Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.classpath7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.cvsignore2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.options7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.project28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.pde.prefs15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF38
-rw-r--r--bundles/org.eclipse.team.cvs.ui/about.html28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/build.properties19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/all_history_mode.gifbin348 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/clear_co.gifbin364 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/collapseall.gifbin155 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/filter_history.gifbin142 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/local_history_mode.gifbin331 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/newstream_wiz.gifbin146 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/refresh.gifbin209 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/remote_history_mode.gifbin209 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/synced.gifbin149 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/annotate.gifbin350 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/checkout.gifbin344 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/cvs_synch.gifbin321 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/history.gifbin335 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/ignorefiles.gifbin228 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newconnect_wiz.gifbin235 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newlocation_wiz.gifbin361 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/share_prj_wiz.gifbin326 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/all_history_mode.gifbin582 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/clear_co.gifbin595 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/collapseall.gifbin157 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/filter_history.gifbin219 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/local_history_mode.gifbin567 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/newstream_wiz.gifbin211 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/refresh.gifbin327 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/remote_history_mode.gifbin328 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gifbin160 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/annotate.gifbin592 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/checkout.gifbin363 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/cvs_synch.gifbin353 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/history.gifbin564 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newconnect_wiz.gifbin362 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newlocation_wiz.gifbin597 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/etool16/share_prj_wiz.gifbin348 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/annotate_view.gifbin594 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/compare_view.gifbin224 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/console_view.gifbin617 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/cvs_persp.gifbin366 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/history_view.gifbin564 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/rep_editors_view.gifbin597 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/eview16/repo_rep.gifbin588 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph1.gifbin585 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph2.gifbin220 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph3.gifbin203 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph4.gifbin327 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph5.gifbin307 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph6.gifbin323 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph7.gifbin328 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph8.gifbin330 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/branches_rep.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/changelog_obj.gifbin596 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gifbin181 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gifbin181 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/import_obj.gifbin351 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/local_entry_tbl.gifbin313 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/module_rep.gifbin585 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/prjversions_rep.gifbin377 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/remote_entry_tbl.gifbin523 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/repository_rep.gifbin545 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/tag.gifbin109 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/versions_rep.gifbin364 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/confauto_ov.gifbin194 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/edited_ov.gifbin167 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/merged_ov.gifbin164 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/no_remotedir_ov.gifbin107 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/question_ov.gifbin79 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/wizban/createpatch_wizban.pngbin7487 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/wizban/import_wiz.pngbin4303 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/wizban/keywordsub_wizban.pngbin8880 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/wizban/mergestream_wizban.pngbin7193 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newconnect_wizban.pngbin5306 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newlocation_wizban.pngbin5996 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties283
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml2386
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java62
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java213
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java236
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java54
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java468
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java473
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java111
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java678
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java90
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java177
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java105
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterAction.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java227
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java1984
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPageSource.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java123
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java661
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java638
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java65
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java646
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java450
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java220
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java45
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceDropAdapter.java29
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceTransfer.java112
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateDescription.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateProvider.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java1178
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java696
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java260
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java245
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java634
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java91
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java232
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java397
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java203
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java203
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java279
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java298
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java437
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java240
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java168
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java377
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java333
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java172
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java196
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java153
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java80
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java355
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java184
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java111
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java104
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UpdateMergePreferencePage.java59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java289
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java362
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java280
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java119
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java112
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java66
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java646
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java52
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java153
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java123
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java116
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java103
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java106
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/FetchAllMembersAction.java36
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java124
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java149
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java87
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java85
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java151
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithLatestRevisionAction.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithSelectableTagAction.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java105
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java205
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java158
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java84
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java283
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java161
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java71
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java149
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java61
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java558
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java218
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java436
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java131
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java104
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java133
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java248
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java562
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetComparator.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetCompareAdapter.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java810
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java221
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetSorter.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java481
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CommitAction.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java114
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java123
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelCompareParticipant.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java247
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelParticipantChangeSetCapability.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java118
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelSynchronizeWizard.java119
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java105
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java222
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceCommitAction.java96
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java265
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java443
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties1196
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java128
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java105
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java159
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java101
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java124
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java160
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java158
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java96
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java147
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java80
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java153
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java254
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java345
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java336
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java123
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java217
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java437
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java537
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java73
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java217
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java446
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java98
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java200
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java145
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FileDiffOperation.java107
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java61
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ProjectMetaFileOperation.java176
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java176
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java397
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java305
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java38
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteProjectFolder.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java191
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java503
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java215
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java279
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java110
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectScopeManager.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectSubscriberContext.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SourceViewerInformationControl.java358
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java195
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java94
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java158
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceFileDiffOperation.java59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceResourceMapper.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java604
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentTemplatesContentHandler.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java62
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/PasteConnectionStringAction.java62
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java170
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java182
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java356
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java168
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesSortingActionGroup.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java437
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java252
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryComparator.java197
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java450
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java972
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java627
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java43
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java456
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java182
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java230
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java346
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java313
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java221
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java111
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchAction.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchWizardParticipant.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java691
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java288
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java173
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java216
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java129
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java430
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java185
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ToolTipMessageDialog.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java83
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java371
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java271
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java55
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java99
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java218
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java138
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java80
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java98
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java142
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java174
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java767
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java164
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java194
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java658
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java332
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java176
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java256
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java144
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java174
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java155
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java332
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java413
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java353
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java244
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java315
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java308
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java502
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java473
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java155
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java180
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java133
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java669
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java1759
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ImportWizard.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java146
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java309
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java286
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java816
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java345
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java228
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java160
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ResizableWizard.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java553
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java560
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java268
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java98
405 files changed, 0 insertions, 67780 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/.classpath b/bundles/org.eclipse.team.cvs.ui/.classpath
deleted file mode 100644
index ce7393340..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.team.cvs.ui/.cvsignore b/bundles/org.eclipse.team.cvs.ui/.cvsignore
deleted file mode 100644
index fe99505dc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-
diff --git a/bundles/org.eclipse.team.cvs.ui/.options b/bundles/org.eclipse.team.cvs.ui/.options
deleted file mode 100644
index 6c209bcfb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.options
+++ /dev/null
@@ -1,7 +0,0 @@
-# Debugging options for the org.eclipse.team.cvs.ui plugin.
-
-# Turn on debugging for the plugin.
-org.eclipse.team.cvs.ui/debug=false
-
-# Shows buffering and flushing of CVS console info to the console document
-org.eclipse.team.cvs.ui/consolebuffering=false
diff --git a/bundles/org.eclipse.team.cvs.ui/.project b/bundles/org.eclipse.team.cvs.ui/.project
deleted file mode 100644
index 36537553d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.team.cvs.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index c4ad2eed2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,69 +0,0 @@
-#Thu Jul 19 13:17:34 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
-org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
-org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
diff --git a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 667149aae..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Jul 18 10:32:47 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org;com;
-org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index 34151974a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,15 +0,0 @@
-#Thu Jan 11 09:43:36 EST 2007
-compilers.incompatible-environment=1
-compilers.p.build=0
-compilers.p.deprecated=1
-compilers.p.missing-packages=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=1
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.use-project=true
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 5e7565c43..000000000
--- a/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,38 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.team.cvs.ui; singleton:=true
-Bundle-Version: 3.3.100.qualifier
-Bundle-Activator: org.eclipse.team.internal.ccvs.ui.CVSUIPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.team.internal.ccvs.ui;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.actions;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.console;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.mappings;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.model;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.operations;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.repo;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.subscriber;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.tags;x-internal:=true,
- org.eclipse.team.internal.ccvs.ui.wizards;x-internal:=true
-Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
- org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
- org.eclipse.jface.text;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
- org.eclipse.ui.workbench.texteditor;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
- org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.resources;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.ui.console;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.team.core;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.team.ui;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.team.cvs.core;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.ui.navigator.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui.navigator;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)"
-Eclipse-LazyStart: true
-Import-Package: com.ibm.icu.text,
- com.ibm.icu.util
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/bundles/org.eclipse.team.cvs.ui/about.html b/bundles/org.eclipse.team.cvs.ui/about.html
deleted file mode 100644
index 460233046..000000000
--- a/bundles/org.eclipse.team.cvs.ui/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/build.properties b/bundles/org.eclipse.team.cvs.ui/build.properties
deleted file mode 100644
index 69ea832da..000000000
--- a/bundles/org.eclipse.team.cvs.ui/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# Eclipse build contribution
-source..=src/
-src.includes=about.html
-bin.includes = about.html,\
- icons/,\
- plugin.xml,\
- plugin.properties,\
- .,\
- META-INF/
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/all_history_mode.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/all_history_mode.gif
deleted file mode 100644
index 80b097815..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/all_history_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/clear_co.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/clear_co.gif
deleted file mode 100644
index 6775edfab..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/collapseall.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/collapseall.gif
deleted file mode 100644
index 7dc0de513..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/filter_history.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/filter_history.gif
deleted file mode 100644
index f6142713a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/filter_history.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/local_history_mode.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/local_history_mode.gif
deleted file mode 100644
index b2e3a3dcf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/local_history_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/newstream_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/newstream_wiz.gif
deleted file mode 100644
index 6e8d4be05..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/newstream_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/refresh.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/refresh.gif
deleted file mode 100644
index 1f551897c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/refresh.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/remote_history_mode.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/remote_history_mode.gif
deleted file mode 100644
index 4576dc563..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/remote_history_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/synced.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/synced.gif
deleted file mode 100644
index 4f6e43a52..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dlcl16/synced.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/annotate.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/annotate.gif
deleted file mode 100644
index e137ea0ab..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/annotate.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/checkout.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/checkout.gif
deleted file mode 100644
index 6bf2ccfb9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/checkout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/cvs_synch.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/cvs_synch.gif
deleted file mode 100644
index 14a075e1e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/cvs_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/history.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/history.gif
deleted file mode 100644
index 6f0d73b77..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/history.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/ignorefiles.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/ignorefiles.gif
deleted file mode 100644
index 75879af82..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/ignorefiles.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newconnect_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newconnect_wiz.gif
deleted file mode 100644
index 28fe673ac..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newconnect_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newlocation_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newlocation_wiz.gif
deleted file mode 100644
index 495e14552..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/newlocation_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/share_prj_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/share_prj_wiz.gif
deleted file mode 100644
index 246a9e856..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/dtool16/share_prj_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/all_history_mode.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/all_history_mode.gif
deleted file mode 100644
index 6c7320c69..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/all_history_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/clear_co.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/clear_co.gif
deleted file mode 100644
index af30a42f8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/collapseall.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/collapseall.gif
deleted file mode 100644
index a2d80a904..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/filter_history.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/filter_history.gif
deleted file mode 100644
index 6fe6f0e10..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/filter_history.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/local_history_mode.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/local_history_mode.gif
deleted file mode 100644
index b39332f8e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/local_history_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/newstream_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/newstream_wiz.gif
deleted file mode 100644
index 045e32c58..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/newstream_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/refresh.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/refresh.gif
deleted file mode 100644
index 3ca04d06f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/refresh.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/remote_history_mode.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/remote_history_mode.gif
deleted file mode 100644
index a15fa5538..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/remote_history_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gif
deleted file mode 100644
index 870934b69..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/annotate.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/annotate.gif
deleted file mode 100644
index 40afd5bfd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/annotate.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/checkout.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/checkout.gif
deleted file mode 100644
index 00e63af3c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/checkout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/cvs_synch.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/cvs_synch.gif
deleted file mode 100644
index b4fa052de..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/cvs_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/history.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/history.gif
deleted file mode 100644
index 07b60c873..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/history.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newconnect_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newconnect_wiz.gif
deleted file mode 100644
index 565a80028..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newconnect_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newlocation_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newlocation_wiz.gif
deleted file mode 100644
index 672b57e78..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/newlocation_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/share_prj_wiz.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/share_prj_wiz.gif
deleted file mode 100644
index d546965fc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/etool16/share_prj_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/annotate_view.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/annotate_view.gif
deleted file mode 100644
index d2108c036..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/annotate_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/compare_view.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/compare_view.gif
deleted file mode 100644
index dc549bce8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/compare_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/console_view.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/console_view.gif
deleted file mode 100644
index 6ef3bca66..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/console_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/cvs_persp.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/cvs_persp.gif
deleted file mode 100644
index c3d56a253..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/cvs_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/history_view.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/history_view.gif
deleted file mode 100644
index c5f904abb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/history_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/rep_editors_view.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/rep_editors_view.gif
deleted file mode 100644
index d28c326de..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/rep_editors_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/repo_rep.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/repo_rep.gif
deleted file mode 100644
index c13bea1ca..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/eview16/repo_rep.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph1.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph1.gif
deleted file mode 100644
index 28466aad2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph1.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph2.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph2.gif
deleted file mode 100644
index ef51bd544..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph2.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph3.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph3.gif
deleted file mode 100644
index f53f01bc3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph3.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph4.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph4.gif
deleted file mode 100644
index 27506f6d7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph4.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph5.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph5.gif
deleted file mode 100644
index 1bccaf868..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph5.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph6.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph6.gif
deleted file mode 100644
index 07164754e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph6.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph7.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph7.gif
deleted file mode 100644
index 32b655e46..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph7.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph8.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph8.gif
deleted file mode 100644
index 5952ed975..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/glyphs/glyph8.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/branches_rep.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/branches_rep.gif
deleted file mode 100644
index 717f3b5b6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/branches_rep.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/changelog_obj.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/changelog_obj.gif
deleted file mode 100644
index f98800321..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/changelog_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gif
deleted file mode 100644
index 96aae05cb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gif
deleted file mode 100644
index 96aae05cb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/import_obj.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/import_obj.gif
deleted file mode 100644
index 487350ef0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/import_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/local_entry_tbl.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/local_entry_tbl.gif
deleted file mode 100644
index 4822bf86c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/local_entry_tbl.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/module_rep.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/module_rep.gif
deleted file mode 100644
index 6372db4fa..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/module_rep.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/prjversions_rep.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/prjversions_rep.gif
deleted file mode 100644
index ba5e76f2d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/prjversions_rep.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/remote_entry_tbl.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/remote_entry_tbl.gif
deleted file mode 100644
index aec2dd90e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/remote_entry_tbl.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/repository_rep.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/repository_rep.gif
deleted file mode 100644
index 0470e1588..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/repository_rep.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/tag.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/tag.gif
deleted file mode 100644
index cded25d29..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/tag.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/versions_rep.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/versions_rep.gif
deleted file mode 100644
index fbe33daa0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/versions_rep.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/confauto_ov.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/confauto_ov.gif
deleted file mode 100644
index e1fd67f06..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/confauto_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/edited_ov.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/edited_ov.gif
deleted file mode 100644
index 48526ac8b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/edited_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/merged_ov.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/merged_ov.gif
deleted file mode 100644
index 186345711..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/merged_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/no_remotedir_ov.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/no_remotedir_ov.gif
deleted file mode 100644
index 131fd63c1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/no_remotedir_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/question_ov.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/question_ov.gif
deleted file mode 100644
index 45ca32060..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/ovr16/question_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/createpatch_wizban.png b/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/createpatch_wizban.png
deleted file mode 100644
index d028e21fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/createpatch_wizban.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/import_wiz.png b/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/import_wiz.png
deleted file mode 100644
index 928bf8399..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/import_wiz.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/keywordsub_wizban.png b/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/keywordsub_wizban.png
deleted file mode 100644
index 4f69e1b4d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/keywordsub_wizban.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/mergestream_wizban.png b/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/mergestream_wizban.png
deleted file mode 100644
index e20272d09..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/mergestream_wizban.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newconnect_wizban.png b/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newconnect_wizban.png
deleted file mode 100644
index 961c27bc7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newconnect_wizban.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newlocation_wizban.png b/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newlocation_wizban.png
deleted file mode 100644
index fae07b216..000000000
--- a/bundles/org.eclipse.team.cvs.ui/icons/full/wizban/newlocation_wizban.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
deleted file mode 100644
index 07e63494f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ /dev/null
@@ -1,283 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-# Maik Schreiber - bug 102461
-###############################################################################
-providerName=Eclipse.org
-pluginName=CVS Team Provider UI
-
-CVS=CVS
-ServerEncoding=Server Encoding
-
-CVSRepositoryExploring=CVS Repository Exploring
-CVSRepositoryExploring.openPerspectiveDescription=Open the CVS Repository Exploring Perspective
-CVSRepositoryExploring.description=This perspective is designed to support the exploration of CVS repositories. It incorporates views for browsing CVS repositories and for browsing file history.
-
-CVSGroupMenu.label=C&VS
-
-SharingWizard.name=CVS
-
-WorkspaceSynchronizeWizard.name=CVS
-WorkspaceSynchronizeWizard.description=Synchronize resources in the workspace with their associated remote CVS repository.
-CVSWorkspaceParticipant=CVS
-CVSResourceMappingParticipant=CVS
-CVSMergeParticipant=CVS Merge
-CVSCompareParticipant=CVS Compare
-
-PreferencePage.name=CVS
-AnnotatePreferencePage.name=Annotate
-CommentTemplatesPreferencePage.name=Comment Templates
-ConsolePreferencePage.name=Console
-ExtMethodPreferencePage.name=Ext Connection Method
-DecoratorPreferencePage.name=Label Decorations
-PasswordManagementPreferencePage.name=Password Management
-ComparePreferencePage.name=Synchronize/Compare
-UpdateMergePreferencePage.name=Update/Merge
-WatchEditPreferencePage.name=Watch/Edit
-
-newWizardCategoryName=CVS
-newProjectCheckoutWizard=Projects from CVS
-newLocationWizard=CVS Repository Location
-newLocationWizardDescription=Create a new CVS repository location
-
-DecoratorStandard.name=CVS
-DecoratorStandard.desc=Shows CVS specific information on resources in projects under CVS control. Information includes the revision number, branch or version name, etc. To customize the CVS decorator go to Team>CVS>Label Decorations.
-
-AddAction.label=Add to &Version Control
-AddAction.name=Add to Version Control
-AddAction.tooltip=Add the Selected Resources to Version Control
-
-MergeAction.label=&Merge...
-MergeAction.name=Merge
-MergeAction.tooltip=Merge
-
-BranchAction.label=&Branch...
-BranchAction.name=Branch
-BranchAction.tooltip=Branch
-
-CompareRemoteResourcesAction.label=Com&pare
-CompareRemoteResourcesAction.tooltip=Compare the Remote Resources with Each Other
-
-CompareRemoteWithTagAction.label=Compare &With...
-CompareRemoteWithTagAction.tooltip=Compare with a Branch or a Version
-
-CompareWithRemoteAction.label=La&test from Repository
-CompareWithRemoteAction.name=Compare With Latest from Repository
-CompareWithRemoteAction.tooltip=Compare with Content on CVS Server
-
-CompareWithRevisionAction.label=&History...
-CompareWithRevisionAction.name=Compare With Revision
-CompareWithRevisionAction.tooltip=Compare with Revision on CVS Server
-
-CompareWithTagAction.label=Another &Branch or Version...
-CompareWithTagAction.name=Compare With Another Branch or Version
-CompareWithTagAction.tooltip=Compare with a Branch or a Version on the CVS Server
-
-OverrideAndUpdateAction.name=Override and Update
-OverrideAndUpdateAction.tooltip=Overwrite the local changes with those from the repository.
-
-OverrideAndCommitAction.name=Override and Commit
-OverrideAndCommitAction.tooltip=Overwrite the changes in the repository with the local changes.
-
-ContentAction.label=Compare File Contents
-ContentAction.tooltip=Use File Contents Instead of Timestamps When Comparing
-
-ConvertNature.label=Convert Provider from Nature
-ConvertNature.tooltip=Converts a CVS project from using natures to using properties
-
-CopyRepositoryNameAction.label=&Copy to Clipboard
-CopyRepositoryNameAction.tooltip=Copy Repository Names to Clipboard
-
-IgnoreAction.label=Add to .cvs&ignore...
-IgnoreAction.name=Add to .cvsignore
-IgnoreAction.tooltip=Ignore the Selected Resources when Synchronizing
-
-RefreshTagsAction.label=Refresh &Branches...
-RefreshTagsAction.tooltip=Refresh the branch tags and their members using the auto-refresh files associated with each remote folder
-
-RemoveRootAction.label=Discard &Location
-RemoveRootAction.tooltip=Discard Location
-
-ReplaceWithRevisionAction.label=&History...
-ReplaceWithRevisionAction.name=Replace With Revision
-ReplaceWithRevisionAction.tooltip=Replace with Revision on CVS Server
-
-ReplaceWithLastRevision.label=Revert to Base
-ReplaceWithLastRevision.name=Revert to Base
-ReplaceWithLastRevision.tooltip=Revert to Base revisions
-
-ReplaceWithTagAction.label=&Another Branch or Version...
-ReplaceWithTagAction.name=Replace With Another Branch or Version
-ReplaceWithTagAction.tooltip=Replace with Branch or Version on the CVS Server
-
-TagAction.label=&Tag as Version...
-TagAction.name=Tag as Version
-TagAction.tooltip=Tag the resources with a CVS version tag
-
-TagInRepositoryAction.label=&Tag as Version...
-TagInRepositoryAction.name=Tag as Version
-TagInRepositoryAction.tooltip=Tag the resources with a CVS version tag
-
-MoveTagAction.label=Tag with &Existing...
-MoveTagAction.tooltip=Tag the selected resources with an existing tag
-
-SetKeywordSubstitutionAction.label=Cha&nge ASCII/Binary Property...
-SetKeywordSubstitutionAction.name=Change ASCII/Binary Property
-SetKeywordSubstitutionAction.tooltip=Change whether the selected resources should be treated as ASCII or binary on the CVS Server
-
-UpdateAction.label=&Update
-UpdateAction.name=Update
-UpdateAction.tooltip=Update resources with new content from the repository
-
-UpdateAllAction.name=Update All Incoming Changes
-UpdateAllAction.tooltip=Update all incoming changes with new content from the repository
-
-UpdateActionSwitch.label=S&witch to Another Branch or Version...
-UpdateActionSwitch.name=Switch to Another Branch or Version
-UpdateActionSwitch.tooltip=Switch to Another Branch or Version
-
-ReplaceWithAction.label=La&test from Repository
-ReplaceWithAction.name=Replace With Latest from Repository
-ReplaceWithAction.tooltip=Replace with last committed content from CVS Server
-
-ConfigureTags.label=Configure &Branches and Versions...
-ConfigureTags.tooltip=Configure the branch and version tags shown in the workbench
-
-AddToBranch.label=Add &to Branch List...
-AddToBranch.tooltip=Add the selected remote folder to a branch
-
-CommitAction.label=&Commit...
-CommitAction.name=Commit
-CommitAction.tooltip=Commit resources to the repository
-
-CommitAllAction.name=Commit All Outgoing Changes
-CommitAllAction.tooltip=Commit all outgoing changes to the repository
-
-CheckoutAction.label=&Check Out
-CheckoutAction.tooltip=Check out a module from the repository to the workspace
-
-CheckoutAsAction.label=Check Out &As...
-CheckoutAsAction.tooltip=Check out a module from the repository to the workspace
-
-OpenLogEntryAction.label=&Open
-OpenLogEntryAction.tooltip=Open Remote File
-
-OpenRemoteFileAction.label=&Open
-OpenRemoteFileAction.tooltip=Open Remote File
-
-ShowHistoryAction.label=Show &History
-ShowHistoryAction.name=Show History
-ShowHistoryAction.tooltip=Show History
-
-ShowAnnotationAction.label=Show Ann&otation
-ShowAnnotationAction.name=Show Annotation
-ShowAnnotationAction.tooltip=Show Annotation
-
-GenerateDiff.label=Create &Patch...
-GenerateDiff.name=Create Patch
-GenerateDiff.tooltip=Compare your workspace contents with the server and generate a diff file that can be used as a patch file.
-
-RefreshFromLocal.label=&Refresh from local CVS state
-RefreshFromLocal.tooltip=Refresh the workbench with changes made to CVS projects from outside the workbench.
-
-Synchronize.label=&Synchronize with Repository
-Synchronize.name=Synchronize with Repository
-Synchronize.tooltip=Synchronize the workspace resources with those in the repository
-
-EditAction.label=&Edit
-EditAction.tooltip=Perform a 'cvs edit' on the selected files
-
-UneditAction.label=U&nedit
-UneditAction.tooltip=Perform a 'cvs unedit' on the selected files
-
-viewCategory=CVS
-
-Console.name=CVS Console
-
-RepositoriesView.name=CVS Repositories
-
-HistoryFilter.label=&Filter History
-HistoryFilter.tooltip=Filter History
-
-HistoryView.name=CVS Resource History
-
-UnmanageFolder.label=&Disconnect...
-UnmanageFolder.tooltip=Disconnect from the CVS repository.
-
-CVSActionSet.categoryName=CVS
-CVSActionSet.description=Actions that apply when working with CVS repositories
-CVSActionSet.newLabel=Add CVS Repository
-CVSActionSet.newTooltip=Add CVS Repository
-CVSActionSet.checkoutLabel=Checkout from CVS
-CVSActionSet.checkoutTooltip=Checkout from CVS
-
-RestoreFromRepositoryAction.label=&Restore from Repository...
-RestoreFromRepositoryAction.tooltip=Restore resources that have been deleted from the remote folder.
-
-ShowEditorsAction.label=Show &Editors
-ShowEditorsAction.tooltip=Perform a 'cvs editors' on the selected file
-
-EditorsView.name=CVS Editors
-CVSConsoleFont.label=CVS Console Font
-CVSConsoleFont.description=The font for the CVS console.
-
-WorkInProgress.name=Work In Progress
-CVSRemoteQuickDiffProvider.label=&Latest CVS Revision
-
-NewDateTagAction.label=&Date Tag...
-NewDateTagAction.tooltip=Add new date tag
-
-ViewCommand.repositoriesView.name=CVS Repositories
-ViewCommand.repositoriesView.description=Show the CVS Repositories view
-ViewCommand.editorsView.name=CVS Editors
-ViewCommand.editorsView.description=Show the CVS Editors view
-
-newProjectCheckoutWizardDescription=Checkout one or more projects from a CVS Repository.
-newProjectCheckoutWizardDescription2=Create a new project by checking out an existing project from a CVS repository.
-
-OutgoingChangeForegroundColor.label=Outgoing Change (Foreground)
-OutgoingChangeForegroundColor.description=This color is used for the foreground color for resources that have outgoing changes.
-OutgoingChangeBackgroundColor.label=Outgoing Change (Background)
-OutgoingChangeBackgroundColor.description=This color is used for the background color for resources that have outgoing changes.
-OutgoingChangeFont.label=Outgoing Change Font
-OutgoingChangeFont.description=The font used to display outgoing changes.
-IgnoredResourceFont.label=Ignored Resource Font
-IgnoredResourceFont.description=The font used to display resources that are ignored from CVS.
-IgnoredResourceForegroundColor.label=Ignored Resource (Foreground)
-IgnoredResourceForegroundColor.description=This color is used for the foreground color for resources that are ignored from CVS.
-IgnoredResourceBackgroundColor.label=Ignored Resource (Background)
-IgnoredResourceBackgroundColor.description=This color is used for the background color for resources that are ignored from CVS.
-CVSHistoryCategory.label=CVS History Page Categories (Foreground)
-CVSHistoryCategory.description=This color is used for the foreground color for all categories diplayed for CVS resources in the history view.
-
-PreferenceKeywords.CVS=cvs team share timeout connection
-PreferenceKeywords.Annotate=cvs team annotate
-PreferenceKeywords.Comment=cvs team comment templates
-PreferenceKeywords.Console=cvs team console colors
-PreferenceKeywords.EXT=cvs team ext connection method ssh ssh2
-PreferenceKeywords.Decorator=cvs team label decorations text icons flag
-PreferenceKeywords.Password=cvs team password management username
-PreferenceKeywords.Compare=cvs team compare synchronize model change set
-PreferenceKeywords.Update=cvs team update merge conflict
-PreferenceKeywords.Watch=cvs team watch editors notification
-
-RepoPreference.Name=CVS Repositories
-RepoPreference.Description=Preferences that contain the CVS repository connection information
-
-FetchAllMembers.label=Expand All
-FetchAllMembers.tooltip=Expand the entire folder in a single round trip
-
-HistoryView.Compare.label = &Compare
-HistoryView.Open.label = &Open
-
-ChangeSets = CVS Change Sets
-newLocation.description = Add a new CVS repository location
-newLocation.name = Add Repository Location
-
-PasteConnectionaction.label=&Paste Connection
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
deleted file mode 100644
index 5202b3bd0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ /dev/null
@@ -1,2386 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
-
-<!-- *************** Synchronize Wizards **************** -->
- <extension
- point="org.eclipse.team.ui.synchronizeWizards">
- <wizard
- class="org.eclipse.team.internal.ccvs.ui.mappings.ModelSynchronizeWizard"
- name="%WorkspaceSynchronizeWizard.name"
- description="%WorkspaceSynchronizeWizard.description"
- icon="$nl$/icons/full/eview16/cvs_persp.gif"
- id="org.eclipse.team.cvs.ui.ModelSynchronizeWizard"/>
- </extension>
-<!-- *************** Console Factory **************** -->
- <extension
- point="org.eclipse.ui.console.consoleFactories">
- <consoleFactory
- label="%CVS"
- icon="$nl$/icons/full/eview16/console_view.gif"
- class="org.eclipse.team.internal.ccvs.ui.console.CVSConsoleFactory"/>
- </extension>
- <extension
- point="org.eclipse.ui.console.consolePageParticipants">
- <consolePageParticipant
- class="org.eclipse.team.internal.ccvs.ui.console.CVSConsolePageParticipant"
- id="org.eclipse.team.internal.ccvs.ui.console.CVSConsolePageParticipant">
- <enablement>
- <instanceof value="org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole"/>
- </enablement>
- </consolePageParticipant>
- </extension>
-
-<!-- *************** Synchronize View Participant **************** -->
- <extension
- point="org.eclipse.team.ui.synchronizeParticipants">
- <participant
- name="%CVSWorkspaceParticipant"
- icon="$nl$/icons/full/eview16/cvs_persp.gif"
- class="org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant"
- id="org.eclipse.team.cvs.ui.cvsworkspace-participant">
- </participant>
- <participant
- name="%CVSResourceMappingParticipant"
- icon="$nl$/icons/full/eview16/cvs_persp.gif"
- class="org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceModelParticipant"
- id="org.eclipse.team.cvs.ui.workspace-participant">
- </participant>
- <participant
- name="%CVSMergeParticipant"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- class="org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant"
- id="org.eclipse.team.cvs.ui.cvsmerge-participant">
- </participant>
- <participant
- persistent="false"
- name="%CVSCompareParticipant"
- icon="$nl$/icons/full/eview16/compare_view.gif"
- class="org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant"
- id="org.eclipse.team.cvs.ui.compare-participant">
- </participant>
- <participant
- class="org.eclipse.team.internal.ccvs.ui.mappings.ModelCompareParticipant"
- icon="$nl$/icons/full/eview16/compare_view.gif"
- id="org.eclipse.team.cvs.ui.modelCompareParticipant"
- name="%CVSCompareParticipant"
- persistent="false"/>
- <participant
- class="org.eclipse.team.internal.ccvs.ui.mappings.ModelMergeParticipant"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- id="org.eclipse.team.cvs.ui.modelMergeParticipant"
- name="%CVSMergeParticipant"
- persistent="true"/>
- </extension>
-
- <extension
- point="org.eclipse.ui.navigator.viewer">
- <viewer
- viewerId="org.eclipse.team.cvs.ui.workspaceSynchronization">
- <popupMenu
- allowsPlatformContributions="false"
- id="org.eclipse.team.cvs.ui.workspaceSynchronizationMenu">
- <insertionPoint name="file"/>
- <insertionPoint name="file-bottom"/>
- <insertionPoint name="edit" separator="true"/>
- <insertionPoint name="synchronize"/>
- <insertionPoint
- name="navigate"
- separator="true"/>
- <insertionPoint
- name="update"
- separator="true"/>
- <insertionPoint
- name="commit"
- separator="false"/>
- <insertionPoint
- name="overrideActions"
- separator="true"/>
- <insertionPoint
- name="otherActions1"
- separator="true"/>
- <insertionPoint
- name="otherActions2"
- separator="true"/>
- <insertionPoint
- name="changeSetActions"
- separator="true"/>
- <insertionPoint
- name="sort"
- separator="true"/>
- <insertionPoint
- name="additions"
- separator="true"/>
- <insertionPoint
- name="properties"
- separator="true"/>
- </popupMenu>
- </viewer>
- <viewer viewerId="org.eclipse.team.cvs.ui.mergeSynchronization">
- <popupMenu
- allowsPlatformContributions="false"
- id="org.eclipse.team.cvs.ui.mergeSynchronizationMenu">
- <insertionPoint name="file"/>
- <insertionPoint name="edit" separator="true"/>
- <insertionPoint name="synchronize"/>
- <insertionPoint
- name="navigate"
- separator="true"/>
- <insertionPoint
- name="merge"
- separator="true"/>
- <insertionPoint
- name="other"
- separator="true"/>
- <insertionPoint
- name="otherActions1"
- separator="true"/>
- <insertionPoint
- name="changeSetActions"
- separator="true"/>
- <insertionPoint
- name="sort"
- separator="true"/>
- <insertionPoint
- name="additions"
- separator="true"/>
- <insertionPoint
- name="properties"
- separator="true"/>
- </popupMenu>
- </viewer>
- <viewer viewerId="org.eclipse.team.cvs.ui.compareSynchronization">
- <popupMenu
- allowsPlatformContributions="false"
- id="org.eclipse.team.cvs.ui.compareSynchronizationMenu">
- <insertionPoint name="file"/>
- <insertionPoint name="file-bottom"/>
- <insertionPoint name="edit"/>
- <insertionPoint name="synchronize"/>
- <insertionPoint
- name="navigate"
- separator="true"/>
- <insertionPoint
- name="merge"
- separator="true"/>
- <insertionPoint
- name="other"
- separator="true"/>
- <insertionPoint
- name="changeSetActions"
- separator="true"/>
- <insertionPoint
- name="sort"
- separator="true"/>
- <insertionPoint
- name="additions"
- separator="true"/>
- <insertionPoint
- name="properties"
- separator="true"/>
- </popupMenu>
- </viewer>
- </extension>
-
-<!-- *************** Authenticator **************** -->
- <extension
- point="org.eclipse.team.cvs.core.authenticator">
- <authenticator>
- <run
- class="org.eclipse.team.internal.ccvs.ui.WorkbenchUserAuthenticator">
- </run>
- </authenticator>
- </extension>
-<!-- *************** CVS File Modification Validator **************** -->
- <extension
- point="org.eclipse.team.cvs.core.filemodificationvalidator">
- <validator>
- <run
- class="org.eclipse.team.internal.ccvs.ui.FileModificationValidator">
- </run>
- </validator>
- </extension>
-<!-- ************** Project Sets (for backwards compatibility) **************** -->
- <extension point="org.eclipse.team.core.projectSets">
- <projectSets id="org.eclipse.team.cvs.core.cvsnature" class="org.eclipse.team.internal.ccvs.ui.CVSProjectSetSerializer"/>
- </extension>
-<!-- ******************* Configurationb Wizard ****************** -->
- <extension
- point="org.eclipse.team.ui.configurationWizards">
- <wizard
- name="%SharingWizard.name"
- icon="$nl$/icons/full/etool16/newconnect_wiz.gif"
- class="org.eclipse.team.internal.ccvs.ui.wizards.SharingWizard"
- id="org.eclipse.team.ccvs.ui.SharingWizard">
- </wizard>
- </extension>
-<!-- ************** Property Pages *************** -->
- <extension
- point="org.eclipse.ui.propertyPages">
- <page
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true"
- name="%CVS"
- class="org.eclipse.team.internal.ccvs.ui.CVSFilePropertiesPage"
- id="org.eclipse.team.ccvs.ui.propertyPages.CVSFilePropertiesPage">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
- </filter>
- </page>
- <page
- objectClass="org.eclipse.core.resources.IFolder"
- adaptable="true"
- name="%CVS"
- class="org.eclipse.team.internal.ccvs.ui.CVSFolderPropertiesPage"
- id="org.eclipse.team.ccvs.ui.propertyPages.CVSFolderPropertiesPage">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
- </filter>
- </page>
- <page
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true"
- name="%CVS"
- class="org.eclipse.team.internal.ccvs.ui.CVSProjectPropertiesPage"
- id="org.eclipse.team.ccvs.ui.propertyPages.CVSProjectPropertiesPage">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
- </filter>
- </page>
- <page
- objectClass="org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot"
- name="%CVS"
- class="org.eclipse.team.internal.ccvs.ui.repo.CVSRepositoryPropertiesPage"
- id="org.eclipse.team.ccvs.ui.propertyPages.CVSRepositoryPropertiesPage">
- </page>
- <page
- objectClass="org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot"
- name="%ServerEncoding"
- class="org.eclipse.team.internal.ccvs.ui.repo.RepositoryEncodingPropertyPage"
- id="org.eclipse.team.ccvs.ui.propertyPages.RepositoryEncodingPage">
- </page>
- </extension>
-<!-- ******************* Menus ******************** -->
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true"
- id="org.eclipse.team.ccvs.ui.IFileContributions">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
- </filter>
- <action
- helpContextId="org.eclipse.team.cvs.ui.show_in_history_action_context"
- label="%ShowHistoryAction.label"
- definitionId="org.eclipse.team.cvs.ui.showHistory"
- icon="$nl$/icons/full/etool16/history.gif"
- tooltip="%ShowHistoryAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction"
- menubarPath="team.main/group2"
- overrideActionId="org.eclipse.team.ui.showLocalHistory"
- id="org.eclipse.team.cvs.ui.showHistory">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
- label="%ShowAnnotationAction.label"
- definitionId="org.eclipse.team.cvs.ui.showAnnotation"
- icon="$nl$/icons/full/etool16/annotate.gif"
- tooltip="%ShowAnnotationAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
- menubarPath="team.main/group2"
- id="org.eclipse.team.cvs.ui.showAnnotation">
- </action>
- <action
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction"
- definitionId="org.eclipse.team.cvs.ui.compareWithRevision"
- helpContextId="org.eclipse.team.cvs.ui.compare_with_revision_action_context"
- id="org.eclipse.team.cvs.ui.compareWithRevision"
- label="%CompareWithRevisionAction.label"
- menubarPath="compareWithMenu/compareWithGroup"
- overrideActionId="org.eclipse.team.ui.compareLocalHistory"
- tooltip="%CompareWithRevisionAction.tooltip">
- </action>
- <action
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRevisionAction"
- definitionId="org.eclipse.team.cvs.ui.replaceWithRevision"
- helpContextId="org.eclipse.team.cvs.ui.replace_with_revision_action_context"
- id="org.eclipse.team.cvs.ui.replaceWithRevision"
- label="%ReplaceWithRevisionAction.label"
- menubarPath="replaceWithMenu/replaceWithGroup"
- overrideActionId="org.eclipse.team.ui.replaceLocalHistory"
- tooltip="%ReplaceWithRevisionAction.tooltip">
- </action>
- <action
- label="%EditAction.label"
- helpContextId="org.eclipse.team.cvs.ui.team_edit_action_context"
- tooltip="%EditAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.EditAction"
- menubarPath="team.main/group4"
- id="org.eclipse.team.ccvs.ui.edit">
- </action>
- <action
- label="%UneditAction.label"
- helpContextId="org.eclipse.team.cvs.ui.team_unedit_action_context"
- tooltip="%UneditAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.UneditAction"
- menubarPath="team.main/group4"
- id="org.eclipse.team.ccvs.ui.unedit">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- id="org.eclipse.team.ccvs.ui.IResourceContributions">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
- </filter>
- <action
- label="%ShowEditorsAction.label"
- helpContextId="org.eclipse.team.cvs.ui.team_show_editors_action_context"
- tooltip="%ShowEditorsAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowEditorsAction"
- menubarPath="team.main/group4"
- id="org.eclipse.team.ccvs.ui.showeditors">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
- adaptable="true"
- id="org.eclipse.team.ccvs.ui.ResourceMapperContributions">
- <enablement>
- <adapt type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test property="org.eclipse.core.resources.projectPersistentProperty" args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature" />
- </adapt>
- </enablement>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_set_keyword_mode_action_context"
- label="%SetKeywordSubstitutionAction.label"
- definitionId="org.eclipse.team.cvs.ui.setKeywordSubstitution"
- class="org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction"
- tooltip="%SetKeywordSubstitutionAction.tooltip"
- menubarPath="team.main/group3"
- id="org.eclipse.team.cvs.ui.setKeywordSubstitution">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_switch_action_context"
- label="%UpdateActionSwitch.label"
- definitionId="org.eclipse.team.cvs.ui.updateSwitch"
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateAction"
- tooltip="%UpdateActionSwitch.tooltip"
- menubarPath="team.main/group2"
- id="org.eclipse.team.cvs.ui.updateSwitch">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_merge_action_context"
- label="%MergeAction.label"
- definitionId="org.eclipse.team.cvs.ui.merge"
- tooltip="%MergeAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.MergeAction"
- icon="$nl$/icons/full/obj16/branches_rep.gif"
- menubarPath="team.main/group2"
- id="org.eclipse.team.cvs.ui.merge">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_branch_action_context"
- label="%BranchAction.label"
- definitionId="org.eclipse.team.cvs.ui.branch"
- tooltip="%BranchAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- menubarPath="team.main/group2"
- id="org.eclipse.team.cvs.ui.branch">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_tag_as_version_action_context"
- label="%TagAction.label"
- definitionId="org.eclipse.team.cvs.ui.tag"
- tooltip="%TagAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.TagLocalAction"
- icon="$nl$/icons/full/obj16/versions_rep.gif"
- menubarPath="team.main/group2"
- id="org.eclipse.team.cvs.ui.tag">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.compare_with_tag_action_context"
- label="%CompareWithTagAction.label"
- definitionId="org.eclipse.team.cvs.ui.compareWithTag"
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareWithTagAction"
- tooltip="%CompareWithTagAction.tooltip"
- menubarPath="compareWithMenu/compareWithGroup"
- id="org.eclipse.team.cvs.ui.compareWithTag">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.compare_with_latest_action_context"
- label="%CompareWithRemoteAction.label"
- definitionId="org.eclipse.team.cvs.ui.compareWithRemote"
- tooltip="%CompareWithRemoteAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareWithRemoteAction"
- menubarPath="compareWithMenu/compareWithGroup"
- id="org.eclipse.team.cvs.ui.compareWithRemote">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.replace_with_tag_action_context"
- label="%ReplaceWithTagAction.label"
- definitionId="org.eclipse.team.cvs.ui.replaceWithTag"
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithSelectableTagAction"
- tooltip="%ReplaceWithTagAction.tooltip"
- menubarPath="replaceWithMenu/replaceWithGroup"
- id="org.eclipse.team.cvs.ui.replaceWithTag">
- </action>
- <action
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithLatestRevisionAction"
- definitionId="org.eclipse.team.cvs.ui.replaceWithBase"
- helpContextId="org.eclipse.team.cvs.ui.replace_with_tag_action_context"
- id="org.eclipse.team.cvs.ui.replaceWithBase"
- label="%ReplaceWithLastRevision.label"
- menubarPath="team.main/group4"
- tooltip="%ReplaceWithLastRevision.tooltip">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.replace_with_latest_action_context"
- label="%ReplaceWithAction.label"
- definitionId="org.eclipse.team.cvs.ui.replace"
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction"
- tooltip="%ReplaceWithAction.tooltip"
- menubarPath="replaceWithMenu/replaceWithGroup"
- id="org.eclipse.team.cvs.ui.replace">
- </action>
- <action
- class="org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction"
- definitionId="org.eclipse.team.cvs.ui.GenerateDiff"
- helpContextId="org.eclipse.team.cvs.ui.team_create_patch_action_context"
- id="org.eclipse.team.cvs.ui.GenerateDiff"
- label="%GenerateDiff.label"
- menubarPath="team.main/group1"
- tooltip="%GenerateDiff.tooltip"/>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_update_action_context"
- label="%UpdateAction.label"
- definitionId="org.eclipse.team.cvs.ui.update"
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateSilentAction"
- tooltip="%UpdateAction.tooltip"
- menubarPath="team.main/group1"
- id="org.eclipse.team.ccvs.ui.update">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_commit_action_context"
- label="%CommitAction.label"
- definitionId="org.eclipse.team.cvs.ui.commit"
- class="org.eclipse.team.internal.ccvs.ui.actions.CommitAction"
- tooltip="%CommitAction.tooltip"
- menubarPath="team.main/group1"
- id="org.eclipse.team.ccvs.ui.commit">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_synchronize_action_context"
- label="%Synchronize.label"
- tooltip="%Synchronize.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.SyncAction"
- definitionId="org.eclipse.team.cvs.ui.sync"
- menubarPath="team.main/group1"
- id="org.eclipse.team.cvs.ui.sync">
- </action>
- <action
- label="%RestoreFromRepositoryAction.label"
- helpContextId="org.eclipse.team.cvs.ui.team_restore_from_repository_action_context"
- tooltip="%RestoreFromRepositoryAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.RestoreFromRepositoryAction"
- menubarPath="team.main/group4"
- id="org.eclipse.team.ccvs.ui.restoreFromRepository">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_ignore_action_context"
- label="%IgnoreAction.label"
- definitionId="org.eclipse.team.cvs.ui.ignore"
- class="org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction"
- tooltip="%IgnoreAction.tooltip"
- menubarPath="team.main/group3"
- id="org.eclipse.team.cvs.ui.ignore">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_add_action_context"
- label="%AddAction.label"
- definitionId="org.eclipse.team.cvs.ui.add"
- class="org.eclipse.team.internal.ccvs.ui.actions.AddAction"
- tooltip="%AddAction.tooltip"
- menubarPath="team.main/group3"
- id="org.eclipse.team.cvs.ui.add">
- </action>
- </objectContribution>
-<!-- ************** Project Menu *************** -->
- <objectContribution
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true"
- id="org.eclipse.team.ccvs.ui.IProjectContributions">
- <filter
- name="projectPersistentProperty"
- value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
- </filter>
- <action
- label="%UnmanageFolder.label"
- helpContextId="org.eclipse.team.cvs.ui.team_disconnect_action_context"
- tooltip="%UnmanageFolder.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.UnmanageAction"
- menubarPath="team.main/projectGroup"
- id="org.eclipse.team.ccvs.ui.unmanage">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder"
- id="org.eclipse.team.ccvs.ui.RemoteFolderContributions">
- <action
- label="%CheckoutAsAction.label"
- helpContextId="org.eclipse.team.cvs.ui.checkout_as_action_context"
- tooltip="%CheckoutAsAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CheckoutAsAction"
- menubarPath="checkoutGroup"
- id="org.eclipse.team.ccvs.ui.checkoutAs">
- </action>
- <action
- label="%CheckoutAction.label"
- helpContextId="org.eclipse.team.cvs.ui.checkout_as_project_action_context"
- tooltip="%CheckoutAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CheckoutAction"
- menubarPath="checkoutGroup"
- id="org.eclipse.team.ccvs.ui.checkout">
- </action>
- <action
- label="%ConfigureTags.label"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- helpContextId="org.eclipse.team.cvs.ui.tag_configuration_overview"
- tooltip="%ConfigureTags.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ConfigureTagsFromRepoViewOnFolder"
- menubarPath="miscGroup"
- id="org.eclipse.team.ccvs.ui.configureTagsOnRemoteFolder">
- </action>
- <action
- label="%AddToBranch.label"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- helpContextId="org.eclipse.team.cvs.ui.add_to_branch_context"
- tooltip="%AddToBranch.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.repo.AddToBranchAction"
- menubarPath="miscGroup"
- id="org.eclipse.team.ccvs.ui.addToBranch">
- </action>
- <action
- class="org.eclipse.team.internal.ccvs.ui.actions.FetchAllMembersAction"
- id="org.eclipse.team.ccvs.ui.fetchAllMembers"
- label="%FetchAllMembers.label"
- tooltip="%FetchAllMembers.tooltip"
- menubarPath="miscGroup"/>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.core.ICVSRemoteFile"
- id="org.eclipse.team.ccvs.ui.RemoteFileContributions">
- <action
- label="%OpenRemoteFileAction.label"
- helpContextId="org.eclipse.team.cvs.ui.open_remote_file_action_context"
- tooltip="%OpenRemoteFileAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.OpenRemoteFileAction"
- id="org.eclipse.team.ccvs.ui.openRemoteFile">
- </action>
- <action
- label="%ShowHistoryAction.label"
- icon="$nl$/icons/full/etool16/history.gif"
- helpContextId="org.eclipse.team.cvs.ui.show_in_history_action_context"
- tooltip="%ShowHistoryAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowHistoryAction"
- id="org.eclipse.team.ccvs.ui.showHistory">
- </action>
- <action
- label="%ShowAnnotationAction.label"
- icon="$nl$/icons/full/etool16/annotate.gif"
- helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
- tooltip="%ShowAnnotationAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
- id="org.eclipse.team.ccvs.ui.showAnnotation">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.core.ILogEntry"
- id="org.eclipse.team.ccvs.ui.LogEntryContributions">
- <action
- label="%OpenLogEntryAction.label"
- helpContextId="org.eclipse.team.cvs.ui.open_remote_file_action_context"
- tooltip="%OpenLogEntryAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction"
- id="org.eclipse.team.ccvs.ui.openLogEntry">
- </action>
- <action
- label="%CompareRemoteResourcesAction.label"
- helpContextId="org.eclipse.team.cvs.ui.compare_remote_resources_action_context"
- tooltip="%CompareRemoteResourcesAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareRemoteResourcesAction"
- enablesFor="2"
- id="org.eclipse.team.ccvs.ui.compareLogEntries">
- </action>
- <action
- label="%ShowAnnotationAction.label"
- icon="$nl$/icons/full/etool16/annotate.gif"
- helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
- tooltip="%ShowAnnotationAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
- id="org.eclipse.team.ccvs.ui.showAnnotation">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.ui.model.RemoteModule"
- id="org.eclipse.team.ccvs.ui.VersionCategoryContributions">
- <action
- label="%ConfigureTags.label"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- helpContextId="org.eclipse.team.cvs.ui.tag_configuration_overview"
- tooltip="%ConfigureTags.label"
- class="org.eclipse.team.internal.ccvs.ui.actions.ConfigureTagsFromRepoViewOnFolder"
- id="org.eclipse.team.ccvs.ui.configureTagsOnRemoteModule">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot"
- id="org.eclipse.team.ccvs.ui.RemoteRootContributions">
- <action
- label="%CopyRepositoryNameAction.label"
- helpContextId="org.eclipse.team.cvs.ui.copy_repository_name_action_context"
- tooltip="%CopyRepositoryNameAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.repo.CopyRepositoryNameAction"
- menubarPath="miscGroup"
- id="org.eclipse.team.ccvs.ui.copyNames">
- </action>
- <action
- label="%RefreshTagsAction.label"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- helpContextId="org.eclipse.team.cvs.ui.refresh_tags_action_context"
- tooltip="%RefreshTagsAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.repo.RefreshTagsAction"
- menubarPath="tagGroup"
- id="org.eclipse.team.ccvs.ui.refreshTags">
- </action>
- <action
- label="%NewDateTagAction.label"
- icon="$nl$/icons/full/obj16/date.gif"
- helpContextId="org.eclipse.team.cvs.ui.new_date_tag_action_context"
- class="org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction"
- tooltip="%NewDateTagAction.tooltip"
- menubarPath="group.add/group1"
- id="org.eclipse.team.ccvs.ui.newDateTag">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.ui.model.DateTagCategory"
- id="org.eclipse.team.ccvs.ui.DateCategoryContributions">
- <action
- label="%NewDateTagAction.label"
- icon="$nl$/icons/full/obj16/date.gif"
- helpContextId="org.eclipse.team.cvs.ui.new_date_tag_action_context"
- class="org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction"
- tooltip="%NewDateTagAction.tooltip"
- menubarPath="group.add/group1"
- id="org.eclipse.team.ccvs.ui.newDateTag">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.ui.model.BranchCategory"
- id="org.eclipse.team.ccvs.ui.model.BranchCategoryContributions">
- <action
- label="%RefreshTagsAction.label"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- helpContextId="org.eclipse.team.cvs.ui.refresh_tags_action_context"
- tooltip="%RefreshTagsAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.repo.RefreshTagsAction"
- menubarPath="tagGroup"
- id="org.eclipse.team.ccvs.ui.refreshTags">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.team.internal.ccvs.core.ICVSRemoteResource"
- id="org.eclipse.team.ccvs.ui.RemoteResourceContributions">
- <action
- label="%CompareRemoteResourcesAction.label"
- helpContextId="org.eclipse.team.cvs.ui.compare_remote_resources_action_context"
- tooltip="%CompareRemoteResourcesAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareRemoteResourcesAction"
- menubarPath="miscGroup"
- enablesFor="2"
- id="org.eclipse.team.ccvs.ui.compareRemoteResources">
- </action>
- <action
- label="%CompareRemoteWithTagAction.label"
- helpContextId="org.eclipse.team.cvs.ui.compare_remote_with_tag_action_context"
- tooltip="%CompareRemoteWithTagAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareRemoteWithTagAction"
- menubarPath="miscGroup"
- id="org.eclipse.team.ccvs.ui.compareRemoteWithTag">
- </action>
- <action
- label="%MoveTagAction.label"
- helpContextId="org.eclipse.team.cvs.ui.move_remote_tag_action_context"
- tooltip="%MoveTagAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.MoveRemoteTagAction"
- menubarPath="tagGroup"
- id="org.eclipse.team.ccvs.ui.moveTagInRepository">
- </action>
- <action
- label="%TagInRepositoryAction.label"
- icon="$nl$/icons/full/obj16/versions_rep.gif"
- helpContextId="org.eclipse.team.cvs.ui.tag_remote_action_context"
- tooltip="%TagInRepositoryAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.TagInRepositoryAction"
- menubarPath="tagGroup"
- id="org.eclipse.team.ccvs.ui.tagInRepository">
- </action>
- </objectContribution>
- <objectContribution
- adaptable="false"
- id="org.eclipse.team.ui.FileRevisionsContribution"
- objectClass="org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision">
- <action
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
- helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
- icon="$nl$/icons/full/etool16/annotate.gif"
- id="org.eclipse.team.ccvs.ui.AnnotateRevisionAction"
- label="%ShowAnnotationAction.label"
- tooltip="%ShowAnnotationAction.tooltip"/>
- </objectContribution>
- <viewerContribution
- id="org.eclipse.team.ccvs.ui.RepositoriesViewContributions"
- targetID="org.eclipse.team.ccvs.ui.RepositoriesView">
- <action
- class="org.eclipse.team.internal.ccvs.ui.repo.PasteConnectionStringAction"
- definitionId="org.eclipse.ui.edit.paste"
- enablesFor="*"
- id="org.eclipse.team.cvs.ui.patch.pasteConnection"
- label="%PasteConnectionaction.label"
- menubarPath="miscGroup"/>
- </viewerContribution>
- </extension>
-
-<!-- ************** Model Element Contributions ********************** -->
-
-<!-- ************** Views ********************** -->
- <extension
- point="org.eclipse.ui.views">
- <category
- name="%viewCategory"
- id="org.eclipse.team.ccvs.ui">
- </category>
- <view
- name="%RepositoriesView.name"
- icon="$nl$/icons/full/eview16/repo_rep.gif"
- category="org.eclipse.team.ccvs.ui"
- fastViewWidthRatio="0.5"
- class="org.eclipse.team.internal.ccvs.ui.repo.RepositoriesView"
- id="org.eclipse.team.ccvs.ui.RepositoriesView">
- </view>
- <view
- name="%EditorsView.name"
- icon="$nl$/icons/full/eview16/rep_editors_view.gif"
- category="org.eclipse.team.ccvs.ui"
- class="org.eclipse.team.internal.ccvs.ui.EditorsView"
- id="org.eclipse.team.ccvs.ui.EditorsView">
- </view>
- </extension>
-<!-- **************** Preferences ******************* -->
- <extension
- point="org.eclipse.ui.keywords">
- <keyword
- label="%PreferenceKeywords.CVS"
- id="org.eclipse.team.cvs.ui.cvs"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.annotate"
- label="%PreferenceKeywords.Annotate"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.comment"
- label="%PreferenceKeywords.Comment"/>
- <keyword
- label="%PreferenceKeywords.Console"
- id="org.eclipse.team.cvs.ui.cvs.console"/>
- <keyword
- label="%PreferenceKeywords.EXT"
- id="org.eclipse.team.cvs.ui.cvs.ext"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.decorator"
- label="%PreferenceKeywords.Decorator"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.password"
- label="%PreferenceKeywords.Password"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.compare"
- label="%PreferenceKeywords.Compare"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.update"
- label="%PreferenceKeywords.Update"/>
- <keyword
- id="org.eclipse.team.cvs.ui.cvs.watch"
- label="%PreferenceKeywords.Watch"/>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%PreferencePage.name"
- category="org.eclipse.team.ui.TeamPreferences"
- class="org.eclipse.team.internal.ccvs.ui.CVSPreferencesPage"
- id="org.eclipse.team.cvs.ui.CVSPreferences">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%ComparePreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.ComparePreferencePage"
- id="org.eclipse.team.cvs.ui.ComparePreferences">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.compare"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%CommentTemplatesPreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.CommentTemplatesPreferencePage"
- id="org.eclipse.team.cvs.ui.CommentTemplatesPreferences">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.comment"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%ConsolePreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.console.ConsolePreferencesPage"
- id="org.eclipse.team.cvs.ui.ConsolePreferences">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.console"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%DecoratorPreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.CVSDecoratorPreferencesPage"
- id="org.eclipse.team.cvs.ui.CVSDecoratorPreferences">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.decorator"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%ExtMethodPreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.ExtMethodPreferencePage"
- id="org.eclipse.team.cvs.ui.ExtMethodPreferencePage">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.ext"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%WatchEditPreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.WatchEditPreferencePage"
- id="org.eclipse.team.cvs.ui.WatchEditPreferencePage">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.watch"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%PasswordManagementPreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.PasswordManagementPreferencePage"
- id="org.eclipse.team.cvs.ui.PasswordManagementPreferencePage">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.password"/>
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.UpdateMergePreferencePage"
- id="org.eclipse.team.cvs.ui.UpdateMergePreferences"
- name="%UpdateMergePreferencePage.name">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.update"/>
- </page>
- </extension>
-
-
-
-<!-- **************** Decorator ******************* -->
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- lightweight="true"
- adaptable="true"
- location="BOTTOM_RIGHT"
- label="%DecoratorStandard.name"
- state="false"
- class="org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator"
- id="org.eclipse.team.cvs.ui.decorator">
- <description>
- %DecoratorStandard.desc
- </description>
- <enablement>
- <objectClass name="org.eclipse.core.resources.mapping.ResourceMapping"/>
- </enablement>
- </decorator>
- </extension>
-<!-- *************** View Actions **************** -->
- <extension
- point="org.eclipse.ui.viewActions">
- <viewContribution
- targetID="org.eclipse.team.ccvs.ui.RepositoriesView"
- id="org.eclipse.team.cvs.ui.repoview_actions">
- <action
- label="%CVSActionSet.newLabel"
- icon="$nl$/icons/full/etool16/newlocation_wiz.gif"
- tooltip="%CVSActionSet.newTooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.NewRepositoryAction"
- toolbarPath="actions"
- definitionId="org.eclipse.team.cvs.ui.addLocation"
- id="org.eclipse.team.cvs.ui.actions.repoview.NewRepositoryAction">
- </action>
- </viewContribution>
- </extension>
-<!-- **************** CVS Perspective ******************* -->
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="%CVSRepositoryExploring"
- icon="$nl$/icons/full/eview16/cvs_persp.gif"
- class="org.eclipse.team.internal.ccvs.ui.CVSPerspective"
- id="org.eclipse.team.cvs.ui.cvsPerspective">
- <description>
- %CVSRepositoryExploring.description
- </description>
- </perspective>
- </extension>
-<!-- ************** Perspective Extensions **************** -->
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.ui.resourcePerspective">
- <perspectiveShortcut
- id="org.eclipse.team.cvs.ui.cvsPerspective">
- </perspectiveShortcut>
- <view
- relative="org.eclipse.ui.views.TaskList"
- visible="false"
- id="org.eclipse.team.ui.GenericHistoryView"
- relationship="stack">
- </view>
- <view
- relative="org.eclipse.ui.navigator.ProjectExplorer"
- visible="false"
- id="org.eclipse.team.ccvs.ui.RepositoriesView"
- relationship="stack">
- </view>
- </perspectiveExtension>
- <perspectiveExtension
- targetID="org.eclipse.team.cvs.ui.cvsPerspective">
- <actionSet
- id="org.eclipse.team.cvs.ui.CVSActionSet">
- </actionSet>
- <showInPart
- id="org.eclipse.team.ui.GenericHistoryView">
- </showInPart>
- </perspectiveExtension>
- <perspectiveExtension
- targetID="org.eclipse.team.ui.TeamSynchronizingPerspective">
- <perspectiveShortcut
- id="org.eclipse.team.cvs.ui.cvsPerspective">
- </perspectiveShortcut>
- <view
- relative="org.eclipse.team.sync.views.SynchronizeView"
- visible="false"
- id="org.eclipse.team.ccvs.ui.RepositoriesView"
- relationship="stack">
- </view>
- </perspectiveExtension>
- </extension>
-<!-- ********** Action Sets ************** -->
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="%CVS"
- description="%CVSActionSet.description"
- visible="false"
- id="org.eclipse.team.cvs.ui.CVSActionSet">
- <action
- definitionId="org.eclipse.team.cvs.ui.checkout"
- label="%CVSActionSet.checkoutLabel"
- icon="$nl$/icons/full/etool16/newconnect_wiz.gif"
- tooltip="%CVSActionSet.checkoutTooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.CheckoutWizardAction"
- toolbarPath="Normal/CVS"
- id="org.eclipse.team.cvs.ui.actions.CheckoutAction">
- </action>
- <menu
- label="%CVSGroupMenu.label"
- path="additions"
- id="cvs.main">
- <separator
- name="group1">
- </separator>
- <separator
- name="group2">
- </separator>
- <separator
- name="group3">
- </separator>
- <separator
- name="group4">
- </separator>
- <separator
- name="group5">
- </separator>
- <separator
- name="group6">
- </separator>
- <separator
- name="group7">
- </separator>
- <separator
- name="group8">
- </separator>
- <separator
- name="group9">
- </separator>
- <separator
- name="group10">
- </separator>
- <separator
- name="projectGroup">
- </separator>
- </menu>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_ignore_action_context"
- label="%IgnoreAction.label"
- definitionId="org.eclipse.team.cvs.ui.ignore"
- class="org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction"
- tooltip="%IgnoreAction.tooltip"
- menubarPath="cvs.main/group3"
- id="org.eclipse.team.cvs.ui.ignore">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_add_action_context"
- label="%AddAction.label"
- definitionId="org.eclipse.team.cvs.ui.add"
- class="org.eclipse.team.internal.ccvs.ui.actions.AddAction"
- tooltip="%AddAction.tooltip"
- menubarPath="cvs.main/group3"
- id="org.eclipse.team.cvs.ui.add">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.show_in_history_action_context"
- label="%ShowHistoryAction.label"
- definitionId="org.eclipse.team.cvs.ui.showHistory"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction"
- tooltip="%ShowHistoryAction.tooltip"
- icon="$nl$/icons/full/eview16/history_view.gif"
- menubarPath="cvs.main/group2"
- id="org.eclipse.team.cvs.ui.showHistory">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
- label="%ShowAnnotationAction.label"
- definitionId="org.eclipse.team.cvs.ui.showAnnotation"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
- tooltip="%ShowAnnotationAction.tooltip"
- icon="$nl$/icons/full/etool16/annotate.gif"
- menubarPath="cvs.main/group2"
- id="org.eclipse.team.cvs.ui.showAnnotation">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_set_keyword_mode_action_context"
- label="%SetKeywordSubstitutionAction.label"
- definitionId="org.eclipse.team.cvs.ui.setKeywordSubstitution"
- class="org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction"
- tooltip="%SetKeywordSubstitutionAction.tooltip"
- menubarPath="cvs.main/group3"
- id="org.eclipse.team.cvs.ui.setKeywordSubstitution">
- </action>
- <action
- label="%UpdateActionSwitch.label"
- definitionId="org.eclipse.team.cvs.ui.updateSwitch"
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateAction"
- tooltip="%UpdateActionSwitch.tooltip"
- menubarPath="cvs.main/group2"
- id="org.eclipse.team.cvs.ui.updateSwitch">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_merge_action_context"
- label="%MergeAction.label"
- icon="$nl$/icons/full/obj16/branches_rep.gif"
- tooltip="%MergeAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.MergeAction"
- definitionId="org.eclipse.team.cvs.ui.merge"
- menubarPath="cvs.main/group2"
- id="org.eclipse.team.cvs.ui.merge">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_branch_action_context"
- label="%BranchAction.label"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- tooltip="%BranchAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
- definitionId="org.eclipse.team.cvs.ui.branch"
- menubarPath="cvs.main/group2"
- id="org.eclipse.team.cvs.ui.branch">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_tag_as_version_action_context"
- label="%TagAction.label"
- icon="$nl$/icons/full/obj16/versions_rep.gif"
- tooltip="%TagAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.TagLocalAction"
- definitionId="org.eclipse.team.cvs.ui.tag"
- menubarPath="cvs.main/group2"
- id="org.eclipse.team.cvs.ui.tag">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_create_patch_action_context"
- label="%GenerateDiff.label"
- definitionId="org.eclipse.team.cvs.ui.GenerateDiff"
- class="org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction"
- tooltip="%GenerateDiff.tooltip"
- menubarPath="cvs.main/group1"
- id="org.eclipse.team.cvs.ui.GenerateDiff">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_update_action_context"
- label="%UpdateAction.label"
- tooltip="%UpdateAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateSilentAction"
- definitionId="org.eclipse.team.cvs.ui.update"
- menubarPath="cvs.main/group1"
- id="org.eclipse.team.cvs.ui.update">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_commit_action_context"
- allowLabelUpdate="false"
- retarget="false"
- label="%CommitAction.label"
- class="org.eclipse.team.internal.ccvs.ui.actions.CommitAction"
- definitionId="org.eclipse.team.cvs.ui.commit"
- tooltip="%CommitAction.tooltip"
- menubarPath="cvs.main/group1"
- id="org.eclipse.team.cvs.ui.commit">
- </action>
- <action
- helpContextId="org.eclipse.team.cvs.ui.team_synchronize_action_context"
- label="%Synchronize.label"
- tooltip="%Synchronize.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.SyncAction"
- definitionId="org.eclipse.team.ui.synchronizeLast"
- menubarPath="cvs.main/group1"
- id="org.eclipse.team.cvs.ui.sync">
- </action>
- </actionSet>
- </extension>
-<!-- ******************* Action Definitions ******************** -->
- <extension
- point="org.eclipse.ui.commands">
- <category
- name="%CVSActionSet.categoryName"
- description="%CVSActionSet.description"
- id="org.eclipse.team.cvs.ui.actionSet">
- </category>
- <!-- Perspective/View Commands -->
- <command
- description="%CVSRepositoryExploring.openPerspectiveDescription"
- categoryId="org.eclipse.ui.category.perspectives"
- name="%CVSRepositoryExploring"
- id="org.eclipse.team.cvs.ui.cvsPerspective"/>
- <command
- name="%ViewCommand.repositoriesView.name"
- description="%ViewCommand.repositoriesView.description"
- categoryId="org.eclipse.ui.category.views"
- id="org.eclipse.team.ccvs.ui.RepositoriesView"/>
- <command
- name="%ViewCommand.editorsView.name"
- description="%ViewCommand.editorsView.description"
- categoryId="org.eclipse.ui.category.views"
- id="org.eclipse.team.ccvs.ui.EditorsView"/>
- <!-- CVS View Actions -->
- <command
- name="%newLocation.name"
- description="%newLocation.description"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- id="org.eclipse.team.cvs.ui.addLocation"/>
- <!-- CVS Menu Commands -->
- <command
- name="%CVSActionSet.checkoutLabel"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- description="%CVSActionSet.checkoutTooltip"
- id="org.eclipse.team.cvs.ui.checkout"/>
- <command
- description="%CommitAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%CommitAction.name"
- id="org.eclipse.team.cvs.ui.commit"/>
- <command
- description="%CommitAllAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%CommitAllAction.name"
- id="org.eclipse.team.cvs.ui.commitAll"/>
- <command
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- description="%ReplaceWithAction.tooltip"
- name="%ReplaceWithAction.name"
- id="org.eclipse.team.cvs.ui.replace"/>
- <command
- description="%ReplaceWithTagAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%ReplaceWithTagAction.name"
- id="org.eclipse.team.cvs.ui.replaceWithTag"/>
- <command
- description="%ReplaceWithRevisionAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%ReplaceWithRevisionAction.name"
- id="org.eclipse.team.cvs.ui.replaceWithRevision"/>
- <command
- description="%CompareWithRemoteAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%CompareWithRemoteAction.name"
- id="org.eclipse.team.cvs.ui.compareWithRemote"/>
- <command
- description="%CompareWithTagAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%CompareWithTagAction.name"
- id="org.eclipse.team.cvs.ui.compareWithTag"/>
- <command
- description="%CompareWithRevisionAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%CompareWithRevisionAction.name"
- id="org.eclipse.team.cvs.ui.compareWithRevision"/>
- <command
- description="%UpdateAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%UpdateAction.name"
- id="org.eclipse.team.cvs.ui.update"/>
- <command
- description="%UpdateAllAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- id="org.eclipse.team.cvs.ui.updateAll"
- name="%UpdateAllAction.name"/>
- <command
- description="%GenerateDiff.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%GenerateDiff.name"
- id="org.eclipse.team.cvs.ui.GenerateDiff"/>
- <command
- description="%TagAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%TagAction.name"
- id="org.eclipse.team.cvs.ui.tag"/>
- <command
- description="%BranchAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%BranchAction.name"
- id="org.eclipse.team.cvs.ui.branch"/>
- <command
- description="%MergeAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%MergeAction.name"
- id="org.eclipse.team.cvs.ui.merge"/>
- <command
- description="%UpdateActionSwitch.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%UpdateActionSwitch.name"
- id="org.eclipse.team.cvs.ui.updateSwitch"/>
- <command
- description="%SetKeywordSubstitutionAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%SetKeywordSubstitutionAction.name"
- id="org.eclipse.team.cvs.ui.setKeywordSubstitution"/>
- <command
- description="%ShowAnnotationAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%ShowAnnotationAction.name"
- id="org.eclipse.team.cvs.ui.showAnnotation"/>
- <command
- description="%ShowHistoryAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%ShowHistoryAction.name"
- id="org.eclipse.team.cvs.ui.showHistory"/>
- <command
- description="%AddAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%AddAction.name"
- id="org.eclipse.team.cvs.ui.add"/>
- <command
- description="%IgnoreAction.tooltip"
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- name="%IgnoreAction.name"
- id="org.eclipse.team.cvs.ui.ignore"/>
- <command
- categoryId="org.eclipse.team.cvs.ui.actionSet"
- description="%Synchronize.tooltip"
- name="%Synchronize.name"
- id="org.eclipse.team.cvs.ui.sync"/>
- </extension>
-
- <!-- Commented out awaiting menu support from UI
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.CommitAction"
- commandId="org.eclipse.team.cvs.ui.commit">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.CommitAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction"
- commandId="org.eclipse.team.cvs.ui.ignore">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- commandId="org.eclipse.team.cvs.ui.add"
- class="org.eclipse.team.internal.ccvs.ui.actions.AddAction">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.AddAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- commandId="org.eclipse.team.cvs.ui.showHistory"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- commandId="org.eclipse.team.cvs.ui.showAnnotation"
- class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- commandId="org.eclipse.team.cvs.ui.setKeywordSubstitution"
- class="org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- commandId="org.eclipse.team.cvs.ui.updateSwitch"
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateAction">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.MergeAction"
- commandId="org.eclipse.team.cvs.ui.merge">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.MergeAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
- commandId="org.eclipse.team.cvs.ui.branch">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.TagLocalAction"
- commandId="org.eclipse.team.cvs.ui.tag">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.TagLocalAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- commandId="org.eclipse.team.cvs.ui.GenerateDiff"
- class="org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateSilentAction"
- commandId="org.eclipse.team.cvs.ui.update">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.UpdateSilentAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.CheckoutWizardAction"
- commandId="org.eclipse.team.cvs.ui.checkout">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.CheckoutWizardAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction"
- commandId="org.eclipse.team.cvs.ui.compareWithRevision">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareWithTagAction"
- commandId="org.eclipse.team.cvs.ui.compareWithTag">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.CompareWithTagAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.CompareWithRemoteAction"
- commandId="org.eclipse.team.cvs.ui.compareWithRemote">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.CompareWithRemoteAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction"
- commandId="org.eclipse.team.cvs.ui.replaceWithTag">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRevisionAction"
- commandId="org.eclipse.team.cvs.ui.replaceWithRevision">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRevisionAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction"
- commandId="org.eclipse.team.cvs.ui.replace">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.team.internal.ccvs.ui.actions.SyncAction"
- commandId="org.eclipse.team.cvs.ui.sync">
- <activeWhen>
- <adapt
- type="org.eclipse.core.resources.mapping.ResourceMapping">
- <test
- args="org.eclipse.team.core.repository,org.eclipse.team.cvs.core.cvsnature"
- property="org.eclipse.core.resources.projectPersistentProperty">
- </test>
- </adapt>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- args="org.eclipse.team.internal.ccvs.ui.actions.SyncAction"
- property="org.eclipse.team.cvs.ui.selection.isEnabled">
- </test>
- </with>
- </enabledWhen>
- </handler>
- </extension>
- -->
-
-<!-- ********** Color and Font Definitions ************** -->
- <extension point="org.eclipse.ui.themes">
- <themeElementCategory
- id="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%CVS"/>
- <fontDefinition
- label="%CVSConsoleFont.label"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- defaultsTo="org.eclipse.jface.textfont"
- id="pref_console_font">
- <description>
- %CVSConsoleFont.description
- </description>
- </fontDefinition>
- <colorDefinition
- id="org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_foreground_color"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%OutgoingChangeForegroundColor.label"
- value="COLOR_LIST_FOREGROUND">
- <description>
- %OutgoingChangeForegroundColor.description
- </description>
- </colorDefinition>
- <colorDefinition
- id="org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_background_color"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%OutgoingChangeBackgroundColor.label"
- value="COLOR_LIST_BACKGROUND">
- <description>
- %OutgoingChangeBackgroundColor.description
- </description>
- </colorDefinition>
- <fontDefinition
- id="org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_font"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%OutgoingChangeFont.label">
- <description>
- %OutgoingChangeFont.description
- </description>
- </fontDefinition>
- <colorDefinition
- id="org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_foreground_color"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%IgnoredResourceForegroundColor.label"
- value="COLOR_LIST_FOREGROUND">
- <description>
- %IgnoredResourceForegroundColor.description
- </description>
- </colorDefinition>
- <colorDefinition
- id="org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_background_color"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%IgnoredResourceBackgroundColor.label"
- value="COLOR_LIST_BACKGROUND">
- <description>
- %IgnoredResourceBackgroundColor.description
- </description>
- </colorDefinition>
- <fontDefinition
- id="org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_font"
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- label="%IgnoredResourceFont.label">
- <description>
- %IgnoredResourceFont.description
- </description>
- </fontDefinition>
- <colorDefinition
- categoryId="org.eclipse.team.cvs.ui.fontsandcolors"
- id="org.eclipse.team.cvs.ui.fontsandcolors.cvshistorypagecategories"
- label="%CVSHistoryCategory.label"
- value="COLOR_LIST_FOREGROUND">
- <description>
- %CVSHistoryCategory.description
- </description>
- </colorDefinition>
-</extension>
-
-<!-- ********** QuickDiff text editor support ************** -->
- <extension
- point="org.eclipse.ui.workbench.texteditor.quickDiffReferenceProvider">
- <referenceprovider
- label="%CVSRemoteQuickDiffProvider.label"
- class="org.eclipse.team.internal.ccvs.ui.RemoteRevisionQuickDiffProvider"
- id="org.eclipse.quickdiff.providers.CVSReferenceProvider">
- </referenceprovider>
- </extension>
-
-<!-- ********** New Project Wizard ************** -->
- <extension
- point="org.eclipse.ui.newWizards">
- <category name="%newWizardCategoryName" id="org.eclipse.team.cvs.ui.newWizards">
- </category>
- <wizard
- category="org.eclipse.team.cvs.ui.newWizards"
- icon="$nl$/icons/full/etool16/newconnect_wiz.gif"
- name="%newProjectCheckoutWizard"
- class="org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard"
- project="true"
- id="org.eclipse.team.cvs.ui.newProjectCheckout">
- <description>
- %newProjectCheckoutWizardDescription2
- </description>
- </wizard>
- <wizard
- category="org.eclipse.team.cvs.ui.newWizards"
- icon="$nl$/icons/full/etool16/newlocation_wiz.gif"
- name="%newLocationWizard"
- class="org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard"
- project="false"
- id="org.eclipse.team.cvs.ui.newLocation">
- <description>
- %newLocationWizardDescription
- </description>
- </wizard>
- </extension>
-
- <!-- ********** Import Wizard ************** -->
- <extension
- point="org.eclipse.ui.importWizards">
- <category name="%newWizardCategoryName" id="org.eclipse.team.cvs.ui.importWizards">
- </category>
- <wizard
- icon="$nl$/icons/full/obj16/import_obj.gif"
- name="%newProjectCheckoutWizard"
- class="org.eclipse.team.internal.ccvs.ui.wizards.ImportWizard"
- category="org.eclipse.team.cvs.ui.importWizards"
- id="org.eclipse.team.cvs.ui.newProjectCheckout">
- <description>
- %newProjectCheckoutWizardDescription
- </description>
- </wizard>
- </extension>
-
- <extension
- point="org.eclipse.ui.preferenceTransfer">
- <transfer
- id="org.eclipse.cvs.ui.transfer.repos"
- icon="$nl$/icons/full/obj16/repository_rep.gif"
- name="%RepoPreference.Name">
- <mapping scope="instance">
- <entry node="org.eclipse.team.cvs.core/repositories"/>
- </mapping>
- <description>
- %RepoPreference.Description
- </description>
- </transfer>
- </extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.team.internal.ccvs.core.filehistory.CVSFileHistoryProvider"
- class="org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory">
- <adapter type="org.eclipse.team.ui.history.IHistoryPageSource"/>
- </factory>
- <factory
- adaptableType="org.eclipse.team.internal.ccvs.core.ICVSRemoteFile"
- class="org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory">
- <adapter type="org.eclipse.team.ui.history.IHistoryPageSource"/>
- </factory>
- <factory
- adaptableType="org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision"
- class="org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory">
- <adapter type="org.eclipse.team.ui.history.IHistoryPageSource"/>
- </factory>
- <factory
- adaptableType="org.eclipse.team.internal.ccvs.core.filehistory.CVSLocalFileRevision"
- class="org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory">
- <adapter type="org.eclipse.team.ui.history.IHistoryPageSource"/>
- </factory>
- <factory
- adaptableType="org.eclipse.team.internal.ccvs.core.mapping.ChangeSetModelProvider"
- class="org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory">
- <adapter type="org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter"/>
- </factory>
- <factory
- adaptableType="org.eclipse.team.internal.ccvs.core.CVSTeamProviderType"
- class="org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory">
- <adapter type="org.eclipse.team.ui.mapping.ITeamStateProvider"/>
- </factory>
- </extension>
- <extension
- point="org.eclipse.team.ui.teamDecorators">
- <teamDecorator
- decoratedDirection="OUTGOING"
- decoratorId="org.eclipse.team.cvs.ui.decorator"
- repositoryId="org.eclipse.team.cvs.core.cvsnature"/>
- </extension>
- <extension
- point="org.eclipse.ui.dropActions">
- <action
- class="org.eclipse.team.internal.ccvs.ui.CVSResourceDropAdapter"
- id="org.eclipse.team.cvs.ui.cvsRemoteDrop"/>
- </extension>
- <extension
- point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent
- activeByDefault="false"
- contentProvider="org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetContentProvider"
- icon="$nl$/icons/full/obj16/changelog_obj.gif"
- id="org.eclipse.team.cvs.ui.changeSetContent"
- labelProvider="org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetLabelProvider"
- name="%ChangeSets"
- priority="normal">
- <enablement>
- <or>
- <instanceof value="org.eclipse.team.internal.ccvs.core.mapping.ChangeSetModelProvider"/>
- <instanceof value="org.eclipse.team.internal.ccvs.core.mapping.CVSActiveChangeSet"/>
- <instanceof value="org.eclipse.team.internal.ccvs.core.mapping.CVSCheckedInChangeSet"/>
- <instanceof value="org.eclipse.core.resources.IResource"/>
- <instanceof
- value="org.eclipse.team.internal.ccvs.core.mapping.UnassignedDiffChangeSet">
- </instanceof>
- </or>
- </enablement>
- <commonSorter
- class="org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetSorter"
- id="org.eclipse.team.cvs.ui.changeSetSorter"/>
- <actionProvider
- class="org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetActionProvider"
- id="org.eclipse.team.cvs.ui.changeSetActions"/>
- </navigatorContent>
- </extension>
- <extension
- point="org.eclipse.team.ui.teamContentProviders">
- <teamContentProvider
- contentExtensionId="org.eclipse.team.cvs.ui.changeSetContent"
- icon="$nl$/icons/full/obj16/changelog_obj.gif"
- modelProviderId="org.eclipse.team.cvs.core.changeSetModel"/>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.internal.ccvs.ui.AnnotatePreferencePage"
- id="org.eclipse.team.cvs.ui.AnnotatePreferences"
- name="%AnnotatePreferencePage.name">
- <keywordReference id="org.eclipse.team.cvs.ui.cvs.annotate"/>
- </page>
- </extension>
-
- <!-- Commented out awaiting menu support from UI
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="org.eclipse.team.cvs.ui.CVSActionSet">
- <command
- commandId="org.eclipse.team.cvs.ui.checkout"
- label="%CVSActionSet.checkoutLabel"
- icon="$nl$/icons/full/etool16/newconnect_wiz.gif"
- tooltip="%CVSActionSet.checkoutTooltip"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
- <menuContribution
- locationURI="menu:cvs.main?after=group3">
- <command
- commandId="org.eclipse.team.cvs.ui.setKeywordSubstitution"
- helpContextId="org.eclipse.team.cvs.ui.team_set_keyword_mode_action_context"
- label="%SetKeywordSubstitutionAction.label"
- mnemonic="%SetKeywordSubstitutionAction.mnemonic"
- style="push"
- tooltip="%SetKeywordSubstitutionAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.add"
- helpContextId="org.eclipse.team.cvs.ui.team_add_action_context"
- label="%AddAction.name"
- mnemonic="%AddAction.mnemonic"
- style="push"
- tooltip="%AddAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.ignore"
- helpContextId="org.eclipse.team.cvs.ui.team_ignore_action_context"
- label="%IgnoreAction.label"
- mnemonic="%IgnoreAction.mnemonic"
- style="push"
- tooltip="%IgnoreAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:cvs.main?after=group2">
- <command
- commandId="org.eclipse.team.cvs.ui.tag"
- helpContextId="org.eclipse.team.cvs.ui.team_tag_as_version_action_context"
- icon="$nl$/icons/full/obj16/versions_rep.gif"
- label="%TagAction.label"
- mnemonic="%TagAction.mnemonic"
- style="push"
- tooltip="%TagAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.branch"
- helpContextId="org.eclipse.team.cvs.ui.team_branch_action_context"
- icon="$nl$/icons/full/elcl16/newstream_wiz.gif"
- label="%BranchAction.label"
- mnemonic="%BranchAction.mnemonic"
- style="push"
- tooltip="%BranchAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.merge"
- helpContextId="org.eclipse.team.cvs.ui.team_merge_action_context"
- icon="$nl$/icons/full/obj16/branches_rep.gif"
- label="%MergeAction.label"
- mnemonic="%MergeAction.mnemonic"
- style="push"
- tooltip="%MergeAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.updateSwitch"
- helpContextId="org.eclipse.team.internal.ccvs.ui.actions.UpdateAction"
- label="%UpdateActionSwitch.label"
- mnemonic="%UpdateActionSwitch.mnemonic"
- style="push"
- tooltip="%UpdateActionSwitch.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.showAnnotation"
- helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
- icon="$nl$/icons/full/etool16/annotate.gif"
- label="%ShowAnnotationAction.label"
- mnemonic="%ShowAnnotationAction.mnemonic"
- style="push"
- tooltip="%ShowAnnotationAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.showHistory"
- helpContextId="org.eclipse.team.cvs.ui.show_in_history_action_context"
- icon="$nl$/icons/full/eview16/history_view.gif"
- label="%ShowHistoryAction.label"
- mnemonic="%ShowHistoryAction.mnemonic"
- style="push"
- tooltip="%ShowHistoryAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:cvs.main?after=group1">
- <command
- commandId="org.eclipse.team.cvs.ui.sync"
- helpContextId="org.eclipse.team.cvs.ui.team_synchronize_action_context"
- label="%Synchronize.label"
- style="push"
- tooltip="%Synchronize.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.commit"
- helpContextId="org.eclipse.team.cvs.ui.team_commit_action_context"
- label="%CommitAction.label"
- mnemonic="%CommitAction.mnemonic"
- style="push"
- tooltip="%CommitAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.update"
- label="%UpdateAction.label"
- mnemonic="%UpdateAction.mnemonic"
- style="push"
- tooltip="%UpdateAction.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.team.cvs.ui.GenerateDiff"
- helpContextId="org.eclipse.team.cvs.ui.team_create_patch_action_context"
- label="%GenerateDiff.label"
- mnemonic="%GenerateDiff.mnemonic"
- style="push"
- tooltip="%GenerateDiff.tooltip">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.team.cvs.ui.CVSActionSet">
- </equals>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:org.eclipse.ui.main.menu">
- <menu
- id="cvs.main"
- label="%CVSGroupMenu.label"
- mnemonic="%CVSGroupMenu.mnemonic">
- <separator
- name="additions"
- visible="true">
- </separator>
- <separator
- name="group1"
- visible="true">
- </separator>
- <separator
- name="group2"
- visible="true">
- </separator>
- <separator
- name="group3"
- visible="true">
- </separator>
- <separator
- name="group4"
- visible="true">
- </separator>
- <separator
- name="group5"
- visible="true">
- </separator>
- <separator
- name="group6"
- visible="true">
- </separator>
- <separator
- name="group7"
- visible="true">
- </separator>
- <separator
- name="group8"
- visible="true">
- </separator>
- <separator
- name="group9"
- visible="true">
- </separator>
- <separator
- name="group10"
- visible="true">
- </separator>
- <separator
- name="projectGroup"
- visible="true">
- </separator>
- </menu>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.team.internal.ccvs.ui.SelectionPropertyTester"
- id="org.eclipse.team.cvs.ui.selectionTester"
- namespace="org.eclipse.team.cvs.ui.selection"
- properties="isEnabled"
- type="org.eclipse.jface.viewers.ISelection">
- </propertyTester>
- </extension>
- -->
-
-</plugin>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
deleted file mode 100644
index 6171838e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * This class acts as an adaptable list that will return the resources in the
- * hierarchy indicated by their paths
- */
-public class AdaptableHierarchicalResourceList extends AdaptableResourceList {
- private IContainer root;
-
- /**
- * Constructor for AdaptableHierarchicalResourceList.
- * @param resources
- */
- public AdaptableHierarchicalResourceList(IContainer root, IResource[] resources) {
- super(resources);
- this.root = root;
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- return getChildenFor(root);
- }
-
- private IResource[] getChildenFor(IContainer parent) {
- Set children = new HashSet();
- IPath parentPath = parent.getFullPath();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IPath resourcePath = resource.getFullPath();
- if (parent instanceof IWorkspaceRoot) {
- children.add(((IWorkspaceRoot)parent).getProject(resourcePath.segment(0)));
- } else if (parentPath.isPrefixOf(resourcePath)) {
- IPath parentRelativePath = resourcePath.removeFirstSegments(parentPath.segmentCount());
- if (parentRelativePath.segmentCount() == 1) {
- children.add(resource);
- } else if (parentRelativePath.segmentCount() > 1) {
- children.add(parent.getFolder(new Path(null, parentRelativePath.segment(0))));
- }
- }
- }
- return (IResource[]) children.toArray(new IResource[children.size()]);
- }
-
- /**
- * Returns a content provider for <code>IResource</code>s that returns
- * only children of the given resource type.
- */
- public ITreeContentProvider getTreeContentProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof IContainer) {
- return getChildenFor((IContainer) o);
- } else {
- return super.getChildren(o);
- }
- }
- };
- }
-
- public void setResources(IResource[] resources) {
- this.resources = resources;
- }
-
- /**
- * Sets the root.
- * @param root The root to set
- */
- public void setRoot(IContainer root) {
- this.root = root;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
deleted file mode 100644
index e4a6997ef..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This class acts as a resource list that can be used in table widgets.
- */
-public class AdaptableResourceList implements IAdaptable, IWorkbenchAdapter {
-
- IResource[] resources;
-
- public AdaptableResourceList(IResource[] resources) {
- this.resources = resources;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(Object)
- */
- public Object[] getChildren(Object o) {
- return resources;
- }
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return o == null ? "" : o.toString();//$NON-NLS-1$
- }
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
deleted file mode 100644
index b1d092f0c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * This dialog allows the user to add a set of resources to version control.
- * They can either all be added or the user can choose which to add from a
- * details list.
- */
-public class AddToVersionControlDialog extends DetailsDialog {
-
- private static final int WIDTH_HINT = 350;
- private final static int SELECTION_HEIGHT_HINT = 100;
-
- private IResource[] unaddedResources;
- private Object[] resourcesToAdd;
-
- private CheckboxTableViewer listViewer;
- /**
- * Constructor for AddToVersionControlDialog.
- * @param parentShell
- */
- public AddToVersionControlDialog(Shell parentShell, IResource[] unaddedResources) {
- super(parentShell, CVSUIMessages.AddToVersionControlDialog_title);
- this.unaddedResources = unaddedResources;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // add a description label
- if (unaddedResources.length==1) {
- createWrappingLabel(composite, NLS.bind(CVSUIMessages.AddToVersionControlDialog_thereIsAnUnaddedResource, new String[] { new Integer(unaddedResources.length).toString() }));
- } else {
- createWrappingLabel(composite, NLS.bind(CVSUIMessages.AddToVersionControlDialog_thereAreUnaddedResources, new String[] { new Integer(unaddedResources.length).toString() }));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG;
- }
-
- /**
- * @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- addUnaddedResourcesArea(composite);
-
- return composite;
- }
-
- private void addUnaddedResourcesArea(Composite composite) {
-
- // add a description label
- createWrappingLabel(composite, CVSUIMessages.ReleaseCommentDialog_unaddedResources);
-
- // add the selectable checkbox list
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SELECTION_HEIGHT_HINT;
- data.widthHint = WIDTH_HINT;
- listViewer.getTable().setLayoutData(data);
-
- // set the contents of the list
- listViewer.setLabelProvider(new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- if (element instanceof IResource)
- return ((IResource)element).getFullPath().toString();
- else
- return input;
- }
- });
- listViewer.setContentProvider(new WorkbenchContentProvider());
- listViewer.setInput(new AdaptableResourceList(unaddedResources));
- if (resourcesToAdd == null) {
- listViewer.setAllChecked(true);
- } else {
- listViewer.setCheckedElements(resourcesToAdd);
- }
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- resourcesToAdd = listViewer.getCheckedElements();
- }
- });
-
- addSelectionButtons(composite);
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
-
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
-
- Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_selectAll, false);
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- resourcesToAdd = null;
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_deselectAll, false);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
- resourcesToAdd = new Object[0];
-
- }
- };
- deselectButton.addSelectionListener(listener);
- }
-
- /**
- * @see org.eclipse.team.internal.ui.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- /**
- * Returns the resourcesToAdd.
- * @return IResource[]
- */
- public IResource[] getResourcesToAdd() {
- if (resourcesToAdd == null) {
- return unaddedResources;
- } else {
- List result = Arrays.asList(resourcesToAdd);
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
- super.createButtonsForButtonBar(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#includeOkButton()
- */
- protected boolean includeOkButton() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int id) {
- // hijack yes and no buttons to set the correct return
- // codes.
- if(id == IDialogConstants.YES_ID || id == IDialogConstants.NO_ID) {
- setReturnCode(id);
- close();
- } else {
- super.buttonPressed(id);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
deleted file mode 100644
index 0f3a2dee4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class AlternateUserValidationDialog extends Dialog {
- String user;
- String password = ""; //$NON-NLS-1$
- List numXs = new ArrayList();
- Label icon1;
- Label icon2;
- Label icon3;
- Label icon4;
- Text passwordText;
- boolean inUpdate = false;
-
- Image[] images;
-
- public AlternateUserValidationDialog(Shell parentShell, String user) {
- super(parentShell);
- this.user = user;
- initializeImages();
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(CVSUIMessages.AlternateUserValidationDialog_Enter_Password_2);
- }
-
- 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(NLS.bind(CVSUIMessages.AlternateUserValidationDialog_message, new String[] { user }));
- l.setLayoutData(new GridData());
- l = new Label(middleComposite, SWT.NULL);
- l.setText(""); //$NON-NLS-1$
- l.setLayoutData(new GridData());
- passwordText = new Text(middleComposite, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData();
- data.widthHint = 250;
- passwordText.setLayoutData(data);
-
- passwordText.addVerifyListener(new VerifyListener() {
- public void verifyText(VerifyEvent e) {
- if (inUpdate) return;
- e.doit = false;
- inUpdate = true;
- switch (e.character) {
- case 8: {
- // backspace pressed
- if (password.length() > 0) {
- password = password.substring(0, password.length() - 1);
- }
- // get rid of bogus Xs
- int numX = ((Integer)numXs.get(numXs.size() - 1)).intValue();
- numXs.remove(numXs.size() - 1);
- String oldText = passwordText.getText();
- String newText = oldText.substring(0, oldText.length() - numX);
- passwordText.setText(newText);
- passwordText.setSelection(newText.length());
- break;
- }
- default: {
- String oldText = passwordText.getText();
- String x = getXs();
- numXs.add(numXs.size(), new Integer(x.length()));
- String newText = oldText + x;
- passwordText.setText(newText);
- passwordText.setSelection(newText.length());
- password += e.character;
- }
- }
- inUpdate = false;
- updateImages();
- }
- });
- /*passwordText.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- switch (e.detail) {
- case SWT.TRAVERSE_ARROW_NEXT:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- e.detail = SWT.TRAVERSE_NONE;
- e.doit = false;
- break;
- }
- }
- });*/
- Composite buttonComposite = new Composite(main, SWT.NONE);
- buttonComposite.setLayout(new GridLayout());
- buttonComposite.setLayoutData(new GridData());
- Button b = new Button(buttonComposite, SWT.PUSH);
- b.setText(CVSUIMessages.AlternateUserValidationDialog_OK_6);
- 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(CVSUIMessages.AlternateUserValidationDialog_Cancel_7);
- data = new GridData();
- data.widthHint = 70;
- b.setLayoutData(data);
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- cancelPressed();
- }
- });
- Dialog.applyDialogFont(parent);
- return main;
- }
-
- public boolean close() {
- boolean result = super.close();
- if (images != null) {
- for (int i = 0; i < images.length; i++) {
- images[i].dispose();
- images[i] = null;
- }
- images = null;
- }
- return result;
- }
- public String getPassword() {
- return password;
- }
-
- Label createLabel(Composite parent) {
- Label result = new Label(parent, SWT.NULL);
- GridData data = new GridData();
- data.widthHint = 22;
- data.heightHint = 22;
- result.setLayoutData(data);
- result.setImage(getImage());
- return result;
- }
- Image getImage() {
- double random = Math.random();
- random *= 7; // Random number between 0.0 and 7.0
- long num = Math.round(random);
- return images[(int)num];
- }
- void initializeImages() {
- images = new Image[8];
- for (int i = 0; i < images.length; i++) {
- images[i] = CVSUIPlugin.getPlugin().getImageDescriptor("glyphs/glyph" + (i+1) + ".gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- FontData fd = new FontData();
- fd.setStyle(SWT.BOLD);
- fd.setHeight(10);
- // On Windows, set the font to Sans Serif for an authentic look
- if (System.getProperty("os.name").indexOf("Windows") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- fd.setName("Microsoft Sans Serif"); //$NON-NLS-1$
- }
- }
- void updateImages() {
- icon1.setImage(getImage());
- icon2.setImage(getImage());
- icon3.setImage(getImage());
- icon4.setImage(getImage());
- }
- public void setUsername(String user) {
- this.user = user;
- }
- String getXs() {
- double random = Math.random();
- random *= 2;
- random += 2;
- long num = Math.round(random);
- // Random number between 2 and 4
- switch ((int)num) {
- case 2:
- return "XX"; //$NON-NLS-1$
- case 3:
- return "XXX"; //$NON-NLS-1$
- case 4:
- return "XXXX"; //$NON-NLS-1$
- }
- return "X"; //$NON-NLS-1$
- }
- protected void cancelPressed() {
- password = null;
- super.cancelPressed();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java
deleted file mode 100644
index b4ac10f4e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.*;
-
-public class AnnotatePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- private RadioGroupFieldEditor binaryPrompt = null;
-
- public AnnotatePreferencePage() {
- super(GRID);
- setTitle(CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageTitle);
- setDescription(CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageMessage);
- setPreferenceStore(CVSUIPlugin.getPlugin().getPreferenceStore());
- }
-
- public void createControl(Composite parent) {
- super.createControl(parent);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.ANNOTATE_VIEW);
- }
-
- public void createFieldEditors() {
- binaryPrompt = new RadioGroupFieldEditor(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY, CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageBinaryFileMessage, 3, new String[][] { {CVSUIMessages.CVSPreferencesPage_11, MessageDialogWithToggle.ALWAYS}, {CVSUIMessages.CVSPreferencesPage_12, MessageDialogWithToggle.NEVER}, {CVSUIMessages.CVSPreferencesPage_13, MessageDialogWithToggle.PROMPT}}, getFieldEditorParent(), true /* use a group */);
- addField(binaryPrompt);
-
- Dialog.applyDialogFont(getFieldEditorParent());
- getFieldEditorParent().layout(true);
- }
-
- public void init(IWorkbench workbench) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return super.performOk();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
deleted file mode 100644
index 416bf92a4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-
-/**
- * A compare input for comparing remote resources. Use <code>CVSLocalCompareInput</code>
- * when comparing resources in the workspace to remote resources.
- */
-public class CVSCompareEditorInput extends CompareEditorInput {
- private ITypedElement left;
- private ITypedElement right;
- private ITypedElement ancestor;
- private Image leftImage;
- private Image rightImage;
- private Image ancestorImage;
-
- // comparison constants
- private static final int NODE_EQUAL = 0;
- private static final int NODE_NOT_EQUAL = 1;
- private static final int NODE_UNKNOWN = 2;
-
- String toolTipText;
- private String title;
-
- /**
- * Creates a new CVSCompareEditorInput.
- */
- public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right) {
- this(left, right, null);
- }
-
- public CVSCompareEditorInput(String title, String toolTip, ResourceEditionNode left, ResourceEditionNode right) {
- this(left, right, null);
- this.title = title;
- this.toolTipText = toolTip;
- }
-
- /**
- * Creates a new CVSCompareEditorInput.
- */
- public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right, ResourceEditionNode ancestor) {
- super(new CompareConfiguration());
- // TODO: Invokers of this method should ensure that trees and contents are prefetched
- this.left = left;
- this.right = right;
- this.ancestor = ancestor;
- if (left != null) {
- this.leftImage = left.getImage();
- }
- if (right != null) {
- this.rightImage = right.getImage();
- }
- if (ancestor != null) {
- this.ancestorImage = ancestor.getImage();
- }
- }
-
- /**
- * Returns the label for the given input element.
- */
- private String getLabel(ITypedElement element) {
- if (element instanceof ResourceEditionNode) {
- ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
- ICVSResource resource = edition;
- if (edition instanceof ICVSRemoteFile) {
- try {
- return NLS.bind(CVSUIMessages.nameAndRevision, new String[] { resource.getName(), ((ICVSRemoteFile)edition).getRevision() });
- } catch (TeamException e) {
- // fall through
- }
- }
- try {
- if (edition.isContainer()) {
- CVSTag tag = ((ICVSRemoteFolder)edition).getTag();
- if (tag == null) {
- return NLS.bind(CVSUIMessages.CVSCompareEditorInput_inHead, new String[] { edition.getName() });
- } else if (tag.getType() == CVSTag.BRANCH) {
- return NLS.bind(CVSUIMessages.CVSCompareEditorInput_inBranch, (new Object[] {edition.getName(), tag.getName()}));
- } else {
- return NLS.bind(CVSUIMessages.CVSCompareEditorInput_repository, (new Object[] {edition.getName(), tag.getName()}));
- }
- } else {
- return NLS.bind(CVSUIMessages.CVSCompareEditorInput_repository, (new Object[] {edition.getName(), resource.getSyncInfo().getRevision()}));
- }
- } catch (TeamException e) {
- handle(e);
- // Fall through and get the default label
- }
- }
- return element.getName();
- }
-
- /**
- * Returns the label for the given input element.
- */
- private String getVersionLabel(ITypedElement element) {
- if (element instanceof ResourceEditionNode) {
- ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
- ICVSResource resource = edition;
- try {
- if (edition.isContainer()) {
- CVSTag tag = ((ICVSRemoteFolder)resource).getTag();
- if (tag == null) {
- return CVSUIMessages.CVSCompareEditorInput_headLabel;
- } else if (tag.getType() == CVSTag.BRANCH) {
- return NLS.bind(CVSUIMessages.CVSCompareEditorInput_branchLabel, new String[] { tag.getName() });
- } else {
- return tag.getName();
- }
- } else {
- return resource.getSyncInfo().getRevision();
- }
- } catch (TeamException e) {
- handle(e);
- // Fall through and get the default label
- }
- }
- return element.getName();
- }
-
- /*
- * Returns a guess of the resource name being compared, for display
- * in the title.
- */
- private String guessResourceName() {
- if (left != null) {
- return left.getName();
- }
- if (right != null) {
- return right.getName();
- }
- if (ancestor != null) {
- return ancestor.getName();
- }
- return ""; //$NON-NLS-1$
- }
-
- /*
- * Returns a guess of the resource path being compared, for display
- * in the tooltip.
- */
- private Object guessResourcePath() {
- if (left != null && left instanceof ResourceEditionNode) {
- return ((ResourceEditionNode)left).getRemoteResource().getRepositoryRelativePath();
- }
- if (right != null && right instanceof ResourceEditionNode) {
- return ((ResourceEditionNode)right).getRemoteResource().getRepositoryRelativePath();
- }
- if (ancestor != null && ancestor instanceof ResourceEditionNode) {
- return ((ResourceEditionNode)ancestor).getRemoteResource().getRepositoryRelativePath();
- }
- return guessResourceName();
- }
-
- /**
- * Handles a random exception and sanitizes it into a reasonable
- * error message.
- */
- private void handle(Exception e) {
- // create a status
- Throwable t = e;
- // unwrap the invocation target exception
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException)t).getTargetException();
- }
- IStatus error;
- if (t instanceof CoreException) {
- error = ((CoreException)t).getStatus();
- } else if (t instanceof TeamException) {
- error = ((TeamException)t).getStatus();
- } else {
- error = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, CVSUIMessages.internal, t);
- }
- setMessage(error.getMessage());
- if (!(t instanceof TeamException)) {
- CVSUIPlugin.log(error.getSeverity(), error.getMessage(), t);
- }
- }
-
- /**
- * Sets up the title and pane labels for the comparison view.
- */
- private void initLabels() {
- CompareConfiguration cc = getCompareConfiguration();
- setLabels(cc, new StructuredSelection());
-
- if (title == null) {
- if (ancestor != null) {
- title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleAncestor, (new Object[] {guessResourceName(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right)}));
- toolTipText = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleAncestor, (new Object[] {guessResourcePath(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right)}));
- } else {
- String leftName = null;
- if (left != null) leftName = left.getName();
- String rightName = null;
- if (right != null) rightName = right.getName();
- if (leftName != null && !leftName.equals(rightName)) {
- title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleNoAncestorDifferent, (new Object[] {leftName, getVersionLabel(left), rightName, getVersionLabel(right)}));
- } else {
- title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleNoAncestor, (new Object[] {guessResourceName(), getVersionLabel(left), getVersionLabel(right)}));
- title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleNoAncestor, (new Object[] {guessResourcePath(), getVersionLabel(left), getVersionLabel(right)}));
- }
- }
- }
- setTitle(title);
- }
-
- private void setLabels(CompareConfiguration cc, IStructuredSelection selection) {
- ITypedElement left = this.left;
- ITypedElement right = this.right;
- ITypedElement ancestor = this.ancestor;
-
- if (left != null) {
- cc.setLeftLabel(getLabel(left));
- cc.setLeftImage(leftImage);
- }
-
- if (right != null) {
- cc.setRightLabel(getLabel(right));
- cc.setRightImage(rightImage);
- }
-
- if (ancestor != null) {
- cc.setAncestorLabel(getLabel(ancestor));
- cc.setAncestorImage(ancestorImage);
- }
- }
-
- /* (Non-javadoc)
- * Method declared on CompareEditorInput
- */
- public boolean isSaveNeeded() {
- return false;
- }
-
- /* (non-Javadoc)
- * Method declared on CompareEditorInput
- */
- protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final boolean threeWay = ancestor != null;
- if (right == null || left == null) {
- setMessage(CVSUIMessages.CVSCompareEditorInput_different);
- 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(NLS.bind(CVSUIMessages.CompareEditorInput_fileProgress, (new String[] {element.getName()})));
- progressMonitor.worked(1);
- }
- }
- protected Object[] getChildren(Object input) {
- if (input instanceof IStructureComparator) {
- Object[] children= ((IStructureComparator)input).getChildren();
- if (children != null)
- return children;
- }
- return null;
- }
- protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
- };
-
- try {
- // do the diff
- Object result = null;
- monitor.beginTask(CVSUIMessages.CVSCompareEditorInput_comparing, 30);
- IProgressMonitor sub = new SubProgressMonitor(monitor, 30);
- sub.beginTask(CVSUIMessages.CVSCompareEditorInput_comparing, 100);
- try {
- result = d.findDifferences(threeWay, sub, null, ancestor, left, right);
- } finally {
- sub.done();
- }
- return result;
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- } catch (RuntimeException e) {
- handle(e);
- return null;
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Compares two nodes to determine if they are equal. Returns NODE_EQUAL
- * of they are the same, NODE_NOT_EQUAL if they are different, and
- * NODE_UNKNOWN if comparison was not possible.
- */
- protected int teamEqual(Object left, Object right) {
- // calculate the type for the left contribution
- ICVSRemoteResource leftEdition = null;
- if (left instanceof ResourceEditionNode) {
- leftEdition = ((ResourceEditionNode)left).getRemoteResource();
- }
-
- // calculate the type for the right contribution
- ICVSRemoteResource rightEdition = null;
- if (right instanceof ResourceEditionNode)
- rightEdition = ((ResourceEditionNode)right).getRemoteResource();
-
-
- // compare them
-
- if (leftEdition == null || rightEdition == null) {
- return NODE_UNKNOWN;
- }
- // if they're both non-files, they're the same
- if (leftEdition.isContainer() && rightEdition.isContainer()) {
- return NODE_EQUAL;
- }
- // if they have different types, they're different
- if (leftEdition.isContainer() != rightEdition.isContainer()) {
- return NODE_NOT_EQUAL;
- }
-
- String leftLocation = leftEdition.getRepository().getLocation(false);
- String rightLocation = rightEdition.getRepository().getLocation(false);
- 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) {
- final Viewer viewer = super.createDiffViewer(parent);
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- CompareConfiguration cc = getCompareConfiguration();
- setLabels(cc, (IStructuredSelection)event.getSelection());
- }
- });
- ((StructuredViewer)viewer).addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- ISelection selection = event.getSelection();
- if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection)selection).getFirstElement();
- if (o instanceof DiffNode) {
- updateLabelsFor((DiffNode)o);
- }
- }
- }
- });
- ((StructuredViewer)viewer).addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection)selection).getFirstElement();
- if (o instanceof DiffNode) {
- DiffNode diffNode = ((DiffNode)o);
- if (diffNode.hasChildren()) {
- AbstractTreeViewer atv = ((AbstractTreeViewer)viewer);
- atv.setExpandedState(o, !atv.getExpandedState(o));
- }
- }
- }
- }
- });
- return viewer;
- }
-
- /*
- * Update the labels for the given DiffNode
- */
- protected void updateLabelsFor(DiffNode node) {
- CompareConfiguration cc = getCompareConfiguration();
- ITypedElement l = node.getLeft();
- if (l == null) {
- cc.setLeftLabel(CVSUIMessages.CVSCompareEditorInput_0);
- cc.setLeftImage(null);
- } else {
- cc.setLeftLabel(getLabel(l));
- cc.setLeftImage(l.getImage());
- }
- ITypedElement r = node.getRight();
- if (r == null) {
- cc.setRightLabel(CVSUIMessages.CVSCompareEditorInput_1);
- cc.setRightImage(null);
- } else {
- cc.setRightLabel(getLabel(r));
- cc.setRightImage(r.getImage());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- if (toolTipText != null) {
- return toolTipText;
- }
- return super.getToolTipText();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
deleted file mode 100644
index a5daba9b2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.synchronize.TeamStateDescription;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.ITheme;
-
-/**
- * A decoration describes the annotations to a user interface element. The
- * annotations can apply to text (e.g. prefix, suffix, color, font) and to an
- * image (e.g. overlays).
- * <p>
- * This class is derived from an internal workbench class
- * <code>IDecoration</code> and is often used in conjunction with the label
- * decoration APIs. As such a client can convert between them using helpers
- * defined in this class.
- * </p>
- * TODO:
- * profile
- * add colors and fonts to preferences instead of being hard coded
- * what to do with CVSDecorationConfiguration class?
- * preference page externalizations
- * preference page preview should update when theme changes
- *
- * @since 3.1
- */
-public class CVSDecoration {
-
- public static final int MODEL = 1000;
-
- // Decorations
- private String prefix;
- private String suffix;
- private ImageDescriptor overlay;
- private Color bkgColor;
- private Color fgColor;
- private Font font;
-
- // Properties
- private int resourceType = IResource.FILE;
- private boolean watchEditEnabled = false;
- private boolean isDirty = false;
- private boolean isIgnored = false;
- private boolean isAdded = false;
- private boolean isNewResource = false;
- private boolean hasRemote = false;
- private boolean readOnly = false;
- private boolean needsMerge = false;
- private boolean virtualFolder = false;
- private String tag;
- private String revision;
- private String repository;
- private ICVSRepositoryLocation location;
- private String keywordSubstitution;
- private int stateFlags;
-
- // Text formatters
- private String fileFormatter;
- private String folderFormatter;
- private String projectFormatter;
-
- // Images cached for better performance
- private static ImageDescriptor dirty;
- private static ImageDescriptor checkedIn;
- private static ImageDescriptor noRemoteDir;
- private static ImageDescriptor added;
- private static ImageDescriptor merged;
- private static ImageDescriptor newResource;
- private static ImageDescriptor edited;
-
- // List of preferences used to configure the decorations that
- // are applied.
- private Preferences preferences;
-
- /*
- * Define a cached image descriptor which only creates the image data once
- */
- public static class CachedImageDescriptor extends ImageDescriptor {
-
- ImageDescriptor descriptor;
- ImageData data;
-
- public CachedImageDescriptor(ImageDescriptor descriptor) {
- Assert.isNotNull(descriptor);
- this.descriptor = descriptor;
- }
-
- public ImageData getImageData() {
- if (data == null) {
- data = descriptor.getImageData();
- }
- return data;
- }
- }
-
- static {
- dirty = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DIRTY_OVR));
- checkedIn = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR));
- added = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR));
- merged = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGED));
- newResource = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE));
- edited = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_EDITED));
- noRemoteDir = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NO_REMOTEDIR));
- }
-
- /**
- * Default constructor uses the plug-in's preferences to determine text decoration
- * formatters and preferences.
- */
- public CVSDecoration() {
- // TODO: for efficiency don't look up a pref until its needed
- IPreferenceStore store = getStore();
- Preferences prefs = new Preferences();
-
- prefs.setValue(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- prefs.setValue(ICVSUIConstants.PREF_DIRTY_FLAG, store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- prefs.setValue(ICVSUIConstants.PREF_ADDED_FLAG, store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- prefs.setValue(ICVSUIConstants.PREF_USE_FONT_DECORATORS, store.getString(ICVSUIConstants.PREF_USE_FONT_DECORATORS));
-
- initialize(prefs, store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION), store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION), store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION));
- }
-
- public CVSDecoration(Preferences preferences, String fileFormater, String folderFormatter, String projectFormatter) {
- initialize(preferences, fileFormater, folderFormatter, projectFormatter);
- }
-
- private IPreferenceStore getStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- private void initialize(Preferences preferences, String fileFormater, String folderFormatter, String projectFormatter) {
- this.preferences = preferences;
- this.fileFormatter = updateOldDirtyFlag(fileFormater);
- this.folderFormatter = updateOldDirtyFlag(folderFormatter);
- this.projectFormatter = updateOldDirtyFlag(projectFormatter);
- }
-
- //see bug 110022
- public static String updateOldDirtyFlag(String param){
- return param.replaceAll(CVSDecoratorConfiguration.OLD_DIRTY_FLAG,
- CVSDecoratorConfiguration.NEW_DIRTY_FLAG);
- }
-
- public void addPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- public void addSuffix(String suffix) {
- this.suffix = suffix;
- }
-
- public void setForegroundColor(Color fgColor) {
- this.fgColor = fgColor;
- }
-
- public void setBackgroundColor(Color bkgColor) {
- this.bkgColor = bkgColor;
- }
-
- public void setFont(Font font) {
- this.font = font;
- }
-
- public Color getBackgroundColor() {
- return bkgColor;
- }
-
- public Color getForegroundColor() {
- return fgColor;
- }
-
- public Font getFont() {
- return font;
- }
-
- public ImageDescriptor getOverlay() {
- return overlay;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getSuffix() {
- return suffix;
- }
-
- public void setResourceType(int type) {
- this.resourceType = type;
- }
-
- public void apply(IDecoration decoration) {
- compute();
- // apply changes
- String suffix = getSuffix();
- if(suffix != null)
- decoration.addSuffix(suffix);
- String prefix = getPrefix();
- if(prefix != null)
- decoration.addPrefix(prefix);
- ImageDescriptor overlay = getOverlay();
- if(overlay != null)
- decoration.addOverlay(overlay);
- Color bc = getBackgroundColor();
- if(bc != null)
- decoration.setBackgroundColor(bc);
- Color fc = getForegroundColor();
- if(fc != null)
- decoration.setForegroundColor(fc);
- Font f = getFont();
- if(f != null)
- decoration.setFont(f);
- }
-
- public void compute() {
- computeText();
- overlay = computeImage();
- computeColorsAndFonts();
- }
-
- private void computeText() {
- if (isIgnored())
- return;
- Map bindings = new HashMap();
- if (isDirty()) {
- bindings.put(CVSDecoratorConfiguration.NEW_DIRTY_FLAG, preferences.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- }
- if (isAdded()) {
- bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, preferences.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- } else if(isHasRemote()){
- bindings.put(CVSDecoratorConfiguration.FILE_REVISION, getRevision());
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, getTag());
- }
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, getKeywordSubstitution());
- if ((resourceType == IResource.FOLDER || resourceType == IResource.PROJECT) && location != null) {
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, location.getHost());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, location.getMethod().getName());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, location.getUsername());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, location.getRootDirectory());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, repository);
-
- RepositoryManager repositoryManager = CVSUIPlugin.getPlugin().getRepositoryManager();
- RepositoryRoot root = repositoryManager.getRepositoryRootFor(location);
- CVSUIPlugin.getPlugin().getRepositoryManager();
- String label = root.getName();
- if (label == null) {
- label = location.getLocation(true);
- }
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_LABEL, label);
- }
- CVSDecoratorConfiguration.decorate(this, getTextFormatter(), bindings);
- }
-
- private ImageDescriptor computeImage() {
- // show newResource icon
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION) && isNewResource()) {
- return newResource;
- }
- // show dirty icon
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION) && isDirty()) {
- return dirty;
- }
- // show added
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION) && isAdded()) {
- return added;
- }
- // show watch edit
- if (isWatchEditEnabled() && resourceType == IResource.FILE && !isReadOnly() && isHasRemote()) {
- return edited;
- }
- if (needsMerge)
- return merged;
- // show checked in
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION) && isHasRemote()) {
- if ((resourceType == IResource.FOLDER || resourceType == IResource.PROJECT) && isVirtualFolder()) {
- return noRemoteDir;
- }
- return checkedIn;
- }
-
- //nothing matched
- return null;
- }
-
- private void computeColorsAndFonts() {
- if (!preferences.getBoolean(ICVSUIConstants.PREF_USE_FONT_DECORATORS))
- return;
-
- ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- if(isIgnored()) {
- setBackgroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR));
- setForegroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR));
- setFont(current.getFontRegistry().get(CVSDecoratorConfiguration.IGNORED_FONT));
- } else if(isDirty()) {
- setBackgroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR));
- setForegroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR));
- setFont(current.getFontRegistry().get(CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT));
- }
- }
-
- private String getTextFormatter() {
- switch (resourceType) {
- case IResource.FILE :
- return fileFormatter;
- case IResource.FOLDER :
- return folderFormatter;
- case IResource.PROJECT :
- return projectFormatter;
- case MODEL :
- return folderFormatter;
- }
- return "no format specified"; //$NON-NLS-1$
- }
-
- public boolean isAdded() {
- return isAdded;
- }
-
- public void setAdded(boolean isAdded) {
- this.isAdded = isAdded;
- }
-
- public boolean isDirty() {
- return isDirty;
- }
-
- public void setDirty(boolean isDirty) {
- this.isDirty = isDirty;
- }
-
- public boolean isIgnored() {
- return isIgnored;
- }
-
- public void setIgnored(boolean isIgnored) {
- this.isIgnored = isIgnored;
- }
-
- public String getTag() {
- return tag;
- }
-
- public void setTag(String tag) {
- this.tag = tag;
- }
-
- public boolean isWatchEditEnabled() {
- return watchEditEnabled;
- }
-
- public void setWatchEditEnabled(boolean watchEditEnabled) {
- this.watchEditEnabled = watchEditEnabled;
- }
-
- public boolean isNewResource() {
- return isNewResource;
- }
-
- public void setNewResource(boolean isNewResource) {
- this.isNewResource = isNewResource;
- }
-
- public void setLocation(ICVSRepositoryLocation location) {
- this.location = location;
- }
-
- public String getRevision() {
- return revision;
- }
-
- public void setRevision(String revision) {
- this.revision = revision;
- }
-
- public String getKeywordSubstitution() {
- return keywordSubstitution;
- }
-
- public void setKeywordSubstitution(String keywordSubstitution) {
- this.keywordSubstitution = keywordSubstitution;
- }
-
- public void setNeedsMerge(boolean needsMerge) {
- this.needsMerge = needsMerge;
- }
-
- public boolean isHasRemote() {
- return hasRemote;
- }
-
- public void setHasRemote(boolean hasRemote) {
- this.hasRemote = hasRemote;
- }
-
- public void setRepository(String repository) {
- this.repository = repository;
- }
-
- public boolean isReadOnly() {
- return readOnly;
- }
-
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- public boolean isVirtualFolder() {
- return virtualFolder;
- }
-
- public void setVirtualFolder(boolean virtualFolder) {
- this.virtualFolder = virtualFolder;
- }
-
- public void setStateFlags(int stateFlags) {
- this.stateFlags = stateFlags;
- if ((stateFlags & IThreeWayDiff.OUTGOING) != 0) {
- setDirty(true);
- }
- }
-
- public TeamStateDescription asTeamStateDescription(String[] properties) {
- TeamStateDescription desc = new CVSTeamStateDescription(stateFlags);
- Object o = computeImage();
- if (o != null && isRequestedProperty(properties, CVSTeamStateDescription.PROP_RESOURCE_STATE)) {
- desc.setProperty(CVSTeamStateDescription.PROP_RESOURCE_STATE, o);
- }
- if (tag != null && isRequestedProperty(properties, CVSTeamStateDescription.PROP_TAG)) {
- desc.setProperty(CVSTeamStateDescription.PROP_TAG, tag);
- }
- return desc;
- }
-
- private boolean isRequestedProperty(String[] properties, String property) {
- if (properties == null)
- return true;
- for (int i = 0; i < properties.length; i++) {
- String string = properties[i];
- if (string.equals(property))
- return true;
- }
- return false;
- }
-}
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 9e8e7b2cc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.Map;
-
-import org.eclipse.osgi.util.TextProcessor;
-
-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$
- public static final String REMOTELOCATION_LABEL = "label"; //$NON-NLS-1$
-
- // bindings for resource states
- // see bug 110022
- public static final String NEW_DIRTY_FLAG = "outgoing_change_flag"; //$NON-NLS-1$
- public static final String OLD_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 = CVSUIMessages.CVSDecoratorConfiguration_0;
- public static final String DEFAULT_ADDED_FLAG = CVSUIMessages.CVSDecoratorConfiguration_1;
-
- // default text decoration formats
- public static final String DEFAULT_FILETEXTFORMAT = CVSUIMessages.CVSDecoratorConfiguration_2;
- public static final String DEFAULT_FOLDERTEXTFORMAT = CVSUIMessages.CVSDecoratorConfiguration_3;
- public static final String DEFAULT_PROJECTTEXTFORMAT = CVSUIMessages.CVSDecoratorConfiguration_4;
-
- // prefix characters that can be removed if the following binding is not found
- private static final char KEYWORD_SEPCOLON = ':';
- private static final char KEYWORD_SEPAT = '@';
-
- // font and color definition ids
- public static final String OUTGOING_CHANGE_FOREGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_foreground_color"; //$NON-NLS-1$
- public static final String OUTGOING_CHANGE_BACKGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_background_color"; //$NON-NLS-1$
- public static final String OUTGOING_CHANGE_FONT = "org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_font"; //$NON-NLS-1$
- public static final String IGNORED_FOREGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_foreground_color"; //$NON-NLS-1$
- public static final String IGNORED_BACKGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_background_color"; //$NON-NLS-1$
- public static final String IGNORED_FONT = "org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_font"; //$NON-NLS-1$
-
- public static void decorate(CVSDecoration decoration, String format, Map bindings) {
- StringBuffer prefix = new StringBuffer();
- StringBuffer suffix = new StringBuffer();
- StringBuffer output = prefix;
-
- int length = format.length();
- int start = -1;
- int end = length;
- while (true) {
- if ((end = format.indexOf('{', start)) > -1) {
- output.append(format.substring(start + 1, end));
- if ((start = format.indexOf('}', end)) > -1) {
- String key = format.substring(end + 1, start);
- String s;
-
- //We use the RESOURCE_NAME key to determine if we are doing the prefix or suffix. The name isn't actually part of either.
- if(key.equals(RESOURCE_NAME)) {
- output = suffix;
- s = null;
- } else {
- s = (String) bindings.get(key);
- }
-
- if(s!=null) {
- output.append(s);
- } else {
- // support for removing prefix character if binding is null
- int curLength = output.length();
- if(curLength>0) {
- char c = output.charAt(curLength - 1);
- if(c == KEYWORD_SEPCOLON || c == KEYWORD_SEPAT) {
- output.deleteCharAt(curLength - 1);
- }
- }
- }
- } else {
- output.append(format.substring(end, length));
- break;
- }
- } else {
- output.append(format.substring(start + 1, length));
- break;
- }
- }
-
- if (prefix.length() != 0) {
- decoration.addPrefix(TextProcessor.process(prefix.toString(),"()[].")); //$NON-NLS-1$
- }
- if (suffix.length() != 0) {
- decoration.addSuffix(TextProcessor.process(suffix.toString(),"()[].")); //$NON-NLS-1$
- }
- }
-}
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 a8942e04b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
+++ /dev/null
@@ -1,678 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak (brockj@tpg.com.au) - Bug 158456 Preview fonts and colours in the CVS decorator preference page
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.ide.IDE.SharedImages;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-
-public class CVSDecoratorPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private static class PreviewFile {
-
- public final String name, tag, mode;
- public final int type;
- public final boolean added, dirty, hasRemote, ignored, newResource;
- public Collection children;
-
- public PreviewFile(String name, int type, boolean added, boolean newResource, boolean dirty, boolean ignored, boolean hasRemote, String mode, String tag) {
- this.name= name;
- this.type= type;
- this.added= added;
- this.ignored= ignored;
- this.dirty= dirty;
- this.hasRemote= hasRemote;
- this.newResource= newResource;
- this.mode= mode != null ? mode : Command.KSUBST_TEXT.getShortDisplayText();
- this.tag= tag != null ? tag : ""; //$NON-NLS-1$
- this.children= Collections.EMPTY_LIST;
- }
-
- public void configureDecoration(CVSDecoration decoration) {
- decoration.setResourceType(type);
- decoration.setAdded(added);
- decoration.setDirty(dirty);
- decoration.setNewResource(newResource);
- decoration.setIgnored(ignored);
- decoration.setHasRemote(hasRemote);
- decoration.setTag(tag);
- decoration.setKeywordSubstitution(mode);
- }
- }
-
- private static class FormatEditor extends SelectionAdapter {
- private final Text fText;
- private final Map fBindings;
- private final String fKey;
-
- public FormatEditor(Composite composite, String title, String buttonText, Map bindings, String key) {
-
- fKey= key;
- fBindings= bindings;
-
- final Label label= SWTUtils.createLabel(composite, title);
- label.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
-
- fText= SWTUtils.createText(composite);
-
- final Button button = new Button(composite, SWT.NONE);
- button.setText(buttonText);
- button.setLayoutData(new GridData());
-
- button.addSelectionListener(this);
- }
-
- public void addModifyListener(ModifyListener listener) {
- fText.addModifyListener(listener);
- }
-
- public String getText() {
- return fText.getText();
- }
-
- public void widgetSelected(SelectionEvent e) {
-
- final ILabelProvider labelProvider = new LabelProvider() {
- public String getText(Object element) {
- return ((Map.Entry)element).getKey() + " - " + ((Map.Entry)element).getValue(); //$NON-NLS-1$
- }
- };
-
- final IStructuredContentProvider contentsProvider = new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return ((Collection)inputElement).toArray();
- }
- public void dispose() {}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- };
-
- final ListSelectionDialog dialog= new ListSelectionDialog(
- fText.getShell(),
- fBindings.entrySet(),
- contentsProvider,
- labelProvider,
- CVSUIMessages.CVSDecoratorPreferencesPage_0);
- dialog.setHelpAvailable(false);
- dialog.setTitle(CVSUIMessages.CVSDecoratorPreferencesPage_1);
- if (dialog.open() != Window.OK)
- return;
-
- Object[] result = dialog.getResult();
-
- for (int i = 0; i < result.length; i++) {
- fText.insert("{"+((Map.Entry)result[i]).getKey() +"}"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- public void performOk(IPreferenceStore store) {
- store.setValue(fKey, fText.getText());
- }
-
- public void performDefaults(IPreferenceStore store) {
- store.setToDefault(fKey);
- fText.setText(store.getDefaultString(fKey));
- }
-
- public void initializeValue(IPreferenceStore store) {
- fText.setText(
- CVSDecoration.updateOldDirtyFlag(store.getString(fKey)));
- }
- }
-
- private abstract class Tab extends Observable {
-
- public abstract void initializeValues(IPreferenceStore store);
- public abstract void performDefaults(IPreferenceStore store);
- public abstract void performOk(IPreferenceStore store);
- public abstract void setPreferences(Preferences preferences);
-
- }
-
- private class IconDecoratorTab extends Tab implements SelectionListener {
-
- private final Button fDirty, fHasRemote, fAdded, fNewResource;
-
- public IconDecoratorTab(TabFolder parent) {
-
- final Composite composite= SWTUtils.createHFillComposite(parent, SWTUtils.MARGINS_DEFAULT);
-
- fDirty= SWTUtils.createCheckBox(composite, CVSUIMessages.CVSDecoratorPreferencesPage_2);
- fDirty.addSelectionListener(this);
-
- fHasRemote= SWTUtils.createCheckBox(composite, CVSUIMessages.CVSDecoratorPreferencesPage_3);
- fHasRemote.addSelectionListener(this);
-
- fAdded= SWTUtils.createCheckBox(composite, CVSUIMessages.CVSDecoratorPreferencesPage_4);
- fAdded.addSelectionListener(this);
-
- fNewResource= SWTUtils.createCheckBox(composite, CVSUIMessages.CVSDecoratorPreferencesPage_5);
- fNewResource.addSelectionListener(this);
-
- final TabItem item= new TabItem(parent, SWT.NONE);
- item.setText(CVSUIMessages.CVSDecoratorPreferencesPage_6);
- item.setControl(composite);
- }
-
- public void widgetSelected(SelectionEvent e) {
- setChanged();
- notifyObservers();
- }
-
- public void initializeValues(IPreferenceStore store) {
- fDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION));
- fAdded.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION));
- fHasRemote.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
- fNewResource.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
- }
-
- public void performOk(IPreferenceStore store) {
- store.setValue(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, fDirty.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, fAdded.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, fHasRemote.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, fNewResource.getSelection());
- }
-
- public void performDefaults(IPreferenceStore store) {
- fDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION));
- fAdded.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION));
- fHasRemote.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
- fNewResource.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
- }
-
- public void setPreferences(Preferences prefs) {
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, fDirty.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, fAdded.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, fHasRemote.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, fNewResource.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- }
-
- private class TextDecoratorTab extends Tab implements ModifyListener {
-
- private final FormatEditor fFileDecoration;
- private final FormatEditor fFolderDecoration;
- private final FormatEditor fProjectDecoration;
-
- private final Text dirtyFlag;
- private final Text addedFlag;
-
- public TextDecoratorTab(TabFolder parent) {
-
- final Composite composite= SWTUtils.createHFillComposite(parent, SWTUtils.MARGINS_DEFAULT, 3);
- Dialog.applyDialogFont(composite);
-
- fFileDecoration= new FormatEditor(composite, CVSUIMessages.CVSDecoratorPreferencesPage_7, CVSUIMessages.CVSDecoratorPreferencesPage_8, BINDINGS, ICVSUIConstants.PREF_FILETEXT_DECORATION); //
- fFolderDecoration= new FormatEditor(composite, CVSUIMessages.CVSDecoratorPreferencesPage_9, CVSUIMessages.CVSDecoratorPreferencesPage_10, FOLDER_BINDINGS, ICVSUIConstants.PREF_FOLDERTEXT_DECORATION); //
- fProjectDecoration= new FormatEditor(composite, CVSUIMessages.CVSDecoratorPreferencesPage_11, CVSUIMessages.CVSDecoratorPreferencesPage_12, FOLDER_BINDINGS, ICVSUIConstants.PREF_PROJECTTEXT_DECORATION); //
-
- fFileDecoration.addModifyListener(this);
- fFolderDecoration.addModifyListener(this);
- fProjectDecoration.addModifyListener(this);
-
- SWTUtils.createPlaceholder(composite, 1, 3);
- final Label dirtyLabel= SWTUtils.createLabel(composite, CVSUIMessages.CVSDecoratorPreferencesPage_13, 1);
- dirtyLabel.setLayoutData(new GridData());
-
- dirtyFlag = new Text(composite, SWT.BORDER);
- dirtyFlag.setLayoutData(SWTUtils.createHFillGridData(1));
- dirtyFlag.addModifyListener(this);
- SWTUtils.createPlaceholder(composite, 1, 1);
-
-
- final Label addedLabel= SWTUtils.createLabel(composite, CVSUIMessages.CVSDecoratorPreferencesPage_14, 1);
- addedLabel.setLayoutData(new GridData());
-
- addedFlag = new Text(composite, SWT.BORDER);
- addedFlag.setLayoutData(SWTUtils.createHFillGridData(1));
- addedFlag.addModifyListener(this);
- SWTUtils.createPlaceholder(composite, 1, 1);
-
- SWTUtils.createPlaceholder(composite, 1, 3);
-
- final TabItem item= new TabItem(parent, SWT.NONE);
- item.setText(CVSUIMessages.CVSDecoratorPreferencesPage_15);
- item.setControl(composite);
- }
-
- public void initializeValues(IPreferenceStore store) {
- fFileDecoration.initializeValue(store);
- fFolderDecoration.initializeValue(store);
- fProjectDecoration.initializeValue(store);
- addedFlag.setText(store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- dirtyFlag.setText(store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- }
-
- public void performOk(IPreferenceStore store) {
- fFileDecoration.performOk(store);
- fFolderDecoration.performOk(store);
- fProjectDecoration.performOk(store);
- store.setValue(ICVSUIConstants.PREF_ADDED_FLAG, addedFlag.getText());
- store.setValue(ICVSUIConstants.PREF_DIRTY_FLAG, dirtyFlag.getText());
- }
-
- public void performDefaults(IPreferenceStore store) {
- fFileDecoration.performDefaults(store);
- fFolderDecoration.performDefaults(store);
- fProjectDecoration.performDefaults(store);
-
- addedFlag.setText(store.getDefaultString(ICVSUIConstants.PREF_ADDED_FLAG));
- dirtyFlag.setText(store.getDefaultString(ICVSUIConstants.PREF_DIRTY_FLAG));
- }
-
- public String getFileTextFormat() {
- return fFileDecoration.getText();
- }
-
- public String getFolderTextFormat() {
- return fFolderDecoration.getText();
- }
-
- public String getProjectTextFormat() {
- return fProjectDecoration.getText();
- }
-
- public void modifyText(ModifyEvent e) {
- setChanged();
- notifyObservers();
- }
-
- public void setPreferences(Preferences prefs) {
- prefs.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
- prefs.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, dirtyFlag.getText());
- prefs.setDefault(ICVSUIConstants.PREF_ADDED_FLAG, addedFlag.getText());
- }
- }
-
- private class GeneralTab extends Tab implements SelectionListener {
- private final Button fShowDirty;
- private final Button fUseFontDecorations;
-
- public GeneralTab(TabFolder parent) {
- final Composite composite= SWTUtils.createHFillComposite(parent, SWTUtils.MARGINS_DEFAULT);
- Dialog.applyDialogFont(composite);
-
- SWTUtils.createPreferenceLink((IWorkbenchPreferenceContainer) getContainer(), composite, CVSUIMessages.CVSDecoratorPreferencesPage_36, CVSUIMessages.CVSDecoratorPreferencesPage_37);
-
- fShowDirty= SWTUtils.createCheckBox(composite, CVSUIMessages.CVSDecoratorPreferencesPage_16);
- SWTUtils.createLabel(composite, CVSUIMessages.CVSDecoratorPreferencesPage_17);
-
- fUseFontDecorations= SWTUtils.createCheckBox(composite, CVSUIMessages.CVSDecoratorPreferencesPage_18);
-
- SWTUtils.createPreferenceLink((IWorkbenchPreferenceContainer) getContainer(), composite, CVSUIMessages.CVSDecoratorPreferencesPage_19, CVSUIMessages.CVSDecoratorPreferencesPage_20);
-
- fShowDirty.addSelectionListener(this);
- fUseFontDecorations.addSelectionListener(this);
-
- final TabItem item= new TabItem(parent, SWT.NONE);
- item.setText(CVSUIMessages.CVSDecoratorPreferencesPage_21);
- item.setControl(composite);
- }
-
- public void widgetSelected(SelectionEvent e) {
- setChanged();
- notifyObservers();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void initializeValues(IPreferenceStore store) {
- fShowDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- fUseFontDecorations.setSelection(store.getBoolean(ICVSUIConstants.PREF_USE_FONT_DECORATORS));
- }
-
- public void performDefaults(IPreferenceStore store) {
- fShowDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- fUseFontDecorations.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_USE_FONT_DECORATORS));
- }
-
- public void performOk(IPreferenceStore store) {
- store.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, fShowDirty.getSelection());
- store.setValue(ICVSUIConstants.PREF_USE_FONT_DECORATORS, fUseFontDecorations.getSelection());
- }
-
- public void setPreferences(Preferences preferences) {
- preferences.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, fShowDirty.getSelection());
- preferences.setValue(ICVSUIConstants.PREF_USE_FONT_DECORATORS, fUseFontDecorations.getSelection());
- }
-
- public boolean isFontDecorationEnabled() {
- return this.fUseFontDecorations.getEnabled();
- }
-
- }
-
- public class Preview extends LabelProvider implements Observer, ITreeContentProvider {
-
- private final ResourceManager fImageCache;
- private final TreeViewer fViewer;
-
- public Preview(Composite composite) {
- SWTUtils.createLabel(composite, CVSUIMessages.CVSDecoratorPreferencesPage_39);
- fImageCache= new LocalResourceManager(JFaceResources.getResources());
- fViewer = new TreeViewer(composite);
- fViewer.getControl().setLayoutData(SWTUtils.createHVFillGridData());
- fViewer.setContentProvider(this);
- fViewer.setLabelProvider(this);
- fViewer.setInput(ROOT);
- fViewer.expandAll();
- }
-
- public void refresh() {
- fViewer.refresh(true);
- setColorsAndFonts();
- }
-
- private void setColorsAndFonts() {
- TreeItem[] items = fViewer.getTree().getItems();
- setColorsAndFonts(items);
- }
-
- private void setColorsAndFonts(TreeItem[] items) {
- for (int i = 0; i < items.length; i++) {
- if (fGeneralTab.isFontDecorationEnabled()) {
- Color backGroundColor = getBackground(items[i].getData());
- items[i].setBackground(backGroundColor);
- Color foreGroundColor = getForeground(items[i].getData());
- items[i].setForeground(foreGroundColor);
- Font font = getFont(items[i].getData());
- items[i].setFont(font);
- } else {
- items[i].setBackground(null);
- items[i].setForeground(null);
- items[i].setFont(null);
- }
- setColorsAndFonts(items[i].getItems());
- }
- }
-
- public void update(Observable o, Object arg) {
- refresh();
- }
-
- public Object[] getChildren(Object parentElement) {
- return ((PreviewFile)parentElement).children.toArray();
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return !((PreviewFile)element).children.isEmpty();
- }
-
- public Object[] getElements(Object inputElement) {
- return ((Collection)inputElement).toArray();
- }
-
- public void dispose() {
- fImageCache.dispose();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public Color getBackground(Object element) {
- return getDecoration(element).getBackgroundColor();
- }
-
- public Color getForeground(Object element) {
- return getDecoration(element).getForegroundColor();
- }
-
- public Font getFont(Object element) {
- return getDecoration(element).getFont();
- }
-
- public String getText(Object element) {
- final CVSDecoration decoration = getDecoration(element);
- final StringBuffer buffer = new StringBuffer();
- final String prefix = decoration.getPrefix();
- if (prefix != null)
- buffer.append(prefix);
- buffer.append(((PreviewFile)element).name);
- final String suffix = decoration.getSuffix();
- if (suffix != null)
- buffer.append(suffix);
- return buffer.toString();
- }
-
- public CVSDecoration getDecoration(Object element) {
- final CVSDecoration decoration = buildDecoration((PreviewFile)element);
- ((PreviewFile)element).configureDecoration(decoration);
- decoration.compute();
- return decoration;
- }
-
- public Image getImage(Object element) {
- final String s;
- switch (((PreviewFile)element).type) {
- case IResource.PROJECT:
- s= SharedImages.IMG_OBJ_PROJECT; break;
- case IResource.FOLDER:
- s= ISharedImages.IMG_OBJ_FOLDER; break;
- default:
- s= ISharedImages.IMG_OBJ_FILE; break;
- }
- final Image baseImage= PlatformUI.getWorkbench().getSharedImages().getImage(s);
- final ImageDescriptor overlay = getDecoration(element).getOverlay();
- if (overlay == null)
- return baseImage;
- try {
- return fImageCache.createImage(new DecorationOverlayIcon(baseImage, overlay, IDecoration.BOTTOM_RIGHT));
- } catch (DeviceResourceException e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, "Error creating decorator image", e)); //$NON-NLS-1$
- }
- return null;
- }
- }
-
- private static class ThemeListener implements IPropertyChangeListener {
-
- private final Preview fPreview;
-
- ThemeListener(Preview preview) {
- fPreview= preview;
- }
- public void propertyChange(PropertyChangeEvent event) {
- fPreview.refresh();
- }
- }
-
- protected static final Collection ROOT;
- protected static final Map BINDINGS;
- protected static final Map FOLDER_BINDINGS;
-
- static {
- BINDINGS= new HashMap();
- BINDINGS.put(CVSDecoratorConfiguration.RESOURCE_NAME, CVSUIMessages.CVSDecoratorPreferencesPage_22);
- BINDINGS.put(CVSDecoratorConfiguration.RESOURCE_TAG, CVSUIMessages.CVSDecoratorPreferencesPage_23);
- BINDINGS.put(CVSDecoratorConfiguration.FILE_KEYWORD, CVSUIMessages.CVSDecoratorPreferencesPage_24);
- BINDINGS.put(CVSDecoratorConfiguration.FILE_REVISION, CVSUIMessages.CVSDecoratorPreferencesPage_25);
- BINDINGS.put(CVSDecoratorConfiguration.NEW_DIRTY_FLAG, CVSUIMessages.CVSDecoratorPreferencesPage_26);
- BINDINGS.put(CVSDecoratorConfiguration.ADDED_FLAG, CVSUIMessages.CVSDecoratorPreferencesPage_27);
-
- FOLDER_BINDINGS= new HashMap();
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.RESOURCE_NAME, CVSUIMessages.CVSDecoratorPreferencesPage_28);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.RESOURCE_TAG, CVSUIMessages.CVSDecoratorPreferencesPage_29);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, CVSUIMessages.CVSDecoratorPreferencesPage_30);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, CVSUIMessages.CVSDecoratorPreferencesPage_31);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, CVSUIMessages.CVSDecoratorPreferencesPage_32);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, CVSUIMessages.CVSDecoratorPreferencesPage_33);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, CVSUIMessages.CVSDecoratorPreferencesPage_34);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.REMOTELOCATION_LABEL, CVSUIMessages.CVSDecoratorPreferencesPage_38);
- FOLDER_BINDINGS.put(CVSDecoratorConfiguration.NEW_DIRTY_FLAG, CVSUIMessages.CVSDecoratorPreferencesPage_35);
-
- final PreviewFile project= new PreviewFile("Project", IResource.PROJECT, false, false, false, false, true, null, "v1_0"); //$NON-NLS-1$ //$NON-NLS-2$
- final ArrayList children= new ArrayList();
- children.add(new PreviewFile("Folder", IResource.FOLDER, false, false, false, false, true, null, null)); //$NON-NLS-1$
- children.add(new PreviewFile("ignored.txt", IResource.FILE, false, false, false, true, false, null, null)); //$NON-NLS-1$
- children.add(new PreviewFile("dirty.cpp", IResource.FILE, false, false, true, false, true, null, null)); //$NON-NLS-1$
- children.add(new PreviewFile("added.java", IResource.FILE, true, false, true, false, false, null, null)); //$NON-NLS-1$
- children.add(new PreviewFile("todo.txt", IResource.FILE, false, true, true, false, false, null, null)); //$NON-NLS-1$
- children.add(new PreviewFile("bugs.txt", IResource.FILE, false, false, true, false, true, null, null)); //$NON-NLS-1$
- children.add(new PreviewFile("archive.zip", IResource.FILE, false, false, true, false, true, Command.KSUBST_BINARY.getShortDisplayText(), null)); //$NON-NLS-1$
- project.children= children;
- ROOT= Collections.singleton(project);
- }
-
-
- private TextDecoratorTab fTextTab;
- private IconDecoratorTab fIconTab;
- private GeneralTab fGeneralTab;
-
- private Preview fPreview;
- private ThemeListener fThemeListener;
-
- protected Control createContents(Composite parent) {
-
- final Composite composite= SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_NONE);
-
- final Composite folderComposite= SWTUtils.createHFillComposite(composite, SWTUtils.MARGINS_NONE);
-
- // create a tab folder for the page
- final TabFolder tabFolder = new TabFolder(folderComposite, SWT.NONE);
- tabFolder.setLayoutData(SWTUtils.createHFillGridData());
-
- // text decoration options
- fGeneralTab= new GeneralTab(tabFolder);
- fTextTab= new TextDecoratorTab(tabFolder);
- fIconTab= new IconDecoratorTab(tabFolder);
-
- fPreview= new Preview(composite);
-
- fTextTab.addObserver(fPreview);
- fIconTab.addObserver(fPreview);
- fGeneralTab.addObserver(fPreview);
-
- initializeValues();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.DECORATORS_PREFERENCE_PAGE);
- Dialog.applyDialogFont(parent);
-
- PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener= new ThemeListener(fPreview));
-
- return tabFolder;
- }
-
- public void dispose() {
- if (fThemeListener != null)
- PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(fThemeListener);
- if (fPreview != null)
- fPreview.dispose();
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- final IPreferenceStore store = getPreferenceStore();
- fTextTab.initializeValues(store);
- fIconTab.initializeValues(store);
- fGeneralTab.initializeValues(store);
- fPreview.refresh();
- 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() {
- final IPreferenceStore store = getPreferenceStore();
- fTextTab.performOk(store);
- fIconTab.performOk(store);
- fGeneralTab.performOk(store);
- if (store.needsSaving()) {
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- CVSUIPlugin.getPlugin().savePluginPreferences();
- }
- return true;
- }
-
- /**
- * Defaults was clicked. Restore the CVS preferences to
- * their default values
- */
- protected void performDefaults() {
- final IPreferenceStore store = getPreferenceStore();
-
- fTextTab.performDefaults(store);
- fIconTab.performDefaults(store);
- fGeneralTab.performDefaults(store);
- fPreview.refresh();
- super.performDefaults();
- }
-
- /**
- * 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();
- }
-
-
- public CVSDecoration buildDecoration(PreviewFile file) {
- final Preferences prefs = new Preferences();
-
- fIconTab.setPreferences(prefs);
- fTextTab.setPreferences(prefs);
- fGeneralTab.setPreferences(prefs);
-
- final CVSDecoration decoration= new CVSDecoration(prefs, fTextTab.getFileTextFormat(), fTextTab.getFolderTextFormat(), fTextTab.getProjectTextFormat());
-
- decoration.setKeywordSubstitution(Command.KSUBST_TEXT.getShortDisplayText());
- decoration.setRevision("1.45"); //$NON-NLS-1$
- try {
- decoration.setLocation(CVSRepositoryLocation.fromString(":pserver:alize@cvs.site.org:/home/cvsroot")); //$NON-NLS-1$
- } catch (CVSException e) {
- // continue without a location, since the location is hard coded an exception should never occur
- }
- return decoration;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java
deleted file mode 100644
index b9d35211d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.*;
-
-/**
- * This class acts as an abstract superclass for CVS preference pages that use
- * field editors.
- */
-public abstract class CVSFieldEditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public static IPreferenceStore getCVSPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- /**
- * Constructor for CVSFieldEditorPreferencePage.
- */
- public CVSFieldEditorPreferencePage() {
- super(GRID);
- setPreferenceStore(getCVSPreferenceStore());
- String description = getPageDescription();
- if (description != null)
- setDescription(description);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- String id = getPageHelpContextId();
- if (id != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), id);
- Dialog.applyDialogFont(control);
- return control;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * Method getPageHelpContextId must be overridden by subclasses to provide
- * the help context ID of the page. Return null for no page F1 help.
- *
- * @return String
- */
- protected abstract String getPageHelpContextId();
-
- /**
- * Method getPageDescription must be overridden by subclasses to provide the
- * description of the page. Return null for no description.
- * @return String
- */
- protected abstract String getPageDescription();
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- if (!super.performOk()) return false;
- pushPreferences();
- return true;
- }
-
- /**
- * Push the preferences to the Core plugin as required
- */
- protected void pushPreferences() {
- // Do nothing by default
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
deleted file mode 100644
index 539bf1ff1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import com.ibm.icu.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.ui.PlatformUI;
-
-public class CVSFilePropertiesPage extends CVSPropertiesPage {
- IFile file;
-
- /*
- * @see PreferencesPage#createContents
- */
- protected Control createContents(Composite parent) {
- initialize();
- noDefaultAndApplyButton();
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- try {
- ICVSFile cvsResource = CVSWorkspaceRoot.getCVSFileFor(file);
- if (!cvsResource.isManaged()) {
- if (cvsResource.isIgnored()) {
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_ignored);
- } else {
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_notManaged);
- }
- createLabel(composite, ""); //$NON-NLS-1$
- return composite;
- }
- ResourceSyncInfo syncInfo = cvsResource.getSyncInfo();
-
-
-
- if (syncInfo.isAdded()) {
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_isAdded, 2);
- } else {
- // Base
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_baseRevision);
- createLabel(composite, syncInfo.getRevision());
- Date baseTime = syncInfo.getTimeStamp();
- if (baseTime != null) {
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_baseTimestamp);
- createLabel(composite, DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(syncInfo.getTimeStamp()));
- }
-
- // Modified
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_modified);
- createLabel(composite, cvsResource.isModified(null) ? CVSUIMessages.yes : CVSUIMessages.no); //
- }
-
- // Keyword Mode
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_keywordMode);
- createLabel(composite, syncInfo.getKeywordMode().getLongDisplayText());
-
- // Tag
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_tag);
- CVSTag tag = Util.getAccurateFileTag(cvsResource);
- createLabel(composite, getTagLabel(tag));
- } catch (TeamException e) {
- // Display error text
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_error);
- createLabel(composite, ""); //$NON-NLS-1$
- }
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.FILE_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- protected Label createLabel(Composite parent, String text) {
- return createLabel(parent, text, 1);
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- // Get the file that is the source of this property page
- file = null;
- IAdaptable element = getElement();
- if (element instanceof IFile) {
- file = (IFile)element;
- } else {
- Object adapter = element.getAdapter(IFile.class);
- if (adapter instanceof IFile) {
- file = (IFile)adapter;
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
deleted file mode 100644
index 7cb05814e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.ui.PlatformUI;
-
-public class CVSFolderPropertiesPage extends CVSPropertiesPage {
-
- IFolder folder;
- private Label root;
- private Label repository;
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- initialize();
- noDefaultAndApplyButton();
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- try {
- ICVSFolder cvsResource = CVSWorkspaceRoot.getCVSFolderFor(folder);
- if (!cvsResource.isManaged()) {
- if (cvsResource.isIgnored()) {
- createLabel(composite, CVSUIMessages.CVSFolderPropertiesPage_ignored, 2);
- } else {
- createLabel(composite, CVSUIMessages.CVSFolderPropertiesPage_notManaged, 2);
- }
- } else if (!cvsResource.isCVSFolder()) {
- // We have a managed folder which is not a cvs folder.
- // This is really an invalid state but it does happen once in a while
- createLabel(composite, CVSUIMessages.CVSFolderPropertiesPage_notCVSFolder, 2);
- } else {
- FolderSyncInfo syncInfo = cvsResource.getFolderSyncInfo();
- createLabel(composite, CVSUIMessages.CVSFolderPropertiesPage_root);
- root = createLabel(composite, syncInfo.getRoot());
- createLabel(composite, CVSUIMessages.CVSFolderPropertiesPage_repository);
- repository = createLabel(composite, syncInfo.getRepository());
-
- // Tag
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_tag);
- CVSTag tag = syncInfo.getTag();
-
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(folder, tag);
- }
-
- createLabel(composite, getTagLabel(tag));
-
- // Static-ness
- if (syncInfo.getIsStatic()) {
- createLabel(composite, CVSUIMessages.CVSFolderPropertiesPage_static);
- createLabel(composite, syncInfo.getIsStatic() ? CVSUIMessages.yes : CVSUIMessages.no); //
- }
-
- createLabel(composite, "", 2); // spacer //$NON-NLS-1$
-
- // Allow the folder to be disconnected from CVS control
- final Button disconnect = new Button(composite, SWT.NONE);
- disconnect.setText(CVSUIMessages.CVSFolderPropertiesPage_disconnect);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, disconnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- disconnect.setLayoutData(data);
- disconnect.addListener(SWT.Selection, new Listener() {
- public void handleEvent (Event event) {
- // perform a disconnect
- if (disconnectFolder()) {
- root.setText(CVSUIMessages.CVSFilePropertiesPage_none);
- repository.setText(CVSUIMessages.CVSFilePropertiesPage_none);
- disconnect.setEnabled(false);
- }
- }
- });
- }
- } catch (TeamException e) {
- // Display error text
- createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_error, 2);
- }
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.FOLDER_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- protected Label createLabel(Composite parent, String text) {
- return createLabel(parent, text, 1);
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- // Get the file that is the source of this property page
- folder = null;
- IAdaptable element = getElement();
- if (element instanceof IFolder) {
- folder = (IFolder)element;
- } else {
- Object adapter = element.getAdapter(IFolder.class);
- if (adapter instanceof IFolder) {
- folder = (IFolder)adapter;
- }
- }
- }
-
- private boolean disconnectFolder() {
- if (MessageDialog.openQuestion(getShell(), CVSUIMessages.CVSFolderPropertiesPage_disconnectTitle, CVSUIMessages.CVSFolderPropertiesPage_disconnectQuestion)) { //
- final ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- cvsFolder.unmanage(null);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- return false;
- } catch (InterruptedException e) {
- // Ignore
- }
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
deleted file mode 100644
index d41fa8235..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.filehistory.CVSFileRevision;
-import org.eclipse.team.internal.ui.history.AbstractHistoryCategory;
-
-public class CVSHistoryFilter extends ViewerFilter {
- public String author;
- public Date fromDate;
- public Date toDate;
- public String comment;
- public boolean isOr;
- private int matchCounter;
-
- public CVSHistoryFilter(String author, String comment, Date fromDate, Date toDate, boolean isOr) {
- this.author = author;
- this.comment = comment;
- this.fromDate = fromDate;
- this.toDate = toDate;
- this.isOr = isOr;
- this.matchCounter = 0;
- }
-
- /**
- * @see ViewerFilter#select(Viewer, Object, Object)
- */
- public boolean select(Viewer aviewer, Object parentElement, Object element) {
- if (element instanceof AbstractHistoryCategory)
- return true;
-
- if (element instanceof CVSFileRevision) {
- CVSFileRevision entry = (CVSFileRevision) element;
- if (isOr) {
- //empty fields should be considered a non-match
- boolean orSearch = (hasAuthor() && authorMatch(entry)) || (hasDate() && dateMatch(entry)) || (hasComment() && commentMatch(entry));
- if (orSearch)
- matchCounter++;
-
- return orSearch;
- } else {
- //"and" search
- //empty fields should be considered a match
- boolean andSearch = (!hasAuthor() || authorMatch(entry)) && (!hasDate() || dateMatch(entry)) && (!hasComment() || commentMatch(entry));
- if (andSearch)
- matchCounter++;
-
- return andSearch;
- }
- }
- return false;
- }
-
- protected boolean authorMatch(CVSFileRevision revision) {
- return revision.getAuthor().equals(author);
- }
-
- protected boolean commentMatch(CVSFileRevision revision) {
- return !(revision.getComment().toLowerCase().indexOf(comment.toLowerCase()) == -1);
- }
-
- protected boolean dateMatch(CVSFileRevision revision) {
- return isAfterFromDate(revision) && isBeforeToDate(revision);
- }
-
- private boolean isBeforeToDate(CVSFileRevision revision) {
- if (toDate == null)
- return true;
- return (toDate.after(new Date(revision.getTimestamp())));
- }
-
- private boolean isAfterFromDate(CVSFileRevision revision) {
- if (fromDate == null)
- return true;
- return (fromDate.before(new Date(revision.getTimestamp())));
- }
-
- 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;
- }
-
- public int getMatchCount(){
- return matchCounter;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterAction.java
deleted file mode 100644
index cf75899c9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.*;
-
-public class CVSHistoryFilterAction extends Action {
- private TreeViewer viewer;
- private CVSHistoryFilter filter;
- private CVSHistoryPage page;
-
- public CVSHistoryFilterAction(CVSHistoryPage page) {
- this.page = page;
- }
-
- /**
- * @see IViewActionDelegate#init(IViewPart)
- */
- public void init(TreeViewer viewer) {
- this.viewer = viewer;
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run() {
- CVSHistoryFilterDialog historyDialog = new CVSHistoryFilterDialog(viewer.getControl().getShell());
- if (filter != null) {
- historyDialog.setFilter(filter);
- }
- if (historyDialog.open() == Window.CANCEL) {
- return;
- }
-
- filter = historyDialog.getFilter();
- page.showFilter(filter);
- }
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java
deleted file mode 100644
index 71d4867d0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Date;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.PlatformUI;
-
-import com.ibm.icu.util.Calendar;
-
-public class CVSHistoryFilterDialog extends TrayDialog {
-
- private CVSHistoryFilter historyFilter;
-
- //widgets
- private Button orRadio;
- private Button andRadio;
- private Text author;
- private Text comment;
- private DateTime fromDate;
- private DateTime toDate;
-
- public CVSHistoryFilterDialog(Shell shell) {
- super(shell);
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(CVSUIMessages.HistoryFilterDialog_title);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite topLevel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- topLevel.setLayout(layout);
-
- //"and" and "or" search radio buttons
- Label label = new Label(topLevel, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setText(CVSUIMessages.HistoryFilterDialog_showMatching);
-
- andRadio = new Button(topLevel, SWT.RADIO);
- andRadio.setText(CVSUIMessages.HistoryFilterDialog_matchingAll);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- andRadio.setLayoutData(data);
- andRadio.setSelection(true);
-
- orRadio = new Button(topLevel, SWT.RADIO);
- orRadio.setText(CVSUIMessages.HistoryFilterDialog_matchingAny);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- orRadio.setLayoutData(data);
-
- //author
- label = new Label(topLevel, SWT.NONE);
- label.setText(CVSUIMessages.HistoryFilterDialog_author);
- author = new Text(topLevel, SWT.BORDER);
- author.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- //comment
- label = new Label(topLevel, SWT.NONE);
- label.setText(CVSUIMessages.HistoryFilterDialog_comment);
- comment = new Text(topLevel, SWT.BORDER);
- comment.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- //"from" date
- label = new Label(topLevel, SWT.NONE);
- label.setText(CVSUIMessages.HistoryFilterDialog_fromDate);
- fromDate = new DateTime(topLevel, SWT.DATE);
-
- //"to" date
- label = new Label(topLevel, SWT.NONE);
- label.setText(CVSUIMessages.HistoryFilterDialog_toDate);
- toDate = new DateTime(topLevel, SWT.DATE);
-
- initializeValues();
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(topLevel, IHelpContextIds.HISTORY_FILTER_DIALOG);
- Dialog.applyDialogFont(parent);
- return topLevel;
- }
-
- void initializeValues() {
- if (historyFilter == null)
- return;
- if (historyFilter.author != null) {
- author.setText(historyFilter.author);
- }
- if (historyFilter.comment != null) {
- comment.setText(historyFilter.comment);
- }
- orRadio.setSelection(historyFilter.isOr);
- andRadio.setSelection(!historyFilter.isOr);
- Calendar calendar = Calendar.getInstance();
- if (historyFilter.fromDate != null) {
- calendar.setTime(historyFilter.fromDate);
- fromDate.setDay(calendar.get(Calendar.DATE));
- fromDate.setMonth(calendar.get(Calendar.MONTH));
- fromDate.setYear(calendar.get(Calendar.YEAR));
- }
- if (historyFilter.toDate != null) {
- calendar.setTime(historyFilter.toDate);
- toDate.setDay(calendar.get(Calendar.DATE));
- toDate.setMonth(calendar.get(Calendar.MONTH));
- toDate.setYear(calendar.get(Calendar.YEAR));
- }
- }
-
- /**
- * 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 = getFromDate();
- Date toDate = getToDate();
-
- //create the filter
- historyFilter = new CVSHistoryFilter(author.getText(), comment.getText(), fromDate, toDate, orRadio.getSelection());
-
- super.buttonPressed(buttonId);
- }
-
- /**
- * Get the date from the given widget or <code>null</code>
- * if the date is today's date.
- * @param calendar a calendar to compute the date
- * @param dateWidget the date widget holding the date
- * @return the date from the given widget or <code>null</code>
- */
- private Calendar getCalendar(DateTime dateWidget) {
- Calendar calendar = Calendar.getInstance();
- if (isFutureDate(dateWidget, calendar)) {
- return null;
- }
- calendar.set(Calendar.YEAR, dateWidget.getYear());
- calendar.set(Calendar.MONTH, dateWidget.getMonth());
- calendar.set(Calendar.DATE, dateWidget.getDay());
-
- //set the hours, minutes and seconds to 00
- //so as to cover the whole day
- calendar.set(Calendar.HOUR_OF_DAY, 0);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
- return calendar;
- }
-
- private boolean isFutureDate(DateTime dateWidget, Calendar calendar) {
- if (calendar.get(Calendar.YEAR) < dateWidget.getYear())
- return true;
- if (calendar.get(Calendar.YEAR) == dateWidget.getYear()) {
- if (calendar.get(Calendar.MONTH) < dateWidget.getMonth())
- return true;
- if (calendar.get(Calendar.MONTH) == dateWidget.getMonth()
- && calendar.get(Calendar.DAY_OF_MONTH) <= dateWidget.getDay())
- return true;
- }
- return false;
- }
-
- //either user input or the smallest date available
- private Date getFromDate() {
- Calendar calendar = getCalendar(fromDate);
- if (calendar == null)
- return null;
-
- //set the hours, minutes and seconds to 00
- //so as to cover the whole day
- calendar.set(Calendar.HOUR_OF_DAY, 0);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
- return calendar.getTime();
- }
-
- //either user input or today
- private Date getToDate() {
- Calendar calendar = getCalendar(toDate);
- if (calendar == null)
- return null;
-
- //set the hours, minutes and seconds to 23, 59, 59
- //so as to cover the whole day
- calendar.set(Calendar.HOUR_OF_DAY, 23);
- calendar.set(Calendar.MINUTE, 59);
- calendar.set(Calendar.SECOND, 59);
- return calendar.getTime();
- }
-
- /**
- * Returns the filter that was created from the provided
- * user input.
- */
- public CVSHistoryFilter getFilter() {
- return historyFilter;
- }
-
- /**
- * Set the intial value of the dialog to the given filter.
- */
- public void setFilter(CVSHistoryFilter filter) {
- this.historyFilter = filter;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
deleted file mode 100644
index abc2cef9a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ /dev/null
@@ -1,1984 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Eugene Kuleshov <eu@md.pp.ru> - Bug 153932 [History] Custom hyperlink detectors for comments in History view
- * Brock Janiczak (brockj@tpg.com.au) - Bug 181899 CVS History wrongly ordered
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.resources.mapping.ResourceChangeValidator;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.revisions.Revision;
-import org.eclipse.jface.text.source.*;
-import org.eclipse.jface.util.IOpenEventListener;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.history.*;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.filehistory.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.actions.MoveRemoteTagAction;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.core.history.LocalFileRevision;
-import org.eclipse.team.internal.ui.TeamUIMessages;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.CompareRevisionAction;
-import org.eclipse.team.internal.ui.actions.OpenRevisionAction;
-import org.eclipse.team.internal.ui.history.*;
-import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;
-import org.eclipse.team.ui.history.*;
-import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.progress.IProgressConstants;
-import org.eclipse.ui.texteditor.*;
-
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.util.Calendar;
-
-public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryCompareAdapter {
-
- /* private */ ICVSFile file;
- /* private */ ICVSFile previousFile;
- /* private */ IFileRevision currentFileRevision;
- private ITypedElement fileElement;
-
- // cached for efficiency
- /* private */ CVSFileHistory cvsFileHistory;
- /* private */IFileRevision[] entries;
-
- /* private */CVSHistoryTableProvider historyTableProvider;
-
- private Composite tagAndTextComposite;
- private Composite searchComposite;
-
- /* private */TreeViewer treeViewer;
- /* private */TextViewer textViewer;
- /* private */TableViewer tagViewer;
-
- /* private */CompareRevisionAction compareAction;
- /* private */OpenRevisionAction openAction;
-
- private CVSHistoryFilterAction cvsHistoryFilter;
- private IAction toggleTextAction;
- private IAction toggleTextWrapAction;
- private IAction toggleListAction;
- private IAction toggleFilterAction;
- private IAction toggleSearchAction;
- private TextViewerAction copyAction;
- private TextViewerAction selectAllAction;
- private Action getContentsAction;
- private Action getRevisionAction;
- private Action refreshAction;
-
- private Action tagWithExistingAction;
- private Action localMode;
- private Action remoteMode;
- private Action remoteLocalMode;
- private Action groupByDateMode;
- private Action collapseAll;
- private Action compareModeAction;
-
- private SashForm sashForm;
- private SashForm innerSashForm;
- private SashForm searchSashForm;
-
- private Image branchImage;
- private Image versionImage;
-
- protected IFileRevision currentSelection;
-
- /* private */RefreshCVSFileHistory refreshCVSFileHistoryJob;
-
- /* private */boolean shutdown = false;
-
- /* private */boolean localFilteredOut = false;
- /* private */boolean remoteFilteredOut = false;
-
- private HistoryResourceListener resourceListener;
-
- //toggle constants for default click action
- private boolean compareMode = false;
-
- //filter constants
- public final static int REMOTE_LOCAL_MODE = 0;
- public final static int REMOTE_MODE = 1;
- public final static int LOCAL_MODE = 2;
-
- //current filter mode
- private int currentFilerMode = 0;
-
- //text field used for search
- private Text searchField;
-
- //grouping on
- private boolean groupingOn;
- private CVSHistoryFilter historyFilter;
- private CVSHistorySearchFilter searchFilter;
- private RevisionAnnotationController rulerSelectionListener;
-
- private int refreshRequest = 0;
- private DateFormat dateTimeFormat;
- private String description;
-
- public CVSHistoryPage(Object object) {
- this.file = getCVSFile(object);
- }
-
- public void createControl(Composite parent) {
- initializeImages();
-
- sashForm = new SashForm(parent, SWT.VERTICAL);
- sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- treeViewer = createTree(sashForm);
-
- tagAndTextComposite = new Composite(sashForm, SWT.NONE);
- tagAndTextComposite.setLayout(new FillLayout());
- innerSashForm = new SashForm(tagAndTextComposite, SWT.HORIZONTAL);
- tagViewer = createTagTable(innerSashForm);
- textViewer = createText(innerSashForm);
-
- searchComposite = new Composite(sashForm, SWT.NONE);
- searchComposite.setLayout(new FillLayout());
- searchSashForm = new SashForm(searchComposite, SWT.HORIZONTAL);
- //Find field
- searchField = new Text(searchSashForm, SWT.SEARCH);
- searchField.setText(CVSUIMessages.CVSHistoryPage_EnterSearchTerm);
- final SearchHistoryTable searchHistoryTable = new SearchHistoryTable();
- searchField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e){
- Display.getDefault().timerExec(1000, searchHistoryTable);
- }
- });
-
- sashForm.setWeights(new int[] {65, 20, 15});
- innerSashForm.setWeights(new int[] {50, 50});
-
- contributeActions();
-
- setViewerVisibility();
-
- IHistoryPageSite parentSite = getHistoryPageSite();
- if (parentSite != null && parentSite instanceof DialogHistoryPageSite && treeViewer != null)
- parentSite.setSelectionProvider(treeViewer);
-
- resourceListener = new HistoryResourceListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceListener, IResourceChangeEvent.POST_CHANGE);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(sashForm, IHelpContextIds.RESOURCE_HISTORY_VIEW);
- }
-
- private TextViewer createText(SashForm parent) {
- SourceViewer result = new SourceViewer(parent, null, null, true, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY);
- result.getTextWidget().setIndent(2);
- result.configure(new TextSourceViewerConfiguration(EditorsUI.getPreferenceStore()) {
- protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
- return Collections.singletonMap("org.eclipse.ui.DefaultTextEditor", //$NON-NLS-1$
- new IAdaptable() {
- public Object getAdapter(Class adapter) {
- if(adapter==IFile.class && getInput() instanceof IFile) {
- return getInput();
- } else if(adapter==IFileHistory.class && getInput() instanceof IFileHistory) {
- return getInput();
- }
- return Platform.getAdapterManager().getAdapter(CVSHistoryPage.this, adapter);
- }
- });
- }
- });
-
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- copyAction.update();
- }
- });
- result.setTextDoubleClickStrategy(
- new DefaultTextDoubleClickStrategy(),
- IDocument.DEFAULT_CONTENT_TYPE);
- result.activatePlugins();
- return result;
- }
-
- private TableViewer createTagTable(SashForm parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- 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];
- ITag[] tags = (ITag[]) inputElement;
- return tags;
- }
- });
- result.setLabelProvider(new LabelProvider() {
- public Image getImage(Object element) {
- if (element == null)
- return null;
- ITag tag = (ITag) element;
- if (!(tag instanceof CVSTag))
- return null;
-
- switch (((CVSTag)tag).getType()) {
- case CVSTag.BRANCH:
- case CVSTag.HEAD:
- return branchImage;
- case CVSTag.VERSION:
- return versionImage;
- }
- return null;
- }
-
- public String getText(Object element) {
- return ((ITag) element).getName();
- }
- });
- result.setComparator(new ViewerComparator() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e1 instanceof ITag) || !(e2 instanceof ITag))
- 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;
- }
-
- public void setFocus() {
- sashForm.setFocus();
- if (refreshRequest != 0) {
- refresh(refreshRequest);
- refreshRequest = 0;
- }
- }
-
- protected void contributeActions() {
- CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
-
- //Refresh
- refreshAction = new Action(CVSUIMessages.HistoryView_refreshLabel, plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED)) {
- public void run() {
- refresh();
- }
- };
- refreshAction.setToolTipText(CVSUIMessages.HistoryView_refresh);
- refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED));
- refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH));
-
- //Local Mode
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- localMode = new Action(CVSUIMessages.CVSHistoryPage_LocalModeAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALMODE)) {
- public void run() {
- if (isChecked()){
- store.setValue(ICVSUIConstants.PREF_REVISION_MODE, LOCAL_MODE);
- updateFilterMode(LOCAL_MODE);
- } else
- setChecked(true);
- }
- };
- localMode.setToolTipText(CVSUIMessages.CVSHistoryPage_LocalModeTooltip);
- localMode.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALMODE_DISABLED));
- localMode.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALMODE));
-
- //Remote Mode
- remoteMode = new Action(CVSUIMessages.CVSHistoryPage_RemoteModeAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_REMOTEMODE)) {
- public void run() {
- if (isChecked()){
- store.setValue(ICVSUIConstants.PREF_REVISION_MODE, REMOTE_MODE);
- updateFilterMode(REMOTE_MODE);
- } else
- setChecked(true);
- }
- };
- remoteMode.setToolTipText(CVSUIMessages.CVSHistoryPage_RemoteModeTooltip);
- remoteMode.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REMOTEMODE_DISABLED));
- remoteMode.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REMOTEMODE));
-
- //Remote + Local Mode
- remoteLocalMode = new Action(CVSUIMessages.CVSHistoryPage_CombinedModeAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALREMOTE_MODE)) {
- public void run() {
- if (isChecked()){
- store.setValue(ICVSUIConstants.PREF_REVISION_MODE, REMOTE_LOCAL_MODE);
- updateFilterMode(REMOTE_LOCAL_MODE);
- } else
- setChecked(true);
- }
- };
- remoteLocalMode.setToolTipText(CVSUIMessages.CVSHistoryPage_CombinedModeTooltip);
- remoteLocalMode.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALREMOTE_MODE_DISABLED));
- remoteLocalMode.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALREMOTE_MODE));
-
- //set the inital filter to both remote and local
- updateFilterMode(store.getInt(ICVSUIConstants.PREF_REVISION_MODE));
-
- //Group by Date
- groupByDateMode = new Action(CVSUIMessages.CVSHistoryPage_GroupByDate, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY)){
- public void run() {
- groupingOn = !groupingOn;
- store.setValue(ICVSUIConstants.PREF_GROUPBYDATE_MODE, groupingOn);
- refreshHistory(false, false, CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE);
- }
- };
- groupingOn = store.getBoolean(ICVSUIConstants.PREF_GROUPBYDATE_MODE);
- groupByDateMode.setChecked(groupingOn);
- groupByDateMode.setToolTipText(CVSUIMessages.CVSHistoryPage_GroupByDate);
- groupByDateMode.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY));
- groupByDateMode.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY));
-
- //Collapse All
- collapseAll = new Action(CVSUIMessages.CVSHistoryPage_CollapseAllAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL)) {
- public void run() {
- treeViewer.collapseAll();
- }
- };
- collapseAll.setToolTipText(CVSUIMessages.CVSHistoryPage_CollapseAllTooltip);
- collapseAll.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL));
- collapseAll.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL));
-
- //Compare Mode Action
- compareModeAction = new Action(CVSUIMessages.CVSHistoryPage_CompareModeToggleAction,plugin.getImageDescriptor(ICVSUIConstants.IMG_COMPARE_VIEW)) {
- public void run() {
- compareMode = !compareMode;
- compareModeAction.setChecked(compareMode);
- }
- };
- compareModeAction.setToolTipText(CVSUIMessages.CVSHistoryPage_CompareModeTooltip);
- compareModeAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COMPARE_VIEW));
- compareModeAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COMPARE_VIEW));
- compareModeAction.setChecked(false);
-
- // Click Compare action
- compareAction = new CompareRevisionAction(CVSUIMessages.CVSHistoryPage_CompareRevisionAction);
- treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- //update the current
- compareAction.setCurrentFileRevision(getCurrentFileRevision());
- compareAction.selectionChanged((IStructuredSelection) treeViewer.getSelection());
- }
- });
- compareAction.setPage(this);
-
- openAction = new OpenRevisionAction(CVSUIMessages.CVSHistoryPage_OpenAction);
- treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- openAction.selectionChanged((IStructuredSelection) treeViewer.getSelection());
- }
- });
- openAction.setPage(this);
-
- OpenStrategy handler = new OpenStrategy(treeViewer.getTree());
- handler.addOpenListener(new IOpenEventListener() {
- public void handleOpen(SelectionEvent e) {
- if (getSite() != null) {
- StructuredSelection tableStructuredSelection = (StructuredSelection) treeViewer.getSelection();
- if (compareMode){
- StructuredSelection sel = new StructuredSelection(new Object[] {getCurrentFileRevision(), tableStructuredSelection.getFirstElement()});
- compareAction.selectionChanged(sel);
- compareAction.run();
- } else {
- //Pass in the entire structured selection to allow for multiple editor openings
- StructuredSelection sel = tableStructuredSelection;
- openAction.selectionChanged(sel);
- openAction.run();
- }
- }
- }
- });
-
- getContentsAction = getContextMenuAction(CVSUIMessages.HistoryView_getContentsAction, true /* needs progress */, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, 100);
- try {
- if(confirmOverwrite() && validateChange()) {
- IStorage currentStorage = currentSelection.getStorage(new SubProgressMonitor(monitor, 50));
- InputStream in = currentStorage.getContents();
- ((IFile)file.getIResource()).setContents(in, false, true, new SubProgressMonitor(monitor, 50));
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- } finally {
- monitor.done();
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getContentsAction, IHelpContextIds.GET_FILE_CONTENTS_ACTION);
-
- getRevisionAction = getContextMenuAction(CVSUIMessages.HistoryView_getRevisionAction, true /* needs progress */, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ICVSRemoteFile remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(((CVSFileRevision) currentSelection).getCVSRemoteFile());
- try {
- if(confirmOverwrite() && validateChange()) {
- CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
-
- if(CVSAction.checkForMixingTags(getHistoryPageSite().getShell(), new IResource[] {file.getIResource()}, revisionTag)) {
- new UpdateOperation(
- null,
- new IResource[] {file.getIResource()},
- new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
- revisionTag)
- .run(monitor);
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
- }
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Cancelled by user
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getRevisionAction, IHelpContextIds.GET_FILE_REVISION_ACTION);
-
- // Override MoveRemoteTagAction to work for log entries
- final IActionDelegate tagActionDelegate = new MoveRemoteTagAction() {
- protected ICVSResource[] getSelectedCVSResources() {
- ICVSResource[] resources = super.getSelectedCVSResources();
- if (resources == null || resources.length == 0) {
- ArrayList logEntrieFiles = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- logEntrieFiles = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof CVSFileRevision) {
- logEntrieFiles.add(((CVSFileRevision)next).getCVSRemoteFile());
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSResource.class);
- if (adapter instanceof ICVSResource) {
- logEntrieFiles.add(((ILogEntry)adapter).getRemoteFile());
- continue;
- }
- }
- }
- }
- if (logEntrieFiles != null && !logEntrieFiles.isEmpty()) {
- return (ICVSResource[])logEntrieFiles.toArray(new ICVSResource[logEntrieFiles.size()]);
- }
- }
- return resources;
- }
- /*
- * Override the creation of the tag operation in order to support
- * the refresh of the view after the tag operation completes
- */
- protected ITagOperation createTagOperation() {
- return new TagInRepositoryOperation(getTargetPart(), getSelectedRemoteResources()) {
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- super.execute(monitor);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if( ! wasCancelled()) {
- refresh();
- }
- }
- });
- };
- };
- }
- };
- tagWithExistingAction = getContextMenuAction(CVSUIMessages.HistoryView_tagWithExistingAction, false /* no progress */, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- tagActionDelegate.selectionChanged(tagWithExistingAction, treeViewer.getSelection());
- tagActionDelegate.run(tagWithExistingAction);
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getRevisionAction, IHelpContextIds.TAG_WITH_EXISTING_ACTION);
-
- // Toggle text visible action
- toggleTextAction = new Action(TeamUIMessages.GenericHistoryView_ShowCommentViewer) {
- public void run() {
- setViewerVisibility();
- store.setValue(ICVSUIConstants.PREF_SHOW_COMMENTS, toggleTextAction.isChecked());
- }
- };
- toggleTextAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_COMMENTS));
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextAction, IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION);
-
- // Toggle wrap comments action
- toggleTextWrapAction = new Action(TeamUIMessages.GenericHistoryView_WrapComments) {
- public void run() {
- setViewerVisibility();
- store.setValue(ICVSUIConstants.PREF_WRAP_COMMENTS, toggleTextWrapAction.isChecked());
- }
- };
- toggleTextWrapAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_WRAP_COMMENTS));
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextWrapAction, IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);
-
- // Toggle list visible action
- toggleListAction = new Action(TeamUIMessages.GenericHistoryView_ShowTagViewer) {
- public void run() {
- setViewerVisibility();
- store.setValue(ICVSUIConstants.PREF_SHOW_TAGS, toggleListAction.isChecked());
- }
- };
- toggleListAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_TAGS));
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction, IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);
-
- //Toggle search field
- toggleSearchAction= new Action(CVSUIMessages.CVSHistoryPage_ShowSearchField) {
- public void run() {
- setViewerVisibility();
- store.setValue(ICVSUIConstants.PREF_SHOW_SEARCH, toggleSearchAction.isChecked());
- if (!toggleSearchAction.isChecked()){
- if (searchFilter != null)
- treeViewer.removeFilter(searchFilter);
- } else {
- searchField.setText(CVSUIMessages.CVSHistoryPage_EnterSearchTerm);
- searchField.selectAll();
- searchField.setFocus();
- }
- }
- };
- toggleSearchAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_SEARCH));
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction, IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);
-
- toggleFilterAction = new Action(CVSUIMessages.CVSHistoryPage_NoFilter){
- public void run(){
- if (historyFilter != null)
- treeViewer.removeFilter(historyFilter);
- historyFilter = null;
- String old = CVSHistoryPage.this.description;
- CVSHistoryPage.this.description = null;
- CVSHistoryPage.this.firePropertyChange(CVSHistoryPage.this, P_NAME, old, getName());
- toggleFilterAction.setEnabled(false);
- }
- };
- toggleFilterAction.setEnabled(historyFilter != null);
-
- //Create the filter action
- cvsHistoryFilter = new CVSHistoryFilterAction(this);
- cvsHistoryFilter.setText(CVSUIMessages.CVSHistoryPage_FilterOn);
- cvsHistoryFilter.init(treeViewer);
- cvsHistoryFilter.setToolTipText(CVSUIMessages.CVSHistoryPage_FilterHistoryTooltip);
- cvsHistoryFilter.setImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_FILTER_HISTORY));
-
- //Contribute actions to popup menu
- MenuManager menuMgr = new MenuManager();
- Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTableMenu(menuMgr);
- }
- });
- menuMgr.setRemoveAllWhenShown(true);
- treeViewer.getTree().setMenu(menu);
- //Don't add the object contribution menu items if this page is hosted in a dialog
- IHistoryPageSite parentSite = getHistoryPageSite();
- if (!parentSite.isModal()) {
- IWorkbenchPart part = parentSite.getPart();
- if (part != null) {
- IWorkbenchPartSite workbenchPartSite = part.getSite();
- workbenchPartSite.registerContextMenu(menuMgr, treeViewer);
- }
- IPageSite pageSite = parentSite.getWorkbenchPageSite();
- if (pageSite != null) {
- IActionBars actionBars = pageSite.getActionBars();
- // Contribute toggle text visible to the toolbar drop-down
- IMenuManager actionBarsMenu = actionBars.getMenuManager();
- if (actionBarsMenu != null){
- actionBarsMenu.add(toggleTextWrapAction);
- actionBarsMenu.add(new Separator());
- actionBarsMenu.add(toggleTextAction);
- actionBarsMenu.add(toggleListAction);
- actionBarsMenu.add(new Separator());
- actionBarsMenu.add(toggleSearchAction);
- actionBarsMenu.add(new Separator());
- actionBarsMenu.add(cvsHistoryFilter);
- actionBarsMenu.add(toggleFilterAction);
- }
- // Create actions for the text editor
- copyAction = new TextViewerAction(textViewer, ITextOperationTarget.COPY);
- copyAction.setText(CVSUIMessages.HistoryView_copy);
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.COPY, copyAction);
-
- selectAllAction = new TextViewerAction(textViewer, ITextOperationTarget.SELECT_ALL);
- selectAllAction.setText(CVSUIMessages.HistoryView_selectAll);
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, selectAllAction);
-
- actionBars.updateActionBars();
- }
- }
-
-
-
- //Create the local tool bar
- IToolBarManager tbm = parentSite.getToolBarManager();
- if (tbm != null) {
- String fileNameQualifier = getFileNameQualifier();
- //Add groups
- tbm.add(new Separator(fileNameQualifier + "grouping")); //$NON-NLS-1$
- tbm.appendToGroup(fileNameQualifier+"grouping", groupByDateMode); //$NON-NLS-1$
- tbm.add(new Separator(fileNameQualifier+"modes")); //$NON-NLS-1$
- tbm.appendToGroup(fileNameQualifier+"modes", remoteLocalMode); //$NON-NLS-1$
- tbm.appendToGroup(fileNameQualifier+"modes", localMode); //$NON-NLS-1$
- tbm.appendToGroup(fileNameQualifier+"modes", remoteMode); //$NON-NLS-1$
- tbm.add(new Separator(fileNameQualifier+"collapse")); //$NON-NLS-1$
- tbm.appendToGroup(fileNameQualifier+"collapse", collapseAll); //$NON-NLS-1$
- if (!parentSite.isModal()) {
- //don't bother adding the compare mode toolbar button if in
- //a dialog; you can only compare from dialogs
- tbm.appendToGroup(fileNameQualifier+"collapse", compareModeAction); //$NON-NLS-1$
- }
- tbm.update(false);
- }
-
- 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 String getFileNameQualifier() {
- //Just append the current system time to generate a unique group name
- return Long.toString(System.currentTimeMillis());
- }
-
- private boolean isLocalHistoryFilteredOut() {
- return localFilteredOut;
- }
-
- private boolean isRemoteHistoryFilteredOut(){
- return remoteFilteredOut;
- }
-
- /* private */ void fillTableMenu(IMenuManager manager) {
- // file actions go first (view file)
- IHistoryPageSite parentSite = getHistoryPageSite();
- manager.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
-
- if (file != null && !parentSite.isModal()){
- manager.add(openAction);
- manager.add(compareAction);
- manager.add(new Separator("openCompare")); //$NON-NLS-1$
- }
- if (file != null &&
- !(file instanceof RemoteFile)) {
- // Add the "Add to Workspace" action if 1 revision is selected.
- ISelection sel = treeViewer.getSelection();
- if (!sel.isEmpty()) {
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection tempSelection = (IStructuredSelection) sel;
- if (tempSelection.size() == 1) {
- manager.add(getContentsAction);
- if (!(tempSelection.getFirstElement() instanceof LocalFileRevision)) {
- manager.add(getRevisionAction);
- manager.add(new Separator());
- if (!parentSite.isModal())
- manager.add(tagWithExistingAction);
- }
- }
- }
- }
- }
-
- if (!parentSite.isModal()){
- 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);
- }
-
- /**
- * 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 TreeViewer createTree(Composite parent) {
-
- historyTableProvider = new CVSHistoryTableProvider();
- TreeViewer viewer = historyTableProvider.createTree(parent, cvsFileHistory == null ? true : cvsFileHistory.isIncludeLocal());
-
- viewer.setContentProvider(new ITreeContentProvider() {
- public Object[] getElements(Object inputElement) {
-
- // The entries of already been fetch so return them
- if (entries != null)
- return entries;
-
- if (!(inputElement instanceof IFileHistory) &&
- !(inputElement instanceof AbstractHistoryCategory[]))
- return new Object[0];
-
- if (inputElement instanceof AbstractHistoryCategory[]){
- return (AbstractHistoryCategory[]) inputElement;
- }
-
- final IFileHistory fileHistory = (IFileHistory) inputElement;
- entries = fileHistory.getFileRevisions();
-
- return entries;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- entries = null;
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof AbstractHistoryCategory){
- return ((AbstractHistoryCategory) parentElement).getRevisions();
- }
-
- return null;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof AbstractHistoryCategory){
- IFileRevision[] revs = ((AbstractHistoryCategory) element).getRevisions();
- if (revs != null)
- return revs.length > 0;
- }
- return false;
- }
- });
-
- 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);
- setStatusLineMessage(null);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() != 1) {
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- setStatusLineMessage(null);
- return;
- }
- Object o = ss.getFirstElement();
- if (o instanceof AbstractHistoryCategory){
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- setStatusLineMessage(null);
- return;
- }
- IFileRevision entry = (IFileRevision)o;
- textViewer.setDocument(new Document(entry.getComment()));
- tagViewer.setInput(entry.getTags());
- setStatusLineMessage(CVSHistoryTableProvider.getCommentAsSingleLine(entry));
- }
- });
-
- return viewer;
- }
-
- private Action getContextMenuAction(String title, final boolean needsProgressDialog, final IWorkspaceRunnable action) {
- return new Action(title) {
- public void run() {
- try {
- if (file == null) return;
- ISelection selection = treeViewer.getSelection();
- if (!(selection instanceof IStructuredSelection)) return;
- IStructuredSelection ss = (IStructuredSelection)selection;
- Object o = ss.getFirstElement();
-
- if (o instanceof AbstractHistoryCategory)
- return;
-
- currentSelection = (IFileRevision)o;
- if(needsProgressDialog) {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- action.run(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } else {
- try {
- action.run(null);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- } catch (InvocationTargetException e) {
- IHistoryPageSite parentSite = getHistoryPageSite();
- CVSUIPlugin.openError(parentSite.getShell(), null, null, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- } catch (InterruptedException e) {
- // Do nothing
- }
- }
-
- public boolean isEnabled() {
- ISelection selection = treeViewer.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.getIResource().exists()) {
- try {
- if(file.isModified(null)) {
- String title = CVSUIMessages.HistoryView_overwriteTitle;
- String msg = CVSUIMessages.HistoryView_overwriteMsg;
- IHistoryPageSite parentSite = getHistoryPageSite();
- final MessageDialog dialog = new MessageDialog(parentSite.getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- final int[] result = new int[1];
- parentSite.getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }});
- if (result[0] != 0) {
- // cancel
- return false;
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- return true;
- }
-
- private boolean validateChange(){
- if (file!=null && file.getIResource().exists()) {
- IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
- factory.change((IFile) file.getIResource());
- return IDE.promptToConfirm(getHistoryPageSite().getShell(), CVSUIMessages.CVSHistoryPage_ValidateChangeTitle, NLS.bind(CVSUIMessages.CVSHistoryPage_ValidateChangeMessage, new String[]{file.getName()}), factory.getDelta(), new String[0], true /* syncExec */);
- }
-
- return false;
- }
-
- /*
- * Refresh the view by refetching the log entries for the remote file
- */
- public void refresh() {
- refresh(CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE);
- }
-
- public void refresh(int refreshFlags) {
- //refetch revisions, not a select only job
- // TODO
- refreshHistory(true, false, refreshFlags);
- }
-
- private void refreshHistory(boolean refetch, boolean selectOnly, int refreshFlags) {
- if (refreshCVSFileHistoryJob.getState() != Job.NONE){
- refreshCVSFileHistoryJob.cancel();
- }
- refreshCVSFileHistoryJob.setFileHistory(cvsFileHistory);
- IResource resource = previousFile.getIResource();
- if (resource != null){
- IResource workspaceFile = ResourcesPlugin.getWorkspace().getRoot().findMember(resource.getFullPath());
- refreshCVSFileHistoryJob.setWorkspaceFile((IFile) workspaceFile);
- }
- //if we need to refetch it's not a select only job and vice versa
- refreshCVSFileHistoryJob.setSelectOnly(selectOnly);
- refreshCVSFileHistoryJob.setRefetchHistory(refetch);
- refreshCVSFileHistoryJob.setIncludeLocals(!isLocalHistoryFilteredOut());
- refreshCVSFileHistoryJob.setIncludeRemote(!isRemoteHistoryFilteredOut());
- refreshCVSFileHistoryJob.setGrouping(groupingOn);
- refreshCVSFileHistoryJob.setRefreshFlags(refreshFlags);
- IHistoryPageSite parentSite = getHistoryPageSite();
- Utils.schedule(refreshCVSFileHistoryJob, getWorkbenchSite(parentSite));
- }
-
- private IWorkbenchPartSite getWorkbenchSite(IHistoryPageSite parentSite) {
- IWorkbenchPart part = parentSite.getPart();
- if (part != null)
- return part.getSite();
- return null;
- }
-
- /**
- * Select the revision in the receiver.
- */
- public void selectRevision(String revision) {
- IFileRevision entry = null;
- entry = getFileRevision(revision);
-
- if (entry != null) {
- IStructuredSelection selection = new StructuredSelection(entry);
- treeViewer.getTree().setRedraw(false);
- treeViewer.setSelection(selection, true);
- treeViewer.getTree().setRedraw(true);
- } else {
- //nothing to select so clear selection
- treeViewer.getTree().deselectAll();
- }
- }
-
- private IFileRevision getFileRevision(String revision) {
- if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getContentIdentifier().equals(revision)) {
- return entries[i];
- }
- }
- } else if (cvsFileHistory != null) {
- return cvsFileHistory.getFileRevision(revision);
- }
- return null;
- }
-
- /**
- * Select the local revision in the receiver. Local revisions are differentiated by their
- * timestamps.
- */
- public void selectLocalRevision(long timeStamp){
- IFileRevision entry = null;
- if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getTimestamp() == timeStamp) {
- entry = entries[i];
- break;
- }
- }
- }else if (cvsFileHistory != null) {
- IFileRevision[] tempEntries = cvsFileHistory.getFileRevisions();
- for (int i = 0; i < tempEntries.length; i++) {
- if (tempEntries[i].getTimestamp() == timeStamp) {
- entry = tempEntries[i];
- break;
- }
- }
- }
-
- if (entry != null) {
- IStructuredSelection selection = new StructuredSelection(entry);
- treeViewer.getTree().setRedraw(false);
- treeViewer.setSelection(selection, true);
- treeViewer.getTree().setRedraw(true);
- } else {
- //nothing to select so clear selection
- treeViewer.getTree().deselectAll();
- }
- }
-
- protected static ICVSFile getCVSFile(Object object) {
- // First, adapt to IResource and ensure mapped to CVS
- IResource resource = (IResource)Utils.getAdapter(object, IResource.class);
- if (resource instanceof IFile) {
- RepositoryProvider provider = RepositoryProvider.getProvider(((IResource)resource).getProject());
- if (provider instanceof CVSTeamProvider)
- return CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- return null;
- }
- // Second, try ICVSFile
- ICVSFile remoteFile = (ICVSFile)Utils.getAdapter(object, ICVSFile.class);
- if (remoteFile != null) {
- return remoteFile;
- }
- // Next, try ICVSResource
- ICVSResource remote = (ICVSResource)Utils.getAdapter(object, ICVSResource.class);
- if (remote instanceof RemoteFile) {
- return (ICVSFile)remote;
- }
- // Next, try IResourceVariant
- IResourceVariant variant = (IResourceVariant)Utils.getAdapter(object, IResourceVariant.class);
- if (variant instanceof RemoteFile) {
- return (ICVSFile)remote;
- }
- // Finally, try IFileRevision
- IFileRevision revision = (IFileRevision)Utils.getAdapter(object, IFileRevision.class);
- if (revision instanceof CVSFileRevision) {
- return ((CVSFileRevision)revision).getCVSRemoteFile();
- }
-
- return null;
- }
-
- /* private */void setViewerVisibility() {
- boolean showText = toggleTextAction.isChecked();
- boolean showList = toggleListAction.isChecked();
- boolean showSearch = toggleSearchAction.isChecked();
-
- //check to see if this page is being shown in a dialog, in which case
- //don't show the text and list panes
- IHistoryPageSite parentSite = getHistoryPageSite();
- if (parentSite.isModal()){
- showText = false;
- showList = false;
- }
-
-
- if (showText && showList && showSearch) {
- //tree + tag + text + search
- tagAndTextComposite.setVisible(true);
- searchComposite.setVisible(true);
- sashForm.setWeights(new int[] {60, 25, 15});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(null);
- searchSashForm.setMaximizedControl(null);
- } else if (showText && showSearch) {
- //tree + text + search
- tagAndTextComposite.setVisible(true);
- searchComposite.setVisible(true);
- sashForm.setWeights(new int[] {60, 25, 15});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(textViewer.getTextWidget());
- searchSashForm.setMaximizedControl(searchField);
- } else if (showList && showSearch) {
- //tree + tag + search
- tagAndTextComposite.setVisible(true);
- searchComposite.setVisible(true);
- sashForm.setWeights(new int[] {60, 25, 15});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(tagViewer.getTable());
- searchSashForm.setMaximizedControl(searchField);
- } else if (showSearch){
- //tree + search
- tagAndTextComposite.setVisible(false);
- searchComposite.setVisible(true);
- sashForm.setWeights(new int[] {85, 0, 15});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(null);
- searchSashForm.setMaximizedControl(searchField);
- } else if (showText && showList) {
- //tree + tag + text
- tagAndTextComposite.setVisible(true);
- searchComposite.setVisible(false);
- sashForm.setWeights(new int[] {70, 30, 0});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(null);
- searchSashForm.setMaximizedControl(searchField);
- } else if (showText) {
- //tree + text
- tagAndTextComposite.setVisible(true);
- searchComposite.setVisible(false);
- sashForm.setWeights(new int[] {70, 30, 0});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(textViewer.getTextWidget());
- } else if (showList) {
- //tree + tag
- tagAndTextComposite.setVisible(true);
- searchComposite.setVisible(false);
- sashForm.setWeights(new int[] {70, 30, 0});
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(tagViewer.getTable());
- } else {
- //tree
- tagAndTextComposite.setVisible(false);
- searchComposite.setVisible(false);
- sashForm.setMaximizedControl(treeViewer.getControl());
- }
-
- boolean wrapText = toggleTextWrapAction.isChecked();
- textViewer.getTextWidget().setWordWrap(wrapText);
- }
-
- private void initializeImages() {
- CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
- versionImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION).createImage();
- branchImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_TAG).createImage();
- }
-
- public void dispose() {
- shutdown = true;
-
- if (resourceListener != null){
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceListener);
- resourceListener = null;
- }
-
- if (branchImage != null) {
- branchImage.dispose();
- branchImage = null;
- }
- if (versionImage != null) {
- versionImage.dispose();
- versionImage = null;
- }
- if (rulerSelectionListener != null) {
- rulerSelectionListener.dispose();
- rulerSelectionListener= null;
- }
-
- //Cancel any incoming
- if (refreshCVSFileHistoryJob != null) {
- if (refreshCVSFileHistoryJob.getState() != Job.NONE) {
- refreshCVSFileHistoryJob.cancel();
- }
- }
- }
-
- public IFileRevision getCurrentFileRevision() {
- if (currentFileRevision != null)
- return currentFileRevision;
-
- if (file != null) {
- try {
- //Case 1 : file is remote
- if (file instanceof RemoteFile) {
- RemoteFile remote = (RemoteFile) file;
- currentFileRevision = cvsFileHistory.getFileRevision(remote.getContentIdentifier());
- //remote.getContents(monitor);
- //currentFileRevision = new CVSFileRevision(remote.getLogEntry(monitor));
- return currentFileRevision;
- }
- //Case 2 : file is local
- //if (file.isModified(monitor)) {
- //file has been modified locally
- IFile localFile = (IFile) file.getIResource();
- if (localFile != null) {
- //make sure that there's actually a resource associated with the file
- currentFileRevision = new LocalFileRevision(localFile);
- } else {
- //no local version exists
- if (file.getSyncInfo() != null) {
- currentFileRevision = cvsFileHistory.getFileRevision(file.getSyncInfo().getRevision());
- }
- }
- return currentFileRevision;
- } catch (CVSException e) {
- }
- }
-
- return null;
- }
-
- private final class CVSRevisionAnnotationController extends
- RevisionAnnotationController {
- public CVSRevisionAnnotationController(IWorkbenchPage page, IFile file) {
- super(page, file, treeViewer);
- }
-
- public CVSRevisionAnnotationController(IWorkbenchPage page, IStorageEditorInput editorInput) {
- super(page, editorInput, treeViewer);
- }
-
- protected Object getHistoryEntry(Revision selected) {
- return CVSHistoryPage.this.getFileRevision(selected.getId());
- }
- }
-
-
- private final class SearchHistoryTable implements Runnable {
- public void run() {
- String searchString = searchField.getText();
- if (searchString.equals("") || //$NON-NLS-1$
- searchString.equals(CVSUIMessages.CVSHistoryPage_EnterSearchTerm)) {
- if (searchFilter != null)
- treeViewer.removeFilter(searchFilter);
- return;
- }
-
-
- if (searchFilter != null)
- treeViewer.removeFilter(searchFilter);
-
- searchFilter = new CVSHistorySearchFilter(searchString);
-
- if (historyFilter != null)
- treeViewer.removeFilter(historyFilter);
-
- treeViewer.addFilter(searchFilter);
- }
- }
-
-
- private class RefreshCVSFileHistory extends Job {
- private final static int NUMBER_OF_CATEGORIES = 4;
-
- private CVSFileHistory fileHistory;
- private AbstractHistoryCategory[] categories;
- private boolean grouping;
- private Object[] elementsToExpand;
- private boolean revisionsFound;
- private IFile workspaceFile;
- private CVSHistoryPage page;
- private boolean selectOnly;
- private boolean useLocalSelect;
-
- private CVSLocalFileRevision localFileRevision;
-
- private int refreshFlags = CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE;
-
- public RefreshCVSFileHistory(CVSHistoryPage page) {
- super(CVSUIMessages.HistoryView_fetchHistoryJob);
- this.page = page;
- }
-
- public void setWorkspaceFile(IFile workspaceFile) {
- this.workspaceFile = workspaceFile;
- }
-
- public void setIncludeLocals(boolean flag) {
- if (fileHistory != null)
- fileHistory.includeLocalRevisions(flag);
- }
-
- public void setIncludeRemote(boolean flag){
- if (fileHistory != null)
- fileHistory.includeRemoteRevisions(flag);
- }
-
- public void setRefetchHistory(boolean refetch) {
- if (fileHistory != null)
- fileHistory.setRefetchRevisions(refetch);
- }
-
- public void setFileHistory(CVSFileHistory fileHistory) {
- this.fileHistory = fileHistory;
- }
-
- public void setGrouping (boolean value){
- this.grouping = value;
- }
-
- public void setSelectOnly(boolean select) {
- this.selectOnly = select;
- }
-
- public void setSelectLocal(boolean localSelect) {
- this.useLocalSelect = localSelect;
- }
-
- public void setLocalFileRevision(CVSLocalFileRevision localRev){
- this.localFileRevision = localRev;
- }
-
- public IStatus run(IProgressMonitor monitor) {
-
- IStatus status = Status.OK_STATUS;
-
- if (fileHistory != null && !shutdown) {
- //If fileHistory terminates in a bad way, try to fetch the local
- //revisions only
- boolean localFetched = false;
- boolean needsUpdate = true;
- if (!fileHistory.isInitialized() && fileHistory.isIncludeLocal() && (refreshFlags & CVSFileHistory.REFRESH_REMOTE) > 0) {
- // If this is the first refresh, show the local history before hitting the server
- try {
- fileHistory.refresh(CVSFileHistory.REFRESH_LOCAL, monitor);
- updateTable();
- localFetched = true;
- needsUpdate = false;
- } catch (TeamException e) {
- // Ignore and try the full refresh
- }
- }
- try {
- fileHistory.refresh(refreshFlags , monitor);
- needsUpdate = true;
- } catch (TeamException ex) {
- if (!localFetched) {
- try {
- fileHistory.refresh(CVSFileHistory.REFRESH_LOCAL, monitor);
- needsUpdate = true;
- } catch (TeamException e) {
- // Ignore and allow the original exception to go through
- }
- }
- status = new CVSStatus(ex.getStatus().getSeverity(), ex.getStatus().getCode(), ex.getMessage(), ex);
- }
- if (needsUpdate)
- updateTable();
- }
-
- if (status != Status.OK_STATUS ) {
- this.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
- this.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
-
- return status;
- }
-
- private void updateTable() {
- if (grouping)
- revisionsFound = sortRevisions();
-
- Utils.asyncExec(new Runnable() {
- public void run() {
- historyTableProvider.setLocalRevisionsDisplayed(fileHistory.isIncludeLocal());
- historyTableProvider.setFile(fileHistory, workspaceFile);
- //historyTableProvider.setWorkspaceFile(workspaceFile);
- if (!selectOnly){
- if (grouping) {
- mapExpandedElements(treeViewer.getExpandedElements());
- treeViewer.getTree().setLinesVisible(revisionsFound);
- treeViewer.getTree().setRedraw(false);
- treeViewer.setInput(categories);
- //if user is switching modes and already has expanded elements
- //selected try to expand those, else expand all
- if (elementsToExpand.length > 0)
- treeViewer.setExpandedElements(elementsToExpand);
- else {
- treeViewer.expandAll();
- Object[] el = treeViewer.getExpandedElements();
- if (el != null && el.length > 0) {
- treeViewer.setSelection(new StructuredSelection(el[0]));
- treeViewer.getTree().deselectAll();
- }
- }
- treeViewer.getTree().setRedraw(true);
- } else {
- if (fileHistory.getFileRevisions().length > 0) {
- treeViewer.getTree().setLinesVisible(true);
- treeViewer.setInput(fileHistory);
- } else {
- categories = new AbstractHistoryCategory[] {getErrorMessage()};
- treeViewer.getTree().setLinesVisible(false);
- treeViewer.setInput(categories);
- }
- }
- }
- //Update the history (if it exists) to reflect the new
- //counts
- if (historyFilter != null){
- CVSHistoryFilter tempFilter = new CVSHistoryFilter(historyFilter.author, historyFilter.comment, historyFilter.fromDate, historyFilter.toDate, historyFilter.isOr);
- showFilter(tempFilter);
- }
-
- //Select the current file if we didn't have to refetch the history
- if (file != null){
- try {
- if (useLocalSelect){
- page.selectLocalRevision(localFileRevision.getTimestamp());
- } else {
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- String workspaceRevision = ResourceSyncInfo.getRevision(syncBytes);
- page.selectRevision(workspaceRevision);
- }
- }
- } catch (CVSException e){
- }
- }
- }
- }, treeViewer);
- }
-
- private void mapExpandedElements(Object[] expandedElements) {
- //store the names of the currently expanded categories in a map
- HashMap elementMap = new HashMap();
- for (int i=0; i<expandedElements.length; i++){
- elementMap.put(((DateHistoryCategory)expandedElements[i]).getName(), null);
- }
-
- //Go through the new categories and keep track of the previously expanded ones
- ArrayList expandable = new ArrayList();
- for (int i = 0; i<categories.length; i++){
- //check to see if this category is currently expanded
- if (elementMap.containsKey(categories[i].getName())){
- expandable.add(categories[i]);
- }
- }
-
- elementsToExpand = new Object[expandable.size()];
- elementsToExpand = (Object[]) expandable.toArray(new Object[expandable.size()]);
- }
-
- private boolean sortRevisions() {
- IFileRevision[] fileRevision = fileHistory.getFileRevisions();
-
- //Create the 4 categories
- DateHistoryCategory[] tempCategories = new DateHistoryCategory[NUMBER_OF_CATEGORIES];
- //Get a calendar instance initialized to the current time
- Calendar currentCal = Calendar.getInstance();
- tempCategories[0] = new DateHistoryCategory(CVSUIMessages.CVSHistoryPage_Today, currentCal, null);
- //Get yesterday
- Calendar yesterdayCal = Calendar.getInstance();
- yesterdayCal.roll(Calendar.DAY_OF_YEAR, -1);
- tempCategories[1] = new DateHistoryCategory(CVSUIMessages.CVSHistoryPage_Yesterday, yesterdayCal, null);
- //Get this month
- Calendar monthCal = Calendar.getInstance();
- monthCal.set(Calendar.DAY_OF_MONTH, 1);
- tempCategories[2] = new DateHistoryCategory(CVSUIMessages.CVSHistoryPage_ThisMonth, monthCal, yesterdayCal);
- //Everything before this month is previous
- tempCategories[3] = new DateHistoryCategory(CVSUIMessages.CVSHistoryPage_Previous, null, monthCal);
-
- ArrayList finalCategories = new ArrayList();
- for (int i = 0; i<NUMBER_OF_CATEGORIES; i++){
- tempCategories[i].collectFileRevisions(fileRevision, false);
- if (tempCategories[i].hasRevisions())
- finalCategories.add(tempCategories[i]);
- }
-
- //Assume that some revisions have been found
- boolean revisionsFound = true;
-
- if (finalCategories.size() == 0){
- //no revisions found for the current mode, so add a message category
- finalCategories.add(getErrorMessage());
- revisionsFound = false;
- }
-
- categories = (AbstractHistoryCategory[])finalCategories.toArray(new AbstractHistoryCategory[finalCategories.size()]);
- return revisionsFound;
- }
-
- private MessageHistoryCategory getErrorMessage(){
- String message = ""; //$NON-NLS-1$
- switch(currentFilerMode){
- case LOCAL_MODE:
- message = CVSUIMessages.CVSHistoryPage_LocalModeTooltip;
- break;
-
- case REMOTE_MODE:
- message = CVSUIMessages.CVSHistoryPage_RemoteModeTooltip;
- break;
-
- case REMOTE_LOCAL_MODE:
- message = CVSUIMessages.CVSHistoryPage_NoRevisions;
- break;
- }
-
- MessageHistoryCategory messageCategory = new MessageHistoryCategory(NLS.bind(CVSUIMessages.CVSHistoryPage_NoRevisionsForMode, new String[] { message }));
- return messageCategory;
- }
-
- public int getRefreshFlags() {
- return refreshFlags;
- }
-
- public void setRefreshFlags(int refreshFlags) {
- this.refreshFlags = refreshFlags;
- }
-
-
-
- }
-
-
- /**
- * A default content provider to prevent subclasses from
- * having to implement methods they don't need.
- */
- private 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) {
- }
- }
-
- private class HistoryResourceListener implements IResourceChangeListener {
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta root = event.getDelta();
- //Safety check for non-managed files that are added with the CVSHistoryPage
- //in view
- if (file == null || file.getIResource() == null)
- return;
-
- IResourceDelta resourceDelta = root.findMember(((IFile)file.getIResource()).getFullPath());
- if (resourceDelta != null){
- String revision = getRevision();
- final boolean hasRevision = cvsFileHistory.getFileRevision(revision) != null;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (treeViewer.getControl().isDisposed())
- return;
- if (treeViewer.getControl().isVisible()) {
- if (hasRevision)
- refresh(CVSFileHistory.REFRESH_LOCAL);
- else
- refresh();
- } else {
- refreshRequest = hasRevision ? CVSFileHistory.REFRESH_LOCAL : CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE;
- }
- }
- });
- }
- }
-
- private String getRevision() {
- try {
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null && !ResourceSyncInfo.isAddition(syncBytes)) {
- return ResourceSyncInfo.getRevision(syncBytes);
- }
- } catch (CVSException e) {
- // Ignore the errors
- }
- return null;
- }
- }
-
- public Control getControl() {
- return sashForm;
- }
-
- public boolean isValidInput(Object object) {
- ICVSFile file = getCVSFile(object);
- return file != null;
- }
-
- public String getName() {
- if (description != null)
- return description;
- if (file != null)
- return file.getName();
-
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the path of the file currently being shown in the CVS History Page.
- * @return an IPath or <code>null</code> if the file is null
- */
- public IPath getFilePath() {
- if (file != null)
- return file.getIResource().getFullPath();
-
- return null;
- }
-
- public Object getAdapter(Class adapter) {
- if(adapter == IHistoryCompareAdapter.class) {
- return this;
- }
- return null;
- }
-
- public ICompareInput getCompareInput(Object object) {
- if (object instanceof IFileRevision){
- IFileRevision selectedFileRevision = (IFileRevision)object;
- if (fileElement == null)
- fileElement = SaveableCompareEditorInput.createFileElement((IFile) file.getIResource());
- FileRevisionTypedElement right = new FileRevisionTypedElement(selectedFileRevision, getLocalEncoding());
- DiffNode node = new DiffNode(fileElement, right);
- return node;
- }
- return null;
- }
-
- private String getLocalEncoding() {
- IResource resource = file.getIResource();
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- try {
- return file.getCharset();
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- }
- return null;
- }
-
- public void setClickAction(boolean compare) {
- //toggleCompareAction is going to switch the mode
- //so make sure that we're in the appropriate mode before
- compareMode = !compare;
- compareModeAction.run();
- }
-
- public void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) {
- initLabels(input, configuration);
- // TODO: pre-fetch contents
- }
-
- private void initLabels(ICompareInput input, CompareConfiguration cc) {
- String leftLabel = getFileRevisionLabel(input.getLeft(), cc);
- cc.setLeftLabel(leftLabel);
- String rightLabel = getFileRevisionLabel(input.getRight(), cc);
- cc.setRightLabel(rightLabel);
- }
-
- private String getFileRevisionLabel(ITypedElement element, CompareConfiguration cc) {
- String label = null;
-
- if (element instanceof IEditableContent) {
- //current revision
- if (element instanceof IModificationDate) {
- IModificationDate md = (IModificationDate) element;
- Date dateFromLong = new Date(md.getModificationDate());
- label = NLS.bind(TeamUIMessages.CompareFileRevisionEditorInput_workspace, new Object[]{ element.getName(), getDateTimeFormat().format(dateFromLong)});
- } else {
- label = element.getName();
- }
- return label;
-
- } else if (element instanceof FileRevisionTypedElement) {
- Object fileObject = ((FileRevisionTypedElement) element).getFileRevision();
-
- if (fileObject instanceof LocalFileRevision) {
- try {
- IStorage storage = ((LocalFileRevision) fileObject).getStorage(new NullProgressMonitor());
- if (Utils.getAdapter(storage, IFileState.class) != null) {
- //local revision
- label = NLS.bind(TeamUIMessages.CompareFileRevisionEditorInput_localRevision, new Object[]{element.getName(), ((FileRevisionTypedElement) element).getTimestamp()});
- }
- } catch (CoreException e) {
- }
- } else {
- label = NLS.bind(
- TeamUIMessages.CompareFileRevisionEditorInput_repository,
- new Object[]{
- element.getName(),
- ((FileRevisionTypedElement) element).getContentIdentifier(),
- ((FileRevisionTypedElement) element).getAuthor()
- });
- }
- }
- return label;
- }
-
- private synchronized DateFormat getDateTimeFormat() {
- if (dateTimeFormat == null)
- dateTimeFormat = DateFormat.getDateTimeInstance();
- return dateTimeFormat;
- }
-
- public String getDescription() {
- try {
- if (file != null)
- return file.getRepositoryRelativePath();
- } catch (CVSException e) {
- // Ignore
- }
- return null;
- }
-
- public boolean inputSet() {
- //reset currentFileRevision
- currentFileRevision = null;
- Object inputObj = getInput();
-
- ICVSFile cvsFile = getCVSFile(inputObj);
- if (cvsFile == null)
- return false;
-
-
- this.file = cvsFile;
- fileElement = null;
-
- if (refreshCVSFileHistoryJob == null)
- refreshCVSFileHistoryJob = new RefreshCVSFileHistory(this);
-
- //if this input is the same as the last, don't refetch the history
- //just update the selection
- boolean needRefresh = checkPreviousInput();
-
- //if the input is a local file revision, pass it to the refresh job to
- //allow the refresh job to use it to match the time stamp of the local
- //files displayed in the history page
- if (inputObj instanceof CVSLocalFileRevision){
- refreshCVSFileHistoryJob.setLocalFileRevision((CVSLocalFileRevision) inputObj);
- } else if (inputObj instanceof IFile) {
- refreshCVSFileHistoryJob.setLocalFileRevision(new CVSLocalFileRevision((IFile) inputObj));
- }
- //let the refresh job know which flavour of select to use (ie. select CVSFileRevisions
- //or CVSLocalFileRevision)
- refreshCVSFileHistoryJob.setSelectLocal(inputObj instanceof CVSLocalFileRevision || inputObj instanceof IFile);
-
-
- //If the file history doesn't need to be refreshed, we can just
- //use the previous input file history
- if (needRefresh){
- cvsFileHistory = new CVSFileHistory(cvsFile);
- //fetch both local and remote revisions the first time around
- cvsFileHistory.includeLocalRevisions(true);
- //blank current input only after we're sure that we have a file
- //to fetch history for
- this.treeViewer.setInput(null);
-
- linkWithEditor();
- }
-
- //always refresh the history if the input gets set - in which
- //case set the selectOnly to false
- refreshHistory(needRefresh, !needRefresh, CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE);
-
- if (toggleSearchAction!= null && toggleSearchAction.isChecked()){
- searchField.selectAll();
- }
-
- return true;
- }
-
-
-
- /**
- * @param page the workbench page that view and editor are contained in
- * @param editor the editor to link to the history view
- * @param historyView the history view to link to the editor
- */
- public void linkWithEditor() {
- if (rulerSelectionListener != null) {
- rulerSelectionListener.dispose();
- rulerSelectionListener= null;
- }
-
- if (!getHistoryPageSite().isModal()) {
- IResource resource = file.getIResource();
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- rulerSelectionListener= new CVSRevisionAnnotationController(getHistoryPageSite().getWorkbenchPageSite().getPage(), file);
- } else {
- Object input = getInput();
- if (input instanceof IStorageEditorInput) {
- IStorageEditorInput editorInput = (IStorageEditorInput) input;
- rulerSelectionListener= new CVSRevisionAnnotationController(getHistoryPageSite().getWorkbenchPageSite().getPage(), editorInput);
- }
- }
- }
- }
-
- /*
- * Check to see if we need to refresh the input; if the previous file
- * that was being shown
- */
- private boolean checkPreviousInput() {
-
- if (previousFile != null){
- try {
- if (isSameRemote(file, previousFile)
- && (isSameLocalFile(file, previousFile)
- || (!isLocal(file) && isLocal(previousFile)))) {
- return false;
- }
- } catch (CVSException e) {
- }
- }
-
- //set previous file to current file
- previousFile = file;
- return true;
- }
-
- private boolean isLocal(ICVSFile file) {
- return file.getIResource() != null;
- }
-
- private boolean isSameLocalFile(ICVSFile file, ICVSFile previousFile) {
- IResource r1 = file.getIResource();
- IResource r2 = previousFile.getIResource();
- return r1 != null && r2 != null && r1.equals(r2);
- }
-
- private boolean isSameRemote(ICVSFile file, ICVSFile previousFile) throws CVSException {
- String path = file.getRepositoryRelativePath();
- String previousPath = previousFile.getRepositoryRelativePath();
-
- //Could be comparing two local files with no remotes
- if (path == null && previousPath == null)
- return true;
-
- return (path != null && previousPath != null && path.equals(previousPath) && isSameRepository(file.getParent(), previousFile.getParent()));
- }
-
-
- private boolean isSameRepository(ICVSFolder parent1, ICVSFolder parent2) {
- try {
- FolderSyncInfo info1 = parent1.getFolderSyncInfo();
- FolderSyncInfo info2 = parent2.getFolderSyncInfo();
- return (info1 != null && info2 != null && info1.getRemoteLocation().equals(info2.getRemoteLocation()));
- } catch (CVSException e) {
- // Ignore
- }
- return false;
- }
-
- private void updateFilterMode(int mode) {
- currentFilerMode=mode;
- switch(mode){
- case LOCAL_MODE:
- localFilteredOut = false;
- remoteFilteredOut = true;
- localMode.setChecked(true);
- remoteMode.setChecked(false);
- remoteLocalMode.setChecked(false);
- break;
-
- case REMOTE_MODE:
- localFilteredOut = true;
- remoteFilteredOut = false;
- localMode.setChecked(false);
- remoteMode.setChecked(true);
- remoteLocalMode.setChecked(false);
- break;
-
- case REMOTE_LOCAL_MODE:
- localFilteredOut = false;
- remoteFilteredOut = false;
- localMode.setChecked(false);
- remoteMode.setChecked(false);
- remoteLocalMode.setChecked(true);
- break;
- }
-
- //the refresh job gets created once the input is set
- //don't bother trying to refresh any history until the input has been set
- if (refreshCVSFileHistoryJob != null){
- //don't refetch, but not a select only job (ie. have to get the
- //existing revisions corresponding to the mode change)
- refreshHistory(false, false, CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE);
- }
- }
-
- public TreeViewer getTreeViewer() {
- return treeViewer;
- }
-
- public void showFilter(CVSHistoryFilter filter) {
- if (historyFilter != null)
- treeViewer.removeFilter(historyFilter);
-
- historyFilter = filter;
- int before = cvsFileHistory.getFileRevisions().length;
- treeViewer.addFilter(historyFilter);
- IHistoryPageSite historyPageSite =getHistoryPageSite();
- if (historyPageSite instanceof WorkbenchHistoryPageSite){
- IWorkbenchPart part = ((WorkbenchHistoryPageSite) historyPageSite).getPart();
- if (part instanceof GenericHistoryView){
- String revisions = NLS.bind(CVSUIMessages.CVSHistoryPage_FilterOnMessage, new Object[]{new Integer(historyFilter.getMatchCount()),new Integer(before)});
- String old = getName();
- description = NLS.bind(CVSUIMessages.CVSHistoryPage_FilterDescription, new Object[]{file.getName(), revisions});
- CVSHistoryPage.this.firePropertyChange(CVSHistoryPage.this, P_NAME, old, getName());
- }
- }
- toggleFilterAction.setEnabled(true);
- }
-
- /*
- * Sets the filter mode for the page.
- * param flag LOCAL_MODE, REMOTE_MODE, REMOTE_LOCAL_MODE
- */
- public void setMode(int flag){
- switch(flag){
- case LOCAL_MODE:
- localMode.setChecked(true);
- localMode.run();
- break;
-
- case REMOTE_MODE:
- remoteMode.setChecked(true);
- remoteMode.run();
- break;
-
- case REMOTE_LOCAL_MODE:
- remoteLocalMode.setChecked(true);
- remoteLocalMode.run();
- break;
- }
-
- //refetch revisions, not a select only job
- refreshHistory(true, false, CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE);
- }
-
- /**
- * Save any changes that are buffered in the pages typed element.
- * @param monitor a progress monitor.
- * @throws CoreException
- */
- public void saveChanges(IProgressMonitor monitor) throws CoreException {
- if (fileElement instanceof LocalResourceTypedElement) {
- LocalResourceTypedElement element = (LocalResourceTypedElement) fileElement;
- element.commit(monitor);
- }
- }
-
- private void setStatusLineMessage(String message) {
- IPageSite workbenchPageSite = getHistoryPageSite().getWorkbenchPageSite();
- if (workbenchPageSite != null) {
- workbenchPageSite.getActionBars().getStatusLineManager().setMessage(message);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPageSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPageSource.java
deleted file mode 100644
index aaaac8e34..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPageSource.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.team.ui.history.HistoryPageSource;
-import org.eclipse.ui.part.Page;
-
-public class CVSHistoryPageSource extends HistoryPageSource {
-
- public Page createPage(Object object) {
- CVSHistoryPage page = new CVSHistoryPage(object);
- return page;
- }
-
- public boolean canShowHistoryFor(Object object) {
- return CVSHistoryPage.getCVSFile(object) != null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java
deleted file mode 100644
index 661fed6ef..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.*;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.team.core.history.ITag;
-import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
-import org.eclipse.team.internal.ui.history.AbstractHistoryCategory;
-
-public class CVSHistorySearchFilter extends org.eclipse.jface.viewers.ViewerFilter {
-
- public String searchString;
- private int matchCounter;
- public ArrayList searchStrings;
-
- public CVSHistorySearchFilter(String searchStrings) {
- this.searchString = searchStrings;
- }
-
- /**
- * @see ViewerFilter#select(Viewer, Object, Object)
- */
- public boolean select(Viewer aviewer, Object parentElement, Object element) {
- if (element instanceof AbstractHistoryCategory)
- return true;
-
- if (element instanceof CVSFileRevision) {
- StringTokenizer tokenizer = new StringTokenizer(searchString);
- searchStrings = new ArrayList();
- while (tokenizer.hasMoreElements()) {
- searchStrings.add(tokenizer.nextToken());
- }
-
- CVSFileRevision entry = (CVSFileRevision) element;
- //empty fields should be considered a non-match
- boolean orSearch = (authorMatch(entry)) || (dateMatch(entry)) || (commentMatch(entry) || revisionMatch(entry) || tagMatch(entry));
- if (orSearch)
- matchCounter++;
- return orSearch;
- }
- return false;
- }
-
- protected boolean authorMatch(CVSFileRevision revision) {
- String author = revision.getAuthor();
- if (author != null){
- Iterator iter = searchStrings.iterator();
- while (iter.hasNext()) {
- String nextString = (String) iter.next();
- if (!((author.indexOf(nextString)) == -1))
- return true;
- }
- }
- return false;
- }
-
- protected boolean commentMatch(CVSFileRevision revision) {
- String comment = revision.getComment().toLowerCase();
- if (comment != null) {
- Iterator iter = searchStrings.iterator();
- while (iter.hasNext()) {
- if (!(comment.indexOf(((String) iter.next()).toLowerCase()) == -1))
- return true;
- }
- }
- return false;
- }
-
- protected boolean dateMatch(CVSFileRevision revision) {
- //No dates for now
- /*String date = DateFormat.getInstance().format(new Date(revision.getTimestamp()));
- Iterator iter = searchStrings.iterator();
- while (iter.hasNext()){
- if (!(date.indexOf(((String) iter.next()).toLowerCase()) == -1))
- return true;
- }*/
-
- return false;
- }
-
- protected boolean tagMatch(CVSFileRevision revision) {
- ITag[] tags = revision.getTags();
- for (int i = 0; i < tags.length; i++) {
- String tag = tags[i].getName().toLowerCase();
- Iterator iter = searchStrings.iterator();
- while (iter.hasNext()) {
- if (!(tag.indexOf(((String) iter.next()).toLowerCase()) == -1))
- return true;
- }
- }
-
- return false;
- }
-
- protected boolean revisionMatch(CVSFileRevision revision) {
- String rev = revision.getContentIdentifier();
- if (rev != null) {
- Iterator iter = searchStrings.iterator();
- while (iter.hasNext()) {
- if (!(rev.indexOf(((String) iter.next()).toLowerCase()) == -1))
- return true;
- }
- }
- return false;
- }
-
-
- public int getMatchCount() {
- return matchCounter;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
deleted file mode 100644
index 9f90f9305..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
+++ /dev/null
@@ -1,661 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak (brockj@tpg.com.au) - Bug 180436 Use table sort indicators on CVS
- * Brock Janiczak (brockj@tpg.com.au) - Bug 181899 CVS History wrongly ordered
- * Brock Janiczak <brockj@tpg.com.au> - Bug 182442 Display full comment in tooltip
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Date;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.history.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.core.history.LocalFileRevision;
-import org.eclipse.team.internal.ui.TeamUIMessages;
-import org.eclipse.team.internal.ui.history.AbstractHistoryCategory;
-import org.eclipse.team.internal.ui.history.DateHistoryCategory;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.ITheme;
-
-import com.ibm.icu.text.DateFormat;
-
-public class CVSHistoryTableProvider {
-
- public static final String CATEGORIES_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.cvshistorypagecategories"; //$NON-NLS-1$
-
- private IFileHistory currentFileHistory;
- private IFile workspaceFile;
-
- /* private */TreeViewer viewer;
- /* private */Font currentRevisionFont;
-
- private boolean baseModified;
-
- //column constants
- private static final int COL_REVISIONID = 0;
- private static final int COL_TAGS = 1;
- private static final int COL_DATE = 2;
- private static final int COL_AUTHOR = 3;
- private static final int COL_COMMENT = 4;
-
- /**
- * The history label provider.
- */
- class HistoryLabelProvider extends ColumnLabelProvider {
-
- Image dateImage = null;
- ImageDescriptor dateDesc = null;
-
- Image localRevImage = null;
- ImageDescriptor localRevDesc = null;
-
- Image remoteRevImage = null;
- ImageDescriptor remoteRevDesc = null;
-
- ThemeListener themeListener;
- private DateFormat dateFormat;
- private final int column;
-
- public HistoryLabelProvider(int column, CVSHistoryTableProvider provider){
- this.column = column;
- PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener= new ThemeListener(provider));
- }
-
- public void dispose() {
- if (dateImage != null){
- dateImage.dispose();
- dateImage = null;
- }
-
- if (localRevImage != null) {
- localRevImage.dispose();
- localRevImage = null;
- }
-
- if (remoteRevImage != null) {
- remoteRevImage.dispose();
- remoteRevImage = null;
- }
-
- if (themeListener != null){
- PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(themeListener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object)
- */
- public String getToolTipText(Object element) {
- if (column == COL_COMMENT && !isSingleLine(element)) {
- IFileRevision entry = adaptToFileRevision(element);
- if (entry != null)
- return entry.getComment();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellLabelProvider#useNativeToolTip(java.lang.Object)
- */
- public boolean useNativeToolTip(Object object) {
- return column != COL_COMMENT || isSingleLine(object);
- }
-
- private boolean isSingleLine(Object object) {
- IFileRevision entry = adaptToFileRevision(object);
- if (entry != null)
- return entry.getComment() == null || entry.getComment().indexOf('\n') == -1;
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return getColumnImage(element, column);
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (element instanceof DateHistoryCategory &&
- columnIndex == COL_REVISIONID){
- if (dateImage == null){
- dateDesc = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
- dateImage = dateDesc.createImage();
- }
- return dateImage;
- }
-
- if (element instanceof LocalFileRevision &&
- columnIndex == COL_REVISIONID){
- if (localRevImage == null){
- localRevDesc = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_LOCALREVISION_TABLE);
- localRevImage = localRevDesc.createImage();
- }
- return localRevImage;
- }
-
- if (element instanceof CVSFileRevision &&
- columnIndex == COL_REVISIONID){
- if (remoteRevImage == null){
- remoteRevDesc = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REMOTEREVISION_TABLE);
- remoteRevImage = remoteRevDesc.createImage();
- }
- return remoteRevImage;
- }
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- return getColumnText(element, column);
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof AbstractHistoryCategory){
- if (columnIndex != COL_REVISIONID)
- return ""; //$NON-NLS-1$
-
- return ((AbstractHistoryCategory) element).getName();
- }
-
- IFileRevision entry = adaptToFileRevision(element);
- if (entry == null)
- return ""; //$NON-NLS-1$
- switch (columnIndex) {
- case COL_REVISIONID :
- String revision = entry.getContentIdentifier();
- String currentRevision = getCurrentRevision();
- if (currentRevision != null && currentRevision.equals(revision)) {
- if (baseModified)
- revision = NLS.bind(CVSUIMessages.nameAndRevision, new String[] { revision, CVSUIMessages.CVSHistoryTableProvider_base}); //NLS.bind(CVSUIMessages.currentRevision, new String[] { revision });
- else
- revision = NLS.bind(CVSUIMessages.currentRevision, new String[] {revision}); //NLS.bind(CVSUIMessages.currentRevision, new String[] { revision });
- }
- return revision;
- case COL_TAGS:
- ITag[] 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 :
- long date = entry.getTimestamp();
- Date dateFromLong = new Date(date);
- return getDateFormat().format(dateFromLong);
- case COL_AUTHOR :
- return entry.getAuthor();
- case COL_COMMENT :
- return getCommentAsSingleLine(entry);
- }
- return ""; //$NON-NLS-1$
- }
-
- private synchronized DateFormat getDateFormat() {
- if (dateFormat == null)
- dateFormat = DateFormat.getInstance();
- return dateFormat;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
- public Color getForeground(Object element) {
- if (element instanceof AbstractHistoryCategory){
- ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- return current.getColorRegistry().get(CVSHistoryTableProvider.CATEGORIES_COLOR);
- }
-
- IFileRevision entry = adaptToFileRevision(element);
- if (!entry.exists()) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
- public Color getBackground(Object element) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
- public Font getFont(Object element) {
- if (element instanceof AbstractHistoryCategory) {
- return getCurrentRevisionFont();
- }
-
- IFileRevision entry = adaptToFileRevision(element);
- if (entry == null)
- return null;
- String revision = entry.getContentIdentifier();
- //String comment = entry.getComment();
- String tempCurrentRevision = getCurrentRevision();
- Font returnFont = null;
-
- if (tempCurrentRevision != null && tempCurrentRevision.equals(revision)) {
- returnFont = getCurrentRevisionFont();
- }
- //Check to see if this is the local workspace file
- if (workspaceFile != null && entry instanceof LocalFileRevision) {
- LocalFileRevision localRevision = (LocalFileRevision) entry;
- if (localRevision.isCurrentState())
- return getCurrentRevisionFont();
- }
-
- return returnFont;
- }
-
- private Font getCurrentRevisionFont() {
- if (currentRevisionFont == null) {
- Font defaultFont = JFaceResources.getDefaultFont();
- FontData[] data = defaultFont.getFontData();
- for (int i = 0; i < data.length; i++) {
- data[i].setStyle(SWT.BOLD);
- }
- currentRevisionFont = new Font(viewer.getTree().getDisplay(), data);
- }
- return currentRevisionFont;
- }
-
- }
-
- /**
- * The history sorter
- */
- class HistoryComparator extends ViewerComparator {
- private boolean reversed = false;
- private int columnNumber;
-
- private VersionCollator versionCollator = new VersionCollator();
-
- // column headings: "Revision" "Tags" "Date" "Author" "Comment"
- private int[][] SORT_ORDERS_BY_COLUMN = { {COL_REVISIONID, COL_DATE, COL_AUTHOR, COL_COMMENT, COL_TAGS}, /* revision */
- {COL_TAGS, COL_DATE, COL_REVISIONID, COL_AUTHOR, COL_COMMENT}, /* tags */
- {COL_DATE, COL_REVISIONID, COL_AUTHOR, COL_COMMENT, COL_TAGS}, /* date */
- {COL_AUTHOR, COL_REVISIONID, COL_DATE, COL_COMMENT, COL_TAGS}, /* author */
- {COL_COMMENT, COL_REVISIONID, COL_DATE, COL_AUTHOR, COL_TAGS} /* comment */
- };
-
- /**
- * The constructor.
- */
- public HistoryComparator(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 compareViewer, Object o1, Object o2) {
- if (o1 instanceof AbstractHistoryCategory || o2 instanceof AbstractHistoryCategory)
- return 0;
-
- IFileRevision e1 = adaptToFileRevision(o1);
- IFileRevision e2 = adaptToFileRevision(o2);
- int result = 0;
- if (e1 == null || e2 == null) {
- result = super.compare(compareViewer, o1, o2);
- } else {
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], e1, e2);
- if (result != 0)
- break;
- }
- }
- if (reversed)
- result = -result;
- return result;
- }
-
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- int compareColumnValue(int columnNumber, IFileRevision e1, IFileRevision e2) {
- switch (columnNumber) {
- case 0 : /* revision */
- if (e1 instanceof LocalFileRevision ||
- e2 instanceof LocalFileRevision) {
- //compare based on dates
- long date1 = e1.getTimestamp();
- long date2 = e2.getTimestamp();
- if (date1 == date2)
- return 0;
-
- return date1 > date2 ? 1 : -1;
- }
- return versionCollator.compare(e1.getContentIdentifier(), e2.getContentIdentifier());
- case 1: /* tags */
- ITag[] tags1 = e1.getTags();
- ITag[] tags2 = e2.getTags();
- if (tags2.length == 0) {
- return -1;
- }
- if (tags1.length == 0) {
- return 1;
- }
- return getComparator().compare(tags1[0].getName(), tags2[0].getName());
- case 2 : /* date */
- long date1 = e1.getTimestamp();
- long date2 = e2.getTimestamp();
- if (date1 == date2)
- return 0;
-
- return date1 > date2 ? 1 : -1;
-
- case 3 : /* author */
- String author1 = e1.getAuthor();
- String author2 = e2.getAuthor();
- if (author2 == null)
- return -1;
-
- if (author1 == null)
- return 1;
-
- return getComparator().compare(author1, author2);
- case 4 : /* comment */
- String comment1 = e1.getComment();
- String comment2 = e2.getComment();
- if (comment2 == null)
- return -1;
-
- if (comment1 == null)
- return 1;
-
- return getComparator().compare(comment1, comment2);
- default :
- return 0;
- }
- }
-
- /**
- * Returns the number of the column by which this is sorting.
- */
- public int getColumnNumber() {
- return columnNumber;
- }
-
- /**
- * Returns true for descending, or false
- * for ascending sorting order.
- */
- public boolean isReversed() {
- return reversed;
- }
-
- /**
- * Sets the sorting order.
- */
- public void setReversed(boolean newReversed) {
- reversed = newReversed;
- }
- }
-
- protected IFileRevision adaptToFileRevision(Object element) {
- // Get the log entry for the provided object
- IFileRevision entry = null;
- if (element instanceof IFileRevision) {
- entry = (IFileRevision) element;
- } else if (element instanceof IAdaptable) {
- entry = (IFileRevision) ((IAdaptable) element).getAdapter(IFileRevision.class);
- } else if (element instanceof AbstractHistoryCategory){
- entry = ((AbstractHistoryCategory) element).getRevisions()[0];
- }
- return entry;
- }
-
- /**
- * Create a TableViewer that can be used to display a list of IFileRevision instances.
- * Ths method provides the labels and sorter but does not provide a content provider
- *
- * @param parent
- * @return TableViewer
- */
- public TreeViewer createTree(Composite parent, boolean localIsDisplayed) {
- Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- tree.setLayoutData(data);
-
- TableLayout layout = new TableLayout();
- tree.setLayout(layout);
-
- this.viewer = new TreeViewer(tree);
- createColumns(viewer, layout);
-
- // Initialize the sorting
- ColumnViewerToolTipSupport.enableFor(viewer);
- setLocalRevisionsDisplayed(localIsDisplayed);
-
- tree.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
- }
- });
-
- return viewer;
- }
-
- /**
- * Creates the columns for the history table.
- */
- private void createColumns(TreeViewer tree, TableLayout layout) {
- SelectionListener headerListener = getColumnListener(viewer);
-
- // revision
- TreeViewerColumn viewerCol = new TreeViewerColumn(tree, SWT.NONE);
- viewerCol.setLabelProvider(new HistoryLabelProvider(COL_REVISIONID, this));
- TreeColumn col = viewerCol.getColumn();
- col.setResizable(true);
- col.setText(TeamUIMessages.GenericHistoryTableProvider_Revision);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // tags
- viewerCol = new TreeViewerColumn(tree, SWT.NONE);
- viewerCol.setLabelProvider(new HistoryLabelProvider(COL_TAGS, this));
- col = viewerCol.getColumn();
- col.setResizable(true);
- col.setText(CVSUIMessages.HistoryView_tags);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
- // creation date
- viewerCol = new TreeViewerColumn(tree, SWT.NONE);
- viewerCol.setLabelProvider(new HistoryLabelProvider(COL_DATE, this));
- col = viewerCol.getColumn();
- col.setResizable(true);
- col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // author
- viewerCol = new TreeViewerColumn(tree, SWT.NONE);
- viewerCol.setLabelProvider(new HistoryLabelProvider(COL_AUTHOR, this));
- col = viewerCol.getColumn();
- col.setResizable(true);
- col.setText(TeamUIMessages.GenericHistoryTableProvider_Author);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- //comment
- viewerCol = new TreeViewerColumn(tree, SWT.NONE);
- viewerCol.setLabelProvider(new HistoryLabelProvider(COL_COMMENT, this));
- col = viewerCol.getColumn();
- col.setResizable(true);
- col.setText(TeamUIMessages.GenericHistoryTableProvider_Comment);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(50, true));
- }
-
- /**
- * Adds the listener that sets the sorter.
- */
- private SelectionListener getColumnListener(final TreeViewer treeViewer) {
- /**
- * 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 = treeViewer.getTree().indexOf((TreeColumn) e.widget);
- HistoryComparator oldSorter = (HistoryComparator) treeViewer.getComparator();
- TreeColumn treeColumn = ((TreeColumn)e.widget);
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- oldSorter.setReversed(!oldSorter.isReversed());
-
- treeViewer.getTree().setSortColumn(treeColumn);
- treeViewer.getTree().setSortDirection(oldSorter.isReversed() ? SWT.DOWN : SWT.UP);
- treeViewer.refresh();
- } else {
- treeViewer.getTree().setSortColumn(treeColumn);
- treeViewer.getTree().setSortDirection(SWT.UP);
- treeViewer.setComparator(new HistoryComparator(column));
- }
- }
- };
- }
-
- public void setFile(IFileHistory fileHistory, IFile workspaceFile) {
- this.currentFileHistory = fileHistory;
- this.workspaceFile = workspaceFile;
- }
-
-
- public IFileHistory getIFileHistory() {
- return this.currentFileHistory;
- }
-
- public String getCurrentRevision() {
-
- try {
- if (workspaceFile != null) {
- ICVSFile cvsWorkspaceFile = CVSWorkspaceRoot.getCVSFileFor(workspaceFile);
- byte[] syncBytes = cvsWorkspaceFile.getSyncBytes();
- if (syncBytes != null) {
- String workspaceRevision = ResourceSyncInfo.getRevision(syncBytes);
- return workspaceRevision;
- }
- }
-
- } catch (CVSException e) {
- }
-
- return null;
- }
-
- /*
- * Used to reset the sorting for the table provider; if local files
- * are included in the table, then we sort by date. Otherwise we default
- * to sorting by revision
- */
- public void setLocalRevisionsDisplayed(boolean displayed){
- //init sort to sort by revision
- int column = COL_REVISIONID;
- if (displayed){
- //locals displayed, if the base has been modified then sort by DATE
- column = COL_DATE;
- }
-
- HistoryComparator oldSorter = (HistoryComparator) viewer.getComparator();
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- viewer.refresh();
- } else {
- HistoryComparator newSorter = new HistoryComparator(column);
- newSorter.setReversed(true);
- viewer.setComparator(newSorter);
- viewer.getTree().setSortColumn(viewer.getTree().getColumn(column));
- viewer.getTree().setSortDirection(newSorter.isReversed() ? SWT.DOWN : SWT.UP);
-
- }
- }
-
- public void setBaseModified(boolean modified) {
- this.baseModified=modified;
- }
-
- private static class ThemeListener implements IPropertyChangeListener {
-
- private final CVSHistoryTableProvider provider;
-
- ThemeListener(CVSHistoryTableProvider provider) {
- this.provider= provider;
- }
- public void propertyChange(PropertyChangeEvent event) {
- provider.viewer.refresh();
- }
- }
-
- public void setWorkspaceFile(IFile workspaceFile) {
- this.workspaceFile = workspaceFile;
- }
-
- public static String getCommentAsSingleLine(IFileRevision entry) {
- String comment = entry.getComment();
- if (comment != null){
- int index = comment.indexOf("\n"); //$NON-NLS-1$
- switch (index) {
- case -1:
- return comment;
- case 0:
- return CVSUIMessages.HistoryView_______4;
- default:
- return NLS.bind(CVSUIMessages.CVSCompareRevisionsInput_truncate, new String[] { comment.substring(0, index) });
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
deleted file mode 100644
index f15d211ff..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
+++ /dev/null
@@ -1,638 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
-import org.eclipse.team.internal.core.ExceptionCollector;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.mapping.SynchronizationStateTester;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.ITheme;
-import org.osgi.framework.Bundle;
-
-import com.ibm.icu.text.SimpleDateFormat;
-
-public class CVSLightweightDecorator extends LabelProvider implements ILightweightLabelDecorator, IResourceStateChangeListener, IPropertyChangeListener {
-
- // Decorator id as defined in the decorator extension point
- public final static String ID = "org.eclipse.team.cvs.ui.decorator"; //$NON-NLS-1$
-
- private static ExceptionCollector exceptions = new ExceptionCollector(CVSUIMessages.CVSDecorator_exceptionMessage, CVSUIPlugin.ID, IStatus.ERROR, CVSUIPlugin.getPlugin().getLog()); //;
-
- private static String DECORATOR_FORMAT = "yyyy/MM/dd HH:mm:ss"; //$NON-NLS-1$
- private static SimpleDateFormat decorateFormatter = new SimpleDateFormat(DECORATOR_FORMAT, Locale.getDefault());
-
- private static String[] fonts = new String[] {
- CVSDecoratorConfiguration.IGNORED_FONT,
- CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT};
-
- private static String[] colors = new String[] {
- CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR,
- CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR,
- CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR,
- CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR};
-
- private static final SynchronizationStateTester DEFAULT_TESTER = new SynchronizationStateTester();
-
- public CVSLightweightDecorator() {
- ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
- TeamUI.addPropertyChangeListener(this);
- CVSUIPlugin.addPropertyChangeListener(this);
-
- // This is an optimization to ensure that while decorating our fonts and colors are
- // pre-created and decoration can occur without having to syncExec.
- ensureFontAndColorsCreated(fonts, colors);
-
- PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().addPropertyChangeListener(this);
- CVSProviderPlugin.broadcastDecoratorEnablementChanged(true /* enabled */);
- }
-
- /**
- * This method will ensure that the fonts and colors used by the decorator
- * are cached in the registries. This avoids having to syncExec when
- * decorating since we ensure that the fonts and colors are pre-created.
- *
- * @param fonts fonts ids to cache
- * @param colors color ids to cache
- */
- private void ensureFontAndColorsCreated(final String[] fonts, final String[] colors) {
- CVSUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- for (int i = 0; i < colors.length; i++) {
- theme.getColorRegistry().get(colors[i]);
-
- }
- for (int i = 0; i < fonts.length; i++) {
- theme.getFontRegistry().get(fonts[i]);
- }
- }
- });
- }
-
- public static boolean isDirty(final ICVSResource resource) throws CVSException {
- return getSubscriber().isDirty(resource, null);
- }
-
- public static boolean isDirty(IResource resource) {
- try {
- return getSubscriber().isDirty(resource, null);
- } catch (CVSException e) {
- handleException(resource, e);
- return true;
- }
- }
-
- /*
- * 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) {
- if (resource == null) return null;
- RepositoryProvider p =
- RepositoryProvider.getProvider(
- resource.getProject(),
- CVSProviderPlugin.getTypeId());
- if (p == null) {
- return null;
- }
- return (CVSTeamProvider) p;
- }
-
- /**
- * This method should only be called by the decorator thread.
- *
- * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
- */
- public void decorate(Object element, IDecoration decoration) {
-
- // Don't decorate the workspace root
- IResource resource = getResource(element);
- if (resource != null && resource.getType() == IResource.ROOT)
- return;
-
- // Get the mapping for the object and ensure it overlaps with CVS projects
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping == null)
- return;
- if (!isMappedToCVS(mapping))
- return;
-
- // Get the sync state tester from the context
- IDecorationContext context = decoration.getDecorationContext();
- SynchronizationStateTester tester = DEFAULT_TESTER;
- Object property = context.getProperty(SynchronizationStateTester.PROP_TESTER);
- if (property instanceof SynchronizationStateTester) {
- tester = (SynchronizationStateTester) property;
- }
-
- // Calculate and apply the decoration
- try {
- if (tester.isDecorationEnabled(element)) {
- CVSDecoration cvsDecoration = decorate(element, tester);
- cvsDecoration.apply(decoration);
- }
- } catch(CoreException e) {
- handleException(element, e);
- } catch (IllegalStateException e) {
- // This is thrown by Core if the workspace is in an illegal state
- // If we are not active, ignore it. Otherwise, propagate it.
- // (see bug 78303)
- if (Platform.getBundle(CVSUIPlugin.ID).getState() == Bundle.ACTIVE) {
- throw e;
- }
- }
- }
-
- private static IResource getResource(Object element) {
- if (element instanceof ResourceMapping) {
- element = ((ResourceMapping) element).getModelObject();
- }
- return Utils.getResource(element);
- }
-
- /*
- * Return whether any of the projects of the mapping are mapped to CVS
- */
- private boolean isMappedToCVS(ResourceMapping mapping) {
- IProject[] projects = mapping.getProjects();
- boolean foundOne = false;
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- if (project != null) {
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (provider instanceof CVSTeamProvider) {
- foundOne = true;
- } else if (provider != null) {
- return false;
- }
- }
- }
- return foundOne;
- }
-
- public static CVSDecoration decorate(Object element, SynchronizationStateTester tester) throws CoreException {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- CVSDecoration result = new CVSDecoration();
-
- // First, decorate the synchronization state
- int state = IDiff.NO_CHANGE;
- if (isSupervised(element)) {
- // TODO: Not quite right
- result.setHasRemote(true);
- state = tester.getState(element,
- store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY)
- ? IDiff.ADD | IDiff.REMOVE | IDiff.CHANGE | IThreeWayDiff.OUTGOING
- : 0,
- new NullProgressMonitor());
- result.setStateFlags(state);
- } else {
- result.setIgnored(true);
- }
- // Tag
- if (!result.isIgnored()) {
- CVSTag tag = getTagToShow(element);
- if (tag != null) {
- String name = tag.getName();
- if (tag.getType() == CVSTag.DATE) {
- Date date = tag.asDate();
- if (date != null) {
- name = decorateFormatter.format(date);
- }
- }
- result.setTag(name);
- }
- }
-
- // If the element adapts to a single resource, add additional decorations
- IResource resource = getResource(element);
- if (resource == null) {
- result.setResourceType(CVSDecoration.MODEL);
- } else {
- decorate(resource, result);
- }
- tester.elementDecorated(element, result.asTeamStateDescription(null));
- return result;
- }
-
- private static boolean isSupervised(Object element) throws CoreException {
- IResource[] resources = getTraversalRoots(element);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (getSubscriber().isSupervised(resource))
- return true;
- }
- return false;
- }
-
- private static IResource[] getTraversalRoots(Object element) throws CoreException {
- Set result = new HashSet();
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null) {
- ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- result.add(resource);
- }
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- private static void decorate(IResource resource, CVSDecoration cvsDecoration) throws CVSException {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- cvsDecoration.setResourceType(resource.getType());
-
- cvsDecoration.setHasRemote(hasRemote(cvsResource));
- if (cvsResource.isIgnored()) {
- cvsDecoration.setIgnored(true);
- }
- if (!cvsDecoration.isIgnored()) {
- // Dirty: Only decorate dirty state if we're not set to decorate models
- boolean decorateModel = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
- if (!decorateModel) {
- // Dirty
- try {
- IDiff node = getSubscriber().getDiff(resource);
- if (node != null) {
- if (node instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) node;
- cvsDecoration.setDirty(twd.getDirection() == IThreeWayDiff.OUTGOING
- || twd.getDirection() == IThreeWayDiff.CONFLICTING);
- }
- }
- } catch (CoreException e) {
- handleException(resource, e);
- }
- // Has a remote
- //cvsDecoration.setHasRemote(CVSWorkspaceRoot.hasRemote(resource));
- }
- // Is a new resource
- if (store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION)) {
- if (cvsResource.exists()) {
- if (cvsResource.isFolder()) {
- if (!((ICVSFolder) cvsResource).isCVSFolder()) {
- cvsDecoration.setNewResource(true);
- }
- } else if (!cvsResource.isManaged()) {
- cvsDecoration.setNewResource(true);
- }
- }
- }
- // Extract type specific properties
- if (resource.getType() == IResource.FILE) {
- extractFileProperties((IFile) resource, cvsDecoration);
- } else {
- extractContainerProperties((IContainer) resource, cvsDecoration);
- }
- }
- }
-
- private static boolean hasRemote(ICVSResource cvsResource) {
- try {
- return (cvsResource.isManaged() || cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder());
- } catch (CVSException e) {
- return false;
- }
- }
-
- public static CVSDecoration decorate(IResource resource, boolean includeDirtyCheck) throws CVSException {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSDecoration cvsDecoration = new CVSDecoration();
- cvsDecoration.setResourceType(resource.getType());
-
- if (cvsResource.isIgnored()) {
- cvsDecoration.setIgnored(true);
- }
- if (!cvsDecoration.isIgnored()) {
- // Dirty
- if (includeDirtyCheck) {
- boolean computeDeepDirtyCheck = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
- int type = resource.getType();
- if (type == IResource.FILE || computeDeepDirtyCheck) {
- cvsDecoration.setDirty(CVSLightweightDecorator.isDirty(resource));
- }
- }
- }
- decorate(resource, cvsDecoration);
- return cvsDecoration;
- }
-
- private static void extractContainerProperties(IContainer resource, CVSDecoration cvsDecoration) throws CVSException {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resource);
- FolderSyncInfo folderInfo = folder.getFolderSyncInfo();
- if (folderInfo != null) {
- cvsDecoration.setLocation(KnownRepositories.getInstance().getRepository(folderInfo.getRoot()));
-
- // Ignore the relative 'repository' path if it is the same locally
- if (!resource.getFullPath().toString().substring(1).equals(folderInfo.getRepository()))
- cvsDecoration.setRepository(folderInfo.getRepository());
- cvsDecoration.setVirtualFolder(folderInfo.isVirtualDirectory());
- }
- }
-
- private static void extractFileProperties(IFile resource, CVSDecoration cvsDecoration) throws CVSException {
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor(resource);
- ResourceSyncInfo fileInfo = file.getSyncInfo();
- KSubstOption option = KSubstOption.fromFile(resource);
- if (fileInfo != null) {
- cvsDecoration.setAdded(fileInfo.isAdded());
- cvsDecoration.setRevision(fileInfo.getRevision());
- cvsDecoration.setReadOnly(file.isReadOnly());
- cvsDecoration.setNeedsMerge(fileInfo.isNeedsMerge(file.getTimeStamp()));
- option = fileInfo.getKeywordMode();
- }
- cvsDecoration.setKeywordSubstitution(option.getShortDisplayText());
- CVSTeamProvider provider = getCVSProviderFor(resource);
- if (provider != null)
- cvsDecoration.setWatchEditEnabled(provider.isWatchEditEnabled());
- }
-
- protected static CVSTag getTagToShow(Object element) throws CoreException {
- IResource r = getResource(element);
- if (r != null)
- return getTagToShow(r);
- IResource[] resources = getTraversalRoots(element);
- boolean first = true;
- CVSTag tag = null;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (getSubscriber().isSupervised(resource)) {
- CVSTag nextTag = getTagToShow(resource);
- if (first) {
- tag = nextTag;
- first = false;
- } else if (!equals(tag, nextTag)) {
- return null;
- }
-
- }
- }
- return tag;
- }
-
- private static boolean equals(CVSTag tag, CVSTag nextTag) {
- if (tag == nextTag)
- return true;
- if (tag == null || nextTag == null)
- return false;
- return tag.getName().equals(nextTag.getName());
- }
-
- /**
- * Only show the tag if the resources tag is different than the parents. Or else, tag
- * names will clutter the text decorations.
- */
- protected static CVSTag getTagToShow(IResource resource) throws CVSException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag tag = null;
-
- // for unmanaged resources don't show a tag since they will be added in
- // the context of their parents tag. For managed resources only show tags
- // if different than parent.
- boolean managed = false;
-
- if(cvsResource.isFolder()) {
- FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(folderInfo != null) {
- tag = folderInfo.getTag();
- managed = true;
- }
- } else {
- ResourceSyncInfo info = ((ICVSFile)cvsResource).getSyncInfo();
- if(info != null) {
- tag = info.getTag();
- managed = true;
- }
- }
-
- ICVSFolder parent = cvsResource.getParent();
- if(parent != null && managed) {
- FolderSyncInfo parentInfo = parent.getFolderSyncInfo();
- if(parentInfo != null) {
- CVSTag parentTag = parentInfo.getTag();
- parentTag = (parentTag == null ? CVSTag.DEFAULT : parentTag);
- tag = (tag == null ? CVSTag.DEFAULT : tag);
- // must compare tags by name because CVS doesn't do a good job of
- // using T and N prefixes for folders and files.
- if( parentTag.getName().equals(tag.getName())) {
- tag = null;
- }
- }
- }
- return tag;
- }
-
- /*
- * Add resource and its parents to the List
- */
-
- private void addWithParents(IResource resource, Set resources) {
- IResource current = resource;
-
- while (current.getType() != IResource.ROOT) {
- resources.add(current);
- current = current.getParent();
- }
- }
-
- /*
- * Perform a blanket refresh of all CVS decorations
- */
- public static void refresh() {
- CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager().update(CVSUIPlugin.DECORATOR_ID);
- }
-
- /*
- * Update the decorators for every resource in project
- */
-
- public void refresh(IProject project) {
- final List resources = new ArrayList();
- try {
- project.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- resources.add(resource);
- return true;
- }
- });
- postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray()));
- } catch (CoreException e) {
- handleException(project, e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceSyncInfoChanged(org.eclipse.core.resources.IResource[])
- */
- public void resourceSyncInfoChanged(IResource[] changedResources) {
- resourceStateChanged(changedResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#externalSyncInfoChange(org.eclipse.core.resources.IResource[])
- */
- public void externalSyncInfoChange(IResource[] changedResources) {
- resourceStateChanged(changedResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceModificationStateChanged(org.eclipse.core.resources.IResource[])
- */
- public void resourceModified(IResource[] changedResources) {
- resourceStateChanged(changedResources);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceStateChanged(org.eclipse.core.resources.IResource[])
- */
- public void resourceStateChanged(IResource[] changedResources) {
- // add depth first so that update thread processes parents first.
- //System.out.println(">> State Change Event");
- Set resourcesToUpdate = new HashSet();
-
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean showingDeepDirtyIndicators = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
-
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
-
- if(showingDeepDirtyIndicators) {
- addWithParents(resource, resourcesToUpdate);
- } else {
- resourcesToUpdate.add(resource);
- }
- }
-
- postLabelEvent(new LabelProviderChangedEvent(this, resourcesToUpdate.toArray()));
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#projectConfigured(org.eclipse.core.resources.IProject)
- */
- public void projectConfigured(IProject project) {
- refresh(project);
- }
- /**
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#projectDeconfigured(org.eclipse.core.resources.IProject)
- */
- public void projectDeconfigured(IProject project) {
- refresh(project);
- }
-
- /**
- * Post the label event to the UI thread
- *
- * @param events the events to post
- */
- private void postLabelEvent(final LabelProviderChangedEvent event) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- fireLabelProviderChanged(event);
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- super.dispose();
- PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().removePropertyChangeListener(this);
- CVSProviderPlugin.broadcastDecoratorEnablementChanged(false /* disabled */);
- TeamUI.removePropertyChangeListener(this);
- CVSUIPlugin.removePropertyChangeListener(this);
- }
-
- /**
- * Handle exceptions that occur in the decorator.
- * Exceptions are only logged for resources that
- * are accessible (i.e. exist in an open project).
- */
- private static void handleException(IResource resource, CoreException e) {
- if (resource == null || resource.isAccessible())
- exceptions.handleException(e);
- }
-
- /**
- * Handle exceptions that occur in the decorator.
- * Exceptions are only logged for resources that
- * are accessible (i.e. exist in an open project).
- */
- private void handleException(Object element, CoreException e) {
- IResource resource = Utils.getResource(element);
- if (resource != null) {
- handleException(resource, e);
- }
- ResourceMapping mapping = Utils.getResourceMapping(element);
- IProject[] projects = mapping.getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- if (!project.isAccessible()) {
- return;
- }
- }
- exceptions.handleException(e);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (isEventOfInterest(event)) {
- ensureFontAndColorsCreated(fonts, colors);
- refresh();
- }
- }
-
- private boolean isEventOfInterest(PropertyChangeEvent event) {
- String prop = event.getProperty();
- return prop.equals(TeamUI.GLOBAL_IGNORES_CHANGED)
- || prop.equals(TeamUI.GLOBAL_FILE_TYPES_CHANGED)
- || prop.equals(CVSUIPlugin.P_DECORATORS_CHANGED)
- || prop.equals(CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT)
- || prop.equals(CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.IGNORED_FONT);
- }
-
- private static CVSWorkspaceSubscriber getSubscriber() {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- }
-}
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 347f58562..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoriesView;
-import org.eclipse.team.ui.history.IHistoryView;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.*;
-
-public class CVSPerspective implements IPerspectiveFactory {
-
- public final static String ID = "org.eclipse.team.cvs.ui.cvsPerspective"; //$NON-NLS-1$
-
- /* (Non-javadoc)
- * Method declared on IPerpsectiveFactory
- */
- public void createInitialLayout(IPageLayout layout) {
- defineActions(layout);
- defineLayout(layout);
- }
-
- /**
- * Defines the initial actions for a page.
- */
- public void defineActions(IPageLayout layout) {
-
- // Add "new wizards".
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); //$NON-NLS-1$
-
- // Add "show views".
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
- layout.addShowViewShortcut(IHistoryView.VIEW_ID);
- layout.addShowViewShortcut(RepositoriesView.VIEW_ID);
- layout.addShowViewShortcut(ISynchronizeView.VIEW_ID);
-
- // Add "perspective short cut"
- layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$
- layout.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); //$NON-NLS-1$
- }
-
- /**
- * Defines the initial layout for a page.
- */
- public void defineLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
- IFolderLayout top =
- layout.createFolder("top", IPageLayout.LEFT, 0.40f, editorArea); //$NON-NLS-1$
- top.addView(RepositoriesView.VIEW_ID);
- layout.addView(IHistoryView.VIEW_ID, IPageLayout.BOTTOM, 0.70f, editorArea);
- layout.setEditorAreaVisible(true);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
deleted file mode 100644
index 2cba2ce60..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ /dev/null
@@ -1,646 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- * William Mitsuda (wmitsuda@gmail.com) - Bug 153879 [Wizards] configurable size of cvs commit comment history
- * Brock Janiczak <brockj@tpg.com.au> - Bug 161536 Warn user when committing resources with problem markers
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.*;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-
-/**
- * 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 {
-
- public static class PerspectiveDescriptorComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- if (o1 instanceof IPerspectiveDescriptor && o2 instanceof IPerspectiveDescriptor) {
- String id1= ((IPerspectiveDescriptor)o1).getLabel();
- String id2= ((IPerspectiveDescriptor)o2).getLabel();
- return Collator.getInstance().compare(id1, id2);
- }
- return 0;
- }
- }
-
-
- private abstract class Field {
- protected final String fKey;
- public Field(String key) { fFields.add(this); fKey= key; }
- public abstract void initializeValue(IPreferenceStore store);
- public abstract void performOk(IPreferenceStore store);
- public void performDefaults(IPreferenceStore store) {
- store.setToDefault(fKey);
- initializeValue(store);
- }
- }
-
- private class Checkbox extends Field {
-
- private final Button fCheckbox;
-
- public Checkbox(Composite composite, String key, String label, String helpID) {
- super(key);
- fCheckbox= new Button(composite, SWT.CHECK);
- fCheckbox.setText(label);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fCheckbox, helpID);
- }
-
- public void initializeValue(IPreferenceStore store) {
- fCheckbox.setSelection(store.getBoolean(fKey));
- }
-
- public void performOk(IPreferenceStore store) {
- store.setValue(fKey, fCheckbox.getSelection());
- }
- }
-
- private abstract class ComboBox extends Field {
- protected final Combo fCombo;
- private final String [] fLabels;
- private final List fValues;
-
- public ComboBox(Composite composite, String key, String text, String helpID, String [] labels, Object [] values) {
- super(key);
- fLabels= labels;
- fValues= Arrays.asList(values);
-
- final Label label= SWTUtils.createLabel(composite, text);
- fCombo= new Combo(composite, SWT.READ_ONLY);
- fCombo.setLayoutData(SWTUtils.createHFillGridData());
- fCombo.setItems(labels);
-
- if (((GridLayout)composite.getLayout()).numColumns > 1) {
- label.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
- }
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fCombo, helpID);
- }
-
- public Combo getCombo() {
- return fCombo;
- }
-
- public void initializeValue(IPreferenceStore store) {
- final Object value= getValue(store, fKey);
- final int index= fValues.indexOf(value);
- if (index >= 0 && index < fLabels.length)
- fCombo.select(index);
- else
- fCombo.select(0);
- }
-
- public void performOk(IPreferenceStore store) {
- saveValue(store, fKey, fValues.get(fCombo.getSelectionIndex()));
- }
-
- protected abstract void saveValue(IPreferenceStore store, String key, Object object);
- protected abstract Object getValue(IPreferenceStore store, String key);
- }
-
- private class IntegerComboBox extends ComboBox {
- public IntegerComboBox(Composite composite, String key, String label, String helpID, String[] labels, Integer [] values) {
- super(composite, key, label, helpID, labels, values);
- }
-
- protected void saveValue(IPreferenceStore store, String key, Object object) {
- store.setValue(key, ((Integer)object).intValue());
- }
-
- protected Object getValue(IPreferenceStore store, String key) {
- return new Integer(store.getInt(key));
- }
- }
-
- private class StringComboBox extends ComboBox {
-
- public StringComboBox(Composite composite, String key, String label, String helpID, String [] labels, String [] values) {
- super(composite, key, label, helpID, labels, values);
- }
-
- protected Object getValue(IPreferenceStore store, String key) {
- return store.getString(key);
- }
-
- protected void saveValue(IPreferenceStore store, String key, Object object) {
- store.setValue(key, (String)object);
- }
- }
-
- private abstract class RadioButtons extends Field {
- protected final Button [] fButtons;
- private final String [] fLabels;
- private final List fValues;
- private final Group fGroup;
-
- public RadioButtons(Composite composite, String key, String label, String helpID, String [] labels, Object [] values) {
- super(key);
- fLabels= labels;
- fValues= Arrays.asList(values);
-
- fGroup= SWTUtils.createHFillGroup(composite, label, SWTUtils.MARGINS_DEFAULT, labels.length);
-
-
- fButtons= new Button [labels.length];
- for (int i = 0; i < fLabels.length; i++) {
- fButtons[i]= new Button(fGroup, SWT.RADIO);
- fButtons[i].setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
- fButtons[i].setText(labels[i]);
- }
- SWTUtils.equalizeControls(SWTUtils.createDialogPixelConverter(composite), fButtons, 0, fButtons.length - 2);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fGroup, helpID);
- }
-
- public void initializeValue(IPreferenceStore store) {
- final Object value= loadValue(store, fKey);
- final int index= fValues.indexOf(value);
- for (int i = 0; i < fButtons.length; i++) {
- Button b = fButtons[i];
- b.setSelection(index == i);
- }
- }
-
- public void performOk(IPreferenceStore store) {
- for (int i = 0; i < fButtons.length; ++i) {
- if (fButtons[i].getSelection()) {
- saveValue(store, fKey, fValues.get(i));
- return;
- }
- }
- }
-
- public Control getControl() {
- return fGroup;
- }
-
- protected abstract Object loadValue(IPreferenceStore store, String key);
-
- protected abstract void saveValue(IPreferenceStore store, String key, Object value);
- }
-
- private class IntegerRadioButtons extends RadioButtons {
-
- public IntegerRadioButtons(Composite composite, String key, String label, String helpID, String[] labels, Integer [] values) {
- super(composite, key, label, helpID, labels, values);
- }
-
- protected Object loadValue(IPreferenceStore store, String key) {
- return new Integer(store.getInt(key));
- }
-
- protected void saveValue(IPreferenceStore store, String key, Object value) {
- store.setValue(key, ((Integer)value).intValue());
- }
- }
-
- private class StringRadioButtons extends RadioButtons {
-
- public StringRadioButtons(Composite composite, String key, String label, String helpID, String[] labels, String [] values) {
- super(composite, key, label, helpID, labels, values);
- }
-
- protected Object loadValue(IPreferenceStore store, String key) {
- return store.getString(key);
- }
-
- protected void saveValue(IPreferenceStore store, String key, Object value) {
- store.setValue(key, (String)value);
- }
- }
-
- private abstract class TextField extends Field implements ModifyListener {
- protected final Text fText;
-
- public TextField(Composite composite, String key, String text, String helpID) {
- super(key);
-
- final Label label= new Label(composite, SWT.WRAP);
- label.setText(text);
- label.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
-
- fText= SWTUtils.createText(composite);
- fText.addModifyListener(this);
-
- if (helpID != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fText, helpID);
- }
-
- public Text getControl() {
- return fText;
- }
-
- public void initializeValue(IPreferenceStore store) {
- final String value= store.getString(fKey);
- fText.setText(value);
- }
-
- public void performOk(IPreferenceStore store) {
- store.setValue(fKey, fText.getText());
- }
-
- public void modifyText(ModifyEvent e) {
- modifyText(fText);
- }
-
- protected abstract void modifyText(Text text);
- }
-
- private final String [] KSUBST_VALUES;
- private final String [] KSUBST_LABELS;
-
- private final String [] COMPRESSION_LABELS;
- private final Integer [] COMPRESSION_VALUES;
-
- protected final ArrayList fFields;
- private final String [] PERSPECTIVE_VALUES;
- private final String [] PERSPECTIVE_LABELS;
- private final String [] YES_NO_PROMPT;
-
- public CVSPreferencesPage() {
- fFields= new ArrayList();
-
- final KSubstOption[] options = KSubstOption.getAllKSubstOptions();
- final ArrayList KSUBST_MODES= new ArrayList();
- for (int i = 0; i < options.length; i++) {
- final KSubstOption option = options[i];
- if (!option.isBinary()) {
- KSUBST_MODES.add(option);
- }
- }
- Collections.sort(KSUBST_MODES, new Comparator() {
- public int compare(Object a, Object b) {
- final String aKey = ((KSubstOption) a).getLongDisplayText();
- final String bKey = ((KSubstOption) b).getLongDisplayText();
- return aKey.compareTo(bKey);
- }
- });
-
- KSUBST_LABELS= new String[KSUBST_MODES.size()];
- KSUBST_VALUES= new String[KSUBST_MODES.size()];
- int index= 0;
- for (Iterator iter = KSUBST_MODES.iterator(); iter.hasNext();) {
- KSubstOption mod = (KSubstOption) iter.next();
- KSUBST_LABELS[index]= mod.getLongDisplayText();
- final String mode= mod.toMode().trim();
- KSUBST_VALUES[index]= mode.length() != 0 ? mode : "-kkv"; //$NON-NLS-1$
- ++index;
- }
-
- COMPRESSION_LABELS = new String[] { CVSUIMessages.CVSPreferencesPage_0,
- CVSUIMessages.CVSPreferencesPage_1,
- CVSUIMessages.CVSPreferencesPage_2,
- CVSUIMessages.CVSPreferencesPage_3,
- CVSUIMessages.CVSPreferencesPage_4,
- CVSUIMessages.CVSPreferencesPage_5,
- /* CVSUIMessages.CVSPreferencesPage_6, // Disallow 6 through 9 due to server bug (see bug 15724)
- CVSUIMessages.CVSPreferencesPage_7,
- CVSUIMessages.CVSPreferencesPage_8,
- CVSUIMessages.CVSPreferencesPage_9 */};
- COMPRESSION_VALUES= new Integer [COMPRESSION_LABELS.length];
- for (int i = 0; i < COMPRESSION_VALUES.length; i++) {
- COMPRESSION_VALUES[i]= new Integer(i);
- }
-
- final IPerspectiveDescriptor [] perspectives= PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();
- PERSPECTIVE_VALUES= new String[perspectives.length + 1];
- PERSPECTIVE_LABELS= new String [perspectives.length + 1];
- Arrays.sort(perspectives, new PerspectiveDescriptorComparator());
- PERSPECTIVE_VALUES[0]= ICVSUIConstants.OPTION_NO_PERSPECTIVE;
- PERSPECTIVE_LABELS[0]= CVSUIMessages.CVSPreferencesPage_10;
- for (int i = 0; i < perspectives.length; i++) {
- PERSPECTIVE_VALUES[i + 1]= perspectives[i].getId();
- PERSPECTIVE_LABELS[i + 1]= perspectives[i].getLabel();
- }
-
- YES_NO_PROMPT= new String [] { CVSUIMessages.CVSPreferencesPage_11, CVSUIMessages.CVSPreferencesPage_12, CVSUIMessages.CVSPreferencesPage_13 }; //
- }
-
- protected Control createContents(Composite parent) {
-
- // create a tab folder for the page
- final TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
- tabFolder.setLayoutData(SWTUtils.createHFillGridData());
-
- createGeneralTab(tabFolder);
- createFilesFoldersTab(tabFolder);
- createConnectionTab(tabFolder);
- createPromptingTab(tabFolder);
-
- initializeValues();
-
- Dialog.applyDialogFont(parent);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.GENERAL_PREFERENCE_PAGE);
- return tabFolder;
- }
-
- private Composite createGeneralTab(final TabFolder tabFolder) {
- final Composite composite = SWTUtils.createHFillComposite(tabFolder, SWTUtils.MARGINS_DEFAULT);
- final TabItem tab= new TabItem(tabFolder, SWT.NONE);
- tab.setText(CVSUIMessages.CVSPreferencesPage_14);
- tab.setControl(composite);
- new Checkbox(composite, ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, CVSUIMessages.CVSPreferencesPage_15, IHelpContextIds.PREF_DETERMINE_SERVER_VERSION);
- new Checkbox(composite, ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, CVSUIMessages.CVSPreferencesPage_16, IHelpContextIds.PREF_CONFIRM_MOVE_TAG);
- new Checkbox(composite, ICVSUIConstants.PREF_DEBUG_PROTOCOL, CVSUIMessages.CVSPreferencesPage_17, IHelpContextIds.PREF_DEBUG_PROTOCOL);
- new Checkbox(composite, ICVSUIConstants.PREF_AUTO_REFRESH_TAGS_IN_TAG_SELECTION_DIALOG, CVSUIMessages.CVSPreferencesPage_18, IHelpContextIds.PREF_AUTOREFRESH_TAG);
- new Checkbox(composite, ICVSUIConstants.PREF_AUTO_SHARE_ON_IMPORT, CVSUIMessages.CVSPreferencesPage_44, null);
- new Checkbox(composite, ICVSUIConstants.PREF_USE_PROJECT_NAME_ON_CHECKOUT, CVSUIMessages.CVSPreferencesPage_45, null);
-
- final Composite textComposite= SWTUtils.createHFillComposite(composite, SWTUtils.MARGINS_NONE, 2);
- new TextField(
- textComposite,
- ICVSUIConstants.PREF_COMMIT_FILES_DISPLAY_THRESHOLD,
- CVSUIMessages.CVSPreferencesPage_20,
- null) {
- protected void modifyText(Text text) {
- // Parse the timeout value
- try {
- final int x = Integer.parseInt(text.getText());
- if (x >= 0) {
- setErrorMessage(null);
- setValid(true);
- } else {
- setErrorMessage(CVSUIMessages.CVSPreferencesPage_21);
- setValid(false);
- }
- } catch (NumberFormatException ex) {
- setErrorMessage(CVSUIMessages.CVSPreferencesPage_22);
- setValid(false);
- }
- }
- };
- new TextField(
- textComposite,
- ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY,
- CVSUIMessages.CVSPreferencesPage_47,
- null) {
- protected void modifyText(Text text) {
- try {
- final int x = Integer.parseInt(text.getText());
- if (x > 0) {
- setErrorMessage(null);
- setValid(true);
- } else {
- setErrorMessage(CVSUIMessages.CVSPreferencesPage_48);
- setValid(false);
- }
- } catch (NumberFormatException ex) {
- setErrorMessage(CVSUIMessages.CVSPreferencesPage_49);
- setValid(false);
- }
- }
- };
-
- return composite;
- }
-
- private Composite createConnectionTab(final TabFolder tabFolder) {
- final Composite composite = SWTUtils.createHFillComposite(tabFolder, SWTUtils.MARGINS_DEFAULT);
- final TabItem tab= new TabItem(tabFolder, SWT.NONE);
- tab.setText(CVSUIMessages.CVSPreferencesPage_19);
- tab.setControl(composite);
-
- final Composite textComposite= SWTUtils.createHFillComposite(composite, SWTUtils.MARGINS_NONE, 2);
- new TextField(
- textComposite,
- ICVSUIConstants.PREF_TIMEOUT,
- CVSUIMessages.CVSPreferencesPage_23,
- IHelpContextIds.PREF_COMMS_TIMEOUT) {
- protected void modifyText(Text text) {
- // Parse the timeout value
- try {
- final int x = Integer.parseInt(text.getText());
- if (x >= 0) {
- setErrorMessage(null);
- setValid(true);
- } else {
- setErrorMessage(CVSUIMessages.CVSPreferencesPage_24);
- setValid(false);
- }
- } catch (NumberFormatException ex) {
- setErrorMessage(CVSUIMessages.CVSPreferencesPage_25);
- setValid(false);
- }
- }
- };
-
- final ComboBox quietnessCombo = new IntegerComboBox(
- textComposite,
- ICVSUIConstants.PREF_QUIETNESS,
- CVSUIMessages.CVSPreferencesPage_26,
- IHelpContextIds.PREF_QUIET,
- new String [] { CVSUIMessages.CVSPreferencesPage_27, CVSUIMessages.CVSPreferencesPage_28, CVSUIMessages.CVSPreferencesPage_29 }, //
- new Integer [] { new Integer(0), new Integer(1), new Integer(2)});
-
- quietnessCombo.getCombo().addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (getQuietnessOptionFor(quietnessCombo.getCombo().getSelectionIndex()).equals(Command.SILENT)) {
- MessageDialog.openWarning(getShell(), CVSUIMessages.CVSPreferencesPage_30, CVSUIMessages.CVSPreferencesPage_31); //
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- new IntegerComboBox(
- textComposite,
- ICVSUIConstants.PREF_COMPRESSION_LEVEL,
- CVSUIMessages.CVSPreferencesPage_32,
- IHelpContextIds.PREF_COMPRESSION,
- COMPRESSION_LABELS, COMPRESSION_VALUES);
-
- SWTUtils.createPreferenceLink((IWorkbenchPreferenceContainer) getContainer(), composite, CVSUIMessages.CVSPreferencesPage_52, CVSUIMessages.CVSPreferencesPage_53);
-
- SWTUtils.createPreferenceLink((IWorkbenchPreferenceContainer) getContainer(), composite, CVSUIMessages.CVSPreferencesPage_54, CVSUIMessages.CVSPreferencesPage_55);
-
- return composite;
- }
-
-
- private Composite createFilesFoldersTab(final TabFolder tabFolder) {
- final Composite composite = SWTUtils.createHFillComposite(tabFolder, SWTUtils.MARGINS_DEFAULT);
- final TabItem tab= new TabItem(tabFolder, SWT.NONE);
- tab.setText(CVSUIMessages.CVSPreferencesPage_33);
- tab.setControl(composite);
- new Checkbox(composite, ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, CVSUIMessages.CVSPreferencesPage_34, IHelpContextIds.PREF_TREAT_NEW_FILE_AS_BINARY);
- new Checkbox(composite, ICVSUIConstants.PREF_USE_PLATFORM_LINEEND, CVSUIMessages.CVSPreferencesPage_35, IHelpContextIds.PREF_LINEEND);
- new Checkbox(composite, ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSUIMessages.CVSPreferencesPage_36, IHelpContextIds.PREF_PRUNE);
- new Checkbox(composite, ICVSUIConstants.PREF_REPLACE_UNMANAGED, CVSUIMessages.CVSPreferencesPage_37, IHelpContextIds.PREF_REPLACE_DELETE_UNMANAGED);
- SWTUtils.createPlaceholder(composite, 1);
- final Composite bottom= SWTUtils.createHFillComposite(composite, SWTUtils.MARGINS_NONE, 2);
- new StringComboBox(
- bottom,
- ICVSUIConstants.PREF_TEXT_KSUBST,
- CVSUIMessages.CVSPreferencesPage_38,
- IHelpContextIds.PREF_KEYWORDMODE,
- KSUBST_LABELS, KSUBST_VALUES);
-
- return composite;
- }
-
- private Composite createPromptingTab(final TabFolder tabFolder) {
-
- final Composite composite = SWTUtils.createHFillComposite(tabFolder, SWTUtils.MARGINS_DEFAULT, 1);
- final TabItem tab= new TabItem(tabFolder, SWT.NONE);
- tab.setText(CVSUIMessages.CVSPreferencesPage_39);
- tab.setControl(composite);
-
- new StringRadioButtons(
- composite,
- ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS,
- CVSUIMessages.CVSPreferencesPage_40,
- IHelpContextIds.PREF_ALLOW_EMPTY_COMMIT_COMMENTS,
- YES_NO_PROMPT,
- new String [] { MessageDialogWithToggle.ALWAYS, MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT });
-
- new IntegerRadioButtons(composite,
- ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS,
- CVSUIMessages.CVSPreferencesPage_41,
- IHelpContextIds.PREF_SAVE_DIRTY_EDITORS,
- YES_NO_PROMPT,
- new Integer [] { new Integer(ICVSUIConstants.OPTION_AUTOMATIC), new Integer(ICVSUIConstants.OPTION_NEVER), new Integer(ICVSUIConstants.OPTION_PROMPT)});
-
- new StringRadioButtons(
- composite,
- ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT,
- CVSUIMessages.CVSPreferencesPage_46,
- IHelpContextIds.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT,
- YES_NO_PROMPT,
- new String [] { MessageDialogWithToggle.ALWAYS, MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT }
- );
-
- new StringRadioButtons(
- composite,
- ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS,
- CVSUIMessages.CVSPreferencesPage_50,
- IHelpContextIds.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT,
- YES_NO_PROMPT,
- new String [] { MessageDialogWithToggle.ALWAYS, MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT }
- );
-
- new StringRadioButtons(
- composite,
- ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS,
- CVSUIMessages.CVSPreferencesPage_51,
- IHelpContextIds.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT,
- YES_NO_PROMPT,
- new String [] { MessageDialogWithToggle.ALWAYS, MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT }
- );
- SWTUtils.createPlaceholder(composite, 1);
-
- return composite;
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- final IPreferenceStore store = getPreferenceStore();
- for (Iterator iter = fFields.iterator(); iter.hasNext();) {
- ((Field)iter.next()).initializeValue(store);
- }
- }
-
- public void init(IWorkbench workbench) {
- }
-
- public boolean performOk() {
-
- final IPreferenceStore store = getPreferenceStore();
- for (Iterator iter = fFields.iterator(); iter.hasNext();) {
- ((Field) iter.next()).performOk(store);
- }
-
- CVSProviderPlugin.getPlugin().setReplaceUnmanaged(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
- CVSProviderPlugin.getPlugin().setTimeout(store.getInt(ICVSUIConstants.PREF_TIMEOUT));
- CVSProviderPlugin.getPlugin().setQuietness(getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
- CVSProviderPlugin.getPlugin().setCompressionLevel(store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
- CVSProviderPlugin.getPlugin().setDebugProtocol(store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
- CVSProviderPlugin.getPlugin().setRepositoriesAreBinary(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
- KSubstOption oldKSubst = CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption();
- KSubstOption newKSubst = KSubstOption.fromMode(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST));
- CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(newKSubst);
- CVSProviderPlugin.getPlugin().setUsePlatformLineend(store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
- CVSProviderPlugin.getPlugin().setDetermineVersionEnabled(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION));
- CVSProviderPlugin.getPlugin().setAutoshareOnImport(store.getBoolean(ICVSUIConstants.PREF_AUTO_SHARE_ON_IMPORT));
-
- // changing the default keyword substitution mode for text files may affect
- // information displayed in the decorators
- if (! oldKSubst.equals(newKSubst)) {
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- }
-
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return true;
- }
-
- protected void performDefaults() {
- super.performDefaults();
- final IPreferenceStore store = getPreferenceStore();
- for (Iterator iter = fFields.iterator(); iter.hasNext();) {
- ((Field) iter.next()).performDefaults(store);
- }
- }
-
- /**
- * 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;
- }
-}
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 e7e0842d2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class CVSProjectPropertiesPage extends CVSPropertiesPage {
- IProject project;
- ICVSRepositoryLocation oldLocation;
- ICVSRepositoryLocation newLocation = null;
-
- private static final int TABLE_HEIGHT_HINT = 150;
-
- // Widgets
- Text methodText;
- Text userText;
- Text hostText;
- Text pathText;
- Text moduleText;
- Text portText;
- Text tagText;
- private Button fetchButton;
- private Button watchEditButton;
-
- IUserInfo info;
- CVSTeamProvider provider;
- private boolean fetch;
- private boolean watchEdit;
-
- public static boolean isCompatible(ICVSRepositoryLocation location, ICVSRepositoryLocation oldLocation) {
- if (!location.getHost().equals(oldLocation.getHost())) return false;
- if (!location.getRootDirectory().equals(oldLocation.getRootDirectory())) return false;
- if (location.equals(oldLocation)) return false;
- return true;
- }
-
- private class RepositorySelectionDialog extends Dialog {
- ICVSRepositoryLocation[] allLocations;
- ICVSRepositoryLocation[] compatibleLocatons;
- ICVSRepositoryLocation selectedLocation;
-
- TableViewer viewer;
- Button okButton;
- boolean showCompatible = true;
-
- public RepositorySelectionDialog(Shell shell, ICVSRepositoryLocation oldLocation) {
- super(shell);
- initialize(oldLocation);
- }
- private void initialize(ICVSRepositoryLocation oldLocation) {
- allLocations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- List locations = new ArrayList();
- for (int i = 0; i < allLocations.length; i++) {
- ICVSRepositoryLocation location = allLocations[i];
- if (isCompatible(location, oldLocation)) {
- locations.add(location);
- }
- }
- compatibleLocatons = (ICVSRepositoryLocation[]) locations.toArray(new ICVSRepositoryLocation[locations.size()]);
- }
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- okButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- protected Control createDialogArea(Composite parent) {
- parent.getShell().setText(CVSUIMessages.CVSProjectPropertiesPage_Select_a_Repository_1);
- Composite composite = (Composite) super.createDialogArea(parent);
-
- createLabel(composite, CVSUIMessages.CVSProjectPropertiesPage_Select_a_CVS_repository_location_to_share_the_project_with__2, 1);
- Table table = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.heightHint = TABLE_HEIGHT_HINT;
- table.setLayoutData(data);
- viewer = new TableViewer(table);
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setContentProvider(new WorkbenchContentProvider() {
- public Object[] getElements(Object inputElement) {
- if (showCompatible) {
- return compatibleLocatons;
- } else {
- return allLocations;
- }
- }
- });
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if (selection.isEmpty()) {
- selectedLocation = null;
- okButton.setEnabled(false);
- } else {
- selectedLocation = (ICVSRepositoryLocation)selection.getFirstElement();
- okButton.setEnabled(true);
- }
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- viewer.setInput(compatibleLocatons);
-
- final Button compatibleButton = createCheckBox(composite, CVSUIMessages.CVSProjectPropertiesPage_31);
- compatibleButton.setSelection(showCompatible);
- compatibleButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showCompatible = compatibleButton.getSelection();
- viewer.refresh();
- }
- });
-
- Dialog.applyDialogFont(parent);
-
- return composite;
- }
- protected void cancelPressed() {
- selectedLocation = null;
- super.cancelPressed();
- }
- public ICVSRepositoryLocation getLocation() {
- return selectedLocation;
- }
- }
-
- /*
- * @see PreferencesPage#createContents
- */
- protected Control createContents(Composite parent) {
- initialize();
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Label label = createLabel(composite, CVSUIMessages.CVSProjectPropertiesPage_connectionType, 1);
- methodText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, CVSUIMessages.CVSProjectPropertiesPage_user, 1);
- userText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, CVSUIMessages.CVSRepositoryLocationPropertySource_host, 1);
- hostText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, CVSUIMessages.CVSPropertiesPage_port, 1);
- portText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, CVSUIMessages.CVSRepositoryLocationPropertySource_root, 1);
- pathText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, CVSUIMessages.CVSPropertiesPage_module, 1);
- moduleText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, CVSUIMessages.CVSPropertiesPage_tag, 1);
- tagText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- createLabel(composite, "", 1); //$NON-NLS-1$
-
- // Should absent directories be fetched on update
- fetchButton = createCheckBox(composite, CVSUIMessages.CVSProjectPropertiesPage_fetchAbsentDirectoriesOnUpdate);
- fetchButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- fetch = fetchButton.getSelection();
- }
- });
-
- // Should the project be configured for watch/edit
- watchEditButton = createCheckBox(composite, CVSUIMessages.CVSProjectPropertiesPage_configureForWatchEdit);
- watchEditButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- watchEdit = watchEditButton.getSelection();
- }
- });
-
- createLabel(composite, "", 1); //$NON-NLS-1$
- createLabel(composite, "", 1); //$NON-NLS-1$
- createLabel(composite, "", 1); //$NON-NLS-1$
- createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = new Label(composite, SWT.WRAP);
- label.setText(CVSUIMessages.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);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 200;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- Button changeButton = new Button(composite, SWT.PUSH);
- changeButton.setText(CVSUIMessages.CVSProjectPropertiesPage_Change_Sharing_5);
- changeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell(), oldLocation);
- dialog.open();
- ICVSRepositoryLocation location = dialog.getLocation();
- if (location == null) return;
- newLocation = location;
- initializeValues(newLocation);
- }
- });
-
- initializeValues(oldLocation);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.PROJECT_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Utility method that creates a text instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new text
- * @return the new text
- */
- protected Text createReadOnlyText(Composite parent, String text, int span) {
- Text txt = new Text(parent, SWT.LEFT | SWT.READ_ONLY);
- txt.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- txt.setLayoutData(data);
- return txt;
- }
- /**
- * Creates a new checkbox instance and sets the default layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- protected Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- // Get the project that is the source of this property page
- project = null;
- IAdaptable element = getElement();
- if (element instanceof IProject) {
- project = (IProject)element;
- } else {
- Object adapter = element.getAdapter(IProject.class);
- if (adapter instanceof IProject) {
- project = (IProject)adapter;
- }
- }
- // Do some pre-checks to ensure we're in a good state
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- try {
- oldLocation = cvsRoot.getRemoteLocation();
- fetch = provider.getFetchAbsentDirectories();
- watchEdit = provider.isWatchEditEnabled();
- } catch (TeamException e) {
- handle(e);
- }
- }
- /**
- * Set the initial values of the widgets
- */
- private void initializeValues(ICVSRepositoryLocation location) {
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- ICVSFolder folder = cvsRoot.getLocalRoot();
-
- try {
- if (!folder.isCVSFolder()) return;
- methodText.setText(location.getMethod().getName());
- info = location.getUserInfo(true);
- userText.setText(info.getUsername());
- hostText.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- portText.setText(CVSUIMessages.CVSPropertiesPage_defaultPort);
- } else {
- portText.setText("" + port); //$NON-NLS-1$
- }
- pathText.setText(location.getRootDirectory());
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- if (syncInfo == null) return;
- String label = syncInfo.getRepository();
- if (label.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)) {
- label = NLS.bind(CVSUIMessages.CVSPropertiesPage_virtualModule, new String[] { label });
- }
- moduleText.setText(label);
- fetchButton.setSelection(fetch);
- watchEditButton.setSelection(watchEdit);
- } catch (TeamException e) {
- handle(e);
- }
-
- initializeTag();
- }
-
- private void initializeTag() {
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- try {
- ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(project);
- CVSTag tag = local.getFolderSyncInfo().getTag();
-
- tagText.setText(getTagLabel(tag));
-
- } catch (TeamException e) {
- handle(e);
- }
- }
- /*
- * @see PreferencesPage#performOk
- */
- public boolean performOk() {
- final boolean[] changeReadOnly = { false };
- try {
- if (fetch != provider.getFetchAbsentDirectories())
- provider.setFetchAbsentDirectories(fetch);
- if (watchEdit != provider.isWatchEditEnabled()) {
- provider.setWatchEditEnabled(watchEdit);
- changeReadOnly[0] = true;
- }
- } catch (CVSException e) {
- handle(e);
- }
- if (newLocation == null && !changeReadOnly[0]) {
- return true;
- }
- try {
- if (newLocation != null && !isCompatible(newLocation, oldLocation)) {
- if (!MessageDialog.openQuestion(getShell(), CVSUIMessages.CVSProjectPropertiesPage_32, CVSUIMessages.CVSProjectPropertiesPage_33)) { //
- return false;
- }
- }
- new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(CVSUIMessages.CVSProjectPropertiesPage_progressTaskName,
- ((newLocation == null)?0:100) + (changeReadOnly[0]?100:0));
- if (newLocation != null)
- provider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 100));
- if (changeReadOnly[0])
- setReadOnly(watchEdit, Policy.infiniteSubMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- newLocation = null;
- if (changeReadOnly[0]) {
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- }
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- return false;
- }
-
- return true;
- }
- /**
- * @param watchEdit
- */
- protected void setReadOnly(final boolean watchEdit, final IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 512);
- String taskName = watchEdit?
- CVSUIMessages.CVSProjectPropertiesPage_setReadOnly:
- CVSUIMessages.CVSProjectPropertiesPage_clearReadOnly;
- monitor.subTask(taskName);
- ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(project);
- root.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // only change managed, unmodified files
- if (file.isManaged() && !file.isModified(null))
- file.setReadOnly(watchEdit);
- monitor.worked(1);
- }
-
- public void visitFolder(ICVSFolder folder) throws CVSException {
- folder.acceptChildren(this);
- }
- });
- monitor.done();
- }
- /**
- * Shows the given errors to the user.
- */
- protected void handle(Throwable t) {
- CVSUIPlugin.openError(getShell(), null, null, t);
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
deleted file mode 100644
index bd43f1092..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IProjectSetSerializer;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.operations.CheckoutSingleProjectOperation;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class CVSProjectSetSerializer implements IProjectSetSerializer {
-
- /**
- * @see IProjectSetSerializer#asReference(IProject[])
- *
- * "1.0,repoLocation,module,projectName[,tag]"
- */
- public String[] asReference(IProject[] providerProjects, Object context, IProgressMonitor monitor) throws TeamException {
- String[] result = new String[providerProjects.length];
- for (int i = 0; i < providerProjects.length; i++) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("1.0,"); //$NON-NLS-1$
-
- IProject project = providerProjects[i];
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
- CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
- CVSRepositoryLocation location = CVSRepositoryLocation.fromString(root.getRemoteLocation().getLocation(false));
- location.setUserMuteable(true);
- String repoLocation = location.getLocation(false);
- buffer.append(repoLocation);
- buffer.append(","); //$NON-NLS-1$
-
- ICVSFolder folder = root.getLocalRoot();
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- String module = syncInfo.getRepository();
- buffer.append(module);
- buffer.append(","); //$NON-NLS-1$
-
- String projectName = folder.getName();
- buffer.append(projectName);
- CVSTag tag = syncInfo.getTag();
- if (tag != null) {
- if (tag.getType() != CVSTag.DATE) {
- buffer.append(","); //$NON-NLS-1$
- String tagName = tag.getName();
- buffer.append(tagName);
- }
- }
- result[i] = buffer.toString();
- }
- return result;
- }
-
- /**
- * @see IProjectSetSerializer#addToWorkspace(String[])
- */
- public IProject[] addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor) throws TeamException {
- final int size = referenceStrings.length;
- final IProject[] projects = new IProject[size];
- final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[size];
- final String[] modules = new String[size];
- final CVSTag[] tags = new CVSTag[size];
-
- for (int i = 0; i < size; i++) {
- StringTokenizer tokenizer = new StringTokenizer(referenceStrings[i], ","); //$NON-NLS-1$
- String version = tokenizer.nextToken();
- if (!version.equals("1.0")) { //$NON-NLS-1$
- // Bail out, this is a newer version
- return null;
- }
- String repo = tokenizer.nextToken();
- locations[i] = getLocationFromString(repo);
- modules[i] = tokenizer.nextToken();
- String projectName = tokenizer.nextToken();
- projects[i] = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (tokenizer.hasMoreTokens()) {
- String tagName = tokenizer.nextToken();
- tags[i] = new CVSTag(tagName, CVSTag.BRANCH);
- }
- }
- // Check if any projects will be overwritten, and warn the user.
- boolean yesToAll = false;
- int action;
- final int[] num = new int[] {size};
- for (int i = 0; i < size; i++) {
- Shell shell = null;
- IProject project = projects[i];
- if (project.exists()) {
- if (shell == null) {
- if (context instanceof Shell) {
- shell = (Shell)context;
- } else {
- return null;
- }
- }
- action = confirmOverwrite(project, yesToAll, shell);
- yesToAll = action == 2;
-
- // message dialog
- switch (action) {
- // no
- case 1:
- // Remove it from the set
- locations[i] = null;
- num[0]--;
- break;
- // yes to all
- case 2:
- // yes
- case 0:
- break;
- // cancel
- case 3:
- default:
- return null;
- }
- }
- }
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- monitor.beginTask("", 1000 * num[0]); //$NON-NLS-1$
- try {
- for (int i = 0; i < size; i++) {
- if (locations[i] != null) {
- ICVSRemoteFolder remote = new RemoteFolder(null, locations[i], modules[i], tags[i]);
- new CheckoutSingleProjectOperation(null /* no part */, remote, projects[i], null /* location */, true)
- .run(new SubProgressMonitor(monitor, 1000));
- }
- }
- } finally {
- monitor.done();
- }
- }
- };
- try {
- op.run(monitor);
- } catch (InterruptedException e) {
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException)t;
- }
- }
- List result = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- if (projects[i] != null) result.add(projects[i]);
- }
- return (IProject[])result.toArray(new IProject[result.size()]);
- }
-
- private ICVSRepositoryLocation getLocationFromString(String repo) throws CVSException {
- // create the new location
- ICVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(repo);
- if (newLocation.getUsername() == null || newLocation.getUsername().length() == 0) {
- // look for an existing location that matched
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
- if (location.getMethod() == newLocation.getMethod()
- && location.getHost().equals(newLocation.getHost())
- && location.getPort() == newLocation.getPort()
- && location.getRootDirectory().equals(newLocation.getRootDirectory()))
- return location;
- }
- }
- return newLocation;
- }
-
- private int confirmOverwrite(IProject project, boolean yesToAll, Shell shell) {
- if (yesToAll) return 2;
- if (!project.exists()) return 0;
- final MessageDialog dialog =
- new MessageDialog(shell, CVSUIMessages.CVSProjectSetSerializer_Confirm_Overwrite_Project_8, null, NLS.bind(CVSUIMessages.CVSProjectSetSerializer_The_project__0__already_exists__Do_you_wish_to_overwrite_it__9, new String[] { project.getName() }), MessageDialog.QUESTION, //
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- final int[] result = new int[1];
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
- return result[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
deleted file mode 100644
index ccf4ba227..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public abstract class CVSPropertiesPage extends PropertyPage {
-
- /**
- * Return the appropriate Tag label for properties pages
- * based on the tag type.
- * @param tag
- * @return String
- */
-
- public static String getTagLabel(CVSTag tag) {
-
- if (tag == null) {
- return CVSUIMessages.CVSFilePropertiesPage_none;
- }
-
- switch (tag.getType()) {
- case CVSTag.HEAD:
- return tag.getName();
- case CVSTag.VERSION:
- return NLS.bind(CVSUIMessages.CVSFilePropertiesPage_version, new String[] { tag.getName() });
- case CVSTag.BRANCH:
- return NLS.bind(CVSUIMessages.CVSFilePropertiesPage_branch, new String[] { tag.getName() });
- case CVSTag.DATE:
- return NLS.bind(CVSUIMessages.CVSFilePropertiesPage_date, new String[] { tag.getName() });
- default :
- return tag.getName();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceDropAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceDropAdapter.java
deleted file mode 100644
index 5e1d4df64..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceDropAdapter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.team.ui.history.IHistoryView;
-import org.eclipse.ui.part.IDropActionDelegate;
-
-public class CVSResourceDropAdapter implements IDropActionDelegate {
-
- public boolean run(Object source, Object target) {
-
- if (source != null && target instanceof IHistoryView) {
- CVSResourceTransfer transfer = CVSResourceTransfer.getInstance();
- Object file = transfer.fromByteArray((byte[]) source);
- ((IHistoryView) target).showHistoryFor(file);
-
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceTransfer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceTransfer.java
deleted file mode 100644
index 855c7b8e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceTransfer.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.*;
-
-import org.eclipse.swt.dnd.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-
-
-/**
- *
- * @author Eugene Kuleshov
- */
-public final class CVSResourceTransfer extends ByteArrayTransfer {
-
- public static final String TYPE_NAME = "CVS-resource-transfer-format"; //$NON-NLS-1$
-
- public static int TYPE = registerType(TYPE_NAME);
-
- private static CVSResourceTransfer instance = new CVSResourceTransfer();
-
-
- private CVSResourceTransfer() {
- }
-
- public static CVSResourceTransfer getInstance() {
- return instance;
- }
-
-
- protected int[] getTypeIds() {
- return new int[] { TYPE };
- }
-
- protected String[] getTypeNames() {
- return new String[] { TYPE_NAME };
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.dnd.Transfer#javaToNative(java.lang.Object,org.eclipse.swt.dnd.TransferData)
- */
- public void javaToNative(Object object, TransferData transferData) {
- if (!isSupportedType(transferData)) {
- DND.error(DND.ERROR_INVALID_DATA);
- }
-
- final byte[] bytes = toByteArray((ICVSRemoteFile) object);
- if (bytes != null) {
- super.javaToNative(bytes, transferData);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.dnd.Transfer#nativeToJava(org.eclipse.swt.dnd.TransferData)
- */
- protected Object nativeToJava(TransferData transferData) {
- byte[] bytes = (byte[]) super.nativeToJava(transferData);
- return fromByteArray(bytes);
- }
-
-
- public Object fromByteArray(byte[] bytes) {
- final DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
-
- try {
- String location = in.readUTF();
- String filePath = in.readUTF();
- String fileRevision = in.readUTF();
-
- ICVSRepositoryLocation repositoryLocation = KnownRepositories.getInstance().getRepository(location);
- RemoteFile file = RemoteFile.create( filePath, repositoryLocation);
- file.setRevision(fileRevision);
- file.setReadOnly(true);
- return file;
- } catch (Exception ex) {
- return null;
- }
- }
-
- public byte[] toByteArray(ICVSRemoteFile file) {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- DataOutputStream dos = new DataOutputStream(bos);
- try {
- dos.writeUTF(file.getRepository().getLocation(false));
- dos.writeUTF(file.getRepositoryRelativePath());
- dos.writeUTF(file.getRevision());
- return bos.toByteArray();
- } catch (Exception ex) {
- // ex.printStackTrace();
- return null;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateDescription.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateDescription.java
deleted file mode 100644
index 1b1f59e17..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateDescription.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.team.ui.synchronize.TeamStateDescription;
-
-/**
- * A state description for the CVS decorations. We only need to
- * enumerate the states that can be associated with model
- * elements that don't have a one-to-one mapping to resources
- */
-public class CVSTeamStateDescription extends TeamStateDescription {
-
- /**
- * Property representing the image overlay
- */
- public static final String PROP_RESOURCE_STATE = "resourceState"; //$NON-NLS-1$
- public static final String PROP_TAG = "tag"; //$NON-NLS-1$
-
- public CVSTeamStateDescription(int state) {
- super(state);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateProvider.java
deleted file mode 100644
index 3acb8a1b0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSTeamStateProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.ui.mapping.*;
-import org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider;
-
-public class CVSTeamStateProvider extends SubscriberTeamStateProvider {
-
- public CVSTeamStateProvider(Subscriber subscriber) {
- super(subscriber);
- }
-
- public ITeamStateDescription getStateDescription(Object element, final int requestedStateMask, String[] properties, IProgressMonitor monitor) throws CoreException {
- if (properties != null && properties.length == 0) {
- return new CVSTeamStateDescription(getSynchronizationState(element, requestedStateMask, monitor));
- }
- CVSDecoration d = CVSLightweightDecorator.decorate(element, new SynchronizationStateTester() {
- public int getState(Object element, int stateMask, IProgressMonitor monitor) throws CoreException {
- if (requestedStateMask != USE_DECORATED_STATE_MASK) {
- stateMask = requestedStateMask & stateMask;
- }
- return getSynchronizationState(element, requestedStateMask & stateMask, monitor);
- }
- });
- return d.asTeamStateDescription(properties);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
deleted file mode 100644
index 073e6ecf2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
+++ /dev/null
@@ -1,1178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Maik Schreiber - bug 102461
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class CVSUIMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.team.internal.ccvs.ui.messages";//$NON-NLS-1$
- //
- // Copyright (c) 2000, 2005 IBM Corporation and others.
- // All rights reserved. This program and the accompanying materials
- // are made available under the terms of the Eclipse Public License v1.0
- // which accompanies this distribution, and is available at
- // http://www.eclipse.org/legal/epl-v10.html
- //
- // Contributors:
- // IBM Corporation - initial API and implementation
- //
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, CVSUIMessages.class);
- }
-
- public static String AddAction_confirmAddingResourcesMessage;
- public static String AddAction_confirmAddingResourcesTitle;
- public static String AnnotatePreferencePage_AnnotatePrefPageBinaryFileMessage;
- public static String AnnotatePreferencePage_AnnotatePrefPageMessage;
- public static String AnnotatePreferencePage_AnnotatePrefPageTitle;
- public static String ChangeSetContentProvider_0;
- public static String CheckoutAsMainPage_Browse;
- public static String CheckoutAsMainPage_EmptyWorkingSetErrorMessage;
- public static String CheckoutAsMainPage_WorkingSetExistsErrorMessage;
- public static String CheckoutAsMainPage_WorkingSetMultiple;
- public static String CheckoutAsMainPage_WorkingSetSingle;
- public static String CommitAction_0;
- public static String CommitAction_3;
- public static String CommitAction_1;
- public static String CommitAction_2;
- public static String CommitCommentArea_10;
- public static String CommitCommentArea_7;
- public static String CommitCommentArea_8;
- public static String CommitCommentArea_9;
- public static String CommitWizard_10;
- public static String CommitWizard_11;
- public static String CommitWizard_12;
- public static String CommitWizard_13;
- public static String CommitWizard_8;
- public static String CommitWizard_9;
- public static String ComparePreferencePage_8;
- public static String ConfigurationWizardMainPage_7;
- public static String ConfigurationWizardMainPage_8;
- public static String CreatePatchAction_0;
- public static String CreatePatchAction_1;
- public static String CVSHistoryPage_CollapseAllAction;
- public static String CVSHistoryPage_CollapseAllTooltip;
- public static String CVSHistoryPage_CompareModeTooltip;
- public static String CVSHistoryPage_EnterSearchTerm;
- public static String CVSHistoryPage_FilterOn;
- public static String CVSHistoryPage_FilterOnMessage;
- public static String CVSHistoryPage_FilterDescription;
- public static String CVSHistoryPage_ShowSearchField;
- public static String CVSHistoryPage_ValidateChangeMessage;
- public static String CVSHistoryPage_ValidateChangeTitle;
- public static String CVSPreferencesPage_46;
- public static String CVSPreferencesPage_47;
- public static String CVSPreferencesPage_48;
- public static String CVSPreferencesPage_49;
- public static String CVSPreferencesPage_50;
- public static String CVSPreferencesPage_51;
- public static String CVSPreferencesPage_52;
- public static String CVSPreferencesPage_53;
- public static String CVSPreferencesPage_54;
- public static String CVSPreferencesPage_55;
- public static String CVSPreferencesPage_QuickDiffAnnotate;
- public static String DiffOperation_CreatePatchConflictMessage;
- public static String DiffOperation_CreatePatchConflictTitle;
- public static String GenerateDiffFileWizard_11;
- public static String GenerateDiffFileWizard_12;
- public static String PasswordManagementPreferencePage_2;
- public static String PasswordManagementPreferencePage_3;
- public static String PasswordManagementPreferencePage_4;
- public static String PasswordManagementPreferencePage_5;
- public static String PasswordManagementPreferencePage_6;
- public static String RemoveRootAction_RepositoryRemovalDialogMessageMultiple;
- public static String RemoveRootAction_RepositoryRemovalDialogMessageSingle;
- public static String RemoveRootAction_RepositoryRemovalDialogTitle;
- public static String ReplaceWithLatestRevisionAction_error;
- public static String RepositoriesSortingActionGroup_host;
- public static String RepositoriesSortingActionGroup_label;
- public static String RepositoriesSortingActionGroup_location;
- public static String RepositoriesSortingActionGroup_sortBy;
- public static String RepositoriesSortingActionGroup_descending;
- public static String ShowAnnotationOperation_QDAnnotateMessage;
- public static String ShowAnnotationOperation_QDAnnotateTitle;
- public static String SyncAction_1;
- public static String UserValidationDialog_5;
- public static String UserValidationDialog_6;
- public static String UserValidationDialog_7;
- public static String simpleInternal;
- public static String internal;
- public static String WorkbenchUserAuthenticator_0;
- public static String WorkspaceModelParticipant_0;
- public static String WorkspaceSubscriberContext_1;
- public static String WorkspaceSubscriberContext_2;
- public static String WorkspaceSubscriberContext_3;
- public static String WorkspaceSubscriberContext_4;
- public static String yes;
- public static String no;
- public static String information;
- public static String cvs;
- public static String notAvailable;
- public static String buildError;
- public static String ok;
- public static String separator;
-
- public static String nameAndRevision;
- public static String currentRevision;
-
- public static String AddAction_addFailed;
- public static String AddAction_adding;
- public static String AddAction_addIgnoredTitle;
- public static String AddAction_addIgnoredQuestion;
-
- public static String AddToVersionControlDialog_title;
- public static String AddToVersionControlDialog_thereIsAnUnaddedResource;
- public static String AddToVersionControlDialog_thereAreUnaddedResources;
-
- public static String BranchWizard_title;
- public static String BranchWizardPage_pageDescription;
- public static String BranchWizardPage_pageDescriptionVersion;
- public static String BranchWizardPage_specifyVersion;
- public static String BranchWizardPage_branchName;
- public static String BranchWizardPage_versionName;
- public static String BranchWizardPage_startWorking;
- public static String BranchWizardPage_versionPrefix;
- public static String BranchWizard_versionNameWarning;
- public static String BranchWizard_branchNameWarning;
- public static String BranchWizard_branchAndVersionMustBeDifferent;
- public static String BranchWizardPage_existingVersionsAndBranches;
-
- public static String ConsolePreferencePage_consoleColorSettings;
- public static String ConsolePreferencePage_commandColor;
- public static String ConsolePreferencePage_messageColor;
- public static String ConsolePreferencePage_errorColor;
- public static String CVSAction_errorTitle;
- public static String CVSAction_warningTitle;
- public static String CVSAction_multipleProblemsMessage;
- public static String CVSAction_mixingTagsTitle;
- public static String CVSAction_mixingTags;
-
- public static String ShowAnnotationAction_noSyncInfo;
- public static String ShowAnnotationOperation_taskName;
- public static String ShowAnnotationOperation_0;
- public static String ShowAnnotationOperation_1;
- public static String ShowAnnotationOperation_2;
- public static String ShowAnnotationOperation_3;
- public static String ShowAnnotationOperation_4;
-
- public static String CVSCompareEditorInput_branchLabel;
- public static String CVSCompareEditorInput_headLabel;
- public static String CVSCompareEditorInput_comparing;
- public static String CVSCompareEditorInput_different;
- public static String CVSCompareEditorInput_inBranch;
- public static String CVSCompareEditorInput_inHead;
- public static String CVSCompareEditorInput_0;
- public static String CVSCompareEditorInput_1;
- public static String CVSCompareEditorInput_repository;
- public static String CVSCompareEditorInput_titleAncestor;
- public static String CVSCompareEditorInput_titleNoAncestor;
- public static String CVSCompareEditorInput_titleNoAncestorDifferent;
- public static String CVSCompareRevisionsInput_compareResourceAndVersions;
- public static String CVSCompareRevisionsInput_repository;
- public static String CVSCompareRevisionsInput_workspace;
- public static String CVSCompareRevisionsInput_truncate;
-
- public static String CVSDecoratorPreferencesPage_0;
- public static String CVSDecoratorPreferencesPage_1;
- public static String CVSDecoratorPreferencesPage_2;
- public static String CVSDecoratorPreferencesPage_3;
- public static String CVSDecoratorPreferencesPage_4;
- public static String CVSDecoratorPreferencesPage_5;
- public static String CVSDecoratorPreferencesPage_6;
- public static String CVSDecoratorPreferencesPage_7;
- public static String CVSDecoratorPreferencesPage_8;
- public static String CVSDecoratorPreferencesPage_9;
- public static String CVSDecoratorPreferencesPage_10;
- public static String CVSDecoratorPreferencesPage_11;
- public static String CVSDecoratorPreferencesPage_12;
- public static String CVSDecoratorPreferencesPage_13;
- public static String CVSDecoratorPreferencesPage_14;
- public static String CVSDecoratorPreferencesPage_15;
- public static String CVSDecoratorPreferencesPage_16;
- public static String CVSDecoratorPreferencesPage_17;
- public static String CVSDecoratorPreferencesPage_18;
- public static String CVSDecoratorPreferencesPage_19;
- public static String CVSDecoratorPreferencesPage_20;
- public static String CVSDecoratorPreferencesPage_21;
- public static String CVSDecoratorPreferencesPage_22;
- public static String CVSDecoratorPreferencesPage_23;
- public static String CVSDecoratorPreferencesPage_24;
- public static String CVSDecoratorPreferencesPage_25;
- public static String CVSDecoratorPreferencesPage_26;
- public static String CVSDecoratorPreferencesPage_27;
- public static String CVSDecoratorPreferencesPage_28;
- public static String CVSDecoratorPreferencesPage_29;
- public static String CVSDecoratorPreferencesPage_30;
- public static String CVSDecoratorPreferencesPage_31;
- public static String CVSDecoratorPreferencesPage_32;
- public static String CVSDecoratorPreferencesPage_33;
- public static String CVSDecoratorPreferencesPage_34;
- public static String CVSDecoratorPreferencesPage_35;
- public static String CVSDecoratorPreferencesPage_36;
- public static String CVSDecoratorPreferencesPage_37;
- public static String CVSDecoratorPreferencesPage_38; // repository label
- public static String CVSDecoratorPreferencesPage_39;
- public static String CVSDecoratorConfiguration_0;
- public static String CVSDecoratorConfiguration_1;
- public static String CVSDecoratorConfiguration_2;
- public static String CVSDecoratorConfiguration_3;
- public static String CVSDecoratorConfiguration_4;
-
- public static String CVSFilePropertiesPage_ignored;
- public static String CVSFilePropertiesPage_notManaged;
- public static String CVSFilePropertiesPage_isAdded;
- public static String CVSFilePropertiesPage_baseRevision;
- public static String CVSFilePropertiesPage_baseTimestamp;
- public static String CVSFilePropertiesPage_modified;
- public static String CVSFilePropertiesPage_keywordMode;
- public static String CVSFilePropertiesPage_tag;
- public static String CVSFilePropertiesPage_none;
- public static String CVSFilePropertiesPage_version;
- public static String CVSFilePropertiesPage_branch;
- public static String CVSFilePropertiesPage_date;
- public static String CVSFilePropertiesPage_error;
- public static String CVSFolderPropertiesPage_ignored;
- public static String CVSFolderPropertiesPage_notManaged;
- public static String CVSFolderPropertiesPage_notCVSFolder;
- public static String CVSFolderPropertiesPage_root;
- public static String CVSFolderPropertiesPage_repository;
- public static String CVSFolderPropertiesPage_static;
- public static String CVSFolderPropertiesPage_disconnect;
- public static String CVSFolderPropertiesPage_disconnectTitle;
- public static String CVSFolderPropertiesPage_disconnectQuestion;
-
- public static String CVSPropertiesPage_connectionType;
- public static String CVSPropertiesPage_user;
- public static String CVSPropertiesPage_password;
- public static String CVSPropertiesPage_host;
- public static String CVSPropertiesPage_port;
- public static String CVSPropertiesPage_path;
- public static String CVSPropertiesPage_module;
- public static String CVSPropertiesPage_defaultPort;
- public static String CVSPropertiesPage_tag;
- public static String CVSPreferencesPage_0;
- public static String CVSPreferencesPage_1;
- public static String CVSPreferencesPage_2;
- public static String CVSPreferencesPage_3;
- public static String CVSPreferencesPage_4;
- public static String CVSPreferencesPage_5;
- public static String CVSPreferencesPage_6;
- public static String CVSPreferencesPage_7;
- public static String CVSPreferencesPage_8;
- public static String CVSPreferencesPage_9;
- public static String CVSPreferencesPage_10;
- public static String CVSPreferencesPage_11;
- public static String CVSPreferencesPage_12;
- public static String CVSPreferencesPage_13;
- public static String CVSPreferencesPage_14;
- public static String CVSPreferencesPage_15;
- public static String CVSPreferencesPage_16;
- public static String CVSPreferencesPage_17;
- public static String CVSPreferencesPage_18;
- public static String CVSPreferencesPage_19;
- public static String CVSPreferencesPage_23;
- public static String CVSPreferencesPage_24;
- public static String CVSPreferencesPage_25;
- public static String CVSPreferencesPage_26;
- public static String CVSPreferencesPage_27;
- public static String CVSPreferencesPage_28;
- public static String CVSPreferencesPage_29;
- public static String CVSPreferencesPage_20;
- public static String CVSPreferencesPage_21;
- public static String CVSPreferencesPage_22;
- public static String CVSPreferencesPage_30;
- public static String CVSPreferencesPage_31;
- public static String CVSPreferencesPage_32;
- public static String CVSPreferencesPage_33;
- public static String CVSPreferencesPage_34;
- public static String CVSPreferencesPage_35;
- public static String CVSPreferencesPage_36;
- public static String CVSPreferencesPage_37;
- public static String CVSPreferencesPage_38;
- public static String CVSPreferencesPage_39;
- public static String CVSPreferencesPage_40;
- public static String CVSPreferencesPage_41;
- public static String CVSPreferencesPage_42;
- public static String CVSPreferencesPage_43;
- public static String CVSPreferencesPage_44;
- public static String CVSPreferencesPage_45;
- public static String CVSPropertiesPage_virtualModule;
-
-
- public static String CVSRemoteFilePropertySource_name;
- public static String CVSRemoteFilePropertySource_revision;
- public static String CVSRemoteFilePropertySource_date;
- public static String CVSRemoteFilePropertySource_author;
- public static String CVSRemoteFilePropertySource_comment;
- public static String CVSRemoteFolderPropertySource_name;
- public static String CVSRemoteFolderPropertySource_tag;
- public static String CVSRemoteFolderPropertySource_none;
-
- public static String CVSRepositoryLocationPropertySource_default;
- public static String CVSRepositoryLocationPropertySource_host;
- public static String CVSRepositoryLocationPropertySource_user;
- public static String CVSRepositoryLocationPropertySource_port;
- public static String CVSRepositoryLocationPropertySource_root;
- public static String CVSRepositoryLocationPropertySource_method;
-
- public static String CVSParticipant_0;
- public static String CVSParticipant_1;
- public static String CVSParticipant_2;
- public static String CVSUIPlugin_refreshTitle;
- public static String CVSUIPlugin_refreshQuestion;
- public static String CVSUIPlugin_refreshMultipleQuestion;
-
- public static String CVSAction_disabledTitle;
- public static String CVSAction_disabledMessage;
- public static String CVSAction_refreshTitle;
- public static String CVSAction_refreshQuestion;
- public static String CVSAction_refreshMultipleQuestion;
-
- public static String CommitAction_commitFailed;
- public static String CommitWizardCommitPage_0;
- public static String CommitWizardCommitPage_2;
- public static String CommitWizardCommitPage_3;
- public static String CommitWizardCommitPage_4;
- public static String CommitWizardCommitPage_1;
- public static String CommitWizardCommitPage_5;
- public static String CommitWizardFileTypePage_0;
- public static String CommitWizardFileTypePage_2;
- public static String CommitWizardFileTypePage_3;
-
- public static String ConfigureRepositoryLocationsWizard_title;
- public static String ConfigureRepositoryLocationsWizard_message;
- public static String ConfigureRepositoryLocationsWizard_createLocation;
- public static String ConfigureRepositoryLocationsWizard_createLocationTooltip;
- public static String ConfigureRepositoryLocationsWizard_column0;
- public static String ConfigureRepositoryLocationsWizard_column1;
- public static String ConfigureRepositoryLocationsWizard_showConnection;
- public static String ConfigureRepositoryLocationsWizardDialog_finish;
-
-
- public static String CommitSyncAction_questionRelease;
- public static String CommitSyncAction_titleRelease;
- public static String CommitSyncAction_releaseAll;
- public static String CommitSyncAction_releasePart;
- public static String CommitSyncAction_cancelRelease;
- public static String CompareWithRevisionAction_compare;
- public static String CompareWithRevisionAction_fetching;
-
- public static String CompareWithTagAction_message;
- public static String CompareEditorInput_fileProgress;
-
- public static String ConfigurationWizardAutoconnectPage_description;
- public static String ConfigurationWizardAutoconnectPage_user;
- public static String ConfigurationWizardAutoconnectPage_host;
- public static String ConfigurationWizardAutoconnectPage_port;
- public static String ConfigurationWizardAutoconnectPage_default;
- public static String ConfigurationWizardAutoconnectPage_connectionType;
- public static String ConfigurationWizardAutoconnectPage_repositoryPath;
- public static String ConfigurationWizardAutoconnectPage_module;
- public static String ConfigurationWizardAutoconnectPage_validate;
- public static String ConfigurationWizardAutoconnectPage_noSyncInfo;
- public static String ConfigurationWizardAutoconnectPage_noCVSDirectory;
-
- public static String RepositorySelectionPage_description;
- public static String RepositorySelectionPage_useExisting;
- public static String RepositorySelectionPage_useNew;
-
- public static String ConfigurationWizardMainPage_connection;
- public static String ConfigurationWizardMainPage_userName;
- public static String ConfigurationWizardMainPage_password;
- public static String ConfigurationWizardMainPage_host;
- public static String ConfigurationWizardMainPage_0;
- public static String ConfigurationWizardMainPage_5;
- public static String ConfigurationWizardMainPage_6;
- public static String ConfigurationWizardMainPage_1;
- public static String ConfigurationWizardMainPage_2;
- public static String ConfigurationWizardMainPage_3;
- public static String ConfigurationWizardMainPage_4;
- public static String ConfigurationWizardMainPage_useDefaultPort;
- public static String ConfigurationWizardMainPage_usePort;
- public static String ConfigurationWizardMainPage_repositoryPath;
- public static String ConfigurationWizardMainPage_invalidUserName;
- public static String ConfigurationWizardMainPage_invalidHostName;
- public static String ConfigurationWizardMainPage_invalidPort;
- public static String ConfigurationWizardMainPage_invalidPathWithSpaces;
- public static String ConfigurationWizardMainPage_invalidPathWithSlashes;
- public static String ConfigurationWizardMainPage_invalidPathWithTrailingSlash;
- public static String ConfigurationWizardMainPage_useNTFormat;
-
- public static String Console_resultServerError;
- public static String Console_resultException;
- public static String Console_resultAborted;
- public static String Console_resultOk;
- public static String Console_resultTimeFormat;
- public static String Console_couldNotFormatTime;
- public static String Console_preExecutionDelimiter;
- public static String Console_postExecutionDelimiter;
- public static String Console_info;
- public static String Console_warning;
- public static String Console_error;
-
- public static String AddToBranchAction_enterTag;
- public static String AddToBranchAction_enterTagLong;
-
- public static String GenerateCVSDiff_title;
- public static String GenerateCVSDiff_pageTitle;
- public static String GenerateCVSDiff_pageDescription;
- public static String GenerateCVSDiff_overwriteTitle;
- public static String GenerateCVSDiff_overwriteMsg;
- public static String GenerateCVSDiff_error;
- public static String GenerateCVSDiff_working;
- public static String GenerateCVSDiff_noDiffsFoundMsg;
- public static String GenerateCVSDiff_noDiffsFoundTitle;
- public static String GenerateCVSDiff_1;
- public static String GenerateCVSDiff_2;
- public static String HistoryFilterDialog_title;
- public static String HistoryFilterDialog_showMatching;
- public static String HistoryFilterDialog_matchingAny;
- public static String HistoryFilterDialog_matchingAll;
- public static String HistoryFilterDialog_author;
- public static String HistoryFilterDialog_comment;
- public static String HistoryFilterDialog_fromDate;
- public static String HistoryFilterDialog_toDate;
-
- public static String HistoryView_getContentsAction;
- public static String HistoryView_getRevisionAction;
- public static String HistoryView_tagWithExistingAction;
- public static String HistoryView_copy;
- public static String HistoryView_revision;
- public static String HistoryView_tags;
- public static String HistoryView_date;
- public static String HistoryView_author;
- public static String HistoryView_comment;
- public static String HistoryView_refreshLabel;
- public static String HistoryView_refresh;
- public static String HistoryView_linkWithLabel;
- public static String HistoryView_selectAll;
- public static String HistoryView_showComment;
- public static String HistoryView_wrapComment;
- public static String HistoryView_showTags;
- public static String HistoryView_overwriteTitle;
- public static String HistoryView_overwriteMsg;
- public static String HistoryView_fetchHistoryJob;
- public static String HistoryView_errorFetchingEntries;
-
- public static String IgnoreAction_ignore;
-
- public static String MergeWizard_title;
- public static String MergeWizard_0;
- public static String MergeWizard_1;
- public static String MergeWizardPage_0;
- public static String MergeWizardPage_1;
- public static String MergeWizardPage_2;
- public static String MergeWizardPage_3;
- public static String MergeWizardPage_4;
- public static String MergeWizardPage_5;
- public static String MergeWizardPage_6;
- public static String MergeWizardPage_7;
- public static String MergeWizardPage_8;
- public static String MergeWizardPage_9;
- public static String MergeWizardPage_10;
- public static String MergeWizardPage_11;
- public static String MergeWizardPage_12;
- public static String MergeWizardPage_13;
- public static String MergeWizardEndPage_branches;
-
- public static String ModuleSelectionPage_moduleIsProject;
- public static String ModuleSelectionPage_specifyModule;
-
- public static String ModeWizardSelectionPage_10;
- public static String ModeWizardSelectionPage_11;
- public static String ModeWizardSelectionPage_12;
- public static String ModeWizardSelectionPage_13;
- public static String ModeWizardSelectionPage_14;
- public static String ModeWizardSelectionPage_15;
- public static String ModeWizardSelectionPage_17;
- public static String ModeWizardSelectionPage_18;
- public static String ModeWizardSelectionPage_19;
- public static String ModeWizardSelectionPage_20;
- public static String ModeWizardSelectionPage_21;
- public static String ModeWizardSelectionPage_22;
- public static String ModeWizardSelectionPage_23;
- public static String ModeWizardSelectionPage_24;
- public static String ModeWizardSelectionPage_25;
-
- public static String MoveTagAction_title;
- public static String MoveTagAction_message;
-
- public static String NewLocationWizard_title;
- public static String NewLocationWizard_heading;
- public static String NewLocationWizard_description;
- public static String NewLocationWizard_validationFailedText;
- public static String NewLocationWizard_validationFailedTitle;
- public static String NewLocationWizard_exception;
-
- public static String AlternativeLocationWizard_title;
- public static String AlternativeLocationWizard_heading;
- public static String AlternativeLocationWizard_description;
- public static String AlternativeLocationWizard_validationFailedText;
- public static String AlternativeLocationWizard_validationFailedTitle;
- public static String AlternativeLocationWizard_exception;
-
- public static String AlternativeConfigurationWizardMainPage_0;
-
- public static String OpenLogEntryAction_deletedTitle;
- public static String OpenLogEntryAction_deleted;
-
- public static String ReleaseCommentDialog_title;
- public static String ReleaseCommentDialog_unaddedResources;
- public static String ReleaseCommentDialog_selectAll;
- public static String ReleaseCommentDialog_deselectAll;
- public static String RemoteFolderElement_nameAndTag;
- public static String RemoteFolderElement_fetchingRemoteChildren;
-
- public static String ReplaceWithTagAction_message;
- public static String ReplaceWithTagAction_replace;
- public static String ReplaceWithRemoteAction_problemMessage;
-
- public static String ReplaceWithAction_confirmOverwrite;
- public static String ReplaceWithAction_localChanges;
- public static String ReplaceWithAction_calculatingDirtyResources;
-
- public static String ReplaceWithLatestAction_multipleTags;
- public static String ReplaceWithLatestAction_multipleVersions;
- public static String ReplaceWithLatestAction_multipleBranches;
- public static String ReplaceWithLatestAction_singleVersion;
- public static String ReplaceWithLatestAction_singleBranch;
- public static String ReplaceWithLatestAction_singleHEAD;
-
- public static String RepositoryManager_committing;
- public static String RepositoryManager_rename;
- public static String RepositoryManager_save;
- public static String RepositoryManager_ioException;
- public static String RepositoryManager_parsingProblem;
- public static String RepositoryManager_fetchingRemoteFolders;
-
- public static String RepositoriesView_refresh;
- public static String RepositoriesView_refreshTooltip;
- public static String RepositoriesView_new;
- public static String RepositoriesView_newSubmenu;
- public static String RepositoriesView_newAnonCVS;
- public static String RepositoriesView_newWorkingSet;
- public static String RepositoriesView_deselectWorkingSet;
- public static String RepositoriesView_editWorkingSet;
- public static String RepositoriesView_workingSetMenuItem;
- public static String RepositoriesView_collapseAll;
- public static String RepositoriesView_collapseAllTooltip;
- public static String RepositoriesView_NItemsSelected;
- public static String RepositoriesView_OneItemSelected;
- public static String RepositoriesView_ResourceInRepository;
- public static String RepositoriesView_CannotGetRevision;
- public static String RemoteViewPart_workingSetToolTip;
-
- public static String ResourcePropertiesPage_status;
- public static String ResourcePropertiesPage_notManaged;
- public static String ResourcePropertiesPage_versioned;
- public static String ResourcePropertiesPage_notVersioned;
- //ResourcePropertiesPage.baseRevision=Base Revision
- //ResourcePropertiesPage.none=none
- public static String ResourcePropertiesPage_error;
-
- public static String SharingWizard_autoConnectTitle;
- public static String SharingWizard_autoConnectTitleDescription;
- public static String SharingWizard_selectTagTitle;
- public static String SharingWizard_selectTag;
- public static String SharingWizard_importTitle;
- public static String SharingWizard_importTitleDescription;
- public static String SharingWizard_title;
- public static String SharingWizard_enterInformation;
- public static String SharingWizard_enterInformationDescription;
- public static String SharingWizard_enterModuleName;
- public static String SharingWizard_enterModuleNameDescription;
- public static String SharingWizard_validationFailedText;
- public static String SharingWizard_validationFailedTitle;
-
- public static String ShowHistoryAction_showHistory;
- public static String SyncAction_noChangesTitle;
- public static String SyncAction_noChangesMessage;
-
- public static String TagAction_tagErrorTitle;
- public static String TagAction_tagWarningTitle;
- public static String TagAction_tagProblemsMessage;
- public static String TagAction_tagProblemsMessageMultiple;
- public static String TagAction_tagResources;
- public static String TagRefreshButtonArea_0;
- public static String TagRefreshButtonArea_1;
- public static String TagRefreshButtonArea_2;
- public static String TagRefreshButtonArea_3;
- public static String TagRefreshButtonArea_4;
- public static String TagRefreshButtonArea_5;
- public static String TagRefreshButtonArea_6;
- public static String TagRefreshButtonArea_7;
- public static String TagAction_enterTag;
- public static String TagAction_moveTag;
- public static String TagRootElement_0;
- public static String TagLocalAction_0;
- public static String TagLocalAction_2;
- public static String TagAction_moveTagConfirmTitle;
- public static String TagAction_moveTagConfirmMessage;
- public static String TagAction_uncommittedChangesTitle;
- public static String TagAction_uncommittedChanges;
- public static String TagAction_existingVersions;
-
- public static String TagInRepositoryAction_tagProblemsMessage;
- public static String TagInRepositoryAction_tagProblemsMessageMultiple;
-
- public static String UpdateAction_update;
- public static String UpdateAction_promptForUpdateSeveral;
- public static String UpdateAction_promptForUpdateOne;
- public static String UpdateAction_promptForUpdateTitle;
-
- public static String UpdateWizard_title;
- public static String UpdateWizard_0;
- public static String UpdateWizard_1;
- public static String UserValidationDialog_required;
- public static String UserValidationDialog_labelUser;
- public static String UserValidationDialog_labelPassword;
- public static String UserValidationDialog_password;
- public static String UserValidationDialog_user;
-
- public static String KeyboradInteractiveDialog_message;
- public static String KeyboardInteractiveDialog_labelRepository;
-
- public static String VersionsElement_versions;
-
- public static String WorkbenchUserAuthenticator_cancelled;
- public static String WorkbenchUserAuthenticator_1;
- public static String WorkbenchUserAuthenticator_2;
- public static String Unmanage_title;
- public static String Unmanage_titleN;
- public static String Unmanage_option1;
- public static String Unmanage_option2;
- public static String Unmanage_unmanagingError;
-
- public static String Unmanage_message;
- public static String Unmanage_messageN;
-
- public static String Save_To_Clipboard_2;
- public static String Save_In_File_System_3;
- public static String Browse____4;
- public static String Save_Patch_As_5;
- public static String patch_txt_6;
- public static String Save_In_Workspace_7;
- public static String Select_a_folder_then_type_in_the_file_name__8;
- public static String Fi_le_name__9;
- public static String Diff_output_format_12;
- public static String Unified__format_required_by_Compare_With_Patch_feature__13;
- public static String Context_14;
- public static String Standard_15;
- public static String Advanced_options_19;
- public static String Configure_the_options_used_for_the_CVS_diff_command_20;
-
- public static String TagSelectionDialog_Select_a_Tag_1;
- public static String TagSelectionDialog_recurseOption;
- public static String TagSelectionDialog_0;
- public static String TagSelectionDialog_1;
- public static String TagSelectionDialog_7;
- public static String TagSelectionDialog_8;
-
- public static String TagSelectionArea_0;
- public static String TagSelectionArea_1;
- public static String TagSelectionArea_2;
- public static String TagSelectionArea_3;
- public static String TagSelectionWizardPage_0;
- public static String TagSelectionWizardPage_1;
-
- public static String ExtMethodPreferencePage_message;
- public static String ExtMethodPreferencePage_CVS_RSH;
- public static String ExtMethodPreferencePage_Browse;
- public static String ExtMethodPreferencePage_0;
- public static String ExtMethodPreferencePage_2;
- public static String ExtMethodPreferencePage_1;
- public static String ExtMethodPreferencePage_Details;
- public static String ExtMethodPreferencePage_CVS_RSH_Parameters;
- public static String ExtMethodPreferencePage_CVS_SERVER__7;
- public static String UpdateMergeActionProblems_merging_remote_resources_into_workspace_1;
- public static String TagConfigurationDialog_1;
- public static String TagConfigurationDialog_5;
- public static String TagConfigurationDialog_6;
- public static String TagConfigurationDialog_7;
- public static String TagConfigurationDialog_8;
- public static String TagConfigurationDialog_9;
- public static String TagConfigurationDialog_0;
- public static String TagConfigurationDialog_10;
- public static String TagConfigurationDialog_11;
- public static String TagConfigurationDialog_12;
- public static String TagConfigurationDialog_13;
- public static String TagConfigurationDialog_14;
- public static String TagConfigurationDialog_20;
- public static String TagConfigurationDialog_21;
- public static String TagConfigurationDialog_22;
- public static String TagConfigurationDialog_AddDateTag;
-
- public static String ConfigureTagsFromRepoViewConfigure_Tag_Error_1;
- public static String RemoteRootAction_label;
- public static String RemoteLogOperation_0;
- public static String RemoteLogOperation_1;
- public static String RemoveDateTagAction_0;
- public static String RemoteRootAction_Unable_to_Discard_Location_1;
- public static String RemoteRootAction_Projects_in_the_local_workspace_are_shared_with__2;
- public static String RemoteRootAction_The_projects_that_are_shared_with_the_above_repository_are__4;
-
- public static String BranchCategory_Branches_1;
- public static String VersionCategory_Versions_1;
- public static String HistoryView_______4;
-
- public static String CVSProjectPropertiesPage_connectionType;
- public static String CVSProjectPropertiesPage_user;
- public static String CVSProjectPropertiesPage_Select_a_Repository_1;
- public static String CVSProjectPropertiesPage_Select_a_CVS_repository_location_to_share_the_project_with__2;
- public static String CVSProjectPropertiesPage_Change_Sharing_5;
- public static String CVSProjectPropertiesPage_fetchAbsentDirectoriesOnUpdate;
- public static String CVSProjectPropertiesPage_configureForWatchEdit;
- public static String CVSProjectPropertiesPage_progressTaskName;
- public static String CVSProjectPropertiesPage_setReadOnly;
- public static String CVSProjectPropertiesPage_clearReadOnly;
- public static String CVSRepositoryPropertiesPage_Confirm_Project_Sharing_Changes_1;
- public static String CVSRepositoryPropertiesPage_There_are_projects_in_the_workspace_shared_with_this_repository_2;
- public static String CVSRepositoryPropertiesPage_sharedProject;
- public static String CVSRepositoryPropertiesPage_useLocationAsLabel;
- public static String CVSRepositoryPropertiesPage_useCustomLabel;
-
- public static String CVSProjectSetSerializer_Confirm_Overwrite_Project_8;
- public static String CVSProjectSetSerializer_The_project__0__already_exists__Do_you_wish_to_overwrite_it__9;
-
- public static String IgnoreResourcesDialog_dialogTitle;
- public static String IgnoreResourcesDialog_title;
- public static String IgnoreResourcesDialog_messageSingle;
- public static String IgnoreResourcesDialog_messageMany;
- public static String IgnoreResourcesDialog_filesWithSpaceWarningMessage;
- public static String IgnoreResourcesDialog_filesWithSpaceWarning;
- public static String IgnoreResourcesDialog_filesWithNoExtensionWarningMessage;
- public static String IgnoreResourcesDialog_addNameEntryButton;
- public static String IgnoreResourcesDialog_addNameEntryExample;
- public static String IgnoreResourcesDialog_addExtensionEntryButton;
- public static String IgnoreResourcesDialog_addExtensionEntryExample;
- public static String IgnoreResourcesDialog_addCustomEntryButton;
- public static String IgnoreResourcesDialog_addCustomEntryExample;
- public static String IgnoreResourcesDialog_patternMustNotBeEmpty;
- public static String IgnoreResourcesDialog_patternDoesNotMatchFile;
-
- public static String 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;
-
- public static String ConfigurationWizardMainPage_Location_1;
- public static String ConfigurationWizardMainPage_Authentication_2;
- public static String ConfigurationWizardMainPage_Connection_3;
- public static String AlternateUserValidationDialog_Enter_Password_2;
- public static String AlternateUserValidationDialog_OK_6;
- public static String AlternateUserValidationDialog_Cancel_7;
- public static String AlternateUserValidationDialog_message;
- public static String WorkbenchUserAuthenticator_The_operation_was_canceled_by_the_user_1;
- public static String WorkingSetSelectionArea_workingSetOther;
- public static String ListSelectionArea_selectAll;
- public static String ListSelectionArea_deselectAll;
-
- public static String RestoreFromRepositoryWizard_fileSelectionPageTitle;
- public static String RestoreFromRepositoryWizard_fileSelectionPageDescription;
- public static String RestoreFromRepositoryFileSelectionPage_fileSelectionPaneTitle;
- public static String RestoreFromRepositoryFileSelectionPage_revisionSelectionPaneTitle;
- public static String RestoreFromRepositoryFileSelectionPage_fileToRestore;
- public static String RestoreFromRepositoryFileSelectionPage_fileContentPaneTitle;
- public static String RestoreFromRepositoryFileSelectionPage_emptyRevisionPane;
- public static String RestoreFromRepositoryFileSelectionPage_fileExists;
- public static String RestoreFromRepositoryFileSelectionPage_revisionIsDeletion;
- public static String RestoreFromRepositoryAction_noFilesTitle;
- public static String RestoreFromRepositoryAction_noFilesMessage;
-
- public static String RepositoryRoot_folderInfoMissing;
-
- public static String RepositoriesViewContentHandler_unmatchedTag;
- public static String RepositoriesViewContentHandler_missingAttribute;
- public static String RepositoriesViewContentHandler_errorCreatingRoot;
-
- public static String WatchEditPreferencePage_description;
- public static String WatchEditPreferencePage_checkoutReadOnly;
- public static String WatchEditPreferencePage_validateEditSaveAction;
- public static String WatchEditPreferencePage_edit;
- public static String WatchEditPreferencePage_editInBackground;
- public static String WatchEditPreferencePage_highjack;
- public static String WatchEditPreferencePage_editPrompt;
- public static String WatchEditPreferencePage_neverPrompt;
- public static String WatchEditPreferencePage_alwaysPrompt;
- public static String WatchEditPreferencePage_onlyPrompt;
- public static String WatchEditPreferencePage_updatePrompt;
- public static String WatchEditPreferencePage_autoUpdate;
- public static String WatchEditPreferencePage_promptUpdate;
- public static String WatchEditPreferencePage_neverUpdate;
- public static String WatchEditPreferencePage_0;
-
- public static String Uneditaction_confirmMessage;
- public static String Uneditaction_confirmTitle;
-
- public static String FileModificationValidator_vetoMessage;
-
- public static String RefreshRemoteProjectWizard_title;
- public static String RefreshRemoteProjectWizard_0;
- public static String RefreshRemoteProjectWizard_1;
- public static String RefreshRemoteProjectWizard_2;
- public static String RefreshRemoteProjectWizard_3;
- public static String RefreshRemoteProjectWizard_4;
- public static String RefreshRemoteProjectSelectionPage_pageTitle;
- public static String RefreshRemoteProjectSelectionPage_pageDescription;
- public static String RefreshRemoteProjectSelectionPage_selectRemoteProjects;
- public static String RefreshRemoteProjectSelectionPage_noWorkingSet;
- public static String RefreshRemoteProjectSelectionPage_workingSet;
-
- public static String EditorsView_file;
- public static String EditorsView_user;
- public static String EditorsView_date;
- public static String EditorsView_computer;
-
- public static String EditorsDialog_title;
- public static String EditorsDialog_question;
- public static String EditorsAction_classNotInitialized;
-
- public static String RemoteFileEditorInput_fullPathAndRevision;
-
- public static String CheckoutOperation_thisResourceExists;
- public static String CheckoutOperation_thisExternalFileExists;
- public static String CheckoutOperation_confirmOverwrite;
- public static String CheckoutOperation_scrubbingProject;
- public static String CheckoutOperation_refreshingProject;
-
- public static String CheckoutSingleProjectOperation_taskname;
- public static String CheckoutMultipleProjectsOperation_taskName;
-
- public static String CheckoutIntoOperation_taskname;
- public static String CheckoutIntoOperation_targetIsFile;
- public static String CheckoutIntoOperation_targetIsFolder;
- public static String CheckoutIntoOperation_targetIsPrunedFolder;
- public static String CheckoutIntoOperation_mappingAlreadyExists;
- public static String CheckoutIntoOperation_cancelled;
- public static String CheckoutIntoOperation_overwriteMessage;
-
- public static String CheckoutAsWizard_title;
- public static String CheckoutAsWizard_error;
- public static String CheckoutAsMainPage_title;
- public static String CheckoutAsMainPage_description;
- public static String CheckoutAsMainPage_singleFolder;
- public static String CheckoutAsMainPage_asConfiguredProject;
- public static String CheckoutAsMainPage_asSimpleProject;
- public static String CheckoutAsMainPage_projectNameLabel;
- public static String CheckoutAsMainPage_multipleFolders;
- public static String CheckoutAsMainPage_asProjects;
- public static String CheckoutAsMainPage_intoProject;
-
- public static String CheckoutAsLocationSelectionPage_title;
- public static String CheckoutAsLocationSelectionPage_description;
- public static String CheckoutAsLocationSelectionPage_useDefaultLabel;
- public static String CheckoutAsLocationSelectionPage_locationLabel;
- public static String CheckoutAsLocationSelectionPage_parentDirectoryLabel;
- public static String CheckoutAsLocationSelectionPage_browseLabel;
- public static String CheckoutAsLocationSelectionPage_locationEmpty;
- public static String CheckoutAsLocationSelectionPage_invalidLocation;
- public static String CheckoutAsLocationSelectionPage_messageForSingle;
- public static String CheckoutAsLocationSelectionPage_messageForMulti;
-
- public static String CheckoutAsProjectSelectionPage_title;
- public static String CheckoutAsProjectSelectionPage_description;
- public static String CheckoutAsProjectSelectionPage_name;
- public static String CheckoutAsProjectSelectionPage_treeLabel;
- public static String CheckoutAsProjectSelectionPage_showLabel;
- public static String CheckoutAsProjectSelectionPage_recurse;
- public static String CheckoutAsProjectSelectionPage_showAll;
- public static String CheckoutAsProjectSelectionPage_showUnshared;
- public static String CheckoutAsProjectSelectionPage_showSameRepo;
- public static String CheckoutAsProjectSelectionPage_invalidFolderName;
-
- public static String WorkspaceChangeSetCapability_1;
- public static String OpenCommitSetAction_20;
- public static String OpenCommitSetAction_21;
- public static String WorkspaceChangeSetCapability_2;
- public static String WorkspaceChangeSetCapability_3;
- public static String CVSChangeSetCollector_4;
- public static String CVSChangeSetCollector_0;
- public static String WorkspaceChangeSetCapability_7;
- public static String WorkspaceChangeSetCapability_8;
- public static String WorkspaceChangeSetCapability_9;
-
- public static String ProjectMetaFile_taskName;
- public static String TagFromWorkspace_taskName;
- public static String TagFromRepository_taskName;
- public static String UpdateOnlyMergeable_taskName;
- public static String UpdateDialog_overwriteTitle;
- public static String UpdateDialog_overwriteMessage;
- public static String ReplaceOperation_taskName;
- public static String UpdateOperation_taskName;
-
- public static String SafeUpdateAction_warnFilesWithConflictsTitle;
- public static String SafeUpdateAction_warnFilesWithConflictsDescription;
-
- public static String ShowAnnotationAction_2;
- public static String ShowAnnotationAction_3;
-
- public static String UpdateAction_jobName;
- public static String MergeUpdateAction_jobName;
- public static String MergeUpdateAction_invalidSubscriber;
- public static String CommitAction_jobName;
-
- public static String CommitCommentArea_0;
- public static String CommitCommentArea_1;
- public static String CommitCommentArea_2;
- public static String CommitCommentArea_3;
- public static String CommitCommentArea_4;
- public static String CommitCommentArea_5;
- public static String CommitCommentArea_6;
-
- public static String CommentTemplatesPreferencePage_Description;
- public static String CommentTemplatesPreferencePage_New;
- public static String CommentTemplatesPreferencePage_Edit;
- public static String CommentTemplatesPreferencePage_Remove;
- public static String CommentTemplatesPreferencePage_Preview;
- public static String CommentTemplatesPreferencePage_EditCommentTemplateTitle;
- public static String CommentTemplatesPreferencePage_EditCommentTemplateMessage;
-
- public static String CheckoutProjectOperation_8;
- public static String CheckoutProjectOperation_9;
- public static String CheckoutProjectOperation_0;
- public static String CheckoutProjectOperation_1;
- public static String CVSOperation_0;
- public static String CVSOperation_1;
- public static String CVSOperation_2;
- public static String CVSModelElement_0;
- public static String CVSModelElement_1;
- public static String CVSDecorator_exceptionMessage;
- public static String FetchMembersOperation_0;
-
- public static String RemoteRevisionQuickDiffProvider_readingFile;
- public static String RemoteRevisionQuickDiffProvider_closingFile;
- public static String RemoteRevisionQuickDiffProvider_fetchingFile;
- public static String RemoteCompareOperation_0;
-
- public static String RefreshDirtyStateOperation_0;
- public static String RefreshDirtyStateOperation_1;
- public static String IgnoreAction_0;
- public static String IgnoreAction_1;
- public static String GenerateDiffFileOperation_0;
- public static String GenerateDiffFileOperation_1;
- public static String GenerateDiffFileOperation_2;
- public static String DiffOperation_0;
- public static String DiffOperation_1;
- public static String GenerateDiffFileWizard_6;
- public static String GenerateDiffFileWizard_7;
- public static String GenerateDiffFileWizard_8;
- public static String GenerateDiffFileWizard_9;
- public static String GenerateDiffFileWizard_10;
- public static String GenerateDiffFileWizard_File_multisegments;
- public static String GenerateDiffFileWizard_SelectAll;
- public static String GenerateDiffFileWizard_DeselectAll;
- public static String GenerateDiffFileWizard_0;
- public static String GenerateDiffFileWizard_2;
- public static String GenerateDiffFileWizard_3;
- public static String GenerateDiffFileWizard_4;
- public static String GenerateDiffFileWizard_5;
- public static String MergeSynchronizeParticipant_8;
- public static String MergeSynchronizeParticipant_9;
- public static String MergeSynchronizeParticipant_10;
- public static String MergeSynchronizeParticipant_11;
- public static String MergeSynchronizeParticipant_12;
- public static String DisconnectOperation_0;
- public static String DisconnectOperation_1;
- public static String SubscriberConfirmMergedAction_0;
- public static String SubscriberConfirmMergedAction_jobName;
- public static String CVSSubscriberAction_0;
- public static String ReconcileProjectOperation_0;
- public static String CheckoutToRemoteFolderOperation_0;
- public static String CVSRepositoryPropertiesPage_0;
- public static String CVSRepositoryPropertiesPage_1;
- public static String CompareRevertAction_0;
- public static String CompareParticipant_0;
-
- public static String ComparePreferencePage_0;
- public static String ComparePreferencePage_1;
- public static String ComparePreferencePage_2;
- public static String ComparePreferencePage_3;
- public static String ComparePreferencePage_4;
- public static String ComparePreferencePage_6;
-
- public static String FileModificationValidator_3;
- public static String FileModificationValidator_4;
- public static String FileModificationValidator_5;
- public static String FileModificationValidator_6;
- public static String CVSSynchronizeWizard_0;
- public static String Participant_comparing;
- public static String Participant_merging;
- public static String CompareWithRevisionAction_4;
- public static String ReplaceWithRevisionAction_0;
- public static String ReplaceWithRevisionAction_1;
-
- public static String ConsolePreferencesPage_4;
- public static String ConsolePreferencesPage_5;
- public static String ConsolePreferencesPage_6;
- public static String ConsolePreferencesPage_7;
- public static String ConsolePreferencesPage_8;
- public static String ConsolePreferencesPage_9;
-
- public static String SharingWizard_23;
- public static String SharingWizard_24;
- public static String SharingWizard_25;
- public static String ReconcileProjectOperation_1;
- public static String ReconcileProjectOperation_2;
- public static String ShareProjectOperation_0;
- public static String SharingWizard_26;
- public static String SharingWizard_27;
- public static String SharingWizardSyncPage_3;
- public static String SharingWizardSyncPage_4;
- public static String SharingWizardSyncPage_5;
- public static String SharingWizardSyncPage_8;
- public static String SharingWizardSyncPage_9;
- public static String SharingWizardSyncPage_12;
- public static String ShareProjectOperation_1;
- public static String ShareProjectOperation_2;
- public static String ShareProjectOperation_3;
- public static String CVSProjectPropertiesPage_31;
- public static String CVSProjectPropertiesPage_32;
- public static String CVSProjectPropertiesPage_33;
- public static String RepositoryEncodingPropertyPage_2;
- public static String RepositoryEncodingPropertyPage_3;
- public static String RepositoryEncodingPropertyPage_0;
- public static String RepositoryEncodingPropertyPage_1;
- public static String RepositoryEncodingPropertyPage_4;
- public static String CheckoutWizard_7;
- public static String CheckoutWizard_8;
- public static String CheckoutWizard_0;
- public static String CheckoutWizard_10;
- public static String CheckoutWizard_11;
- public static String ModuleSelectionPage_2;
- public static String CheckoutAsWizard_3;
- public static String CheckoutAsWizard_4;
- public static String CheckoutAsMainPage_10;
- public static String CVSTeamProvider_updatingFile;
- public static String CVSTeamProvider_makeBranch;
- public static String CVSTeamProvider_folderInfo;
- public static String CVSTeamProvider_updatingFolder;
- public static String AddOperation_0;
- public static String BranchOperation_0;
- public static String BranchOperation_1;
- public static String CommitOperation_0;
- public static String CommitSetDialog_0;
- public static String CommitSetDialog_2;
- public static String CommitWizard_0;
- public static String CommitWizard_1;
- public static String CommitWizard_2;
- public static String CommitWizard_4;
- public static String CommitWizard_6;
- public static String CommitWizard_7;
- public static String UpdateOperation_0;
- public static String ReplaceOperation_0;
- public static String ReplaceOperation_1;
- public static String TagOperation_0;
- public static String RemoteAnnotationStorage_1;
- public static String DateTagCategory_0;
- public static String DateTagDialog_0;
- public static String DateTagDialog_1;
- public static String DateTagDialog_2;
- public static String DateTagDialog_3;
- public static String DateTagDialog_4;
- public static String DateTagDialog_5;
- public static String LogEntryCacheUpdateHandler_0;
- public static String LogEntryCacheUpdateHandler_1;
- public static String LogEntryCacheUpdateHandler_2;
- public static String MultiFolderTagSource_0;
- public static String LocalProjectTagSource_0;
- public static String ModeWizard_0;
- public static String ModeWizard_1;
- public static String ModeWizard_2;
- public static String ModeWizard_3;
- public static String ModeWizard_4;
- public static String ModeWizard_5;
- public static String ModeWizard_6;
-
- public static String ModeWizardSelectionPage_2;
- public static String ModeWizardSelectionPage_3;
- public static String ModeWizardSelectionPage_4;
- public static String ModeWizardSelectionPage_8;
- public static String ModeWizardSelectionPage_9;
-
- public static String ReplaceWithTagAction_0;
- public static String ReplaceWithTagAction_1;
- public static String ReplaceWithTagAction_2;
- public static String UncommittedChangesDialog_2;
- public static String UncommittedChangesDialog_3;
- public static String UncommittedChangesDialog_4;
- public static String AddWizard_0;
-
- public static String OpenChangeSetAction_0;
- public static String OpenChangeSetAction_1;
-
- public static String WorkInProgress_EnableModelUpdate;
- public static String CVSMappingMergeOperation_MergeInfoTitle;
- public static String CVSMappingMergeOperation_MergeInfoText;
-
- public static String WorkInProgressPage_0;
- public static String WorkInProgressPage_1;
- public static String WorkInProgressPage_2;
- public static String FetchAllMembersOperation_0;
- public static String CacheTreeContentsOperation_0;
- public static String CacheTreeContentsOperation_1;
- public static String CVSMergeContext_0;
- public static String CVSMergeContext_1;
- public static String CVSMergeContext_2;
- public static String UpdateMergePreferencePage_0;
- public static String UpdateMergePreferencePage_1;
- public static String UpdateMergePreferencePage_2;
- public static String UpdateMergePreferencePage_3;
- public static String WorkspaceSubscriberContext_0;
- public static String ModelReplaceOperation_0;
- public static String ModelReplaceOperation_1;
- public static String ModelReplaceOperation_2;
- public static String ModelReplaceOperation_3;
- public static String MergeWizardPage_14;
- public static String CVSHistoryFilterDialog_showLocalRevisions;
- public static String CVSHistoryTableProvider_base;
- public static String CVSHistoryTableProvider_currentVersion;
- public static String ComparePreferencePage_7;
- public static String WorkspaceTraversalAction_0;
- public static String OutgoingChangesDialog_0;
- public static String OutgoingChangesDialog_1;
- public static String SyncAction_0;
- public static String ModelCompareOperation_0;
- public static String CVSHistoryPage_LocalModeAction;
- public static String CVSHistoryPage_LocalModeTooltip;
- public static String CVSHistoryPage_RemoteModeAction;
- public static String CVSHistoryPage_RemoteModeTooltip;
- public static String CVSHistoryPage_NoRevisions;
- public static String CVSHistoryPage_CombinedModeAction;
- public static String CVSHistoryPage_CombinedModeTooltip;
- public static String CVSHistoryPage_CompareRevisionAction;
- public static String CVSHistoryPage_CompareModeToggleAction;
- public static String CVSHistoryPage_FilterHistoryTooltip;
- public static String CVSHistoryPage_OpenAction;
- public static String CVSHistoryPage_GroupByDate;
- public static String CVSHistoryPage_Today;
- public static String CVSHistoryPage_Yesterday;
- public static String CVSHistoryPage_ThisMonth;
- public static String CVSHistoryPage_Previous;
- public static String CVSHistoryPage_NoRevisionsForMode;
- public static String CVSHistoryPage_NoFilter;
-
- public static String CVSProxyPreferencePage_enableProxy;
- public static String CVSProxyPreferencePage_proxyTpe;
- public static String CVSProxyPreferencePage_proxyHost;
- public static String CVSProxyPreferencePage_proxyPort;
- public static String CVSProxyPreferencePage_enableProxyAuth;
- public static String CVSProxyPreferencePage_proxyUser;
- public static String CVSProxyPreferencePage_proxyPass;
- public static String CVSProxyPreferencePage_proxyPortError;
-
- public static String NewLocationWizard_1;
- public static String NewLocationWizard_2;
- public static String NewLocationWizard_3;
- public static String NewLocationWizard_4;
- public static String ClipboardDiffOperation_Clipboard;
- public static String CVSAction_doNotShowThisAgain;
-}
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 c8c423ad9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ /dev/null
@@ -1,696 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- * William Mitsuda (wmitsuda@gmail.com) - Bug 153879 [Wizards] configurable size of cvs commit comment history
- * Brock Janiczak <brockj@tpg.com.au> - Bug 161536 Warn user when committing resources with problem markers
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole;
-import org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * UI Plugin for CVS provider-specific workbench functionality.
- */
-public class CVSUIPlugin extends AbstractUIPlugin {
- /**
- * The id of the CVS plug-in
- */
- public static final String ID = "org.eclipse.team.cvs.ui"; //$NON-NLS-1$
- public static final String DECORATOR_ID = "org.eclipse.team.cvs.ui.decorator"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the decorator configuration has changed.
- */
- public static final String P_DECORATORS_CHANGED = CVSUIPlugin.ID + ".P_DECORATORS_CHANGED"; //$NON-NLS-1$
-
- private Hashtable imageDescriptors = new Hashtable(20);
- private static List propertyChangeListeners = new ArrayList(5);
-
- /**
- * The singleton plug-in instance
- */
- private static CVSUIPlugin plugin;
-
- /**
- * The CVS console
- */
- private CVSOutputConsole console;
-
- /**
- * The repository manager
- */
- private RepositoryManager repositoryManager;
-
- /**
- * CVSUIPlugin constructor
- *
- * @param descriptor the plugin descriptor
- */
- public CVSUIPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated display. If so, this
- * display is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display= Display.getCurrent();
- if (display == null) {
- display= Display.getDefault();
- }
- return display;
- }
-
- /**
- * Creates an image and places it in the image registry.
- */
- protected void createImageDescriptor(String id) {
- URL url = FileLocator.find(CVSUIPlugin.getPlugin().getBundle(), new Path(ICVSUIConstants.ICON_PATH + id), null);
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- imageDescriptors.put(id, desc);
- }
-
- /**
- * Returns the active workbench page. Note that the active page may not be
- * the one that the user perceives as active in some situations so this
- * method of obtaining the activate page should only be used if no other
- * method is available.
- *
- * @return the active workbench page
- */
- public static IWorkbenchPage getActivePage() {
- return TeamUIPlugin.getActivePage();
- }
-
- /**
- * Register for changes made to Team properties.
- */
- public static void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
-
- /**
- * Remove a Team property changes.
- */
- public static void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
-
- /**
- * Broadcast a Team property change.
- */
- public static void broadcastPropertyChange(PropertyChangeEvent event) {
- for (Iterator it = propertyChangeListeners.iterator(); it.hasNext();) {
- IPropertyChangeListener listener = (IPropertyChangeListener)it.next();
- listener.propertyChange(event);
- }
- }
-
- /**
- * Run an operation involving the given resource. If an exception is thrown
- * and the code on the status is IResourceStatus.OUT_OF_SYNC_LOCAL then
- * the user will be prompted to refresh and try again. If they agree, then the
- * supplied operation will be run again.
- */
- public static void runWithRefresh(Shell parent, IResource[] resources,
- IRunnableWithProgress runnable, IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- boolean firstTime = true;
- while(true) {
- try {
- runnable.run(monitor);
- return;
- } catch (InvocationTargetException e) {
- if (! firstTime) throw e;
- IStatus status = null;
- if (e.getTargetException() instanceof CoreException) {
- status = ((CoreException)e.getTargetException()).getStatus();
- } else if (e.getTargetException() instanceof TeamException) {
- status = ((TeamException)e.getTargetException()).getStatus();
- } else {
- throw e;
- }
- if (status.getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- if (promptToRefresh(parent, resources, status)) {
- try {
- for (int i = 0; i < resources.length; i++) {
- resources[i].refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- } catch (CoreException coreEx) {
- // Throw the original exception to the caller
- log(coreEx);
- throw e;
- }
- firstTime = false;
- // Fall through and the operation will be tried again
- } else {
- // User chose not to continue. Treat it as a cancel.
- throw new InterruptedException();
- }
- } else {
- throw e;
- }
- }
- }
- }
-
- private static boolean promptToRefresh(final Shell shell, final IResource[] resources, final IStatus status) {
- final boolean[] result = new boolean[] { false};
- Runnable runnable = new Runnable() {
- public void run() {
- Shell shellToUse = shell;
- if (shell == null) {
- shellToUse = new Shell(Display.getCurrent());
- }
- String question;
- if (resources.length == 1) {
- question = NLS.bind(CVSUIMessages.CVSUIPlugin_refreshQuestion, new String[] { status.getMessage(), resources[0].getFullPath().toString() });
- } else {
- question = NLS.bind(CVSUIMessages.CVSUIPlugin_refreshMultipleQuestion, new String[] { status.getMessage() });
- }
- result[0] = MessageDialog.openQuestion(shellToUse, CVSUIMessages.CVSUIPlugin_refreshTitle, question);
- }
- };
- 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 canceled
- */
- public static void runWithProgress(Shell parent, boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- Utils.runWithProgress(parent, cancelable, runnable);
- }
-
- /**
- * Returns the image descriptor for the given image ID.
- * Returns null if there is no such image.
- */
- public ImageDescriptor getImageDescriptor(String id) {
- return (ImageDescriptor)imageDescriptors.get(id);
- }
-
- /**
- * Returns the singleton plug-in instance.
- *
- * @return the plugin instance
- */
- public static CVSUIPlugin getPlugin() {
- return plugin;
- }
-
- /**
- * Returns the repository manager
- *
- * @return the repository manager
- */
- public synchronized RepositoryManager getRepositoryManager() {
- if (repositoryManager == null) {
- repositoryManager = new RepositoryManager();
- repositoryManager.startup();
- }
- return repositoryManager;
- }
-
- /**
- * Initializes the table of images used in this plugin.
- */
- private void initializeImages() {
- // objects
- createImageDescriptor(ICVSUIConstants.IMG_REPOSITORY);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED);
- createImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR);
- createImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR_ENABLED);
- createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL);
- createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED);
- createImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION);
- createImageDescriptor(ICVSUIConstants.IMG_CVSLOGO);
- createImageDescriptor(ICVSUIConstants.IMG_TAG);
- createImageDescriptor(ICVSUIConstants.IMG_MODULE);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR_ENABLED);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR_DISABLED);
- createImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY);
- createImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY);
- createImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
- createImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_KEYWORD);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_IMPORT);
- createImageDescriptor(ICVSUIConstants.IMG_MERGEABLE_CONFLICT);
- createImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE);
- createImageDescriptor(ICVSUIConstants.IMG_MERGED);
- createImageDescriptor(ICVSUIConstants.IMG_EDITED);
- createImageDescriptor(ICVSUIConstants.IMG_NO_REMOTEDIR);
- createImageDescriptor(ICVSUIConstants.IMG_CVS_CONSOLE);
- createImageDescriptor(ICVSUIConstants.IMG_DATE);
- createImageDescriptor(ICVSUIConstants.IMG_CHANGELOG);
- createImageDescriptor(ICVSUIConstants.IMG_FILTER_HISTORY);
- createImageDescriptor(ICVSUIConstants.IMG_LOCALMODE);
- createImageDescriptor(ICVSUIConstants.IMG_LOCALREMOTE_MODE);
- createImageDescriptor(ICVSUIConstants.IMG_REMOTEMODE);
- createImageDescriptor(ICVSUIConstants.IMG_LOCALMODE_DISABLED);
- createImageDescriptor(ICVSUIConstants.IMG_LOCALREMOTE_MODE_DISABLED);
- createImageDescriptor(ICVSUIConstants.IMG_REMOTEMODE_DISABLED);
- createImageDescriptor(ICVSUIConstants.IMG_LOCALREVISION_TABLE);
- createImageDescriptor(ICVSUIConstants.IMG_REMOTEREVISION_TABLE);
- createImageDescriptor(ICVSUIConstants.IMG_COMPARE_VIEW);
-
- // special
- createImageDescriptor("glyphs/glyph1.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph2.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph3.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph4.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph5.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph6.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph7.gif"); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph8.gif"); //$NON-NLS-1$
- }
- /**
- * Convenience method for logging statuses to the plugin log
- *
- * @param status the status to log
- */
- public static void log(IStatus status) {
- getPlugin().getLog().log(status);
- }
-
- public static void log(CoreException e) {
- log(e.getStatus().getSeverity(), CVSUIMessages.simpleInternal, e);
- }
-
- /**
- * Log the given exception along with the provided message and severity indicator
- */
- public static void log(int severity, String message, Throwable e) {
- log(new Status(severity, ID, 0, message, e));
- }
-
- // flags to tailor error reporting
- public static final int PERFORM_SYNC_EXEC = 1;
- public static final int LOG_TEAM_EXCEPTIONS = 2;
- public static final int LOG_CORE_EXCEPTIONS = 4;
- public static final int LOG_OTHER_EXCEPTIONS = 8;
- public static final int LOG_NONTEAM_EXCEPTIONS = LOG_CORE_EXCEPTIONS | LOG_OTHER_EXCEPTIONS;
-
- /**
- * Convenience method for showing an error dialog
- * @param shell a valid shell or null
- * @param exception the exception to be report
- * @param title the title to be displayed
- * @return IStatus the status that was displayed to the user
- */
- public static IStatus openError(Shell shell, String title, String message, Throwable exception) {
- return openError(shell, title, message, exception, LOG_OTHER_EXCEPTIONS);
- }
-
- /**
- * Convenience method for showing an error dialog
- * @param shell a valid shell or null
- * @param exception the exception to be report
- * @param title the title to be displayed
- * @param flags customized attributes for the error handling
- * @return IStatus the status that was displayed to the user
- */
- public static IStatus openError(Shell providedShell, String title, String message, Throwable exception, int flags) {
- // Unwrap InvocationTargetExceptions
- if (exception instanceof InvocationTargetException) {
- Throwable target = ((InvocationTargetException)exception).getTargetException();
- // re-throw any runtime exceptions or errors so they can be handled by the workbench
- if (target instanceof RuntimeException) {
- throw (RuntimeException)target;
- }
- if (target instanceof Error) {
- throw (Error)target;
- }
- return openError(providedShell, title, message, target, flags);
- }
-
- // Determine the status to be displayed (and possibly logged)
- IStatus status = null;
- boolean log = false;
- if (exception instanceof CoreException) {
- status = ((CoreException)exception).getStatus();
- log = ((flags & LOG_CORE_EXCEPTIONS) > 0);
- } else if (exception instanceof TeamException) {
- status = ((TeamException)exception).getStatus();
- log = ((flags & LOG_TEAM_EXCEPTIONS) > 0);
- } else if (exception instanceof InterruptedException) {
- return new CVSStatus(IStatus.OK, CVSUIMessages.ok);
- } else if (exception != null) {
- status = new CVSStatus(IStatus.ERROR, CVSUIMessages.internal, exception);
- log = ((flags & LOG_OTHER_EXCEPTIONS) > 0);
- if (title == null) title = CVSUIMessages.internal;
- }
-
- // Check for a build error and report it differently
- if (status.getCode() == IResourceStatus.BUILD_FAILED) {
- message = CVSUIMessages.buildError;
- log = true;
- }
-
- // Check for multi-status with only one child
- if (status.isMultiStatus() && status.getChildren().length == 1) {
- status = status.getChildren()[0];
- }
- if (status.isOK()) return status;
-
- // Log if the user requested it
- if (log) CVSUIPlugin.log(status.getSeverity(), status.getMessage(), exception);
-
- // Create a runnable that will display the error status
- final String displayTitle = title;
- final String displayMessage = message;
- final IStatus displayStatus = status;
- final IOpenableInShell openable = new IOpenableInShell() {
- public void open(Shell shell) {
- if (displayStatus.getSeverity() == IStatus.INFO && !displayStatus.isMultiStatus()) {
- MessageDialog.openInformation(shell, CVSUIMessages.information, displayStatus.getMessage());
- } else {
- ErrorDialog.openError(shell, displayTitle, displayMessage, displayStatus);
- }
- }
- };
- openDialog(providedShell, openable, flags);
-
- // return the status we display
- return status;
- }
-
- /**
- * Interface that allows a shell to be passed to an open method. The
- * provided shell can be used without sync-execing, etc.
- */
- public interface IOpenableInShell {
- public void open(Shell shell);
- }
-
- /**
- * Open the dialog code provided in the IOpenableInShell, ensuring that
- * the provided shell is valid. This method will provide a shell to the
- * IOpenableInShell if one is not provided to the method.
- *
- * @param providedShell
- * @param openable
- * @param flags
- */
- public static void openDialog(Shell providedShell, final IOpenableInShell openable, int flags) {
- // If no shell was provided, try to get one from the active window
- if (providedShell == null) {
- IWorkbenchWindow window = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- providedShell = window.getShell();
- // sync-exec when we do this just in case
- flags = flags | PERFORM_SYNC_EXEC;
- }
- }
-
- // Create a runnable that will display the error status
- final Shell shell = providedShell;
- Runnable outerRunnable = new Runnable() {
- public void run() {
- Shell displayShell;
- if (shell == null) {
- Display display = Display.getCurrent();
- displayShell = new Shell(display);
- } else {
- displayShell = shell;
- }
- openable.open(displayShell);
- if (shell == null) {
- displayShell.dispose();
- }
- }
- };
-
- // Execute the above runnable as determined by the parameters
- if (shell == null || (flags & PERFORM_SYNC_EXEC) > 0) {
- Display display;
- if (shell == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- } else {
- display = shell.getDisplay();
- }
- display.syncExec(outerRunnable);
- } else {
- outerRunnable.run();
- }
- }
-
-
- /**
- * Initializes the preferences for this plugin if necessary.
- */
- protected void initializeDefaultPluginPreferences() {
- IPreferenceStore store = getPreferenceStore();
- // Get the plugin preferences for CVS Core
- Preferences corePrefs = CVSProviderPlugin.getPlugin().getPluginPreferences();
-
- store.setDefault(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, false);
- store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
- store.setDefault(ICVSUIConstants.PREF_WRAP_COMMENTS, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_SEARCH, false);
- store.setDefault(ICVSUIConstants.PREF_REVISION_MODE, 0);
- store.setDefault(ICVSUIConstants.PREF_GROUPBYDATE_MODE, true);
- store.setDefault(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING, false);
- store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE);
- store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT);
- store.setDefault(ICVSUIConstants.PREF_CONSIDER_CONTENTS, true);
- store.setDefault(ICVSUIConstants.PREF_COMPRESSION_LEVEL, CVSProviderPlugin.DEFAULT_COMPRESSION_LEVEL);
- store.setDefault(ICVSUIConstants.PREF_TEXT_KSUBST, CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION.toMode());
- store.setDefault(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND, true);
- store.setDefault(ICVSUIConstants.PREF_REPLACE_UNMANAGED, true);
- store.setDefault(ICVSUIConstants.PREF_CVS_RSH, CVSProviderPlugin.DEFAULT_CVS_RSH);
- store.setDefault(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, CVSProviderPlugin.DEFAULT_CVS_RSH_PARAMETERS);
- store.setDefault(ICVSUIConstants.PREF_CVS_SERVER, CVSProviderPlugin.DEFAULT_CVS_SERVER);
- store.setDefault(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, "ext"); //$NON-NLS-1$
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY, true);
- store.setDefault(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, true);
- store.setDefault(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, CVSProviderPlugin.DEFAULT_CONFIRM_MOVE_TAG);
- store.setDefault(ICVSUIConstants.PREF_DEBUG_PROTOCOL, false);
- store.setDefault(ICVSUIConstants.PREF_WARN_REMEMBERING_MERGES, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, false);
- store.setDefault(ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT, false);
- store.setDefault(ICVSUIConstants.PREF_AUTO_REFRESH_TAGS_IN_TAG_SELECTION_DIALOG, false);
- store.setDefault(ICVSUIConstants.PREF_AUTO_SHARE_ON_IMPORT, true);
- store.setDefault(ICVSUIConstants.PREF_ENABLE_WATCH_ON_EDIT, false);
- store.setDefault(ICVSUIConstants.PREF_USE_PROJECT_NAME_ON_CHECKOUT, false);
- store.setDefault(ICVSUIConstants.PREF_COMMIT_FILES_DISPLAY_THRESHOLD, 1000);
- store.setDefault(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY, RepositoryManager.DEFAULT_MAX_COMMENTS);
-
- PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR, new RGB(0, 0, 0));
- PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR, new RGB(0, 0, 255));
- PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR, new RGB(255, 0, 0));
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE, false);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT, true);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK, 500000);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_WRAP, false);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_WIDTH, 80);
-
- store.setDefault(ICVSUIConstants.PREF_FILETEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_FILETEXTFORMAT);
- store.setDefault(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_FOLDERTEXTFORMAT);
- store.setDefault(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_PROJECTTEXTFORMAT);
-
- store.setDefault(ICVSUIConstants.PREF_FIRST_STARTUP, true);
- store.setDefault(ICVSUIConstants.PREF_ADDED_FLAG, CVSDecoratorConfiguration.DEFAULT_ADDED_FLAG);
- store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
- store.setDefault(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, false);
- store.setDefault(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, true);
- store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
- store.setDefault(ICVSUIConstants.PREF_USE_FONT_DECORATORS, false);
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
- store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);
-
- store.setDefault(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY, MessageDialogWithToggle.PROMPT);
- store.setDefault(ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS, MessageDialogWithToggle.PROMPT);
- store.setDefault(ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT, MessageDialogWithToggle.NEVER);
- store.setDefault(ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS, MessageDialogWithToggle.ALWAYS);
- store.setDefault(ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS, MessageDialogWithToggle.PROMPT);
-
- store.setDefault(ICVSUIConstants.PREF_UPDATE_HANDLING, ICVSUIConstants.PREF_UPDATE_HANDLING_TRADITIONAL);
- store.setDefault(ICVSUIConstants.PREF_UPDATE_PREVIEW, ICVSUIConstants.PREF_UPDATE_PREVIEW_IN_SYNCVIEW);
-
- store.setDefault(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC, true);
- store.setDefault(ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE, true);
-
- // Set the watch/edit preferences defaults and values
- store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
- store.setDefault(ICVSUIConstants.PREF_EDIT_ACTION, ICVSUIConstants.PREF_EDIT_IN_BACKGROUND);
- store.setDefault(ICVSUIConstants.PREF_EDIT_PROMPT, ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS);
- store.setDefault(ICVSUIConstants.PREF_UPDATE_PROMPT, ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER);
- // Ensure that the preference values in UI match Core
- store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));
-
- // Forward the values to the CVS plugin
- CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
- CVSProviderPlugin.getPlugin().setTimeout(store.getInt(ICVSUIConstants.PREF_TIMEOUT));
- CVSProviderPlugin.getPlugin().setCvsRshCommand(store.getString(ICVSUIConstants.PREF_CVS_RSH));
- CVSProviderPlugin.getPlugin().setCvsRshParameters(store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS));
- CVSProviderPlugin.getPlugin().setCvsServer(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
- CVSRepositoryLocation.setExtConnectionMethodProxy(store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY));
- CVSProviderPlugin.getPlugin().setQuietness(CVSPreferencesPage.getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
- CVSProviderPlugin.getPlugin().setCompressionLevel(store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
- CVSProviderPlugin.getPlugin().setReplaceUnmanaged(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(KSubstOption.fromMode(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST)));
- CVSProviderPlugin.getPlugin().setUsePlatformLineend(store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
- CVSProviderPlugin.getPlugin().setRepositoriesAreBinary(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
- CVSProviderPlugin.getPlugin().setDetermineVersionEnabled(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION));
- CVSProviderPlugin.getPlugin().setDebugProtocol(CVSProviderPlugin.getPlugin().isDebugProtocol() || store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
- CVSProviderPlugin.getPlugin().setAutoshareOnImport(store.getBoolean(ICVSUIConstants.PREF_AUTO_SHARE_ON_IMPORT));
-
- // code to transfer CVS preference to Team preference
- if (store.getBoolean(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR)) {
- store.setValue(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR, false);
- IPreferenceStore teamStore = TeamUIPlugin.getPlugin().getPreferenceStore();
- if (teamStore.isDefault(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR))
- teamStore.setValue(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR, true);
- }
- }
-
- /**
- * @see Plugin#start(BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- initializeImages();
-
- CVSAdapterFactory factory = new CVSAdapterFactory();
- Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFile.class);
- Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFolder.class);
- Platform.getAdapterManager().registerAdapters(factory, ICVSRepositoryLocation.class);
- Platform.getAdapterManager().registerAdapters(factory, RepositoryRoot.class);
-
- try {
- console = new CVSOutputConsole();
- } catch (RuntimeException e) {
- // Don't let the console bring down the CVS UI
- log(IStatus.ERROR, "Errors occurred starting the CVS console", e); //$NON-NLS-1$
- }
-
- IPreferenceStore store = getPreferenceStore();
- if (store.getBoolean(ICVSUIConstants.PREF_FIRST_STARTUP)) {
- // If we enable the decorator in the XML, the CVS plugin will be loaded
- // on startup even if the user never uses CVS. Therefore, we enable the
- // decorator on the first start of the CVS plugin since this indicates that
- // the user has done something with CVS. Subsequent startups will load
- // the CVS plugin unless the user disables the decorator. In this case,
- // we will not re-enable since we only enable automatically on the first startup.
- PlatformUI.getWorkbench().getDecoratorManager().setEnabled(CVSLightweightDecorator.ID, true);
- store.setValue(ICVSUIConstants.PREF_FIRST_STARTUP, false);
- }
-
- }
-
- /**
- * @see Plugin#stop(BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- try {
- try {
- if (repositoryManager != null)
- repositoryManager.shutdown();
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
-
- if (console != null)
- console.shutdown();
- } finally {
- super.stop(context);
- }
- }
-
- /**
- * @return the CVS console
- */
- public CVSOutputConsole getConsole() {
- return console;
- }
-
- public IEditorPart openEditor(ICVSRemoteFile file, IProgressMonitor monitor) throws InvocationTargetException {
- IWorkbench workbench = getWorkbench();
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- try {
- return Utils.openEditor(page, (IFileRevision)file.getAdapter(IFileRevision.class), monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /**
- * Helper method which access the preference store to determine if the
- * project name from the project description file (.project) should be used
- * as the project name on checkout.
- */
- public boolean isUseProjectNameOnCheckout() {
- return getPreferenceStore().getBoolean(ICVSUIConstants.PREF_USE_PROJECT_NAME_ON_CHECKOUT);
- }
-
- public ActiveChangeSetManager getChangeSetManager() {
- return CVSProviderPlugin.getPlugin().getChangeSetManager();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java
deleted file mode 100644
index 87fb26e4e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.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;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * A simple input dialog for soliciting an input string from the user.
- * <p>
- * This concrete dialog class can be instantiated as is, or further subclassed as
- * required.
- * </p>
- */
-public class CommentTemplateEditDialog extends Dialog {
- /**
- * The title of the dialog.
- */
- private String title;
-
- /**
- * The message to display, or <code>null</code> if none.
- */
- private String message;
-
- /**
- * The input value; the empty string by default.
- */
- private String value = "";//$NON-NLS-1$
-
- /**
- * The input validator, or <code>null</code> if none.
- */
- private IInputValidator validator;
-
- /**
- * Ok button widget.
- */
- private Button okButton;
-
- /**
- * Input text widget.
- */
- private Text text;
-
- /**
- * Error message label widget.
- */
- private Text errorMessageText;
-
- /**
- * Creates an input dialog with OK and Cancel buttons. Note that the dialog
- * will have no visual representation (no widgets) until it is told to open.
- * <p>
- * Note that the <code>open</code> method blocks for input dialogs.
- * </p>
- *
- * @param parentShell
- * the parent shell, or <code>null</code> to create a top-level
- * shell
- * @param dialogTitle
- * the dialog title, or <code>null</code> if none
- * @param dialogMessage
- * the dialog message, or <code>null</code> if none
- * @param initialValue
- * the initial input value, or <code>null</code> if none
- * (equivalent to the empty string)
- * @param validator
- * an input validator, or <code>null</code> if none
- */
- public CommentTemplateEditDialog(Shell parentShell, String dialogTitle,
- String dialogMessage, String initialValue, IInputValidator validator) {
- super(parentShell);
- this.title = dialogTitle;
- message = dialogMessage;
- if (initialValue == null)
- value = "";//$NON-NLS-1$
- else
- value = initialValue;
- this.validator = validator;
- }
-
- /*
- * (non-Javadoc) Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- value = text.getText();
- } else {
- value = null;
- }
- super.buttonPressed(buttonId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null)
- shell.setText(title);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
- //do this here because setting the text will set enablement on the ok
- // button
- text.setFocus();
- if (value != null) {
- text.setText(value);
- text.selectAll();
- }
- }
-
- /*
- * (non-Javadoc) Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = (Composite) super.createDialogArea(parent);
- // create message
- if (message != null) {
- Label label = new Label(composite, SWT.WRAP);
- 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(parent.getFont());
- }
- text = new Text(composite, SWT.MULTI | SWT.BORDER);
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL);
- gd.heightHint = convertHeightInCharsToPixels(5);
- text.setLayoutData(gd);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- });
- errorMessageText = new Text(composite, SWT.READ_ONLY);
- errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageText.setBackground(errorMessageText.getDisplay()
- .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
-
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- * Returns the error message label.
- *
- * @return the error message label
- * @deprecated use setErrorMessage(String) instead
- */
- protected Label getErrorMessageLabel() {
- return null;
- }
-
- /**
- * Returns the ok button.
- *
- * @return the ok button
- */
- protected Button getOkButton() {
- return okButton;
- }
-
- /**
- * Returns the text area.
- *
- * @return the text area
- */
- protected Text getText() {
- return text;
- }
-
- /**
- * Returns the validator.
- *
- * @return the validator
- */
- protected IInputValidator getValidator() {
- return validator;
- }
-
- /**
- * Returns the string typed into this input dialog.
- *
- * @return the input string
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Validates the input.
- * <p>
- * The default implementation of this framework method delegates the request
- * to the supplied input validator object; if it finds the input invalid,
- * the error message is displayed in the dialog's message line. This hook
- * method is called whenever the text changes in the input field.
- * </p>
- */
- protected void validateInput() {
- String errorMessage = null;
- if (validator != null) {
- errorMessage = validator.isValid(text.getText());
- }
- // Bug 16256: important not to treat "" (blank error) the same as null
- // (no error)
- setErrorMessage(errorMessage);
- }
-
- /**
- * Sets or clears the error message.
- * If not <code>null</code>, the OK button is disabled.
- *
- * @param errorMessage
- * the error message, or <code>null</code> to clear
- * @since 3.0
- */
- public void setErrorMessage(String errorMessage) {
- errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
- okButton.setEnabled(errorMessage == null);
- errorMessageText.getParent().update();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
deleted file mode 100644
index 1620ac20d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 Maik Schreiber.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Maik Schreiber - initial API and implementation
- * IBM - Bug 158656 Unlabeled list when empty
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.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.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.ui.*;
-
-public class CommentTemplatesPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage, ISelectionChangedListener {
-
- private ListViewer viewer;
- private Button editButton;
- private Button removeButton;
- private Text preview;
-
- protected Control createContents(Composite ancestor) {
- Composite parent = new Composite(ancestor, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createListAndButtons(parent);
-
- Label previewLabel = new Label(parent, SWT.NONE);
- previewLabel.setText(CVSUIMessages.CommentTemplatesPreferencePage_Preview);
-
- preview = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = convertHeightInCharsToPixels(5);
- preview.setLayoutData(gd);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.COMMENT_TEMPLATE_PREFERENCE_PAGE);
- Dialog.applyDialogFont(ancestor);
-
- return parent;
- }
-
- private Composite createListAndButtons(Composite parent) {
- Composite listAndButtons = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- listAndButtons.setLayout(layout);
- listAndButtons.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label viewerLabel = new Label(listAndButtons, SWT.NONE);
- viewerLabel.setText(CVSUIMessages.CommentTemplatesPreferencePage_Description);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- viewerLabel.setLayoutData(data);
-
- viewer = new ListViewer(listAndButtons);
- viewer.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- String template = (String) element;
- return Util.flattenText(template);
- }
- });
- viewer.addSelectionChangedListener(this);
- viewer.setComparator(new ViewerComparator() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- String template1 = Util.flattenText((String) e1);
- String template2 = Util.flattenText((String) e2);
- return template1.compareToIgnoreCase(template2);
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- editTemplate();
- }
- });
- List list = viewer.getList();
- list.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // populate list
- String[] templates =
- CVSUIPlugin.getPlugin().getRepositoryManager().getCommentTemplates();
- for (int i = 0; i < templates.length; i++) {
- viewer.add(templates[i]);
- }
-
- createButtons(listAndButtons);
- return listAndButtons;
- }
-
- private void createButtons(Composite parent) {
- Composite buttons = new Composite(parent, SWT.NONE);
- buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
-
- Button newButton = new Button(buttons, SWT.PUSH);
- newButton.setText(CVSUIMessages.CommentTemplatesPreferencePage_New);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint,
- newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- newButton.setLayoutData(data);
- newButton.setEnabled(true);
- newButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- newTemplate();
- }
- });
-
- editButton = new Button(buttons, SWT.PUSH);
- editButton.setText(CVSUIMessages.CommentTemplatesPreferencePage_Edit);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint,
- editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- editButton.setLayoutData(data);
- editButton.setEnabled(false);
- editButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- editTemplate();
- }
- });
-
- removeButton = new Button(buttons, SWT.PUSH);
- removeButton.setText(CVSUIMessages.CommentTemplatesPreferencePage_Remove);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint,
- removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeButton.setLayoutData(data);
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- remove();
- }
- });
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- switch (selection.size()) {
- case 0:
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
- preview.setText(""); //$NON-NLS-1$
- break;
-
- case 1:
- editButton.setEnabled(true);
- removeButton.setEnabled(true);
- preview.setText((String) selection.getFirstElement());
- break;
-
- default:
- editButton.setEnabled(false);
- removeButton.setEnabled(true);
- preview.setText(""); //$NON-NLS-1$
- break;
- }
- }
-
- void newTemplate() {
- CommentTemplateEditDialog dialog = new CommentTemplateEditDialog(
- getShell(),
- CVSUIMessages.CommentTemplatesPreferencePage_EditCommentTemplateTitle,
- CVSUIMessages.CommentTemplatesPreferencePage_EditCommentTemplateMessage,
- "", null); //$NON-NLS-1$
- if (dialog.open() == Window.OK) {
- viewer.add(dialog.getValue());
- }
- }
-
- void editTemplate() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.size() == 1) {
- String oldTemplate = (String) selection.getFirstElement();
- CommentTemplateEditDialog dialog = new CommentTemplateEditDialog(
- getShell(),
- CVSUIMessages.CommentTemplatesPreferencePage_EditCommentTemplateTitle,
- CVSUIMessages.CommentTemplatesPreferencePage_EditCommentTemplateMessage,
- oldTemplate, null);
- if (dialog.open() == Window.OK) {
- viewer.remove(oldTemplate);
- viewer.add(dialog.getValue());
- }
- }
- }
-
- void remove() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- viewer.remove(selection.toArray());
- }
-
- public boolean performOk() {
- int numTemplates = viewer.getList().getItemCount();
- String[] templates = new String[numTemplates];
- for (int i = 0; i < numTemplates; i++) {
- templates[i] = (String) viewer.getElementAt(i);
- }
- try {
- CVSUIPlugin.getPlugin().getRepositoryManager()
- .replaceAndSaveCommentTemplates(templates);
- } catch (TeamException e) {
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.LOG_OTHER_EXCEPTIONS);
- }
-
- return super.performOk();
- }
-
- public void init(IWorkbench workbench) {
- // Nothing to do
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
deleted file mode 100644
index 76a6ebe9a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
+++ /dev/null
@@ -1,634 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids - bug 57208
- * Maik Schreiber - bug 102461
- * Eugene Kuleshov (eu@md.pp.ru) - Bug 112742 [Wizards] Add spell check to commit dialog
- * Brock Janiczak <brockj@tpg.com.au> - Bug 179183 Use spelling support from JFace in CVS commit dialog
- * Brock Janiczak <brockj@tpg.com.au> - Bug 77944 [Change Sets] Comment dialog: Use comment as title
- * Brock Janiczak <brockj@tpg.com.au> - Bug 194992 [Wizards] Display quick assists on context menu of commit dialog
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.commands.ActionHandler;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.source.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.ActiveShellExpression;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.texteditor.*;
-
-
-/**
- * This area provides the widgets for providing the CVS commit comment
- */
-public class CommitCommentArea extends DialogArea {
-
- private class TextBox implements ModifyListener, TraverseListener, FocusListener, Observer {
-
- private final StyledText fTextField; // updated only by modify events
- private final String fMessage;
-
- private String fText;
-
- public TextBox(Composite composite, String message, String initialText) {
-
- fMessage= message;
- fText= initialText;
-
- AnnotationModel annotationModel = new AnnotationModel();
- IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
-
- Composite cc = new Composite(composite, SWT.BORDER);
- cc.setLayout(new FillLayout());
- cc.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- final SourceViewer sourceViewer = new SourceViewer(cc, null, null, true, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
- fTextField = sourceViewer.getTextWidget();
- fTextField.setIndent(2);
-
- final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(sourceViewer, null, annotationAccess, EditorsUI.getSharedTextColors());
-
- Iterator e= new MarkerAnnotationPreferences().getAnnotationPreferences().iterator();
- while (e.hasNext())
- support.setAnnotationPreference((AnnotationPreference) e.next());
-
- support.install(EditorsUI.getPreferenceStore());
-
- final IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- final IHandlerActivation handlerActivation= installQuickFixActionHandler(handlerService, sourceViewer);
-
- final TextViewerAction cutAction = new TextViewerAction(sourceViewer, ITextOperationTarget.CUT);
- cutAction.setText(CVSUIMessages.CommitCommentArea_7);
- cutAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
-
- final TextViewerAction copyAction = new TextViewerAction(sourceViewer, ITextOperationTarget.COPY);
- copyAction.setText(CVSUIMessages.CommitCommentArea_8);
- copyAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
-
- final TextViewerAction pasteAction = new TextViewerAction(sourceViewer, ITextOperationTarget.PASTE);
- pasteAction.setText(CVSUIMessages.CommitCommentArea_9);
- pasteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
-
- final TextViewerAction selectAllAction = new TextViewerAction(sourceViewer, ITextOperationTarget.SELECT_ALL);
- selectAllAction.setText(CVSUIMessages.CommitCommentArea_10);
- selectAllAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
-
- MenuManager contextMenu = new MenuManager();
- contextMenu.add(cutAction);
- contextMenu.add(copyAction);
- contextMenu.add(pasteAction);
- contextMenu.add(selectAllAction);
- contextMenu.add(new Separator());
-
- final SubMenuManager quickFixMenu = new SubMenuManager(contextMenu);
- quickFixMenu.setVisible(true);
- quickFixMenu.addMenuListener(new IMenuListener() {
-
- public void menuAboutToShow(IMenuManager manager) {
- quickFixMenu.removeAll();
-
- IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
- Iterator annotationIterator = annotationModel.getAnnotationIterator();
- while (annotationIterator.hasNext()) {
- Annotation annotation = (Annotation) annotationIterator.next();
- if (!annotation.isMarkedDeleted() && includes(annotationModel.getPosition(annotation), sourceViewer.getTextWidget().getCaretOffset()) && sourceViewer.getQuickAssistAssistant().canFix(annotation)) {
- ICompletionProposal[] computeQuickAssistProposals = sourceViewer.getQuickAssistAssistant().getQuickAssistProcessor().computeQuickAssistProposals(sourceViewer.getQuickAssistInvocationContext());
- for (int i = 0; i < computeQuickAssistProposals.length; i++) {
- final ICompletionProposal proposal = computeQuickAssistProposals[i];
- quickFixMenu.add(new Action(proposal.getDisplayString()) {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- proposal.apply(sourceViewer.getDocument());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- if (proposal.getImage() != null) {
- return ImageDescriptor.createFromImage(proposal.getImage());
- }
- return null;
- }
- });
- }
- }
- }
- }
-
- });
-
- fTextField.addFocusListener(new FocusListener() {
-
- private IHandlerActivation cutHandlerActivation;
- private IHandlerActivation copyHandlerActivation;
- private IHandlerActivation pasteHandlerActivation;
- private IHandlerActivation selectAllHandlerActivation;
-
- public void focusGained(FocusEvent e) {
- cutAction.update();
- copyAction.update();
- IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
- this.cutHandlerActivation = service.activateHandler(IWorkbenchActionDefinitionIds.CUT, new ActionHandler(cutAction), new ActiveShellExpression(getComposite().getShell()));
- this.copyHandlerActivation = service.activateHandler(IWorkbenchActionDefinitionIds.COPY, new ActionHandler(copyAction), new ActiveShellExpression(getComposite().getShell()));
- this.pasteHandlerActivation = service.activateHandler(IWorkbenchActionDefinitionIds.PASTE, new ActionHandler(pasteAction), new ActiveShellExpression(getComposite().getShell()));
- this.selectAllHandlerActivation = service.activateHandler(IWorkbenchActionDefinitionIds.SELECT_ALL, new ActionHandler(selectAllAction), new ActiveShellExpression(getComposite().getShell()));
-
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
-
- if (cutHandlerActivation != null) {
- service.deactivateHandler(cutHandlerActivation);
- }
-
- if (copyHandlerActivation != null) {
- service.deactivateHandler(copyHandlerActivation);
- }
-
- if (pasteHandlerActivation != null) {
- service.deactivateHandler(pasteHandlerActivation);
- }
-
- if (selectAllHandlerActivation != null) {
- service.deactivateHandler(selectAllHandlerActivation);
- }
- }
-
- });
-
- fTextField.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- cutAction.update();
- copyAction.update();
- }
-
- });
-
- sourceViewer.getTextWidget().addDisposeListener(new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent e) {
- support.uninstall();
- handlerService.deactivateHandler(handlerActivation);
- }
-
- });
-
- Document document = new Document(initialText);
-
- // NOTE: Configuration must be applied before the document is set in order for
- // Hyperlink coloring to work. (Presenter needs document object up front)
- sourceViewer.configure(new TextSourceViewerConfiguration(EditorsUI.getPreferenceStore()));
- sourceViewer.setDocument(document, annotationModel);
-
- fTextField.addTraverseListener(this);
- fTextField.addModifyListener(this);
- fTextField.addFocusListener(this);
-
- fTextField.setMenu(contextMenu.createContextMenu(fTextField));
-
- }
-
- protected boolean includes(Position position, int caretOffset) {
- return position.includes(caretOffset) || (position.offset + position.length) == caretOffset;
- }
-
- /**
- * Installs the quick fix action handler
- * and returns the handler activation.
- *
- * @param handlerService the handler service
- * @param sourceViewer the source viewer
- * @return the handler activation
- * @since 3.4
- */
- private IHandlerActivation installQuickFixActionHandler(IHandlerService handlerService, SourceViewer sourceViewer) {
- return handlerService.activateHandler(
- ITextEditorActionDefinitionIds.QUICK_ASSIST,
- createQuickFixActionHandler(sourceViewer),
- new ActiveShellExpression(sourceViewer.getTextWidget().getShell()));
- }
-
- /**
- * Creates and returns a quick fix action handler.
- *
- * @param textOperationTarget the target for text operations
- * @since 3.4
- */
- private ActionHandler createQuickFixActionHandler(final ITextOperationTarget textOperationTarget) {
- Action quickFixAction= new Action() {
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- textOperationTarget.doOperation(ISourceViewer.QUICK_ASSIST);
- }
- };
- quickFixAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
- return new ActionHandler(quickFixAction);
- }
-
- public void modifyText(ModifyEvent e) {
- final String old = fText;
- fText = fTextField.getText();
- firePropertyChangeChange(COMMENT_MODIFIED, old, fText);
- }
-
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) != 0) {
- e.doit = false;
- firePropertyChangeChange(OK_REQUESTED, null, null);
- }
- }
-
- public void focusGained(FocusEvent e) {
-
- if (fText.length() > 0)
- return;
-
- fTextField.removeModifyListener(this);
- try {
- fTextField.setText(fText);
- } finally {
- fTextField.addModifyListener(this);
- }
- }
-
- public void focusLost(FocusEvent e) {
-
- if (fText.length() > 0)
- return;
-
- fTextField.removeModifyListener(this);
- try {
- fTextField.setText(fMessage);
- fTextField.selectAll();
- } finally {
- fTextField.addModifyListener(this);
- }
- }
-
- public void setEnabled(boolean enabled) {
- fTextField.setEnabled(enabled);
- }
-
- public void update(Observable o, Object arg) {
- if (arg instanceof String) {
- setText((String)arg); // triggers a modify event
- }
- }
-
- public String getText() {
- return fText;
- }
-
- private void setText(String text) {
- if (text.length() == 0) {
- fTextField.setText(fMessage);
- fTextField.selectAll();
- } else
- fTextField.setText(text);
- }
-
- public void setFocus() {
- fTextField.setFocus();
- }
- }
-
- private static class ComboBox extends Observable implements SelectionListener, FocusListener {
-
- private final String fMessage;
- private final String [] fComments;
- private String[] fCommentTemplates;
- private final Combo fCombo;
-
-
- public ComboBox(Composite composite, String message, String [] options,
- String[] commentTemplates) {
-
- fMessage= message;
- fComments= options;
- fCommentTemplates = commentTemplates;
-
- fCombo = new Combo(composite, SWT.READ_ONLY);
- fCombo.setLayoutData(SWTUtils.createHFillGridData());
- fCombo.setVisibleItemCount(20);
-
- // populate the previous comment list
- populateList();
-
- // We don't want to have an initial selection
- // (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078)
- fCombo.addFocusListener(this);
- fCombo.addSelectionListener(this);
- }
-
- private void populateList() {
- fCombo.removeAll();
-
- fCombo.add(fMessage);
- for (int i = 0; i < fCommentTemplates.length; i++) {
- fCombo.add(CVSUIMessages.CommitCommentArea_6 + ": " + //$NON-NLS-1$
- Util.flattenText(fCommentTemplates[i]));
- }
- for (int i = 0; i < fComments.length; i++) {
- fCombo.add(Util.flattenText(fComments[i]));
- }
- fCombo.setText(fMessage);
- }
-
- public void widgetSelected(SelectionEvent e) {
- int index = fCombo.getSelectionIndex();
- if (index > 0) {
- index--;
- setChanged();
-
- // map from combo box index to array index
- String message;
- if (index < fCommentTemplates.length) {
- message = fCommentTemplates[index];
- } else {
- message = fComments[index - fCommentTemplates.length];
- }
- notifyObservers(message);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void focusGained(FocusEvent e) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- fCombo.removeSelectionListener(this);
- try {
- fCombo.setText(fMessage);
- } finally {
- fCombo.addSelectionListener(this);
- }
- }
-
- public void setEnabled(boolean enabled) {
- fCombo.setEnabled(enabled);
- }
-
- void setCommentTemplates(String[] templates) {
- fCommentTemplates = templates;
- populateList();
- }
- }
-
- private static final String EMPTY_MESSAGE= CVSUIMessages.CommitCommentArea_0;
- private static final String COMBO_MESSAGE= CVSUIMessages.CommitCommentArea_1;
- private static final String CONFIGURE_TEMPLATES_MESSAGE= CVSUIMessages.CommitCommentArea_5;
-
- public static final String OK_REQUESTED = "OkRequested";//$NON-NLS-1$
- public static final String COMMENT_MODIFIED = "CommentModified";//$NON-NLS-1$
-
- private TextBox fTextBox;
- private ComboBox fComboBox;
-
- private IProject fMainProject;
- private String fProposedComment;
- private Composite fComposite;
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- Dialog.applyDialogFont(parent);
- initializeDialogUnits(parent);
-
- fComposite = createGrabbingComposite(parent, 1);
- initializeDialogUnits(fComposite);
-
- fTextBox= new TextBox(fComposite, EMPTY_MESSAGE, getInitialComment());
-
- final String [] comments = CVSUIPlugin.getPlugin().getRepositoryManager().getPreviousComments();
- final String[] commentTemplates = CVSUIPlugin.getPlugin().getRepositoryManager().getCommentTemplates();
- fComboBox= new ComboBox(fComposite, COMBO_MESSAGE, comments, commentTemplates);
-
- Link templatesPrefsLink = new Link(fComposite, 0);
- templatesPrefsLink.setText("<a href=\"configureTemplates\">" + //$NON-NLS-1$
- CONFIGURE_TEMPLATES_MESSAGE + "</a>"); //$NON-NLS-1$
- templatesPrefsLink.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- openCommentTemplatesPreferencePage();
- }
-
- public void widgetSelected(SelectionEvent e) {
- openCommentTemplatesPreferencePage();
- }
- });
-
- fComboBox.addObserver(fTextBox);
- }
-
- void openCommentTemplatesPreferencePage() {
- PreferencesUtil.createPreferenceDialogOn(
- null,
- "org.eclipse.team.cvs.ui.CommentTemplatesPreferences", //$NON-NLS-1$
- new String[] { "org.eclipse.team.cvs.ui.CommentTemplatesPreferences" }, //$NON-NLS-1$
- null).open();
- fComboBox.setCommentTemplates(
- CVSUIPlugin.getPlugin().getRepositoryManager().getCommentTemplates());
- }
-
- public String getComment(boolean save) {
- final String comment= fTextBox.getText();
- if (comment == null)
- return ""; //$NON-NLS-1$
-
- final String stripped= strip(comment);
- if (save && comment.length() > 0)
- CVSUIPlugin.getPlugin().getRepositoryManager().addComment(comment);
-
- return stripped;
- }
-
- /**
- * Calculates a shortened form of the commit message for use as a commit set
- * title
- * @return The first line or sentence of the commit message. The commit template
- * text will be removed, as will leading and trailing whitespace.
- */
- public String getFirstLineOfComment() {
- String comment= fTextBox.getText();
- if (comment == null) {
- comment= ""; //$NON-NLS-1$
- }
-
- comment= strip(comment);
-
-
- int cr= comment.indexOf('\r');
- if (cr != -1) {
- comment= comment.substring(0, cr);
- }
-
- int lf= comment.indexOf('\n');
- if (lf != -1) {
- comment= comment.substring(0, lf);
- }
-
- int dot= comment.indexOf('.');
- if (dot != -1) {
- comment= comment.substring(0, dot);
- }
-
- comment= comment.trim();
-
- return comment;
- }
-
- public String getCommentWithPrompt(Shell shell) {
- final String comment= getComment(false);
- if (comment.length() == 0) {
- final IPreferenceStore store= CVSUIPlugin.getPlugin().getPreferenceStore();
- final String value= store.getString(ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS);
-
- if (MessageDialogWithToggle.NEVER.equals(value))
- return null;
-
- if (MessageDialogWithToggle.PROMPT.equals(value)) {
-
- final String title= CVSUIMessages.CommitCommentArea_2;
- final String message= CVSUIMessages.CommitCommentArea_3;
- final String toggleMessage= CVSUIMessages.CommitCommentArea_4;
-
- final MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(shell, title, message, toggleMessage, false, store, ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS);
- if (dialog.getReturnCode() != IDialogConstants.YES_ID) {
- fTextBox.setFocus();
- return null;
- }
- }
- }
- return getComment(true);
- }
-
-
- public void setProject(IProject iProject) {
- this.fMainProject = iProject;
- }
-
- public void setFocus() {
- if (fTextBox != null) {
- fTextBox.setFocus();
- }
- }
-
- public void setProposedComment(String proposedComment) {
- if (proposedComment == null || proposedComment.length() == 0) {
- this.fProposedComment = null;
- } else {
- this.fProposedComment = proposedComment;
- }
- }
-
- public boolean hasCommitTemplate() {
- try {
- String commitTemplate = getCommitTemplate();
- return commitTemplate != null && commitTemplate.length() > 0;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return false;
- }
- }
-
- public void setEnabled(boolean enabled) {
- fTextBox.setEnabled(enabled);
- fComboBox.setEnabled(enabled);
- }
-
- public Composite getComposite() {
- return fComposite;
- }
-
- protected void firePropertyChangeChange(String property, Object oldValue, Object newValue) {
- super.firePropertyChangeChange(property, oldValue, newValue);
- }
-
- private String getInitialComment() {
- if (fProposedComment != null)
- return fProposedComment;
- try {
- return getCommitTemplate();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return ""; //$NON-NLS-1$
- }
- }
-
- private String strip(String comment) {
- // strip template from the comment entered
- try {
- final String commitTemplate = getCommitTemplate();
- if (comment.startsWith(commitTemplate)) {
- return comment.substring(commitTemplate.length());
- } else if (comment.endsWith(commitTemplate)) {
- return comment.substring(0, comment.length() - commitTemplate.length());
- }
- } catch (CVSException e) {
- // we couldn't get the commit template. Log the error and continue
- CVSUIPlugin.log(e);
- }
- return comment;
- }
-
- private CVSTeamProvider getProvider() {
- if (fMainProject == null) return null;
- return (CVSTeamProvider) RepositoryProvider.getProvider(fMainProject, CVSProviderPlugin.getTypeId());
- }
-
- private String getCommitTemplate() throws CVSException {
- CVSTeamProvider provider = getProvider();
- if (provider == null)
- return ""; //$NON-NLS-1$
- final String template = provider.getCommitTemplate();
- return template != null ? template : ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java
deleted file mode 100644
index d704fbf82..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.IPreferencePageContainer;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-
-/**
- * Preference page for configuring CVS comparisons
- */
-public class ComparePreferencePage extends CVSFieldEditorPreferencePage {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageHelpContextId()
- */
- protected String getPageHelpContextId() {
- return IHelpContextIds.COMPARE_PREFERENCE_PAGE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription()
- */
- protected String getPageDescription() {
- return CVSUIMessages.ComparePreferencePage_0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_CONSIDER_CONTENTS,
- CVSUIMessages.ComparePreferencePage_4,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()) {
- protected Button getChangeControl(Composite parent) {
- Button button = super.getChangeControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(button, IHelpContextIds.PREF_CONSIDER_CONTENT);
- return button;
- }
- });
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG,
- CVSUIMessages.ComparePreferencePage_3,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT,
- CVSUIMessages.ComparePreferencePage_2,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_ENABLE_MODEL_SYNC,
- CVSUIMessages.ComparePreferencePage_7,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE,
- CVSUIMessages.ComparePreferencePage_8,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
-
- IPreferencePageContainer container = getContainer();
- if (container instanceof IWorkbenchPreferenceContainer) {
- IWorkbenchPreferenceContainer workbenchContainer = (IWorkbenchPreferenceContainer) container;
- SWTUtils.createPreferenceLink(workbenchContainer, getFieldEditorParent(),
- CompareUI.PREFERENCE_PAGE_ID, CVSUIMessages.ComparePreferencePage_6); //
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences()
- */
- protected void pushPreferences() {
- super.pushPreferences();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java
deleted file mode 100644
index d6914f0df..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Map;
-import java.util.Properties;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.wizards.AlternativeLocationWizard;
-import org.eclipse.ui.PlatformUI;
-
-public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
-
- private Image dlgTitleImage;
- private ConfigureRepositoryLocationsTable fConfigureRepositoryLocationsTable;
-
- /**
- * Creates a new AlternativeRepositoryDialog.
- *
- * @param parentShell
- * the parent shell
- * @param alternativesMap
- * Map with a repository location (ICVSRepositoryLocation) from
- * the Team Project Set as a key and list of alternatives found
- * (also ICVSRepositoryLocation) as a value.
- * @param message
- * a message to display to the user
- */
- public ConfigureRepositoryLocationsDialog(Shell parentShell, Map alternativesMap) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- fConfigureRepositoryLocationsTable = new ConfigureRepositoryLocationsTable(
- alternativesMap);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.TitleAreaDialog#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Control contents = super.createContents(parent);
- setTitle(CVSUIMessages.ConfigureRepositoryLocationsWizard_title);
- setMessage(CVSUIMessages.ConfigureRepositoryLocationsWizard_message);
- dlgTitleImage = CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION).createImage();
- setTitleImage(dlgTitleImage);
- return contents;
- }
-
- public boolean close() {
- if (dlgTitleImage != null) {
- dlgTitleImage.dispose();
- }
- return super.close();
- }
-
- /*
- * (non-Javadoc) Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_title);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IHelpContextIds.ALTERNATIVE_REPOSITORY_DIALOG);
- }
-
- /**
- * @see Dialog#createDialogArea
- */
- protected Control createDialogArea(Composite parent) {
- initializeDialogUnits(parent);
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
-
- GridData childData = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(childData);
-
- Composite table = fConfigureRepositoryLocationsTable.createControl(composite);
- GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- table.setLayoutData(gridData);
-
- final Button showMethodButton = new Button(composite, SWT.CHECK);
- showMethodButton
- .setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_showConnection);
- showMethodButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- fConfigureRepositoryLocationsTable
- .setShowConnectionMethod(showMethodButton
- .getSelection());
- }
- });
- showMethodButton.setEnabled(fConfigureRepositoryLocationsTable
- .noDuplicateRepositoryLocationFound());
- showMethodButton.setSelection(!fConfigureRepositoryLocationsTable
- .noDuplicateRepositoryLocationFound());
- showMethodButton.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- final Button createLocationButton = new Button(composite, SWT.PUSH);
- createLocationButton
- .setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_createLocation);
- createLocationButton
- .setToolTipText(CVSUIMessages.ConfigureRepositoryLocationsWizard_createLocationTooltip);
- createLocationButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
-
- CVSRepositoryLocation selectedAlternativeRepository = fConfigureRepositoryLocationsTable
- .getSelectedAlternativeRepository();
-
- Properties properties = new Properties();
- properties
- .put(
- "connection", selectedAlternativeRepository.getMethod().getName()); //$NON-NLS-1$
- properties.put(
- "user", selectedAlternativeRepository.getUsername()); //$NON-NLS-1$
- // TODO: retrieve password (if available) and use it to prime
- // the field
- // properties.put("password", ""); //$NON-NLS-1$
- properties.put("host", selectedAlternativeRepository.getHost()); //$NON-NLS-1$
- int port = selectedAlternativeRepository.getPort();
- if (port != ICVSRepositoryLocation.USE_DEFAULT_PORT)
- properties.put("port", String.valueOf(port)); //$NON-NLS-1$
- properties
- .put(
- "root", selectedAlternativeRepository.getRootDirectory()); //$NON-NLS-1$
-
- AlternativeLocationWizard wizard = new AlternativeLocationWizard(
- properties);
- wizard.setSwitchPerspectives(false);
- WizardDialog dialog = new ConfigureRepositoryLocationsWizardDialog(
- getShell(), wizard);
- dialog.open();
-
- ICVSRepositoryLocation location = wizard.getLocation();
- if (location != null)
- fConfigureRepositoryLocationsTable
- .addAlternativeRepositoryToSelection(location);
- }
- });
- createLocationButton.setEnabled(fConfigureRepositoryLocationsTable
- .getSelection().getFirstElement() != null);
- createLocationButton.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_END));
-
- fConfigureRepositoryLocationsTable.getViewer().addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event
- .getSelection();
- Object firstElement = sel.getFirstElement();
- createLocationButton.setEnabled(firstElement != null);
- }
- });
-
- return composite;
- }
-
- public Map getSelected() {
- return fConfigureRepositoryLocationsTable.getSelected();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
- */
- protected IDialogSettings getDialogBoundsSettings() {
- String sectionName = getClass().getName() + "_dialogBounds"; //$NON-NLS-1$
- IDialogSettings settings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = settings.getSection(sectionName);
- if (section == null) {
- section = settings.addNewSection(sectionName);
- section.put("DIALOG_HEIGHT", 300); //$NON-NLS-1$
- section.put("DIALOG_WIDTH", 600); //$NON-NLS-1$
- }
- return section;
- }
-
- /*
- * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsStrategy()
- * @since 3.2
- */
- protected int getDialogBoundsStrategy() {
- return DIALOG_PERSISTLOCATION | DIALOG_PERSISTSIZE;
- }
-
- /**
- * This class is made only to change Wizard's default "Finish" button label
- * to "Create".
- */
- private class ConfigureRepositoryLocationsWizardDialog extends WizardDialog {
-
- public ConfigureRepositoryLocationsWizardDialog(Shell parentShell,
- IWizard newWizard) {
- super(parentShell, newWizard);
- }
-
- protected Button createButton(Composite parent, int id, String label,
- boolean defaultButton) {
- if (id == IDialogConstants.FINISH_ID)
- label = CVSUIMessages.ConfigureRepositoryLocationsWizardDialog_finish;
- return super.createButton(parent, id, label, defaultButton);
- }
-
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java
deleted file mode 100644
index 4a2bea411..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSProjectSetCapability;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-
-public class ConfigureRepositoryLocationsTable implements ICellModifier,
- IStructuredContentProvider, ITableLabelProvider {
-
- private static final class AlternativeRepositoryComparator extends
- ViewerComparator {
-
- public AlternativeRepositoryComparator() {
- }
-
- private int getCategory(Object element) {
- if (element instanceof RepositoryLocationItem) {
- return 0;
- }
- return 2;
- }
-
- public int compare(Viewer viewer, Object e1, Object e2) {
- final int compare = getCategory(e1) - getCategory(e2);
- if (compare != 0)
- return compare;
- return super.compare(viewer, ((Item) e1).location,
- ((Item) e2).location);
- }
- }
-
- public abstract static class Item implements Comparable {
- public final ICVSRepositoryLocation location;
- public List alternativeList;
- public int selected;
-
- public Item(ICVSRepositoryLocation name, List alternative) {
- this.location = name;
- this.alternativeList = alternative;
- this.selected = 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object o) {
- return location.getLocation(false).compareTo(
- ((Item) o).location.getLocation(false));
- }
- }
-
- public static class RepositoryLocationItem extends Item {
- public RepositoryLocationItem(
- ICVSRepositoryLocation projectSetRepositoryLocation,
- List suggestedRepositoryLocations) {
- super(projectSetRepositoryLocation, suggestedRepositoryLocations);
- }
- }
-
- protected static final String ITEM = "item"; //$NON-NLS-1$
- protected static final String PROPERTY_ALTERNATIVE_LIST = "alternativeList"; //$NON-NLS-1$
-
- private TableViewer fTableViewer;
-
- private CellEditor[] cellEditors;
-
- private TextCellEditor dummyAlternativeRepositoryEditor;
-
- private Table table;
-
- /**
- * List of <code>AlternativeRepositoryTable.RepositoryLocationItem</code>
- * used as an input to the table.
- */
- private List fAlternatives;
-
- /**
- * Indicates whether a connection method should be displayed in the first
- * column - project set information.
- */
- private boolean fShowConnectionMethod;
-
- private boolean fNoDuplicateRepositoryLocationFound;
-
- public ConfigureRepositoryLocationsTable(Map alternativesMap) {
- fAlternatives = new ArrayList();
- Set checkSet = new HashSet();
- for (Iterator iterator = alternativesMap.entrySet().iterator(); iterator
- .hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- fAlternatives
- .add(new ConfigureRepositoryLocationsTable.RepositoryLocationItem(
- (ICVSRepositoryLocation) entry.getKey(),
- (List) entry.getValue()));
- fNoDuplicateRepositoryLocationFound = checkSet
- .add(excludeConnectionMethod((ICVSRepositoryLocation) entry
- .getKey()));
- }
- fShowConnectionMethod = !fNoDuplicateRepositoryLocationFound;
- // we won't need it anymore
- checkSet = null;
- }
-
- public Composite createControl(final Composite composite) {
- /**
- * Create a table.
- */
- table = new Table(composite, SWT.V_SCROLL | SWT.BORDER | SWT.MULTI
- | SWT.FULL_SELECTION);
- // table.setLayoutData(SWTUtils.createHVFillGridData());
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
- table.addListener(SWT.MeasureItem, new Listener() {
- public void handleEvent(Event event) {
- // int clientWidth = table.getClientArea().width;
- event.height = event.gc.getFontMetrics().getHeight() + 5;
- // event.width = clientWidth * 2;
- }
- });
-
- /**
- * The 'Project Set repository location' column
- */
- final TableColumn projectSetRepositoryColumn = new TableColumn(table,
- SWT.NONE, 0);
- projectSetRepositoryColumn
- .setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_column0);
-
- /**
- * The 'Alternative repository locations' column
- */
- final TableColumn alternativeRepositoryColums = new TableColumn(table,
- SWT.NONE, 1);
- alternativeRepositoryColums
- .setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_column1);
-
- composite.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- Rectangle area = composite.getClientArea();
- Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- ScrollBar vBar = table.getVerticalBar();
- int width = area.width - table.computeTrim(0, 0, 0, 0).width
- - vBar.getSize().x;
- if (size.y > area.height + table.getHeaderHeight()) {
- // Subtract the scrollbar width from the total column width
- // if a vertical scrollbar will be required
- Point vBarSize = vBar.getSize();
- width -= vBarSize.x;
- }
- Point oldSize = table.getSize();
- if (oldSize.x > area.width) {
- // table is getting smaller so make the columns
- // smaller first and then resize the table to
- // match the client area width
- projectSetRepositoryColumn.setWidth(width / 2);
- alternativeRepositoryColums.setWidth(width
- - projectSetRepositoryColumn.getWidth());
- table.setSize(area.width, area.height);
- } else {
- // table is getting bigger so make the table
- // bigger first and then make the columns wider
- // to match the client area width
- table.setSize(area.width, area.height);
- projectSetRepositoryColumn.setWidth(width / 2);
- alternativeRepositoryColums.setWidth(width
- - projectSetRepositoryColumn.getWidth());
- }
- }
- });
-
- /**
- * Create a viewer for the table.
- */
- fTableViewer = new TableViewer(table);
- fTableViewer.setContentProvider(this);
- fTableViewer.setLabelProvider(this);
- fTableViewer.setComparator(new AlternativeRepositoryComparator());
-
- /**
- * Add a cell editor in the 'Alternative repository locations' column
- */
- new TableEditor(table);
-
- cellEditors = new CellEditor[2];
- cellEditors[0] = null;
- // to enable cell editing, create a dummy cell editor
- cellEditors[1] = dummyAlternativeRepositoryEditor = new TextCellEditor(
- table, SWT.READ_ONLY);
-
- fTableViewer.setCellEditors(cellEditors);
- fTableViewer.setColumnProperties(new String[] { ITEM,
- PROPERTY_ALTERNATIVE_LIST });
- fTableViewer.setCellModifier(this);
- fTableViewer.setInput(fAlternatives);
-
- return table;
- }
-
- public Object getValue(Object element, String property) {
-
- final Item item = (Item) element;
-
- if (PROPERTY_ALTERNATIVE_LIST.equals(property)) {
- return new Integer(item.selected);
- }
- return null;
- }
-
- public boolean canModify(Object element, String property) {
- // set the correct cell editor for this element
- cellEditors[1] = getCellEditor(element);
- // only allow modification for editable elements
- return PROPERTY_ALTERNATIVE_LIST.equals(property);
- }
-
- private CellEditor getCellEditor(Object element) {
-
- if (element instanceof RepositoryLocationItem) {
-
- // create combo-box list of alternative repositories
- List alternativeList = ((RepositoryLocationItem) element).alternativeList;
- String[] alternativeNames = new String[alternativeList.size()];
- int i = 0;
- for (Iterator iterator = alternativeList.iterator(); iterator
- .hasNext();) {
- CVSRepositoryLocation repo = (CVSRepositoryLocation) iterator
- .next();
- alternativeNames[i++] = repo.getLocation();
- }
- return new ComboBoxCellEditor(table, alternativeNames,
- SWT.READ_ONLY);
- }
- return dummyAlternativeRepositoryEditor;
- }
-
- public void modify(Object element, String property, Object value) {
-
- final IStructuredSelection selection = (IStructuredSelection) fTableViewer
- .getSelection();
- final Item item = (Item) selection.getFirstElement();
- if (item == null)
- return;
-
- final int comboIndex = ((Integer) value).intValue();
-
- if (PROPERTY_ALTERNATIVE_LIST.equals(property)) {
- item.selected = comboIndex;
- }
- fTableViewer.refresh(item);
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- final Item item = (Item) element;
-
- switch (columnIndex) {
- case 0:
- return fShowConnectionMethod ? item.location.getLocation(false)
- : excludeConnectionMethod(item.location);
- case 1:
- return ((CVSRepositoryLocation) item.alternativeList
- .get(item.selected)).getLocation();
- default:
- return null;
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public Object[] getElements(Object inputElement) {
- return ((Collection) inputElement).toArray();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public IStructuredSelection getSelection() {
- return (IStructuredSelection) fTableViewer.getSelection();
- }
-
- public TableViewer getViewer() {
- return fTableViewer;
- }
-
- /**
- * @return a selected (in a combo box) alternative repository location for
- * the first selected element
- */
- public CVSRepositoryLocation getSelectedAlternativeRepository() {
- RepositoryLocationItem firstElement = (RepositoryLocationItem) getSelection()
- .getFirstElement();
- return (CVSRepositoryLocation) firstElement.alternativeList
- .get(firstElement.selected);
- }
-
- public void addAlternativeRepositoryToSelection(
- ICVSRepositoryLocation location) {
- // add newly created repository location to all selected elements
- for (Iterator iterator = getSelection().iterator(); iterator.hasNext();) {
- RepositoryLocationItem selectedItem = (RepositoryLocationItem) iterator
- .next();
- selectedItem.alternativeList.add(0, location);
- selectedItem.selected = 0;
- // fTableViewer.refresh(selectedItem);
- }
-
- // add newly created repository location to not-selected elements
- // new location must be compatible with the one from the project set
- for (int i = 0; i < fTableViewer.getTable().getItemCount(); i++) {
- Object element = fTableViewer.getElementAt(i);
- if (!getSelection().toList().contains(element)) {
- RepositoryLocationItem locationItem = (RepositoryLocationItem) element;
- if (CVSProjectSetCapability.isCompatible(location,
- locationItem.location)) {
- locationItem.alternativeList.add(location);
- }
- }
- }
-
- // update labels because of the first loop - first item changed
- fTableViewer.refresh(true);
- }
-
- /**
- * @return A map with repository location from the project set as a key and
- * selected repository location from a combo box as value.
- */
- public Map getSelected() {
- Map map = new HashMap();
- for (Iterator iterator = fAlternatives.iterator(); iterator.hasNext();) {
- ConfigureRepositoryLocationsTable.RepositoryLocationItem rli = (ConfigureRepositoryLocationsTable.RepositoryLocationItem) iterator
- .next();
- map.put(rli.location, rli.alternativeList.get(rli.selected));
- }
- return map;
- }
-
- public void setShowConnectionMethod(boolean show) {
- fShowConnectionMethod = show;
- fTableViewer.refresh(true);
- }
-
- private String excludeConnectionMethod(ICVSRepositoryLocation location) {
- String user = location.getUsername();
- String host = location.getHost();
- int port = location.getPort();
- String root = location.getRootDirectory();
-
- return (user != null && !user.equals("") ? (user + CVSRepositoryLocation.HOST_SEPARATOR) //$NON-NLS-1$
- : "") + //$NON-NLS-1$
- host
- + CVSRepositoryLocation.COLON
- + ((port == CVSRepositoryLocation.USE_DEFAULT_PORT) ? "" : (new Integer(port).toString())) + //$NON-NLS-1$
- root;
- }
-
- public boolean noDuplicateRepositoryLocationFound() {
- return fNoDuplicateRepositoryLocationFound;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
deleted file mode 100644
index 79881ff7d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Date;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.PlatformUI;
-
-import com.ibm.icu.util.Calendar;
-import com.ibm.icu.util.TimeZone;
-
-/**
- * Dialog for obtaining a date from the user
- */
-public class DateTagDialog extends TrayDialog {
-
- DateArea dateArea;
- TimeArea timeArea;
- IDialogSettings settings;
- private Date dateEntered;
-
- public class DateArea extends DialogArea {
- private DateTime date;
-
- public void createArea(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- initializeDialogUnits(composite);
- createLabel(composite, CVSUIMessages.DateTagDialog_0, 1);
- date = new DateTime(composite, SWT.DATE);
- }
-
- public void initializeValues(Calendar calendar ) {
- date.setDay(calendar.get(Calendar.DATE) - 1);
- date.setMonth(calendar.get(Calendar.MONTH));
- date.setYear(calendar.get(Calendar.YEAR));
- timeArea.initializeValues(calendar);
- }
-
- public void updateWidgetEnablements() {
- // Do nothing
- }
-
- public void adjustCalendar(Calendar calendar) {
- calendar.set(
- date.getYear(),
- date.getMonth(),
- date.getDay(),
- 0,0,0);
- }
- }
- public class TimeArea extends DialogArea {
-
- private Button includeTime, localTime, utcTime;
- private DateTime time;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- initializeDialogUnits(composite);
- includeTime = createCheckbox(composite, CVSUIMessages.DateTagDialog_1, 2);
- createLabel(composite, CVSUIMessages.DateTagDialog_2, 1);
- time = new DateTime(composite, SWT.TIME);
- localTime = createRadioButton(composite, CVSUIMessages.DateTagDialog_3, 2);
- utcTime = createRadioButton(composite, CVSUIMessages.DateTagDialog_4, 2);
-
- includeTime.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateWidgetEnablements();
- }
- });
- }
-
- public void initializeValues(Calendar calendar) {
- time.setHours(calendar.get(Calendar.HOUR_OF_DAY));//24 hour clock
- time.setMinutes(calendar.get(Calendar.MINUTE));
- time.setSeconds(calendar.get(Calendar.SECOND));
-
- includeTime.setSelection(settings.getBoolean("includeTime")); //$NON-NLS-1$
- localTime.setSelection(!settings.getBoolean("utcTime")); //$NON-NLS-1$
- utcTime.setSelection(settings.getBoolean("utcTime")); //$NON-NLS-1$
- }
- public void updateWidgetEnablements() {
- time.setEnabled(includeTime.getSelection());
- localTime.setEnabled(includeTime.getSelection());
- utcTime.setEnabled(includeTime.getSelection());
- }
- public void adjustCalendar(Calendar calendar) {
- if (includeTime.getSelection()) {
- calendar.set(Calendar.HOUR_OF_DAY, time.getHours());//24 hour clock
- calendar.set(Calendar.MINUTE, time.getMinutes());
- calendar.set(Calendar.SECOND, time.getSeconds());
- if (utcTime.getSelection()) {
- calendar.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
- }
- }
- }
- }
-
- public DateTagDialog(Shell parentShell) {
- super(parentShell);
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("DateTagDialog");//$NON-NLS-1$
- if (this.settings == null) {
- this.settings = workbenchSettings.addNewSection("DateTagDialog");//$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(CVSUIMessages.DateTagDialog_5);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite topLevel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- initializeDialogUnits(topLevel);
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- topLevel.setLayout(layout);
-
- createDateArea(topLevel);
- createTimeArea(topLevel);
- initializeValues();
- updateWidgetEnablements();
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(topLevel, IHelpContextIds.DATE_TAG_DIALOG);
- Dialog.applyDialogFont(parent);
- return topLevel;
- }
-
- private void createDateArea(Composite topLevel) {
- dateArea = new DateArea();
- dateArea.createArea(topLevel);
- }
-
- private void createTimeArea(Composite topLevel) {
- timeArea = new TimeArea();
- timeArea.createArea(topLevel);
- }
-
- private void initializeValues() {
- Calendar calendar = Calendar.getInstance();
- dateArea.initializeValues(calendar);
- timeArea.initializeValues(calendar);
- }
-
- private void updateWidgetEnablements() {
- timeArea.updateWidgetEnablements();
- dateArea.updateWidgetEnablements();
- }
-
- /**
- * Return the date specified by the user in UTC.
- * @return the date specified by the user
- */
- public Date getDate() {
- return dateEntered;
- }
-
- private Date privateGetDate() {
- Calendar calendar = Calendar.getInstance();
- dateArea.adjustCalendar(calendar);
- timeArea.adjustCalendar(calendar);
- return calendar.getTime();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- dateEntered = privateGetDate();
- }
- super.buttonPressed(buttonId);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java
deleted file mode 100644
index 46b0436c7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- * IBM Corporation - ongoing maintenance
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.EditorsInfo;
-import org.eclipse.ui.PlatformUI;
-
-/**
- *
- * A dialog for showing the result of a cvs editors command.
- * Currently not in use, but can be used before executing the edit command
- *
- * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor Kohlwes</a>
- */
-public class EditorsDialog extends TrayDialog {
- /**
- * Constructor EditorsDialog.
- * @param shell
- * @param iEditorsInfos
- */
-
- EditorsView editorsView;
- EditorsInfo[] editorsInfo;
-
- public EditorsDialog(Shell shell, EditorsInfo[] infos) {
- super(shell);
- editorsInfo = infos;
- }
-
- protected Control createDialogArea(Composite container) {
-
- Composite parent = (Composite) super.createDialogArea(container);
-
- getShell().setText(CVSUIMessages.EditorsDialog_title);
- createMessageArea(parent);
- editorsView = new EditorsView();
- editorsView.createPartControl(container);
- editorsView.setInput(editorsInfo);
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.EDITORS_DIALOG);
-
- Dialog.applyDialogFont(parent);
-
- return parent;
- }
- /**
- * Method createMessageArea.
- * @param parent
- */
- private void createMessageArea(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(CVSUIMessages.EditorsDialog_question); //
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
deleted file mode 100644
index 038fe9764..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- * IBM Corporation - ongoing maintenance
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.EditorsInfo;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- *
- * The <code>EditorsView</code> shows the result of cvs editors command
- *
- * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor Kohlwes</a>
- * @see org.eclipse.team.internal.ccvs.ui.actions.ShowEditorsAction
- */
-public class EditorsView extends ViewPart {
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.EditorsView"; //$NON-NLS-1$
-
- private Table table;
- private TableViewer tableViewer;
-
- class EditorsContentProvider implements IStructuredContentProvider {
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return (EditorsInfo[]) inputElement;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(
- Viewer viewer,
- Object oldInput,
- Object newInput) {
- }
-
- }
-
- class EditorsLabelProvider implements ITableLabelProvider {
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (element == null)
- return ""; //$NON-NLS-1$
- EditorsInfo info = (EditorsInfo) element;
-
- String result = null;
- switch (columnIndex) {
- case 0 :
- result = info.getFileName();
- break;
- case 1 :
- result = info.getUserName();
- break;
- case 2 :
- result = info.getDateString();
- break;
- case 3 :
- result = info.getComputerName();
- break;
- }
- // This method must not return null
- if (result == null) result = ""; //$NON-NLS-1$
- return result;
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.widthHint=500;
- gridData.heightHint=100;
- table.setLayoutData(gridData);
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- tableViewer = new TableViewer(table);
- createColumns(table, layout);
-
- tableViewer.setContentProvider(new EditorsContentProvider());
- tableViewer.setLabelProvider(new EditorsLabelProvider());
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(tableViewer.getControl(), IHelpContextIds.CVS_EDITORS_VIEW);
- }
- public void setInput(EditorsInfo[] infos) {
- tableViewer.setInput(infos);
- }
- /**
- * Method createColumns.
- * @param table
- * @param layout
- * @param viewer
- */
- private void createColumns(Table table, TableLayout layout) {
-
- TableColumn col;
- // file name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.EditorsView_file);
- layout.addColumnData(new ColumnWeightData(30, true));
-
- // user name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.EditorsView_user);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // creation date
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.EditorsView_date);
- layout.addColumnData(new ColumnWeightData(30, true));
-
- // computer name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.EditorsView_computer);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- if (table != null)
- table.setFocus();
- }
-
- /**
- * Method getTable.
- */
- public Table getTable() {
- return table;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
deleted file mode 100644
index 1fc2f3cd2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.*;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-
-public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- Text cvsRsh;
- Text cvsServer;
- Text cvsRshParameters;
- private Button useExternal;
- private Button useInternal;
- private Combo methodType;
- private Control internal, external;
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData());
-
- SelectionAdapter selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- };
-
- useExternal = createRadioButton(composite, CVSUIMessages.ExtMethodPreferencePage_0, 1);
- useExternal.addSelectionListener(selectionListener);
- external = createExternalArea(composite);
-
- useInternal = createRadioButton(composite, CVSUIMessages.ExtMethodPreferencePage_1, 1);
- useInternal.addSelectionListener(selectionListener);
- internal = createInternalArea(composite);
-
- SWTUtils.createPreferenceLink((IWorkbenchPreferenceContainer) getContainer(), composite, CVSUIMessages.CVSPreferencesPage_52, CVSUIMessages.CVSPreferencesPage_53);
-
- SWTUtils.createPreferenceLink((IWorkbenchPreferenceContainer) getContainer(), composite, CVSUIMessages.CVSPreferencesPage_54, CVSUIMessages.CVSPreferencesPage_55);
-
- initializeDefaults();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.EXT_PREFERENCE_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- private void updateEnablements() {
- external.setEnabled(useExternal.getSelection());
- cvsRsh.setEnabled(useExternal.getSelection());
- cvsRshParameters.setEnabled(useExternal.getSelection());
- cvsServer.setEnabled(useExternal.getSelection());
- internal.setEnabled(!useExternal.getSelection());
- methodType.setEnabled(!useExternal.getSelection());
- }
-
- private Control createInternalArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label intro = new Label(composite, SWT.LEFT | SWT.WRAP);
- intro.setText(CVSUIMessages.ExtMethodPreferencePage_2);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- intro.setLayoutData(data);
-
- createLabel(composite, CVSUIMessages.CVSPropertiesPage_connectionType, 1);
- methodType = createCombo(composite);
-
- return composite;
- }
- protected Control createExternalArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.numColumns = 3;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label intro = new Label(composite, SWT.LEFT | SWT.WRAP);
- intro.setText(CVSUIMessages.ExtMethodPreferencePage_message);
- GridData data = new GridData();
- data.horizontalSpan = 3;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- intro.setLayoutData(data);
-
- new Label(composite, SWT.LEFT).setText(CVSUIMessages.ExtMethodPreferencePage_CVS_RSH);
- cvsRsh = new Text(composite, SWT.BORDER);
- cvsRsh.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- final Button b = new Button(composite, SWT.NONE);
- b.setText(CVSUIMessages.ExtMethodPreferencePage_Browse);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- 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(CVSUIMessages.ExtMethodPreferencePage_Details);
- String file = d.open();
- if(file!=null) {
- setCvsRshText(file);
- }
- }
- });
-
- new Label(composite, SWT.LEFT).setText(CVSUIMessages.ExtMethodPreferencePage_CVS_RSH_Parameters);
- cvsRshParameters = new Text(composite, SWT.BORDER);
- data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- cvsRshParameters.setLayoutData(data);
-
- new Label(composite, SWT.LEFT).setText(CVSUIMessages.ExtMethodPreferencePage_CVS_SERVER__7);
- cvsServer = new Text(composite, SWT.BORDER);
- data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- cvsServer.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(cvsRsh, IHelpContextIds.EXT_PREFERENCE_RSH);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(cvsRshParameters, IHelpContextIds.EXT_PREFERENCE_PARAM);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(cvsServer, IHelpContextIds.EXT_PREFERENCE_SERVER);
- return composite;
- }
-
- private void initializeDefaults() {
- IPreferenceStore store = getPreferenceStore();
- String rsh = store.getString(ICVSUIConstants.PREF_CVS_RSH);
- String parameter = store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS);
- String server = store.getString(ICVSUIConstants.PREF_CVS_SERVER);
- String method = store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY);
- initializeDefaults(rsh, parameter, server, method);
- }
-
- /*
- * Set CVS_RSH program
- */
- protected void setCvsRshText(String s) {
- cvsRsh.setText(s);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /*
- * @see IPreferencePage#performOk()
- */
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- String method;
- if (useExternal.getSelection()) {
- method = "ext"; //$NON-NLS-1$
- store.setValue(ICVSUIConstants.PREF_CVS_RSH, cvsRsh.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, cvsRshParameters.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_SERVER, cvsServer.getText());
- CVSProviderPlugin.getPlugin().setCvsRshCommand(cvsRsh.getText());
- CVSProviderPlugin.getPlugin().setCvsRshParameters(cvsRshParameters.getText());
- CVSProviderPlugin.getPlugin().setCvsServer(cvsServer.getText());
- } else {
- method = methodType.getText();
- }
- store.setValue(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, method);
- CVSRepositoryLocation.setExtConnectionMethodProxy(method);
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return super.performOk();
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- IPreferenceStore store = getPreferenceStore();
- String rsh = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH);
- String parameter = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS);
- String server = store.getDefaultString(ICVSUIConstants.PREF_CVS_SERVER);
- String method = store.getDefaultString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY);
- initializeDefaults(rsh, parameter, server, method);
- super.performDefaults();
- }
-
- private void initializeDefaults(String rsh, String parameters, String server, String method) {
- cvsRsh.setText(rsh);
- cvsRshParameters.setText(parameters);
- cvsServer.setText(server);
- IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- String name = methods[i].getName();
- if (!name.equals("ext")) { //$NON-NLS-1$
- methodType.add(name);
- }
- }
- if (method.equals("ext")) { //$NON-NLS-1$
- methodType.select(0);
- } else {
- methodType.select(methodType.indexOf(method));
- }
- useExternal.setSelection(method.equals("ext")); //$NON-NLS-1$
- useInternal.setSelection(!method.equals("ext")); //$NON-NLS-1$
- updateEnablements();
- }
-
- /*
- * @see PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
-
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- data.horizontalSpan = 1;
- combo.setLayoutData(data);
- return combo;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
deleted file mode 100644
index 99124e2ae..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.team.FileModificationValidationContext;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.ui.actions.EditorsAction;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.progress.IProgressConstants;
-
-/**
- * IFileModificationValidator that is plugged into the CVS Repository Provider
- */
-public class FileModificationValidator extends CVSCoreFileModificationValidator {
-
- public FileModificationValidator() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.CVSCoreFileModificationValidator#edit(org.eclipse.core.resources.IFile[], org.eclipse.core.resources.team.FileModificationValidationContext)
- */
- protected IStatus edit(IFile[] readOnlyFiles, FileModificationValidationContext context) {
- return edit(readOnlyFiles, getShell(context));
- }
-
- private Shell getShell(FileModificationValidationContext context) {
- if (context == null)
- return null;
- if (context.getShell() != null)
- return (Shell)context.getShell();
- return Utils.getShell(null, true);
- }
-
- private IStatus getStatus(InvocationTargetException e) {
- Throwable target = e.getTargetException();
- if (target instanceof TeamException) {
- return ((TeamException) target).getStatus();
- } else if (target instanceof CoreException) {
- return ((CoreException) target).getStatus();
- }
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, CVSUIMessages.internal, target);
- }
-
- private IStatus edit(final IFile[] files, final Shell shell) {
- if (isPerformEdit()) {
- try {
- if (shell != null && !promptToEditFiles(files, shell)) {
- // The user didn't want to edit.
- // OK is returned but the file remains read-only
- throw new InterruptedException();
- }
-
- // see if the file is up to date
- if (shell != null && promptToUpdateFiles(files, shell)) {
- // The user wants to update the file
- // Run the update in a runnable in order to get a busy cursor.
- // This runnable is syncExeced in order to get a busy cursor
- IRunnableWithProgress updateRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- performUpdate(files, monitor);
- }
- };
- if (isRunningInUIThread()) {
- // Only show a busy cursor if validate edit is blocking the UI
- CVSUIPlugin.runWithProgress(shell, false, updateRunnable);
- } else {
- // We can't show a busy cursor (i.e., run in the UI thread)
- // since this thread may hold locks and
- // running an edit in the UI thread could try to obtain the
- // same locks, resulting in a deadlock.
- updateRunnable.run(new NullProgressMonitor());
- }
- }
-
- // Run the edit in a runnable in order to get a busy cursor.
- // This runnable is syncExeced in order to get a busy cursor
- IRunnableWithProgress editRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- performEdit(files, monitor);
- } catch (CVSException e) {
- new InvocationTargetException(e);
- }
- }
- };
- if (isRunningInUIThread()) {
- // Only show a busy cursor if validate edit is blocking the UI
- CVSUIPlugin.runWithProgress(shell, false, editRunnable);
- } else {
- // We can't show a busy cursor (i.e., run in the UI thread)
- // since this thread may hold locks and
- // running an edit in the UI thread could try to obtain the
- // same locks, resulting in a deadlock.
- editRunnable.run(new NullProgressMonitor());
- }
- } catch (InvocationTargetException e) {
- return getStatus(e);
- } catch (InterruptedException e) {
- // Must return an error to indicate that it is not OK to edit the files
- return new Status(IStatus.CANCEL, CVSUIPlugin.ID, 0, CVSUIMessages.FileModificationValidator_vetoMessage, null); //;
- }
- } else if (isPerformEditInBackground()) {
- IStatus status = setWritable(files);
- if (status.isOK())
- performEdit(files);
- return status;
- } else {
- // Allow the files to be edited without notifying the server
- return setWritable(files);
- }
-
- return Status.OK_STATUS;
-
- }
-
- protected void scheduleEditJob(Job job) {
- job.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- job.setProperty(IProgressConstants.ICON_PROPERTY, getOperationIcon());
- super.scheduleEditJob(job);
- }
-
- private URL getOperationIcon() {
- return FileLocator.find(CVSUIPlugin.getPlugin().getBundle(), new Path(ICVSUIConstants.ICON_PATH + ICVSUIConstants.IMG_CVS_PERSPECTIVE), null);
- }
-
- private boolean isRunningInUIThread() {
- return Display.getCurrent() != null;
- }
-
- private boolean promptToEditFiles(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
- if (files.length == 0)
- return true;
-
- if(isNeverPrompt())
- return true;
-
- // Contact the server to see if anyone else is editing the files
- EditorsAction editors = fetchEditors(files, shell);
- if (editors.isEmpty()) {
- if (isAlwaysPrompt())
- return (promptEdit(shell));
- return true;
- } else {
- return (editors.promptToEdit(shell));
- }
- }
-
- private boolean promptToUpdateFiles(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
- if (files.length == 0)
- return false;
-
- if (isNeverUpdate())
- return false;
-
- // Contact the server to see if the files are up-to-date
- if (needsUpdate(files, new NullProgressMonitor())) {
- if (isPromptUpdate())
- return (promptUpdate(shell));
- return true; // auto update
- }
-
- return false;
- }
-
- private boolean promptEdit(Shell shell) {
- // Open the dialog using a sync exec (there are no guarantees that we
- // were called from the UI thread
- final boolean[] result = new boolean[] { false };
- int flags = isRunningInUIThread() ? 0 : CVSUIPlugin.PERFORM_SYNC_EXEC;
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- result[0] = MessageDialog.openQuestion(shell,CVSUIMessages.FileModificationValidator_3,CVSUIMessages.FileModificationValidator_4); //
- }
- }, flags);
- return result[0];
- }
-
- private boolean promptUpdate(Shell shell) {
- // Open the dialog using a sync exec (there are no guarantees that we
- // were called from the UI thread
- final boolean[] result = new boolean[] { false };
- int flags = isRunningInUIThread() ? 0 : CVSUIPlugin.PERFORM_SYNC_EXEC;
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- result[0] = MessageDialog.openQuestion(shell,CVSUIMessages.FileModificationValidator_5,CVSUIMessages.FileModificationValidator_6);
- }
- }, flags);
- return result[0];
- }
-
- private boolean isPerformEdit() {
- return ICVSUIConstants.PREF_EDIT_PROMPT_EDIT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION));
- }
-
- private boolean isPerformEditInBackground() {
- return ICVSUIConstants.PREF_EDIT_IN_BACKGROUND.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION));
- }
-
- private EditorsAction fetchEditors(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
- final EditorsAction editors = new EditorsAction(getProvider(files), files);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- editors.run(monitor);
- }
- };
- if (isRunningInUIThread()) {
- // Show a busy cursor if we are running in the UI thread
- CVSUIPlugin.runWithProgress(shell, false, runnable);
- } else {
- // We can't show a busy cursor (i.e., run in the UI thread)
- // since this thread may hold locks and
- // running a CVS operation in the UI thread could try to obtain the
- // same locks, resulting in a deadlock.
- runnable.run(new NullProgressMonitor());
- }
- return editors;
- }
-
- private boolean isNeverPrompt() {
- return ICVSUIConstants.PREF_EDIT_PROMPT_NEVER.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT));
- }
-
- private boolean isAlwaysPrompt() {
- return ICVSUIConstants.PREF_EDIT_PROMPT_ALWAYS.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT));
- }
-
- private boolean needsUpdate(IFile[] files, IProgressMonitor monitor) {
- try {
- CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- subscriber.refresh(files, IResource.DEPTH_ZERO, monitor);
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
- SyncInfo info = subscriber.getSyncInfo(file);
- int direction = info.getKind() & SyncInfo.DIRECTION_MASK;
- if (direction == SyncInfo.CONFLICTING || direction == SyncInfo.INCOMING) {
- return true;
- }
- }
- } catch (TeamException e) {
- // Log the exception and assume we don't need to update it
- CVSProviderPlugin.log(e);
- }
- return false;
- }
-
- private void performUpdate(IFile[] files, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- // TODO: This obtains the project rule which can cause a rule violation
- new UpdateOperation(null /* no target part */, files, Command.NO_LOCAL_OPTIONS, null /* no tag */).run(monitor);
- }
-
- private boolean isPromptUpdate() {
- return ICVSUIConstants.PREF_UPDATE_PROMPT_IF_OUTDATED.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PROMPT));
- }
-
- private boolean isNeverUpdate() {
- return ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PROMPT));
- }
-
- public ISchedulingRule validateEditRule(CVSResourceRuleFactory factory, IResource[] resources) {
- if (!isNeverUpdate()) {
- // We may need to perform an update so we need to obtain the lock on each project
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (isReadOnly(resource))
- projects.add(resource.getProject());
- }
- return createSchedulingRule(projects);
- }
- return internalValidateEditRule(factory, resources);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
deleted file mode 100644
index dfdeefbf2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import com.ibm.icu.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-
-/**
- * This class provides the table and it's required components for a file's revision
- * history
- */
-public class HistoryTableProvider {
-
- private ICVSFile currentFile;
- private String currentRevision;
- private TableViewer viewer;
- private Font currentRevisionFont;
-
- /**
- * Constructor for HistoryTableProvider.
- */
- public HistoryTableProvider() {
- super();
- }
-
- //column constants
- private static final int COL_REVISION = 0;
- private static final int COL_TAGS = 1;
- private static final int COL_DATE = 2;
- private static final int COL_AUTHOR = 3;
- private static final int COL_COMMENT = 4;
-
- /**
- * The history label provider.
- */
- class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider, IFontProvider {
- private DateFormat dateFormat;
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- public String getColumnText(Object element, int columnIndex) {
- ILogEntry entry = adaptToLogEntry(element);
- if (entry == null) return ""; //$NON-NLS-1$
- switch (columnIndex) {
- case COL_REVISION:
- String revision = entry.getRevision();
- String currentRevision = getCurrentRevision();
- if (currentRevision != null && currentRevision.equals(revision)) {
- revision = NLS.bind(CVSUIMessages.currentRevision, new String[] { revision });
- }
- 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 CVSUIMessages.notAvailable;
- return getDateFormat().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 CVSUIMessages.HistoryView_______4;
- default:
- return NLS.bind(CVSUIMessages.CVSCompareRevisionsInput_truncate, new String[] { comment.substring(0, index) });
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- private synchronized DateFormat getDateFormat() {
- if (dateFormat == null)
- dateFormat = DateFormat.getInstance();
- return dateFormat;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
- public Color getForeground(Object element) {
- ILogEntry entry = adaptToLogEntry(element);
- if (entry.isDeletion()) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- } else {
- return null;
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
- public Color getBackground(Object element) {
- return null;
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
- public Font getFont(Object element) {
- ILogEntry entry = adaptToLogEntry(element);
- if (entry == null)
- return null;
- String revision = entry.getRevision();
- String currentRevision = getCurrentRevision();
- if (currentRevision != null && currentRevision.equals(revision)) {
- if (currentRevisionFont == null) {
- Font defaultFont = JFaceResources.getDefaultFont();
- FontData[] data = defaultFont.getFontData();
- for (int i = 0; i < data.length; i++) {
- data[i].setStyle(SWT.BOLD);
- }
- currentRevisionFont = new Font(viewer.getTable().getDisplay(), data);
- }
- return currentRevisionFont;
- }
- return null;
- }
- }
-
- /**
- * The history sorter
- */
- class HistoryComparator extends ViewerComparator {
- private boolean reversed = false;
- private int columnNumber;
-
- private VersionCollator versionCollator = new VersionCollator();
-
- // column headings: "Revision" "Tags" "Date" "Author" "Comment"
- private int[][] SORT_ORDERS_BY_COLUMN = {
- {COL_REVISION, COL_DATE, COL_AUTHOR, COL_COMMENT, COL_TAGS}, /* revision */
- {COL_TAGS, COL_REVISION, COL_DATE, COL_AUTHOR, COL_COMMENT}, /* tags */
- {COL_DATE, COL_REVISION, COL_AUTHOR, COL_COMMENT, COL_TAGS}, /* date */
- {COL_AUTHOR, COL_REVISION, COL_DATE, COL_COMMENT, COL_TAGS}, /* author */
- {COL_COMMENT, COL_REVISION, COL_DATE, COL_AUTHOR, COL_TAGS} /* comment */
- };
-
- /**
- * The constructor.
- */
- public HistoryComparator(int columnNumber) {
- this.columnNumber = columnNumber;
- }
- /**
- * Compares two log entries, sorting first by the main column of this sorter,
- * then by subsequent columns, depending on the column sort order.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- ILogEntry e1 = adaptToLogEntry(o1);
- ILogEntry e2 = adaptToLogEntry(o2);
- int result = 0;
- if (e1 == null || e2 == null) {
- result = super.compare(viewer, o1, o2);
- } else {
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], e1, e2);
- if (result != 0)
- break;
- }
- }
- if (reversed)
- result = -result;
- return result;
- }
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- int compareColumnValue(int columnNumber, ILogEntry e1, ILogEntry e2) {
- switch (columnNumber) {
- case 0: /* revision */
- return versionCollator.compare(e1.getRevision(), e2.getRevision());
- case 1: /* tags */
- CVSTag[] tags1 = e1.getTags();
- CVSTag[] tags2 = e2.getTags();
- if (tags2.length == 0) {
- return -1;
- }
- if (tags1.length == 0) {
- return 1;
- }
- return getComparator().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 getComparator().compare(e1.getAuthor(), e2.getAuthor());
- case 4: /* comment */
- return getComparator().compare(e1.getComment(), e2.getComment());
- default:
- return 0;
- }
- }
- /**
- * Returns the number of the column by which this is sorting.
- */
- public int getColumnNumber() {
- return columnNumber;
- }
- /**
- * Returns true for descending, or false
- * for ascending sorting order.
- */
- public boolean isReversed() {
- return reversed;
- }
- /**
- * Sets the sorting order.
- */
- public void setReversed(boolean newReversed) {
- reversed = newReversed;
- }
- }
-
- protected ILogEntry adaptToLogEntry(Object element) {
- // Get the log entry for the provided object
- ILogEntry entry = null;
- if (element instanceof ILogEntry) {
- entry = (ILogEntry) element;
- } else if (element instanceof IAdaptable) {
- entry = (ILogEntry)((IAdaptable)element).getAdapter(ILogEntry.class);
- }
- return entry;
- }
-
- /**
- * Create a TableViewer that can be used to display a list of ILogEntry instances.
- * Ths method provides the labels and sorter but does not provide a content provider
- *
- * @param parent
- * @return TableViewer
- */
- public TableViewer createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(data);
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- TableViewer viewer = new TableViewer(table);
-
- createColumns(table, layout, viewer);
-
- viewer.setLabelProvider(new HistoryLabelProvider());
-
- // By default, reverse sort by revision.
- HistoryComparator sorter = new HistoryComparator(COL_REVISION);
- sorter.setReversed(true);
- viewer.setComparator(sorter);
-
- table.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if(currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
- }
- });
-
- this.viewer = viewer;
- return viewer;
- }
-
- /**
- * Create a CheckBoxTableViewer that can be used to display a list of ILogEntry instances.
- * Ths method provides the labels and sorter but does not provide a content provider
- *
- * @param parent
- * @return TableViewer
- */
- public CheckboxTableViewer createCheckBoxTable(Composite parent) {
- Table table = new Table(parent, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(data);
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- CheckboxTableViewer viewer = new CheckboxTableViewer(table);
-
- createColumns(table, layout, viewer);
-
- viewer.setLabelProvider(new HistoryLabelProvider());
-
- // By default, reverse sort by revision.
- HistoryComparator sorter = new HistoryComparator(COL_REVISION);
- sorter.setReversed(true);
- viewer.setComparator(sorter);
-
- table.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if(currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
- }
- });
-
- this.viewer = viewer;
- return viewer;
- }
-
- /**
- * Creates the columns for the history table.
- */
- private void createColumns(Table table, TableLayout layout, TableViewer viewer) {
- SelectionListener headerListener = getColumnListener(viewer);
- // revision
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.HistoryView_revision);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // tags
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.HistoryView_tags);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // creation date
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.HistoryView_date);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // author
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.HistoryView_author);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- //comment
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(CVSUIMessages.HistoryView_comment);
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(50, true));
- }
-
- /**
- * Adds the listener that sets the sorter.
- */
- private SelectionListener getColumnListener(final TableViewer tableViewer) {
- /**
- * This class handles selections of the column headers.
- * Selection of the column header will cause resorting
- * of the shown tasks using that column's sorter.
- * Repeated selection of the header will toggle
- * sorting order (ascending versus descending).
- */
- return new SelectionAdapter() {
- /**
- * Handles the case of user selecting the
- * header area.
- * <p>If the column has not been selected previously,
- * it will set the sorter of that column to be
- * the current tasklist sorter. Repeated
- * presses on the same column header will
- * toggle sorting order (ascending/descending).
- */
- public void widgetSelected(SelectionEvent e) {
- // column selected - need to sort
- int column = tableViewer.getTable().indexOf((TableColumn) e.widget);
- HistoryComparator oldSorter = (HistoryComparator)tableViewer.getComparator();
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- oldSorter.setReversed(!oldSorter.isReversed());
- tableViewer.refresh();
- } else {
- tableViewer.setComparator(new HistoryComparator(column));
- }
- }
- };
- }
-
- public String getCurrentRevision() {
- return currentRevision;
- }
-
- /**
- * Method getRevision.
- * @param currentEdition
- */
- private String getRevision(ICVSFile currentEdition) throws CVSException {
- if (currentEdition == null) return ""; //$NON-NLS-1$
- ResourceSyncInfo info = currentEdition.getSyncInfo();
- if (info == null) return ""; //$NON-NLS-1$
- return info.getRevision();
- }
-
- public void setFile(ICVSFile file) throws CVSException {
- this.currentFile = file;
- this.currentRevision = getRevision(this.currentFile);
- }
-
- public ICVSFile getICVSFile() {
- return this.currentFile;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
deleted file mode 100644
index 35917d6a4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- * William Mitsuda (wmitsuda@gmail.com) - Bug 153879 [Wizards] configurable size of cvs commit comment history
- * Brock Janiczak <brockj@tpg.com.au> - Bug 161536 Warn user when committing resources with problem markers
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-public interface ICVSUIConstants {
- public final String PREFIX = CVSUIPlugin.ID + "."; //$NON-NLS-1$
-
- // image path
- public final String ICON_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
-
- // images
- public final String IMG_CVS_CONSOLE = "eview16/console_view.gif"; //$NON-NLS-1$
- public final String IMG_CVS_PERSPECTIVE = "eview16/cvs_persp.gif"; //$NON-NLS-1$
- public final String IMG_COMPARE_VIEW = "eview16/compare_view.gif"; //$NON-NLS-1$
-
- // overlays
- public final String IMG_MERGEABLE_CONFLICT = "ovr16/confauto_ov.gif"; //$NON-NLS-1$
- public final String IMG_QUESTIONABLE = "ovr16/question_ov.gif"; //$NON-NLS-1$
- public final String IMG_MERGED = "ovr16/merged_ov.gif"; //$NON-NLS-1$
- public final String IMG_EDITED = "ovr16/edited_ov.gif"; //$NON-NLS-1$
- public final String IMG_NO_REMOTEDIR = "ovr16/no_remotedir_ov.gif"; //$NON-NLS-1$
-
- // objects
- public final String IMG_REPOSITORY = "obj16/repository_rep.gif"; //$NON-NLS-1$
- public final String IMG_TAG = "obj16/tag.gif"; //$NON-NLS-1$
- public final String IMG_BRANCHES_CATEGORY = "obj16/branches_rep.gif"; //$NON-NLS-1$
- public final String IMG_VERSIONS_CATEGORY = "obj16/versions_rep.gif"; //$NON-NLS-1$
- public final String IMG_DATES_CATEGORY = "obj16/dates.gif"; //$NON-NLS-1$
-
- public final String IMG_MODULE = "obj16/module_rep.gif"; //$NON-NLS-1$
- public final String IMG_PROJECT_VERSION = "obj16/prjversions_rep.gif"; //$NON-NLS-1$
- public final String IMG_DATE = "obj16/date.gif"; //$NON-NLS-1$
- public final String IMG_CHANGELOG = "obj16/changelog_obj.gif"; //$NON-NLS-1$
-
- public final String IMG_LOCALREVISION_TABLE = "obj16/local_entry_tbl.gif"; //$NON-NLS-1$
- public final String IMG_REMOTEREVISION_TABLE = "obj16/remote_entry_tbl.gif"; //$NON-NLS-1$
-
- // toolbar
- public final String IMG_REFRESH = "elcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR = "elcl16/clear_co.gif"; //$NON-NLS-1$
- public final String IMG_COLLAPSE_ALL = "elcl16/collapseall.gif"; //$NON-NLS-1$
- public final String IMG_LINK_WITH_EDITOR = "elcl16/synced.gif"; //$NON-NLS-1$
- public final String IMG_REMOVE_CONSOLE = "elcl16/console_rem.gif"; //$NON-NLS-1$
- public final String IMG_REMOTEMODE = "elcl16/remote_history_mode.gif"; //$NON-NLS-1$
- public final String IMG_LOCALMODE = "elcl16/local_history_mode.gif"; //$NON-NLS-1$
- public final String IMG_LOCALREMOTE_MODE = "elcl16/all_history_mode.gif"; //$NON-NLS-1$
-
- // toolbar (disabled)
- public final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR_DISABLED = "dlcl16/clear_co.gif"; //$NON-NLS-1$
- public final String IMG_REMOVE_CONSOLE_DISABLED = "dlcl16/console_rem.gif"; //$NON-NLS-1$
- public final String IMG_REMOTEMODE_DISABLED = "dlcl16/remote_history_mode.gif"; //$NON-NLS-1$
- public final String IMG_LOCALMODE_DISABLED = "dlcl16/local_history_mode.gif"; //$NON-NLS-1$
- public final String IMG_LOCALREMOTE_MODE_DISABLED = "dlcl16/all_history_mode.gif"; //$NON-NLS-1$
-
- // toolbar (enabled)
- public final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR_ENABLED = "elcl16/clear_co.gif"; //$NON-NLS-1$
- public final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif"; //$NON-NLS-1$
- public final String IMG_LINK_WITH_EDITOR_ENABLED = "elcl16/synced.gif"; //$NON-NLS-1$
-
- //history page toolbar
- public final String IMG_FILTER_HISTORY = "elcl16/filter_history.gif"; //$NON-NLS-1$
-
- // wizards
- public final String IMG_NEWLOCATION = "etool16/newlocation_wiz.gif"; //$NON-NLS-1$
- public final String IMG_CVSLOGO = "etool16/newconnect_wiz.gif"; //$NON-NLS-1$
-
- // preferences
- public final String PREF_REVISION_MODE = "pref_revision_mode"; //$NON-NLS-1$
- public final String PREF_GROUPBYDATE_MODE = "pref_groupbydate_mode"; //$NON-NLS-1$
- public final String PREF_SHOW_COMMENTS = "pref_show_comments"; //$NON-NLS-1$
- public final String PREF_WRAP_COMMENTS = "pref_wrap_comments"; //$NON-NLS-1$
- public final String PREF_SHOW_TAGS = "pref_show_tags"; //$NON-NLS-1$
- public final String PREF_SHOW_SEARCH = "pref_show_search"; //$NON-NLS-1$
- public final String PREF_HISTORY_VIEW_EDITOR_LINKING = "pref_history_view_linking"; //$NON-NLS-1$
- public final String PREF_PRUNE_EMPTY_DIRECTORIES = "pref_prune_empty_directories"; //$NON-NLS-1$
- public final String PREF_TIMEOUT = "pref_timeout"; //$NON-NLS-1$
- public final String PREF_QUIETNESS = "pref_quietness"; //$NON-NLS-1$
- public final String PREF_CVS_RSH = "pref_cvs_rsh"; //$NON-NLS-1$
- public final String PREF_CVS_RSH_PARAMETERS = "pref_cvs_rsh_parameters"; //$NON-NLS-1$
- public final String PREF_CVS_SERVER = "pref_cvs_server"; //$NON-NLS-1$
- public final String PREF_CONSIDER_CONTENTS = "pref_consider_contents"; //$NON-NLS-1$
- public final String PREF_REPLACE_UNMANAGED = "pref_replace_unmanaged"; //$NON-NLS-1$
- public final String PREF_COMPRESSION_LEVEL = "pref_compression_level"; //$NON-NLS-1$
- public final String PREF_TEXT_KSUBST = "pref_text_ksubst"; //$NON-NLS-1$
- public final String PREF_USE_PLATFORM_LINEEND = "pref_lineend"; //$NON-NLS-1$
- public final String PREF_PROMPT_ON_MIXED_TAGS = "pref_prompt_on_mixed_tags"; //$NON-NLS-1$
- public final String PREF_PROMPT_ON_SAVING_IN_SYNC = "pref_prompt_on_saving_in_sync"; //$NON-NLS-1$
- public final String PREF_SAVE_DIRTY_EDITORS = "pref_save_dirty_editors"; //$NON-NLS-1$
- public final String PREF_PROMPT_ON_CHANGE_GRANULARITY = "pref_prompt_on_change_granularity"; //$NON-NLS-1$
- public final String PREF_REPOSITORIES_ARE_BINARY = "pref_repositories_are_binary"; //$NON-NLS-1$
- public final String PREF_DETERMINE_SERVER_VERSION = "pref_determine_server_version"; //$NON-NLS-1$
- public final String PREF_CONFIRM_MOVE_TAG = "pref_confirm_move_tag"; //$NON-NLS-1$
- public final String PREF_DEBUG_PROTOCOL = "pref_debug_protocol"; //$NON-NLS-1$
- public final String PREF_WARN_REMEMBERING_MERGES = "pref_remember_merges"; //$NON-NLS-1$
- public final String PREF_FIRST_STARTUP = "pref_first_startup"; //$NON-NLS-1$
- public final String PREF_EXT_CONNECTION_METHOD_PROXY = "pref_ext_connection_method_proxy"; //$NON-NLS-1$
- public final String PREF_SHOW_COMPARE_REVISION_IN_DIALOG = "pref_show_compare_revision_in_dialog"; //$NON-NLS-1$
- public final String PREF_SHOW_AUTHOR_IN_EDITOR = "pref_show_author_in_editor"; //$NON-NLS-1$
- public final String PREF_COMMIT_SET_DEFAULT_ENABLEMENT = "pref_enable_commit_sets"; //$NON-NLS-1$
- public final String PREF_AUTO_REFRESH_TAGS_IN_TAG_SELECTION_DIALOG = "pref_auto_refresh_tags_in_tag_selection_dialog"; //$NON-NLS-1$
- public final String PREF_COMMIT_FILES_DISPLAY_THRESHOLD = "pref_commit_files_display_threshold"; //$NON-NLS-1$
- public final String PREF_COMMIT_COMMENTS_MAX_HISTORY = "pref_commit_comments_max_history"; //$NON-NLS-1$
- public final String PREF_AUTO_SHARE_ON_IMPORT = "pref_auto_share_on_import"; //$NON-NLS-1$
- public final String PREF_ENABLE_WATCH_ON_EDIT = "pref_enable_watch_on_edit"; //$NON-NLS-1$
- public final String PREF_USE_PROJECT_NAME_ON_CHECKOUT = "pref_use_project_name_on_checkout"; //$NON-NLS-1$
- public final String PREF_INCLUDE_CHANGE_SETS_IN_COMMIT = "pref_include_change_sets"; //$NON-NLS-1$
- public final String PREF_ANNOTATE_PROMPTFORBINARY = "pref_annotate_promptforbinary"; //$NON-NLS-1$
- public final String PREF_ALLOW_COMMIT_WITH_WARNINGS = "pref_commit_with_warning"; //$NON-NLS-1$
- public final String PREF_ALLOW_COMMIT_WITH_ERRORS = "pref_commit_with_errors"; //$NON-NLS-1$
-
-
- // console preferences
- public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
- public final String PREF_CONSOLE_MESSAGE_COLOR = "pref_console_message_color"; //$NON-NLS-1$
- public final String PREF_CONSOLE_ERROR_COLOR = "pref_console_error_color"; //$NON-NLS-1$
- public final String PREF_CONSOLE_FONT = "pref_console_font"; //$NON-NLS-1$
- public final String PREF_CONSOLE_SHOW_ON_MESSAGE = "pref_console_show_on_message"; //$NON-NLS-1$
- public final String PREF_CONSOLE_LIMIT_OUTPUT = "pref_console_limit_output"; //$NON-NLS-1$
- public final String PREF_CONSOLE_HIGH_WATER_MARK = "pref_console_high_water_mark"; //$NON-NLS-1$
- public final String PREF_CONSOLE_WRAP = "pref_console_wrap"; //$NON-NLS-1$
- public final String PREF_CONSOLE_WIDTH = "pref_console_width"; //$NON-NLS-1$
-
- // decorator preferences
- public final String PREF_FILETEXT_DECORATION = "pref_filetext_decoration"; //$NON-NLS-1$
- public final String PREF_FOLDERTEXT_DECORATION = "pref_foldertext_decoration"; //$NON-NLS-1$
- public final String PREF_PROJECTTEXT_DECORATION = "pref_projecttext_decoration"; //$NON-NLS-1$
-
- public final String PREF_SHOW_DIRTY_DECORATION = "pref_show_overlaydirty"; //$NON-NLS-1$
- public final String PREF_SHOW_ADDED_DECORATION = "pref_show_added"; //$NON-NLS-1$
- public final String PREF_SHOW_HASREMOTE_DECORATION = "pref_show_hasremote"; //$NON-NLS-1$
- public final String PREF_SHOW_NEWRESOURCE_DECORATION = "pref_show_newresource"; //$NON-NLS-1$
-
- public final String PREF_DIRTY_FLAG = "pref_dirty_flag"; //$NON-NLS-1$
- public final String PREF_ADDED_FLAG = "pref_added_flag"; //$NON-NLS-1$
-
- public final String PREF_CALCULATE_DIRTY = "pref_calculate_dirty"; //$NON-NLS-1$
- public final String PREF_USE_FONT_DECORATORS= "pref_use_font_decorators"; //$NON-NLS-1$
-
- // watch/edit preferences
- public final String PREF_CHECKOUT_READ_ONLY = "pref_checkout_read_only"; //$NON-NLS-1$
- public final String PREF_EDIT_ACTION = "pref_edit_action"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_EDIT = "edit"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_HIGHJACK = "highjack"; //$NON-NLS-1$
- public final String PREF_EDIT_IN_BACKGROUND = "editInBackground"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT = "pref_edit_prompt"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_NEVER = "never"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_ALWAYS = "always"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_IF_EDITORS = "only"; //$NON-NLS-1$
-
- // update preferences
- public final String PREF_UPDATE_PROMPT = "pref_update_prompt"; //$NON-NLS-1$
- public final String PREF_UPDATE_PROMPT_NEVER = "never"; //$NON-NLS-1$
- public final String PREF_UPDATE_PROMPT_AUTO = "auto"; //$NON-NLS-1$
- public final String PREF_UPDATE_PROMPT_IF_OUTDATED = "only"; //$NON-NLS-1$
-
- // Repositories view preferences
- public final String PREF_GROUP_VERSIONS_BY_PROJECT = "pref_group_versions_by_project"; //$NON-NLS-1$
-
- // Perspective changing preferences
- public final String PREF_CHANGE_PERSPECTIVE_ON_NEW_REPOSITORY_LOCATION = "pref_change_perspective_on_new_location"; //$NON-NLS-1$
-
- public final String PREF_ALLOW_EMPTY_COMMIT_COMMENTS= "pref_allow_empty_commit_comment"; //$NON-NLS-1$
-
- public final String PREF_UPDATE_HANDLING = "pref_team_update_handling"; //$NON-NLS-1$
- public final String PREF_UPDATE_HANDLING_PREVIEW = "previewUpdate"; //$NON-NLS-1$
- public final String PREF_UPDATE_HANDLING_PERFORM = "performUpdate"; //$NON-NLS-1$
- public final String PREF_UPDATE_HANDLING_TRADITIONAL = "traditionalUpdate"; //$NON-NLS-1$
- public final String PREF_UPDATE_PREVIEW = "pref_update_preview"; //$NON-NLS-1$
- public final String PREF_UPDATE_PREVIEW_IN_DIALOG = "dialog"; //$NON-NLS-1$
- public final String PREF_UPDATE_PREVIEW_IN_SYNCVIEW = "syncView"; //$NON-NLS-1$
-
- public final String PREF_ENABLE_MODEL_SYNC = "enableModelSync"; //$NON-NLS-1$
- public final String PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE = "openCompareEditorForSingleFile"; //$NON-NLS-1$
-
- // Wizard banners
- public final String IMG_WIZBAN_SHARE = "wizban/newconnect_wizban.png"; //$NON-NLS-1$
- public final String IMG_WIZBAN_MERGE = "wizban/mergestream_wizban.png"; //$NON-NLS-1$
- public final String IMG_WIZBAN_DIFF = "wizban/createpatch_wizban.png"; //$NON-NLS-1$
- public final String IMG_WIZBAN_KEYWORD = "wizban/keywordsub_wizban.png"; //$NON-NLS-1$
- public final String IMG_WIZBAN_NEW_LOCATION = "wizban/newlocation_wizban.png"; //$NON-NLS-1$
- public final String IMG_WIZBAN_CHECKOUT = "wizban/newconnect_wizban.png"; //$NON-NLS-1$
- public final String IMG_WIZBAN_IMPORT = "wizban/import_wiz.png"; //$NON-NLS-1$
-
- // Properties
- public final String PROP_NAME = "cvs.name"; //$NON-NLS-1$
- public final String PROP_REVISION = "cvs.revision"; //$NON-NLS-1$
- public final String PROP_AUTHOR = "cvs.author"; //$NON-NLS-1$
- public final String PROP_COMMENT = "cvs.comment"; //$NON-NLS-1$
- public final String PROP_DATE = "cvs.date"; //$NON-NLS-1$
- public final String PROP_DIRTY = "cvs.dirty"; //$NON-NLS-1$
- public final String PROP_MODIFIED = "cvs.modified"; //$NON-NLS-1$
- public final String PROP_KEYWORD = "cvs.date"; //$NON-NLS-1$
- public final String PROP_TAG = "cvs.tag"; //$NON-NLS-1$
- public final String PROP_PERMISSIONS = "cvs.permissions"; //$NON-NLS-1$
- public final String PROP_HOST = "cvs.host"; //$NON-NLS-1$
- public final String PROP_USER = "cvs.user"; //$NON-NLS-1$
- public final String PROP_METHOD = "cvs.method"; //$NON-NLS-1$
- public final String PROP_PORT = "cvs.port"; //$NON-NLS-1$
- public final String PROP_ROOT = "cvs.root"; //$NON-NLS-1$
-
- // preference options
- public final int OPTION_NEVER = 1;
- public final int OPTION_PROMPT = 2;
- public final int OPTION_AUTOMATIC = 3;
-
- public final String OPTION_NO_PERSPECTIVE= "none"; //$NON-NLS-1$
-
- // Command Ids
- public final String CMD_COMMIT = "org.eclipse.team.cvs.ui.commit"; //$NON-NLS-1$
- public final String CMD_COMMIT_ALL = "org.eclipse.team.cvs.ui.commitAll"; //$NON-NLS-1$
- public final String CMD_SYNCHRONIZE = "org.eclipse.team.ui.synchronizeLast"; //$NON-NLS-1$
- public final String CMD_UPDATE = "org.eclipse.team.cvs.ui.update"; //$NON-NLS-1$
- public final String CMD_UPDATE_ALL = "org.eclipse.team.cvs.ui.updateAll"; //$NON-NLS-1$
- public final String CMD_CREATEPATCH = "org.eclipse.team.cvs.ui.GenerateDiff"; //$NON-NLS-1$
- public final String CMD_TAGASVERSION = "org.eclipse.team.cvs.ui.tag"; //$NON-NLS-1$
- public final String CMD_BRANCH = "org.eclipse.team.cvs.ui.branch"; //$NON-NLS-1$
- public final String CMD_MERGE = "org.eclipse.team.cvs.ui.merge"; //$NON-NLS-1$
- public final String CMD_UPDATESWITCH = "org.eclipse.team.cvs.ui.updateSwitch"; //$NON-NLS-1$
- public final String CMD_SETFILETYPE = "org.eclipse.team.cvs.ui.setKeywordSubstitution"; //$NON-NLS-1$
- public final String CMD_ANNOTATE = "org.eclipse.team.cvs.ui.showAnnotation"; //$NON-NLS-1$
- public final String CMD_HISTORY = "org.eclipse.team.cvs.ui.showHistory"; //$NON-NLS-1$
- public final String CMD_ADD = "org.eclipse.team.cvs.ui.add"; //$NON-NLS-1$
- public final String CMD_IGNORE = "org.eclipse.team.cvs.ui.ignore"; //$NON-NLS-1$
-
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
deleted file mode 100644
index ac3ca492c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-/**
- * Here's how to reference the help context in code:
- *
- * WorkbenchHelp.setHelp(actionOrControl, IHelpContextIds.NAME_DEFIED_BELOW);
- */
-public interface IHelpContextIds {
-
- public static final String PREFIX = CVSUIPlugin.ID + "."; //$NON-NLS-1$
-
- // Dialogs
- public static final String TAG_CONFIGURATION_OVERVIEW = PREFIX + "tag_configuration_overview"; //$NON-NLS-1$
- public static final String TAG_CONFIGURATION_REFRESHLIST = PREFIX + "tag_configuration_refreshlist"; //$NON-NLS-1$
- public static final String TAG_CONFIGURATION_REFRESHACTION = PREFIX + "tag_configuration_refreshaction"; //$NON-NLS-1$
- public static final String USER_VALIDATION_DIALOG = PREFIX + "user_validation_dialog_context"; //$NON-NLS-1$
- public static final String RELEASE_COMMENT_DIALOG = PREFIX + "release_comment_dialog_context"; //$NON-NLS-1$
- public static final String BRANCH_DIALOG = PREFIX + "branch_dialog_context"; //$NON-NLS-1$
- public static final String ADD_TO_VERSION_CONTROL_DIALOG = PREFIX + "add_to_version_control_dialog_context"; //$NON-NLS-1$
- public static final String EDITORS_DIALOG = PREFIX + "editors_dialog_context"; //$NON-NLS-1$
- public static final String HISTORY_FILTER_DIALOG = PREFIX + "history_filter_dialog_context"; //$NON-NLS-1$
- public static final String DATE_TAG_DIALOG = PREFIX + "date_tag_dialog_context"; //$NON-NLS-1$
- public static final String KEYBOARD_INTERACTIVE_DIALOG = PREFIX + "keyboard_interactive_dialog_context"; //$NON-NLS-1$
- public static final String COMMIT_SET_DIALOG = PREFIX + "commit_set_dialog_context"; //$NON-NLS-1$
- public static final String TAG_UNCOMMITED_PROMPT = PREFIX + "tag_uncommmited_dialog_context"; //$NON-NLS-1$
- public static final String ALTERNATIVE_REPOSITORY_DIALOG = PREFIX + "alternative_repository_dialog_context"; //$NON-NLS-1$
-
- // Different uses of the TagSelectionDialog
- public static final String REPLACE_TAG_SELECTION_DIALOG = PREFIX + "replace_tag_selection_dialog_context"; //$NON-NLS-1$
- public static final String COMPARE_TAG_SELECTION_DIALOG = PREFIX + "compare_tag_selection_dialog_context"; //$NON-NLS-1$
- public static final String TAG_REMOTE_WITH_EXISTING_DIALOG = PREFIX + "tag_remote_with_existing_dialog_context"; //$NON-NLS-1$
-
- // Different uses of the TagAsVersionDialog
- public static final String TAG_AS_VERSION_DIALOG = PREFIX + "tag_as_version_dialog_context"; //$NON-NLS-1$
-
- // Different uses of the OutgoingChangesDialog
- public static final String REPLACE_OUTGOING_CHANGES_DIALOG = PREFIX + "replace_outgoing_changes_dialog_context"; //$NON-NLS-1$
- public static final String TAG_OUTGOING_CHANGES_DIALOG = PREFIX + "tag_outgoing_changes_dialog_context"; //$NON-NLS-1$
-
- // Wizard Pages
- public static final String SHARING_AUTOCONNECT_PAGE = PREFIX + "sharing_autoconnect_page_context"; //$NON-NLS-1$
- public static final String SHARING_SELECT_REPOSITORY_PAGE = PREFIX + "sharing_select_repository_page_context"; //$NON-NLS-1$
- public static final String SHARING_NEW_REPOSITORY_PAGE = PREFIX + "sharing_new_repository_page_context"; //$NON-NLS-1$
- public static final String SHARING_MODULE_PAGE = PREFIX + "sharing_module_page_context"; //$NON-NLS-1$
- public static final String SHARING_TAG_SELETION_PAGE = PREFIX + "sharing_tag_selection_page_context"; //$NON-NLS-1$
- public static final String SHARING_SYNC_PAGE = PREFIX + "sharing_sync_page_context"; //$NON-NLS-1$
-
- public static final String PATCH_SELECTION_PAGE = PREFIX + "patch_selection_page_context"; //$NON-NLS-1$
- public static final String PATCH_OPTIONS_PAGE = PREFIX + "patch_options_page_context"; //$NON-NLS-1$
-
- public static final String KEYWORD_SUBSTITUTION_PAGE = PREFIX + "keyword_substitution_page_context"; //$NON-NLS-1$
-
- public static final String MERGE_WIZARD_PAGE = PREFIX + "merge_wizard_page_context"; //$NON-NLS-1$
- public static final String MERGE_START_PAGE = PREFIX + "merge_start_page_context"; //$NON-NLS-1$
- public static final String MERGE_END_PAGE = PREFIX + "merge_end_page_context"; //$NON-NLS-1$
-
- public static final String CHECKOUT_MODULE_SELECTION_PAGE = PREFIX + "checkout_module_selection_context"; //$NON-NLS-1$
- public static final String CHECKOUT_CONFIGURATION_PAGE = PREFIX + "checkout_configuration_context"; //$NON-NLS-1$
- public static final String CHECKOUT_LOCATION_SELECTION_PAGE = PREFIX + "checkout_location_selection_context"; //$NON-NLS-1$
- public static final String CHECKOUT_PROJECT_SELECTION_PAGE = PREFIX + "checkout_into_resource_selection_page_context"; //$NON-NLS-1$
- public static final String CHECKOUT_TAG_SELETION_PAGE = PREFIX + "checkout_tag_selection_page_context"; //$NON-NLS-1$
-
- public static final String UPDATE_TAG_SELETION_PAGE = PREFIX + "update_tag_selection_page_context"; //$NON-NLS-1$
-
- public static final String RESTORE_FROM_REPOSITORY_FILE_SELECTION_PAGE = PREFIX + "restore_from_repository_file_selection_page_context"; //$NON-NLS-1$
- public static final String REFRESH_REMOTE_PROJECT_SELECTION_PAGE = PREFIX + "refresh_remote_project_selection_page_context"; //$NON-NLS-1$
-
- public static final String COMMIT_FILE_TYPES_PAGE = PREFIX + "commit_file_types_page_context"; //$NON-NLS-1$
- public static final String COMMIT_COMMENT_PAGE = PREFIX + "commit_comment_page_context"; //$NON-NLS-1$
-
- // Preference Pages
- public static final String PREF_DEBUG_PROTOCOL = PREFIX + "debug_protocol_pref"; //$NON-NLS-1$
- public static final String PREF_PRUNE = PREFIX + "prune_empty_directories_pref"; //$NON-NLS-1$
- public static final String PREF_QUIET = PREFIX + "quietness_level_pref"; //$NON-NLS-1$
- public static final String PREF_COMPRESSION = PREFIX + "compression_level_pref"; //$NON-NLS-1$
- public static final String PREF_KEYWORDMODE = PREFIX + "default_keywordmode_pref"; //$NON-NLS-1$
- public static final String PREF_LINEEND = PREFIX + "line_end_pref"; //$NON-NLS-1$
- public static final String PREF_COMMS_TIMEOUT = PREFIX + "comms_timeout_pref"; //$NON-NLS-1$
- public static final String PREF_CONSIDER_CONTENT = PREFIX + "consider_content_pref"; //$NON-NLS-1$
- public static final String PREF_REPLACE_DELETE_UNMANAGED = PREFIX + "replace_deletion_of_unmanaged_pref"; //$NON-NLS-1$
- public static final String PREF_SAVE_DIRTY_EDITORS = PREFIX + "save_dirty_editors_pref"; //$NON-NLS-1$
- public static final String PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS = PREFIX + "change_perspective_on_show_annotations"; //$NON-NLS-1$
- public static final String PREF_ALLOW_EMPTY_COMMIT_COMMENTS = PREFIX + "allow_empty_commit_comment"; //$NON-NLS-1$
- public static final String PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS = PREFIX + "show_annotations_perspective"; //$NON-NLS-1$
- public static final String PREF_INCLUDE_CHANGE_SETS_IN_COMMIT = PREFIX + "include_change_sets"; //$NON-NLS-1$
-
- public static final String PREF_TREAT_NEW_FILE_AS_BINARY = PREFIX + "treat_new_files_as_binary_pref"; //$NON-NLS-1$
- public static final String PREF_DETERMINE_SERVER_VERSION = PREFIX + "determine_server_version"; //$NON-NLS-1$
- public static final String PREF_CONFIRM_MOVE_TAG = PREFIX + "confirm_move_tag"; //$NON-NLS-1$
- public static final String PREF_AUTOREFRESH_TAG = PREFIX + "auto_refresh_tag"; //$NON-NLS-1$
-
- public static final String GENERAL_PREFERENCE_PAGE = PREFIX + "general_preference_page_context"; //$NON-NLS-1$
- public static final String CONSOLE_PREFERENCE_PAGE = PREFIX + "console_preference_page_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_PAGE = PREFIX + "ext_preference_page_context"; //$NON-NLS-1$
- public static final String SSH2_PREFERENCE_PAGE = PREFIX + "ssh2_preference_page_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_RSH = PREFIX + "ext_preference_rsh_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_PARAM = PREFIX + "ext_preference_param_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_SERVER = PREFIX + "ext_preference_server_context"; //$NON-NLS-1$
- public static final String DECORATORS_PREFERENCE_PAGE = PREFIX + "decorators_preference_page_context"; //$NON-NLS-1$
- public static final String WATCH_EDIT_PREFERENCE_PAGE = PREFIX + "watch_edit_preference_page_context"; //$NON-NLS-1$
- public static final String PASSWORD_MANAGEMENT_PAGE = PREFIX + "password_management_preference_page_context"; //$NON-NLS-1$
- public static final String COMPARE_PREFERENCE_PAGE = PREFIX + "cvs_compare_preference_page_context"; //$NON-NLS-1$
- public static final String PROXY_PREFERENCE_PAGE = PREFIX + "proxy_preference_page_context"; //$NON-NLS-1$
- public static final String COMMENT_TEMPLATE_PREFERENCE_PAGE = PREFIX + "comment_template_preference_page_context"; //$NON-NLS-1$
- public static final String UPDATE_MERGE_PREFERENCE_PAGE = PREFIX + "update_merge_preference_page_context"; //$NON-NLS-1$
-
- // Views
- public static final String CONSOLE_VIEW = PREFIX + "console_view_context"; //$NON-NLS-1$
- public static final String REPOSITORIES_VIEW = PREFIX + "repositories_view_context"; //$NON-NLS-1$
- public static final String RESOURCE_HISTORY_VIEW = PREFIX + "resource_history_view_context"; //$NON-NLS-1$
- public static final String COMPARE_REVISIONS_VIEW = PREFIX + "compare_revision_view_context"; //$NON-NLS-1$
-
- public static final String CVS_EDITORS_VIEW = PREFIX + "cvs_editors_view_context"; //$NON-NLS-1$
- public static final String ANNOTATE_VIEW = PREFIX + "annotate_view_context"; //$NON-NLS-1$
-
- // Viewers
- public static final String CATCHUP_RELEASE_VIEWER = PREFIX + "catchup_release_viewer_context"; //$NON-NLS-1$
-
- // Add to .cvsignore dialog
- public static final String ADD_TO_CVSIGNORE = PREFIX + "add_to_cvsignore_context"; //$NON-NLS-1$
-
- // Actions
- public static final String GET_ANNOTATE_ACTION = PREFIX + "get_annotate_action_context"; //$NON-NLS-1$
- public static final String GET_FILE_REVISION_ACTION = PREFIX + "get_file_revision_action_context"; //$NON-NLS-1$
- public static final String GET_FILE_CONTENTS_ACTION = PREFIX + "get_file_contents_action_context"; //$NON-NLS-1$
- public static final String TAG_WITH_EXISTING_ACTION = PREFIX + "tag_with_existing_action_context"; //$NON-NLS-1$
- public static final String NEW_REPOSITORY_LOCATION_ACTION = PREFIX + "new_repository_location_action_context"; //$NON-NLS-1$
- public static final String NEW_DEV_ECLIPSE_REPOSITORY_LOCATION_ACTION = PREFIX + "new_dev_eclipse repository_location_action_context"; //$NON-NLS-1$
- public static final String SHOW_COMMENT_IN_HISTORY_ACTION = PREFIX + "show_comment_in_history_action_context"; //$NON-NLS-1$
- public static final String SHOW_TAGS_IN_HISTORY_ACTION = PREFIX + "show_tag_in_history_action_context"; //$NON-NLS-1$
- public static final String SELECT_WORKING_SET_ACTION = PREFIX + "select_working_set_action_context"; //$NON-NLS-1$
- public static final String DESELECT_WORKING_SET_ACTION = PREFIX + "deselect_working_set_action_context"; //$NON-NLS-1$
- public static final String EDIT_WORKING_SET_ACTION = PREFIX + "edit_working_set_action_context"; //$NON-NLS-1$
- public static final String REMOVE_REPOSITORY_LOCATION_ACTION = PREFIX + "remove_root_action_context"; //$NON-NLS-1$
- public static final String SHOW_IN_RESOURCE_HISTORY = PREFIX + "show_in_history_action_context"; //$NON-NLS-1$
- public static final String SELECT_NEW_RESOURCES_ACTION = PREFIX + "select_new_action_context"; //$NON-NLS-1$
- public static final String CONFIRM_MERGE_ACTION = PREFIX + "confirm_merge_action_context"; //$NON-NLS-1$;
- public static final String DISCONNECT_ACTION = PREFIX + "disconnect_action_context"; //$NON-NLS-1$;
-
- // Sync view menu actions
- public static final String SYNC_COMMIT_ACTION = PREFIX + "sync_commit_action_context"; //$NON-NLS-1$
- public static final String SYNC_FORCED_COMMIT_ACTION = PREFIX + "sync_forced_commit_action_context"; //$NON-NLS-1$
- public static final String SYNC_UPDATE_ACTION = PREFIX + "sync_update_action_context"; //$NON-NLS-1$
- public static final String SYNC_FORCED_UPDATE_ACTION = PREFIX + "sync_forced_update_action_context"; //$NON-NLS-1$
- public static final String SYNC_ADD_ACTION = PREFIX + "sync_add_action_context"; //$NON-NLS-1$
- public static final String SYNC_IGNORE_ACTION = PREFIX + "sync_ignore_action_context"; //$NON-NLS-1$
- public static final String MERGE_UPDATE_ACTION = PREFIX + "merge_update_action_context"; //$NON-NLS-1$
- public static final String MERGE_FORCED_UPDATE_ACTION = PREFIX + "merge_forced_update_action_context"; //$NON-NLS-1$
- public static final String MERGE_UPDATE_WITH_JOIN_ACTION = PREFIX + "merge_update_with_joinaction_context"; //$NON-NLS-1$
-
- // properties pages
- public static final String REPOSITORY_LOCATION_PROPERTY_PAGE = PREFIX + "repository_location_property_page_context"; //$NON-NLS-1$
- public static final String REPOSITORY_ENCODING_PROPERTY_PAGE = PREFIX + "repository_encoding_property_page_context"; //$NON-NLS-1$
- public static final String PROJECT_PROPERTY_PAGE = PREFIX + "project_property_page_context"; //$NON-NLS-1$
- public static final String FOLDER_PROPERTY_PAGE = PREFIX + "folder_property_page_context"; //$NON-NLS-1$
- public static final String FILE_PROPERTY_PAGE = PREFIX + "file_property_page_context"; //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java
deleted file mode 100644
index f8fe388ef..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-public interface IRepositoryListener {
- public void repositoryAdded(ICVSRepositoryLocation root);
- public void repositoriesChanged(ICVSRepositoryLocation[] roots);
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
deleted file mode 100644
index 041b1e36a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.fieldassist.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.util.FileNameMatcher;
-import org.eclipse.ui.PlatformUI;
-
-public class IgnoreResourcesDialog extends TitleAreaDialog {
- // 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 int selectedAction;
- private String customPattern;
-
- // layout controls
- private static final int LABEL_INDENT_WIDTH = 32;
-
- /**
- * Image for title area
- */
- private Image dlgTitleImage = null;
-
- // to avoid an error/warning message at startup default values are as below
- private boolean resourceWithSpaces = false;
- private boolean allResourecesHaveExtensions = true;
- private boolean allResourcesWithSpacesHaveExtensions = true;
-
- /**
- * 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;
- }
-
- resourceWithSpaces = checkForResourcesWithSpaces();
- allResourecesHaveExtensions = checkIfAllResourcesHaveExtensions();
- allResourcesWithSpacesHaveExtensions = checkIfAllResourcesWithSpacesHaveExtensions();
- }
-
- /**
- * 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);
- newShell.setText(CVSUIMessages.IgnoreResourcesDialog_dialogTitle);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- dlgTitleImage = CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION).createImage();
- setTitleImage(dlgTitleImage);
- updateEnablements();
- setTitle(CVSUIMessages.IgnoreResourcesDialog_title);
- setErrorMessage(null);
- setDefaultMessage();
- return control;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite top = new Composite((Composite) super
- .createDialogArea(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);
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IHelpContextIds.ADD_TO_CVSIGNORE);
-
- Listener selectionListener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements();
- }
- };
- Listener modifyListener = new Listener() {
- public void handleEvent(Event event) {
- validate();
- }
- };
-
- addNameEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryButton);
- addNameEntryButton.addListener(SWT.Selection, selectionListener);
- addNameEntryButton.setSelection(selectedAction == ADD_NAME_ENTRY);
- Label addNameEntryLabel = createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryExample, LABEL_INDENT_WIDTH);
-
- addExtensionEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addExtensionEntryButton);
- addExtensionEntryButton.addListener(SWT.Selection, selectionListener);
- addExtensionEntryButton.setSelection(selectedAction == ADD_EXTENSION_ENTRY);
- Label addExtensionEntryLabel = createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addExtensionEntryExample, LABEL_INDENT_WIDTH);
-
- addCustomEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addCustomEntryButton);
- addCustomEntryButton.addListener(SWT.Selection, selectionListener);
- addCustomEntryButton.setSelection(selectedAction == ADD_CUSTOM_ENTRY);
- createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addCustomEntryExample, LABEL_INDENT_WIDTH);
-
- if (resourceWithSpaces) {
- customEntryText = createIndentedText(top, getResourceWithSpace()
- .getName().replaceAll(" ", "?"), LABEL_INDENT_WIDTH); //$NON-NLS-1$ //$NON-NLS-2$
- ControlDecoration customEntryTextDecoration = new ControlDecoration(
- customEntryText, SWT.TOP | SWT.LEAD);
- FieldDecorationRegistry registry = FieldDecorationRegistry
- .getDefault();
- FieldDecoration infoDecoration = registry
- .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
- customEntryTextDecoration.setImage(infoDecoration.getImage());
- customEntryTextDecoration
- .setDescriptionText(CVSUIMessages.IgnoreResourcesDialog_filesWithSpaceWarning);
- customEntryTextDecoration.setShowOnlyOnFocus(false);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalIndent = LABEL_INDENT_WIDTH
- + FieldDecorationRegistry.getDefault()
- .getMaximumDecorationWidth();
- customEntryText.setLayoutData(gridData);
- customEntryText.setFocus();
-
- addNameEntryButton.setEnabled(false);
- addNameEntryLabel.setEnabled(false);
- // switch selection to "Custom pattern"
- if (!addCustomEntryButton.getSelection()) {
- addNameEntryButton.setSelection(false);
- addCustomEntryButton.setSelection(true);
- selectedAction = ADD_CUSTOM_ENTRY;
- }
-
- // when there is at least one resource without extension with spaces
- // we should disable the "Wildcard extension" option
- if (!allResourcesWithSpacesHaveExtensions) {
- addExtensionEntryButton.setEnabled(false);
- addExtensionEntryLabel.setEnabled(false);
- // switch selection to "Custom pattern" which is always enabled
- addExtensionEntryButton.setSelection(false);
- addCustomEntryButton.setSelection(true);
- selectedAction = ADD_CUSTOM_ENTRY;
- }
-
- } else {
- customEntryText = createIndentedText(top, resources[0].getName(),
- LABEL_INDENT_WIDTH);
- }
-
- customEntryText.addListener(SWT.Modify, modifyListener);
-
- applyDialogFont(top);
-
- return top;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void okPressed() {
- settings.put(ACTION_KEY, selectedAction);
- super.okPressed();
- }
-
- private Label createIndentedLabel(Composite parent, String text, int indent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
- data.horizontalIndent = indent;
- label.setLayoutData(data);
- return label;
- }
-
- private Text createIndentedText(Composite parent, String text, int indent) {
- Text textbox = new Text(parent, SWT.BORDER);
- textbox.setText(text);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalIndent = indent;
- textbox.setLayoutData(data);
- return textbox;
- }
-
- private Button createRadioButton(Composite parent, String text) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(text);
- button.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL));
- return button;
- }
-
- private void updateEnablements() {
- if (addNameEntryButton.getSelection()) {
- selectedAction = ADD_NAME_ENTRY;
- } else if (addExtensionEntryButton.getSelection()) {
- selectedAction = ADD_EXTENSION_ENTRY;
- } else if (addCustomEntryButton.getSelection()) {
- selectedAction = ADD_CUSTOM_ENTRY;
- }
- customEntryText.setEnabled(selectedAction == ADD_CUSTOM_ENTRY);
- validate();
- }
-
- private void validate() {
- if (selectedAction == ADD_CUSTOM_ENTRY) {
- customPattern = customEntryText.getText();
- if (customPattern.length() == 0) {
- setError(CVSUIMessages.IgnoreResourcesDialog_patternMustNotBeEmpty);
- 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(NLS.bind(CVSUIMessages.IgnoreResourcesDialog_patternDoesNotMatchFile, new String[] { name }));
- return;
- }
- }
- if (resourceWithSpaces) {
- setWarning(CVSUIMessages.IgnoreResourcesDialog_filesWithSpaceWarningMessage);
- return;
- }
- } else if (selectedAction == ADD_EXTENSION_ENTRY && !allResourecesHaveExtensions) {
- setWarning(CVSUIMessages.IgnoreResourcesDialog_filesWithNoExtensionWarningMessage);
- return;
- }
- setError(null);
- }
-
- /**
- * Sets an error message on the dialog.
- *
- * @param text
- * A message to set. If <code>null</code> the error message
- * will be cleared.
- */
- private void setError(String text) {
- setErrorMessage(text);
- // set a non-error message
- if (text == null)
- setDefaultMessage();
- getButton(IDialogConstants.OK_ID).setEnabled(text == null);
- }
-
- private void setWarning(String text) {
- setError(null);
- setMessage(text, IMessageProvider.WARNING);
- }
-
- private void setDefaultMessage() {
- if (resources.length == 1) {
- setMessage(NLS.bind(
- CVSUIMessages.IgnoreResourcesDialog_messageSingle,
- new String[] { resources[0].getName() }));
- } else {
- setMessage(NLS.bind(
- CVSUIMessages.IgnoreResourcesDialog_messageMany,
- new String[] { Integer.toString(resources.length) }));
- }
- }
-
- /**
- * Check whether at least one of the given resources names contain a space.
- *
- * @param resources
- * Array of resources to check.
- * @return <code>true</code> if a resource filename containing space has
- * been found, <code>false</code> otherwise.
- */
- private boolean checkForResourcesWithSpaces() {
- return getResourceWithSpace() != null;
- }
-
- private IResource getResourceWithSpace() {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getName().indexOf(" ") != -1) //$NON-NLS-1$
- return resources[i];
- }
- return null;
- }
-
- private boolean checkIfAllResourcesWithSpacesHaveExtensions() {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getName().indexOf(" ") != -1 && resources[i].getFileExtension() == null) //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- private boolean checkIfAllResourcesHaveExtensions() {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getFileExtension() != null)
- return true;
- }
- // couldn't find a resource with an extension
- return false;
- }
-
- public boolean close() {
- if (dlgTitleImage != null) {
- dlgTitleImage.dispose();
- }
- return super.close();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java
deleted file mode 100644
index 68042de04..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atsuhiko Yamanaka, JCraft,Inc. - initial API and implementation.
- * IBM Corporation - ongoing maintenance
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.ITeamUIImages;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A dialog for keyboard-interactive authentication for the ssh2 connection.
- */
-public class KeyboardInteractiveDialog extends TrayDialog {
- // widgets
- private Text[] texts;
- protected Image keyLockImage;
- protected Button allowCachingButton;
- protected Text usernameField;
-
- protected String userName;
- protected String domain;
- protected String destination;
- protected String name;
- protected String instruction;
- protected String lang;
- protected String[] prompt;
- protected boolean[] echo;
- private String message;
- private String[] result;
- protected boolean allowCaching=false;
- private boolean cachingDialog=false;
-
- private boolean isPasswordAuth=false;
-
-
- /**
- * Creates a new KeyboardInteractiveDialog.
- *
- * @param parentShell the parent shell
- * @param destication the location
- * @param name the name
- * @param instruction the instruction
- * @param prompt the titles for text fields
- * @param echo '*' should be used or not
- */
- public KeyboardInteractiveDialog(Shell parentShell,
- String location,
- String destination,
- String name,
- String userName,
- String instruction,
- String[] prompt,
- boolean[] echo,
- boolean cachingDialog){
- super(parentShell);
- this.domain=location;
- this.destination=destination;
- this.name=name;
- this.userName=userName;
- this.instruction=instruction;
- this.prompt=prompt;
- this.echo=echo;
- this.cachingDialog=cachingDialog;
-
- this.message=NLS.bind(CVSUIMessages.KeyboradInteractiveDialog_message, new String[] { destination+(name!=null && name.length()>0 ? ": "+name : "") }); //NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$
-
- if(KeyboardInteractiveDialog.isPasswordAuth(prompt)){
- isPasswordAuth=true;
- }
- }
- /**
- * @see Window#configureShell
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- if (isPasswordAuth) {
- newShell.setText(CVSUIMessages.UserValidationDialog_required);
- } else {
- newShell.setText(message);
- }
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
- IHelpContextIds.KEYBOARD_INTERACTIVE_DIALOG);
- }
- /**
- * @see Window#create
- */
- public void create() {
- super.create();
-
- if (isPasswordAuth && usernameField != null && userName != null) {
- usernameField.setText(userName);
- usernameField.setEditable(false);
- }
-
- if (texts.length > 0) {
- texts[0].setFocus();
- }
- }
- /**
- * @see Dialog#createDialogArea
- */
- protected Control createDialogArea(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
-
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite imageComposite = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- imageComposite.setLayout(layout);
- imageComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- Composite main = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label imageLabel = new Label(imageComposite, SWT.NONE);
- keyLockImage = TeamImages
- .getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).createImage();
- imageLabel.setImage(keyLockImage);
- GridData data = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- imageLabel.setLayoutData(data);
-
- if (message != null) {
- Label messageLabel = new Label(main, SWT.WRAP);
- messageLabel.setText(message);
- data = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- data.widthHint = 300;
- messageLabel.setLayoutData(data);
- }
-
- if (domain != null) {
- Label d = new Label(main, SWT.WRAP);
- d.setText(CVSUIMessages.UserValidationDialog_5);
- data = new GridData();
- d.setLayoutData(data);
- Label label = new Label(main, SWT.WRAP);
-
- label.setText(NLS.bind(
- CVSUIMessages.UserValidationDialog_labelUser,
- new String[] { domain }));
-
- data = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = 300;
- label.setLayoutData(data);
- }
-
- if (instruction != null && instruction.length() > 0) {
- Label label = new Label(main, SWT.WRAP);
- label.setText(instruction);
- data = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- data.widthHint = 300;
- label.setLayoutData(data);
- }
-
- if (isPasswordAuth) {
- createUsernameFields(main);
- }
-
- createPasswordFields(main);
-
- if (cachingDialog && isPasswordAuth) {
- allowCachingButton = new Button(main, SWT.CHECK);
- allowCachingButton.setText(CVSUIMessages.UserValidationDialog_6);
- data = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
- Composite warningComposite = new Composite(main, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(getImage(DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_BEGINNING
- | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(CVSUIMessages.UserValidationDialog_7);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- warningText.setLayoutData(data);
- }
-
- Dialog.applyDialogFont(parent);
- return main;
- }
-
- /**
- * 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(CVSUIMessages.UserValidationDialog_user);
-
- usernameField=new Text(parent, SWT.BORDER);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan=2;
- data.widthHint=convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- usernameField.setLayoutData(data);
- }
-
- /**
- * Creates the widgets that represent the entry area.
- *
- * @param parent
- * the parent of the widgets
- */
- protected void createPasswordFields(Composite parent) {
- texts=new Text[prompt.length];
-
- for(int i=0; i<prompt.length; i++){
- new Label(parent, SWT.NONE).setText(prompt[i]);
- texts[i]=new Text(parent, SWT.BORDER|SWT.PASSWORD);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan=2;
- data.widthHint=convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- texts[i].setLayoutData(data);
- if(!echo[i]){
- texts[i].setEchoChar('*');
- }
- }
- }
- /**
- * Returns the entered values, or null
- * if the user canceled.
- *
- * @return the entered values
- */
- public String[] getResult() {
- return result;
- }
-
- /**
- * Returns <code>true</code> if the save password checkbox was selected.
- * @return <code>true</code> if the save password checkbox was selected and <code>false</code>
- * otherwise.
- */
- public boolean getAllowCaching(){
- return allowCaching;
- }
-
- /**
- * Notifies that the ok button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.OK</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- protected void okPressed() {
- result=new String[prompt.length];
- for(int i=0; i<texts.length; i++){
- result[i]=texts[i].getText();
- }
- super.okPressed();
- }
- /**
- * Notifies that the cancel button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.CANCEL</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- protected void cancelPressed() {
- result=null;
- super.cancelPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#close()
- */
- public boolean close(){
- if(keyLockImage!=null){
- keyLockImage.dispose();
- }
- return super.close();
- }
-
- /**
- * Guesses if this dialog is used for password authentication.
- * @param prompt prompts for keyboard-interactive authentication method.
- * @return <code>true</code> if this dialog is used for password authentication.
- */
- static boolean isPasswordAuth(String[] prompt) {
- return prompt != null && prompt.length == 1
- && prompt[0].trim().equalsIgnoreCase("password:"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java
deleted file mode 100644
index 94b1496dd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-
-/**
- * Reusable area that provides a list to select from and a select all and
- * deselect all button.
- */
-public class ListSelectionArea extends DialogArea {
- private Object inputElement;
- private IStructuredContentProvider contentProvider;
- private ILabelProvider labelProvider;
- private String message;
- private List initialSelections;
-
- // the visual selection widget group
- private CheckboxTableViewer listViewer;
-
- private Object[] previousCheckedElements;
-
- public static final String LIST_SELECTION = "ListSelection"; //$NON-NLS-1$
-
- /**
- * Constructor for ListSelectionArea.
- * @param parentDialog
- * @param settings
- */
- public ListSelectionArea(
- Object input,
- IStructuredContentProvider contentProvider,
- ILabelProvider labelProvider,
- String message) {
- this.inputElement = input;
- this.contentProvider = contentProvider;
- this.labelProvider = labelProvider;
- this.message = message;
- this.initialSelections = new ArrayList();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
-
- Dialog.applyDialogFont(parent);
-
- final Composite composite = createComposite(parent, 1, true);
-
- initializeDialogUnits(composite);
-
- if (message != null)
- createWrappingLabel(composite, message, 1);
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.heightHint = 0; // It will expand to the size of the wizard page!
- data.widthHint = 0;
- listViewer.getTable().setLayoutData(data);
-
- listViewer.setLabelProvider(labelProvider);
- listViewer.setContentProvider(contentProvider);
-
- listViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object[] checkedElements = getViewer().getCheckedElements();
- firePropertyChangeChange(LIST_SELECTION, previousCheckedElements, checkedElements);
- previousCheckedElements = checkedElements;
- }
- });
-
- addSelectionButtons(composite);
-
- initializeViewer();
-
- // initialize page
- if (!getInitialElementSelections().isEmpty())
- checkInitialSelections();
- }
-
- /**
- * Initializes this dialog's viewer after it has been laid out.
- */
- private void initializeViewer() {
- listViewer.setInput(inputElement);
- }
-
- /**
- * Visually checks the previously-specified elements in this dialog's list
- * viewer.
- */
- private void checkInitialSelections() {
- Iterator itemsToCheck = getInitialElementSelections().iterator();
-
- while (itemsToCheck.hasNext())
- listViewer.setChecked(itemsToCheck.next(),true);
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- buttonComposite.setLayout(new GridLayout(2, false));
- buttonComposite.setData(new GridData(SWT.END, SWT.BEGINNING, true, false));
-
- Button selectButton = createButton(buttonComposite, CVSUIMessages.ListSelectionArea_selectAll, GridData.HORIZONTAL_ALIGN_FILL);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
-
- Button deselectButton = createButton(buttonComposite, CVSUIMessages.ListSelectionArea_deselectAll, GridData.HORIZONTAL_ALIGN_FILL);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
-
- }
- };
- deselectButton.addSelectionListener(listener);
- }
-
- /**
- * Returns the list of initial element selections.
- * @return List
- */
- protected List getInitialElementSelections(){
- return initialSelections;
- }
-
- /**
- * Returns the listViewer.
- * @return CheckboxTableViewer
- */
- public CheckboxTableViewer getViewer() {
- return listViewer;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java
deleted file mode 100644
index 94810b931..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.*;
-
-public class PasswordManagementPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private TableViewer viewer;
- private Button removeButton;
- private Button removeAllButton;
-
- class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public String getColumnText(Object element, int columnIndex) {
- ICVSRepositoryLocation entry = (ICVSRepositoryLocation)element;
- switch (columnIndex) {
- case 0:
- return entry.toString();
- case 1:
- return entry.getUsername();
- default:
- return null;
- }
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- };
-
- public void init(IWorkbench workbench) {
- setDescription(CVSUIMessages.PasswordManagementPreferencePage_2);
- }
-
- /**
- * Creates preference page controls on demand.
- *
- * @param parent the parent for the preference page
- */
- protected Control createContents(Composite ancestor) {
-
- Composite parent = new Composite(ancestor, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- parent.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- parent.setLayoutData(data);
-
- viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- Table table = viewer.getTable();
- new TableEditor(table);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData gd = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(gd);
- table.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- handleSelection();
- }
- });
- // Create the table columns
- new TableColumn(table, SWT.NULL);
- new TableColumn(table, SWT.NULL);
- TableColumn[] columns = table.getColumns();
- columns[0].setText(CVSUIMessages.PasswordManagementPreferencePage_3);
- columns[1].setText(CVSUIMessages.PasswordManagementPreferencePage_4);
- viewer.setColumnProperties(new String[] {"location", "username"}); //$NON-NLS-1$ //$NON-NLS-2$
- viewer.setLabelProvider(new TableLabelProvider());
- viewer.setContentProvider(new IStructuredContentProvider() {
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public Object[] getElements(Object inputElement) {
- if (inputElement == null) return null;
- ICVSRepositoryLocation[] locations = ((KnownRepositories)inputElement).getRepositories();
- List repos = new ArrayList();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation l = locations[i];
- if(l.getUserInfoCached())
- repos.add(l);
- }
- return (ICVSRepositoryLocation[]) repos.toArray(new ICVSRepositoryLocation[repos.size()]);
- }
- });
- TableLayout tl = new TableLayout();
- Dialog.applyDialogFont(ancestor);
- PixelConverter converter = new PixelConverter(table);
- tl.addColumnData(new ColumnWeightData(70, converter.convertWidthInCharsToPixels(40)));
- tl.addColumnData(new ColumnWeightData(30, converter.convertWidthInCharsToPixels(12)));
- table.setLayout(tl);
-
- Composite buttons = new Composite(parent, SWT.NULL);
- buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
-
- removeButton = new Button(buttons, SWT.PUSH);
- removeButton.setText(CVSUIMessages.PasswordManagementPreferencePage_5);
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- remove();
- }
- });
- removeAllButton = new Button(buttons, SWT.PUSH);
- removeAllButton.setText(CVSUIMessages.PasswordManagementPreferencePage_6);
- removeAllButton.setEnabled(true);
- removeAllButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- removeAll();
- }
- });
-
- // Use the same size for the buttons and ensure they conform to the proper minimum size
- int buttonWidth = SWTUtils.calculateControlSize(SWTUtils.createDialogPixelConverter(parent), new Button [] { removeButton, removeAllButton });
- data = SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.END, SWT.CENTER, false, false);
- removeButton.setLayoutData(data);
- removeAllButton.setLayoutData(data);
-
- Dialog.applyDialogFont(ancestor);
- viewer.setInput(KnownRepositories.getInstance());
- handleSelection();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.PASSWORD_MANAGEMENT_PAGE);
-
- return parent;
- }
-
- public boolean performOk() {
- return true;
- }
-
- protected void performDefaults() {
- super.performDefaults();
- }
-
- private void remove() {
- IStructuredSelection s = (IStructuredSelection)viewer.getSelection();
- for (Iterator it = s.iterator(); it.hasNext();) {
- ICVSRepositoryLocation location = (ICVSRepositoryLocation) it.next();
- location.flushUserInfo();
- }
- viewer.refresh();
- handleSelection();
- }
-
- private void removeAll() {
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation l = locations[i];
- if(l.getUserInfoCached())
- l.flushUserInfo();
- }
- viewer.refresh();
- handleSelection();
- }
-
- private void handleSelection() {
- if (viewer.getTable().getSelectionCount() > 0) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
- removeAllButton.setEnabled(viewer.getTable().getItemCount() > 0);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
deleted file mode 100644
index be810b75f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-
-public class Policy {
-
- private static String ACTION_BUNDLE = "org.eclipse.team.internal.ccvs.ui.actions.actions"; //$NON-NLS-1$
- private static ResourceBundle actionBundle = null;
-
- public static boolean DEBUG_CONSOLE_BUFFERING = false;
-
- static {
- //init debug options
- if (CVSUIPlugin.getPlugin().isDebugging()) {
- DEBUG_CONSOLE_BUFFERING = "true".equalsIgnoreCase(Platform.getDebugOption(CVSUIPlugin.ID + "/consolebuffering")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Progress monitor helpers
- */
- public static void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled())
- cancelOperation();
- }
- public static void cancelOperation() {
- throw new OperationCanceledException();
- }
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
-
- public static IProgressMonitor infiniteSubMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new InfiniteSubProgressMonitor(monitor, ticks);
- }
-
- public static ResourceBundle getActionBundle() {
- ResourceBundle tmpBundle = actionBundle;
- if (tmpBundle != null)
- return tmpBundle;
- return actionBundle = ResourceBundle.getBundle(ACTION_BUNDLE);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
deleted file mode 100644
index 485ebe762..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-
-/**
- * Prompts the user for a multi-line comment for releasing to CVS.
- */
-public class ReleaseCommentDialog extends DetailsDialog {
-
- CommitCommentArea commitCommentArea;
- // dialogs settings that are persistent between workbench sessions
- private IDialogSettings settings;
-
- private static final int DEFAULT_WIDTH_IN_CHARS= 80;
-
- private static final String HEIGHT_KEY = "width-key"; //$NON-NLS-1$
- private static final String WIDTH_KEY = "height-key"; //$NON-NLS-1$
-
- /**
- * ReleaseCommentDialog constructor.
- *
- * @param parentShell the parent of this dialog
- * @param proposedComment
- */
- public ReleaseCommentDialog(Shell parentShell, IResource[] resourcesToCommit, String proposedComment, int depth) {
- super(parentShell, CVSUIMessages.ReleaseCommentDialog_title);
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.RESIZE | SWT.MAX);
- commitCommentArea = new CommitCommentArea();
- // Get a project from which the commit template can be obtained
- if (resourcesToCommit.length > 0)
- commitCommentArea.setProject(resourcesToCommit[0].getProject());
- commitCommentArea.setProposedComment(proposedComment);
-
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("ReleaseCommentDialog");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("ReleaseCommentDialog");//$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton()
- */
- protected boolean includeDetailsButton() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeErrorMessage()
- */
- protected boolean includeErrorMessage() {
- return false;
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- getShell().setText(CVSUIMessages.ReleaseCommentDialog_title);
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- commitCommentArea.createArea(composite);
- commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == CommitCommentArea.OK_REQUESTED)
- okPressed();
- }
- });
-
- Dialog.applyDialogFont(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IHelpContextIds.RELEASE_COMMENT_DIALOG;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#getInitialSize()
- */
- protected Point getInitialSize() {
- try {
- return new Point(settings.getInt(WIDTH_KEY), settings.getInt(HEIGHT_KEY));
- } catch(NumberFormatException e) {
- final Point size= super.getInitialSize();
- size.x= convertWidthInCharsToPixels(DEFAULT_WIDTH_IN_CHARS);
- size.y += convertHeightInCharsToPixels(8);
- return size;
- }
- }
-
- public String getComment() {
- return commitCommentArea.getComment(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#close()
- */
- public boolean close() {
- Rectangle bounds = getShell().getBounds();
- settings.put(HEIGHT_KEY, bounds.height);
- settings.put(WIDTH_KEY, bounds.width);
- return super.close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Control c = super.createContents(parent);
- commitCommentArea.setFocus();
- return c;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java
deleted file mode 100644
index bef9bb832..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public class RemoteAnnotationStorage extends PlatformObject implements IEncodedStorage {
-
- private InputStream contents;
- private ICVSRemoteFile file;
-
- public RemoteAnnotationStorage(ICVSRemoteFile file, InputStream contents) {
- this.file = file;
- this.contents = contents;
- }
-
- public InputStream getContents() throws CoreException {
- try {
- // Contents are a ByteArrayInputStream which can be reset to the beginning
- contents.reset();
- } catch (IOException e) {
- CVSUIPlugin.log(CVSException.wrapException(e));
- }
- return contents;
- }
-
- public String getCharset() throws CoreException {
- InputStream contents = getContents();
- try {
- String charSet = TeamPlugin.getCharset(getName(), contents);
- return charSet;
- } catch (IOException e) {
- throw new CVSException(new Status(IStatus.ERROR, CVSUIPlugin.ID, IResourceStatus.FAILED_DESCRIBING_CONTENTS, NLS.bind(CVSUIMessages.RemoteAnnotationStorage_1, (new String[] { getFullPath().toString() })), e));
- } finally {
- try {
- contents.close();
- } catch (IOException e1) {
- // Ignore
- }
- }
- }
-
- public IPath getFullPath() {
- ICVSRepositoryLocation location = file.getRepository();
- IPath path = new Path(null, location.getRootDirectory());
- path = path.setDevice(location.getHost() + IPath.DEVICE_SEPARATOR);
- // see bug 176809
- String revision = ""; //$NON-NLS-1$
- try {
- revision = ' ' + file.getRevision();
- } catch (TeamException e) {
- //ignore
- }
- path = path.append(file.getRepositoryRelativePath() + revision);
- return path;
- }
- public String getName() {
- return file.getName();
- }
- public boolean isReadOnly() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
deleted file mode 100644
index 61474b5bc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
-import org.eclipse.team.core.subscribers.ISubscriberChangeListener;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.editors.text.IStorageDocumentProvider;
-import org.eclipse.ui.ide.ResourceUtil;
-import org.eclipse.ui.texteditor.*;
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
-
-/**
- * A QuickDiff provider that provides a reference to the latest revision of a file
- * in the CVS repository. The provider notifies when the file's sync state changes
- * and the diff should be recalculated (e.g. commit, update...) or when the file
- * is changed (e.g. replace with).
- *
- * Here are the file states and what this provider does for each:
- *
- * 1. File is unmanaged : reference == empty document
- * 2. Unmanaged file transitions to managed : empty reference updated with new remote revision
- * 3. A managed file has new remote (commit, refresh remote) : reference updated with new
- * remote revision
- * 4. A managed file cleaned, remote is the same (replace with, update) : refresh diff bar
- * with existing reference
- *
- * [Note: Currently an empty document must be returned for an unmanaged file. This
- * results in the entire document appearing as outgoing changes in the quickdiff bar.
- * This is required because the quickdiff support relies on IDocument change events
- * to update the quickdiff, and returning null for the reference document doesn't
- * allow the transition to later return a IDocument.]
- *
- * @since 3.0
- */
-public class RemoteRevisionQuickDiffProvider implements IQuickDiffReferenceProvider {
- // The editor showing this quickdiff and provides access to the editor input and
- // ultimatly the IFile.
- private ITextEditor fEditor = null;
-
- // The document containing the remote file. Can be null if the assigned editor doesn't have
- // a CVS remote resource associated with it.
- private IDocument fReference = null;
-
- // Will be true when the document has been read and initialized.
- private boolean fReferenceInitialized = false;
-
- // Document provider allows us to register/deregister the element state change listener.
- private IDocumentProvider fDocumentProvider = null;
-
- // Unique id for this reference provider as set via setId().
- private String fId;
-
- // A handle to the remote CVS file for this provider.
- private SyncInfo fLastSyncState;
-
- // Job that re-creates the reference document.
- private Job fUpdateJob;
-
- private boolean DEBUG = false;
-
- /**
- * Updates the document if a sync changes occurs to the associated CVS file.
- */
- private ISubscriberChangeListener teamChangeListener = new ISubscriberChangeListener() {
- public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- if(fReferenceInitialized) {
- for (int i = 0; i < deltas.length; i++) {
- ISubscriberChangeEvent delta = deltas[i];
- IResource resource = delta.getResource();
- if(resource.getType() == IResource.FILE &&
- fLastSyncState != null && resource.equals(fLastSyncState.getLocal())) {
- if(delta.getFlags() == ISubscriberChangeEvent.SYNC_CHANGED) {
- fetchContentsInJob();
- }
- }
- }
- }
- }
- };
-
- /**
- * Updates the document if the document is changed (e.g. replace with)
- */
- private IElementStateListener documentListener = new IElementStateListener() {
- public void elementDirtyStateChanged(Object element, boolean isDirty) {
- }
-
- public void elementContentAboutToBeReplaced(Object element) {
- }
-
- public void elementContentReplaced(Object element) {
- if(fEditor != null && fEditor.getEditorInput() == element) {
- fetchContentsInJob();
- }
- }
-
- public void elementDeleted(Object element) {
- }
-
- public void elementMoved(Object originalElement, Object movedElement) {
- }
- };
-
- /*
- * @see org.eclipse.test.quickdiff.DocumentLineDiffer.IQuickDiffReferenceProvider#getReference()
- */
- public IDocument getReference(IProgressMonitor monitor) throws CoreException {
- if(! fReferenceInitialized) return null;
- if (fReference == null) {
- readDocument(monitor);
- }
- return fReference;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.quickdiff.IQuickDiffProviderImplementation#setActiveEditor(org.eclipse.ui.texteditor.ITextEditor)
- */
- public void setActiveEditor(ITextEditor targetEditor) {
- IEditorInput editorInput = targetEditor.getEditorInput();
- if (editorInput == null || ResourceUtil.getFile(editorInput) == null) return;
- fEditor = targetEditor;
- fDocumentProvider= fEditor.getDocumentProvider();
-
- if(fDocumentProvider != null) {
- CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().addListener(teamChangeListener);
- fDocumentProvider.addElementStateListener(documentListener);
- }
- fReferenceInitialized= true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.quickdiff.IQuickDiffProviderImplementation#isEnabled()
- */
- public boolean isEnabled() {
- if (! fReferenceInitialized)
- return false;
- try {
- return getManagedCVSFile() != null;
- } catch (CVSException e) {
- return false;
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.diff.DocumentLineDiffer.IQuickDiffReferenceProvider#dispose()
- */
- public void dispose() {
- fReferenceInitialized = false;
- // stop update job
- if(fUpdateJob != null && fUpdateJob.getState() != Job.NONE) {
- fUpdateJob.cancel();
- }
-
- // remove listeners
- if(fDocumentProvider != null) {
- fDocumentProvider.removeElementStateListener(documentListener);
- }
- CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().removeListener(teamChangeListener);
- }
-
- /*
- * @see org.eclipse.quickdiff.QuickDiffTestPlugin.IQuickDiffProviderImplementation#setId(java.lang.String)
- */
- public void setId(String id) {
- fId= id;
- }
-
- /*
- * @see org.eclipse.jface.text.source.diff.DocumentLineDiffer.IQuickDiffReferenceProvider#getId()
- */
- public String getId() {
- return fId;
- }
-
- /**
- * Determine if the file represented by this quickdiff provider has changed with
- * respect to it's remote state. Return true if the remote contents should be
- * refreshed, and false if not.
- */
- private boolean computeChange(IProgressMonitor monitor) throws TeamException {
- boolean needToUpdateReferenceDocument = false;
- if(fReferenceInitialized) {
- SyncInfo info = getSyncState(getFileFromEditor());
- if(info == null && fLastSyncState != null) {
- return true;
- } else if(info == null) {
- return false;
- }
-
- if(fLastSyncState == null) {
- needToUpdateReferenceDocument = true;
- } else if(! fLastSyncState.equals(info)) {
- needToUpdateReferenceDocument = true;
- }
- if(DEBUG) debug(fLastSyncState, info);
- fLastSyncState = info;
- }
- return needToUpdateReferenceDocument;
- }
-
- private void debug(SyncInfo lastSyncState, SyncInfo info) {
- String last = "[none]"; //$NON-NLS-1$
- if(lastSyncState != null) {
- last = lastSyncState.toString();
- }
- System.out.println("+ CVSQuickDiff: was " + last + " is " + info.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private SyncInfo getSyncState(IResource resource) throws TeamException {
- if (resource == null) return null;
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().getSyncInfo(resource);
- }
-
- /**
- * Creates a document and initializes it with the contents of a CVS remote
- * resource.
- * @param monitor the progress monitor
- * @throws CoreException
- */
- private void readDocument(IProgressMonitor monitor) throws CoreException {
- if(! fReferenceInitialized) return;
- if(fReference == null)
- fReference = new Document();
- if(computeChange(monitor)) {
- ICVSRemoteFile remoteFile = (ICVSRemoteFile)fLastSyncState.getRemote();
- if (fLastSyncState.getRemote() != null && fDocumentProvider instanceof IStorageDocumentProvider) {
- IStorageDocumentProvider provider= (IStorageDocumentProvider) fDocumentProvider;
- String encoding= provider.getEncoding(fEditor.getEditorInput());
- if (encoding == null) {
- encoding= provider.getDefaultEncoding();
- }
- if(monitor.isCanceled()) return;
- InputStream stream= remoteFile.getContents(monitor);
- if (stream == null || monitor.isCanceled() || ! fReferenceInitialized) {
- return;
- }
- setDocumentContent(fReference, stream, encoding);
- } else {
- // the remote is null, so ensure that the document is null
- if(monitor.isCanceled()) return;
- fReference.set(""); //$NON-NLS-1$
- }
- if(DEBUG) System.out.println("+ CVSQuickDiff: updating document " + (fReference!=null ? "remote found" : "remote empty")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Intitializes the given document with the given stream using the given encoding.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @param encoding the character encoding for reading the given stream
- * @exception CoreException if the given stream can not be read
- */
- private static void setDocumentContent(IDocument document, InputStream contentStream, String encoding) throws CoreException {
- Reader in= null;
- try {
- final int DEFAULT_FILE_SIZE= 15 * 1024;
-
- in= new BufferedReader(new InputStreamReader(contentStream, encoding), DEFAULT_FILE_SIZE);
- CharArrayWriter caw= new CharArrayWriter(DEFAULT_FILE_SIZE);
- char[] readBuffer= new char[2048];
- int n= in.read(readBuffer);
- while (n > 0) {
- caw.write(readBuffer, 0, n);
- n= in.read(readBuffer);
- }
- document.set(caw.toString());
- //System.out.println("+ CVSQuickDiff: updating document : " + caw.toString());
- } catch (IOException x) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, CVSUIMessages.RemoteRevisionQuickDiffProvider_readingFile, x);
- throw new CVSException(status);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, CVSUIMessages.RemoteRevisionQuickDiffProvider_closingFile, x);
- throw new CVSException(status);
- }
- }
- }
- }
-
- /**
- * Returns the ICVSFile associated with he active editor or <code>null</code>
- * if the provider doesn't not have access to a CVS managed file.
- * @return the handle to a CVS file
- */
- private ICVSFile getManagedCVSFile() throws CVSException {
- if(fEditor != null) {
- IFile file = getFileFromEditor();
- if(file != null && CVSWorkspaceRoot.isSharedWithCVS(file)) {
- return CVSWorkspaceRoot.getCVSFileFor(file);
- }
- }
- return null;
- }
-
- private IFile getFileFromEditor() {
- if(fEditor != null) {
- IEditorInput input= fEditor.getEditorInput();
- if (input != null) {
- IFile file = ResourceUtil.getFile(input);
- return file;
- }
- }
- return null;
- }
-
- /**
- * Runs a job that updates the document. If a previous job is already running it
- * is stopped before the new job can start.
- */
- private void fetchContentsInJob() {
- if(! fReferenceInitialized) return;
- if(fUpdateJob != null && fUpdateJob.getState() != Job.NONE) {
- fUpdateJob.cancel();
- }
- fUpdateJob = new Job(CVSUIMessages.RemoteRevisionQuickDiffProvider_fetchingFile) {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- readDocument(monitor);
- } catch (CoreException e) {
- // continue and return ok for now. The error will be reported
- // when the quick diff supports calls getReference() again.
- // continue
- }
- return Status.OK_STATUS;
- }
- };
- fUpdateJob.schedule();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java
deleted file mode 100644
index 51d6b4e4f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-public class ResizableWizardDialog extends WizardDialog {
- /**
- * Creates a new resizable wizard dialog.
- */
- public ResizableWizardDialog(Shell parent, IWizard wizard) {
- super(parent, wizard);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
deleted file mode 100644
index aadea21b8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.IEncodedStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-
-/**
- * A class for comparing ICVSRemoteResource objects
- */
-public class ResourceEditionNode implements IStructureComparator, ITypedElement, IEncodedStreamContentAccessor {
- private ICVSRemoteResource resource;
- private ResourceEditionNode[] children;
-
- /**
- * Creates a new ResourceEditionNode on the given resource edition.
- */
- public ResourceEditionNode(ICVSRemoteResource resourceEdition) {
- this.resource = resourceEdition;
- }
-
- /**
- * Returns true if both resources names are identical.
- * The content is not considered.
- * @see IComparator#equals
- */
- public boolean equals(Object other) {
- if (other instanceof ITypedElement) {
- String otherName = ((ITypedElement)other).getName();
- return getName().equals(otherName);
- }
- return super.equals(other);
- }
-
- /**
- * Enumerate children of this node (if any).
- */
- public Object[] getChildren() {
- if (children == null) {
- children = new ResourceEditionNode[0];
- if (resource != null) {
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSRemoteResource[] members = resource.members(monitor);
- children = new ResourceEditionNode[members.length];
- for (int i = 0; i < members.length; i++) {
- children[i] = new ResourceEditionNode(members[i]);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- // operation canceled
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- CVSUIPlugin.log(((TeamException) t));
- }
- }
- }
- }
- return children;
- }
-
- /**
- * @see IStreamContentAccessor#getContents()
- */
- public InputStream getContents() throws CoreException {
- IStorage storage = getStorage();
- if (storage != null) {
- return storage.getContents();
- }
- return new ByteArrayInputStream(new byte[0]);
- }
-
- public Image getImage() {
- return CompareUI.getImage(resource);
- }
-
- /**
- * Returns the name of this node.
- */
- public String getName() {
- return resource == null ? "" : resource.getName(); //$NON-NLS-1$
- }
-
- public ICVSRemoteResource getRemoteResource() {
- return resource;
- }
-
- /**
- * Returns the comparison type for this node.
- */
- public String getType() {
- if (resource == null) {
- return UNKNOWN_TYPE;
- }
- if (resource.isContainer()) {
- return FOLDER_TYPE;
- }
- String name = resource.getName();
- name = name.substring(name.lastIndexOf('.') + 1);
- return name.length() == 0 ? UNKNOWN_TYPE : name;
- }
-
- /**
- * @see IComparator#equals
- */
- public int hashCode() {
- return getName().hashCode();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
- */
- public String getCharset() throws CoreException {
- // Use the local file encoding if there is one
- IResource local = resource.getIResource();
- if (local != null && local.getType() == IResource.FILE) {
- return ((IFile)local).getCharset();
- }
- // See if the remote file has an encoding
- IStorage storage = getStorage();
- if (storage instanceof IEncodedStorage) {
- String charset = ((IEncodedStorage)storage).getCharset();
- if (charset != null) {
- return charset;
- }
- }
- return null;
- }
-
- private IStorage getStorage() throws TeamException {
- if (resource == null) {
- return null;
- }
- final IStorage[] holder = new IStorage[1];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- holder[0] = ((IResourceVariant)resource).getStorage(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- throw TeamException.asTeamException(e);
- } catch (InterruptedException e) {
- // Shouldn't happen. Ignore
- }
- return holder[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
deleted file mode 100644
index 05de2824f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * A property page which displays the CVS-specific properties for the
- * selected resource.
- */
-public class ResourcePropertiesPage extends PropertyPage {
- // The resource to show properties for
- IResource resource;
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- try {
- IResource resource = getSelectedElement();
- if (resource != null) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!cvsResource.isManaged()) {
- createPair(composite, CVSUIMessages.ResourcePropertiesPage_status, CVSUIMessages.ResourcePropertiesPage_notManaged); //
- } 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, CVSUIMessages.ResourcePropertiesPage_status, hasRemote ? CVSUIMessages.ResourcePropertiesPage_versioned : CVSUIMessages.ResourcePropertiesPage_notVersioned); //
- }
- }
- } catch (TeamException e) {
- createPair(composite, CVSUIMessages.ResourcePropertiesPage_error, e.getMessage());
- }
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Creates a key-value property pair in the given parent.
- *
- * @param parent the parent for the labels
- * @param left the string for the left label
- * @param right the string for the right label
- */
- protected void createPair(Composite parent, String left, String right) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(left);
-
- label = new Label(parent, SWT.NONE);
- label.setText(right);
- label.setToolTipText(right);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- /**
- * Returns the element selected when the properties was run
- *
- * @return the selected element
- */
- protected IResource getSelectedElement() {
- // get the resource that is the source of this property page
- IResource resource = null;
- IAdaptable element = getElement();
- if (element instanceof IResource) {
- resource = (IResource)element;
- } else {
- Object adapter = element.getAdapter(IResource.class);
- if (adapter instanceof IResource) {
- resource = (IResource)adapter;
- }
- }
- return resource;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
deleted file mode 100644
index 8c5586959..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.*;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-//import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class SelectionPropertyTester extends PropertyTester {
-
- /**
- *
- */
- public SelectionPropertyTester() {
- // TODO Auto-generated constructor stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
- * java.lang.String, java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
-
- // only 'isEnabled' property is allowed at the moment
- if (property == null || !property.equals("isEnabled")) { //$NON-NLS-1$
- return false;
- }
-
- if (!(receiver instanceof ISelection)) {
- return false;
- }
-
- if (args == null || args.length != 1) {
- return false;
- }
-
- Object obj = receiver;
- if (obj instanceof IStructuredSelection) {
- obj = ((IStructuredSelection) receiver).getFirstElement();
- }
-
- if (obj == null) {
- return false;
- }
-
- Object invoke;
- try {
- Class clazz = Class.forName((String) args[0]);
- Object instance = clazz.newInstance();
-
-// Field fld = clazz.getDeclaredField(SELECTION_FIELDNAME);
-// fld.set(instance, (ISelection) receiver);
-// ((TeamAction) instance).selectionChanged((IAction)instance,
- // called only to set the selection
- ((TeamAction) instance).selectionChanged(null,
- (ISelection) receiver);
-
- Method method = findMethod(clazz, property);
- if (method != null) {
- invoke = method.invoke(instance, null);
- return ((Boolean) invoke).booleanValue();
- }
- } catch (IllegalArgumentException e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, null, e));
- } catch (IllegalAccessException e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, null, e));
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, null, e));
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, null, e.getTargetException()));
- } catch (ClassNotFoundException e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, null, e));
- } catch (Exception e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, null, e));
- }
- return false;
- }
-
- private static Method findMethod(Class clazz, String method)
- throws Exception {
- Method[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(method))
- return methods[i];
- }
- return null;
- }
-}
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 c79a9b3b9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.viewers.*;
-
-/**
- * A default content provider to prevent subclasses from
- * having to implement methods they don't need.
- */
-public class SimpleContentProvider implements IStructuredContentProvider {
-
- /**
- * SimpleContentProvider constructor.
- */
- public SimpleContentProvider() {
- super();
- }
-
- /*
- * @see SimpleContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /*
- * @see SimpleContentProvider#getElements()
- */
- public Object[] getElements(Object element) {
- return new Object[0];
- }
-
- /*
- * @see SimpleContentProvider#inputChanged()
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java
deleted file mode 100644
index 54e3b5b20..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.ui.texteditor.IUpdate;
-
-public class TextViewerAction extends Action implements IUpdate {
- private int operationCode = -1;
- private ITextOperationTarget operationTarget;
-
- public TextViewerAction(ITextViewer viewer, int operationCode) {
- this.operationCode = operationCode;
- operationTarget = viewer.getTextOperationTarget();
- update();
- }
- public void update() {
- boolean wasEnabled = isEnabled();
- boolean isEnabled = (operationTarget != null && operationTarget.canDoOperation(operationCode));
- setEnabled(isEnabled);
- if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
- }
- }
- public void run() {
- if (operationCode != -1 && operationTarget != null) {
- operationTarget.doOperation(operationCode);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UpdateMergePreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UpdateMergePreferencePage.java
deleted file mode 100644
index f44b68bce..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UpdateMergePreferencePage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
-
-public class UpdateMergePreferencePage extends CVSFieldEditorPreferencePage {
-
- private RadioGroupFieldEditor updateStyle;
- private RadioGroupFieldEditor updatePreviewStyle;
-
- protected String getPageHelpContextId() {
- return IHelpContextIds.UPDATE_MERGE_PREFERENCE_PAGE;
- }
-
- protected String getPageDescription() {
- return null;
- }
-
- protected void createFieldEditors() {
-
- updateStyle = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_UPDATE_HANDLING,
- CVSUIMessages.WorkInProgressPage_0,
- 1,
- new String[][] {
- new String[] {CVSUIMessages.WorkInProgressPage_1, ICVSUIConstants.PREF_UPDATE_HANDLING_PREVIEW},
- new String[] {CVSUIMessages.WorkInProgressPage_2, ICVSUIConstants.PREF_UPDATE_HANDLING_PERFORM},
- new String[] {CVSUIMessages.UpdateMergePreferencePage_0, ICVSUIConstants.PREF_UPDATE_HANDLING_TRADITIONAL}
- },
- getFieldEditorParent(),
- true);
- addField(updateStyle);
-
- updatePreviewStyle = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_UPDATE_PREVIEW,
- CVSUIMessages.UpdateMergePreferencePage_1,
- 1,
- new String[][] {
- new String[] {CVSUIMessages.UpdateMergePreferencePage_2, ICVSUIConstants.PREF_UPDATE_PREVIEW_IN_DIALOG},
- new String[] {CVSUIMessages.UpdateMergePreferencePage_3, ICVSUIConstants.PREF_UPDATE_PREVIEW_IN_SYNCVIEW}
- },
- getFieldEditorParent(),
- true);
- addField(updatePreviewStyle);
-
- // TODO: Add option for sync and compare to use old or new (add to sync compare page)
-
- }
-
-}
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 d4cf852ab..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.ITeamUIImages;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A dialog for prompting for a user name and password
- */
-public class UserValidationDialog extends TrayDialog {
- // widgets
- protected Text usernameField;
- protected Text passwordField;
- protected Button allowCachingButton;
-
- protected String domain;
- protected String defaultUsername;
- protected String password = null;
- protected boolean allowCaching = false;
- protected Image keyLockImage;
-
- // whether or not the user name can be changed
- protected boolean isUsernameMutable = true;
- protected String username = null;
- protected String message = null;
- boolean cachingCheckbox=true;
-
- /**
- * Creates a new UserValidationDialog.
- *
- * @param parentShell the parent shell
- * @param location the location
- * @param defaultName the default user name
- * @param message a message to display to the user
- */
- public UserValidationDialog(Shell parentShell, String location, String defaultName, String message) {
- this(parentShell, location, defaultName, message, true);
- }
-
- /**
- * Creates a new UserValidationDialog.
- *
- * @param parentShell the parent shell
- * @param location the location
- * @param defaultName the default user name
- * @param message a message to display to the user
- * @param cachingCheckbox a flag to show the allowCachingButton
- */
- public UserValidationDialog(Shell parentShell, String location, String defaultName, String message, boolean cachingCheckbox) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- this.defaultUsername = defaultName;
- this.domain = location;
- this.message = message;
- this.cachingCheckbox=cachingCheckbox;
- }
-
- /**
- * @see Window#configureShell
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(CVSUIMessages.UserValidationDialog_required);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().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 user name field
- usernameField.selectAll();
- usernameField.setFocus();
- } else {
- usernameField.setEditable(false);
- passwordField.setFocus();
- }
- }
-
- /**
- * @see Dialog#createDialogArea
- */
- protected Control createDialogArea(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
-
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite imageComposite = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- imageComposite.setLayout(layout);
- imageComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- Composite main = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label imageLabel = new Label(imageComposite, SWT.NONE);
- keyLockImage = TeamImages.getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).createImage();
- imageLabel.setImage(keyLockImage);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- imageLabel.setLayoutData(data);
-
- if (message != null) {
- Label messageLabel = new Label(main, SWT.WRAP);
- messageLabel.setText(message);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- data.widthHint = 300;
- messageLabel.setLayoutData(data);
- }
- if (domain != null) {
- Label d = new Label(main, SWT.WRAP);
- d.setText(CVSUIMessages.UserValidationDialog_5);
- data = new GridData();
- d.setLayoutData(data);
- Label label = new Label(main, SWT.WRAP);
- if (isUsernameMutable) {
- label.setText(NLS.bind(CVSUIMessages.UserValidationDialog_labelUser, new String[] { domain }));
- } else {
- label.setText(NLS.bind(CVSUIMessages.UserValidationDialog_labelPassword, (new Object[]{defaultUsername, domain})));
- }
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = 300;
- label.setLayoutData(data);
- }
- createUsernameFields(main);
- createPasswordFields(main);
-
- if(cachingCheckbox && domain != null) {
- allowCachingButton = new Button(main, SWT.CHECK);
- allowCachingButton.setText(CVSUIMessages.UserValidationDialog_6);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
- Composite warningComposite = new Composite(main, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(getImage(DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(CVSUIMessages.UserValidationDialog_7);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- warningText.setLayoutData(data);
- }
-
- Dialog.applyDialogFont(parent);
-
- 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(CVSUIMessages.UserValidationDialog_password);
-
- passwordField = new Text(parent, SWT.BORDER | SWT.PASSWORD);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- passwordField.setLayoutData(data);
- }
- /**
- * Creates the three widgets that represent the user name entry area.
- *
- * @param parent the parent of the widgets
- */
- protected void createUsernameFields(Composite parent) {
- new Label(parent, SWT.NONE).setText(CVSUIMessages.UserValidationDialog_user);
-
- usernameField = new Text(parent, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- usernameField.setLayoutData(data);
- }
-
- /**
- * Returns the password entered by the user, or null
- * if the user canceled.
- *
- * @return the entered password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * Returns the user name entered by the user, or null
- * if the user canceled.
- *
- * @return the entered user name
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * Returns <code>true</code> if the save password checkbox was selected.
- * @return <code>true</code> if the save password checkbox was selected and <code>false</code>
- * otherwise.
- */
- public boolean getAllowCaching() {
- return allowCaching;
- }
-
- /**
- * Notifies that the ok button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.OK</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- protected void okPressed() {
- password = passwordField.getText();
- username = usernameField.getText();
-
- super.okPressed();
- }
- /**
- * Sets whether or not the user name field should be mutable.
- * This method must be called before create(), otherwise it
- * will be ignored.
- *
- * @param value whether the user name is mutable
- */
- public void setUsernameMutable(boolean value) {
- isUsernameMutable = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#close()
- */
- public boolean close() {
- if(keyLockImage != null) {
- keyLockImage.dispose();
- }
- return super.close();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
deleted file mode 100644
index b634070c9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Collator to compare two CVS revisions
- */
-public class VersionCollator {
- public int compare(String revision1, String revision2) {
- if (revision1 == null && revision2 == null) return 0;
- if (revision1 == null) return -1;
- if (revision2 == null) return 1;
- int[] revision1Segments = getIntSegments(revision1);
- int[] revision2Segments = getIntSegments(revision2);
- for (int i = 0; i < revision1Segments.length && i < revision2Segments.length; i++) {
- int i1 = revision1Segments[i];
- int i2 = revision2Segments[i];
- if (i1 != i2) {
- return i1 > i2 ? 1 : -1;
- }
- }
- if (revision1Segments.length != revision2Segments.length) {
- return revision1Segments.length > revision2Segments.length ? 1 : -1;
- }
- return 0;
- }
-
- int[] getIntSegments(String string) {
- int size = string.length();
- if (size == 0) return new int[0];
- StringBuffer buffer = new StringBuffer();
- List list = new ArrayList();
- for (int i = 0; i < size; i++) {
- char ch = string.charAt(i);
- if (ch == '.') {
- list.add(new Integer(buffer.toString()));
- buffer = new StringBuffer();
- } else {
- buffer.append(ch);
- }
- }
- list.add(new Integer(buffer.toString()));
- int[] result = new int[list.size()];
- Iterator it = list.iterator();
- for (int i = 0; i < result.length; i++) {
- result[i] = ((Integer)it.next()).intValue();
- }
- return result;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
deleted file mode 100644
index f9229c9cd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-
-/**
- * This page contains preferences related to the cvs watch/edit commands
- */
-public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage {
-
- private RadioGroupFieldEditor promptEditor;
- private RadioGroupFieldEditor updateEditor;
- private RadioGroupFieldEditor actionEditor;
- private IPreferenceStore store;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageHelpContextId()
- */
- protected String getPageHelpContextId() {
- return IHelpContextIds.WATCH_EDIT_PREFERENCE_PAGE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription()
- */
- protected String getPageDescription() {
- return CVSUIMessages.WatchEditPreferencePage_description; //;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_CHECKOUT_READ_ONLY,
- CVSUIMessages.WatchEditPreferencePage_checkoutReadOnly,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_ENABLE_WATCH_ON_EDIT,
- CVSUIMessages.WatchEditPreferencePage_0,
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
-
- actionEditor = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_EDIT_ACTION,
- CVSUIMessages.WatchEditPreferencePage_validateEditSaveAction,
- 1,
- new String[][] {{CVSUIMessages.WatchEditPreferencePage_edit, ICVSUIConstants.PREF_EDIT_PROMPT_EDIT},
- {CVSUIMessages.WatchEditPreferencePage_editInBackground, ICVSUIConstants.PREF_EDIT_IN_BACKGROUND},
- {CVSUIMessages.WatchEditPreferencePage_highjack, ICVSUIConstants.PREF_EDIT_PROMPT_HIGHJACK},
- }, //
- getFieldEditorParent(), true);
- addField(actionEditor);
-
- promptEditor = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_EDIT_PROMPT,
- CVSUIMessages.WatchEditPreferencePage_editPrompt,
- 1,
- new String[][] {{CVSUIMessages.WatchEditPreferencePage_alwaysPrompt, ICVSUIConstants.PREF_EDIT_PROMPT_ALWAYS},
- {CVSUIMessages.WatchEditPreferencePage_onlyPrompt, ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS},
- {CVSUIMessages.WatchEditPreferencePage_neverPrompt, ICVSUIConstants.PREF_EDIT_PROMPT_NEVER},
- }, //
- getFieldEditorParent(), true);
-
- updateEditor = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_UPDATE_PROMPT,
- CVSUIMessages.WatchEditPreferencePage_updatePrompt,
- 1,
- new String[][] {{CVSUIMessages.WatchEditPreferencePage_autoUpdate, ICVSUIConstants.PREF_UPDATE_PROMPT_AUTO},
- {CVSUIMessages.WatchEditPreferencePage_promptUpdate, ICVSUIConstants.PREF_UPDATE_PROMPT_IF_OUTDATED},
- {CVSUIMessages.WatchEditPreferencePage_neverUpdate, ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER},
- }, //
- getFieldEditorParent(), true);
-
- store = getCVSPreferenceStore();
- addField(promptEditor);
- addField(updateEditor);
- }
-
- private boolean isEditEnabled() {
- return store.getString(ICVSUIConstants.PREF_EDIT_ACTION).equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences()
- */
- protected void pushPreferences() {
- store = getCVSPreferenceStore();
- Preferences target = CVSProviderPlugin.getPlugin().getPluginPreferences();
- target.setValue(
- CVSProviderPlugin.READ_ONLY,
- store.getBoolean(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY));
- target.setValue(
- CVSProviderPlugin.ENABLE_WATCH_ON_EDIT,
- store.getBoolean(ICVSUIConstants.PREF_ENABLE_WATCH_ON_EDIT));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getSource() == actionEditor) {
- boolean enabled = event.getNewValue().equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT);
- promptEditor.setEnabled(enabled, getFieldEditorParent());
- updateEditor.setEnabled(enabled, getFieldEditorParent());
- }
- super.propertyChange(event);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize()
- */
- protected void initialize() {
- super.initialize();
- promptEditor.setEnabled(isEditEnabled(), getFieldEditorParent());
- updateEditor.setEnabled(isEditEnabled(), getFieldEditorParent());
- }
-}
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 f28cc5a59..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Atsuhiko Yamanaka, JCraft,Inc. - implementation of promptForKeyboradInteractive
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.*;
-import org.eclipse.team.internal.ccvs.core.*;
-
-/**
- * An authenticator that prompts the user for authentication info,
- * and stores the results in the Platform's authentication key-ring.
- */
-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;
- IStringMapping[] mappings = Team.getFileContentManager().getExtensionMappings();
- for (int i = 0; i < mappings.length; i++) {
- if (mappings[i].getString().equals("notes")) { //$NON-NLS-1$
- USE_ALTERNATE_PROMPTER = true;
- return;
- }
- }
- USE_ALTERNATE_PROMPTER = false;
- }
- /**
- * @see IUserAuthenticator#authenticateUser
- */
- public void promptForUserInfo(final ICVSRepositoryLocation location, final IUserInfo userinfo, final String message) throws CVSException {
- if (!userinfo.isUsernameMutable() && USE_ALTERNATE_PROMPTER) {
- alternatePromptForUserInfo(userinfo);
- return;
- }
- // ask the user for a password
- final String[] result = new String[2];
- Display display = Display.getCurrent();
- final boolean allowCaching[] = {false};
- if (display != null) {
- allowCaching[0] = promptForPassword(location, userinfo.getUsername(), message, userinfo.isUsernameMutable(), result);
- } else {
- // sync exec in default thread
- final CVSException[] exception = new CVSException[] { null };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- allowCaching[0] = promptForPassword(location, userinfo.getUsername(), message, userinfo.isUsernameMutable(), result);
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- }
-
- if (result[0] == null) {
- throw new OperationCanceledException(CVSUIMessages.WorkbenchUserAuthenticator_cancelled);
- }
-
- if (userinfo.isUsernameMutable()) {
- userinfo.setUsername(result[0]);
-
- }
- userinfo.setPassword(result[1]);
-
- if(location != null) {
- if (userinfo.isUsernameMutable()) {
- location.setUsername(result[0]);
- }
- location.setPassword(result[1]);
- location.setAllowCaching(allowCaching[0]);
- }
- }
-
- /**
- * Asks the user to enter a password. Places the
- * results in the supplied string[]. result[0] must
- * contain the username, result[1] must contain the password.
- * If the user canceled, both values must be zero.
- *
- * @param location the location to obtain the password for
- * @param username the username
- * @param message a message to display to the user
- * @param userMutable whether the user can be changed in the dialog
- * @param result a String array of length two in which to put the result
- * @throws CVSException
- */
- private boolean promptForPassword(final ICVSRepositoryLocation location, final String username, final String message, final boolean userMutable, final String[] result) throws CVSException {
- String domain = location == null ? null : location.getLocation(true);
- boolean cachingCheckbox=true;
-
- if(location != null && location.getMethod().getName().equals("pserverssh2")){ //$NON-NLS-1$
- /**
- * If this method 'promptForPassword' is invoked for ssh2 connection,
- * we want to disable the checkbox for password caching, because it will
- * overwrite the password for pserver with the password for ssh2.
- *
- * In pserverssh2 connection type, its location name will be like
- * pserverssh2:pserver_username@ssh2_username@ssh2_host@pserver_host
- *
- * The problem is that there is not a method to know if we are invoked from ssh2 or pserver.
- * The following code will guess that if 'username' is equals to 'ssh2_userver' we are from ssh2,
- * but if 'pserver2_username' is equals to 'ssh2_username', this guess will not be correct.
- */
- String host = location.getHost(); // ssh2_username@ssh2_host@pserver_host
- int index = host.indexOf("@"); //$NON-NLS-1$
- if (index != -1) {
- cachingCheckbox = false;
- if (index != 0) {
- if (!username.equals(host.substring(0, index))) {
- cachingCheckbox = true;
- }
- }
- }
- }
-
- UserValidationDialog dialog = new UserValidationDialog(null, domain, (username==null)?"":username, message, cachingCheckbox);//$NON-NLS-1$
- dialog.setUsernameMutable(userMutable);
- dialog.open();
- result[0] = dialog.getUsername();
- result[1] = dialog.getPassword();
- return dialog.getAllowCaching();
- }
-
- /**
- * Asks the user to enter values.
- *
- * @param location the location to obtain the password for
- * @param destication the location
- * @param name the name
- * @param instruction the instruction
- * @param prompt the titles for text fields
- * @param echo '*' should be used or not
- * @param result the entered values, or null if user canceled.
- */
- public String[] promptForKeyboradInteractive(final ICVSRepositoryLocation location,
- final String destination,
- final String name,
- final String instruction,
- final String[] prompt,
- final boolean[] echo) throws CVSException {
- final String[][] result = new String[1][];
- final boolean[] allowCaching=new boolean[1];
- Display display = Display.getCurrent();
- if (display != null) {
- result[0]=_promptForUserInteractive(location, destination, name, instruction, prompt, echo, allowCaching);
- }
- else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0]=_promptForUserInteractive(location, destination, name, instruction, prompt, echo, allowCaching);
- }
- });
- }
- if (result[0] != null && location != null &&
- KeyboardInteractiveDialog.isPasswordAuth(prompt)) {
- location.setPassword(result[0][0]);
- location.setAllowCaching(allowCaching[0]);
- }
- return result[0];
- }
-
- private String[] _promptForUserInteractive(final ICVSRepositoryLocation location,
- final String destination,
- final String name,
- final String instruction,
- final String[] prompt,
- final boolean[] echo,
- final boolean[] allowCaching) {
-
- String domain = location == null ? null : location.getLocation(true);
- String userName = location == null ? null : location.getUsername();
- boolean cachingCheckbox=true;
-
- if (location != null
- && location.getMethod().getName().equals("pserverssh2")) { //$NON-NLS-1$
- /**
- * We want to disable the checkbox for password caching, because it will
- * overwrite the password for pserver with the password for ssh2.
- *
- * In pserverssh2 connection type, its location name will be like
- * pserverssh2:pserver_username@ssh2_username@ssh2_host@pserver_host
- *
- * 'userName' is 'pserver_username', so we also have to change it to 'ssh2_username'.
- */
- String host = location.getHost(); // ssh2_username@ssh2_host@pserver_host
- int index = host.indexOf("@"); //$NON-NLS-1$
- if (index != -1) {
- if (index != 0) {
- userName = host.substring(0, index);
- }
- cachingCheckbox = false;
- }
- }
-
- KeyboardInteractiveDialog dialog = new KeyboardInteractiveDialog(null,
- domain,
- destination,
- name,
- userName,
- instruction,
- prompt,
- echo,
- cachingCheckbox);
- dialog.open();
- String[] _result=dialog.getResult();
- if(_result!=null)
- allowCaching[0]=dialog.getAllowCaching();
- return _result;
- }
-
- /**
- * Special alternate prompting. Returns the password. Username must be fixed.
- */
- private String alternatePromptForPassword(final String username) {
- AlternateUserValidationDialog dialog = new AlternateUserValidationDialog(null, (username == null) ? "" : username); //$NON-NLS-1$
- dialog.setUsername(username);
- int result = dialog.open();
- if (result == Window.CANCEL) return null;
- return dialog.getPassword();
- }
-
- /**
- * Special alternate prompting.
- */
- public void alternatePromptForUserInfo(final IUserInfo userinfo) {
- // ask the user for a password
- final String[] result = new String[1];
- Display display = Display.getCurrent();
- if (display != null) {
- result[0] = alternatePromptForPassword(userinfo.getUsername());
- } else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0] = alternatePromptForPassword(userinfo.getUsername());
- }
- });
- }
-
- if (result[0] == null) {
- throw new OperationCanceledException(CVSUIMessages.WorkbenchUserAuthenticator_The_operation_was_canceled_by_the_user_1);
- }
-
- userinfo.setPassword(result[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IUserAuthenticator#prompt(org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, int, java.lang.String, java.lang.String, int[], int)
- */
- public int prompt(final ICVSRepositoryLocation location, final int promptType, final String title, final String message, final int[] promptResponses, final int defaultResponse) {
- final Display display = CVSUIPlugin.getStandardDisplay();
- final int[] retval = new int[1];
- final String[] buttons = new String[promptResponses.length];
- for (int i = 0; i < promptResponses.length; i++) {
- int prompt = promptResponses[i];
- switch(prompt) {
- case IUserAuthenticator.OK_ID: buttons[i] = IDialogConstants.OK_LABEL; break;
- case IUserAuthenticator.CANCEL_ID: buttons[i] = IDialogConstants.CANCEL_LABEL; break;
- case IUserAuthenticator.NO_ID: buttons[i] = IDialogConstants.NO_LABEL; break;
- case IUserAuthenticator.YES_ID: buttons[i] = IDialogConstants.YES_LABEL; break;
- }
- }
-
- display.syncExec(new Runnable() {
- public void run() {
- final MessageDialog dialog = new MessageDialog(
- new Shell(display),
- title,
- null /* title image */,
- NLS.bind(CVSUIMessages.WorkbenchUserAuthenticator_0, message, location.getLocation(true)),
- promptType,
- buttons,
- 1
- );
- retval[0] = dialog.open();
- }
- });
- return retval[0];
- }
-
- public boolean promptForHostKeyChange(final ICVSRepositoryLocation location) {
- final boolean[] openConfirm = new boolean[] { false };
- final Display display = CVSUIPlugin.getStandardDisplay();
- display.syncExec(new Runnable() {
- public void run() {
- openConfirm[0] = MessageDialog.openConfirm(null, CVSUIMessages.WorkbenchUserAuthenticator_1, NLS.bind(CVSUIMessages.WorkbenchUserAuthenticator_2, new String[] { location.getHost() })); //
- }
- });
- if (!openConfirm[0]) {
- throw new OperationCanceledException();
- }
- return openConfirm[0];
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.internal.ccvs.core.IUserAuthenticator#promptToConfigureRepositoryLocations(java.util.Map)
- */
- public Map promptToConfigureRepositoryLocations(final Map alternativeMap) {
- final Map[] result = new Map[1];
- Display display = Display.getCurrent();
- if (display != null) {
- result[0] = openAlternativeRepositoryDialog(alternativeMap);
- } else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0] = openAlternativeRepositoryDialog(alternativeMap);
- }
- });
- }
- return result[0];
- }
-
- /**
- * Opens the Alternative Repository Selection dialog.
- *
- * @param alternativeMap
- * @return a map with selected repositories to use or <code>null</code>
- * when canceled.
- */
- private Map openAlternativeRepositoryDialog(Map alternativeMap) {
- ConfigureRepositoryLocationsDialog dialog = new ConfigureRepositoryLocationsDialog(
- null, alternativeMap);
- int result = dialog.open();
- return result == IDialogConstants.CANCEL_ID ? null : dialog
- .getSelected();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
deleted file mode 100644
index dad742453..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-
-/**
- * @author Administrator
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class WorkingSetSelectionArea extends DialogArea {
-
- private Button noWorkingSetButton;
- private Button workingSetButton;
- private Combo mruList;
- private Button selectButton;
- private IWorkingSet workingSet, oldWorkingSet;
-
- private String noWorkingSetText;
- private String workingSetText;
-
- private static final String USE_WORKING_SET = "UseWorkingSet"; //$NON-NLS-1$
- public static final String SELECTED_WORKING_SET = "SelectedWorkingSet"; //$NON-NLS-1$
-
- /*
- * Used to update the mru list box when working sets are
- * renamed in the working set selection dialog.
- */
- private IPropertyChangeListener workingSetChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- Object newValue = event.getNewValue();
-
- if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) &&
- newValue instanceof IWorkingSet) {
- String newName = ((IWorkingSet) newValue).getName();
- int count = mruList.getItemCount();
- for (int i = 0; i < count; i++) {
- String item = mruList.getItem(i);
- IWorkingSet workingSet = (IWorkingSet) mruList.getData(item);
- if (workingSet == newValue) {
- boolean isTopItem = (mruList.getData(mruList.getText()) == workingSet);
- mruList.remove(i);
- mruList.add(newName, i);
- mruList.setData(newName, workingSet);
- if (isTopItem) {
- mruList.setText(newName);
- }
- break;
- }
- }
- }
- }
- };
- private final IDialogSettings settings;
- private final Shell shell;
-
- public WorkingSetSelectionArea(Shell shell, String noWorkingSetText, String workingSetText, IDialogSettings settings) {
- this.shell = shell;
- this.noWorkingSetText = noWorkingSetText;
- this.workingSetText = workingSetText;
- this.settings = settings;
- }
-
- /**
- * Overrides method in Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
- public void createArea(Composite parent) {
- Dialog.applyDialogFont(parent);
- final Composite composite = createComposite(parent, 2, false);
- initializeDialogUnits(composite);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- // Create the checkbox to enable/disable working set use
- noWorkingSetButton = createRadioButton(composite, noWorkingSetText, 2);
- workingSetButton = createRadioButton(composite, workingSetText, 2);
- workingSetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleWorkingSetButtonSelection();
- }
- });
-
- boolean useWorkingSet = false;
- if (settings != null) {
- useWorkingSet = settings.getBoolean(USE_WORKING_SET);
- }
- noWorkingSetButton.setSelection(!useWorkingSet);
- workingSetButton.setSelection(useWorkingSet);
-
- // Create the combo/button which allows working set selection
- mruList = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
- data.horizontalIndent= 15;
- mruList.setLayoutData(data);
-
- selectButton = createButton(composite, CVSUIMessages.WorkingSetSelectionArea_workingSetOther, GridData.HORIZONTAL_ALIGN_FILL);
- selectButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleWorkingSetSelection();
- }
- });
-
- initializeMru();
- initializeWorkingSet();
-
- mruList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleMruSelection();
- }
- });
- }
-
- /**
- * Method handleMruSelection.
- */
- private void handleMruSelection() {
- String selectedWorkingSet = mruList.getText();
- oldWorkingSet = workingSet;
- workingSet = (IWorkingSet) mruList.getData(selectedWorkingSet);
- if (settings != null)
- settings.put(SELECTED_WORKING_SET, selectedWorkingSet);
- handleWorkingSetChange();
- }
-
- /**
- * Opens the working set selection dialog if the "Other..." item
- * is selected in the most recently used working set list.
- */
- private void handleWorkingSetSelection() {
- IWorkingSetSelectionDialog dialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, false);
- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.getWorkingSet(mruList.getText());
-
- if (workingSet != null) {
- dialog.setSelection(new IWorkingSet[]{workingSet});
- }
- // add a change listener to detect a working set name change
- workingSetManager.addPropertyChangeListener(workingSetChangeListener);
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- workingSet = result[0];
- String workingSetName = workingSet.getName();
- if (mruList.indexOf(workingSetName) != -1) {
- mruList.remove(workingSetName);
- }
- mruList.add(workingSetName, 0);
- mruList.setText(workingSetName);
- mruList.setData(workingSetName, workingSet);
- handleMruSelection();
- }
- else {
- workingSet = null;
- }
- // remove deleted working sets from the mru list box
- String[] mruNames = mruList.getItems();
- for (int i = 0; i < mruNames.length; i++) {
- if (workingSetManager.getWorkingSet(mruNames[i]) == null) {
- mruList.remove(mruNames[i]);
- }
- }
- }
- workingSetManager.removePropertyChangeListener(workingSetChangeListener);
- }
-
- /**
- * Sets the enabled state of the most recently used working set list
- * based on the checked state of the working set check box.
- */
- private void handleWorkingSetButtonSelection() {
- boolean useWorkingSet = workingSetButton.getSelection();
- if (settings != null)
- settings.put(USE_WORKING_SET, useWorkingSet);
- mruList.setEnabled(useWorkingSet);
- selectButton.setEnabled(useWorkingSet);
- if (useWorkingSet && mruList.getSelectionIndex() >= 0) {
- handleMruSelection();
- } else if (!useWorkingSet) {
- handleDeselection();
- }
- }
-
- private void handleDeselection() {
- oldWorkingSet = workingSet;
- workingSet = null;
- handleWorkingSetChange();
- }
-
- private void handleWorkingSetChange() {
- firePropertyChangeChange(SELECTED_WORKING_SET, oldWorkingSet, workingSet);
- }
-
- /**
- * Populates the most recently used working set list with MRU items from
- * the working set manager as well as adds an item to enable selection of
- * a working set not in the MRU list.
- */
- private void initializeMru() {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
-
- for (int i = 0; i < workingSets.length; i++) {
- String workingSetName = workingSets[i].getName();
- mruList.add(workingSetName);
- mruList.setData(workingSetName, workingSets[i]);
- }
- if (workingSets.length > 0) {
- mruList.setText(workingSets[0].getName());
- }
- }
-
- /**
- * Initializes the state of the working set part of the dialog.
- */
- private void initializeWorkingSet() {
- if (workingSet == null && settings != null && settings.getBoolean(USE_WORKING_SET)) {
- IWorkingSet mruSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(settings.get(SELECTED_WORKING_SET));
- if (mruSet != null) {
- // the call to setWorkingSet will re-invoke the initializeWorkingSet method
- setWorkingSet(mruSet);
- return;
- }
- }
- workingSetButton.setSelection(workingSet != null);
- handleWorkingSetButtonSelection();
- if (workingSet != null && mruList.indexOf(workingSet.getName()) != -1) {
- mruList.setText(workingSet.getName());
- }
- handleWorkingSetChange();
- }
-
- /**
- * Sets the working set that should be selected in the most recently
- * used working set list.
- *
- * @param workingSet the working set that should be selected.
- * has to exist in the list returned by
- * org.eclipse.ui.IWorkingSetManager#getRecentWorkingSets().
- * Must not be null.
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- oldWorkingSet = this.workingSet;
- this.workingSet = workingSet;
-
- if (workingSetButton != null && mruList != null) {
- initializeWorkingSet();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
deleted file mode 100644
index 0ecdde471..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.*;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-
-/**
- * A simple XML writer.
- */
-public class XMLWriter extends PrintWriter {
- protected int tab;
-
- /* constants */
- protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
-
-public XMLWriter(OutputStream output) throws UnsupportedEncodingException {
- super(new OutputStreamWriter(output, "UTF8")); //$NON-NLS-1$
- tab = 0;
- println(XML_VERSION);
-}
-public void endTag(String name) {
- tab--;
- printTag('/' + name, null);
-}
-public void printSimpleTag(String name, Object value) {
- if (value != null) {
- printTag(name, null, true, false);
- print(getEscaped(String.valueOf(value)));
- printTag('/' + name, null, false, true);
- }
-}
-public void printTabulation() {
- for (int i = 0; i < tab; i++)
- super.print('\t');
-}
-private void printTag(String name, HashMap parameters) {
- printTag(name, parameters, true, true);
-}
-private void printTag(String name, HashMap parameters, boolean tab, boolean newLine) {
- printTag(name, parameters, tab, newLine, false);
-}
-private void printTag(String name, HashMap parameters, boolean tab, boolean newLine, boolean end) {
- StringBuffer sb = new StringBuffer();
- sb.append("<"); //$NON-NLS-1$
- sb.append(name);
- if (parameters != null)
- for (Enumeration e = Collections.enumeration(parameters.keySet()); e.hasMoreElements();) {
- sb.append(" "); //$NON-NLS-1$
- String key = (String) e.nextElement();
- sb.append(key);
- sb.append("=\""); //$NON-NLS-1$
- sb.append(getEscaped(String.valueOf(parameters.get(key))));
- sb.append("\""); //$NON-NLS-1$
- }
- if (end)
- sb.append('/');
- sb.append(">"); //$NON-NLS-1$
- if (tab)
- printTabulation();
- if (newLine)
- println(sb.toString());
- else
- print(sb.toString());
-}
-public void startTag(String name, HashMap parameters) {
- startTag(name, parameters, true);
-}
-public void startTag(String name, HashMap parameters, boolean newLine) {
- printTag(name, parameters, true, newLine);
- tab++;
-}
-public void startAndEndTag(String name, HashMap parameters, boolean newLine) {
- printTag(name, parameters, true, true, true);
-}
-private static void appendEscapedChar(StringBuffer buffer, char c) {
- String replacement = getReplacement(c);
- if (replacement != null) {
- buffer.append('&');
- buffer.append(replacement);
- buffer.append(';');
- } else {
- buffer.append(c);
- }
-}
-public static String getEscaped(String s) {
- StringBuffer result = new StringBuffer(s.length() + 10);
- for (int i = 0; i < s.length(); ++i)
- appendEscapedChar(result, s.charAt(i));
- return result.toString();
-}
-private static String getReplacement(char c) {
- // Encode special XML characters into the equivalent character references.
- // These five are defined by default for all XML documents.
- switch (c) {
- case '<' :
- return "lt"; //$NON-NLS-1$
- case '>' :
- return "gt"; //$NON-NLS-1$
- case '"' :
- return "quot"; //$NON-NLS-1$
- case '\'' :
- return "apos"; //$NON-NLS-1$
- case '&' :
- return "amp"; //$NON-NLS-1$
- }
- return null;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
deleted file mode 100644
index 6dbec651c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.operations.AddOperation;
-import org.eclipse.team.internal.ccvs.ui.wizards.AddWizard;
-
-/**
- * AddAction performs a 'cvs add' command on the selected resources. If a
- * container is selected, its children are recursively added.
- */
-public class AddAction extends WorkspaceTraversalAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- if (!promptForAddOfIgnored()) return;
- if (!promptForAdd()) return;
- AddOperation op = new AddOperation(getTargetPart(), getCVSResourceMappings());
- AddWizard.run(getShell(), op);
- }
-
- /*
- * Prompt the user to avoid accidental adding a resource to version control
- */
- private boolean promptForAdd() {
- return MessageDialog.openQuestion(getShell(),
- CVSUIMessages.AddAction_confirmAddingResourcesTitle,
- CVSUIMessages.AddAction_confirmAddingResourcesMessage);
- }
-
- /*
- * Prompt whether explicitly selected ignored resources should be added
- */
- private boolean promptForAddOfIgnored() {
- // Prompt if any of the traversal roots are ignored
- // TODO: What about non-root resources that are part of the model but would be ignored?
- IResource[] resources = getSelectedResourcesWithOverlap();
- boolean prompt = false;
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = getCVSResourceFor(resources[i]);
- try {
- if (resource.isIgnored()) {
- prompt = true;
- break;
- }
- } catch (CVSException e) {
- handle(e);
- }
- }
- if (prompt) {
- return MessageDialog.openQuestion(getShell(), CVSUIMessages.AddAction_addIgnoredTitle, CVSUIMessages.AddAction_addIgnoredQuestion); //
- }
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForManagedResources()
- */
- protected boolean isEnabledForManagedResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForIgnoredResources()
- */
- protected boolean isEnabledForIgnoredResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- // Add to version control should never be enabled for linked resources
- IResource resource = cvsResource.getIResource();
- if (resource.isLinked()) return false;
- return super.isEnabledForCVSResource(cvsResource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_ADD;
- }
-}
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 731afce9c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.operations.BranchOperation;
-
-/**
- * BranchAction tags the selected resources with a branch tag specified by the user,
- * and optionally updates the local resources to point to the new branch.
- */
-public class BranchAction extends WorkspaceTraversalAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ResourceMapping[] resourceMappings = getCVSResourceMappings();
- if (resourceMappings == null || resourceMappings.length == 0) {
- // Could be a sync element tat is selected
- IResource[] resources = getSelectedResources();
- resourceMappings = getResourceMappings(resources);
- }
- if (resourceMappings == null || resourceMappings.length == 0) {
- // Nothing is select so just return
- return;
- }
- new BranchOperation(getTargetPart(), resourceMappings).run();
- }
-
- private ResourceMapping[] getResourceMappings(IResource[] resources) {
- List mappings = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- Object o = getAdapter(resource, ResourceMapping.class);
- if (o instanceof ResourceMapping) {
- ResourceMapping mapping = (ResourceMapping) o;
- mappings.add(mapping);
- }
- }
- return (ResourceMapping[]) mappings.toArray(new ResourceMapping[mappings.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_BRANCH;
- }
-}
-
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 12924b7bb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ /dev/null
@@ -1,646 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.commands.*;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.RetargetAction;
-import org.eclipse.ui.ide.IDE;
-
-/**
- * CVSAction is the common superclass for all CVS actions. It provides
- * facilities for enablement handling, standard error handling, selection
- * retrieval and prompting.
- */
-abstract public class CVSAction extends TeamAction implements IEditorActionDelegate {
-
- private List accumulatedStatus = new ArrayList();
- private RetargetAction retargetAction;
- private IAction action;
-
- public CVSAction() {
- super();
- }
-
- /**
- * Initializes a retarget action that will listen to part changes and allow parts to
- * override this action's behavior. The retarget action is used if this
- * action is shown in a top-level menu or toolbar.
- * @param window the workbench window showing this action
- * @since 3.1
- */
- private void initializeRetargetAction(IWorkbenchWindow window) {
- // Don't need to specify a the title because it will use this actions
- // title instead.
- retargetAction = new RetargetAction(getId(), ""); //$NON-NLS-1$
- retargetAction.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IAction.ENABLED)) {
- Object val = event.getNewValue();
- if (val instanceof Boolean && action != null) {
- action.setEnabled(((Boolean) val).booleanValue());
- }
- } else if (event.getProperty().equals(IAction.CHECKED)) {
- Object val = event.getNewValue();
- if (val instanceof Boolean && action != null) {
- action.setChecked(((Boolean) val).booleanValue());
- }
- } else if (event.getProperty().equals(IAction.TEXT)) {
- Object val = event.getNewValue();
- if (val instanceof String && action != null) {
- action.setText((String) val);
- }
- } else if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
- Object val = event.getNewValue();
- if (val instanceof String && action != null) {
- action.setToolTipText((String) val);
- }
- } else if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)) {
- if(action != null && retargetAction != null) {
- action.setEnabled(retargetAction.isEnabled());
- }
- }
- }
- });
- window.getPartService().addPartListener(retargetAction);
- IWorkbenchPart activePart = window.getPartService().getActivePart();
- if (activePart != null)
- retargetAction.partActivated(activePart);
- }
-
- /**
- * Common run method for all CVS actions.
- */
- final public void run(IAction action) {
- try {
- if (!beginExecution(action)) return;
- // If the action has been replaced by another handler, then
- // call that one instead.
- if(retargetAction != null && retargetAction.getActionHandler() != null) {
- retargetAction.run();
- } else {
- execute(action);
- }
- endExecution();
- } catch (InvocationTargetException e) {
- // Handle the exception and any accumulated errors
- handle(e);
- } catch (InterruptedException e) {
- // Show any problems that have occurred so far
- handle(null);
- } catch (TeamException e) {
- // Handle the exception and any accumulated errors
- handle(e);
- }
- }
-
- /**
- * Return the command and retarget action id for this action. This is used to
- *match retargetable actions and allow key bindings.
- *
- * @return the id for this action
- * @since 3.1
- */
- public String getId() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Called when this action is added to a top-level menu or toolbar (e.g. IWorkbenchWindowDelegate)
- * @since 3.1
- */
- public void init(IWorkbenchWindow window) {
- super.init(window);
- initializeRetargetAction(window);
- }
-
- public boolean isEnabled() {
- if(retargetAction != null && retargetAction.getActionHandler() != null) {
- return retargetAction.isEnabled();
- }
- // don't know so let subclasses decide
- return false;
- }
-
- public void dispose() {
- super.dispose();
- IWorkbenchWindow window = getWindow();
- if (window != null) {
- IPartService partService = window.getPartService();
- if (partService != null)
- partService.removePartListener(retargetAction);
- }
-
- if(retargetAction != null) {
- retargetAction.dispose();
- retargetAction = null;
- }
- }
-
- public void selectionChanged(final IAction action, ISelection selection) {
- if (selection instanceof TextSelection) {
- // Since we have a text selection, we will assume that the target is the active editor.
- // Look for the active editor and see it adapts to ResourceMapping or IResource.
- // See bug 132176
- IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (part != null) {
- IEditorInput input = part.getEditorInput();
- ResourceMapping mapping = Utils.getResourceMapping(input);
- if (mapping != null) {
- selection = new StructuredSelection(mapping);
- } else {
- IResource resource = Utils.getResource(input);
- if (resource != null) {
- selection = new StructuredSelection(resource);
- }
- }
- }
- }
- super.selectionChanged(action, selection);
- this.action = action;
- }
-
- protected void setActionEnablement(IAction action) {
- if(retargetAction != null && retargetAction.getActionHandler() != null) {
- action.setEnabled(retargetAction.isEnabled());
- } else {
- super.setActionEnablement(action);
- }
- }
-
- /**
- * This method gets invoked before the <code>CVSAction#execute(IAction)</code>
- * method. It can perform any prechecking and initialization required before
- * the action is executed. Subclasses may override but must invoke this
- * inherited method to ensure proper initialization of this superclass is performed.
- * These included preparation to accumulate IStatus and checking for dirty editors.
- */
- protected boolean beginExecution(IAction action) throws TeamException {
- accumulatedStatus.clear();
- if(needsToSaveDirtyEditors()) {
- if(!saveAllEditors()) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * This method gets invoked after <code>CVSAction#execute(IAction)</code>
- * if no exception occurred. Subclasses may override but should invoke this
- * inherited method to ensure proper handling of any accumulated IStatus.
- */
- protected void endExecution() throws TeamException {
- if ( ! accumulatedStatus.isEmpty()) {
- handle(null);
- }
- }
-
- /**
- * Add a status to the list of accumulated status.
- * These will be provided to method handle(Exception, IStatus[])
- * when the action completes.
- */
- protected void addStatus(IStatus status) {
- accumulatedStatus.add(status);
- }
-
- /**
- * Return the list of status accumulated so far by the action. This
- * will include any OK status that were added using addStatus(IStatus)
- */
- protected IStatus[] getAccumulatedStatus() {
- return (IStatus[]) accumulatedStatus.toArray(new IStatus[accumulatedStatus.size()]);
- }
-
- /**
- * Return the title to be displayed on error dialogs.
- * Subclasses should override to present a custom message.
- */
- protected String getErrorTitle() {
- return CVSUIMessages.CVSAction_errorTitle;
- }
-
- /**
- * Return the title to be displayed on error dialogs when warnings occur.
- * Subclasses should override to present a custom message.
- */
- protected String getWarningTitle() {
- return CVSUIMessages.CVSAction_warningTitle;
- }
-
- /**
- * Return the message to be used for the parent MultiStatus when
- * multiple errors occur during an action.
- * Subclasses should override to present a custom message.
- */
- protected String getMultiStatusMessage() {
- return CVSUIMessages.CVSAction_multipleProblemsMessage;
- }
-
- /**
- * Return the status to be displayed in an error dialog for the given list
- * of non-OK status.
- *
- * This method can be overridden but 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);
- for (int i = 0; i < problems.length; i++) {
- combinedStatus.merge(problems[i]);
- }
- return combinedStatus;
- }
-
- /**
- * Method that implements generic handling of an exception.
- *
- * This method will also use any accumulated status when determining what
- * information (if any) to show the user.
- *
- * @param exception the exception that occurred (or null if none occurred)
- * @param status any status accumulated by the action before the end of
- * the action or the exception occurred.
- */
- protected void handle(Exception exception) {
- // Get the non-OK status
- 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 status
- if (problems.size() == 0) {
- if (exception == null) return;
- handle(exception, getErrorTitle(), null);
- return;
- }
-
- // For now, display both the exception and the problem status
- // Later, we can determine how to display both together
- if (exception != null) {
- handle(exception, getErrorTitle(), null);
- }
-
- String message = null;
- IStatus statusToDisplay = getStatusToDisplay((IStatus[]) problems.toArray(new IStatus[problems.size()]));
- if (statusToDisplay.isOK()) return;
- if (statusToDisplay.isMultiStatus() && statusToDisplay.getChildren().length == 1) {
- message = statusToDisplay.getMessage();
- statusToDisplay = statusToDisplay.getChildren()[0];
- }
- String title;
- if (statusToDisplay.getSeverity() == IStatus.ERROR) {
- title = getErrorTitle();
- } else {
- title = getWarningTitle();
- }
- CVSUIPlugin.openError(getShell(), title, message, new CVSException(statusToDisplay));
- }
-
- /**
- * Convenience method for running an operation with the appropriate progress.
- * Any exceptions are propagated so they can be handled by the
- * <code>CVSAction#run(IAction)</code> error handling code.
- *
- * @param runnable the runnable which executes the operation
- * @param cancelable indicate if a progress monitor should be cancelable
- * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
- */
- final protected void run(final IRunnableWithProgress runnable, boolean cancelable, int progressKind) throws InvocationTargetException, InterruptedException {
- final Exception[] exceptions = new Exception[] {null};
-
- // Ensure that no repository view refresh happens until after the action
- final IRunnableWithProgress innerRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- getRepositoryManager().run(runnable, monitor);
- }
- };
-
- switch (progressKind) {
- case PROGRESS_BUSYCURSOR :
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- public void run() {
- try {
- innerRunnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = e;
- }
- }
- });
- break;
- case PROGRESS_DIALOG :
- default :
- new ProgressMonitorDialog(getShell()).run(cancelable, cancelable, innerRunnable);
- break;
- }
- if (exceptions[0] != null) {
- if (exceptions[0] instanceof InvocationTargetException)
- throw (InvocationTargetException)exceptions[0];
- else
- throw (InterruptedException)exceptions[0];
- }
- }
-
- /**
- * Answers if the action would like dirty editors to saved
- * based on the CVS preference before running the action. By
- * default, CVSActions do not save dirty editors.
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-
- /**
- * Returns the selected CVS resources
- */
- protected ICVSResource[] getSelectedCVSResources() {
- ArrayList resources = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSResource) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSResource.class);
- if (adapter instanceof ICVSResource) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSResource[])resources.toArray(new ICVSResource[resources.size()]);
- }
- return new ICVSResource[0];
- }
-
- /**
- * Get selected CVS remote folders
- */
- protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
- ArrayList resources = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFolder) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRemoteFolder.class);
- if (adapter instanceof ICVSRemoteFolder) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSRemoteFolder[])resources.toArray(new ICVSRemoteFolder[resources.size()]);
- }
- return new ICVSRemoteFolder[0];
- }
-
- /**
- * Returns the selected remote resources
- */
- protected ICVSRemoteResource[] getSelectedRemoteResources() {
- ArrayList resources = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteResource) {
- resources.add(next);
- continue;
- }
- if (next instanceof CVSFileRevision) {
- resources.add(((CVSFileRevision)next).getCVSRemoteFile());
- continue;
- }
- if (next instanceof ILogEntry) {
- resources.add(((ILogEntry)next).getRemoteFile());
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRemoteResource.class);
- if (adapter instanceof ICVSRemoteResource) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRemoteResource[] result = new ICVSRemoteResource[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRemoteResource[0];
- }
-
- /**
- * A helper prompt condition for prompting for CVS dirty state.
- */
- public static IPromptCondition getOverwriteLocalChangesPrompt(final IResource[] dirtyResources) {
- return new IPromptCondition() {
- List resources = Arrays.asList(dirtyResources);
- public boolean needsPrompt(IResource resource) {
- return resources.contains(resource);
- }
- public String promptMessage(IResource resource) {
- return NLS.bind(CVSUIMessages.ReplaceWithAction_localChanges, new String[] { resource.getName() });
- }
- };
- }
-
- /**
- * Checks if a the resources' parent's tags are different then the given tag.
- * Prompts the user that they are adding mixed tags and returns <code>true</code> if
- * the user wants to continue or <code>false</code> otherwise.
- */
- public static boolean checkForMixingTags(final Shell shell, IResource[] resources, final CVSTag tag) throws CVSException {
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(!store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS)) {
- return true;
- };
-
- final boolean[] result = new boolean[] { true };
-
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getType() != IResource.PROJECT) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
- // prompt if the tags are not equal
- // consider BASE to be equal the parent tag since we don't make BASE sticky on replace
- if (!CVSTag.equalTags(tag, parentTag) && !CVSTag.equalTags(tag, CVSTag.BASE)) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(shell,
- CVSUIMessages.CVSAction_mixingTagsTitle,
- NLS.bind(CVSUIMessages.CVSAction_mixingTags, new String[] { tag.getName() }),
- CVSUIMessages.CVSAction_doNotShowThisAgain, false,
- store, ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS);
- result[0] = dialog.getReturnCode() == 0;
- }
- });
- // only prompt once
- break;
- }
- }
- }
- return result[0];
- }
-
- /**
- * Based on the CVS preference for saving dirty editors this method will either
- * ignore dirty editors, save them automatically, or prompt the user to save them.
- *
- * @return <code>true</code> if the command succeeded, and <code>false</code>
- * if at least one editor with unsaved changes was not saved
- */
- private boolean saveAllEditors() {
- final int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- final boolean[] okToContinue = new boolean[] {true};
- if (option != ICVSUIConstants.OPTION_NEVER) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- boolean confirm = option == ICVSUIConstants.OPTION_PROMPT;
- IResource[] selectedResources = getSelectedResources();
- if (selectedResources != null) {
- okToContinue[0] = IDE.saveAllEditors(selectedResources, confirm);
- }
- }
- });
- }
- return okToContinue[0];
- }
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#handle(java.lang.Exception, java.lang.String, java.lang.String)
- */
- protected void handle(Exception exception, String title, String message) {
- CVSUIPlugin.openError(getShell(), title, message, exception, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
-
- protected RepositoryManager getRepositoryManager() {
- return CVSUIPlugin.getPlugin().getRepositoryManager();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources()
- */
- protected final IResource[] getSelectedResourcesWithOverlap() {
- IStructuredSelection selection = getSelection();
- CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection());
- if (props == null) {
- return Utils.getContributedResources(selection.toArray());
- }
- return props.getAllSelectedResources();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources()
- */
- protected final IResource[] getSelectedResources() {
- IStructuredSelection selection = getSelection();
- CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection());
- if (props == null) {
- return CVSActionSelectionProperties.getNonOverlapping(Utils.getContributedResources(selection.toArray()));
- }
- return props.getNonoverlappingSelectedResources();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- }
-
- /**
- * These handlers won't have any interesting property changes. There is
- * no need to notify listeners.
- * @param handlerListener
- * @since 3.1
- */
- public void removeHandlerListener(IHandlerListener handlerListener) {
- }
- public void addHandlerListener(IHandlerListener handlerListener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#isHandled()
- */
- public boolean isHandled() {
- return true;
- }
-
- protected final ICVSResource getCVSResourceFor(IResource resource) {
- CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection());
- if (props == null) {
- return CVSWorkspaceRoot.getCVSResourceFor(resource);
- }
- return props.getCVSResourceFor(resource);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
deleted file mode 100644
index d84c566a0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ui.Utils;
-
-/**
- * This class represents a selection for a set of CVS actions.
- */
-public class CVSActionSelectionProperties {
-
- // Use a weak hash map so that the properties ae collected when the selection is no longer referenced
- private static Map selectionProperties = new WeakHashMap();
-
- private Object[] selection;
- private Map properties = new HashMap();
-
- private static final String SELECTED_RESOURCES = "selectedResources"; //$NON-NLS-1$
- private static final String NONOVERLAPPING_SELECTED_RESOURCES = "nonoverlappingSelectedResources"; //$NON-NLS-1$
- private static final String CVS_RESOURCE_MAP = "cvsResourceMap"; //$NON-NLS-1$
-
- public static CVSActionSelectionProperties getProperties(IStructuredSelection selection) {
- if (selection == null) return null;
- CVSActionSelectionProperties props = (CVSActionSelectionProperties)selectionProperties.get(selection);
- if (props == null) {
- props = new CVSActionSelectionProperties(selection);
- selectionProperties.put(selection, props);
- }
- return props;
- }
-
- public CVSActionSelectionProperties(IStructuredSelection selection) {
- // Copy the selection so that the WeakHashMap will not think the seleciton used for the key is still in use
- this.selection = selection.toArray();
- }
-
- public void put(String key, Object value) {
- properties.put(key, value);
- }
-
- public Object get(String key) {
- return properties.get(key);
- }
-
- public IResource[] getAllSelectedResources() {
- IResource[] resources = (IResource[])get(SELECTED_RESOURCES);
- if (resources == null) {
- resources = getResources(selection);
- put(SELECTED_RESOURCES, resources);
- }
- return resources;
- }
-
- /*
- * This method gets the resources from the given objects.
- * It does so in a manner that is consistent with how the workbench does it.
- * Tha is, it first uses IContributionResourceAdapter, then IResource,
- * then ResourceMapping.
- */
- private IResource[] getResources(Object[] objects) {
- return Utils.getContributedResources(objects);
- }
-
- public IResource[] getNonoverlappingSelectedResources() {
- IResource[] resources = (IResource[])get(NONOVERLAPPING_SELECTED_RESOURCES);
- if (resources == null) {
- resources = getNonOverlapping(getAllSelectedResources());
- put (NONOVERLAPPING_SELECTED_RESOURCES, resources);
- }
- return resources;
- }
-
- public ICVSResource getCVSResourceFor(IResource resource) {
- Map map = (Map)get(CVS_RESOURCE_MAP);
- if (map == null) {
- map = new HashMap();
- put(CVS_RESOURCE_MAP, map);
- }
- ICVSResource cvsResource = (ICVSResource)map.get(resource);
- if (cvsResource == null) {
- cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- map.put(resource, cvsResource);
- }
- return cvsResource;
- }
-
- /**
- * Method getNonOverlapping ensures that a resource is not covered more than once.
- * @param resources
- * @return IResource[]
- */
- public static IResource[] getNonOverlapping(IResource[] resources) {
- if (resources == null || resources.length == 0 || resources.length == 1) {
- return resources;
- }
- // Sort the resources so the shortest paths are first
- List sorted = new ArrayList();
- sorted.addAll(Arrays.asList(resources));
- Collections.sort(sorted, new Comparator() {
- public int compare(Object arg0, Object arg1) {
- IResource resource0 = (IResource) arg0;
- IResource resource1 = (IResource) arg1;
- return resource0.getFullPath().segmentCount() - resource1.getFullPath().segmentCount();
- }
- public boolean equals(Object arg0) {
- return false;
- }
- });
- // Collect all non-overlapping resources
- List coveredPaths = new ArrayList();
- for (Iterator iter = sorted.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- IPath resourceFullPath = resource.getFullPath();
- boolean covered = false;
- for (Iterator it = coveredPaths.iterator(); it.hasNext();) {
- IPath path = (IPath) it.next();
- if(path.isPrefixOf(resourceFullPath)) {
- covered = true;
- }
- }
- if (covered) {
- // if the resource is covered by a parent, remove it
- iter.remove();
- } else {
- // if the resource is a non-covered folder, add it to the covered paths
- if (resource.getType() == IResource.FOLDER) {
- coveredPaths.add(resource.getFullPath());
- }
- }
- }
- return (IResource[]) sorted.toArray(new IResource[sorted.size()]);
- }
-
-}
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 7bf7f1a92..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.operations.CheckoutMultipleProjectsOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.ProjectMetaFileOperation;
-
-/**
- * Checkout a remote module into the workspace ensuring that the user is prompted for
- * any overwrites that may occur.
- */
-public class CheckoutAction extends CVSAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- new CheckoutMultipleProjectsOperation(getTargetPart(), getSelectedRemoteFoldersWithProjectName(), null)
- .run();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- if (folders.length == 0) return false;
- // only enabled when all folders are in the same repository
- ICVSRepositoryLocation location = folders[0].getRepository();
- for (int i = 1; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
- if (!folder.getRepository().equals(location)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Get selected CVS remote folders, and add Project Description
- * from metafile if available based on preferences settings
- * @throws InterruptedException
- * @throws InvocationTargetException
- */
- private ICVSRemoteFolder[] getSelectedRemoteFoldersWithProjectName() throws InvocationTargetException, InterruptedException {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- if (CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout()){
- folders = ProjectMetaFileOperation.updateFoldersWithProjectName(getTargetPart(), folders);
- }
- return folders;
- }
-}
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 b87d8fbbc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.operations.ProjectMetaFileOperation;
-import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutAsWizard;
-
-public class CheckoutAsAction extends CVSAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- boolean withName = CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout();
- ProjectMetaFileOperation op = new ProjectMetaFileOperation(getTargetPart(), folders, withName);
- op.run();
-
- // project configuration allowed only if single folder without metafile
- boolean allowProjectConfig = (folders.length == 1 && !op.metaFileExists());
-
- if (withName) {
- folders = op.getUpdatedFolders();
- }
-
- CheckoutAsWizard wizard = new CheckoutAsWizard(getTargetPart(), folders, allowProjectConfig);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- return getSelectedRemoteFolders().length > 0;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java
deleted file mode 100644
index adf00baae..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * Action that launches the checkout wizard
- */
-public class CheckoutWizardAction extends CVSAction implements IWorkbenchWindowActionDelegate {
-
- Shell shell;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate2#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- this.shell = window.getShell();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- CheckoutWizard wizard = new CheckoutWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- return true;
- }
-}
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 554128032..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.internal.ccvs.core.mapping.CVSActiveChangeSetCollector;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Action for checking in files to a CVS provider.
- * Prompts the user for a release comment.
- */
-public class CommitAction extends WorkspaceTraversalAction {
-
- private final class CommitScopeManager extends SynchronizationScopeManager {
- private boolean includeChangeSets;
-
- private CommitScopeManager(ResourceMapping[] mappings, ResourceMappingContext context, boolean models) {
- super("", mappings, context, models); //$NON-NLS-1$
- includeChangeSets = isIncludeChangeSets(getShell(), CVSUIMessages.CommitAction_2);
- }
-
- protected ResourceTraversal[] adjustInputTraversals(ResourceTraversal[] traversals) {
- if (includeChangeSets)
- return ((CVSActiveChangeSetCollector)CVSUIPlugin.getPlugin().getChangeSetManager()).adjustInputTraversals(traversals);
- return super.adjustInputTraversals(traversals);
- }
- }
-
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final ResourceTraversal[][] traversals = new ResourceTraversal[][] { null };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(CVSUIMessages.CommitAction_0, 100);
- traversals[0] = getTraversals(Policy.subMonitorFor(monitor, 80));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- CommitWizard.run(getTargetPart(), getShell(), traversals[0]);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, false, PROGRESS_BUSYCURSOR);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.CommitAction_commitFailed;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_COMMIT;
- }
-
- protected SynchronizationScopeManager getScopeManager() {
- return new CommitScopeManager(getCVSResourceMappings(), getResourceMappingContext(), true);
- }
-
- public static boolean isIncludeChangeSets(final Shell shell, final String message) {
- if (CVSUIPlugin.getPlugin().getChangeSetManager().getSets().length == 0)
- return false;
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT);
- if (option.equals(MessageDialogWithToggle.ALWAYS))
- return true; // no, always switch
-
- if (option.equals(MessageDialogWithToggle.NEVER))
- return false; // no, never switch
-
- // Ask the user whether to switch
- final int[] result = new int[] { 0 };
- Utils.syncExec(new Runnable() {
- public void run() {
- final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(
- shell,
- CVSUIMessages.CommitAction_1,
- message,
- CVSUIMessages.ShowAnnotationOperation_4,
- false /* toggle state */,
- store,
- ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT);
-
- result[0] = m.getReturnCode();
- }
- }, shell);
-
- switch (result[0]) {
- // yes
- case IDialogConstants.YES_ID:
- case IDialogConstants.OK_ID :
- return true;
- // no
- case IDialogConstants.NO_ID :
- return false;
- }
- return false;
- }
-}
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 fde26d715..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.ui.CVSCompareEditorInput;
-import org.eclipse.team.internal.ccvs.ui.ResourceEditionNode;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation;
-
-/**
- * This action is used for comparing two arbitrary remote resources. This is
- * enabled in the repository explorer.
- */
-public class CompareRemoteResourcesAction extends CVSAction {
-
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRemoteResource[] editions = getSelectedRemoteResources();
- if (editions == null || editions.length != 2) {
- return;
- }
- try {
- if (isSameFolder(editions)) {
- RemoteCompareOperation.create(null, editions[0], RemoteCompareOperation.getTag(editions[1])).run();
- } else {
- ResourceEditionNode left = new ResourceEditionNode(editions[0]);
- ResourceEditionNode right = new ResourceEditionNode(editions[1]);
- CompareUI.openCompareEditorOnPage(new CVSCompareEditorInput(left, right), getTargetPage());
- }
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- protected boolean isSameFolder(ICVSRemoteResource[] editions) {
- return editions[0].isContainer() && editions[0].getRepository().equals(editions[1].getRepository())
- && editions[0].getRepositoryRelativePath().equals(editions[1].getRepositoryRelativePath());
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRemoteResource[] resources = getSelectedRemoteResources();
- if (resources.length != 2) return false;
- if (resources[0].isContainer() != resources[1].isContainer()) return false;
- // Don't allow comparisons of two unrelated remote projects
- return !resources[0].isContainer() || isSameFolder(resources);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
deleted file mode 100644
index 9eb1f50fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-
-/**
- * Compare to versions of a remote resource.
- */
-public class CompareRemoteWithTagAction extends CVSAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- final ICVSRemoteResource[] resources = getSelectedRemoteResources();
- if (resources.length == 0) return;
-
- // Obtain the tag to compare against
- final ICVSRemoteResource resource = resources[0];
- final CVSTag[] tag = new CVSTag[] { null};
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- tag[0] = TagSelectionDialog.getTagToCompareWith(getShell(), TagSource.create(resources),
- TagSelectionDialog.INCLUDE_BRANCHES |
- TagSelectionDialog.INCLUDE_VERSIONS |
- TagSelectionDialog.INCLUDE_DATES |
- TagSelectionDialog.INCLUDE_HEAD_TAG);
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- if (tag[0] == null) return;
-
- // Run the compare operation in the background
- try {
- RemoteCompareOperation.create(getTargetPart(), resource, tag[0])
- .run();
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRemoteResource[] resources = getSelectedRemoteResources();
- // Only support single select for now.
- // Need to avoid overlap if multi-select is supported
- return resources.length == 1;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
deleted file mode 100644
index 02b0723d6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-
-/**
- * This action shows the CVS workspace participant into a model dialog. For single file
- * selection, the compare editor is shown instead.
- *
- * @since 3.0
- */
-public class CompareWithRemoteAction extends SyncAction {
-
- /*
- * Update the text label for the action based on the tags in the selection.
- * @see TeamAction#setActionEnablement(org.eclipse.jface.action.IAction)
- */
- protected void setActionEnablement(IAction action) {
- super.setActionEnablement(action);
- action.setText(calculateActionTagValue());
- }
-
- /**
- * Enable for resources that are managed (using super) or whose parent is a CVS folder.
- *
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return super.isEnabledForCVSResource(cvsResource) || cvsResource.getParent().isCVSFolder();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
deleted file mode 100644
index 9925826d3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.history.*;
-
-/**
- * Compare with revision will allow a user to browse the history of a file, compare with the
- * other revisions and merge changes from other revisions into the workspace copy.
- */
-public class CompareWithRevisionAction extends WorkspaceAction {
-
-
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- // Show the compare viewer
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- if (isShowInDialog()) {
- IFile file = (IFile) getSelectedResources()[0];
- showCompareInDialog(getShell(), file);
- } else {
- IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), (IFile)getSelectedResources()[0], null);
- IHistoryPage page = view.getHistoryPage();
- if (page instanceof CVSHistoryPage){
- CVSHistoryPage cvsHistoryPage = (CVSHistoryPage) page;
- cvsHistoryPage.setClickAction(true);
- }
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- protected void showCompareInDialog(Shell shell, Object object){
- IHistoryPageSource pageSource = HistoryPageSource.getHistoryPageSource(object);
- if (pageSource != null && pageSource.canShowHistoryFor(object)) {
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(true);
- cc.setRightEditable(false);
- HistoryPageCompareEditorInput input = new HistoryPageCompareEditorInput(cc, pageSource, object) {
- public void saveChanges(IProgressMonitor monitor) throws CoreException {
- super.saveChanges(monitor);
- ((CVSHistoryPage)getHistoryPage()).saveChanges(monitor);
- setDirty(false);
- }
- };
- CompareUI.openCompareDialog(input);
- }
- }
-
- /**
- * Return the text describing this action
- */
- protected String getActionTitle() {
- return CVSUIMessages.CompareWithRevisionAction_4;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.CompareWithRevisionAction_compare;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return (!cvsResource.isFolder() && super.isEnabledForCVSResource(cvsResource));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return true;
- }
-
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- protected boolean isEnabledForIgnoredResources() {
- return true;
- }
-
- protected boolean isShowInDialog() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG);
- }
-}
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 0687c34d2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.mappings.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-
-public class CompareWithTagAction extends WorkspaceTraversalAction {
-
- private static boolean isOpenEditorForSingleFile() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE);
- }
-
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- // First, determine the tag to compare with
- IResource[] resources = getSelectedResources();
- CVSTag tag = promptForTag(resources);
- if (tag == null)
- return;
-
- if (isOpenEditorForSingleFile()) {
- IFile file = getSelectedFile();
- if (file != null && SyncAction.isOKToShowSingleFile(file)) {
- CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(resources, tag);
- SyncAction.showSingleFileComparison(getShell(), compareSubscriber, file, getTargetPage());
- compareSubscriber.dispose();
- return;
- }
- }
-
- // Create a subscriber that can cover all projects involved
- if (isShowModelSync()) {
- final CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag);
- ResourceMapping[] mappings = getCVSResourceMappings();
- try {
- // TODO: Only prime the area covered by the mappings
- compareSubscriber.primeRemoteTree();
- } catch(CVSException e) {
- // ignore, the compare will fail if there is a real problem.
- }
- SubscriberScopeManager manager = new SubscriberScopeManager(compareSubscriber.getName(), mappings, compareSubscriber, true){
- public void dispose() {
- compareSubscriber.dispose();
- super.dispose();
- }
- };
- SynchronizationContext context = CompareSubscriberContext.createContext(manager, compareSubscriber);
- ModelCompareParticipant participant = new ModelCompareParticipant(context);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
- participant.run(getTargetPart());
- } else {
- CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag);
- ResourceMapping[] resourceMappings = getCVSResourceMappings();
- if (isLogicalModel(resourceMappings)) {
- compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag);
- resources = getResourcesToCompare(compareSubscriber);
- compareSubscriber.dispose();
- }
- // create a subscriber specifically for the resources for display to the user
- compareSubscriber = new CVSCompareSubscriber(resources, tag);
- try {
- compareSubscriber.primeRemoteTree();
- } catch(CVSException e) {
- // ignore, the compare will fail if there is a real problem.
- }
- // First check if there is an existing matching participant, if so then re-use it
- CompareParticipant participant = CompareParticipant.getMatchingParticipant(resources, tag);
- if (participant == null) {
- CVSCompareSubscriber s = compareSubscriber;
- participant = new CompareParticipant(s);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
- }
- participant.refresh(resources, null, null, null);
- }
- }
-
- private boolean isShowModelSync() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC);
- }
-
- protected CVSTag promptForTag(IResource[] resources) {
- CVSTag tag = TagSelectionDialog.getTagToCompareWith(getShell(), TagSource.create(resources), TagSelectionDialog.INCLUDE_ALL_TAGS);
- return tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
deleted file mode 100644
index abd33d496..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteModule;
-import org.eclipse.team.internal.ccvs.ui.tags.TagConfigurationDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-;
-
-/**
- * DefineTagAction remembers a tag by name
- */
-public class ConfigureTagsFromRepoViewOnFolder extends CVSAction {
-
- /**
- * Returns the selected remote folders
- */
- protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
- ArrayList resources = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof RemoteModule) {
- next = ((RemoteModule)next).getCVSResource();
- }
- if (next instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder)next;
- if (folder.isDefinedModule()) {
- resources.add(next);
- } else if(new Path(null, ((ICVSRemoteFolder)next).getRepositoryRelativePath()).segmentCount()==1) {
- resources.add(next);
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSRemoteFolder[])resources.toArray(new ICVSRemoteFolder[resources.size()]);
- }
- return new ICVSRemoteFolder[0];
- }
-
- /*
- * @see CVSAction@execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ICVSFolder[] cvsFolders = new ICVSFolder[roots.length];
- for (int i = 0; i < roots.length; i++) {
- cvsFolders[i] = roots[i];
- }
- TagConfigurationDialog d = new TagConfigurationDialog(shell, TagSource.create(cvsFolders));
- d.open();
- }
- });
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
- if (roots.length != 1) return false;
- return true;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.ConfigureTagsFromRepoViewConfigure_Tag_Error_1;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
deleted file mode 100644
index 45d5d85e6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.PlatformUI;
-
-public class EditAction extends WorkspaceAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- // Get the editors
- final EditorsAction editors = new EditorsAction();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- executeProviderAction(editors, Policy.subMonitorFor(monitor, 25));
-
- // If there are editors show them and prompt the user to execute the edit command
- if (!editors.promptToEdit(getShell())) {
- return;
- }
-
- executeProviderAction(new IProviderAction() {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- provider.edit(resources, false /* recurse */, true /* notify server */, false /* notifyForWritable*/, ICVSFile.NO_NOTIFICATION, monitor);
- return Team.OK_STATUS;
- }
- }, Policy.subMonitorFor(monitor, 75));
- }
- });
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (cvsResource.isFolder()) return false;
- if (super.isEnabledForCVSResource(cvsResource)) {
- return ((ICVSFile)cvsResource).isReadOnly();
- } else {
- return false;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
deleted file mode 100644
index c7ac7ee0c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- * IBM Corporation - ongoing maintenance
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction.IProviderAction;
-
-/**
- * This Action gets the <code>EditorsInfo[]</code>
- * It is used by the <code>ShowEditorAction</code>
- * and <code>ShowEditorAction</code>.
- *
- * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor
- * Kohlwes</a>
- *
- */
-public class EditorsAction implements IProviderAction, IRunnableWithProgress {
- EditorsInfo[] f_editorsInfo = new EditorsInfo[0];
- CVSTeamProvider f_provider;
- IResource[] f_resources;
-
- public EditorsAction() {
- }
-
- public EditorsAction(CVSTeamProvider provider, IResource[] resources) {
- f_provider = provider;
- f_resources = resources;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction.IProviderAction#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- f_editorsInfo = provider.editors(resources, monitor);
- return Team.OK_STATUS;
- }
-
- public boolean promptToEdit(Shell shell) {
- if (!isEmpty()) {
- final EditorsDialog view = new EditorsDialog(shell, f_editorsInfo);
- // Open the dialog using a sync exec (there are no guarentees that we
- // were called from the UI thread
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- view.open();
- }
- }, CVSUIPlugin.PERFORM_SYNC_EXEC);
- return (view.getReturnCode() == Window.OK);
- }
- return true;
- }
-
- /**
- * Contact the server to determine if there are any editors on the associatd files.
- *
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (f_provider == null || f_resources == null) {
- throw new InvocationTargetException(new RuntimeException(NLS.bind(CVSUIMessages.EditorsAction_classNotInitialized, new String[] { this.getClass().getName() })));
- }
- try {
- execute(f_provider,f_resources,monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /**
- * Returns the f_editorsInfo.
- * @return EditorsInfo[]
- */
- public EditorsInfo[] getEditorsInfo() {
- return f_editorsInfo;
- }
-
- /**
- * Indicates whether there are editors of any of the associated files.
- * The <code>run(IProgressMonitor)</code> must be invoked first to
- * fetch any editors from the server.
- * @return boolean
- */
- public boolean isEmpty() {
- return f_editorsInfo.length == 0;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/FetchAllMembersAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/FetchAllMembersAction.java
deleted file mode 100644
index cc7c03956..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/FetchAllMembersAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchAllMembersOperation;
-
-public class FetchAllMembersAction extends CVSAction {
-
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- ICVSRepositoryLocation repoLocation = getRepositoryManager().getRepositoryLocationFor(folders[0]);
- new FetchAllMembersOperation (getTargetPart(), folders, repoLocation).run();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- //Only enable for one selection for now
- return getSelectedRemoteFolders().length == 1;
- }
-
-}
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 3339ce364..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * 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 WorkspaceTraversalAction{
-
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void execute(IAction action) {
-
- try {
- final IResource [][] resources = new IResource[][] { null };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = getDeepResourcesToPatch(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- GenerateDiffFileWizard.run(getTargetPart(), resources[0]);
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- private IResource[] getDeepResourcesToPatch(IProgressMonitor monitor) throws CoreException {
- ResourceMapping[] mappings = getCVSResourceMappings();
- List roots = new ArrayList();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
- ResourceTraversal[] traversals = mapping.getTraversals(
- SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()),
- monitor);
- for (int j = 0; j < traversals.length; j++) {
- ResourceTraversal traversal = traversals[j];
- IResource[] resources = traversal.getResources();
- if (traversal.getDepth() == IResource.DEPTH_INFINITE) {
- roots.addAll(Arrays.asList(resources));
- } else if (traversal.getDepth() == IResource.DEPTH_ZERO) {
- collectShallowFiles(resources, roots);
- } else if (traversal.getDepth() == IResource.DEPTH_ONE) {
- collectShallowFiles(resources, roots);
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- if (resource.getType() != IResource.FILE) {
- collectShallowFiles(members(resource), roots);
- }
- }
- }
- }
- }
- return (IResource[]) roots.toArray(new IResource[roots.size()]);
- }
-
- private void collectShallowFiles(IResource[] resources, List roots) {
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- if (resource.getType() == IResource.FILE)
- roots.add(resource);
- }
- }
-
- private IResource[] members(IResource resource) throws CoreException {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().members(resource);
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_CREATEPATCH;
- }
-}
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 cebb92752..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class IgnoreAction extends WorkspaceTraversalAction {
-
- /**
- * Define an operation that can be run in the background.
- * We divide the ignores by provider to obtain project
- * locks while modifying the .cvsignore files
- */
- class IgnoreOperation extends RepositoryProviderOperation {
-
- private final IgnoreResourcesDialog dialog;
-
- public IgnoreOperation(IWorkbenchPart part, IResource[] resources, IgnoreResourcesDialog dialog) {
- super(part, resources);
- this.dialog = dialog;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.IgnoreAction_0, new String[] { provider.getProject().getName() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(null, resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- String pattern = dialog.getIgnorePatternFor(resource);
- ICVSResource cvsResource = getCVSResourceFor(resource);
- cvsResource.setIgnoredAs(pattern);
- monitor.worked(1);
- }
- } catch (TeamException e) {
- collectStatus(e.getStatus());
- return;
- } finally {
- monitor.done();
- }
- collectStatus(Status.OK_STATUS);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.IgnoreAction_1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings()
- */
- public boolean consultModelsForMappings() {
- return false;
- }
-
- }
-
- protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- IResource[] resources = getSelectedResources();
- IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(getShell(), resources);
- if (dialog.open() != Window.OK) return;
- new IgnoreOperation(getTargetPart(), resources, dialog).run();
-
- //if (action != null) action.setEnabled(isEnabled());
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.IgnoreAction_ignore;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForManagedResources()
- */
- protected boolean isEnabledForManagedResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (super.isEnabledForCVSResource(cvsResource)) {
- // Perform an extra check against the subscriber to ensure there is no conflict
- CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- IResource resource = cvsResource.getIResource();
- if (resource == null) return false;
- try {
- SyncInfo info = subscriber.getSyncInfo(resource);
- return ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING);
- } catch (TeamException e) {
- // Let the enablement happen
- return true;
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_IGNORE;
- }
-}
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 d58fae169..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.wizards.MergeWizard;
-
-public class MergeAction extends WorkspaceTraversalAction {
-
- /*
- * @see CVSAction#execute()
- */
- public void execute(IAction action) {
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MergeWizard wizard = new MergeWizard(getTargetPart(), getSelectedResources(), getSelectedResourceMappings(CVSProviderPlugin.getTypeId()));
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_MERGE;
- }
-}
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 a9ff003b9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-
-public class MoveRemoteTagAction extends TagInRepositoryAction {
-
- /**
- * @see TagRemoteAction#promptForTag(ICVSFolder[])
- */
- protected ITagOperation configureOperation() {
- // Allow the user to select a tag
- ITagOperation operation = createTagOperation();
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), operation.getTagSource(),
- CVSUIMessages.MoveTagAction_title,
- CVSUIMessages.MoveTagAction_message,
- TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS,
- isFolderSelected(), /* show recurse */
- IHelpContextIds.TAG_REMOTE_WITH_EXISTING_DIALOG);
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- return null;
- }
- CVSTag tag = dialog.getResult();
- if (tag == null) return null;
- operation.setTag(tag);
- operation.moveTag();
- boolean recursive = dialog.getRecursive();
- if (!recursive) {
- operation.doNotRecurse();
- }
- return operation;
- }
-
- private boolean isFolderSelected() {
- ICVSResource[] resources = getSelectedCVSResources();
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- if (resource.isFolder())
- return true;
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java
deleted file mode 100644
index ec4e11380..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class NewRepositoryAction implements IWorkbenchWindowActionDelegate, IViewActionDelegate {
- Shell shell;
-
- /**
- * @see IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- this.shell = window.getShell();
- }
-
- public void init(IViewPart view) {
- shell = view.getSite().getShell();
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- NewLocationWizard wizard = new NewLocationWizard();
- wizard.setSwitchPerspectives(false);
- 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 93d73a95d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-
-public class OpenLogEntryAction extends CVSAction {
- /**
- * Returns the selected remote files
- */
- protected ILogEntry[] getSelectedLogEntries() {
- ArrayList entries = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- entries = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ILogEntry) {
- entries.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ILogEntry.class);
- if (adapter instanceof ILogEntry) {
- entries.add(adapter);
- continue;
- }
- }
- }
- }
- if (entries != null && !entries.isEmpty()) {
- ILogEntry[] result = new ILogEntry[entries.size()];
- entries.toArray(result);
- return result;
- }
- return new ILogEntry[0];
- }
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ILogEntry[] entries = getSelectedLogEntries();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].isDeletion()) {
- MessageDialog.openError(getShell(), CVSUIMessages.OpenLogEntryAction_deletedTitle, CVSUIMessages.OpenLogEntryAction_deleted); //
- } else {
- ICVSRemoteFile file = entries[i].getRemoteFile();
- CVSUIPlugin.getPlugin().openEditor(file, monitor);
- }
- }
- }
- }, false, PROGRESS_BUSYCURSOR);
- }
- /*
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ILogEntry[] entries = getSelectedLogEntries();
- if (entries.length == 0) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
deleted file mode 100644
index 2d0f51bea..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-
-public class OpenRemoteFileAction extends CVSAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFile) {
- resources.add(next);
- continue;
- }
- if (next instanceof ILogEntry) {
- resources.add(((ILogEntry)next).getRemoteFile());
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRemoteFile.class);
- if (adapter instanceof ICVSRemoteFile) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRemoteFile[] result = new ICVSRemoteFile[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRemoteFile[0];
- }
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- for (int i = 0; i < files.length; i++) {
- ICVSRemoteFile file = files[i];
- CVSUIPlugin.getPlugin().openEditor(file, monitor);
- }
- }
- }, false, PROGRESS_BUSYCURSOR);
- }
- /*
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRemoteFile[] resources = getSelectedRemoteFiles();
- if (resources.length == 0) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java
deleted file mode 100644
index ca7b42bd6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceSubscriberContext;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.team.ui.synchronize.*;
-
-public class OutgoingChangesDialog extends DetailsDialog {
-
- private final String message;
- private ParticipantPagePane pane;
- private ModelSynchronizeParticipant participant;
- private final String title;
- private final String detailsMessage;
- private final ISynchronizationScopeManager manager;
- private String helpContextId;
-
- public OutgoingChangesDialog(Shell parentShell, ISynchronizationScopeManager manager, String title, String message, String detailsMessage) {
- super(parentShell, title);
- this.manager = manager;
- this.title = title;
- this.message = message;
- this.detailsMessage = detailsMessage;
- }
-
- protected void createMainDialogArea(Composite parent) {
- Composite composite = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- createWrappingLabel(composite, message);
- Dialog.applyDialogFont(parent);
- }
-
- protected Label createWrappingLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalIndent = 0;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- return label;
- }
-
- protected Composite createDropDownDialogArea(Composite parent) {
- Composite composite = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_DIALOG);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 200;
- data.widthHint = 200;
- composite.setLayoutData(data);
- composite.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (pane != null)
- pane.dispose();
- if (participant != null)
- participant.dispose();
- }
- });
-
- createWrappingLabel(composite, detailsMessage);
-
- try {
- participant = createParticipant();
- ISynchronizePageConfiguration configuration = participant.createPageConfiguration();
- configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE);
- configuration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE);
- configuration.setMenuGroups(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] { ISynchronizePageConfiguration.NAVIGATE_GROUP, ISynchronizePageConfiguration.LAYOUT_GROUP });
- pane = new ParticipantPagePane(getShell(), true, configuration, participant);
- Control control = pane.createPartControl(composite);
- control.setLayoutData(SWTUtils.createHVFillGridData());
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- SWTUtils.createLabel(parent, CVSUIMessages.OutgoingChangesDialog_0);
- } catch (InterruptedException e) {
- SWTUtils.createLabel(parent, CVSUIMessages.OutgoingChangesDialog_1);
- }
-
- return composite;
- }
-
- private ModelSynchronizeParticipant createParticipant() throws InvocationTargetException, InterruptedException {
- SynchronizationContext context = createSynchronizationContext(manager);
- ModelSynchronizeParticipant participant = ModelSynchronizeParticipant.createParticipant(context, title);
- participant.setMergingEnabled(false);
- return participant;
- }
-
- private SynchronizationContext createSynchronizationContext(final ISynchronizationScopeManager manager) throws InvocationTargetException, InterruptedException {
- final SynchronizationContext[] context = new SynchronizationContext[] { null };
- context[0] = WorkspaceSubscriberContext.createContext(manager, ISynchronizationContext.THREE_WAY);
- return context[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
- */
- protected boolean isMainGrabVertical() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- // Can always finish
- setPageComplete(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeErrorMessage()
- */
- protected boolean includeErrorMessage() {
- return false;
- }
-
- public void setHelpContextId(String helpContextId) {
- this.helpContextId = helpContextId;
- }
-
- protected String getHelpContextId() {
- return helpContextId;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithLatestRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithLatestRevisionAction.java
deleted file mode 100644
index 6c6f24c72..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithLatestRevisionAction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-
-
-public class ReplaceWithLatestRevisionAction extends ReplaceWithTagAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction.getTag(ReplaceOperation)
- */
- protected CVSTag getTag(ReplaceOperation replaceOperation) {
- return CVSTag.BASE;
- }
-
- public boolean isEnabled(){
- return super.isEnabled();
- }
-
-}
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 f6455c8e9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-
-public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
-
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- final ReplaceOperation replaceOperation = new ReplaceOperation(getTargetPart(), getCVSResourceMappings(), null);
- if (hasOutgoingChanges(replaceOperation)) {
- final boolean[] keepGoing = new boolean[] { true };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(),
- CVSUIMessages.ReplaceWithTagAction_2,
- CVSUIMessages.ReplaceWithTagAction_0,
- CVSUIMessages.ReplaceWithTagAction_1);
- dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG);
- int result = dialog.open();
- keepGoing[0] = result == Window.OK;
- }
- });
- if (!keepGoing[0])
- return;
- }
- replaceOperation.run();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.ReplaceWithRemoteAction_problemMessage;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /*
- * Update the text label for the action based on the tags in the
- * selection.
- *
- * @see TeamAction#setActionEnablement(org.eclipse.jface.action.IAction)
- */
- protected void setActionEnablement(IAction action) {
- super.setActionEnablement(action);
-
- action.setText(calculateActionTagValue());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java
deleted file mode 100644
index 90cd1fc09..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.compare.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.CVSHistoryPage;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ui.history.FileRevisionTypedElement;
-import org.eclipse.team.ui.history.*;
-import org.eclipse.ui.part.IPage;
-
-/**
- * Displays a compare dialog and allows the same behavior as the compare. In addition
- * a replace button is added to the dialog that will replace the local with the currently
- * selected revision.
- *
- * @since 3.0
- */
-public class ReplaceWithRevisionAction extends CompareWithRevisionAction {
-
- protected void showCompareInDialog(Shell shell, Object object){
- IHistoryPageSource pageSource = HistoryPageSource.getHistoryPageSource(object);
- if (pageSource != null && pageSource.canShowHistoryFor(object)) {
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(false);
- cc.setRightEditable(false);
- HistoryPageCompareEditorInput input = new HistoryPageCompareEditorInput(cc, pageSource, object) {
- public void saveChanges(IProgressMonitor monitor) throws CoreException {
- super.saveChanges(monitor);
- ((CVSHistoryPage)getHistoryPage()).saveChanges(monitor);
- setDirty(false);
- }
- protected void performReplace(Object o) throws CoreException {
- FileRevisionTypedElement right = (FileRevisionTypedElement)o;
- IFile file = (IFile)getCompareResult();
- file.setContents(right.getContents(), false, true, null);
- }
- protected IPage createPage(CompareViewerPane parent,
- IToolBarManager toolBarManager) {
- IPage page = super.createPage(parent, toolBarManager);
- setTitle(NLS.bind(CVSUIMessages.ReplaceWithRevisionAction_0, ((IHistoryPage)page).getName()));
- setPageDescription(((IHistoryPage)page).getName());
- return page;
- }
- };
- input.setReplace(true);
- CompareUI.openCompareDialog(input);
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction#getActionTitle()
- */
- protected String getActionTitle() {
- return CVSUIMessages.ReplaceWithRevisionAction_1;
- }
-
- protected boolean isShowInDialog() {
- // Always show a replace in a dialog
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithSelectableTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithSelectableTagAction.java
deleted file mode 100644
index 0e44a223f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithSelectableTagAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-
-public class ReplaceWithSelectableTagAction extends ReplaceWithTagAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction.getTag(ReplaceOperation)
- */
- protected CVSTag getTag(final ReplaceOperation replaceOperation) {
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), TagSource.create(replaceOperation.getScope().getMappings()),
- CVSUIMessages.ReplaceWithTagAction_message,
- CVSUIMessages.TagSelectionDialog_Select_a_Tag_1,
- TagSelectionDialog.INCLUDE_ALL_TAGS,
- false, /*show recurse*/
- IHelpContextIds.REPLACE_TAG_SELECTION_DIALOG);
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- return null;
- }
- return dialog.getResult();
- }
-
-}
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 7fef4b31a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-
-/**
- * Action for replace with tag.
- */
-public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction {
-
- /*
- * Method declared on IActionDelegate.
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
-
- // Setup the holders
- final CVSTag[] tag = new CVSTag[] {null};
-
- final ReplaceOperation replaceOperation = new ReplaceOperation(getTargetPart(), getCVSResourceMappings(), tag[0]);
- if (hasOutgoingChanges(replaceOperation)) {
- final boolean[] keepGoing = new boolean[] { true };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(),
- CVSUIMessages.ReplaceWithTagAction_2,
- CVSUIMessages.ReplaceWithTagAction_0,
- CVSUIMessages.ReplaceWithTagAction_1);
- dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG);
- int result = dialog.open();
- keepGoing[0] = result == Window.OK;
- }
- });
- if (!keepGoing[0])
- return;
- }
-
- // Show a busy cursor while display the tag selection dialog
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- monitor = Policy.monitorFor(monitor);
- tag[0] = getTag(replaceOperation);
-
- // 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(), replaceOperation.getScope().getRoots(), tag[0])) {
- tag[0] = null;
- return;
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
-
- if (tag[0] == null) return;
-
- // Perform the replace in the background
- replaceOperation.setTag(tag[0]);
- replaceOperation.run();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.ReplaceWithTagAction_replace;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * This function should obtain a tag which user wants to load.
- * @param replaceOperation
- * replaceOperation is an operation for which the tag is obtained
- * @return tag
- * marks the resources revision the user wants to load
- */
- abstract protected CVSTag getTag(final ReplaceOperation replaceOperation);
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
deleted file mode 100644
index 897bd481e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.RestoreFromRepositoryWizard;
-
-/**
- * @author Administrator
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class RestoreFromRepositoryAction extends WorkspaceTraversalAction {
-
- /*
- * This class handles the output from "cvs log -R ..." where -R
- * indicates that only the RCS file name is to be returned. Files
- * that have been deleted will be in the Attic. The Attic may also
- * contains files that exist on a branch but not in HEAD
- */
- class AtticLogListener extends CommandOutputListener {
- private static final String RCS_FILE_POSTFIX = ",v"; //$NON-NLS-1$
- private static final String LOGGING_PREFIX = "Logging "; //$NON-NLS-1$
- ICVSFolder currentFolder;
- List atticFiles = new ArrayList();
-
- public IStatus messageLine(
- String line,
- ICVSRepositoryLocation location,
- ICVSFolder commandRoot,
- IProgressMonitor monitor) {
-
- // Extract the file name and path from the RCS path
- // String filePath = line.substring(index);
- // Find all RCS file names that contain "Attic"
- int start = line.lastIndexOf(Session.SERVER_SEPARATOR);
- if (start != -1) {
- String fileName = line.substring(start + 1);
- if (fileName.endsWith(RCS_FILE_POSTFIX)) {
- fileName = fileName.substring(0, fileName.length() - RCS_FILE_POSTFIX.length());
- }
- if (currentFolder != null) {
- try {
- ICVSFile file = currentFolder.getFile(fileName);
- if (!file.exists())
- atticFiles.add(file);
- } catch (CVSException e) {
- return e.getStatus();
- }
- }
- }
- return OK;
- }
-
- public IStatus errorLine(
- String line,
- ICVSRepositoryLocation location,
- ICVSFolder commandRoot,
- IProgressMonitor monitor) {
-
- CVSRepositoryLocation repo = (CVSRepositoryLocation)location;
- String folderPath = repo.getServerMessageWithoutPrefix(line, SERVER_PREFIX);
- if (folderPath != null) {
- if (folderPath.startsWith(LOGGING_PREFIX)) {
- folderPath = folderPath.substring(LOGGING_PREFIX.length());
- try {
- currentFolder = commandRoot.getFolder(folderPath);
- } catch (CVSException e) {
- return e.getStatus();
- }
- return OK;
- }
- }
- return super.errorLine(line, location, commandRoot, monitor);
- }
-
- public ICVSFile[] getAtticFilePaths() {
- return (ICVSFile[]) atticFiles.toArray(new ICVSFile[atticFiles.size()]);
- }
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- IContainer resource = (IContainer)getSelectedResources()[0];
- ICVSFile[] files = fetchDeletedFiles(resource);
- if (files == null) return;
- if (files.length == 0) {
- MessageDialog.openInformation(getShell(), CVSUIMessages.RestoreFromRepositoryAction_noFilesTitle, NLS.bind(CVSUIMessages.RestoreFromRepositoryAction_noFilesMessage, new String[] { resource.getName() })); //
- return;
- }
- RestoreFromRepositoryWizard wizard = new RestoreFromRepositoryWizard(resource, files);
- WizardDialog dialog = new ResizableWizardDialog(getShell(), wizard);
- dialog.setMinimumPageSize(350, 250);
- dialog.open();
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return false;
- if (resources[0].getType() == IResource.FILE) return false;
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resources[0]);
- try {
- if (!folder.isCVSFolder()) return false;
- } catch (CVSException e) {
- return isEnabledForException(e);
- }
- return true;
- }
-
- private ICVSFile[] fetchDeletedFiles(final IContainer parent) {
- final ICVSFile[][] files = new ICVSFile[1][0];
- files[0] = null;
- try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
- files[0] = fetchFilesInAttic(location, folder, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, true, PROGRESS_DIALOG);
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- return null;
- }
- return files[0];
- }
-
- /*
- * Fetch the RCS paths (minus the Attic segment) of all files in the Attic.
- * This path includes the repository root path.
- */
- private ICVSFile[] fetchFilesInAttic(ICVSRepositoryLocation location, ICVSFolder parent, IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- AtticLogListener listener = new AtticLogListener();
- Session session = new Session(location, parent, true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
- try {
- QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- IStatus status = Command.LOG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { Log.RCS_FILE_NAMES_ONLY },
- new ICVSResource[] { parent }, listener,
- Policy.subMonitorFor(monitor, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
- }
- } finally {
- session.close();
- }
- return listener.getAtticFilePaths();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
deleted file mode 100644
index b4919c017..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.wizards.ModeWizard;
-
-/**
- * TagAction tags the selected resources with a version tag specified by the user.
- */
-public class SetKeywordSubstitutionAction extends WorkspaceTraversalAction {
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) {
- ModeWizard.run(getShell(), getSelectedResources());
- }
-
- public String getId() {
- return ICVSUIConstants.CMD_SETFILETYPE;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
deleted file mode 100644
index 90f6d545c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
-import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.ShowAnnotationOperation;
-
-public class ShowAnnotationAction extends WorkspaceAction {
-
- /**
- * Action to open a CVS Annotate View
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final ICVSResource resource= getSingleSelectedCVSResource();
- if (resource == null)
- return;
- execute(resource);
- }
-
- /**
- * Fetch the revision number of a CVS resource and perform a ShowAnnotationOperation
- * in the background.
- *
- * @param cvsResource The CVS resource (must not be null)
- *
- * @throws InvocationTargetException
- * @throws InterruptedException
- */
- public void execute(final ICVSResource cvsResource) throws InvocationTargetException, InterruptedException {
- final String revision= getRevision(cvsResource);
- if (revision == null)
- return;
- boolean binary = isBinary(cvsResource);
- if (binary) {
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY);
- if (option.equals(MessageDialogWithToggle.PROMPT)) {
- final MessageDialogWithToggle dialog = (MessageDialogWithToggle.openYesNoQuestion(getShell(), CVSUIMessages.ShowAnnotationAction_2, NLS.bind(CVSUIMessages.ShowAnnotationAction_3, new String[] {cvsResource.getName()}), CVSUIMessages.ShowAnnotationOperation_4, false, store, ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY));
- final int result = dialog.getReturnCode();
- switch (result) {
- case IDialogConstants.NO_ID :
- return;
- }
- } else if (option.equals(MessageDialogWithToggle.NEVER))
- return;
- }
-
- new ShowAnnotationOperation(getTargetPart(), cvsResource, revision, binary).run();
- }
-
- private boolean isBinary(ICVSResource cvsResource) {
- if (cvsResource.isFolder()) return false;
-
- try {
- byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes();
- if (syncBytes == null)
- return false;
- return ResourceSyncInfo.isBinary(syncBytes);
- } catch (CVSException e) {
- return false;
- }
- }
-
- /**
- * Only enabled for single resource selection
- */
- public boolean isEnabled() {
- ICVSResource resource = getSingleSelectedCVSResource();
- try {
- return (resource != null && ! resource.isFolder() && resource.isManaged());
- } catch (CVSException e) {
- return isEnabledForException(e);
- }
- }
-
- /**
- * This action is called from one of a Resource Navigator a CVS Resource
- * Navigator or a History Log Viewer. Return the selected resource as an
- * ICVSResource
- *
- * @return ICVSResource
- */
- private ICVSResource getSingleSelectedCVSResource() {
- // Selected from a CVS Resource Navigator
- final ICVSResource[] cvsResources = getSelectedCVSResources();
- if (cvsResources.length == 1) {
- return cvsResources[0];
- }
-
- // Selected from a History Viewer
- final Object[] logEntries = getAdaptedSelection(LogEntry.class);
- if (logEntries.length == 1) {
- final LogEntry aLogEntry = (LogEntry) logEntries[0];
- final ICVSRemoteFile cvsRemoteFile = aLogEntry.getRemoteFile();
- return cvsRemoteFile;
- }
-
- //Selected from the CVS History Page
- final Object[] fileRevisions = getAdaptedSelection(CVSFileRevision.class);
- if (fileRevisions.length == 1) {
- final ICVSRemoteFile cvsRemoteFile =((CVSFileRevision) fileRevisions[0]).getCVSRemoteFile();
- return cvsRemoteFile;
- }
-
-
- // Selected from a Resource Navigator
- final IResource[] resources = getSelectedResources();
- if (resources.length == 1) {
- return getCVSResourceFor(resources[0]);
- }
- return null;
- }
-
-
- /**
- * Get the revision for the CVS resource. Throws an InvocationTargetException
- * if the revision could not be determined.
- *
- * @param cvsResource The CVS resource
- * @return The revision of the resource.
- * @throws InvocationTargetException
- */
- private String getRevision(ICVSResource cvsResource) throws InvocationTargetException {
- final ResourceSyncInfo info;
- try {
- info= cvsResource.getSyncInfo();
- if (info == null)
- throw new CVSException(NLS.bind(CVSUIMessages.ShowAnnotationAction_noSyncInfo, new String[] { cvsResource.getName() }));
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- return info.getRevision();
- }
-
- public String getId() {
- return ICVSUIConstants.CMD_ANNOTATE;
- }
-}
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 bf41f1192..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-public class ShowCVSPerspectiveAction extends Action {
- public void run() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
- if (activeWindow == null) {
- return;
- }
- IWorkbenchPage activePage = activeWindow.getActivePage();
- if (activePage == null) {
- return;
- }
- IPerspectiveDescriptor cvsPerspective = workbench.getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.team.cvs.ui.cvsPerspective"); //$NON-NLS-1$
- if(cvsPerspective!=null) {
- activePage.setPerspective(cvsPerspective);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
deleted file mode 100644
index a669cce7a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- * IBM Corporation - ongoing maintenance
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.EditorsInfo;
-import org.eclipse.team.internal.ccvs.ui.EditorsView;
-/**
- *
- *
- * Action for Show Editors in popup menus
- *
- * @author <a href="mailto:kohlwes@gmx.net">Gregor Kohlwes</a>
- *
- */
-public class ShowEditorsAction extends WorkspaceAction {
-
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final EditorsAction editorsAction = new EditorsAction();
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- executeProviderAction(editorsAction, monitor);
- }
- }, true /* cancelable */ , PROGRESS_DIALOG);
- EditorsInfo[] infos = editorsAction.getEditorsInfo();
- EditorsView view = (EditorsView)showView(EditorsView.VIEW_ID);
- if (view != null) {
- view.setInput(infos);
- }
-
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- // We support one selected Resource,
- // because the editors command will
- // show the editors of all children too.
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
deleted file mode 100644
index bf9eb950e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.ui.TeamUI;
-
-public class ShowHistoryAction extends CVSAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFile) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable)next;
- Object adapter = a.getAdapter(ICVSRemoteFile.class);
- if (adapter instanceof ICVSRemoteFile) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRemoteFile[] result = new ICVSRemoteFile[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRemoteFile[0];
- }
- /*
- * @see CVSAction#executeIAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- TeamUI.showHistoryFor(getTargetPage(), files[0], null);
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
- /*
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRemoteFile[] resources = getSelectedRemoteFiles();
- return resources.length == 1;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.ShowHistoryAction_showHistory;
- }
-
-}
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 e58a5b0b6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.TeamUI;
-
-public class ShowResourceInHistoryAction extends WorkspaceAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return;
- TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resources[0], null);
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.ShowHistoryAction_showHistory;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return (!cvsResource.isFolder() && super.isEnabledForCVSResource(cvsResource));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_HISTORY;
- }
-
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- protected boolean isEnabledForIgnoredResources() {
- return true;
- }
-}
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 bd9d81622..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceModelParticipant;
-import org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceSubscriberContext;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.actions.OpenInCompareAction;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.*;
-
-/**
- * Action to initiate a CVS workspace synchronize
- */
-public class SyncAction extends WorkspaceTraversalAction {
-
- public void execute(IAction action) throws InvocationTargetException {
- // First, see if there is a single file selected
- if (isOpenEditorForSingleFile()) {
- IFile file = getSelectedFile();
- if (file != null && isOKToShowSingleFile(file)) {
- showSingleFileComparison(getShell(), CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), file, getTargetPage());
- return;
- }
- }
- if (isShowModelSync()) {
- ResourceMapping[] mappings = getCVSResourceMappings();
- if (mappings.length == 0)
- return;
- SubscriberScopeManager manager = WorkspaceSubscriberContext.createWorkspaceScopeManager(mappings, true, CommitAction.isIncludeChangeSets(getShell(), CVSUIMessages.SyncAction_1));
- WorkspaceSubscriberContext context = WorkspaceSubscriberContext.createContext(manager, ISynchronizationContext.THREE_WAY);
- WorkspaceModelParticipant participant = new WorkspaceModelParticipant(context);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- participant.run(getTargetPart());
- } else {
- IResource[] resources = getResourcesToCompare(getWorkspaceSubscriber());
- if (resources == null || resources.length == 0) return;
- // First check if there is an existing matching participant
- WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, resources);
- // If there isn't, create one and add to the manager
- if (participant == null) {
- ISynchronizeScope scope;
- if (includesAllCVSProjects(resources)) {
- scope = new WorkspaceScope();
- } else {
- IWorkingSet[] sets = getSelectedWorkingSets();
- if (sets != null) {
- scope = new WorkingSetScope(sets);
- } else {
- scope = new ResourceScope(resources);
- }
- }
- participant = new WorkspaceSynchronizeParticipant(scope);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- }
- participant.refresh(resources, getTargetPart().getSite());
- }
- }
-
- private static boolean isShowModelSync() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC);
- }
-
- private static boolean isOpenEditorForSingleFile() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE);
- }
-
- private IWorkingSet[] getSelectedWorkingSets() {
- ResourceMapping[] mappings = getCVSResourceMappings();
- List sets = new ArrayList();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
- if (mapping.getModelObject() instanceof IWorkingSet) {
- IWorkingSet set = (IWorkingSet) mapping.getModelObject();
- sets.add(set);
- } else {
- return null;
- }
- }
- if (sets.isEmpty())
- return null;
- return (IWorkingSet[]) sets.toArray(new IWorkingSet[sets.size()]);
- }
-
- private boolean includesAllCVSProjects(IResource[] resources) {
- // First, make sure all the selected thinsg are projects
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getType() != IResource.PROJECT)
- return false;
- }
- IProject[] cvsProjects = getAllCVSProjects();
- return cvsProjects.length == resources.length;
- }
-
- private IProject[] getAllCVSProjects() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- Set cvsProjects = new HashSet();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- if (RepositoryProvider.isShared(project) && RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) != null) {
- cvsProjects.add(project);
- }
- }
- return (IProject[]) cvsProjects.toArray(new IProject[cvsProjects.size()]);
- }
-
- /**
- * Return whether it is OK to open the selected file directly in a compare editor.
- * It is not OK to show the single file if the file is part of a logical model element
- * that spans files.
- * @param file the file
- * @return whether it is OK to open the selected file directly in a compare editor
- */
- public static boolean isOKToShowSingleFile(IFile file) {
- if (!isShowModelSync())
- return true;
- IModelProviderDescriptor[] descriptors = ModelProvider.getModelProviderDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- IModelProviderDescriptor descriptor = descriptors[i];
- try {
- IResource[] resources = descriptor.getMatchingResources(new IResource[] { file });
- if (resources.length > 0) {
- ModelProvider provider = descriptor.getModelProvider();
- // Technically, we should us the remote context to determine if multiple resources are involved.
- // However, we do not have a progress monitor so we'll just use a local context since,
- // it is unlikely that a model element will consist of one file locally but multiple files remotely
- ResourceMapping[] mappings = provider.getMappings(file, ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int j = 0; j < mappings.length; j++) {
- ResourceMapping mapping = mappings[j];
- ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int k = 0; k < traversals.length; k++) {
- ResourceTraversal traversal = traversals[k];
- IResource[] tResources = traversal.getResources();
- for (int index = 0; index < tResources.length; index++) {
- IResource tr = tResources[index];
- if (!tr.equals(file))
- return false;
- }
- }
- }
- }
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- }
- return true;
- }
-
- /**
- * Refresh the subscriber directly and show the resulting synchronization state in a compare editor. If there
- * is no difference the user is prompted.
- *
- * @param resources the file to refresh and compare
- */
- public static void showSingleFileComparison(final Shell shell, final Subscriber subscriber, final IResource resource, final IWorkbenchPage page) {
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- subscriber.refresh(new IResource[]{resource}, IResource.DEPTH_ZERO, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- final SyncInfo info = subscriber.getSyncInfo(resource);
- if (info == null) return;
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (info.getKind() == SyncInfo.IN_SYNC) {
- MessageDialog.openInformation(shell, CVSUIMessages.SyncAction_noChangesTitle, CVSUIMessages.SyncAction_noChangesMessage); //
- } else {
- SyncInfoCompareInput input = new SyncInfoCompareInput(subscriber.getName(), info);
- OpenInCompareAction.openCompareEditor(input, page);
- }
- }
- });
- } catch (InvocationTargetException e) {
- Utils.handle(e);
- } catch (InterruptedException e) {
- } catch (TeamException e) {
- Utils.handle(e);
- }
- }
-
- public static boolean isSingleFile(IResource[] resources) {
- return resources.length == 1 && resources[0].getType() == IResource.FILE;
- }
-
- /**
- * Enable for resources that are managed (using super) or whose parent is a
- * CVS folder.
- *
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return (super.isEnabledForCVSResource(cvsResource) || (cvsResource.getParent().isCVSFolder() && !cvsResource.isIgnored()));
- }
-
- public String getId() {
- return ICVSUIConstants.CMD_SYNCHRONIZE;
- }
-
-
- public boolean isEnabled() {
- if(super.isEnabled()){
- return true;
- }
- IWorkingSet[] sets = getSelectedWorkingSets();
- // empty selection will not be considered
- if(sets == null || sets.length == 0){
- return false;
- }
-
- Set projects = getProjects(sets);
-
- boolean existsProjectToSynchronize = false;
- for (Iterator it = projects.iterator(); it.hasNext();) {
- IProject project = (IProject) it.next();
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if(provider != null){
- existsProjectToSynchronize = true;
- //we handle only CVS repositories
- if(!CVSProviderPlugin.getTypeId().equals(provider.getID())){
- return false;
- }
- }
- }
-
- return existsProjectToSynchronize;
- }
-
- private Set getProjects(IWorkingSet[] sets) {
- Set projects = new HashSet();
-
- if(sets == null)
- return projects;
-
- for (int i = 0; i < sets.length; i++) {
- IAdaptable ad[] = sets[i].getElements();
- if (ad != null) {
- for (int j = 0; j < ad.length; j++) {
- IResource resource = (IResource) ad[j]
- .getAdapter(IResource.class);
- if (resource != null) {
- projects.add(resource.getProject());
- }
- }
- }
- }
-
- return projects;
- }
-}
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 aabea012f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.TagAsVersionDialog;
-
-/**
- * TagAction tags the selected resources with a version tag specified by the user.
- */
-public abstract class TagAction extends WorkspaceTraversalAction {
-
- // remember if the execute action was cancelled
- private boolean wasCancelled = false;
-
- /**
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- setWasCancelled(false);
-
- // Prompt for the tag name
- final ITagOperation[] result = new ITagOperation[1];
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = configureOperation();
- if (result[0] == null) {
- return;
- }
- }});
-
- if (result[0] == null) {
- setWasCancelled(true);
- return;
- }
-
- result[0].run();
- }
-
- protected boolean performPrompting(ITagOperation operation) {
- return true;
- }
-
- /**
- * Prompts the user for a tag name.
- * Note: This method is designed to be overridden by test cases.
- * @return the operation, or null to cancel
- */
- protected ITagOperation configureOperation() {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- ITagOperation operation = createTagOperation();
- if (operation.isEmpty()) {
- return null;
- }
- if (!performPrompting(operation)) {
- return null;
- }
- TagAsVersionDialog dialog = new TagAsVersionDialog(getShell(),
- CVSUIMessages.TagAction_tagResources,
- operation);
- if (dialog.open() != Window.OK) return null;
-
- // The user has indicated they want to force a move. Make sure they really do.
- if (dialog.shouldMoveTag() && store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG)) {
- MessageDialogWithToggle confirmDialog = MessageDialogWithToggle.openYesNoQuestion(getShell(),
- CVSUIMessages.TagAction_moveTagConfirmTitle,
- NLS.bind(CVSUIMessages.TagAction_moveTagConfirmMessage, new String[] { dialog.getTagName() }),
- null,
- false,
- null,
- null);
-
- if (confirmDialog.getReturnCode() == IDialogConstants.YES_ID) {
- store.setValue(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, !confirmDialog.getToggleState());
- } else {
- return null;
- }
- }
-
- // The user is a cowboy and wants to do it.
- return dialog.getOperation();
- }
-
- protected abstract ITagOperation createTagOperation();
-
- protected String getErrorTitle() {
- return CVSUIMessages.TagAction_tagErrorTitle;
- }
-
- protected String getWarningTitle() {
- return CVSUIMessages.TagAction_tagWarningTitle;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- public boolean wasCancelled() {
- return wasCancelled;
- }
-
- public void setWasCancelled(boolean b) {
- wasCancelled = b;
- }
-
- public static void broadcastTagChange(final ICVSResource[] resources, final CVSTag tag) throws InvocationTargetException, InterruptedException {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- // Cache the new tag creation even if the tag may have had warnings.
- manager.addTags(getRootParent(resource), new CVSTag[] {tag});
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- private ICVSResource getRootParent(ICVSResource resource) throws CVSException {
- if (!resource.isManaged()) return resource;
- ICVSFolder parent = resource.getParent();
- if (parent == null) return resource;
- // Special check for a parent which is the repository itself
- if (parent.getName().length() == 0) return resource;
- return getRootParent(parent);
- }
- }, new NullProgressMonitor());
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
deleted file mode 100644
index d9f132d8e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.TagInRepositoryOperation;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class TagInRepositoryAction extends TagAction {
-
- /**
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSResource[] resources = getSelectedCVSResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof ICVSRepositoryLocation) return false;
- }
- return true;
- }
-
- /**
- * @see CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#requiresLocalSyncInfo()
- */
- protected boolean requiresLocalSyncInfo() {
- return false;
- }
-
- protected ITagOperation createTagOperation() {
- return new TagInRepositoryOperation(getTargetPart(), getSelectedRemoteResources());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
deleted file mode 100644
index e71ed4853..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
-
-/**
- * Action that tags the local workspace with a version tag.
- */
-public class TagLocalAction extends TagAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#performPrompting(org.eclipse.team.internal.ccvs.ui.operations.ITagOperation)
- */
- protected boolean performPrompting(ITagOperation operation) {
- if (operation instanceof TagOperation) {
- final TagOperation tagOperation = (TagOperation) operation;
- try {
- if (hasOutgoingChanges(tagOperation)) {
- final boolean[] keepGoing = new boolean[] { true };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), tagOperation.getScopeManager(),
- CVSUIMessages.TagLocalAction_2,
- CVSUIMessages.TagLocalAction_0,
- ""); //$NON-NLS-1$
- dialog.setHelpContextId(IHelpContextIds.TAG_OUTGOING_CHANGES_DIALOG);
- int result = dialog.open();
- keepGoing[0] = result == Window.OK;
- }
- });
- return keepGoing[0];
- }
- return true;
- } catch (InterruptedException e) {
- // Ignore
- } catch (InvocationTargetException e) {
- handle(e);
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#createTagOperation()
- */
- protected ITagOperation createTagOperation() {
- return new TagOperation(getTargetPart(), getCVSResourceMappings());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_TAGASVERSION;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java
deleted file mode 100644
index 29b543135..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class UneditAction extends WorkspaceAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- if(! MessageDialog.openConfirm(getShell(), CVSUIMessages.Uneditaction_confirmTitle, CVSUIMessages.Uneditaction_confirmMessage)) { //
- return;
- }
-
- run(new WorkspaceModifyOperation(null) {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- executeProviderAction(new IProviderAction() {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- provider.unedit(resources, false /* recurse */, true /* notify server */, monitor);
- return Team.OK_STATUS;
- }
- }, monitor);
- }
- }, true /* cancelable */, PROGRESS_DIALOG);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (cvsResource.isFolder()) return false;
- if (super.isEnabledForCVSResource(cvsResource)) {
- return !((ICVSFile)cvsResource).isReadOnly() && ((ICVSFile)cvsResource).isEdited();
- } else {
- return false;
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
deleted file mode 100644
index 483e452f0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.operations.DisconnectOperation;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Unmanage action removes the cvs feature from a project and optionally
- * deletes the CVS meta information that is stored on disk.
- */
-public class UnmanageAction extends WorkspaceAction {
-
- static class DeleteProjectDialog extends MessageDialog {
-
- boolean deleteContent = false;
- Button radio1;
- Button radio2;
-
- DeleteProjectDialog(Shell parentShell, IProject[] projects) {
- super(
- parentShell,
- getTitle(projects),
- null, // accept the default window icon
- getMessage(projects),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0); // yes is the default
- }
-
- static String getTitle(IProject[] projects) {
- if (projects.length == 1)
- return CVSUIMessages.Unmanage_title;
- else
- return CVSUIMessages.Unmanage_titleN;
- }
-
- static String getMessage(IProject[] projects) {
- if (projects.length == 1) {
- IProject project = projects[0];
- return NLS.bind(CVSUIMessages.Unmanage_message, new String[] { project.getName() });
- }
- else {
- return NLS.bind(CVSUIMessages.Unmanage_messageN, new String[] { new Integer(projects.length).toString() });
- }
- }
-
- 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(CVSUIMessages.Unmanage_option2);
-
- radio2 = new Button(composite, SWT.RADIO);
- radio2.addSelectionListener(selectionListener);
-
- radio2.setText(CVSUIMessages.Unmanage_option1);
-
- // set initial state
- radio1.setSelection(deleteContent);
- radio2.setSelection(!deleteContent);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DISCONNECT_ACTION);
-
- return composite;
- }
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.widget;
- if (button.getSelection()) {
- deleteContent = (button == radio1);
- }
- }
- };
-
- public boolean getDeleteContent() {
- return deleteContent;
- }
- }
-
- private boolean deleteContent = false;
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- if(confirmDeleteProjects()) {
- new DisconnectOperation(getTargetPart(), getSelectedProjects(), deleteContent)
- .run();
- }
- }
-
- boolean confirmDeleteProjects() {
- final int[] result = new int[] { Window.OK };
- IProject[] projects = getSelectedProjects();
- final DeleteProjectDialog dialog = new DeleteProjectDialog(getShell(), projects);
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
- deleteContent = dialog.getDeleteContent();
- return result[0] == 0; // YES
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.Unmanage_unmanagingError;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- IResource resource = cvsResource.getIResource();
- return resource != null && resource.getType() == IResource.PROJECT;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
deleted file mode 100644
index 54a383b7c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.wizards.UpdateWizard;
-
-/**
- * UpdateAction performs a 'cvs update' command on the selected resources.
- * If conflicts are present (file has been changed both remotely and locally),
- * the changes will be merged into the local file such that the user must
- * resolve the conflicts. This action is temporary code; it will be removed
- * when a functional synchronize view has been implemented.
- */
-public class UpdateAction extends UpdateSilentAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- UpdateWizard.run(getTargetPart(), getCVSResourceMappings());
- }
-
- public String getId() {
- return ICVSUIConstants.CMD_UPDATESWITCH;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
deleted file mode 100644
index 3902acdd3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.mappings.ModelUpdateOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-
-/**
- * Action that runs an update without prompting the user for a tag.
- *
- * @since 3.1
- */
-public class UpdateSilentAction extends WorkspaceTraversalAction {
-
- /*
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- if (CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_HANDLING).equals(ICVSUIConstants.PREF_UPDATE_HANDLING_TRADITIONAL)) {
- new UpdateOperation(getTargetPart(), getCVSResourceMappings(), Command.NO_LOCAL_OPTIONS, null /* no tag */).run();
- } else {
- new ModelUpdateOperation(getTargetPart(), getSelectedResourceMappings(CVSProviderPlugin.getTypeId())).run();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
- */
- public String getId() {
- return ICVSUIConstants.CMD_UPDATE;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
deleted file mode 100644
index da414209a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.osgi.util.NLS;
-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.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.team.internal.ui.dialogs.PromptingDialog;
-
-/**
- * This class represents an action performed on a local CVS workspace
- */
-public abstract class WorkspaceAction extends CVSAction {
-
- public interface IProviderAction {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#beginExecution(IAction)
- */
- protected boolean beginExecution(IAction action) throws TeamException {
- if (super.beginExecution(action)) {
- // Ensure that the required sync info is loaded
- if (requiresLocalSyncInfo()) {
- // There is a possibility of the selection containing an orphaned subtree.
- // If it does, they will be purged and enablement rechecked before the
- // operation is performed.
- handleOrphanedSubtrees();
- // Check enablement just in case the sync info wasn't loaded
- if (!isEnabled()) {
- MessageDialog.openInformation(getShell(), CVSUIMessages.CVSAction_disabledTitle, CVSUIMessages.CVSAction_disabledMessage); //
- return false;
- }
- }
- return true;
- } else {
- return false;
- }
- }
-
- /*
- * Determine if any of the selected resources are deascendants of
- * an orphaned CVS subtree and if they are, purge the CVS folders.
- */
- private boolean handleOrphanedSubtrees() {
- // invoke the inherited method so that overlaps are maintained
- IResource[] resources = getSelectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- handleOrphanedSubtree(resource);
- }
- return false;
- }
-
- /*
- * Determine if the resource is a descendant of an orphaned subtree.
- * If it is, purge the CVS folders of the subtree.
- */
- private void handleOrphanedSubtree(IResource resource) {
- try {
- if (!CVSWorkspaceRoot.isSharedWithCVS(resource)) return ;
- ICVSFolder folder;
- if (resource.getType() == IResource.FILE) {
- folder = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent());
- } else {
- folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resource);
- }
- handleOrphanedSubtree(folder);
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
- }
-
- /*
- * Recursively check for and handle orphaned CVS folders
- */
- private void handleOrphanedSubtree(final ICVSFolder folder) throws CVSException {
- if (folder.getIResource().getType() == IResource.PROJECT) return;
- if (CVSWorkspaceRoot.isOrphanedSubtree((IContainer)folder.getIResource())) {
- try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- folder.unmanage(null);
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
- }
- }, true, PROGRESS_BUSYCURSOR);
- } catch (InvocationTargetException e) {
- // Ignore this since we logged the one we care about above
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
- handleOrphanedSubtree(folder.getParent());
- }
-
- /**
- * Return true if the sync info is loaded for all selected resources.
- * The purpose of this method is to allow enablement code to be as fast
- * as possible. If the sync info is not loaded, the menu should be enabled
- * and, if choosen, the action will verify that it is indeed enabled before
- * performing the associated operation
- */
- protected boolean isSyncInfoLoaded(IResource[] resources) throws CVSException {
- return EclipseSynchronizer.getInstance().isSyncInfoLoaded(resources, getEnablementDepth());
- }
-
- /**
- * Returns the resource depth of the action for use in determining if the required
- * sync info is loaded. The default is IResource.DEPTH_INFINITE. Sunclasses can override
- * as required.
- */
- protected int getActionDepth() {
- return IResource.DEPTH_INFINITE;
- }
-
- /**
- * Returns the resource depth of the action enablement for use in determining if the required
- * sync info is loaded. The default is IResource.DEPTH_ZERO. Sunclasses can override
- * as required.
- */
- protected int getEnablementDepth() {
- return IResource.DEPTH_ZERO;
- }
-
- /**
- * Ensure that the sync info for all the provided resources has been loaded.
- * If an out-of-sync resource is found, prompt to refresh all the projects involved.
- */
- protected boolean ensureSyncInfoLoaded(IResource[] resources) throws CVSException {
- boolean keepTrying = true;
- while (keepTrying) {
- try {
- EclipseSynchronizer.getInstance().ensureSyncInfoLoaded(resources, getActionDepth());
- keepTrying = false;
- } catch (CVSException e) {
- if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- // determine the projects of the resources involved
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- projects.add(resource.getProject());
- }
- // prompt to refresh
- if (promptToRefresh(getShell(), (IResource[]) projects.toArray(new IResource[projects.size()]), e.getStatus())) {
- for (Iterator iter = projects.iterator();iter.hasNext();) {
- IProject project = (IProject) iter.next();
- try {
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException coreException) {
- throw CVSException.wrapException(coreException);
- }
- }
- } else {
- return false;
- }
- } else {
- throw e;
- }
- }
- }
- return true;
- }
-
- /**
- * Override to ensure that the sync info is available before performing the
- * real <code>isEnabled()</code> test.
- *
- * @see org.eclipse.team.internal.ui.actions.TeamAction#setActionEnablement(IAction)
- */
- protected void setActionEnablement(IAction action) {
- try {
- boolean requires = requiresLocalSyncInfo();
- if (!requires || (requires && isSyncInfoLoaded(getSelectedResources()))) {
- super.setActionEnablement(action);
- } else {
- // If the sync info is not loaded, enable the menu item
- // Performing the action will ensure that the action should really
- // be enabled before anything else is done
- action.setEnabled(true);
- }
- } catch (CVSException e) {
- // We couldn't determine if the sync info was loaded.
- // Enable the action so that performing the action will
- // reveal the error to the user.
- action.setEnabled(true);
- }
- }
-
- /**
- * Return true if the action requires the sync info for the selected resources.
- * If the sync info is required, the real enablement code will only be run if
- * the sync info is loaded from disc. Otherwise, the action is enabled and
- * performing the action will load the sync info and verify that the action is truely
- * enabled before doing anything else.
- *
- * This implementation returns <code>true</code>. Subclasses must override if they do
- * not require the sync info of the selected resources.
- *
- * @return boolean
- */
- protected boolean requiresLocalSyncInfo() {
- return true;
- }
-
- protected boolean promptToRefresh(final Shell shell, final IResource[] resources, final IStatus status) {
- final boolean[] result = new boolean[] { false};
- Runnable runnable = new Runnable() {
- public void run() {
- Shell shellToUse = shell;
- if (shell == null) {
- shellToUse = new Shell(Display.getCurrent());
- }
- String question;
- if (resources.length == 1) {
- question = NLS.bind(CVSUIMessages.CVSAction_refreshQuestion, new String[] { status.getMessage(), resources[0].getFullPath().toString() });
- } else {
- question = NLS.bind(CVSUIMessages.CVSAction_refreshMultipleQuestion, new String[] { status.getMessage() });
- }
- result[0] = MessageDialog.openQuestion(shellToUse, CVSUIMessages.CVSAction_refreshTitle, question);
- }
- };
- Display.getDefault().syncExec(runnable);
- return result[0];
- }
-
- /**
- * Most CVS workspace actions modify the workspace and thus should
- * save dirty editors.
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return true;
- }
-
- /**
- * The action is enabled for the appropriate resources. This method checks
- * that:
- * <ol>
- * <li>there is no overlap between a selected file and folder (overlapping
- * folders is allowed because of logical vs. physical mapping problem in
- * views)
- * <li>the state of the resources match the conditions provided by:
- * <ul>
- * <li>isEnabledForIgnoredResources()
- * <li>isEnabledForManagedResources()
- * <li>isEnabledForUnManagedResources() (i.e. not ignored and not managed)
- * </ul>
- * </ol>
- * @see TeamAction#isEnabled()
- */
- public boolean isEnabled() {
-
- // allow the super to decide enablement. if the super doesn't know it will return false.
- boolean enabled = super.isEnabled();
- if(enabled) return true;
-
- // invoke the inherited method so that overlaps are maintained
- IResource[] resources = getSelectedResourcesWithOverlap();
-
- // disable if no resources are selected
- if(resources.length==0) return false;
-
- // disable properly for single resource enablement
- if (!isEnabledForMultipleResources() && resources.length != 1) return false;
-
- // validate enabled for each resource in the selection
- List folderPaths = new ArrayList();
- List filePaths = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
-
- // only enable for accessible resources
- if(resource.getType() == IResource.PROJECT) {
- if (! resource.isAccessible()) return false;
- }
-
- // no CVS actions are enabled if the selection contains a linked resource
- if (CVSWorkspaceRoot.isLinkedResource(resource)) return false;
-
- // only enable for resources in a project shared with CVS
- if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
- return false;
- }
-
- // collect files and folders separately to check for overlap later
- IPath resourceFullPath = resource.getFullPath();
- if(resource.getType() == IResource.FILE) {
- filePaths.add(resourceFullPath);
- } else {
- folderPaths.add(resourceFullPath);
- }
-
- // ensure that resource management state matches what the action requires
- ICVSResource cvsResource = getCVSResourceFor(resource);
- try {
- if (!isEnabledForCVSResource(cvsResource)) {
- return false;
- }
- } catch (CVSException e) {
- if (!isEnabledForException(e))
- return false;
- }
- }
- // Ensure that there is no overlap between files and folders
- // NOTE: folder overlap must be allowed because of logical vs. physical
- if(!folderPaths.isEmpty()) {
- for (Iterator fileIter = filePaths.iterator(); fileIter.hasNext();) {
- IPath resourcePath = (IPath) fileIter.next();
- for (Iterator it = folderPaths.iterator(); it.hasNext();) {
- IPath folderPath = (IPath) it.next();
- if (folderPath.isPrefixOf(resourcePath)) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Method isEnabledForCVSResource.
- * @param cvsResource
- * @return boolean
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- boolean managed = false;
- boolean ignored = false;
- boolean added = false;
- if (cvsResource.isIgnored()) {
- ignored = true;
- } else if (cvsResource.isFolder()) {
- managed = ((ICVSFolder)cvsResource).isCVSFolder();
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- managed = info != null;
- if (managed) added = info.isAdded();
- }
- if (managed && ! isEnabledForManagedResources()) return false;
- if ( ! managed && ! isEnabledForUnmanagedResources()) return false;
- if ( ignored && ! isEnabledForIgnoredResources()) return false;
- if (added && ! isEnabledForAddedResources()) return false;
- if ( ! cvsResource.exists() && ! isEnabledForNonExistantResources()) return false;
- return true;
- }
-
- /**
- * Method isEnabledForIgnoredResources.
- * @return boolean
- */
- protected boolean isEnabledForIgnoredResources() {
- return false;
- }
-
- /**
- * Method isEnabledForUnmanagedResources.
- * @return boolean
- */
- protected boolean isEnabledForUnmanagedResources() {
- return false;
- }
-
- /**
- * Method isEnabledForManagedResources.
- * @return boolean
- */
- protected boolean isEnabledForManagedResources() {
- return true;
- }
-
- /**
- * Method isEnabledForAddedResources.
- * @return boolean
- */
- protected boolean isEnabledForAddedResources() {
- return true;
- }
-
- /**
- * Method isEnabledForAddedResources.
- * @return boolean
- */
- protected boolean isEnabledForMultipleResources() {
- return true;
- }
-
- /**
- * Method isEnabledForNonExistantResources.
- * @return boolean
- */
- protected boolean isEnabledForNonExistantResources() {
- return false;
- }
-
- protected void executeProviderAction(IProviderAction action, IResource[] resources, IProgressMonitor monitor) throws InvocationTargetException {
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask(null, keySet.size() * 1000);
- Iterator iterator = keySet.iterator();
-
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- try {
- addStatus(action.execute(provider, providerResources, subMonitor));
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
-
- }
- }
-
- protected void executeProviderAction(IProviderAction action, IProgressMonitor monitor) throws InvocationTargetException {
- executeProviderAction(action, getSelectedResources(), monitor);
- }
-
- /**
- * Given the current selection this method returns a text label that can
- * be shown to the user that reflects the tags in the current selection.
- * These can be used in the <b>Compare With</b> and <b>Replace With</b> actions.
- */
- protected String calculateActionTagValue() {
- try {
- IResource[] resources = getSelectedResources();
- CVSTag commonTag = null;
- boolean sameTagType = true;
- boolean multipleSameNames = true;
-
- for (int i = 0; i < resources.length; i++) {
- ICVSResource cvsResource = getCVSResourceFor(resources[i]);
- CVSTag tag = null;
- if(cvsResource.isFolder()) {
- FolderSyncInfo info = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(info != null) {
- tag = info.getTag();
- }
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(resources[i], tag);
- }
- } else {
- tag = Util.getAccurateFileTag(cvsResource);
- }
- if(tag == null) {
- tag = new CVSTag();
- }
- if(commonTag == null) {
- commonTag = tag;
- } else if(!commonTag.equals(tag)) {
- if(commonTag.getType() != tag.getType()) {
- sameTagType = false;
- }
- if(!commonTag.getName().equals(tag.getName())) {
- multipleSameNames = false;
- }
- }
- }
-
- // set text to default
- String actionText = CVSUIMessages.ReplaceWithLatestAction_multipleTags;
- if(commonTag != null) {
- int tagType = commonTag.getType();
- String tagName = commonTag.getName();
- // multiple tag names but of the same type
- if(sameTagType && !multipleSameNames) {
- if(tagType == CVSTag.BRANCH) {
- actionText = CVSUIMessages.ReplaceWithLatestAction_multipleBranches; //
- } else {
- actionText = CVSUIMessages.ReplaceWithLatestAction_multipleVersions;
- }
- // same tag names and types
- } else if(sameTagType && multipleSameNames) {
- if(tagType == CVSTag.BRANCH) {
- actionText = NLS.bind(CVSUIMessages.ReplaceWithLatestAction_singleBranch, new String[] { tagName }); //
- } else if(tagType == CVSTag.VERSION){
- actionText = NLS.bind(CVSUIMessages.ReplaceWithLatestAction_singleVersion, new String[] { tagName });
- } else if(tagType == CVSTag.HEAD) {
- actionText = NLS.bind(CVSUIMessages.ReplaceWithLatestAction_singleHEAD, new String[] { tagName });
- }
- }
- }
-
- return actionText;
- } catch (CVSException e) {
- // silently ignore
- return CVSUIMessages.ReplaceWithLatestAction_multipleTags; //
- }
- }
-
- protected IResource[] checkOverwriteOfDirtyResources(IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- List dirtyResources = new ArrayList();
- IResource[] selectedResources = getSelectedResources();
-
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, selectedResources.length * 100);
- monitor.setTaskName(CVSUIMessages.ReplaceWithAction_calculatingDirtyResources);
- for (int i = 0; i < selectedResources.length; i++) {
- IResource resource = selectedResources[i];
- ICVSResource cvsResource = getCVSResourceFor(resource);
- if(cvsResource.isModified(Policy.subMonitorFor(monitor, 100))) {
- dirtyResources.add(resource);
- }
- }
- } finally {
- monitor.done();
- }
-
- PromptingDialog dialog = new PromptingDialog(getShell(), selectedResources,
- getPromptCondition((IResource[]) dirtyResources.toArray(new IResource[dirtyResources.size()])), CVSUIMessages.ReplaceWithAction_confirmOverwrite);
- return dialog.promptForMultiple();
- }
-
- /**
- * This is a helper for the CVS UI automated tests. It allows the tests to ignore prompting dialogs.
- * @param resources
- */
- protected IPromptCondition getPromptCondition(IResource[] resources) {
- return getOverwriteLocalChangesPrompt(resources);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
deleted file mode 100644
index 6f40a7e83..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.mapping.BuildScopeOperation;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A specialized workspace actions that operates on resource traversals
- * instead of resources/
- */
-public abstract class WorkspaceTraversalAction extends WorkspaceAction {
-
- /**
- * Return the selected mappings that contain resources
- * within a CVS managed project.
- * @return the selected mappings that contain resources
- * within a CVS managed project
- */
- protected ResourceMapping[] getCVSResourceMappings() {
- return getSelectedResourceMappings(CVSProviderPlugin.getTypeId());
- }
-
- private static ResourceTraversal[] getTraversals(IWorkbenchPart part, ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException {
- try {
- BuildScopeOperation op = new BuildScopeOperation(part, manager);
- op.run(monitor);
- return manager.getScope().getTraversals();
- } catch (InvocationTargetException e) {
- throw TeamException.asTeamException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- private static IResource[] getRootTraversalResources(ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException {
- Set result = new HashSet();
- ResourceTraversal[] traversals = getTraversals(null, manager, monitor);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- if (RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) != null) {
- result.add(resource);
- }
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- protected Subscriber getWorkspaceSubscriber() {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- }
-
- public static IResource[] getResourcesToCompare(ResourceMapping[] mappings, Subscriber subscriber) throws InvocationTargetException {
- ISynchronizationScopeManager manager = new SynchronizationScopeManager("", //$NON-NLS-1$
- mappings, SubscriberResourceMappingContext.createContext(subscriber), true);
- try {
- return getResourcesToCompare(manager);
- } finally {
- manager.dispose();
- }
- }
-
- protected IResource[] getResourcesToCompare(final Subscriber subscriber) throws InvocationTargetException {
- ISynchronizationScopeManager manager = new SynchronizationScopeManager("", //$NON-NLS-1$
- getCVSResourceMappings(), SubscriberResourceMappingContext.createContext(subscriber), true);
- try {
- return getResourcesToCompare(manager);
- } finally {
- manager.dispose();
- }
- }
-
- protected ResourceMappingContext getResourceMappingContext() {
- return SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-
- public static IResource[] getResourcesToCompare(final ISynchronizationScopeManager manager) throws InvocationTargetException {
- // Determine what resources need to be synchronized.
- // Use a resource mapping context to include any relevant remote resources
- final IResource[][] resources = new IResource[][] { null };
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = getRootTraversalResources(
- manager,
- monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- });
- } catch (InterruptedException e) {
- // Canceled
- return null;
- }
- return resources[0];
- }
-
- public static IResource[] getProjects(IResource[] resources) {
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- projects.add(resource.getProject());
- }
- return (IResource[]) projects.toArray(new IResource[projects.size()]);
- }
-
- /**
- *
- * @param mappings
- * @return
- *
- * @deprecated need to find a better way to do this
- */
- public static boolean isLogicalModel(ResourceMapping[] mappings) {
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
- if (! (mapping.getModelObject() instanceof IResource) ) {
- return true;
- }
- }
- return false;
- }
-
- protected IFile getSelectedFile() {
- ResourceMapping[] mappings = getCVSResourceMappings();
- if (mappings.length == 1) {
- IResource resource = Utils.getResource(mappings[0].getModelObject());
- if (resource != null && resource.getType() == IResource.FILE)
- return (IFile)resource;
- }
- return null;
- }
-
- protected boolean hasOutgoingChanges(final RepositoryProviderOperation operation) throws InvocationTargetException, InterruptedException {
- final boolean[] hasChange = new boolean[] { false };
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- monitor.beginTask(CVSUIMessages.WorkspaceTraversalAction_0, 100);
- operation.buildScope(Policy.subMonitorFor(monitor, 50));
- hasChange[0] = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().hasLocalChanges(
- operation.getScope().getTraversals(),
- Policy.subMonitorFor(monitor, 50));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- return hasChange[0];
- }
-
- /**
- * Return the complete set of traversals to be targeted by the action
- * including those that are included by consulting the models.
- *
- * @param monitor
- * a progress monitor
- * @return the complete set of traversals to be targeted by the action
- * @throws CoreException
- */
- protected ResourceTraversal[] getTraversals(IProgressMonitor monitor) throws CoreException {
- SynchronizationScopeManager scopeManager = getScopeManager();
- try {
- return getTraversals(getTargetPart(), scopeManager, monitor);
- } finally {
- scopeManager.dispose();
- }
- }
-
- /**
- * Return a scope manager that provides the scope for the action.
- * @return a scope manager that provides the scope for the action
- */
- protected SynchronizationScopeManager getScopeManager() {
- return new SynchronizationScopeManager(
- "", //$NON-NLS-1$
- getCVSResourceMappings(),
- getResourceMappingContext(), true);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties
deleted file mode 100644
index bff5d9434..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties
+++ /dev/null
@@ -1,93 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-SetKeywordSubstitutionAction.label=Cha&nge ASCII/Binary Property...
-SetKeywordSubstitutionAction.tooltip=Change whether the selected resources should be treated as ASCII or binary on the CVS Server
-
-WorkingSetSelectionDialog.detailsButton.label= &Edit...
-WorkingSetSelectionDialog.newButton.label= &New...
-WorkingSetSelectionDialog.removeButton.label= &Remove
-
-WorkspaceToolbarCommitAction.label=Commit
-WorkspaceToolbarCommitAction.tooltip=Commit All Outgoing Changes...
-WorkspaceToolbarCommitAction.description=Commit All Outgoing Changes...
-WorkspaceToolbarCommitAction.image=checkin_action.gif
-
-WorkspaceToolbarUpdateAction.label=Update
-WorkspaceToolbarUpdateAction.tooltip=Update All Incoming Changes...
-WorkspaceToolbarUpdateAction.description=Update All Incoming Changes...
-WorkspaceToolbarUpdateAction.image=checkout_action.gif
-
-SharingWizardIgnore.label=Ignore
-SharingWizardIgnore.tooltip=Ignore Selected Resources...
-SharingWizardIgnore.description=Ignore Selected Resources...
-SharingWizardIgnore.image=ignorefiles.gif
-
-ConsoleRemoveAction.label=Close CVS Console
-ConsoleRemoveAction.tooltip=Close CVS console
-ConsoleRemoveAction.image=participant_rem.gif
-
-WorkspaceUpdateAction.label=&Update
-WorkspaceUpdateAction.tooltip=Perform an update on the selected resources
-WorkspaceUpdateAction.helpContextId=org.eclipse.team.cvs.ui.workspace_update_action
-
-OverrideAndUpdateAction.label=O&verride and Update
-OverrideAndUpdateAction.tooltip=Perform an override and update on the selected resources. This will make the local contents equal to the remote ignoring any local changes.
-OverrideAndUpdateAction.helpContextId=org.eclipse.team.cvs.ui.workspace_overupdate_action
-
-RefreshDirtyStateAction.label=C&lean Timestamps
-RefreshDirtyStateAction.tooltip=Reset the dirty state of out-of-sync files whose contents match the server contents
-RefreshDirtyStateAction.helpContextId=org.eclipse.team.cvs.ui.workspace_refresh_dirty_state_action_context
-
-WorkspaceCommitAction.label=&Commit...
-WorkspaceCommitAction.tooltip=Perform a commit on the selected resources
-WorkspaceCommitAction.helpContextId="org.eclipse.team.cvs.ui.workspace_commit_action
-
-OverrideAndCommitAction.label=Override and Comm&it...
-OverrideAndCommitAction.tooltip=Perform an override and commit on the selected resources. This will make the remote contents equal to the local ignoring any remote changes.
-OverrideAndCommitAction.helpContextId=org.eclipse.team.cvs.ui.workspace_overcommit_action
-
-ConfirmMergedAction.label=&Mark as Merged
-ConfirmMergedAction.tooltip=Mark the conflict as merged by upgrading the base to match the remote
-ConfirmMergedAction.helpContextId=org.eclipse.team.cvs.ui.workspace_confirm_merged_action
-
-BranchAction.label=&Branch...
-BranchAction.tooltip=Branch
-
-IgnoreAction.label=A&dd to .cvsignore...
-IgnoreAction.tooltip=Ignore the Selected Resources when Synchronizing
-
-ShowResourceInHistoryAction.label=Sho&w in History
-ShowResourceInHistoryAction.tooltip=Show in History
-
-ShowAnnotationAction.label=Show &Annotation
-ShowAnnotationAction.tooltip=Show Annotation
-
-GenerateDiffFileAction.label=Create &Patch...
-GenerateDiffFileAction.tooltip=Compare your workspace contents with the server and generate a diff file that can be used as a patch file.
-
-MergeUpdateAction.label=&Update
-MergeUpdateAction.tooltip=Perform an update merge on the selected resources
-MergeUpdateAction.helpContextId=org.eclipse.team.cvs.ui.merge_update_action
-
-CompareRevertAction.label=&Override and Update
-CompareRevertAction.tooltip=Revert the local file contents to match that of their corresponding remotes
-CompareRevertAction.helpContextId=org.eclipse.team.cvs.ui.compare_revert_action
-
-SharingCommitAction.label=Commit
-SharingCommitAction.tooltip=Commit All Changes...
-SharingCommitAction.description=Commit All Changes...
-SharingCommitAction.image=checkin_action.gif
-
-ComnitWizardComparePaneToggle.label=Show Changes
-ComnitWizardComparePaneToggle.tooltip=Show file content changes pane
-ComnitWizardComparePaneToggle.description=Show file content changes pane
-ComnitWizardComparePaneToggle.image=syncpane_co.gif
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
deleted file mode 100644
index 2c741a0ea..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-//commented out because of Bug 75387
-//import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole.MyLifecycle;
-import org.eclipse.ui.console.*;
-
-/**
- * Console factory is used to show the console from the Console view "Open Console"
- * drop-down action. This factory is registered via the org.eclipse.ui.console.consoleFactory
- * extension point.
- *
- * @since 3.1
- */
-public class CVSConsoleFactory implements IConsoleFactory {
-
- public CVSConsoleFactory() {
- }
-
- public void openConsole() {
- showConsole();
- }
-
- public static void showConsole() {
- CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole();
- if (console != null) {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] existing = manager.getConsoles();
- boolean exists = false;
- for (int i = 0; i < existing.length; i++) {
- if(console == existing[i])
- exists = true;
- }
- if(! exists)
- manager.addConsoles(new IConsole[] {console});
- manager.showConsoleView(console);
- }
- }
-
- public static void closeConsole() {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole();
- if (console != null) {
- manager.removeConsoles(new IConsole[] {console});
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(console.new MyLifecycle());
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
deleted file mode 100644
index 181ed6127..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.console.*;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * Console helper that allows contributing actions to the console view when
- * the CVS console is visible. Added to the console via an extension point
- * from org.eclipse.ui.console.
- *
- * @since 3.1
- */
-public class CVSConsolePageParticipant implements IConsolePageParticipant {
-
- private ConsoleRemoveAction consoleRemoveAction;
-
- public void init(IPageBookViewPage page, IConsole console) {
- this.consoleRemoveAction = new ConsoleRemoveAction();
- IActionBars bars = page.getSite().getActionBars();
- bars.getToolBarManager().appendToGroup(IConsoleConstants.LAUNCH_GROUP, consoleRemoveAction);
- }
-
- public void dispose() {
- this.consoleRemoveAction = null;
- }
-
- public void activated() {
- }
-
- public void deactivated() {
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
deleted file mode 100644
index 6f9fafe9c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.*;
-
-/**
- * Console that shows the output of CVS commands. It is shown as a page in the generic
- * console view. It supports coloring for message, command, and error lines in addition
- * the font can be configured.
- *
- * @since 3.0
- */
-public class CVSOutputConsole extends MessageConsole implements IConsoleListener, IPropertyChangeListener {
-
- // created colors for each line type - must be disposed at shutdown
- private Color commandColor;
- private Color messageColor;
- private Color errorColor;
-
- // used to time the commands
- private long commandStarted = 0;
-
- // streams for each command type - each stream has its own color
- private MessageConsoleStream commandStream;
- private MessageConsoleStream messageStream;
- private MessageConsoleStream errorStream;
-
- // preferences for showing the cvs console when cvs output is provided
- private boolean showOnMessage;
-
- private ConsoleDocument document;
- private IConsoleManager consoleManager;
-
- // format for timings printed to console
- private static final DateFormat TIME_FORMAT;
-
- static {
- DateFormat format;
- try {
- format = new SimpleDateFormat(CVSUIMessages.Console_resultTimeFormat);
- } catch (RuntimeException e) {
- // This can happen if the bundle contains an invalid format
- format = new SimpleDateFormat("'(took 'm:ss.SSS')')"); //$NON-NLS-1$
- }
- TIME_FORMAT = format;
- }
-
- // Indicates whether the console is visible in the Console view
- private boolean visible = false;
- // Indicates whether the console's streams have been initialized
- private boolean initialized = false;
-
- /*
- * Constant used for indenting error status printing
- */
- private static final String NESTING = " "; //$NON-NLS-1$
-
- /**
- * Used to notify this console of lifecycle methods <code>init()</code>
- * and <code>dispose()</code>.
- */
- public class MyLifecycle implements org.eclipse.ui.console.IConsoleListener {
- public void consolesAdded(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == CVSOutputConsole.this) {
- init();
- }
- }
-
- }
- public void consolesRemoved(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == CVSOutputConsole.this) {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- dispose();
- }
- }
- }
- }
-
- /**
- * Constructor initializes preferences and colors but doesn't create the console
- * page yet.
- */
- public CVSOutputConsole() {
- super("CVS", CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CVS_CONSOLE)); //$NON-NLS-1$
- showOnMessage = CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE);
- document = new ConsoleDocument();
- consoleManager = ConsolePlugin.getDefault().getConsoleManager();
- CVSProviderPlugin.getPlugin().setConsoleListener(CVSOutputConsole.this);
- CVSUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(CVSOutputConsole.this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.AbstractConsole#init()
- */
- protected void init() {
- // Called when console is added to the console view
- super.init();
-
- initLimitOutput();
- initWrapSetting();
-
- // Ensure that initialization occurs in the ui thread
- CVSUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- JFaceResources.getFontRegistry().addListener(CVSOutputConsole.this);
- initializeStreams();
- dump();
- }
- });
- }
-
- private void initWrapSetting() {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_WRAP)) {
- setConsoleWidth(store.getInt(ICVSUIConstants.PREF_CONSOLE_WIDTH));
- } else {
- setConsoleWidth(-1);
- }
- }
-
- private void initLimitOutput() {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT)) {
- setWaterMarks(1000, store.getInt(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK));
- } else {
- setWaterMarks(-1, 0);
- }
- }
-
- /*
- * Initialize thre streams of the console. Must be
- * called from the UI thread.
- */
- private void initializeStreams() {
- synchronized(document) {
- if (!initialized) {
- commandStream = newMessageStream();
- errorStream = newMessageStream();
- messageStream = newMessageStream();
- // install colors
- commandColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR);
- commandStream.setColor(commandColor);
- messageColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR);
- messageStream.setColor(messageColor);
- errorColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR);
- errorStream.setColor(errorColor);
- // install font
- Font f = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().get(ICVSUIConstants.PREF_CONSOLE_FONT);
- setFont(f);
- initialized = true;
- }
- }
- }
-
- private void dump() {
- synchronized(document) {
- visible = true;
- ConsoleDocument.ConsoleLine[] lines = document.getLines();
- for (int i = 0; i < lines.length; i++) {
- ConsoleDocument.ConsoleLine line = lines[i];
- appendLine(line.type, line.line);
- }
- document.clear();
- }
- }
-
- private void appendLine(int type, String line) {
- showConsole();
- synchronized(document) {
- if(visible) {
- switch(type) {
- case ConsoleDocument.COMMAND:
- commandStream.println(line);
- break;
- case ConsoleDocument.MESSAGE:
- messageStream.println(" " + line); //$NON-NLS-1$
- break;
- case ConsoleDocument.ERROR:
- errorStream.println(" " + line); //$NON-NLS-1$
- break;
- }
- } else {
- document.appendConsoleLine(type, line);
- }
- }
- }
-
- private void showConsole() {
- show(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.MessageConsole#dispose()
- */
- protected void dispose() {
- // Here we can't call super.dispose() because we actually want the partitioner to remain
- // connected, but we won't show lines until the console is added to the console manager
- // again.
-
- // Called when console is removed from the console view
- synchronized (document) {
- visible = false;
- JFaceResources.getFontRegistry().removeListener(this);
- }
- }
-
- /**
- * Clean-up created fonts.
- */
- public void shutdown() {
- // Call super dispose because we want the partitioner to be
- // disconnected.
- super.dispose();
- if (commandColor != null)
- commandColor.dispose();
- if (messageColor != null)
- messageColor.dispose();
- if (errorColor != null)
- errorColor.dispose();
- CVSUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#commandInvoked(java.lang.String)
- */
- public void commandInvoked(Session session, String line) {
- if (!session.isOutputToConsole()) return;
- commandStarted = System.currentTimeMillis();
- appendLine(ConsoleDocument.COMMAND, CVSUIMessages.Console_preExecutionDelimiter);
- appendLine(ConsoleDocument.COMMAND, line);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#messageLineReceived(java.lang.String)
- */
- public void messageLineReceived(Session session, String line, IStatus status) {
- if (session.isOutputToConsole()) {
- appendLine(ConsoleDocument.MESSAGE, " " + line); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#errorLineReceived(java.lang.String)
- */
- public void errorLineReceived(Session session, String line, IStatus status) {
- if (session.isOutputToConsole()) {
- appendLine(ConsoleDocument.ERROR, " " + line); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#commandCompleted(org.eclipse.core.runtime.IStatus, java.lang.Exception)
- */
- public void commandCompleted(Session session, IStatus status, Exception exception) {
- if (!session.isOutputToConsole()) return;
- long commandRuntime = System.currentTimeMillis() - commandStarted;
- String time;
- try {
- time = TIME_FORMAT.format(new Date(commandRuntime));
- } catch (RuntimeException e) {
- CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.Console_couldNotFormatTime, e);
- time = ""; //$NON-NLS-1$
- }
- String statusText;
- if (status != null) {
- boolean includeRoot = true;
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- statusText = NLS.bind(CVSUIMessages.Console_resultServerError, new String[] { status.getMessage(), time });
- includeRoot = false;
- } else {
- statusText = NLS.bind(CVSUIMessages.Console_resultOk, new String[] { time });
- }
- appendLine(ConsoleDocument.COMMAND, statusText);
- outputStatus(status, includeRoot, includeRoot ? 0 : 1);
- } else if (exception != null) {
- if (exception instanceof OperationCanceledException) {
- statusText = NLS.bind(CVSUIMessages.Console_resultAborted, new String[] { time });
- } else {
- statusText = NLS.bind(CVSUIMessages.Console_resultException, new String[] { time });
- }
- appendLine(ConsoleDocument.COMMAND, statusText);
- if (exception instanceof CoreException) {
- outputStatus(((CoreException)exception).getStatus(), true, 1);
- }
- } else {
- statusText = NLS.bind(CVSUIMessages.Console_resultOk, new String[] { time });
- }
- appendLine(ConsoleDocument.COMMAND, CVSUIMessages.Console_postExecutionDelimiter);
- appendLine(ConsoleDocument.COMMAND, ""); //$NON-NLS-1$
- }
-
- private void outputStatus(IStatus status, boolean includeParent, int nestingLevel) {
- if (includeParent && !status.isOK()) {
- outputStatusMessage(status, nestingLevel);
- nestingLevel++;
- }
-
- // Include a CoreException in the status
- Throwable t = status.getException();
- if (t instanceof CoreException) {
- outputStatus(((CoreException)t).getStatus(), true, nestingLevel);
- }
-
- // Include child status
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- outputStatus(children[i], true, nestingLevel);
- }
- }
-
- private void outputStatusMessage(IStatus status, int nesting) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < nesting; i++) {
- buffer.append(NESTING);
- }
- buffer.append(messageLineForStatus(status));
- appendLine(ConsoleDocument.COMMAND, buffer.toString());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- // colors
- if (visible) {
- if (property.equals(ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR)) {
- Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR);
- commandStream.setColor(newColor);
- commandColor.dispose();
- commandColor = newColor;
- } else if (property.equals(ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR)) {
- Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR);
- messageStream.setColor(newColor);
- messageColor.dispose();
- messageColor = newColor;
- } else if (property.equals(ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR)) {
- Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR);
- errorStream.setColor(newColor);
- errorColor.dispose();
- errorColor = newColor;
- // font
- } else if (property.equals(ICVSUIConstants.PREF_CONSOLE_FONT)) {
- setFont(((FontRegistry) event.getSource()).get(ICVSUIConstants.PREF_CONSOLE_FONT));
- }
- }
- if (property.equals(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE)) {
- Object value = event.getNewValue();
- if (value instanceof String) {
- showOnMessage = Boolean.valueOf((String) value).booleanValue();
- } else {
- showOnMessage = ((Boolean) value).booleanValue();
- }
- } else if(property.equals(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT)) {
- initLimitOutput();
- } else if(property.equals(ICVSUIConstants.PREF_CONSOLE_WRAP)) {
- initWrapSetting();
- }
- }
-
- /**
- * Returns the NLSd message based on the status returned from the CVS
- * command.
- *
- * @param status an NLSd message based on the status returned from the CVS
- * command.
- */
- private String messageLineForStatus(IStatus status) {
- if (status.getSeverity() == IStatus.ERROR) {
- return NLS.bind(CVSUIMessages.Console_error, new String[] { status.getMessage() });
- } else if (status.getSeverity() == IStatus.WARNING) {
- return NLS.bind(CVSUIMessages.Console_warning, new String[] { status.getMessage() });
- } else if (status.getSeverity() == IStatus.INFO) {
- return NLS.bind(CVSUIMessages.Console_info, new String[] { status.getMessage() });
- }
- return status.getMessage();
- }
-
- /**
- * Returns a color instance based on data from a preference field.
- */
- private Color createColor(Display display, String preference) {
- RGB rgb = PreferenceConverter.getColor(CVSUIPlugin.getPlugin().getPreferenceStore(), preference);
- return new Color(display, rgb);
- }
-
- /**
- * Show the console.
- * @param showNoMatterWhat ignore preferences if <code>true</code>
- */
- public void show(boolean showNoMatterWhat) {
- if(showNoMatterWhat || showOnMessage) {
- if(!visible)
- CVSConsoleFactory.showConsole();
- else
- consoleManager.showConsoleView(this);
- }
- }
-
- public String getHelpContextId() {
- return IHelpContextIds.CONSOLE_VIEW;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java
deleted file mode 100644
index 94ecb6cf4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-/**
- * Simple circular buffer that stores a fix number of lines.
- */
-public class ConsoleDocument {
- public static final int COMMAND = 0; // command text
- public static final int MESSAGE = 1; // message received
- public static final int ERROR = 2; // error received
- public static final int STATUS = 3; // status text
- public static final int DELIMITER = 4; // delimiter text between runs
-
- private int[] lineTypes;
- private String[] lines;
-
- private int writeIndex = 0;
- private int readIndex = 0;
-
- private static final int BUFFER_SIZE = 200;
-
- protected static class ConsoleLine {
- public String line;
- public int type;
- ConsoleLine(String line, int type) {
- this.line = line;
- this.type = type;
- }
- }
-
- /**
- * Creates an empty console document.
- */
- public ConsoleDocument() {
- }
-
- /**
- * Clears the console document.
- */
- public void clear() {
- lineTypes = null;
- lines = null;
- writeIndex = 0;
- readIndex = 0;
- }
-
- /**
- * Appends a line of the specified type to the end of the console.
- */
- public void appendConsoleLine(int type, String line) {
- if(lines == null) {
- lines = new String[BUFFER_SIZE];
- lineTypes = new int[BUFFER_SIZE];
- }
- lines[writeIndex] = line;
- lineTypes[writeIndex] = type;
-
- if(++writeIndex >= BUFFER_SIZE) {
- writeIndex = 0;
- }
- if(writeIndex == readIndex) {
- if(++readIndex >= BUFFER_SIZE) {
- readIndex = 0;
- }
- }
- }
-
- public ConsoleLine[] getLines() {
- if(isEmpty()) return new ConsoleLine[0];
- ConsoleLine[] docLines = new ConsoleLine[readIndex > writeIndex ? BUFFER_SIZE : writeIndex];
- int index = readIndex;
- for (int i = 0; i < docLines.length; i++) {
- docLines[i] = new ConsoleLine(lines[index], lineTypes[index]);
- if (++index >= BUFFER_SIZE) {
- index = 0;
- }
- }
- return docLines;
- }
-
- public boolean isEmpty() {
- return writeIndex == readIndex;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java
deleted file mode 100644
index d1271d932..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.*;
-
-public class ConsolePreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public ConsolePreferencesPage() {
- super(GRID);
- setPreferenceStore(CVSUIPlugin.getPlugin().getPreferenceStore());
- }
- private ColorFieldEditor commandColorEditor;
- private ColorFieldEditor messageColorEditor;
- private ColorFieldEditor errorColorEditor;
- private BooleanFieldEditor showOnMessage;
- private BooleanFieldEditor restrictOutput;
- private BooleanFieldEditor wrap;
- private IntegerFieldEditor highWaterMark;
- private IntegerFieldEditor width;
-
- protected void createFieldEditors() {
- final Composite composite = getFieldEditorParent();
- createLabel(composite, CVSUIMessages.ConsolePreferencesPage_9);
- IPreferenceStore store = getPreferenceStore();
-
- // ** WRAP
- wrap = new BooleanFieldEditor(ICVSUIConstants.PREF_CONSOLE_WRAP, CVSUIMessages.ConsolePreferencesPage_6, composite);
- addField(wrap);
-
- width = new IntegerFieldEditor(ICVSUIConstants.PREF_CONSOLE_WIDTH, CVSUIMessages.ConsolePreferencesPage_7, composite); //)
- width.setValidRange(80, Integer.MAX_VALUE - 1);
- addField(width);
- width.setEnabled(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_WRAP), composite);
-
- // ** RESTRICT OUTPUT
- restrictOutput = new BooleanFieldEditor(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT, CVSUIMessages.ConsolePreferencesPage_5, composite);
- addField(restrictOutput);
-
- highWaterMark = new IntegerFieldEditor(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK, CVSUIMessages.ConsolePreferencesPage_8, composite); //)
- highWaterMark.setValidRange(1000, Integer.MAX_VALUE - 1);
- addField(highWaterMark);
- highWaterMark.setEnabled(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT), composite);
-
- // ** SHOW AUTOMATICALLY
- showOnMessage = new BooleanFieldEditor(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE, CVSUIMessages.ConsolePreferencesPage_4, composite);
- addField(showOnMessage);
-
- createLabel(composite, CVSUIMessages.ConsolePreferencePage_consoleColorSettings);
-
- // ** COLORS AND FONTS
- commandColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR,
- CVSUIMessages.ConsolePreferencePage_commandColor, composite);
- addField(commandColorEditor);
-
- messageColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR,
- CVSUIMessages.ConsolePreferencePage_messageColor, composite);
- addField(messageColorEditor);
-
- errorColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR,
- CVSUIMessages.ConsolePreferencePage_errorColor, composite);
- addField(errorColorEditor);
-
- Dialog.applyDialogFont(composite);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.CONSOLE_PREFERENCE_PAGE);
- }
-
-
- public void propertyChange(PropertyChangeEvent event) {
- super.propertyChange(event);
- highWaterMark.setEnabled(restrictOutput.getBooleanValue(), getFieldEditorParent());
- width.setEnabled(wrap.getBooleanValue(), getFieldEditorParent());
- }
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Creates a new color field editor.
- */
- private ColorFieldEditor createColorFieldEditor(String preferenceName, String label, Composite parent) {
- ColorFieldEditor editor = new ColorFieldEditor(preferenceName, label, parent);
- editor.setPreferencePage(this);
- editor.setPreferenceStore(getPreferenceStore());
- return editor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return super.performOk();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java
deleted file mode 100644
index b66205c10..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-
-/**
- * Action that removed the CVS console from the console view. The console
- * can be re-added via the console view "Open Console" drop-down.
- *
- * @since 3.1
- */
-public class ConsoleRemoveAction extends Action {
-
- ConsoleRemoveAction() {
- Utils.initAction(this, "ConsoleRemoveAction.", Policy.getActionBundle()); //$NON-NLS-1$
- }
-
- public void run() {
- CVSConsoleFactory.closeConsole();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
deleted file mode 100644
index ce7deccd8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.ui.PlatformUI;
-
-public abstract class AbstractCommitAction extends CVSModelProviderAction {
-
- public AbstractCommitAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void execute() {
- final List resources = new ArrayList();
- try {
- final IStructuredSelection selection = getActualSelection();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ResourceTraversal[] traversals = getCommitTraversals(selection, monitor);
- resources.add(getOutgoingChanges(getSynchronizationContext().getDiffTree(), traversals, monitor));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- Utils.handleError(getConfiguration().getSite().getShell(), e, null, null);
- } catch (InterruptedException e) {
- // Ignore
- } catch (CVSException e) {
- Utils.handleError(getConfiguration().getSite().getShell(), e, null, null);
- }
- if (!resources.isEmpty() && ((IResource[])resources.get(0)).length > 0) {
- Shell shell= getConfiguration().getSite().getShell();
- try {
- CommitWizard.run(getConfiguration().getSite().getPart(), shell, ((IResource[])resources.get(0)));
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
-
- protected IStructuredSelection getActualSelection() throws CVSException {
- return getStructuredSelection();
- }
-
- protected abstract ResourceTraversal[] getCommitTraversals(IStructuredSelection selection, IProgressMonitor monitor) throws CoreException;
-
- protected IResource[] getOutgoingChanges(final IResourceDiffTree tree, ResourceTraversal[] traversals, IProgressMonitor monitor) {
- final List resources = new ArrayList();
- IDiff[] diffs = tree.getDiffs(traversals);
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- if (hasLocalChange(diff)) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource != null)
- resources.add(resource);
- }
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- private boolean hasLocalChange(IDiff diff) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- return twd.getDirection() == IThreeWayDiff.OUTGOING
- || twd.getDirection() == IThreeWayDiff.CONFLICTING;
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java
deleted file mode 100644
index 103a072f3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.ui.synchronize.ModelParticipantMergeOperation;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class AbstractModelMergeOperation extends ModelParticipantMergeOperation {
-
- private boolean ownsManager = false;
-
- public AbstractModelMergeOperation(IWorkbenchPart part, ISynchronizationScopeManager manager, boolean ownsManager) {
- super(part, manager);
- this.ownsManager = ownsManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#canRunAsJob()
- */
- protected boolean canRunAsJob() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#isPreviewInDialog()
- */
- protected boolean isPreviewInDialog() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PREVIEW).equals(ICVSUIConstants.PREF_UPDATE_PREVIEW_IN_DIALOG);
- }
-
- protected void endOperation(IProgressMonitor monitor) throws InvocationTargetException {
- if (ownsManager) {
- ISynchronizationScopeManager manager = getScopeManager();
- manager.dispose();
- }
- super.endOperation(monitor);
- }
-
- protected ModelSynchronizeParticipant createParticipant() {
- ModelSynchronizeParticipant participant = super.createParticipant();
- // Transfer ownership of the manager to the participant
- setOwnsManager(false);
- return participant;
- }
-
- public boolean isOwnsManager() {
- return ownsManager;
- }
-
- public void setOwnsManager(boolean ownsManager) {
- this.ownsManager = ownsManager;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java
deleted file mode 100644
index 6486be99b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.mapping.ResourceModelParticipantAction;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.ui.ide.IDE;
-
-public abstract class CVSModelProviderAction extends ResourceModelParticipantAction {
-
- public CVSModelProviderAction(ISynchronizePageConfiguration configuration) {
- super(null, configuration);
- Utils.initAction(this, getBundleKeyPrefix(), Policy.getActionBundle());
- }
-
- /**
- * Return the key to the action text in the resource bundle.
- * The default is the fully qualified class name followed by a dot (.).
- * @return the bundle key prefix
- */
- protected String getBundleKeyPrefix() {
- return getClass().getName() + "."; //$NON-NLS-1$
- }
-
- protected ResourceMapping[] getResourceMappings(IStructuredSelection selection) {
- List mappings = new ArrayList();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null)
- mappings.add(mapping);
- }
- return (ResourceMapping[]) mappings.toArray(new ResourceMapping[mappings.size()]);
- }
-
- /**
- * Prompt to save all dirty editors and return whether to proceed
- * or not.
- * @return whether to proceed
- * or not
- */
- public final boolean saveDirtyEditors() {
- if(needsToSaveDirtyEditors()) {
- if(!saveAllEditors(getTargetResources(), confirmSaveOfDirtyEditor())) {
- return false;
- }
- }
- return true;
- }
-
- protected IResource[] getTargetResources() {
- IStructuredSelection selection = getStructuredSelection();
- Object[] objects = selection.toArray();
- Set roots = new HashSet();
- for (int i = 0; i < objects.length; i++) {
- Object object = objects[i];
- ResourceMapping mapping = Utils.getResourceMapping(object);
- if (mapping != null) {
- try {
- ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int j = 0; j < traversals.length; j++) {
- ResourceTraversal traversal = traversals[j];
- IResource[] resources = traversal.getResources();
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- roots.add(resource);
- }
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
- }
- }
- }
- return (IResource[]) roots.toArray(new IResource[roots.size()]);
- }
-
- /**
- * Save all dirty editors in the workbench that are open on files that may
- * be affected by this operation. Opens a dialog to prompt the user if
- * <code>confirm</code> is true. Return true if successful. Return false
- * if the user has canceled the command. Must be called from the UI thread.
- * @param resources the root resources being operated on
- * @param confirm prompt the user if true
- * @return boolean false if the operation was canceled.
- */
- public final boolean saveAllEditors(IResource[] resources, boolean confirm) {
- return IDE.saveAllEditors(resources, confirm);
- }
-
- /**
- * Return whether dirty editor should be saved before this action is run.
- * Default is <code>true</code>.
- *
- * @return whether dirty editor should be saved before this action is run
- */
- protected boolean needsToSaveDirtyEditors() {
- return true;
- }
-
- /**
- * Returns whether the user should be prompted to save dirty editors. The
- * default is <code>true</code>.
- *
- * @return whether the user should be prompted to save dirty editors
- */
- protected boolean confirmSaveOfDirtyEditor() {
- return true;
- }
-
- public void run() {
- if (saveDirtyEditors())
- execute();
- }
-
- protected abstract void execute();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java
deleted file mode 100644
index c7cf9c036..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.mapping.ModelProvider;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.internal.ccvs.core.mapping.ChangeSetModelProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.ComparePreferencePage;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantLabelDecorator;
-import org.eclipse.team.internal.ui.synchronize.IChangeSetProvider;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-
-public abstract class CVSModelSynchronizeParticipant extends ModelSynchronizeParticipant {
-
- public static PreferencePage[] addCVSPreferencePages(PreferencePage[] inheritedPages) {
- PreferencePage[] pages = new PreferencePage[inheritedPages.length + 1];
- for (int i = 0; i < inheritedPages.length; i++) {
- pages[i] = inheritedPages[i];
- }
- pages[pages.length - 1] = new ComparePreferencePage();
- pages[pages.length - 1].setTitle(CVSUIMessages.CVSParticipant_2);
- return pages;
- }
-
- public CVSModelSynchronizeParticipant() {
- super();
- }
-
- public CVSModelSynchronizeParticipant(SynchronizationContext context) {
- super(context);
- }
-
- public PreferencePage[] getPreferencePages() {
- return addCVSPreferencePages(super.getPreferencePages());
- }
-
- public ModelProvider[] getEnabledModelProviders() {
- ModelProvider[] enabledProviders = super.getEnabledModelProviders();
- if (this instanceof IChangeSetProvider) {
- for (int i = 0; i < enabledProviders.length; i++) {
- ModelProvider provider = enabledProviders[i];
- if (provider.getId().equals(ChangeSetModelProvider.ID))
- return enabledProviders;
- }
- ModelProvider[] extended = new ModelProvider[enabledProviders.length + 1];
- for (int i = 0; i < enabledProviders.length; i++) {
- extended[i] = enabledProviders[i];
- }
- ChangeSetModelProvider provider = ChangeSetModelProvider.getProvider();
- if (provider == null)
- return enabledProviders;
- extended[extended.length - 1] = provider;
- return extended;
- }
- return enabledProviders;
- }
-
- protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) {
- return new CVSParticipantLabelDecorator(configuration);
- }
-
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.addLabelDecorator(getLabelDecorator(configuration));
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
deleted file mode 100644
index 24cf938c1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.mapping.*;
-import org.eclipse.team.core.mapping.provider.MergeStatus;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberMergeContext;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
-
- private static final IStorageMerger MERGER = new DelegatingStorageMerger() {
- protected IStorageMerger createDelegateMerger(IStorage target) throws CoreException {
- IStorageMerger storageMerger = super.createDelegateMerger(target);
- if (storageMerger == null) {
- if (target instanceof IFile) {
- IFile file = (IFile) target;
- if (isText(file))
- storageMerger = createTextMerger();
- }
- }
- return storageMerger;
- }
-
- protected int getType(IStorage target) {
- if (target instanceof IFile) {
- IFile file = (IFile) target;
- if (isText(file))
- return Team.TEXT;
- return Team.BINARY;
- }
- return super.getType(target);
- }
-
- private boolean isText(IFile file) {
- try {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- byte[] syncBytes = cvsFile.getSyncBytes();
- if (syncBytes != null)
- return !ResourceSyncInfo.isBinary(syncBytes);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- return false;
- }
- };
-
- protected CVSSubscriberMergeContext(Subscriber subscriber, ISynchronizationScopeManager manager) {
- super(subscriber, manager);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.MergeContext#run(org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.jobs.ISchedulingRule, int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(final IWorkspaceRunnable runnable, final ISchedulingRule rule, int flags, IProgressMonitor monitor) throws CoreException {
- super.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- EclipseSynchronizer.getInstance().run(rule, new ICVSRunnable(){
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- runnable.run(monitor);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
- }, monitor);
- }
-
- }, rule, flags, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.MergeContext#getMergeRule(org.eclipse.core.resources.IResource)
- */
- public ISchedulingRule getMergeRule(IDiff node) {
- // Return the project since that is what the EclipseSynchronize needs
- return getDiffTree().getResource(node).getProject();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.provider.MergeContext#makeInSync(org.eclipse.team.core.diff.IDiff, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void makeInSync(IDiff diff, IProgressMonitor monitor) throws CoreException {
- markAsMerged(diff, true, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#reject(org.eclipse.team.core.diff.IDiff, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void reject(IDiff diff, IProgressMonitor monitor) throws CoreException {
- markAsMerged(diff, false, monitor);
- }
-
- public IStatus merge(final IDiff[] diffs, final boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
- final IStatus[] result = new IStatus[] { Status.OK_STATUS };
- if (diffs.length > 0)
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- result[0] = internalMerge(diffs, ignoreLocalChanges, monitor);
- }
- }, getMergeRule(diffs), IWorkspace.AVOID_UPDATE, monitor);
- return result[0];
- }
-
- private IStatus internalMerge(final IDiff[] diffs, final boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
-
- // The list of diffs that add or change the local file
- List fileChanges = new ArrayList();
- // The list of folders diffs
- List folderDiffs = new ArrayList();
- // The list of diffs that will result in the deletion of
- // the local file
- List fileDeletions = new ArrayList();
-
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource.getType() == IResource.FILE) {
- if (isIncomingDeletion(diff, ignoreLocalChanges)) {
- fileDeletions.add(diff);
- } else {
- fileChanges.add(diff);
- }
- } else {
- folderDiffs.add(diff);
- }
- }
-
- if (fileDeletions.isEmpty() && fileChanges.isEmpty() && folderDiffs.isEmpty())
- return Status.OK_STATUS;
-
- // We do deletions first so that case changes can occur on platforms that are no case sensitive
- int ticks = (fileDeletions.size() + fileChanges.size()) * 100;
- try {
- monitor.beginTask(null, ticks);
- List result = new ArrayList();
- if (!fileDeletions.isEmpty()) {
- IStatus status = CVSSubscriberMergeContext.super.merge(
- (IDiff[]) fileDeletions.toArray(new IDiff[fileDeletions.size()]),
- ignoreLocalChanges,
- Policy.subMonitorFor(monitor, 100 * fileDeletions.size()));
- if (!status.isOK()) {
- if (status.isMultiStatus()) {
- result.addAll(Arrays.asList(status.getChildren()));
- } else {
- result.add(status);
- }
- }
- }
- if (!fileChanges.isEmpty()) {
- IStatus status = CVSSubscriberMergeContext.super.merge(
- (IDiff[]) fileChanges.toArray(new IDiff[fileChanges.size()]),
- ignoreLocalChanges,
- Policy.subMonitorFor(monitor, 100 * fileChanges.size()));
- if (!status.isOK()) {
- if (status.isMultiStatus()) {
- result.addAll(Arrays.asList(status.getChildren()));
- } else {
- result.add(status);
- }
- }
- }
- if (!folderDiffs.isEmpty()) {
- // Order the diffs so empty added children will get deleted before their parents are visited
- Collections.sort(folderDiffs, new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((IDiff)o2).getPath().toString().compareTo(((IDiff)o1).getPath().toString());
- }
- });
- for (Iterator iter = folderDiffs.iterator(); iter.hasNext();) {
- IDiff diff = (IDiff) iter.next();
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- IDiff currentDiff = getSubscriber().getDiff(resource);
- merge(currentDiff, ignoreLocalChanges, monitor);
- }
- }
- if (result.isEmpty())
- return Status.OK_STATUS;
- if (result.size() == 1)
- return (IStatus)result.get(0);
- return new MergeStatus(CVSUIPlugin.ID, ((IStatus)result.get(0)).getMessage(), getFailedFiles(result));
- } finally {
- monitor.done();
- }
- }
-
- private boolean isIncomingDeletion(IDiff diff, boolean ignoreLocalChanges) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getKind() == IDiff.REMOVE && twd.getDirection() == IThreeWayDiff.INCOMING)
- return true;
- IDiff remoteChange = twd.getRemoteChange();
- if (ignoreLocalChanges && remoteChange != null)
- return isIncomingDeletion(remoteChange, ignoreLocalChanges);
- IDiff localChange = twd.getLocalChange();
- if (ignoreLocalChanges && localChange != null)
- return isIncomingDeletion(localChange, ignoreLocalChanges);
- return false;
- }
- if (diff instanceof IResourceDiff) {
- IResourceDiff rd = (IResourceDiff) diff;
- return (ignoreLocalChanges || getMergeType() == ISynchronizationContext.TWO_WAY) && rd.getAfterState() == null;
- }
- return false;
- }
-
- private IFile[] getFailedFiles(List result) {
- List failures = new ArrayList();
- for (Iterator iter = result.iterator(); iter.hasNext();) {
- IStatus status = (IStatus) iter.next();
- if (status instanceof MergeStatus) {
- MergeStatus ms = (MergeStatus) status;
- failures.addAll(Arrays.asList(ms.getConflictingFiles()));
- }
- }
- return (IFile[]) failures.toArray(new IFile[failures.size()]);
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IStorageMerger.class)
- return MERGER;
- return super.getAdapter(adapter);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
deleted file mode 100644
index 1865e7894..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
+++ /dev/null
@@ -1,562 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006-2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Matt McCutchen <hashproduct+eclipse@gmail.com> - Bug 94808 [Change Sets] "&" not showing up in dropdown menu
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.internal.ccvs.core.mapping.ChangeSetModelProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.core.subscribers.*;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.mapping.ResourceModelActionProvider;
-import org.eclipse.team.internal.ui.mapping.ResourceModelTraversalCalculator;
-import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-import org.eclipse.ui.navigator.INavigatorContentExtension;
-import org.eclipse.ui.navigator.INavigatorContentService;
-
-public class ChangeSetActionProvider extends ResourceModelActionProvider {
-
- /**
- * Menu group that can be added to the context menu
- */
- public final static String CHANGE_SET_GROUP = "changeSetActions"; //$NON-NLS-1$
-
- // Constants for persisting sorting options
- private static final String P_LAST_COMMENTSORT = TeamUIPlugin.ID + ".P_LAST_COMMENT_SORT"; //$NON-NLS-1$
-
- private MenuManager sortByComment;
- private CreateChangeSetAction createChangeSet;
- private MenuManager addToChangeSet;
- private EditChangeSetAction editChangeSet;
- private RemoveChangeSetAction removeChangeSet;
- private MakeDefaultChangeSetAction makeDefault;
-
- private OpenChangeSetAction openCommitSet;
-
- private class CreateChangeSetAction extends ModelParticipantAction {
-
- public CreateChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
- }
-
- public void run() {
- final IDiff[] diffs = getLocalChanges(getStructuredSelection());
- syncExec(new Runnable() {
- public void run() {
- createChangeSet(diffs);
- }
- });
- }
-
- /* package */ void createChangeSet(IDiff[] diffs) {
- ActiveChangeSet set = getChangeSetCapability().createChangeSet(getConfiguration(), diffs);
- if (set != null) {
- getActiveChangeSetManager().add(set);
- }
- }
-
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- return isContentProviderEnabled() && containsLocalChanges(selection);
- }
- }
-
- /**
- * Escape a string so it can be used as an action text without '&'
- * being interpreted as a mnemonic. Specifically, turn each '&' into '&&'.
- */
- /* package */ static String escapeActionText(String x) {
- // Loosely based on org.eclipse.jface.action.LegacyActionTools#removeMnemonics
- int ampersandIndex = x.indexOf('&');
- if (ampersandIndex == -1)
- return x;
-
- int len = x.length();
- StringBuffer sb = new StringBuffer(2 * len + 1);
- int doneIndex = 0;
- while (ampersandIndex != -1) {
- sb.append(x.substring(doneIndex, ampersandIndex));
- sb.append("&&"); //$NON-NLS-1$
- doneIndex = ampersandIndex + 1;
- ampersandIndex = x.indexOf('&', doneIndex);
- }
- if (doneIndex < len)
- sb.append(x.substring(doneIndex, len));
- return sb.toString();
- }
-
- private class AddToChangeSetAction extends ModelParticipantAction {
-
- private final ActiveChangeSet set;
-
- public AddToChangeSetAction(ISynchronizePageConfiguration configuration, ActiveChangeSet set, ISelection selection) {
- super(set == null ? TeamUIMessages.ChangeSetActionGroup_2 : escapeActionText(set.getTitle()), configuration);
- this.set = set;
- selectionChanged(selection);
- }
-
- public void run() {
- IDiff[] diffArray = getLocalChanges(getStructuredSelection());
- if (set != null) {
- set.add(diffArray);
- } else {
- ChangeSet[] sets = getActiveChangeSetManager().getSets();
- IResource[] resources = getResources(diffArray);
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet activeSet = (ActiveChangeSet)sets[i];
- activeSet.remove(resources);
- }
- }
- }
-
- private IResource[] getResources(IDiff[] diffArray) {
- List result = new ArrayList();
- for (int i = 0; i < diffArray.length; i++) {
- IDiff diff = diffArray[i];
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource != null) {
- result.add(resource);
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- return isContentProviderEnabled() && containsLocalChanges(selection);
- }
- }
-
- private abstract class ChangeSetAction extends BaseSelectionListenerAction {
-
- public ChangeSetAction(String title, ISynchronizePageConfiguration configuration) {
- super(title);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- return getSelectedSet() != null;
- }
-
- protected ActiveChangeSet getSelectedSet() {
- IStructuredSelection selection = getStructuredSelection();
- if (selection.size() == 1) {
- Object first = selection.getFirstElement();
- if (first instanceof ActiveChangeSet) {
- ActiveChangeSet activeChangeSet = (ActiveChangeSet) first;
- if (activeChangeSet.isUserCreated())
- return activeChangeSet;
- }
- }
- return null;
- }
- }
-
- private class EditChangeSetAction extends ChangeSetAction {
-
- public EditChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_6, configuration);
- }
-
- public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- getChangeSetCapability().editChangeSet(internalGetSynchronizePageConfiguration(), set);
- }
- }
-
- private class RemoveChangeSetAction extends ChangeSetAction {
-
- public RemoveChangeSetAction(ISynchronizePageConfiguration configuration) {
- super("Remove Change Set", configuration); //$NON-NLS-1$
- }
-
- public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- if (MessageDialog.openConfirm(internalGetSynchronizePageConfiguration().getSite().getShell(), TeamUIMessages.ChangeSetActionGroup_0, NLS.bind(TeamUIMessages.ChangeSetActionGroup_1, new String[] { set.getTitle() }))) { //
- getActiveChangeSetManager().remove(set);
- }
- }
- }
-
- private class MakeDefaultChangeSetAction extends ChangeSetAction {
- public MakeDefaultChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_9, configuration);
- }
-
- public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- getActiveChangeSetManager().makeDefault(set);
- }
- }
-
- /* *****************************************************************************
- * Action that allows changing the model providers sort order.
- */
- private class ToggleSortOrderAction extends Action {
- private int criteria;
- protected ToggleSortOrderAction(String name, int criteria) {
- super(name, IAction.AS_RADIO_BUTTON);
- this.criteria = criteria;
- update();
- }
-
- public void run() {
- int sortCriteria = getSortCriteria(internalGetSynchronizePageConfiguration());
- if (isChecked() && sortCriteria != criteria) {
- setSortCriteria(internalGetSynchronizePageConfiguration(), criteria);
- update();
- ((SynchronizePageConfiguration)internalGetSynchronizePageConfiguration()).getPage().getViewer().refresh();
- }
- }
-
- public void update() {
- setChecked(criteria == getSortCriteria(internalGetSynchronizePageConfiguration()));
- }
- }
-
- public static int getSortCriteria(ISynchronizePageConfiguration configuration) {
- int sortCriteria = ChangeSetSorter.DATE;
- if (configuration != null) {
- Object o = configuration.getProperty(P_LAST_COMMENTSORT);
- if (o instanceof Integer) {
- Integer wrapper = (Integer) o;
- sortCriteria = wrapper.intValue();
- } else {
- try {
- IDialogSettings pageSettings = configuration.getSite().getPageSettings();
- if(pageSettings != null) {
- sortCriteria = pageSettings.getInt(P_LAST_COMMENTSORT);
- }
- } catch(NumberFormatException e) {
- // ignore and use the defaults.
- }
- }
- }
- switch (sortCriteria) {
- case ChangeSetSorter.COMMENT:
- case ChangeSetSorter.DATE:
- case ChangeSetSorter.USER:
- break;
- default:
- sortCriteria = ChangeSetSorter.DATE;
- break;
- }
- return sortCriteria;
- }
-
- public static void setSortCriteria(ISynchronizePageConfiguration configuration, int criteria) {
- configuration.setProperty(P_LAST_COMMENTSORT, new Integer(criteria));
- IDialogSettings pageSettings = configuration.getSite().getPageSettings();
- if(pageSettings != null) {
- pageSettings.put(P_LAST_COMMENTSORT, criteria);
- }
- }
-
- public ChangeSetActionProvider() {
- super();
- }
-
- protected void initialize() {
- super.initialize();
- if (getChangeSetCapability().supportsCheckedInChangeSets()) {
- sortByComment = new MenuManager(TeamUIMessages.ChangeLogModelProvider_0a);
- sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_1a, ChangeSetSorter.COMMENT));
- sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_2a, ChangeSetSorter.DATE));
- sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_3a, ChangeSetSorter.USER));
- openCommitSet = new OpenChangeSetAction(getSynchronizePageConfiguration());
- }
- if (getChangeSetCapability().supportsActiveChangeSets()) {
- addToChangeSet = new MenuManager(TeamUIMessages.ChangeLogModelProvider_12);
- addToChangeSet.setRemoveAllWhenShown(true);
- addToChangeSet.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addChangeSets(manager);
- }
- });
- createChangeSet = new CreateChangeSetAction(getSynchronizePageConfiguration());
- addToChangeSet.add(createChangeSet);
- addToChangeSet.add(new Separator());
- editChangeSet = new EditChangeSetAction(getSynchronizePageConfiguration());
- makeDefault = new MakeDefaultChangeSetAction(getSynchronizePageConfiguration());
- removeChangeSet = new RemoveChangeSetAction(getSynchronizePageConfiguration());
- }
- }
-
- public void fillContextMenu(IMenuManager menu) {
- if (isContentProviderEnabled()) {
- super.fillContextMenu(menu);
- if (getChangeSetCapability().enableCheckedInChangeSetsFor(getSynchronizePageConfiguration())) {
- appendToGroup(
- menu,
- "file-bottom", //$NON-NLS-1$
- openCommitSet);
- appendToGroup(menu, ISynchronizePageConfiguration.SORT_GROUP, sortByComment);
- }
- if (getChangeSetCapability().enableActiveChangeSetsFor(getSynchronizePageConfiguration())) {
- appendToGroup(
- menu,
- CHANGE_SET_GROUP,
- addToChangeSet);
- appendToGroup(
- menu,
- CHANGE_SET_GROUP,
- editChangeSet);
- appendToGroup(
- menu,
- CHANGE_SET_GROUP,
- removeChangeSet);
- appendToGroup(
- menu,
- CHANGE_SET_GROUP,
- makeDefault);
- }
- }
- }
-
- public void dispose() {
- if (addToChangeSet != null) {
- addToChangeSet.dispose();
- addToChangeSet.removeAll();
- }
- if (sortByComment != null) {
- sortByComment.dispose();
- sortByComment.removeAll();
- }
- super.dispose();
- }
-
- protected void addChangeSets(IMenuManager manager) {
- ChangeSet[] sets = getActiveChangeSetManager().getSets();
- Arrays.sort(sets, new ChangeSetComparator());
- ISelection selection = getContext().getSelection();
- createChangeSet.selectionChanged(selection);
- addToChangeSet.add(createChangeSet);
- addToChangeSet.add(new Separator());
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet set = (ActiveChangeSet)sets[i];
- AddToChangeSetAction action = new AddToChangeSetAction(getSynchronizePageConfiguration(), set, selection);
- manager.add(action);
- }
- addToChangeSet.add(new Separator());
- // Action that removes change set resources
- addToChangeSet.add(new AddToChangeSetAction(getSynchronizePageConfiguration(), null, selection));
- }
-
- private boolean appendToGroup(IContributionManager manager, String groupId, IContributionItem item) {
- if (manager == null || item == null) return false;
- IContributionItem group = manager.find(groupId);
- if (group != null) {
- manager.appendToGroup(group.getId(), item);
- return true;
- }
- return false;
- }
-
- private boolean appendToGroup(IContributionManager manager, String groupId, IAction action) {
- if (manager == null || action == null) return false;
- IContributionItem group = manager.find(groupId);
- if (group != null) {
- manager.appendToGroup(group.getId(), action);
- //registerActionWithWorkbench(action);
- return true;
- }
- return false;
- }
-
- public ChangeSetCapability getChangeSetCapability() {
- ISynchronizeParticipant participant = getSynchronizePageConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- return provider.getChangeSetCapability();
- }
- return null;
- }
-
- /* package */ void syncExec(final Runnable runnable) {
- final Control ctrl = getSynchronizePageConfiguration().getPage().getViewer().getControl();
- Utils.syncExec(runnable, ctrl);
- }
-
- /* package */ ActiveChangeSetManager getActiveChangeSetManager() {
- return CVSUIPlugin.getPlugin().getChangeSetManager();
- }
-
-
- public IDiff[] getLocalChanges(IStructuredSelection selection) {
- if (selection instanceof ITreeSelection) {
- ITreeSelection ts = (ITreeSelection) selection;
- TreePath[] paths = ts.getPaths();
- List result = new ArrayList();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
- IDiff[] diffs = getLocalChanges(path);
- for (int j = 0; j < diffs.length; j++) {
- IDiff diff = diffs[j];
- result.add(diff);
- }
- }
- return (IDiff[]) result.toArray(new IDiff[result.size()]);
- }
- return new IDiff[0];
- }
-
- private IDiff[] getLocalChanges(TreePath path) {
- IResourceDiffTree tree = getDiffTree(path);
- if (path.getSegmentCount() == 1 && path.getLastSegment() instanceof IDiffTree) {
- return ((ResourceDiffTree)tree).getDiffs();
- }
- ResourceTraversal[] traversals = getTraversals(path.getLastSegment());
- return tree.getDiffs(traversals);
- }
-
- private IResourceDiffTree getDiffTree(TreePath path) {
- return getContentProvider().getDiffTree(path);
- }
-
- public boolean containsLocalChanges(IStructuredSelection selection) {
- if (selection instanceof ITreeSelection) {
- ITreeSelection ts = (ITreeSelection) selection;
- TreePath[] paths = ts.getPaths();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
- if (containsLocalChanges(path)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private boolean containsLocalChanges(TreePath path) {
- IResourceDiffTree tree = getDiffTree(path);
- ResourceTraversal[] traversals = getTraversals(path.getLastSegment());
- return tree.hasMatchingDiffs(traversals, getVisibleLocalChangesFilter());
- }
-
- private ResourceTraversal[] getTraversals(Object element) {
- if (element instanceof ChangeSet) {
- ChangeSet set = (ChangeSet) element;
- return new ResourceTraversal[] { new ResourceTraversal(set.getResources(), IResource.DEPTH_ZERO, IResource.NONE) };
- }
- if (element instanceof IProject) {
- IProject project = (IProject) element;
- return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { project }, IResource.DEPTH_INFINITE, IResource.NONE) };
- }
- if (element instanceof IFile) {
- IFile file = (IFile) element;
- return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { file }, IResource.DEPTH_ZERO, IResource.NONE) };
- }
- if (element instanceof IFolder) {
- IFolder folder = (IFolder) element;
- if (getLayout().equals(IPreferenceIds.COMPRESSED_LAYOUT)) {
- return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder }, IResource.DEPTH_ONE, IResource.NONE) };
- } else if (getLayout().equals(IPreferenceIds.TREE_LAYOUT)) {
- return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder }, IResource.DEPTH_INFINITE, IResource.NONE) };
- } else if (getLayout().equals(IPreferenceIds.FLAT_LAYOUT)) {
- return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder }, IResource.DEPTH_ZERO, IResource.NONE) };
- }
- }
- return new ResourceTraversal[0];
- }
-
- private FastDiffFilter getVisibleLocalChangesFilter() {
- return new FastDiffFilter() {
- public boolean select(IDiff diff) {
- if (diff instanceof IThreeWayDiff && isVisible(diff)) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getDirection() == IThreeWayDiff.OUTGOING || twd.getDirection() == IThreeWayDiff.CONFLICTING) {
- return true;
- }
- }
- return false;
- }
- };
- }
-
- /* package */ boolean isVisible(IDiff diff) {
- return ((SynchronizePageConfiguration)getSynchronizePageConfiguration()).isVisible(diff);
- }
-
- protected ResourceModelTraversalCalculator getTraversalCalculator() {
- return ResourceModelTraversalCalculator.getTraversalCalculator(getSynchronizePageConfiguration());
- }
-
- private ChangeSetContentProvider getContentProvider() {
- INavigatorContentExtension extension = getExtension();
- if (extension != null) {
- ITreeContentProvider provider = extension.getContentProvider();
- if (provider instanceof ChangeSetContentProvider) {
- return (ChangeSetContentProvider) provider;
- }
- }
- return null;
- }
-
- private INavigatorContentExtension getExtension() {
- INavigatorContentService service = getActionSite().getContentService();
- Set set = service.findContentExtensionsByTriggerPoint(getModelProvider());
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- INavigatorContentExtension extension = (INavigatorContentExtension) iter.next();
- return extension;
- }
- return null;
- }
-
- private Object getModelProvider() {
- return ChangeSetModelProvider.getProvider();
- }
-
- private String getLayout() {
- return TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT);
- }
-
- public void setContext(ActionContext context) {
- super.setContext(context);
- if (context != null) {
- if (editChangeSet != null)
- editChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
- if (removeChangeSet != null)
- removeChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
- if (makeDefault != null)
- makeDefault.selectionChanged((IStructuredSelection)getContext().getSelection());
- }
- }
-
- protected boolean isContentProviderEnabled() {
- ChangeSetContentProvider provider = getContentProvider();
- if (provider != null) {
- return provider.isEnabled();
- }
- return false;
- }
-
- /* package */ ISynchronizePageConfiguration internalGetSynchronizePageConfiguration() {
- return getSynchronizePageConfiguration();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetComparator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetComparator.java
deleted file mode 100644
index d60bec9fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetComparator.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.Comparator;
-
-public class ChangeSetComparator implements Comparator {
- private ChangeSetSorter fSorter= new ChangeSetSorter();
-
- public int compare(Object o1, Object o2) {
- return fSorter.compare(null, o1, o2);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetCompareAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetCompareAdapter.java
deleted file mode 100644
index 2fcccbe92..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetCompareAdapter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.team.core.mapping.ISynchronizationScope;
-import org.eclipse.team.internal.core.subscribers.ChangeSet;
-import org.eclipse.team.internal.ui.mapping.DiffTreeChangesSection.ITraversalFactory;
-import org.eclipse.team.ui.mapping.SynchronizationCompareAdapter;
-import org.eclipse.ui.IMemento;
-
-public class ChangeSetCompareAdapter extends SynchronizationCompareAdapter implements ITraversalFactory {
-
- public void save(ResourceMapping[] mappings, IMemento memento) {
- // Don't save
- }
-
- public ResourceMapping[] restore(IMemento memento) {
- // Don't restore
- return new ResourceMapping[0];
- }
-
- public ResourceTraversal[] getTraversals(ISynchronizationScope scope) {
- return scope.getTraversals(ModelProvider.RESOURCE_MODEL_PROVIDER_ID);
- }
-
- public String getName(ResourceMapping mapping) {
- Object modelObject = mapping.getModelObject();
- if (modelObject instanceof ChangeSet) {
- ChangeSet changeSet = (ChangeSet) modelObject;
- return changeSet.getName();
- }
- return super.getName(mapping);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
deleted file mode 100644
index d9e893b64..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
+++ /dev/null
@@ -1,810 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.internal.ccvs.core.mapping.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSChangeSetCollector;
-import org.eclipse.team.internal.core.subscribers.*;
-import org.eclipse.team.internal.core.subscribers.BatchingChangeSetManager.CollectorChangeEvent;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider;
-import org.eclipse.team.internal.ui.mapping.ResourceModelLabelProvider;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
-import org.eclipse.team.internal.ui.synchronize.IChangeSetProvider;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.ui.navigator.*;
-
-public class ChangeSetContentProvider extends ResourceModelContentProvider implements ITreePathContentProvider {
-
- private final class CollectorListener implements IChangeSetChangeListener, BatchingChangeSetManager.IChangeSetCollectorChangeListener {
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#setAdded(org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- public void setAdded(final ChangeSet set) {
- // We only react here for active change sets.
- // Checked-in change set changes are batched
- if (set instanceof ActiveChangeSet) {
- if (isVisibleInMode(set)) {
- Utils.syncExec(new Runnable() {
- public void run() {
- Object input = getViewer().getInput();
- ((AbstractTreeViewer)getViewer()).add(input, set);
- }
- }, (StructuredViewer)getViewer());
- }
- handleSetAddition(set);
- }
- }
-
- private void handleSetAddition(final ChangeSet set) {
- getUnassignedSet().remove(set.getResources());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#defaultSetChanged(org.eclipse.team.internal.core.subscribers.ChangeSet, org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- if (isVisibleInMode(set) || isVisibleInMode(previousDefault)) {
- Utils.asyncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).update(new Object[] {previousDefault, set}, null);
- }
- }, (StructuredViewer)getViewer());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#setRemoved(org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- public void setRemoved(final ChangeSet set) {
- // We only react here for active change sets.
- // Checked-in change set changes are batched
- if (set instanceof ActiveChangeSet) {
- if (isVisibleInMode(set)) {
- Utils.syncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).remove(TreePath.EMPTY.createChildPath(set));
- }
- }, (StructuredViewer)getViewer());
- }
- handleSetRemoval(set);
- }
- }
-
- private void handleSetRemoval(final ChangeSet set) {
- IResource[] resources = set.getResources();
- List toAdd = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IDiff diff = getContext().getDiffTree().getDiff(resource);
- if (diff != null && !isContainedInSet(diff))
- toAdd.add(diff);
- }
- getUnassignedSet().add((IDiff[]) toAdd.toArray(new IDiff[toAdd.size()]));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#nameChanged(org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- public void nameChanged(final ChangeSet set) {
- if (isVisibleInMode(set)) {
- Utils.asyncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).update(set, null);
- }
- }, (StructuredViewer)getViewer());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#resourcesChanged(org.eclipse.team.internal.core.subscribers.ChangeSet, org.eclipse.core.runtime.IPath[])
- */
- public void resourcesChanged(final ChangeSet set, final IPath[] paths) {
- // We only react here for active change sets.
- // Checked-in change set changes are batched
- if (set instanceof ActiveChangeSet) {
- if (isVisibleInMode(set)) {
- Utils.syncExec(new Runnable() {
- public void run() {
- if (hasChildrenInContext(set))
- if (getVisibleSetsInViewer().contains(set))
- ((AbstractTreeViewer)getViewer()).refresh(set, true);
- else
- ((AbstractTreeViewer)getViewer()).add(getViewer().getInput(), set);
- else
- ((AbstractTreeViewer)getViewer()).remove(set);
- }
- }, (StructuredViewer)getViewer());
- }
- handleSetChange(set, paths);
- }
- }
-
- private void handleSetChange(final ChangeSet set, final IPath[] paths) {
- try {
- getTheRest().beginInput();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
- boolean isContained = ((DiffChangeSet)set).contains(path);
- if (isContained) {
- IDiff diff = ((DiffChangeSet)set).getDiffTree().getDiff(path);
- if (diff != null) {
- getTheRest().remove(ResourceDiffTree.getResourceFor(diff));
- }
- } else {
- IDiff diff = getContext().getDiffTree().getDiff(path);
- if (diff != null && !isContainedInSet(diff)) {
- getTheRest().add(diff);
- }
- }
- }
- } finally {
- getTheRest().endInput(null);
- }
- }
-
- public void changeSetChanges(final CollectorChangeEvent event, IProgressMonitor monitor) {
- ChangeSet[] addedSets = event.getAddedSets();
- final ChangeSet[] visibleAddedSets = getVisibleSets(addedSets);
- ChangeSet[] removedSets = event.getRemovedSets();
- final ChangeSet[] visibleRemovedSets = getVisibleSets(removedSets);
- ChangeSet[] changedSets = event.getChangedSets();
- final ChangeSet[] visibleChangedSets = getVisibleSets(changedSets);
- if (visibleAddedSets.length > 0 || visibleRemovedSets.length > 0 || visibleChangedSets.length > 0) {
- Utils.syncExec(new Runnable() {
- public void run() {
- try {
- getViewer().getControl().setRedraw(false);
- if (visibleAddedSets.length > 0) {
- Object input = getViewer().getInput();
- ((AbstractTreeViewer)getViewer()).add(input, visibleAddedSets);
- }
- if (visibleRemovedSets.length > 0)
- ((AbstractTreeViewer)getViewer()).remove(visibleRemovedSets);
- for (int i = 0; i < visibleChangedSets.length; i++) {
- ChangeSet set = visibleChangedSets[i];
- ((AbstractTreeViewer)getViewer()).refresh(set, true);
- }
- } finally {
- getViewer().getControl().setRedraw(true);
- }
- }
- }, (StructuredViewer)getViewer());
- }
- try {
- getTheRest().beginInput();
- for (int i = 0; i < addedSets.length; i++) {
- ChangeSet set = addedSets[i];
- handleSetAddition(set);
- }
- if (removedSets.length > 0) {
- // If sets were removed, we reset the unassigned set.
- // We need to do this because it is possible that diffs were
- // removed from the set before the set itself was removed.
- // See bug 173138
- addAllUnassignedToUnassignedSet();
- }
- for (int i = 0; i < changedSets.length; i++) {
- ChangeSet set = changedSets[i];
- IPath[] paths = event.getChangesFor(set);
- if (event.getSource().contains(set)) {
- handleSetChange(set, paths);
- } else {
- try {
- getTheRest().beginInput();
- for (int j = 0; j < paths.length; j++) {
- IPath path = paths[j];
- IDiff diff = getContext().getDiffTree().getDiff(path);
- if (diff != null && !isContainedInSet(diff))
- getTheRest().add(diff);
- }
- } finally {
- getTheRest().endInput(null);
- }
- }
- }
- } finally {
- getTheRest().endInput(monitor);
- }
- }
-
- private ChangeSet[] getVisibleSets(ChangeSet[] sets) {
- List result = new ArrayList(sets.length);
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (isVisibleInMode(set)) {
- result.add(set);
- }
- }
- return (ChangeSet[]) result.toArray(new ChangeSet[result.size()]);
- }
- }
-
- private DiffChangeSet unassignedDiffs;
- private boolean firstDiffChange = true;
-
- /*
- * Listener that reacts to changes made to the active change set collector
- */
- private IChangeSetChangeListener collectorListener = new CollectorListener();
-
- private IDiffChangeListener diffTreeListener = new IDiffChangeListener() {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#propertyChanged(org.eclipse.team.core.diff.IDiffTree, int, org.eclipse.core.runtime.IPath[])
- */
- public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
- // Ignore
- }
-
- boolean isSetVisible(DiffChangeSet set) {
- return getVisibleSetsInViewer().contains(set);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#diffsChanged(org.eclipse.team.core.diff.IDiffChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- Object input = getViewer().getInput();
- if (input instanceof ChangeSetModelProvider && unassignedDiffs != null && event.getTree() == unassignedDiffs.getDiffTree()) {
- Utils.asyncExec(new Runnable() {
- public void run() {
- if (unassignedDiffs.isEmpty() || !hasChildren(TreePath.EMPTY.createChildPath(getUnassignedSet()))) {
- ((AbstractTreeViewer)getViewer()).remove(unassignedDiffs);
- } else if (!isSetVisible(unassignedDiffs)) {
- Object input = getViewer().getInput();
- ((AbstractTreeViewer)getViewer()).add(input, unassignedDiffs);
- } else {
- ((AbstractTreeViewer)getViewer()).refresh(unassignedDiffs);
- }
- }
- }, (StructuredViewer)getViewer());
- }
- }
-
- };
- private CheckedInChangeSetCollector checkedInCollector;
- private boolean collectorInitialized;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider#getModelProviderId()
- */
- protected String getModelProviderId() {
- return ChangeSetModelProvider.ID;
- }
-
- /* package */ boolean isVisibleInMode(ChangeSet set) {
- final Object input = getViewer().getInput();
- if (input instanceof ChangeSetModelProvider) {
- if (set instanceof ActiveChangeSet) {
- return getConfiguration().getMode() != ISynchronizePageConfiguration.INCOMING_MODE;
- }
- if (set instanceof DiffChangeSet) {
- return getConfiguration().getMode() != ISynchronizePageConfiguration.OUTGOING_MODE;
- }
- }
- return false;
- }
-
- protected boolean isEnabled() {
- final Object input = getViewer().getInput();
- return (input instanceof ChangeSetModelProvider);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object parent) {
- if (parent instanceof ISynchronizationContext) {
- // Do not show change sets when all models are visible because
- // model providers that override the resource content may cause
- // problems for the change set content provider
- return new Object[0];
- }
- if (parent == getModelProvider()) {
- return getRootElements();
- }
- return super.getElements(parent);
- }
-
- private Object[] getRootElements() {
- if (!collectorInitialized) {
- initializeCheckedInChangeSetCollector(getChangeSetCapability());
- collectorInitialized = true;
- }
- List result = new ArrayList();
- ChangeSet[] sets = getAllSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (hasChildren(TreePath.EMPTY.createChildPath(set)))
- result.add(set);
- }
- if (!getUnassignedSet().isEmpty() && hasChildren(TreePath.EMPTY.createChildPath(getUnassignedSet()))) {
- result.add(getUnassignedSet());
- }
- return result.toArray();
- }
-
- private synchronized DiffChangeSet getUnassignedSet() {
- if (unassignedDiffs == null) {
- unassignedDiffs = new UnassignedDiffChangeSet(CVSUIMessages.ChangeSetContentProvider_0);
- unassignedDiffs.getDiffTree().addDiffChangeListener(diffTreeListener);
- addAllUnassignedToUnassignedSet();
- }
- return unassignedDiffs;
- }
-
- private void addAllUnassignedToUnassignedSet() {
- IResourceDiffTree allChanges = getContext().getDiffTree();
- final List diffs = new ArrayList();
- allChanges.accept(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (!isContainedInSet(diff))
- diffs.add(diff);
- return true;
- }
- }, IResource.DEPTH_INFINITE);
- unassignedDiffs.add((IDiff[]) diffs.toArray(new IDiff[diffs.size()]));
- }
-
- private ResourceDiffTree getTheRest() {
- return (ResourceDiffTree)getUnassignedSet().getDiffTree();
- }
-
- /**
- * Return whether the given diff is contained in a set other than
- * the unassigned set.
- * @param diff the diff
- * @return whether the given diff is contained in a set other than
- * the unassigned set
- */
- protected boolean isContainedInSet(IDiff diff) {
- ChangeSet[] sets = getAllSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set.contains(ResourceDiffTree.getResourceFor(diff))) {
- return true;
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider#getTraversals(org.eclipse.team.core.mapping.ISynchronizationContext, java.lang.Object)
- */
- protected ResourceTraversal[] getTraversals(
- ISynchronizationContext context, Object object) {
- if (object instanceof ChangeSet) {
- ChangeSet set = (ChangeSet) object;
- IResource[] resources = set.getResources();
- return new ResourceTraversal[] { new ResourceTraversal(resources, IResource.DEPTH_ZERO, IResource.NONE) };
- }
- return super.getTraversals(context, object);
- }
-
- public Object[] getChildren(TreePath parentPath) {
- if (!isEnabled())
- return new Object[0];
- if (parentPath.getSegmentCount() == 0)
- return getRootElements();
- Object first = parentPath.getFirstSegment();
- if (!isVisibleInMode(first)) {
- return new Object[0];
- }
- IResourceDiffTree diffTree;
- Object parent = parentPath.getLastSegment();
- if (first instanceof DiffChangeSet) {
- DiffChangeSet set = (DiffChangeSet) first;
- diffTree = set.getDiffTree();
- if (parent instanceof DiffChangeSet) {
- parent = getModelRoot();
- }
- } else {
- return new Object[0];
- }
- Object[] children = getChildren(parent);
- Set result = new HashSet();
- for (int i = 0; i < children.length; i++) {
- Object child = children[i];
- if (isVisible(child, diffTree)) {
- result.add(child);
- }
- }
- return result.toArray();
- }
-
- private boolean isVisibleInMode(Object first) {
- if (first instanceof ChangeSet) {
- ChangeSet cs = (ChangeSet) first;
- int mode = getConfiguration().getMode();
- switch (mode) {
- case ISynchronizePageConfiguration.BOTH_MODE:
- return true;
- case ISynchronizePageConfiguration.CONFLICTING_MODE:
- return containsConflicts(cs);
- case ISynchronizePageConfiguration.INCOMING_MODE:
- return cs instanceof CVSCheckedInChangeSet || (isUnassignedSet(cs) && hasIncomingChanges(cs));
- case ISynchronizePageConfiguration.OUTGOING_MODE:
- return cs instanceof ActiveChangeSet || hasConflicts(cs) || (isUnassignedSet(cs) && hasOutgoingChanges(cs));
- default:
- break;
- }
- }
- return true;
- }
-
- private boolean hasIncomingChanges(ChangeSet cs) {
- if (cs instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) cs;
- return dcs.getDiffTree().countFor(IThreeWayDiff.INCOMING, IThreeWayDiff.DIRECTION_MASK) > 0;
- }
- return false;
- }
-
- private boolean hasOutgoingChanges(ChangeSet cs) {
- if (cs instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) cs;
- return dcs.getDiffTree().countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK) > 0;
- }
- return false;
- }
-
- private boolean isUnassignedSet(ChangeSet cs) {
- return cs == unassignedDiffs;
- }
-
- private boolean hasConflicts(ChangeSet cs) {
- if (cs instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) cs;
- return dcs.getDiffTree().countFor(IThreeWayDiff.CONFLICTING, IThreeWayDiff.DIRECTION_MASK) > 0;
- }
- return false;
- }
-
- private boolean containsConflicts(ChangeSet cs) {
- if (cs instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) cs;
- return dcs.getDiffTree().hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), ResourceModelLabelProvider.CONFLICT_FILTER);
- }
- return false;
- }
-
- private boolean isVisible(Object object, IResourceDiffTree tree) {
- if (object instanceof IResource) {
- IResource resource = (IResource) object;
- IDiff diff = tree.getDiff(resource);
- if (diff != null && isVisible(diff))
- return true;
- int depth = getTraversalCalculator().getLayoutDepth(resource, null);
- IDiff[] diffs = tree.getDiffs(resource, depth);
- for (int i = 0; i < diffs.length; i++) {
- IDiff child = diffs[i];
- if (isVisible(child)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean hasChildren(TreePath path) {
- if (path.getSegmentCount() == 1) {
- Object first = path.getFirstSegment();
- if (first instanceof ChangeSet) {
- return isVisibleInMode(first) && hasChildrenInContext((ChangeSet)first);
- }
- }
- return getChildren(path).length > 0;
- }
-
- private boolean hasChildrenInContext(ChangeSet set) {
- IResource[] resources = set.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (getContext().getDiffTree().getDiff(resource) != null)
- return true;
- }
- return false;
- }
-
- public TreePath[] getParents(Object element) {
- if (element instanceof ChangeSet) {
- return new TreePath[] { TreePath.EMPTY };
- }
- if (element instanceof IResource) {
- IResource resource = (IResource) element;
- DiffChangeSet[] sets = getSetsContaining(resource);
- if (sets.length > 0) {
- List result = new ArrayList();
- for (int i = 0; i < sets.length; i++) {
- DiffChangeSet set = sets[i];
- TreePath path = getPathForElement(set, resource.getParent());
- if (path != null)
- result.add(path);
- }
- return (TreePath[]) result.toArray(new TreePath[result.size()]);
- } else {
- TreePath path = getPathForElement(getUnassignedSet(), resource.getParent());
- if (path != null)
- return new TreePath[] { path };
- }
- }
-
- return new TreePath[0];
- }
-
- private DiffChangeSet[] getSetsContaining(IResource resource) {
- List result = new ArrayList();
- DiffChangeSet[] allSets = getAllSets();
- for (int i = 0; i < allSets.length; i++) {
- DiffChangeSet set = allSets[i];
- if (isVisible(resource, set.getDiffTree())) {
- result.add(set);
- }
- }
- return (DiffChangeSet[]) result.toArray(new DiffChangeSet[result.size()]);
- }
-
- /**
- * Return all the change sets (incoming and outgoing). This
- * list must not include the unassigned set.
- * @return all the change sets (incoming and outgoing)
- */
- private DiffChangeSet[] getAllSets() {
- List result = new ArrayList();
- ChangeSetCapability csc = getChangeSetCapability();
- if (csc.supportsActiveChangeSets()) {
- ActiveChangeSetManager collector = csc.getActiveChangeSetManager();
- ChangeSet[] sets = collector.getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- result.add(set);
- }
- }
- if (checkedInCollector != null) {
- ChangeSet[] sets = checkedInCollector.getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- result.add(set);
- }
- }
- return (DiffChangeSet[]) result.toArray(new DiffChangeSet[result.size()]);
- }
-
- private TreePath getPathForElement(DiffChangeSet set, IResource resource) {
- List pathList = getPath(set.getDiffTree(), resource);
- if (pathList != null) {
- pathList.add(0, set);
- TreePath path = new TreePath(pathList.toArray());
- return path;
- }
- return null;
- }
-
- private List getPath(IResourceDiffTree tree, IResource resource) {
- if (resource == null)
- return null;
- boolean hasDiff = tree.getDiff(resource) == null;
- if (hasDiff && tree.members(resource).length == 0)
- return null;
- if (resource.getType() == IResource.ROOT) {
- return null;
- }
- List result = new ArrayList();
- result.add(resource.getProject());
- if (resource.getType() != IResource.PROJECT) {
- String layout = getTraversalCalculator().getLayout();
- if (layout.equals(IPreferenceIds.FLAT_LAYOUT)) {
- result.add(resource);
- } else if (layout.equals(IPreferenceIds.COMPRESSED_LAYOUT) && resource.getType() == IResource.FOLDER) {
- result.add(resource);
- } else if (layout.equals(IPreferenceIds.COMPRESSED_LAYOUT) && resource.getType() == IResource.FILE) {
- IContainer parent = resource.getParent();
- if (parent.getType() != IResource.PROJECT)
- result.add(parent);
- result.add(resource);
- } else {
- List resourcePath = new ArrayList();
- IResource next = resource;
- while (next.getType() != IResource.PROJECT) {
- resourcePath.add(next);
- next = next.getParent();
- }
- for (int i = resourcePath.size() - 1; i >=0; i--) {
- result.add(resourcePath.get(i));
- }
- }
- }
- return result;
- }
-
- public void init(ICommonContentExtensionSite site) {
- super.init(site);
- ChangeSetCapability csc = getChangeSetCapability();
- if (csc.supportsActiveChangeSets()) {
- ActiveChangeSetManager collector = csc.getActiveChangeSetManager();
- collector.addListener(collectorListener);
- }
- ChangeSetSorter sorter = getSorter();
- if (sorter != null) {
- sorter.setConfiguration(getConfiguration());
- }
- }
-
- private ChangeSetSorter getSorter() {
- INavigatorContentService contentService = getExtensionSite().getService();
- INavigatorSorterService sortingService = contentService.getSorterService();
- INavigatorContentExtension extension = getExtensionSite().getExtension();
- if (extension != null) {
- ViewerSorter sorter = sortingService.findSorter(extension.getDescriptor(), getModelProvider(), new DiffChangeSet(), new DiffChangeSet());
- if (sorter instanceof ChangeSetSorter) {
- return (ChangeSetSorter) sorter;
- }
- }
- return null;
- }
-
- private void initializeCheckedInChangeSetCollector(ChangeSetCapability csc) {
- if (csc.supportsCheckedInChangeSets()) {
- checkedInCollector = ((ModelParticipantChangeSetCapability)csc).createCheckedInChangeSetCollector(getConfiguration());
- getConfiguration().setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, checkedInCollector);
- checkedInCollector.addListener(collectorListener);
- checkedInCollector.add(((ResourceDiffTree)getContext().getDiffTree()).getDiffs());
- }
- }
-
- public void dispose() {
- ChangeSetCapability csc = getChangeSetCapability();
- if (csc.supportsActiveChangeSets()) {
- csc.getActiveChangeSetManager().removeListener(collectorListener);
- }
- if (checkedInCollector != null) {
- checkedInCollector.removeListener(collectorListener);
- checkedInCollector.dispose();
- }
- if (unassignedDiffs != null) {
- unassignedDiffs.getDiffTree().removeDiffChangeListener(diffTreeListener);
- }
- super.dispose();
- }
-
- public boolean isVisible(IDiff diff) {
- return super.isVisible(diff);
- }
-
- public IResourceDiffTree getDiffTree(TreePath path) {
- if (path.getSegmentCount() > 0) {
- Object first = path.getFirstSegment();
- if (first instanceof DiffChangeSet) {
- DiffChangeSet set = (DiffChangeSet) first;
- return set.getDiffTree();
- }
- }
- return getTheRest();
- }
-
- public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- // Override inherited method to reconcile sub-trees
- IPath[] removed = event.getRemovals();
- IDiff[] added = event.getAdditions();
- IDiff[] changed = event.getChanges();
- // Only adjust the set of the rest. The others will be handled by the collectors
- try {
- getTheRest().beginInput();
- for (int i = 0; i < removed.length; i++) {
- IPath path = removed[i];
- getTheRest().remove(path);
- }
- for (int i = 0; i < added.length; i++) {
- IDiff diff = added[i];
- // Only add the diff if it is not already in another set
- if (!isContainedInSet(diff)) {
- getTheRest().add(diff);
- }
- }
- for (int i = 0; i < changed.length; i++) {
- IDiff diff = changed[i];
- // Only add the diff if it is already contained in the free set
- if (getTheRest().getDiff(diff.getPath()) != null) {
- getTheRest().add(diff);
- }
- }
- } finally {
- getTheRest().endInput(monitor);
- }
- if (checkedInCollector != null)
- checkedInCollector.handleChange(event);
- if (firstDiffChange) {
- // One the first diff event, refresh the viewer to ensure outgoing change sets appear
- firstDiffChange = false;
- Utils.asyncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).refresh();
- }
- }, (StructuredViewer)getViewer());
- }
- }
-
- protected void updateLabels(ISynchronizationContext context, IPath[] paths) {
- super.updateLabels(context, paths);
- ChangeSet[] sets = getSetsShowingPropogatedStateFrom(paths);
- if (sets.length > 0)
- ((AbstractTreeViewer)getViewer()).update(sets, null);
- }
-
-
- private ChangeSet[] getSetsShowingPropogatedStateFrom(IPath[] paths) {
- Set result = new HashSet();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
- ChangeSet[] sets = getSetsShowingPropogatedStateFrom(path);
- for (int j = 0; j < sets.length; j++) {
- ChangeSet set = sets[j];
- result.add(set);
- }
- }
- return (ChangeSet[]) result.toArray(new ChangeSet[result.size()]);
- }
-
- protected DiffChangeSet[] getSetsShowingPropogatedStateFrom(IPath path) {
- List result = new ArrayList();
- DiffChangeSet[] allSets = getAllSets();
- for (int i = 0; i < allSets.length; i++) {
- DiffChangeSet set = allSets[i];
- if (set.getDiffTree().getDiff(path) != null || set.getDiffTree().getChildren(path).length > 0) {
- result.add(set);
- }
- }
- return (DiffChangeSet[]) result.toArray(new DiffChangeSet[result.size()]);
- }
-
- public ChangeSetCapability getChangeSetCapability() {
- ISynchronizeParticipant participant = getConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- return provider.getChangeSetCapability();
- }
- return null;
- }
-
- private Set getVisibleSetsInViewer() {
- TreeViewer viewer = (TreeViewer)getViewer();
- Tree tree = viewer.getTree();
- TreeItem[] children = tree.getItems();
- Set result = new HashSet();
- for (int i = 0; i < children.length; i++) {
- TreeItem control = children[i];
- Object data = control.getData();
- if (data instanceof ChangeSet) {
- ChangeSet set = (ChangeSet) data;
- result.add(set);
- }
- }
- return result;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java
deleted file mode 100644
index 05d064ee4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.diff.IDiffTree;
-import org.eclipse.team.internal.ccvs.core.mapping.ChangeSetModelProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantLabelDecorator;
-import org.eclipse.team.internal.core.subscribers.*;
-import org.eclipse.team.internal.ui.mapping.ResourceModelLabelProvider;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
-import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-
-public class ChangeSetLabelProvider extends ResourceModelLabelProvider {
-
- private CVSParticipantLabelDecorator decorator;
-
- public void init(ICommonContentExtensionSite site) {
- super.init(site);
- ISynchronizePageConfiguration configuration = getConfiguration();
- if (isCompare(configuration)) {
- decorator = new CVSParticipantLabelDecorator(configuration);
- }
- }
-
- private ISynchronizePageConfiguration getConfiguration() {
- return (ISynchronizePageConfiguration)getExtensionSite().getExtensionStateModel().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_PAGE_CONFIGURATION);
- }
-
- private boolean isCompare(ISynchronizePageConfiguration configuration) {
- return configuration.getParticipant() instanceof ModelCompareParticipant;
- }
-
- public String getText(Object element) {
- String text = super.getText(element);
- if (decorator != null && isChangeSetsEnabled())
- text = decorator.decorateText(text, element);
- return text;
- }
-
- private boolean isChangeSetsEnabled() {
- String id = (String)getConfiguration().getProperty(ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER);
- return id.equals(ChangeSetModelProvider.ID);
- }
-
- protected String getDelegateText(Object elementOrPath) {
- Object element = internalGetElement(elementOrPath);
- if (element instanceof DiffChangeSet) {
- DiffChangeSet set = (DiffChangeSet) element;
- return set.getName();
- }
- return super.getDelegateText(elementOrPath);
- }
-
- protected Image getDelegateImage(Object elementOrPath) {
- Object element = internalGetElement(elementOrPath);
- if (element instanceof DiffChangeSet) {
- return getChangeSetImage();
- }
- return super.getDelegateImage(elementOrPath);
- }
-
- private Image getChangeSetImage() {
- return getImageManager().getImage(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CHANGELOG));
- }
-
- public void dispose() {
- if (decorator != null)
- decorator.dispose();
- super.dispose();
- }
-
- protected boolean isBusy(Object elementOrPath) {
- Object element = internalGetElement(elementOrPath);
- if (element instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) element;
- IResource[] resources = dcs.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (getContext().getDiffTree().getProperty(resource.getFullPath(), IDiffTree.P_BUSY_HINT))
- return true;
- }
- return false;
- }
- return super.isBusy(elementOrPath);
- }
-
- protected boolean hasDecendantConflicts(Object elementOrPath) {
- Object element = internalGetElement(elementOrPath);
- if (element instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) element;
- IResource[] resources = dcs.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (getContext().getDiffTree().getProperty(resource.getFullPath(), IDiffTree.P_HAS_DESCENDANT_CONFLICTS))
- return true;
- }
- return false;
- }
- if (elementOrPath instanceof TreePath && element instanceof IResource) {
- DiffChangeSet set = internalGetChangeSet(elementOrPath);
- if (set != null) {
- ResourceTraversal[] traversals = getTraversalCalculator().getTraversals(set, (TreePath)elementOrPath);
- return (getContext().getDiffTree().hasMatchingDiffs(traversals, CONFLICT_FILTER));
- }
- }
- return super.hasDecendantConflicts(elementOrPath);
- }
-
- private DiffChangeSet internalGetChangeSet(Object elementOrPath) {
- if (elementOrPath instanceof TreePath) {
- TreePath tp = (TreePath) elementOrPath;
- Object o = tp.getFirstSegment();
- if (o instanceof DiffChangeSet) {
- return (DiffChangeSet) o;
- }
- }
- return null;
- }
-
- protected int getMarkerSeverity(Object elementOrPath) {
- Object element = internalGetElement(elementOrPath);
- if (element instanceof DiffChangeSet) {
- DiffChangeSet dcs = (DiffChangeSet) element;
- Set projects = new HashSet();
- IResource[] resources = dcs.getResources();
- int severity = -1;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IProject project = resource.getProject();
- if (!projects.contains(project)) {
- projects.add(project);
- int next = super.getMarkerSeverity(project);
- if (next == IMarker.SEVERITY_ERROR)
- return IMarker.SEVERITY_ERROR;
- if (next == IMarker.SEVERITY_WARNING)
- severity = next;
- }
- }
- return severity;
- }
- return super.getMarkerSeverity(elementOrPath);
- }
-
- protected void updateLabels(Object[] elements) {
- super.updateLabels(addSetsContainingElements(elements));
- }
-
- private Object[] addSetsContainingElements(Object[] elements) {
- Set result = new HashSet();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
- result.add(object);
- if (object instanceof IProject) {
- IProject project = (IProject) object;
- ChangeSet[] sets = getSetsContaing(project);
- for (int j = 0; j < sets.length; j++) {
- ChangeSet set = sets[j];
- result.add(set);
- }
- }
- }
- return result.toArray();
- }
-
- private ChangeSet[] getSetsContaing(IProject project) {
- return getContentProvider().getSetsShowingPropogatedStateFrom(project.getFullPath());
- }
-
- private ChangeSetContentProvider getContentProvider() {
- return (ChangeSetContentProvider)getExtensionSite().getExtension().getContentProvider();
- }
-
- private Object internalGetElement(Object elementOrPath) {
- if (elementOrPath instanceof TreePath) {
- TreePath tp = (TreePath) elementOrPath;
- return tp.getLastSegment();
- }
- return elementOrPath;
- }
-
- public Font getFont(Object element) {
- element = internalGetElement(element);
- if (element instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)element)) {
- return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
- }
- return super.getFont(element);
- }
-
- private boolean isDefaultActiveSet(ActiveChangeSet set) {
- ChangeSetCapability changeSetCapability = getContentProvider().getChangeSetCapability();
- if (changeSetCapability != null) {
- ActiveChangeSetManager activeChangeSetManager = changeSetCapability.getActiveChangeSetManager();
- if (activeChangeSetManager != null)
- return activeChangeSetManager.isDefault(set);
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetSorter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetSorter.java
deleted file mode 100644
index 4317c76dd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetSorter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ccvs.core.mapping.CVSCheckedInChangeSet;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
-import org.eclipse.team.internal.core.subscribers.ChangeSet;
-import org.eclipse.team.internal.ui.mapping.ResourceModelSorter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class ChangeSetSorter extends ResourceModelSorter {
-
- // Comment sorting options
- public final static int DATE = 1;
- public final static int COMMENT = 2;
- public final static int USER = 3;
- private ISynchronizePageConfiguration configuration;
-
- public ChangeSetSorter() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- //have to deal with non-resources in navigator
- //if one or both objects are not resources, returned a comparison
- //based on class.
- if (o1 instanceof ChangeSet && o2 instanceof ChangeSet) {
- ChangeSet s1 = (ChangeSet) o1;
- ChangeSet s2 = (ChangeSet) o2;
- if (s1 instanceof ActiveChangeSet && s2 instanceof ActiveChangeSet) {
- return compareNames(((ActiveChangeSet)s1).getTitle(), ((ActiveChangeSet)s2).getTitle());
- }
- if (s1 instanceof CVSCheckedInChangeSet && s2 instanceof CVSCheckedInChangeSet) {
- CVSCheckedInChangeSet r1 = (CVSCheckedInChangeSet)s1;
- CVSCheckedInChangeSet r2 = (CVSCheckedInChangeSet)s2;
- if (getCommentCriteria() == DATE)
- return r1.getDate().compareTo(r2.getDate());
- else if (getCommentCriteria() == COMMENT)
- return compareNames(r1.getComment(), r2.getComment());
- else if (getCommentCriteria() == USER)
- return compareNames(r1.getAuthor(), r2.getAuthor());
- else
- return 0;
- }
- if (s1 instanceof ActiveChangeSet) {
- return -1;
- } else if (s2 instanceof ActiveChangeSet) {
- return 1;
- }
- if (s1 instanceof CVSCheckedInChangeSet) {
- return -1;
- } else if (s2 instanceof CVSCheckedInChangeSet) {
- return 1;
- }
- }
- return super.compare(viewer, o1, o2);
- }
-
- private int compareNames(String s1, String s2) {
- return collator.compare(s1, s2);
- }
-
- public int getCommentCriteria() {
- return ChangeSetActionProvider.getSortCriteria(configuration);
- }
-
- public void setConfiguration(ISynchronizePageConfiguration configuration) {
- this.configuration = configuration;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java
deleted file mode 100644
index 677e0690a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java
+++ /dev/null
@@ -1,481 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-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.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.diff.provider.DiffTree;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.mapping.CVSCheckedInChangeSet;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSChangeSetCollector;
-import org.eclipse.team.internal.ccvs.ui.subscriber.LogEntryCacheUpdateHandler;
-import org.eclipse.team.internal.ccvs.ui.subscriber.LogEntryCacheUpdateHandler.ILogsFetchedListener;
-import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;
-import org.eclipse.team.internal.core.subscribers.*;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
-
-public class CheckedInChangeSetCollector extends BatchingChangeSetManager implements ILogsFetchedListener {
-
- /*
- * Constant used to store the log entry handler in the configuration so it can
- * be kept around over layout changes
- */
- private static final String LOG_ENTRY_HANDLER = CVSUIPlugin.ID + ".LogEntryHandler"; //$NON-NLS-1$
-
- /* *****************************************************************************
- * Special sync info that has its kind already calculated.
- */
- private class CVSUpdatableSyncInfo extends CVSSyncInfo {
- public int kind;
- public CVSUpdatableSyncInfo(int kind, IResource local, IResourceVariant base, IResourceVariant remote, Subscriber s) {
- super(local, base, remote, s);
- this.kind = kind;
- }
-
- protected int calculateKind() throws TeamException {
- return kind;
- }
- }
-
- IDiffChangeListener diffTreeListener = new IDiffChangeListener() {
- public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
- // Ignore
- }
- public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- if (event.getTree().isEmpty()) {
- ChangeSet changeSet = getChangeSet(event.getTree());
- if (changeSet != null) {
- remove(changeSet);
- }
- } else {
- ChangeSet changeSet = getChangeSet(event.getTree());
- if (changeSet != null) {
- fireResourcesChangedEvent(changeSet, getAffectedPaths(event));
- }
- }
- }
- private IPath[] getAffectedPaths(IDiffChangeEvent event) {
- Set result = new HashSet();
- IPath[] removed = event.getRemovals();
- for (int i = 0; i < removed.length; i++) {
- IPath path = removed[i];
- result.add(path);
- }
- IDiff[] diffs = event.getAdditions();
- for (int j = 0; j < diffs.length; j++) {
- IDiff diff = diffs[j];
- result.add(diff.getPath());
- }
- diffs = event.getChanges();
- for (int j = 0; j < diffs.length; j++) {
- IDiff diff = diffs[j];
- result.add(diff.getPath());
- }
- return (IPath[]) result.toArray(new IPath[result.size()]);
- }
- };
-
- private final ISynchronizePageConfiguration configuration;
- private boolean disposed;
- private LogEntryCache logEntryCache;
- private final Subscriber subscriber;
-
- private HashSet updatedSets;
-
- public CheckedInChangeSetCollector(ISynchronizePageConfiguration configuration, Subscriber subscriber) {
- this.configuration = configuration;
- this.subscriber = subscriber;
- }
-
- /**
- * Return the configuration for the page that is displaying the model created
- * using this collector.
- * @return the configuration for the page that is displaying the model created
- * using this collector
- */
- public final ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
-
- protected void handleSetAdded(ChangeSet set) {
- ((DiffChangeSet)set).getDiffTree().addDiffChangeListener(diffTreeListener);
- super.handleSetAdded(set);
- if (updatedSets != null) {
- updatedSets.add(set);
- ((DiffTree)((DiffChangeSet)set).getDiffTree()).beginInput();
- }
- }
-
- protected void handleSetRemoved(ChangeSet set) {
- ((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(diffTreeListener);
- super.handleSetRemoved(set);
- }
-
- protected ChangeSet getChangeSet(IDiffTree tree) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet changeSet = sets[i];
- if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
- return changeSet;
- }
- }
- return null;
- }
-
- public void handleChange(IDiffChangeEvent event) {
- List removals = new ArrayList();
- List additions = new ArrayList();
- removals.addAll(Arrays.asList(event.getRemovals()));
- additions.addAll(Arrays.asList(event.getAdditions()));
- IDiff[] changed = event.getChanges();
- for (int i = 0; i < changed.length; i++) {
- IDiff diff = changed[i];
- additions.add(diff);
- removals.add(diff.getPath());
- }
- if (!removals.isEmpty()) {
- remove((IPath[]) removals.toArray(new IPath[removals.size()]));
- }
- if (!additions.isEmpty()) {
- add((IDiff[]) additions.toArray(new IDiff[additions.size()]));
- }
- }
-
- protected void remove(IPath[] paths) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- DiffChangeSet set = (DiffChangeSet)sets[i];
- set.remove(paths);
- }
- }
-
- public synchronized LogEntryCacheUpdateHandler getLogEntryHandler() {
- LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)getConfiguration().getProperty(LOG_ENTRY_HANDLER);
- if (handler == null) {
- handler = initializeLogEntryHandler(getConfiguration());
- }
- handler.setListener(this);
- return handler;
- }
-
- /*
- * Initialize the log entry handler and place it in the configuration
- */
- private LogEntryCacheUpdateHandler initializeLogEntryHandler(final ISynchronizePageConfiguration configuration) {
- final LogEntryCacheUpdateHandler logEntryHandler = new LogEntryCacheUpdateHandler(configuration);
- configuration.setProperty(LOG_ENTRY_HANDLER, logEntryHandler);
- // Use an action group to get notified when the configuration is disposed
- configuration.addActionContribution(new SynchronizePageActionGroup() {
- public void dispose() {
- super.dispose();
- LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)configuration.getProperty(LOG_ENTRY_HANDLER);
- if (handler != null) {
- handler.shutdown();
- configuration.setProperty(LOG_ENTRY_HANDLER, null);
- }
- }
- });
- return logEntryHandler;
- }
-
- protected void add(IDiff[] diffs) {
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null)
- try {
- handler.fetch(getSyncInfos(diffs));
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- private SyncInfo[] getSyncInfos(IDiff[] diffs) {
- SyncInfoSet set = new SyncInfoSet();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- set.add(getConverter().asSyncInfo(diff, getSubscriber().getResourceComparator()));
- }
- return set.getSyncInfos();
- }
-
- public Subscriber getSubscriber() {
- return subscriber;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#dispose()
- */
- public void dispose() {
- // No longer listen for log entry changes
- // (The handler is disposed with the page)
- disposed = true;
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) handler.setListener(null);
- getConfiguration().setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, null);
- logEntryCache = null;
- super.dispose();
- }
-
- /**
- * Fetch the log histories for the remote changes and use this information
- * to add each resource to an appropriate commit set.
- */
- private void handleRemoteChanges(final SyncInfo[] infos, final LogEntryCache logEntries, final IProgressMonitor monitor) {
- try {
- beginSetUpdate();
- addLogEntries(infos, logEntries, monitor);
- } finally {
- endSetUpdate(monitor);
- }
- }
-
- private void beginSetUpdate() {
- updatedSets = new HashSet();
- }
-
- private void endSetUpdate(IProgressMonitor monitor) {
- for (Iterator iter = updatedSets.iterator(); iter.hasNext();) {
- DiffChangeSet set = (DiffChangeSet) iter.next();
- try {
- ((DiffTree)set.getDiffTree()).endInput(monitor);
- } catch (RuntimeException e) {
- CVSUIPlugin.log(IStatus.ERROR, "Internal error", e); //$NON-NLS-1$
- }
- }
- updatedSets = null;
- }
-
- /*
- * Add the following sync info elements to the viewer. It is assumed that these elements have associated
- * log entries cached in the log operation.
- */
- private void addLogEntries(SyncInfo[] commentInfos, LogEntryCache logs, IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, commentInfos.length * 10);
- if (logs != null) {
- for (int i = 0; i < commentInfos.length; i++) {
- addSyncInfoToCommentNode(commentInfos[i], logs);
- monitor.worked(10);
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * Create a node for the given sync info object. The logs should contain the log for this info.
- *
- * @param info the info for which to create a node in the model
- * @param log the cvs log for this node
- */
- private void addSyncInfoToCommentNode(SyncInfo info, LogEntryCache logs) {
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- ICVSRemoteResource remoteResource = handler.getRemoteResource(info);
- if(handler.getSubscriber() instanceof CVSCompareSubscriber && remoteResource != null) {
- addMultipleRevisions(info, logs, remoteResource);
- } else {
- addSingleRevision(info, logs, remoteResource);
- }
- }
- }
-
- /*
- * Add a single log entry to the model.
- *
- * @param info
- * @param logs
- * @param remoteResource
- */
- private void addSingleRevision(SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) {
- ILogEntry logEntry = logs.getLogEntry(remoteResource);
- if (remoteResource != null && !remoteResource.isFolder()) {
- // For incoming deletions grab the comment for the latest on the same branch
- // which is now in the attic.
- try {
- String remoteRevision = ((ICVSRemoteFile) remoteResource).getRevision();
- if (isDeletedRemotely(info)) {
- ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
- String revision = entry.getRevision();
- if (entry.isDeletion() && ResourceSyncInfo.isLaterRevision(revision, remoteRevision)) {
- logEntry = entry;
- }
- }
- }
- } catch (TeamException e) {
- // continue and skip deletion checks
- }
- }
- addRemoteChange(info, remoteResource, logEntry);
- }
-
- /*
- * Add multiple log entries to the model.
- *
- * @param info
- * @param logs
- * @param remoteResource
- */
- private void addMultipleRevisions(SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) {
- ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- if(logEntries == null || logEntries.length == 0) {
- // If for some reason we don't have a log entry, try the latest
- // remote.
- addRemoteChange(info, null, null);
- } else {
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
- addRemoteChange(info, remoteResource, entry);
- }
- }
- }
-
- private boolean isDeletedRemotely(SyncInfo info) {
- int kind = info.getKind();
- if(kind == (SyncInfo.INCOMING | SyncInfo.DELETION)) return true;
- if(SyncInfo.getDirection(kind) == SyncInfo.CONFLICTING && info.getRemote() == null) return true;
- return false;
- }
-
- /*
- * Add the remote change to an incoming commit set
- */
- private void addRemoteChange(SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) {
- if (disposed) return;
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if(handler != null && remoteResource != null && logEntry != null && handler.isRemoteChange(info)) {
- if(requiresCustomSyncInfo(info, remoteResource, logEntry)) {
- info = new CVSUpdatableSyncInfo(info.getKind(), info.getLocal(), info.getBase(), (RemoteResource)logEntry.getRemoteFile(), getSubscriber());
- try {
- info.init();
- } catch (TeamException e) {
- // this shouldn't happen, we've provided our own calculate kind
- }
- }
- IDiff diff = getConverter().getDeltaFor(info);
- // Only add the info if the base and remote differ
- IResourceVariant base = info.getBase();
- IResourceVariant remote = info.getRemote();
- if ((base == null && remote != null) || (remote == null && base != null) || (remote != null && base != null && !base.equals(remote))) {
- synchronized(this) {
- CVSCheckedInChangeSet set = getChangeSetFor(logEntry);
- if (set == null) {
- set = createChangeSetFor(logEntry);
- add(set);
- }
- set.add(diff);
- }
- }
- } else {
- // The info was not retrieved for the remote change for some reason.
- // Add the node to the root
- //addToDefaultSet(DEFAULT_INCOMING_SET_NAME, info);
- }
- }
-
- private SyncInfoToDiffConverter getConverter() {
- SyncInfoToDiffConverter converter = (SyncInfoToDiffConverter)Utils.getAdapter(subscriber, SyncInfoToDiffConverter.class);
- if (converter == null)
- converter = SyncInfoToDiffConverter.getDefault();
- return converter;
- }
-
- private CVSCheckedInChangeSet createChangeSetFor(ILogEntry logEntry) {
- return new CVSCheckedInChangeSet(logEntry);
- }
-
- private CVSCheckedInChangeSet getChangeSetFor(ILogEntry logEntry) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set instanceof CVSCheckedInChangeSet &&
- set.getComment().equals(logEntry.getComment()) &&
- ((CVSCheckedInChangeSet)set).getAuthor().equals(logEntry.getAuthor())) {
- return (CVSCheckedInChangeSet)set;
- }
- }
- return null;
- }
-
- private boolean requiresCustomSyncInfo(SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) {
- // Only interested in non-deletions
- if (logEntry.isDeletion()) return false;
- // Only require a custom sync info if the remote of the sync info
- // differs from the remote in the log entry
- IResourceVariant remote = info.getRemote();
- if (remote == null) return true;
- return !remote.equals(remoteResource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#waitUntilDone(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void waitUntilDone(IProgressMonitor monitor) {
- monitor.worked(1);
- // wait for the event handler to process changes.
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- while(handler.getEventHandlerJob().getState() != Job.NONE) {
- monitor.worked(1);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- }
- Policy.checkCanceled(monitor);
- }
- }
- monitor.worked(1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.LogEntryCacheUpdateHandler.ILogsFetchedListener#logEntriesFetched(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor) {
- if (disposed) return;
- // Hold on to the cache so we can use it while commit sets are visible
- this.logEntryCache = logEntryCache;
- try {
- beginInput();
- handleRemoteChanges(set.getSyncInfos(), logEntryCache, monitor);
- } finally {
- endInput(monitor);
- }
- }
-
- public ICVSRemoteFile getImmediatePredecessor(ICVSRemoteFile file) throws TeamException {
- if (logEntryCache != null)
- return logEntryCache.getImmediatePredecessor(file);
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CommitAction.java
deleted file mode 100644
index d2a249154..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CommitAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class CommitAction extends AbstractCommitAction implements IPropertyChangeListener {
-
- public CommitAction(final ISynchronizePageConfiguration configuration) {
- super(configuration);
- configuration.addPropertyChangeListener(this);
- setId(ICVSUIConstants.CMD_COMMIT);
- setActionDefinitionId(ICVSUIConstants.CMD_COMMIT);
- }
-
- protected String getBundleKeyPrefix() {
- return "WorkspaceCommitAction."; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ModelProviderAction#isEnabledForSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- return internalIsEnabled(selection);
- }
-
- private boolean internalIsEnabled(IStructuredSelection selection) {
- // Only enable commit in outgoing or both modes
- int mode = getConfiguration().getMode();
- if (mode == ISynchronizePageConfiguration.OUTGOING_MODE || mode == ISynchronizePageConfiguration.BOTH_MODE) {
- return getResourceMappings(selection).length > 0;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getSource() == getConfiguration() && event.getProperty() == ISynchronizePageConfiguration.P_MODE) {
- setEnabled(internalIsEnabled(getStructuredSelection()));
- }
- }
-
- protected ResourceTraversal[] getCommitTraversals(IStructuredSelection selection, IProgressMonitor monitor)
- throws CoreException {
- return getResourceTraversals(selection, monitor);
- }
-
- protected IStructuredSelection getActualSelection() throws CVSException {
- IStructuredSelection selection = getStructuredSelection();
- IStructuredSelection actualSelection = internalGetActualSelection();
- if (!equal(selection, actualSelection)) {
- throw new CVSException(CVSUIMessages.CommitAction_3);
- }
- return selection;
- }
-
- private boolean equal(IStructuredSelection selection,
- IStructuredSelection actualSelection) {
- return selection.equals(actualSelection);
- }
-
- private IStructuredSelection internalGetActualSelection() {
- ISelection s = getConfiguration().getSite().getSelectionProvider().getSelection();
- if (s instanceof IStructuredSelection) {
- return (IStructuredSelection) s;
- }
- return StructuredSelection.EMPTY;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java
deleted file mode 100644
index 20e1eab55..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CompareSubscriberContext.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.diff.DiffFilter;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
-import org.eclipse.team.internal.core.subscribers.ContentComparisonDiffFilter;
-
-public class CompareSubscriberContext extends CVSSubscriberMergeContext {
-
- public static SynchronizationContext createContext(ISynchronizationScopeManager manager, CVSCompareSubscriber subscriber) {
- CompareSubscriberContext mergeContext = new CompareSubscriberContext(subscriber, manager);
- mergeContext.initialize();
- return mergeContext;
- }
-
- protected CompareSubscriberContext(Subscriber subscriber, ISynchronizationScopeManager manager) {
- super(subscriber, manager);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#markAsMerged(org.eclipse.team.core.diff.IDiff, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void markAsMerged(IDiff node, boolean inSyncHint,
- IProgressMonitor monitor) throws CoreException {
- // Do nothing
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.SubscriberMergeContext#getDiffFilter()
- */
- protected DiffFilter getDiffFilter() {
- // Return a filter that selects any diffs whose contents are not equal
- final DiffFilter contentsEqual = new ContentComparisonDiffFilter(false);
- return new DiffFilter() {
- public boolean select(IDiff diff, IProgressMonitor monitor) {
- return !contentsEqual.select(diff, monitor);
- }
- };
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
deleted file mode 100644
index 94febf1c4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.ui.PlatformUI;
-
-public class CreatePatchAction extends CVSModelProviderAction implements IDiffChangeListener {
-
- public CreatePatchAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- getSynchronizationContext().getDiffTree().addDiffChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ModelProviderAction#isEnabledForSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- return internalIsEnabled(selection);
- }
-
- private boolean internalIsEnabled(IStructuredSelection selection) {
- // Only enable commit in outgoing or both modes
- int mode = getConfiguration().getMode();
- if (mode == ISynchronizePageConfiguration.OUTGOING_MODE || mode == ISynchronizePageConfiguration.BOTH_MODE) {
- return getResourceMappings(selection).length > 0;
- }
- return getSynchronizationContext().getDiffTree().countFor(IThreeWayDiff.CONFLICTING, IThreeWayDiff.DIRECTION_MASK) > 0;
- }
-
- private IResource[] getVisibleResources(ResourceTraversal[] traversals) {
- final Set resources = new HashSet();
- final IResourceDiffTree diffTree = getSynchronizationContext().getDiffTree();
- IDiff[] diffs = diffTree.getDiffs(traversals);
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- IResource child = diffTree.getResource(diff);
- if (child.getType() == IResource.FILE && diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- IDiff local = twd.getLocalChange();
- if (local != null && local.getKind() != IDiff.NO_CHANGE) {
- resources.add(child);
- }
- }
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.mappings.CVSModelProviderAction#getBundleKeyPrefix()
- */
- protected String getBundleKeyPrefix() {
- return "GenerateDiffFileAction."; //$NON-NLS-1$
- }
-
- public void execute() {
- final ResourceTraversal [][] traversals = new ResourceTraversal[][] { null };
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- traversals[0] = getResourceTraversals(getStructuredSelection(), monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- Utils.handleError(getConfiguration().getSite().getShell(), e, null, null);
- } catch (InterruptedException e) {
- // Ignore
- }
- if (traversals[0] != null) {
- IResource[] resources = getVisibleResources(traversals[0]);
- if (resources.length == 0) {
- MessageDialog.openInformation(getConfiguration().getSite().getShell(), CVSUIMessages.CreatePatchAction_0, CVSUIMessages.CreatePatchAction_1);
- } else {
- GenerateDiffFileWizard.run(getConfiguration().getSite().getPart(), resources, false);
- }
- }
- }
-
- public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- updateEnablement();
- }
-
- public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
- // Nothing to do
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
deleted file mode 100644
index 664ee810e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ui.Utils;
-
-public class MergeSubscriberContext extends CVSSubscriberMergeContext {
-
- public static MergeSubscriberContext createContext(ISynchronizationScopeManager manager, Subscriber subscriber) {
- MergeSubscriberContext mergeContext = new MergeSubscriberContext(subscriber, manager);
- mergeContext.initialize();
- return mergeContext;
- }
-
- private boolean cancel = true;
-
- public MergeSubscriberContext(Subscriber subscriber, ISynchronizationScopeManager manager) {
- super(subscriber, manager);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#markAsMerged(org.eclipse.team.core.diff.IDiffNode, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void markAsMerged(final IDiff diff, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ((CVSMergeSubscriber)getSubscriber()).merged(new IResource[] { getDiffTree().getResource(diff)});
- }
- }, getMergeRule(diff), IResource.NONE, monitor);
- }
-
- public void markAsMerged(final IDiff[] diffs, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- List result = new ArrayList();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- result.add(getDiffTree().getResource(diff));
- }
- ((CVSMergeSubscriber)getSubscriber()).merged((IResource[]) result.toArray(new IResource[result.size()]));
- }
- }, getMergeRule(diffs), IResource.NONE, monitor);
- }
-
- public void dispose() {
- if (cancel)
- ((CVSMergeSubscriber)getSubscriber()).cancel();
- super.dispose();
- }
-
- public void setCancelSubscriber(boolean b) {
- cancel = b;
- }
-
- public IStatus merge(final IDiff diff, final boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
- final IStatus[] status = new IStatus[] { Status.OK_STATUS };
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IThreeWayDiff currentDiff = (IThreeWayDiff)getSubscriber().getDiff(getDiffTree().getResource(diff));
- if (!MergeSubscriberContext.this.equals(currentDiff, (IThreeWayDiff)diff)) {
- throw new CVSException(NLS.bind(CVSUIMessages.CVSMergeContext_1, diff.getPath()));
- }
- status[0] = MergeSubscriberContext.super.merge(diff, ignoreLocalChanges, monitor);
- if (status[0].isOK()) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource.getType() == IResource.FILE && resource.exists() && diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getKind() == IDiff.ADD && twd.getDirection() == IThreeWayDiff.INCOMING) {
- IFileRevision remote = Utils.getRemote(diff);
- IResourceVariant variant = (IResourceVariant)Utils.getAdapter(remote, IResourceVariant.class);
- byte[] syncBytes = variant.asBytes();
- MutableResourceSyncInfo info = new MutableResourceSyncInfo(resource.getName(), ResourceSyncInfo.ADDED_REVISION);
- info.setKeywordMode(ResourceSyncInfo.getKeywordMode(syncBytes));
- info.setTag(getTag(resource.getParent()));
- CVSWorkspaceRoot.getCVSFileFor((IFile)resource).setSyncInfo(info, ICVSFile.DIRTY);
- }
- }
- }
- }
-
- }, getMergeRule(diff), IWorkspace.AVOID_UPDATE, monitor);
- return status[0];
- }
-
- CVSTag getTag(IContainer parent) throws CVSException {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null)
- return info.getTag();
- return null;
- }
-
- boolean equals(IThreeWayDiff currentDiff, IThreeWayDiff diffTreeDiff) {
- return currentDiff != null
- && currentDiff.getKind() == diffTreeDiff.getKind()
- && currentDiff.getDirection() == diffTreeDiff.getDirection();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelCompareParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelCompareParticipant.java
deleted file mode 100644
index 3e2960eb9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelCompareParticipant.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberMergeContext;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
-import org.eclipse.team.internal.ui.synchronize.IChangeSetProvider;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class ModelCompareParticipant extends CVSModelSynchronizeParticipant implements IChangeSetProvider {
-
- public static final String VIEWER_ID = "org.eclipse.team.cvs.ui.compareSynchronization"; //$NON-NLS-1$
-
- public class CompareChangeSetCapability extends ModelParticipantChangeSetCapability {
- public CheckedInChangeSetCollector createCheckedInChangeSetCollector(ISynchronizePageConfiguration configuration) {
- return new CheckedInChangeSetCollector(configuration, getSubscriber());
- }
- }
-
- private CompareChangeSetCapability capability;
-
- public ModelCompareParticipant(SynchronizationContext context) {
- super(context);
- try {
- setInitializationData(TeamUI.getSynchronizeManager().getParticipantDescriptor("org.eclipse.team.cvs.ui.modelCompareParticipant")); //$NON-NLS-1$
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
- }
- setSecondaryId(Long.toString(System.currentTimeMillis()));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- configuration.setProperty(ISynchronizePageConfiguration.P_VIEWER_ID, VIEWER_ID);
- super.initializeConfiguration(configuration);
- }
-
- public Subscriber getSubscriber() {
- return ((SubscriberMergeContext)getContext()).getSubscriber();
- }
-
- public ChangeSetCapability getChangeSetCapability() {
- if (capability == null) {
- capability = new CompareChangeSetCapability();
- }
- return capability;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java
deleted file mode 100644
index 43d8a8664..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class ModelMergeOperation extends AbstractModelMergeOperation {
-
- private final Subscriber subscriber;
- private final boolean attempAutomerge;
-
- /**
- * Create a merge operation for the given subscriber. The merge operation will cancel the subscriber
- * when it is no longer needed.
- * @param part the part
- * @param mappings the mappings
- * @param subscriber the subscriber
- * @param attempAutomerge
- */
- public ModelMergeOperation(IWorkbenchPart part, ResourceMapping[] mappings, final CVSMergeSubscriber subscriber, boolean attempAutomerge) {
- super(part, new SubscriberScopeManager(subscriber.getName(), mappings, subscriber, true){
- public void dispose() {
- subscriber.cancel();
- super.dispose();
- }
- }, true);
- this.subscriber = subscriber;
- this.attempAutomerge = attempAutomerge;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelParticipantMergeOperation#createMergeContext()
- */
- protected SynchronizationContext createMergeContext() {
- return MergeSubscriberContext.createContext(getScopeManager(), subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getJobName()
- */
- protected String getJobName() {
- return CVSUIMessages.MergeUpdateAction_jobName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.mappings.AbstractModelMergeOperation#createParticipant()
- */
- protected ModelSynchronizeParticipant createParticipant() {
- setOwnsManager(false);
- return new ModelMergeParticipant((MergeSubscriberContext)createMergeContext());
- }
-
- protected boolean isPreviewInDialog() {
- return false;
- }
-
- public boolean isPreviewRequested() {
- return !attempAutomerge;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java
deleted file mode 100644
index a9e8bcb61..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.mapping.ISynchronizationScope;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.MergeContext;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSActionDelegateWrapper;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
-
-public class ModelMergeParticipant extends CVSModelSynchronizeParticipant {
-
- public static final String VIEWER_ID = "org.eclipse.team.cvs.ui.mergeSynchronization"; //$NON-NLS-1$
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_1 = "otherActions1"; //$NON-NLS-1$
-
- public static final String ID = "org.eclipse.team.cvs.ui.modelMergeParticipant"; //$NON-NLS-1$
-
- private final static String CTX_SUBSCRIBER = "mergeSubscriber"; //$NON-NLS-1$
- private final static String CTX_ROOT = "root"; //$NON-NLS-1$
- private final static String CTX_ROOT_PATH = "root_resource"; //$NON-NLS-1$
- private final static String CTX_START_TAG = "start_tag"; //$NON-NLS-1$
- private final static String CTX_START_TAG_TYPE = "start_tag_type"; //$NON-NLS-1$
- private final static String CTX_END_TAG = "end_tag"; //$NON-NLS-1$
- private final static String CTX_END_TAG_TYPE = "end_tag_type"; //$NON-NLS-1$
-
- public class MergeActionGroup extends ModelSynchronizeParticipantActionGroup {
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- }
- }
- }
-
- private CVSMergeSubscriber subscriber;
-
- public ModelMergeParticipant() {
- }
-
- public ModelMergeParticipant(MergeSubscriberContext context) {
- super(context);
- subscriber = getSubscriber();
- initialize();
- }
-
- protected ModelSynchronizeParticipantActionGroup createMergeActionGroup() {
- return new MergeActionGroup();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- configuration.setProperty(ISynchronizePageConfiguration.P_VIEWER_ID, VIEWER_ID);
- super.initializeConfiguration(configuration);
- configuration.setSupportedModes(ISynchronizePageConfiguration.INCOMING_MODE | ISynchronizePageConfiguration.CONFLICTING_MODE);
- configuration.setMode(ISynchronizePageConfiguration.INCOMING_MODE);
- }
-
- private void initialize() {
- try {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(ID);
- setInitializationData(descriptor);
- CVSMergeSubscriber s = (CVSMergeSubscriber)getSubscriber();
- setSecondaryId(s.getId().getLocalName());
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- private CVSMergeSubscriber getSubscriber() {
- return (CVSMergeSubscriber)((MergeSubscriberContext)getContext()).getSubscriber();
- }
-
- public void init(String secondaryId, IMemento memento) throws PartInitException {
- if(memento != null) {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(ID);
- String qualifier = descriptor.getId();
- String localname = secondaryId;
- if(qualifier == null || localname == null) {
- throw new PartInitException(CVSUIMessages.MergeSynchronizeParticipant_8);
- }
- try {
- subscriber = read(new QualifiedName(qualifier, localname), memento.getChild(CTX_SUBSCRIBER));
- } catch (CVSException e) {
- throw new PartInitException(CVSUIMessages.MergeSynchronizeParticipant_9, e);
- }
- }
- try {
- super.init(secondaryId, memento);
- } catch (PartInitException e) {
- subscriber.cancel();
- throw e;
- }
- }
-
- public void saveState(IMemento memento) {
- super.saveState(memento);
- write(subscriber, memento.createChild(CTX_SUBSCRIBER));
- }
-
- private CVSMergeSubscriber read(QualifiedName id, IMemento memento) throws CVSException {
- CVSTag start = new CVSTag(memento.getString(CTX_START_TAG), memento.getInteger(CTX_START_TAG_TYPE).intValue());
- CVSTag end = new CVSTag(memento.getString(CTX_END_TAG), memento.getInteger(CTX_END_TAG_TYPE).intValue());
-
- IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
- if(rootNodes == null || rootNodes.length == 0) {
- throw new CVSException(NLS.bind(CVSUIMessages.MergeSynchronizeParticipant_10, new String[] { id.toString() }));
- }
-
- List resources = new ArrayList();
- for (int i = 0; i < rootNodes.length; i++) {
- IMemento rootNode = rootNodes[i];
- IPath path = new Path(rootNode.getString(CTX_ROOT_PATH));
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
- if(resource != null) {
- resources.add(resource);
- } else {
- // log that a resource previously in the merge set is no longer in the workspace
- CVSProviderPlugin.log(IStatus.INFO, NLS.bind(CVSUIMessages.MergeSynchronizeParticipant_11, new String[] { path.toString() }), null);
- }
- }
- if(resources.isEmpty()) {
- throw new CVSException(NLS.bind(CVSUIMessages.MergeSynchronizeParticipant_12, new String[] { id.toString() }));
- }
- IResource[] roots = (IResource[]) resources.toArray(new IResource[resources.size()]);
- return new CVSMergeSubscriber(id, roots, start, end);
- }
-
- private void write(CVSMergeSubscriber s, IMemento memento) {
- // start and end tags
- CVSTag start = s.getStartTag();
- CVSTag end = s.getEndTag();
- memento.putString(CTX_START_TAG, start.getName());
- memento.putInteger(CTX_START_TAG_TYPE, start.getType());
- memento.putString(CTX_END_TAG, end.getName());
- memento.putInteger(CTX_END_TAG_TYPE, end.getType());
-
- // resource roots
- IResource[] roots = s.roots();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
- IMemento rootNode = memento.createChild(CTX_ROOT);
- rootNode.putString(CTX_ROOT_PATH, resource.getFullPath().toString());
- }
- }
-
- protected String getShortTaskName() {
- return CVSUIMessages.Participant_merging;
- }
-
- public void dispose() {
- if(TeamUI.getSynchronizeManager().get(getId(), getSecondaryId()) != null) {
- // If the participant is managed by the synchronize manager then we
- // we don't want to flush the synchronizer cache.
- ((MergeSubscriberContext)getContext()).setCancelSubscriber(false);
- }
- super.dispose();
- }
-
- protected ISynchronizationScopeManager createScopeManager(ResourceMapping[] mappings) {
- return new SubscriberScopeManager(subscriber.getName(),
- mappings, subscriber, true);
- }
-
- protected MergeContext restoreContext(ISynchronizationScopeManager manager) throws CoreException {
- return MergeSubscriberContext.createContext(manager, subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
- */
- public String getName() {
- return NLS.bind(CVSUIMessages.CompareParticipant_0, new String[] { ((CVSMergeSubscriber)getSubscriber()).getName(), Utils.getScopeDescription(getContext().getScope()) });
- }
-
- /*
- * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
- */
- public static ModelMergeParticipant getMatchingParticipant(ResourceMapping[] mappings, CVSTag startTag, CVSTag endTag) {
- ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference reference = refs[i];
- if (reference.getId().equals(ID)) {
- ModelMergeParticipant p;
- try {
- p = (ModelMergeParticipant) reference.getParticipant();
- } catch (TeamException e) {
- continue;
- }
- ISynchronizationScope scope = p.getContext().getScope().asInputScope();
- ResourceMapping[] roots = scope.getMappings();
- if (roots.length == mappings.length) {
- boolean match = true;
- for (int j = 0; j < mappings.length; j++) {
-
- ResourceMapping mapping = mappings[j];
- if (scope.getTraversals(mapping) == null) {
- // The mapping is not in the scope so the participants don't match
- match = false;
- break;
- }
- }
- if (match && p.getSubscriber().getStartTag().equals(startTag) && p.getSubscriber().getEndTag().equals(endTag)) {
- return p;
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelParticipantChangeSetCapability.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelParticipantChangeSetCapability.java
deleted file mode 100644
index 0eb6ddf01..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelParticipantChangeSetCapability.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public abstract class ModelParticipantChangeSetCapability extends ChangeSetCapability {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangeSetCapability#enableChangeSetsByDefault()
- */
- public boolean enableChangeSetsByDefault() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangeSetCapability#supportsCheckedInChangeSets()
- */
- public boolean supportsCheckedInChangeSets() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangeSetCapability#enableCheckedInChangeSetsFor(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- public boolean enableCheckedInChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return supportsCheckedInChangeSets() &&
- configuration.getMode() != ISynchronizePageConfiguration.OUTGOING_MODE;
- }
-
- public abstract CheckedInChangeSetCollector createCheckedInChangeSetCollector(ISynchronizePageConfiguration configuration);
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java
deleted file mode 100644
index 0a1bb9578..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.mapping.IMergeContext;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class ModelReplaceOperation extends ModelUpdateOperation {
-
- boolean hasPrompted = false;
-
- public ModelReplaceOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings, boolean consultModels) {
- super(part, selectedMappings, consultModels);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getJobName()
- */
- protected String getJobName() {
- return CVSUIMessages.ReplaceOperation_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#isAttemptHeadlessMerge()
- */
- protected boolean isAttemptHeadlessMerge() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#hasChangesOfInterest()
- */
- protected boolean hasChangesOfInterest() {
- IMergeContext context = (IMergeContext)getContext();
- return !context.getDiffTree().isEmpty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.mappings.ModelUpdateOperation#getMergeType()
- */
- protected int getMergeType() {
- return ISynchronizationContext.TWO_WAY;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#performMerge(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus performMerge(IProgressMonitor monitor) throws CoreException {
- if (!hasLocalChanges() || promptForOverwrite()) {
- return super.performMerge(monitor);
- }
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUEST_PREVIEW, "", null); //$NON-NLS-1$
- }
-
- /*
- * Mde porotected to be overriden by test cases.
- */
- protected boolean promptForOverwrite() {
- if (hasPrompted)
- return true;
- final int[] result = new int[] { 1 };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.ModelReplaceOperation_0, null, // accept
- // the
- // default
- // window
- // icon
- CVSUIMessages.ModelReplaceOperation_1,
- MessageDialog.QUESTION, new String[] { CVSUIMessages.ModelReplaceOperation_2, CVSUIMessages.ModelReplaceOperation_3,
- IDialogConstants.CANCEL_LABEL }, result[0]); // preview is the default
-
- result[0] = dialog.open();
-
- };
- });
- if (result[0] == 2)
- throw new OperationCanceledException();
- hasPrompted = true;
- return result[0] == 0;
- }
-
- private boolean hasLocalChanges() {
- return getContext().getDiffTree().hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new FastDiffFilter() {
- public boolean select(IDiff node) {
- if (node instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) node;
- int direction = twd.getDirection();
- if (direction == IThreeWayDiff.OUTGOING || direction == IThreeWayDiff.CONFLICTING) {
- return true;
- }
- } else {
- // Return true for any two-way change
- return true;
- }
- return false;
- }
- });
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelSynchronizeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelSynchronizeWizard.java
deleted file mode 100644
index 085706f60..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelSynchronizeWizard.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.CommitAction;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard;
-import org.eclipse.team.internal.ui.mapping.ModelElementSelectionPage;
-import org.eclipse.team.internal.ui.synchronize.GlobalRefreshElementSelectionPage;
-import org.eclipse.team.internal.ui.synchronize.GlobalRefreshResourceSelectionPage;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-
-public class ModelSynchronizeWizard extends ParticipantSynchronizeWizard {
-
- private GlobalRefreshElementSelectionPage selectionPage;
-
- private boolean isShowModelSync() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ParticipantSynchronizeWizard#createParticipant()
- */
- protected void createParticipant() {
- if (isShowModelSync()) {
- ISynchronizeParticipant participant = createParticipant(
- ((ModelElementSelectionPage)selectionPage).getSelectedMappings());
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
- // We don't know in which site to show progress because a participant could actually be shown in multiple sites.
- participant.run(null /* no site */);
- } else {
- IResource[] resources = ((GlobalRefreshResourceSelectionPage)selectionPage).getRootResources();
- if (resources != null && resources.length > 0) {
- SubscriberParticipant participant = createParticipant(((GlobalRefreshResourceSelectionPage)selectionPage).getSynchronizeScope());
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
- // We don't know in which site to show progress because a participant could actually be shown in multiple sites.
- participant.run(null /* no site */);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ParticipantSynchronizeWizard#createScopeSelectionPage()
- */
- protected final WizardPage createScopeSelectionPage() {
- if (isShowModelSync())
- selectionPage = new ModelElementSelectionPage(getRootResources());
- else
- selectionPage = new GlobalRefreshResourceSelectionPage(getRootResources());
- return selectionPage;
- }
-
- public static ISynchronizeParticipant createWorkspaceParticipant(ResourceMapping[] selectedMappings, Shell shell) {
- ISynchronizationScopeManager manager = WorkspaceSubscriberContext.createWorkspaceScopeManager(selectedMappings, true, CommitAction.isIncludeChangeSets(shell, CVSUIMessages.SyncAction_1));
- WorkspaceModelParticipant p = new WorkspaceModelParticipant(
- WorkspaceSubscriberContext.createContext(manager, ISynchronizationContext.THREE_WAY));
- return p;
- }
-
- public ModelSynchronizeWizard() {
- super();
- setNeedsProgressMonitor(isShowModelSync());
- }
-
- protected ISynchronizeParticipant createParticipant(ResourceMapping[] selectedMappings) {
- return createWorkspaceParticipant(selectedMappings, getShell());
- }
-
- protected SubscriberParticipant createParticipant(ISynchronizeScope scope) {
- // First check if there is an existing matching participant
- IResource[] roots = scope.getRoots();
- if (roots == null) {
- roots = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
- }
- WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, roots);
- // If there isn't, create one and add to the manager
- if (participant == null) {
- return new WorkspaceSynchronizeParticipant(scope);
- } else {
- return participant;
- }
- }
-
- protected String getPageTitle() {
- ISynchronizeParticipantDescriptor desc = TeamUI.getSynchronizeManager().getParticipantDescriptor(WorkspaceModelParticipant.ID);
- if(desc != null) {
- return desc.getName();
- } else {
- return CVSUIMessages.CVSSynchronizeWizard_0;
- }
- }
-
- protected IWizard getImportWizard() {
- return new CheckoutWizard();
- }
-
- protected IResource[] getRootResources() {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
deleted file mode 100644
index 5841698a0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.client.PruneFolderVisitor;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.core.mapping.CompoundResourceTraversal;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class ModelUpdateOperation extends AbstractModelMergeOperation {
-
- public ModelUpdateOperation(IWorkbenchPart targetPart, ResourceMapping[] selectedResourceMappings, boolean consultModels) {
- this(targetPart, WorkspaceSubscriberContext.createUpdateScopeManager(selectedResourceMappings, consultModels));
- }
-
- public ModelUpdateOperation(IWorkbenchPart targetPart, ResourceMapping[] resourceMappings) {
- this(targetPart, resourceMappings, true);
- }
-
- public ModelUpdateOperation(IWorkbenchPart targetPart, SubscriberScopeManager manager) {
- super(targetPart, manager, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getJobName()
- */
- protected String getJobName() {
- return CVSUIMessages.UpdateOperation_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingOperation#isPreviewRequested()
- */
- public boolean isPreviewRequested() {
- return super.isPreviewRequested() || !isAttemptHeadlessMerge();
- }
-
- protected boolean isAttemptHeadlessMerge() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_HANDLING).equals(ICVSUIConstants.PREF_UPDATE_HANDLING_PERFORM);
- }
-
- /**
- * Return the merge type associated with this operation.
- * @return the merge type associated with this operation
- */
- protected int getMergeType() {
- return ISynchronizationContext.THREE_WAY;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#createParticipant()
- */
- protected ModelSynchronizeParticipant createParticipant() {
- return new WorkspaceModelParticipant(createMergeContext());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelParticipantMergeOperation#createMergeContext()
- */
- protected SynchronizationContext createMergeContext() {
- return WorkspaceSubscriberContext.createContext(getScopeManager(), getMergeType());
- }
-
- protected void executeMerge(IProgressMonitor monitor) throws CoreException {
- super.executeMerge(monitor);
- // Prune any empty folders within the traversals
- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) {
- CompoundResourceTraversal ct = new CompoundResourceTraversal();
- ct.addTraversals(getContext().getScope().getTraversals());
- IResource[] roots = ct.getRoots();
- List cvsResources = new ArrayList();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
- if (resource.getProject().isAccessible()) {
- cvsResources.add(CVSWorkspaceRoot.getCVSResourceFor(roots[i]));
- }
- }
- new PruneFolderVisitor().visit(
- CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()),
- (ICVSResource[]) cvsResources.toArray(new ICVSResource[cvsResources.size()]));
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
deleted file mode 100644
index 07d6d443f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.mapping.CVSCheckedInChangeSet;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation.CompareTreeBuilder;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSChangeSetCollector;
-import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;
-import org.eclipse.team.internal.core.subscribers.ChangeSet;
-import org.eclipse.team.internal.core.subscribers.DiffChangeSet;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.mapping.ResourceModelParticipantAction;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.ui.PlatformUI;
-
-import com.ibm.icu.text.DateFormat;
-
-class OpenChangeSetAction extends ResourceModelParticipantAction {
-
- protected OpenChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(CVSUIMessages.OpenCommitSetAction_20, configuration);
- ISelection selection = configuration.getSite().getSelectionProvider().getSelection();
- if (selection != null)
- selectionChanged(selection);
- }
-
- private ChangeSet getChangeSet(IStructuredSelection selection) {
- // First, check to see if a change set is selected directly
- if (selection.size() == 1) {
- Object o = selection.getFirstElement();
- if (o instanceof IAdaptable) {
- ChangeSet set = (ChangeSet)((IAdaptable)o).getAdapter(ChangeSet.class);
- if (set != null)
- return set;
- }
- }
- // Failing that, check to see if all the selected elements and their children are in the same change set
- if (selection instanceof TreeSelection) {
- TreeSelection ts = (TreeSelection) selection;
- TreePath[] paths = ts.getPaths();
- if (paths.length > 0) {
- ChangeSet set = getChangeSet(paths[0]);
- if (set != null) {
- for (int i = 1; i < paths.length; i++) {
- TreePath path = paths[i];
- ChangeSet otherSet = getChangeSet(path);
- if (set != otherSet)
- return null;
- }
- }
- return set;
- }
- }
- return null;
- }
-
- private ChangeSet getChangeSet(TreePath treePath) {
- Object test = treePath.getFirstSegment();
- if (test instanceof ChangeSet) {
- ChangeSet cs = (ChangeSet) test;
- return cs;
- }
- return null;
- }
-
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- // The selection only contains appropriate files so
- // only enable if the selection is contained within a single change set
- ChangeSet set = getChangeSet(selection);
- return set != null;
- }
-
- public void openEditor(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IDiff[] diffs = getSelectedDiffs(monitor);
- if (diffs.length > 0) {
- ICVSRepositoryLocation location = getLocation(diffs[0]);
- if (location == null) {
- throw new CVSException(CVSUIMessages.OpenCommitSetAction_21);
- }
- CompareTreeBuilder builder = new CompareTreeBuilder(location, null, null);
- if (buildTrees(builder, diffs)) {
- builder.cacheContents(monitor);
- builder.openCompareEditor(getConfiguration().getSite().getPart().getSite().getPage(), getCompareTitle(), getCompareToolTip());
- }
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- private IDiff[] getSelectedDiffs(IProgressMonitor monitor) throws CoreException {
- ResourceTraversal[] traversals = getResourceTraversals(getStructuredSelection(), monitor);
- DiffChangeSet set = (DiffChangeSet)getChangeSet(getStructuredSelection());
- return set.getDiffTree().getDiffs(traversals);
- }
-
- /*
- * Build the trees that will be compared
- */
- private boolean buildTrees(CompareTreeBuilder builder, IDiff[] diffs) {
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- if (isFileChange(diff)) {
- IFileRevision remoteRevision = Utils.getRemote(diff);
- IResourceVariant remote = SyncInfoToDiffConverter.asResourceVariant(remoteRevision);
- if (remote == null) {
- IFileRevision predecessorRevision = Utils.getBase(diff);
- IResourceVariant predecessor = SyncInfoToDiffConverter.asResourceVariant(predecessorRevision);
- if (predecessor instanceof ICVSRemoteFile) {
- builder.addToTrees((ICVSRemoteFile)predecessor, null);
- }
- } else if (remote instanceof ICVSRemoteFile) {
- try {
- ICVSRemoteFile predecessor = getImmediatePredecessor(remote);
- builder.addToTrees(predecessor, (ICVSRemoteFile)remote);
- } catch (TeamException e) {
- Utils.handle(e);
- return false;
- }
- }
- }
- }
- return true;
- }
-
- private boolean isFileChange(IDiff diff) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource.getType() == IResource.FILE) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- return twd.getDirection() == IThreeWayDiff.INCOMING || twd.getDirection() == IThreeWayDiff.CONFLICTING;
- }
- return true;
- }
- return false;
- }
-
- private ICVSRepositoryLocation getLocation(IDiff diff) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject());
- if (provider instanceof CVSTeamProvider) {
- CVSTeamProvider ctp = (CVSTeamProvider) provider;
- try {
- return ctp.getCVSWorkspaceRoot().getRemoteLocation();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- return null;
- }
-
- private String getCompareTitle() {
- ChangeSet set = getChangeSet(getStructuredSelection());
- if (set instanceof CVSCheckedInChangeSet) {
- CVSCheckedInChangeSet cics = (CVSCheckedInChangeSet)set;
- String date = DateFormat.getDateTimeInstance().format(cics.getDate());
- return NLS.bind(CVSUIMessages.OpenChangeSetAction_0, new String[] {cics.getAuthor(), date});
- }
- return CVSUIMessages.OpenChangeSetAction_1;
- }
-
- private String getCompareToolTip() {
- ChangeSet set = getChangeSet(getStructuredSelection());
- if (set != null)
- return set.getName();
- return null;
- }
-
- private ICVSRemoteFile getImmediatePredecessor(IResourceVariant remote) throws TeamException {
- CheckedInChangeSetCollector changeSetCollector = getChangeSetCollector();
- if (changeSetCollector != null) {
- return changeSetCollector.getImmediatePredecessor((ICVSRemoteFile)remote);
- }
- return null;
- }
-
- private CheckedInChangeSetCollector getChangeSetCollector() {
- return (CheckedInChangeSetCollector)getConfiguration().getProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR);
- }
-
- public void run() {
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- openEditor(monitor);
- }
- });
- } catch (InvocationTargetException e) {
- Utils.handle(e);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java
deleted file mode 100644
index 4f5ac0b24..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.window.Window;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CommitSetDialog;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class WorkspaceChangeSetCapability extends ModelParticipantChangeSetCapability {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangeSetCapability#supportsActiveChangeSets()
- */
- public boolean supportsActiveChangeSets() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangeSetCapability#enableActiveChangeSetsFor(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return supportsActiveChangeSets() &&
- configuration.getMode() != ISynchronizePageConfiguration.INCOMING_MODE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangeSetCapability#createChangeSet(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.team.core.diff.IDiff[])
- */
- public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, IDiff[] infos) {
- ActiveChangeSet set = getActiveChangeSetManager().createSet(CVSUIMessages.WorkspaceChangeSetCapability_1, new IDiff[0]);
- CommitSetDialog dialog = new CommitSetDialog(configuration.getSite().getShell(), set, getResources(infos), CommitSetDialog.NEW);
- dialog.open();
- if (dialog.getReturnCode() != Window.OK) return null;
- set.add(infos);
- return set;
- }
-
- private IResource[] getResources(IDiff[] diffs) {
- Set result = new HashSet();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource != null)
- result.add(resource);
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#editChangeSet(org.eclipse.team.core.subscribers.ActiveChangeSet)
- */
- public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
- CommitSetDialog dialog = new CommitSetDialog(configuration.getSite().getShell(), set, set.getResources(), CommitSetDialog.EDIT);
- dialog.open();
- if (dialog.getReturnCode() != Window.OK) return;
- // Nothing to do here as the set was updated by the dialog
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#getActiveChangeSetManager()
- */
- public ActiveChangeSetManager getActiveChangeSetManager() {
- return CVSUIPlugin.getPlugin().getChangeSetManager();
- }
-
- public CheckedInChangeSetCollector createCheckedInChangeSetCollector(ISynchronizePageConfiguration configuration) {
- return new CheckedInChangeSetCollector(configuration, CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceCommitAction.java
deleted file mode 100644
index 0796c5bd1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceCommitAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.ICache;
-import org.eclipse.team.core.ICacheListener;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * A commit action that will commit all outgoing changes in the context.
- */
-public class WorkspaceCommitAction extends AbstractCommitAction implements IDiffChangeListener {
-
- /**
- * Create the action
- * @param configuration the synchronize page configuration
- */
- public WorkspaceCommitAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- setId(ICVSUIConstants.CMD_COMMIT_ALL);
- setActionDefinitionId(ICVSUIConstants.CMD_COMMIT_ALL);
- final IDiffTree tree = getDiffTree();
- tree.addDiffChangeListener(this);
- getSynchronizationContext().getCache().addCacheListener(new ICacheListener() {
- public void cacheDisposed(ICache cache) {
- tree.removeDiffChangeListener(WorkspaceCommitAction.this);
- }
- });
- updateEnablement();
-
- }
-
- protected String getBundleKeyPrefix() {
- return "WorkspaceToolbarCommitAction."; //$NON-NLS-1$
- }
-
- private IDiffTree getDiffTree() {
- ISynchronizationContext context = (ISynchronizationContext)getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT);
- IDiffTree tree = context.getDiffTree();
- return tree;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ModelProviderAction#isEnabledForSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- // Enablement has nothing to do with selection
- return isEnabled();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#diffChanged(org.eclipse.team.core.diff.IDiffChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- updateEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#propertyChanged(int, org.eclipse.core.runtime.IPath[])
- */
- public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
- // Do nothing
- }
-
- public void updateEnablement() {
- boolean enabled = (getDiffTree().countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK) > 0)
- && (getDiffTree().countFor(IThreeWayDiff.CONFLICTING, IThreeWayDiff.DIRECTION_MASK) == 0);
- setEnabled(enabled);
- }
-
- protected IResource[] getTargetResources() {
- return getSynchronizationContext().getScope().getRoots();
- }
-
- protected ResourceTraversal[] getCommitTraversals(IStructuredSelection selection, IProgressMonitor monitor)
- throws CoreException {
- return getSynchronizationContext().getScope().getTraversals();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java
deleted file mode 100644
index 57cb9edb8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.mapping.*;
-import org.eclipse.team.core.mapping.provider.MergeContext;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.*;
-import org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceSubscriberContext.ChangeSetSubscriberScopeManager;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSActionDelegateWrapper;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.mapping.MergeAllActionHandler;
-import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
-import org.eclipse.team.ui.mapping.SynchronizationActionProvider;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipantActionGroup;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
-
-public class WorkspaceModelParticipant extends
- CVSModelSynchronizeParticipant implements IChangeSetProvider {
-
- public static final String VIEWER_ID = "org.eclipse.team.cvs.ui.workspaceSynchronization"; //$NON-NLS-1$
-
- public static final String CONTEXT_MENU_UPDATE_GROUP_1 = "update"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_COMMIT_GROUP_1 = "commit"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_2 = "overrideActions"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_3 = "otherActions1"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_4 = "otherActions2"; //$NON-NLS-1$
-
- public static final String ID = "org.eclipse.team.cvs.ui.workspace-participant"; //$NON-NLS-1$
-
- private static final String CTX_CONSULT_CHANGE_SETS = "consultChangeSets"; //$NON-NLS-1$
-
- /**
- * CVS workspace action contribution
- */
- public class WorkspaceMergeActionGroup extends ModelSynchronizeParticipantActionGroup {
- private WorkspaceCommitAction commitToolbar;
-
- public void initialize(ISynchronizePageConfiguration configuration) {
- configuration.setProperty(MERGE_ALL_ACTION_ID, new MergeAllActionHandler(configuration) {
- protected String getJobName() {
- String name = getConfiguration().getParticipant().getName();
- return NLS.bind(CVSUIMessages.WorkspaceModelParticipant_0, Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, name));
- }
-
- protected boolean promptToUpdate() {
- final IResourceDiffTree tree = getMergeContext().getDiffTree();
- if (tree.isEmpty()) {
- return false;
- }
- final long count = tree.countFor(IThreeWayDiff.INCOMING, IThreeWayDiff.DIRECTION_MASK) + tree.countFor(IThreeWayDiff.CONFLICTING, IThreeWayDiff.DIRECTION_MASK);
- if (count == 0)
- return false;
- final boolean[] result = new boolean[] {true};
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- String sizeString = Long.toString(count);
- String message = tree.size() > 1 ? NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateSeveral, new String[] { sizeString }) : NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateOne, new String[] { sizeString }); //
- result[0] = MessageDialog.openQuestion(getConfiguration().getSite().getShell(), NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateTitle, new String[] { sizeString }), message);
-
- }
- });
- return result[0];
- }
- private IMergeContext getMergeContext() {
- return ((IMergeContext)getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT));
- }
- protected boolean needsToSaveDirtyEditors() {
- int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- return option != ICVSUIConstants.OPTION_NEVER;
- }
- protected boolean confirmSaveOfDirtyEditor() {
- int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- return option == ICVSUIConstants.OPTION_PROMPT;
- }
- });
- super.initialize(configuration);
-
- int modes = configuration.getSupportedModes();
- if ((modes & (ISynchronizePageConfiguration.OUTGOING_MODE | ISynchronizePageConfiguration.BOTH_MODE)) != 0) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_COMMIT_GROUP_1,
- new CommitAction(configuration));
-
- commitToolbar = new WorkspaceCommitAction(configuration);
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- MERGE_ACTION_GROUP,
- commitToolbar);
- // TODO: let's leave off override and commit for now
-// appendToGroup(
-// ISynchronizePageConfiguration.P_CONTEXT_MENU,
-// CONTEXT_MENU_CONTRIBUTION_GROUP_2,
-// new OverrideAndCommitAction(configuration));
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new IgnoreAction(), configuration));
- }
-
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CreatePatchAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new BranchAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new SetKeywordSubstitutionAction(), configuration));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.MergeActionGroup#configureMergeAction(java.lang.String, org.eclipse.jface.action.Action)
- */
- protected void configureMergeAction(String mergeActionId, Action action) {
- if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID) {
- Utils.initAction(action, "WorkspaceUpdateAction.", Policy.getActionBundle()); //$NON-NLS-1$
- action.setId(ICVSUIConstants.CMD_UPDATE);
- action.setActionDefinitionId(ICVSUIConstants.CMD_UPDATE);
- } else if (mergeActionId == SynchronizationActionProvider.OVERWRITE_ACTION_ID) {
- Utils.initAction(action, "OverrideAndUpdateAction.", Policy.getActionBundle()); //$NON-NLS-1$
- } else if (mergeActionId == SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID) {
- Utils.initAction(action, "ConfirmMergedAction.", Policy.getActionBundle()); //$NON-NLS-1$
- } else if (mergeActionId == MERGE_ALL_ACTION_ID) {
- Utils.initAction(action, "WorkspaceToolbarUpdateAction.", Policy.getActionBundle()); //$NON-NLS-1$
- action.setId(ICVSUIConstants.CMD_UPDATE_ALL);
- action.setActionDefinitionId(ICVSUIConstants.CMD_UPDATE_ALL);
- } else {
- super.configureMergeAction(mergeActionId, action);
- }
- }
-
- protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) {
- IContributionItem group = null;;
- if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID) {
- group = manager.find(CONTEXT_MENU_UPDATE_GROUP_1);
- } else if (mergeActionId == SynchronizationActionProvider.OVERWRITE_ACTION_ID) {
- group = manager.find(CONTEXT_MENU_CONTRIBUTION_GROUP_2);
- } else if (mergeActionId == SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID) {
- group = manager.find(CONTEXT_MENU_CONTRIBUTION_GROUP_2);
- } else {
- super.addToContextMenu(mergeActionId, action, manager);
- return;
- }
- if (group != null) {
- manager.appendToGroup(group.getId(), action);
- } else {
- manager.add(action);
- }
- }
- }
-
- private WorkspaceChangeSetCapability capability;
-
- private boolean isConsultChangeSets;
-
- public WorkspaceModelParticipant() {
- }
-
- public WorkspaceModelParticipant(SynchronizationContext context) {
- super(context);
- try {
- setInitializationData(TeamUI.getSynchronizeManager().getParticipantDescriptor("org.eclipse.team.cvs.ui.workspace-participant")); //$NON-NLS-1$
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
- }
- setSecondaryId(Long.toString(System.currentTimeMillis()));
- isConsultChangeSets = isConsultChangeSets(context.getScopeManager());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- configuration.setProperty(ISynchronizePageConfiguration.P_VIEWER_ID, VIEWER_ID);
- super.initializeConfiguration(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ResourceMappingSynchronizeParticipant#createMergeActionGroup()
- */
- protected ModelSynchronizeParticipantActionGroup createMergeActionGroup() {
- return new WorkspaceMergeActionGroup();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#restoreContext(org.eclipse.team.core.mapping.IResourceMappingScope, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected MergeContext restoreContext(ISynchronizationScopeManager manager) {
- return WorkspaceSubscriberContext.createContext(manager, ISynchronizationContext.THREE_WAY);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#createScopeManager(org.eclipse.core.resources.mapping.ResourceMapping[])
- */
- protected ISynchronizationScopeManager createScopeManager(ResourceMapping[] mappings) {
- return WorkspaceSubscriberContext.createWorkspaceScopeManager(mappings, true, isConsultChangeSets);
- }
-
- public ChangeSetCapability getChangeSetCapability() {
- if (capability == null) {
- capability = new WorkspaceChangeSetCapability();
- }
- return capability;
- }
-
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento.putString(CTX_CONSULT_CHANGE_SETS, Boolean.toString(isConsultChangeSets));
- }
-
- public void init(String secondaryId, IMemento memento) throws PartInitException {
- try {
- String consult = memento.getString(CTX_CONSULT_CHANGE_SETS);
- if (consult != null)
- isConsultChangeSets = Boolean.valueOf(consult).booleanValue();
- } finally {
- super.init(secondaryId, memento);
- }
- }
-
- private boolean isConsultChangeSets(ISynchronizationScopeManager manager) {
- if (manager instanceof ChangeSetSubscriberScopeManager) {
- ChangeSetSubscriberScopeManager man = (ChangeSetSubscriberScopeManager) manager;
- return man.isConsultSets();
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
deleted file mode 100644
index 68d8817b2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.mappings;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.diff.provider.DiffTree;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.*;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.PruneFolderVisitor;
-import org.eclipse.team.internal.ccvs.core.mapping.CVSActiveChangeSetCollector;
-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.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.core.mapping.GroupProgressMonitor;
-import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
-
-public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext {
-
- public static final class ChangeSetSubscriberScopeManager extends SubscriberScopeManager {
- private final boolean consultSets;
-
- private ChangeSetSubscriberScopeManager(String name, ResourceMapping[] mappings, Subscriber subscriber, boolean consultModels, boolean consultSets) {
- super(name, mappings, subscriber, consultModels);
- this.consultSets = consultSets;
- }
-
- protected ResourceTraversal[] adjustInputTraversals(ResourceTraversal[] traversals) {
- if (isConsultSets())
- return ((CVSActiveChangeSetCollector)CVSUIPlugin.getPlugin().getChangeSetManager()).adjustInputTraversals(traversals);
- return super.adjustInputTraversals(traversals);
- }
-
- public boolean isConsultSets() {
- return consultSets;
- }
- }
-
- private final int type;
-
- public static SubscriberScopeManager createWorkspaceScopeManager(ResourceMapping[] mappings, boolean consultModels, final boolean consultChangeSets) {
- return new ChangeSetSubscriberScopeManager(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().getName(), mappings, CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), consultModels, consultChangeSets);
- }
-
- public static SubscriberScopeManager createUpdateScopeManager(ResourceMapping[] mappings, boolean consultModels) {
- return new SubscriberScopeManager(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().getName(), mappings, CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), consultModels);
- }
-
- public static WorkspaceSubscriberContext createContext(ISynchronizationScopeManager manager, int type) {
- CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- WorkspaceSubscriberContext mergeContext = new WorkspaceSubscriberContext(subscriber, manager, type);
- mergeContext.initialize();
- return mergeContext;
- }
-
- protected WorkspaceSubscriberContext(CVSWorkspaceSubscriber subscriber, ISynchronizationScopeManager manager, int type) {
- super(subscriber, manager);
- this.type = type;
- }
-
- public void markAsMerged(IDiff[] nodes, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- if (getType() == TWO_WAY) {
- // For, TWO_WAY merges (i.e. replace) should not adjust sync info
- // but should remove the node from the tree so that other models do
- // not modify the file
- DiffTree tree = ((DiffTree)getDiffTree());
- try {
- tree.beginInput();
- for (int i = 0; i < nodes.length; i++) {
- IDiff diff = nodes[i];
- tree.remove(diff.getPath());
- }
- } finally {
- tree.endInput(monitor);
- }
- } else {
- super.markAsMerged(nodes, inSyncHint, monitor);
- }
- }
-
- public void markAsMerged(final IDiff diff, final boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Get the latest sync info for the file (i.e. not what is in the set).
- // We do this because the client may have modified the file since the
- // set was populated.
- IResource resource = getDiffTree().getResource(diff);
- if (resource.getType() != IResource.FILE) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (resource.getType() == IResource.FOLDER
- && twd.getKind() == IDiff.ADD
- && twd.getDirection() == IThreeWayDiff.INCOMING
- && resource.exists()) {
- // The folder was created by merge
- SyncInfo info = getSyncInfo(resource);
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
- cvsInfo.makeInSync();
- }
- }
- }
- return;
- }
- if (getType() == TWO_WAY) {
- // For, TWO_WAY merges (i.e. replace) should not adjust sync info
- // but should remove the node from the tree so that other models do
- // not modify the file
- ((DiffTree)getDiffTree()).remove(diff.getPath());
- } else {
- SyncInfo info = getSyncInfo(resource);
- ensureRemotesMatch(resource, diff, info);
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
- monitor.beginTask(null, 50 + (inSyncHint ? 100 : 0));
- cvsInfo.makeOutgoing(Policy.subMonitorFor(monitor, 50));
- if (inSyncHint) {
- // Compare the contents of the file with the remote
- // and make the file in-sync if they match
- ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- if (resource.getType() == IResource.FILE && info.getRemote() != null) {
- if (comparator.compareContents((IFile)resource, info.getRemote(), Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
- }
- }
- monitor.done();
- }
- }
- }
- }, getMergeRule(diff), IResource.NONE, monitor);
- }
-
- protected void makeInSync(final IDiff diff, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Get the latest sync info for the file (i.e. not what is in the set).
- // We do this because the client may have modified the file since the
- // set was populated.
- IResource resource = getDiffTree().getResource(diff);
- if (resource.getType() != IResource.FILE)
- return;
- SyncInfo info = getSyncInfo(resource);
- ensureRemotesMatch(resource, diff, info);
- IResourceVariant remote = info.getRemote();
- RemoteFile file = (RemoteFile)remote;
- if (file != null)
- remote = file.getCachedHandle();
-
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
- cvsInfo.makeOutgoing(monitor);
- if (resource.getType() == IResource.FILE && info.getRemote() != null) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- if (remote != null && remote instanceof RemoteFile){
- cvsFile.setExecutable(((RemoteFile)remote).isExecutable());
- cvsFile.setTimeStamp(((RemoteFile) remote).getTimeStamp());
- cvsFile.setReadOnly(getReadOnly(cvsFile));
- }
- cvsFile.checkedIn(null , false /* not a commit */);
- }
- }
- }
- }, getMergeRule(diff), IResource.NONE, monitor);
- }
-
- protected boolean getReadOnly(ICVSFile cvsFile) {
- IResource resource = cvsFile.getIResource();
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject());
- if (provider instanceof CVSTeamProvider) {
- CVSTeamProvider ctp = (CVSTeamProvider) provider;
- try {
- return ctp.isWatchEditEnabled();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- return false;
- }
-
- protected void ensureRemotesMatch(IResource resource, IDiff node, SyncInfo info) throws CVSException {
- IResourceVariant variant = info.getRemote();
- IFileRevision remote = getRemote(node);
- if (variant != null && remote != null && remote instanceof IFileRevision) {
- String ci1 = variant.getContentIdentifier();
- String ci2 = ((IFileRevision)remote).getContentIdentifier();
- if (!ci1.equals(ci2)) {
- throw new CVSException(NLS.bind(CVSUIMessages.WorkspaceSubscriberContext_0, resource.getFullPath().toString()));
- }
- }
- }
-
- private IFileRevision getRemote(IDiff node) {
- if (node == null) return null;
- if (node instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) node;
- return getRemote(twd.getRemoteChange());
- }
- if (node instanceof IResourceDiff) {
- IResourceDiff rd = (IResourceDiff) node;
- return rd.getAfterState();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.MergeContext#merge(org.eclipse.team.core.diff.IDiffNode, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus merge(IDiff delta, boolean force, IProgressMonitor monitor) throws CoreException {
- if (getMergeType() == ISynchronizationContext.TWO_WAY) {
- force = true;
- }
- // First, verify that the provided delta matches the current state
- // i.e. it is possible that a concurrent change has occurred
- IThreeWayDiff currentDiff = (IThreeWayDiff)getSubscriber().getDiff(getDiffTree().getResource(delta));
- if (currentDiff == null
- || currentDiff.getKind() == IDiff.NO_CHANGE
- || (currentDiff.getDirection() == IThreeWayDiff.OUTGOING && !force)) {
- // Seems like this one was already merged so return OK
- return Status.OK_STATUS;
- }
- if (!equals(currentDiff, (IThreeWayDiff)delta)) {
- throw new CVSException(NLS.bind(CVSUIMessages.CVSMergeContext_1, delta.getPath()));
- }
- try {
- monitor.beginTask(null, 100);
- IStatus status = super.merge(delta, force, Policy.subMonitorFor(monitor, 99));
- if (status.isOK()) {
- IResource resource = getDiffTree().getResource(delta);
- if (resource.getType() == IResource.FILE && !resource.exists()) {
- ICVSResource localResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- localResource.unmanage(Policy.subMonitorFor(monitor, 1));
- }
- pruneEmptyParents(new IDiff[] { delta });
- }
- return status;
- } finally {
- monitor.done();
- }
- }
-
- private boolean equals(IThreeWayDiff currentDiff, IThreeWayDiff otherDiff) {
- return currentDiff.getKind() == otherDiff.getKind()
- && currentDiff.getDirection() == otherDiff.getDirection();
- }
-
- private void pruneEmptyParents(IDiff[] deltas) throws CVSException {
- // TODO: A more explicit tie in to the pruning mechanism would be preferable.
- // i.e. I don't like referencing the option and visitor directly
- if (!CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) return;
- ICVSResource[] cvsResources = new ICVSResource[deltas.length];
- for (int i = 0; i < cvsResources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(getDiffTree().getResource(deltas[i]));
- }
- new PruneFolderVisitor().visit(
- CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()),
- cvsResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.provider.MergeContext#getMergeType()
- */
- public int getMergeType() {
- return type;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.SubscriberMergeContext#refresh(org.eclipse.core.resources.mapping.ResourceTraversal[], int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void refresh(final ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
- SubscriberDiffTreeEventHandler handler = getHandler();
- if (handler != null) {
- GroupProgressMonitor group = getGroup(monitor);
- if (group != null)
- handler.setProgressGroupHint(group.getGroup(), group.getTicks());
- handler.initializeIfNeeded();
- ((CVSWorkspaceSubscriber)getSubscriber()).refreshWithContentFetch(traversals, monitor);
- runInBackground(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- cacheContents(traversals, getDiffTree(), true, monitor);
- }
- });
- } else {
- super.refresh(traversals, flags, monitor);
- runInBackground(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- cacheContents(traversals, getDiffTree(), false, monitor);
- }
- });
- }
- }
-
- private SubscriberDiffTreeEventHandler getHandler() {
- Object o = getAdapter(SubscriberDiffTreeEventHandler.class);
- if (o instanceof SubscriberDiffTreeEventHandler) {
- return (SubscriberDiffTreeEventHandler) o;
- }
- return null;
- }
-
- private GroupProgressMonitor getGroup(IProgressMonitor monitor) {
- if (monitor instanceof GroupProgressMonitor) {
- return (GroupProgressMonitor) monitor;
- }
- if (monitor instanceof ProgressMonitorWrapper) {
- ProgressMonitorWrapper wrapper = (ProgressMonitorWrapper) monitor;
- return getGroup(wrapper.getWrappedProgressMonitor());
- }
- return null;
- }
-
- protected void cacheContents(final ResourceTraversal[] traversals, IResourceDiffTree tree, boolean baseOnly, IProgressMonitor monitor) throws CVSException {
- // cache the base and remote contents
- // TODO: Refreshing and caching now takes 3 round trips.
- // OPTIMIZE: remote state and contents could be obtained in 1
- // OPTIMIZE: Based could be avoided if we always cached base locally
- ResourceMapping[] mappings = new ResourceMapping[] { new ResourceMapping() {
- public Object getModelObject() {
- return WorkspaceSubscriberContext.this;
- }
- public IProject[] getProjects() {
- return ResourcesPlugin.getWorkspace().getRoot().getProjects();
- }
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- return traversals;
- }
- public boolean contains(ResourceMapping mapping) {
- return false;
- }
- public String getModelProviderId() {
- return ModelProvider.RESOURCE_MODEL_PROVIDER_ID;
- }
- }};
- try {
- monitor.beginTask(null, 50);
- new CacheBaseContentsOperation(null, mappings, tree, true).run(Policy.subMonitorFor(monitor, 25));
- if (!baseOnly) {
- new CacheRemoteContentsOperation(null, mappings, tree).run(Policy.subMonitorFor(monitor, 25));
- }
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore
- } finally {
- monitor.done();
- }
- }
-
- public IStatus merge(IDiff[] deltas, boolean force, IProgressMonitor monitor) throws CoreException {
- try {
- if (deltas.length == 0)
- return Status.OK_STATUS;
- String taskName = getMergeTaskName(deltas, force);
- monitor.beginTask(taskName, 100);
- monitor.setTaskName(taskName);
- cacheContents(getTraversals(deltas), getDiffTree(deltas), false, Policy.subMonitorFor(monitor, 30));
- return super.merge(deltas, force, Policy.subMonitorFor(monitor, 70));
- } finally {
- monitor.done();
- }
- }
-
- private String getMergeTaskName(IDiff[] deltas, boolean force) {
- if (force) {
- if (deltas.length == 1) {
- return NLS.bind(CVSUIMessages.WorkspaceSubscriberContext_1, getDiffTree().getResource(deltas[0]).getFullPath());
- }
- return NLS.bind(CVSUIMessages.WorkspaceSubscriberContext_2, new Integer(deltas.length));
- }
- if (deltas.length == 1) {
- return NLS.bind(CVSUIMessages.WorkspaceSubscriberContext_3, getDiffTree().getResource(deltas[0]).getFullPath());
- }
- return NLS.bind(CVSUIMessages.WorkspaceSubscriberContext_4, new Integer(deltas.length));
- }
-
- private ResourceTraversal[] getTraversals(IDiff[] deltas) {
- List result = new ArrayList();
- for (int i = 0; i < deltas.length; i++) {
- IDiff diff = deltas[i];
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource != null) {
- result.add(resource);
- }
- }
- return new ResourceTraversal[] {
- new ResourceTraversal((IResource[]) result.toArray(new IResource[result.size()]), IResource.DEPTH_ZERO, IResource.NONE)
- };
- }
-
- private IResourceDiffTree getDiffTree(IDiff[] deltas) {
- ResourceDiffTree tree = new ResourceDiffTree();
- for (int i = 0; i < deltas.length; i++) {
- IDiff diff = deltas[i];
- tree.add(diff);
- }
- return tree;
- }
-
- protected void performReplace(IDiff diff, IProgressMonitor monitor) throws CoreException {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource.getType() == IResource.FILE){
- IFile file = (IFile) resource;
- ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(file);
- try {
- // The file may have been set as read-only by a previous checkout/update
- if (mFile.isReadOnly()) mFile.setReadOnly(false);
- } catch (CVSException e) {
- // Just log and keep going
- CVSProviderPlugin.log(e);
- }
- }
- super.performReplace(diff, monitor);
-
- }
-} \ No newline at end of file
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 efa484c53..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ /dev/null
@@ -1,1196 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-# Maik Schreiber - bug 102461
-# Philippe Ombredanne - bug 84808
-###############################################################################
-PasswordManagementPreferencePage_2=When you create a CVS repository location you have the option of saving the password to disk. This page allows you to manage the stored passwords. The following CVS repository locations have saved passwords:
-PasswordManagementPreferencePage_3=Location
-PasswordManagementPreferencePage_4=Username
-PasswordManagementPreferencePage_5=&Remove
-PasswordManagementPreferencePage_6=Remove A&ll
-UserValidationDialog_5=CVS Repository:
-UserValidationDialog_6=&Save password
-UserValidationDialog_7=Saved passwords are stored on your computer in a file that is difficult, but not impossible, for an intruder to read.
-simpleInternal=Internal error
-internal=An internal error has occurred, consult the error log for details.
-yes=Yes
-no=No
-information=Server Information
-cvs=CVS
-notAvailable=Not Available
-buildError=A build error occurred after the CVS operation completed.
-ok=OK
-separator=/
-
-nameAndRevision={0} {1}
-currentRevision=*{0}
-
-AddAction_addFailed=Error occurred during Add
-AddAction_adding=Adding...
-AddAction_addIgnoredTitle=Add Ignored Resource?
-AddAction_addIgnoredQuestion=You have explicitly asked to version control one or more resources that otherwise would have been ignored. Continue?
-
-AddToVersionControlDialog_title=Add to CVS Version Control
-AddToVersionControlDialog_thereIsAnUnaddedResource=There is {0} resource that is not under CVS version control. Do you want to add it?
-AddToVersionControlDialog_thereAreUnaddedResources=There are {0} resources that are not under CVS version control. Do you want to add them?
-
-BranchWizard_title=Create a new CVS Branch
-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.
-BranchWizardPage_existingVersionsAndBranches=E&xisting Versions and Branches
-
-ConsolePreferencePage_consoleColorSettings=Console text color settings:
-ConsolePreferencePage_commandColor=&Command Line:
-ConsolePreferencePage_messageColor=&Message:
-ConsolePreferencePage_errorColor=E&rror:
-
-CVSAction_errorTitle=Errors occurred
-CVSAction_warningTitle=Warnings occurred
-CVSAction_multipleProblemsMessage=Multiple problems occurred:
-CVSAction_mixingTagsTitle=Confirm Mixing Tags
-CVSAction_mixingTags=You are mixing tags within a project. Beware that synchronization uses the tag information associated with each resource to determine the remote resource with which the local resource is compared. \n\nThis means that the part(s) of your project that you are replacing with another tag will be synchronized with the tag ''{0}'' while other resources in the project will be synchronized with another tag. \n\nDo you wish to continue?
-
-ShowAnnotationAction_noSyncInfo=Cannot display annotation for {0} because it does not have a remote revision.
-ShowAnnotationOperation_taskName=Fetching annotations from repository
-ShowAnnotationOperation_QDAnnotateTitle=Quick Diff Annotate
-ShowAnnotationOperation_QDAnnotateMessage=Do you wish to view annotations using quick diff?
-ShowAnnotationOperation_0=Error opening perspective
-ShowAnnotationOperation_1=Confirm Open Perspective
-ShowAnnotationOperation_2=The CVS Annotate View is associated with the {0} perspective. Do you want to open that perspective now?
-ShowAnnotationOperation_3=The CVS Annotate View is associated with the {0} perspective.\n\n{1}\n\nDo you want to open that perspective now?
-ShowAnnotationOperation_4=&Remember my decision
-NewLocationWizard_1=Confirm Open Perspective
-NewLocationWizard_2=CVS Repositories are associated with the {0} perspective. Do you want to open that perspective now?
-NewLocationWizard_3=CVS Repositories are associated with the {0} perspective.\n\n{1}\n\nDo you want to open that perspective now?
-NewLocationWizard_4=&Remember my decision
-
-
-CVSCompareEditorInput_branchLabel=<branch-{0}>
-CVSCompareEditorInput_headLabel=<HEAD>
-CVSCompareEditorInput_comparing=Comparing...
-CVSCompareEditorInput_different=Cannot compare resources of different kind.
-CVSCompareEditorInput_inBranch={0} in {1}
-CVSCompareEditorInput_inHead={0} in HEAD
-CVSCompareEditorInput_0=File is new
-CVSCompareEditorInput_1=File has been deleted
-CVSCompareEditorInput_repository=Repository: {0} {1}
-CVSCompareEditorInput_titleAncestor=Compare {0} {1}-{2} and {3}
-CVSCompareEditorInput_titleNoAncestor=Compare {0} {1} and {2}
-CVSCompareEditorInput_titleNoAncestorDifferent=Compare {0} {1} and {2} {3}
-
-CVSCompareRevisionsInput_compareResourceAndVersions=Revisions of ''{0}''
-CVSCompareRevisionsInput_repository=Repository file: {0}
-CVSCompareRevisionsInput_workspace=Workspace file: {0}
-CVSCompareRevisionsInput_truncate={0}[...]
-
-CVSDecoratorPreferencesPage_0=Select the &variables to add to the decoration format:
-CVSDecoratorPreferencesPage_1=Add Variables
-CVSDecoratorPreferencesPage_2=O&utgoing changes
-CVSDecoratorPreferencesPage_3=Re&mote resources
-CVSDecoratorPreferencesPage_4=Added &resources
-CVSDecoratorPreferencesPage_5=&New resources
-CVSDecoratorPreferencesPage_6=I&con Decorations
-CVSDecoratorPreferencesPage_7=File &Decoration:
-CVSDecoratorPreferencesPage_8=Add &Variables...
-CVSDecoratorPreferencesPage_9=F&older Decoration:
-CVSDecoratorPreferencesPage_10=Add Varia&bles...
-CVSDecoratorPreferencesPage_11=&Project Decoration:
-CVSDecoratorPreferencesPage_12=Add Variable&s...
-CVSDecoratorPreferencesPage_13=Ou&tgoing Change flag:
-CVSDecoratorPreferencesPage_14=Added f&lag:
-CVSDecoratorPreferencesPage_15=Te&xt Decorations
-CVSDecoratorPreferencesPage_16=C&ompute deep outgoing state for folders
-CVSDecoratorPreferencesPage_17=Disabling this will improve decorator performance.
-CVSDecoratorPreferencesPage_18=Enable &font and color decorations
-CVSDecoratorPreferencesPage_19=org.eclipse.ui.preferencePages.ColorsAndFonts
-CVSDecoratorPreferencesPage_20=See <a>''{0}''</a> to configure the font and color decorations.
-CVSDecoratorPreferencesPage_21=&General
-CVSDecoratorPreferencesPage_22=name of the resource being decorated
-CVSDecoratorPreferencesPage_23=the tag applied to the resource
-CVSDecoratorPreferencesPage_24=keyword substitution rule for the resource
-CVSDecoratorPreferencesPage_25=last revision loaded into workspace
-CVSDecoratorPreferencesPage_26=flag indicating that the file has outgoing changes
-CVSDecoratorPreferencesPage_27=flag indicating that the file has been added to the server
-CVSDecoratorPreferencesPage_28=name of the resource being decorated
-CVSDecoratorPreferencesPage_29=the tag applied to the resource (version, branch, or date). If it is HEAD the variable will be omitted.
-CVSDecoratorPreferencesPage_30=the repository location's hostname
-CVSDecoratorPreferencesPage_31=the connection method (e.g. pserver, ssh)
-CVSDecoratorPreferencesPage_32=user name for the connection
-CVSDecoratorPreferencesPage_33=repository home directory on server
-CVSDecoratorPreferencesPage_34=root relative directory. It will be omitted if the value is the same as the project name.
-CVSDecoratorPreferencesPage_35=flag indicating that the folder has a child resource with outgoing changes
-CVSDecoratorPreferencesPage_36=org.eclipse.ui.preferencePages.Decorators
-CVSDecoratorPreferencesPage_37=See <a>''{0}''</a> to enable CVS decorations.
-CVSDecoratorPreferencesPage_38=the repository label
-CVSDecoratorPreferencesPage_39=Previe&w:
-
-
-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_modified=Modified:
-CVSFilePropertiesPage_keywordMode=Keyword mode:
-CVSFilePropertiesPage_tag=Tag:
-CVSFilePropertiesPage_none=HEAD
-CVSFilePropertiesPage_version={0} (Version)
-CVSFilePropertiesPage_branch={0} (Branch)
-CVSFilePropertiesPage_date={0} (Date)
-CVSFilePropertiesPage_error=An error occurred while creating this page.
-
-CVSFolderPropertiesPage_ignored=The folder is ignored by CVS.
-CVSFolderPropertiesPage_notManaged=The folder is not managed by CVS.
-CVSFolderPropertiesPage_notCVSFolder=This folder has lost its CVS sharing information.
-CVSFolderPropertiesPage_root=Repository root:
-CVSFolderPropertiesPage_repository=Repository path:
-CVSFolderPropertiesPage_static=Static:
-CVSFolderPropertiesPage_disconnect=&Disconnect...
-CVSFolderPropertiesPage_disconnectTitle=Disconnect folder?
-CVSFolderPropertiesPage_disconnectQuestion=Disconnecting the folder from CVS control will delete the CVS synchronization information for the folder. Are you sure you want to disconnect?
-
-
-
-CVSPropertiesPage_connectionType=&Connection type:
-CVSPropertiesPage_user=&User:
-CVSPropertiesPage_password=&Password:
-CVSPropertiesPage_host=&Host:
-CVSPropertiesPage_port=Port:
-CVSPropertiesPage_path=Repository p&ath:
-CVSPropertiesPage_module=Module:
-CVSPropertiesPage_defaultPort=Default
-CVSPropertiesPage_tag=Tag:
-CVSPreferencesPage_0=0 (disabled)
-CVSPreferencesPage_1=1
-CVSPreferencesPage_2=2
-CVSPreferencesPage_3=3
-CVSPreferencesPage_4=4
-CVSPreferencesPage_5=5
-CVSPreferencesPage_6=6
-CVSPreferencesPage_7=7
-CVSPreferencesPage_8=8
-CVSPreferencesPage_9=9 (highest compression)
-CVSPreferencesPage_10=None
-CVSPreferencesPage_11=Yes
-CVSPreferencesPage_12=No
-CVSPreferencesPage_13=Prompt
-CVSPreferencesPage_14=&General
-CVSPreferencesPage_15=&Validate server version compatibility on first connection
-CVSPreferencesPage_16=Confirm &move tag on tag operation
-CVSPreferencesPage_17=D&isplay detailed protocol output to stdout (for debugging purposes)
-CVSPreferencesPage_18=R&efresh tags when comparing or replacing tags
-CVSPreferencesPage_19=&Connection
-CVSPreferencesPage_23=C&onnection timeout (s):
-CVSPreferencesPage_24=Timeout must be positive
-CVSPreferencesPage_25=The timeout must be a number
-CVSPreferencesPage_26=&Quietness level:
-CVSPreferencesPage_27=Verbose
-CVSPreferencesPage_28=Somewhat quiet
-CVSPreferencesPage_29=Very quiet
-CVSPreferencesPage_20=Maximum &number of files displayed when committing:
-CVSPreferencesPage_21=Maximum files displayed must be positive
-CVSPreferencesPage_22=Maximum files displayed must be a number
-CVSPreferencesPage_30='Very Quiet' mode is dangerous
-CVSPreferencesPage_31=In 'Very Quiet' mode, some cvs servers may not communicate important information about errors that have occurred. You may want to consider using 'Somewhat quiet' mode instead.
-CVSPreferencesPage_32=Compre&ssion:
-CVSPreferencesPage_33=&Files and Folders
-CVSPreferencesPage_34=&Treat all new files as binary
-CVSPreferencesPage_35=Con&vert text files to use platform line ending
-CVSPreferencesPage_36=P&rune empty directories
-CVSPreferencesPage_37=D&elete unmanaged resources on replace
-CVSPreferencesPage_38=Default te&xt mode:
-CVSPreferencesPage_39=&Prompting
-CVSPreferencesPage_40=A&llow empty commit comments
-CVSPreferencesPage_41=A&utomatically save dirty editors before CVS operations
-CVSPreferencesPage_42=&Open perspective after a 'Show Annotations' operation
-CVSPreferencesPage_43=D&efault perspective for 'Show Annotations':
-CVSPreferencesPage_44=Aut&omatically share projects containing CVS meta information
-CVSPreferencesPage_45=Use .project &project name instead of module name on check out
-CVSPreferencesPage_46=Consult change &sets when synchronizing or committing
-CVSPreferencesPage_47=Maximum number of comments on &history:
-CVSPreferencesPage_48=Maximum number of comments must be positive
-CVSPreferencesPage_49=Maximum number of comments must be a number
-CVSPreferencesPage_50=Commit resources with warnings
-CVSPreferencesPage_51=Commit resources with errors
-CVSPreferencesPage_52=org.eclipse.ui.net.NetPreferences
-CVSPreferencesPage_53=See <a>''{0}''</a> to configure Proxy support.
-CVSPreferencesPage_54=org.eclipse.jsch.ui.SSHPreferences
-CVSPreferencesPage_55=See <a>''{0}''</a> to configure SSH support.
-CVSPropertiesPage_virtualModule=<no corresponding remote folder>
-
-CVSProxyPreferencePage_enableProxy=&Enable proxy connection
-CVSProxyPreferencePage_proxyTpe=Proxy &type:
-CVSProxyPreferencePage_proxyHost=Proxy host add&ress:
-CVSProxyPreferencePage_proxyPort=Proxy host p&ort:
-CVSProxyPreferencePage_enableProxyAuth=E&nable proxy authentication
-CVSProxyPreferencePage_proxyUser=Proxy &user name:
-CVSProxyPreferencePage_proxyPass=Proxy pa&ssword:
-CVSProxyPreferencePage_proxyPortError=Port must be a number between 0 and 65535.
-
-CVSRemoteFilePropertySource_name=Name
-CVSRemoteFilePropertySource_revision=Revision
-CVSRemoteFilePropertySource_date=Date
-CVSRemoteFilePropertySource_author=Author
-CVSRemoteFilePropertySource_comment=Comment
-
-CVSRemoteFolderPropertySource_name=Name
-CVSRemoteFolderPropertySource_tag=Tag
-CVSRemoteFolderPropertySource_none=(none)
-
-CVSRepositoryLocationPropertySource_default=Default
-CVSRepositoryLocationPropertySource_host=Host
-CVSRepositoryLocationPropertySource_user=User
-CVSRepositoryLocationPropertySource_port=Port
-CVSRepositoryLocationPropertySource_root=Repository path
-CVSRepositoryLocationPropertySource_method=Connection method
-
-CVSParticipant_0=Remote File ({0} - {1})
-CVSParticipant_1=Common Ancestor ({0} - {1})
-CVSParticipant_2=C&VS
-
-CVSUIPlugin_refreshTitle=Refresh Resource?
-CVSUIPlugin_refreshQuestion={0} Would you like to refresh resource ''{1}''?
-CVSUIPlugin_refreshMultipleQuestion={0} Would you like to refresh the selected resources?
-
-CVSAction_disabledTitle=Information
-CVSAction_disabledMessage=The chosen operation is not enabled.
-CVSAction_doNotShowThisAgain=Do not show this again
-CVSAction_refreshTitle=Refresh Project?
-CVSAction_refreshQuestion={0} Would you like to refresh project ''{1}''?
-CVSAction_refreshMultipleQuestion={0} Would you like to refresh the projects of the selected resources?
-
-CommitAction_commitFailed=Problems encountered performing commit
-CommitWizardCommitPage_0=Commit
-CommitWizardCommitPage_2=Enter a comment for the commit operation.
-CommitWizardCommitPage_3=Please enter a commit comment.
-CommitWizardCommitPage_4=Conflicting changes cannot be committed. Either exclude them from the commit or use the synchronize view to resolve the conflicts.
-CommitWizardCommitPage_1=Hiding changes. The {0} changes exceeds the display threshold of {1}. It may take a long time to show this number of changes.
-CommitWizardCommitPage_5=Show &Changes
-CommitWizardFileTypePage_0=Add Resources
-CommitWizardFileTypePage_2=Unknown new files detected.
-CommitWizardFileTypePage_3=New files with the following unknown names or extensions have been detected in the workspace. Please specify whether these files should be stored as text or binary and whether this decision should be remembered.
-
-ConfigureRepositoryLocationsWizard_title=Specify Repository Information
-ConfigureRepositoryLocationsWizard_message=The project set only contains partial repository information. You may use the table below to specify the complete repository information for each repository in the project set or click OK to use the default repository location.
-ConfigureRepositoryLocationsWizard_createLocation=Create Location
-ConfigureRepositoryLocationsWizard_createLocationTooltip=Creates a new repository location
-ConfigureRepositoryLocationsWizard_column0=Project set repository information
-ConfigureRepositoryLocationsWizard_column1=Repository Location
-ConfigureRepositoryLocationsWizard_showConnection=Show connection method
-ConfigureRepositoryLocationsWizardDialog_finish=Create
-
-CommitSyncAction_questionRelease=You have changes that conflict with the server. Release those changes?
-CommitSyncAction_titleRelease=Confirm Overwrite
-CommitSyncAction_releaseAll=Release all changes, overriding any conflicting changes on the server.
-CommitSyncAction_releasePart=Only release the changes that don't conflict with changes on the server.
-CommitSyncAction_cancelRelease=Cancel the release operation.
-
-
-CompareWithRevisionAction_compare=Error Comparing with Revision
-CompareWithRevisionAction_fetching=Fetching revisions from repository...
-
-CompareWithTagAction_message=Compare With Branch or Version
-
-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 Commit wizard will open to allow you to commit your resources.
-RepositorySelectionPage_useExisting=&Use existing repository location:
-RepositorySelectionPage_useNew=&Create a new repository location
-
-ConfigurationWizardMainPage_connection=&Connection type:
-ConfigurationWizardMainPage_userName=&User:
-ConfigurationWizardMainPage_password=&Password:
-ConfigurationWizardMainPage_host=&Host:
-ConfigurationWizardMainPage_0=Location already exists.
-ConfigurationWizardMainPage_5=The host name must not start or end with a space
-ConfigurationWizardMainPage_6=The user name must not start or end with a space
-ConfigurationWizardMainPage_1=User Name Required
-ConfigurationWizardMainPage_2=Host Required
-ConfigurationWizardMainPage_3=Port Required
-ConfigurationWizardMainPage_4=Repository Path Required
-ConfigurationWizardMainPage_7=<a>Configure connection preferences...</a>
-ConfigurationWizardMainPage_8=You can also paste a full repository location into this field (e.g. :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse)
-ConfigurationWizardMainPage_useDefaultPort=Use default p&ort
-ConfigurationWizardMainPage_usePort=Use por&t:
-ConfigurationWizardMainPage_repositoryPath=&Repository path:
-ConfigurationWizardMainPage_invalidUserName=Invalid User Name
-ConfigurationWizardMainPage_invalidHostName=Invalid Host Name
-ConfigurationWizardMainPage_invalidPort=Invalid Port
-ConfigurationWizardMainPage_invalidPathWithSpaces=The repository path cannot have segments with leading or trailing spaces
-ConfigurationWizardMainPage_invalidPathWithSlashes=The repository path cannot contain a double slash (//)
-ConfigurationWizardMainPage_invalidPathWithTrailingSlash=The repository path cannot end with a slash (/)
-ConfigurationWizardMainPage_useNTFormat=Use NT path names for specifying CVSNT repository paths (e.g. C:\\cvs\\root)
-
-Console_resultServerError={0} {1}
-Console_resultException=failed due to an internal error {0}
-Console_resultAborted=operation canceled {0}
-Console_resultOk=ok {0}
-Console_resultTimeFormat='(took 'm:ss.SSS')'
-Console_couldNotFormatTime=An error occurred formatting the output time for the CVS console.
-Console_preExecutionDelimiter=***
-Console_postExecutionDelimiter=***
-Console_info=Info: {0}
-Console_warning=Warning: {0}
-Console_error=Error: {0}
-
-AddToBranchAction_enterTag=Enter Branch Tag
-AddToBranchAction_enterTagLong=Enter the name of the branch:
-
-GenerateCVSDiff_title=Create Patch
-GenerateCVSDiff_pageTitle=Create a Patch Using the CVS Diff Command
-GenerateCVSDiff_pageDescription=The results of the CVS diff command can be used as an input file for the Apply Patch wizard.
-GenerateCVSDiff_overwriteTitle=Confirm Overwrite
-GenerateCVSDiff_overwriteMsg=A file with that name already exists. Overwrite?
-GenerateCVSDiff_error=Error running the CVS diff command
-GenerateCVSDiff_working=Running CVS diff...
-GenerateCVSDiff_noDiffsFoundMsg=No differences found.
-GenerateCVSDiff_noDiffsFoundTitle=CVS diff
-GenerateCVSDiff_1=Read-only file
-GenerateCVSDiff_2=The specified file is read-only and cannot be overwritten.
-
-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:
-HistoryFilterDialog_toDate = &To date:
-
-HistoryView_getContentsAction=&Get Contents
-HistoryView_getRevisionAction=Get Sticky &Revision
-HistoryView_tagWithExistingAction=&Tag with Existing...
-HistoryView_copy=&Copy
-HistoryView_revision=Revision
-HistoryView_tags=Tags
-HistoryView_date=Date
-HistoryView_author=Author
-HistoryView_comment=Comment
-HistoryView_refreshLabel=&Refresh View
-HistoryView_refresh=Refresh View
-HistoryView_linkWithLabel=Link with Editor
-HistoryView_selectAll=Select &All
-HistoryView_showComment=Show &Comment Pane
-HistoryView_wrapComment=&Wrap Comments
-HistoryView_showTags=Show &Tag Pane
-HistoryView_overwriteTitle=Overwrite local changes?
-HistoryView_overwriteMsg=You have local changes. Do you want to overwrite them?
-HistoryView_fetchHistoryJob=Fetching CVS revision history
-HistoryView_errorFetchingEntries=Error fetching entries for {0}
-
-IgnoreAction_ignore=Error Ignoring Resource
-
-
-
-MergeWizard_title=Merge
-MergeWizard_0=Select the merge points
-MergeWizard_1=Specify the branch or version to be merged and the common base version.
-MergeWizardPage_0=Preview the merge in the &synchronize view
-MergeWizardPage_1=Perform the merge into the &local workspace
-MergeWizardPage_2=&Branch or version to be merged (end tag):
-MergeWizardPage_3=Br&owse...
-MergeWizardPage_4=Choose End Tag
-MergeWizardPage_5=&Select end tag
-MergeWizardPage_6=Common base &version (start tag):
-MergeWizardPage_7=Bro&wse...
-MergeWizardPage_8=Choose Start Tag
-MergeWizardPage_9=&Select start tag
-MergeWizardPage_10=The specified end tag is not known to exist. Either enter a different tag or refresh the known tags.
-MergeWizardPage_11=The specified start tag is not known to exist. Either enter a different tag or refresh the known tags.
-MergeWizardPage_12=The start and end tags cannot be the same.
-MergeWizardPage_13=A start tag is required for previewing a merge in the synchronize view.
-MergeWizardPage_14=&Merge non-conflicting changes and only preview conflicts
-MergeWizardEndPage_branches=Branches
-
-ModuleSelectionPage_moduleIsProject=Use &project name as module name
-ModuleSelectionPage_specifyModule=Use &specified module name:
-
-ModeWizardSelectionPage_10=Propo&se
-ModeWizardSelectionPage_11=Automatically propose a new mode for the file based\non its name and extension. This can be configured on the\nTeam > File Content preference page.
-ModeWizardSelectionPage_12=S&elect All
-ModeWizardSelectionPage_13=Select &None
-ModeWizardSelectionPage_14=Only sho&w those files that will be changed
-ModeWizardSelectionPage_15=C&lear
-ModeWizardSelectionPage_17={0} files will be changed
-ModeWizardSelectionPage_18=SelectionPage
-ModeWizardSelectionPage_19=ASCII/Binary Property
-ModeWizardSelectionPage_20=Configure the way CVS transfers your files.
-ModeWizardSelectionPage_21=Fil&ter files by name (? = any character, * = any string)
-ModeWizardSelectionPage_22=C&hange the ASCII/Binary property for the selected files
-ModeWizardSelectionPage_23=For information about the different CVS ASCII/Binary modes refer to your CVS documentation.
-ModeWizardSelectionPage_24=Enter a c&ommit comment
-ModeWizardSelectionPage_25={0} files selected
-
-MoveTagAction_title=Tag with Existing Tag
-MoveTagAction_message=&Select the tag to be moved
-
-NewLocationWizard_title=Add CVS Repository
-NewLocationWizard_heading=Add a new CVS Repository
-NewLocationWizard_description=Add a new CVS Repository to the CVS Repositories view
-NewLocationWizard_validationFailedText=Error validating location: "{0}"\n\nKeep location anyway?
-NewLocationWizard_validationFailedTitle=Unable to Validate
-NewLocationWizard_exception=Unable to create repository location
-
-AlternativeLocationWizard_title=Configure CVS Repository
-AlternativeLocationWizard_heading=Configure CVS Repository
-AlternativeLocationWizard_description=Configure the repository location from the project set
-AlternativeLocationWizard_validationFailedText=Error validating location: "{0}"\n\nUse location anyway?
-AlternativeLocationWizard_validationFailedTitle=Unable to Validate
-AlternativeLocationWizard_exception=Unable to create repository location
-
-AlternativeConfigurationWizardMainPage_0=Location already exists. Close this dialog and select the location from a combo box.
-
-OpenLogEntryAction_deletedTitle=Resource is Deleted
-OpenLogEntryAction_deleted=The selected revision represents a deletion. It cannot be opened.
-
-ReleaseCommentDialog_title=Commit
-ReleaseCommentDialog_unaddedResources=Checked resources will be &added to CVS version control.
-ReleaseCommentDialog_selectAll=&Select All
-ReleaseCommentDialog_deselectAll=D&eselect All
-
-RemoteFolderElement_nameAndTag={0} {1}
-RemoteFolderElement_fetchingRemoteChildren=Fetching remote CVS children for ''{0}''...
-
-
-ReplaceWithTagAction_message=Replace with Branch or Version
-ReplaceWithTagAction_replace=Error Replacing With Tag
-
-ReplaceWithRemoteAction_problemMessage=Error Replacing With Latest From Repository
-
-ReplaceWithAction_confirmOverwrite=Confirm Overwrite
-ReplaceWithAction_localChanges={0} has local changes which you are about to overwrite. Do you wish to overwrite?
-ReplaceWithAction_calculatingDirtyResources=Finding outgoing changes...
-
-ReplaceWithLatestAction_multipleTags=La&test from Repository
-ReplaceWithLatestAction_multipleVersions=&Versions from Repository
-ReplaceWithLatestAction_multipleBranches=La&test from Branches
-ReplaceWithLatestAction_singleVersion=&Version {0}
-ReplaceWithLatestRevisionAction_error=Error Replacing With BASE
-ReplaceWithLatestAction_singleBranch=La&test from Branch {0}
-ReplaceWithLatestAction_singleHEAD=La&test from {0}
-
-
-RepositoryManager_committing=Committing
-RepositoryManager_rename=An IO Exception occurred while renaming the state file
-RepositoryManager_save=An IO Exception occurred while saving the state file
-RepositoryManager_ioException=An IO Exception occurred while reading the state file
-RepositoryManager_parsingProblem=An error occurred parsing file ''{0}''.
-RepositoryManager_fetchingRemoteFolders=Fetching remote CVS folders for ''{0}''...
-
-RepositoriesView_refresh=&Refresh View
-RepositoriesView_refreshTooltip=Refresh View
-RepositoriesView_new=&Repository Location...
-RepositoriesView_newSubmenu=&New
-RepositoriesView_newAnonCVS=&Anonymous Repository Location to dev.eclipse.org...
-RepositoriesView_newWorkingSet=Select Working Set...
-RepositoriesView_deselectWorkingSet=Deselect Working Set
-RepositoriesView_editWorkingSet=Edit Active Working Set...
-RepositoriesView_workingSetMenuItem={0} {1}
-RepositoriesView_collapseAll=Collapse All
-RepositoriesView_collapseAllTooltip=Collapse All
-RepositoriesView_NItemsSelected={0} items selected
-RepositoriesView_OneItemSelected=1 item selected
-RepositoriesView_ResourceInRepository={0} in {1}
-RepositoriesSortingActionGroup_sortBy=Sort By
-RepositoriesSortingActionGroup_label=&Label
-RepositoriesSortingActionGroup_host=&Host
-RepositoriesSortingActionGroup_location=L&ocation
-RepositoriesSortingActionGroup_descending=D&escending
-RepositoriesView_CannotGetRevision=Cannot get revision
-RemoteViewPart_workingSetToolTip=Working Set: {0}
-
-ResourcePropertiesPage_status=Status
-ResourcePropertiesPage_notManaged=Not managed by CVS
-ResourcePropertiesPage_versioned=versioned
-ResourcePropertiesPage_notVersioned=not versioned
-#ResourcePropertiesPage.baseRevision=Base Revision
-#ResourcePropertiesPage.none=none
-ResourcePropertiesPage_error=Error
-
-
-
-
-
-
-
-
-SharingWizard_autoConnectTitle=Connect Project to Repository
-SharingWizard_autoConnectTitleDescription=Project is already configured with CVS repository information.
-SharingWizard_selectTagTitle=Select Tag
-SharingWizard_selectTag=&Select the tag to synchronize with:
-SharingWizard_importTitle=Share Project with CVS Repository
-SharingWizard_importTitleDescription=Select an existing repository location or create a new location.
-SharingWizard_title=Share Project
-SharingWizard_enterInformation=Enter Repository Location Information
-SharingWizard_enterInformationDescription=Define the location and protocol required to connect with an existing CVS repository.
-SharingWizard_enterModuleName=Enter Module Name
-SharingWizard_enterModuleNameDescription=Select the name of the module in the CVS repository.
-SharingWizard_validationFailedText={0}. Set project sharing anyway?
-SharingWizard_validationFailedTitle=Unable to Validate
-
-
-ShowHistoryAction_showHistory=Error occurred performing Show History
-
-SyncAction_noChangesTitle=No Changes
-SyncAction_noChangesMessage=There are no changes between the workspace resource and the remote.
-
-TagAction_tagErrorTitle=Tagging Error
-TagAction_tagWarningTitle=Tagging Warning
-TagAction_tagProblemsMessage=Problems reported tagging the resource.
-TagAction_tagProblemsMessageMultiple=Problems tagging the resources. {0} project(s) successfully tagged and {1} project(s) with errors.
-TagAction_tagResources=Tag Resources
-TagRefreshButtonArea_0=No Tags Found
-TagRefreshButtonArea_1=Perform &Deep Search
-TagRefreshButtonArea_2=Confi&gure Manually
-TagRefreshButtonArea_3=&Cancel
-TagRefreshButtonArea_4=Tags were not found for {0} using the auto-refresh files and a shallow cvs log operation. You can choose to search using a deep cvs log operation, to manually configure the tags or to cancel.
-TagRefreshButtonArea_5=Refreshing tags
-TagRefreshButtonArea_6=Refreshing tags...
-TagRefreshButtonArea_7=No tags could be found.
-TagAction_enterTag=&Please enter a version tag:
-TagAction_moveTag=&Move tag if it already exists
-TagRootElement_0=Dates
-TagLocalAction_0=The selected elements contain uncommitted changes. The unchanged server version will be tagged for those.
-TagLocalAction_2=Tag with Uncommitted Changes
-TagAction_moveTagConfirmTitle=Confirm Move Existing Tag
-TagAction_moveTagConfirmMessage=If the tag {0} is already used in this project, it will be moved to the selected revisions. Are you sure you want to perform the tag operation?
-TagAction_uncommittedChangesTitle=Confirm Uncommitted Changes
-TagAction_uncommittedChanges=You are tagging ''{0}'' that has uncommitted changes. These changes are not in the repository and will not be included in the version you are creating. Do you still want to tag this resource?
-TagAction_existingVersions=Existing Versions
-
-TagInRepositoryAction_tagProblemsMessage=Problems reported tagging the resource.
-TagInRepositoryAction_tagProblemsMessageMultiple=Problems tagging the resources. {0} resource(s) successfully tagged and {1} resource(s) with errors.
-
-UpdateAction_update=Problems encountered performing update
-UpdateAction_promptForUpdateSeveral=Are you sure you want to update {0} resources?
-UpdateAction_promptForUpdateOne=Are you sure you want to update {0} resource?
-UpdateAction_promptForUpdateTitle=Confirm Update
-
-UpdateWizard_title=Update
-UpdateWizard_0=Select Tag
-UpdateWizard_1=Select the tag for the update
-
-UserValidationDialog_required=Password Required
-UserValidationDialog_labelUser={0}
-UserValidationDialog_labelPassword={1}
-UserValidationDialog_password=&Password:
-UserValidationDialog_user=&User name:
-
-KeyboradInteractiveDialog_message=Keyboard Interactive authentication for {0}
-KeyboardInteractiveDialog_labelRepository=Enter values for the following repository: {0}
-
-VersionsElement_versions=Versions
-
-WorkbenchUserAuthenticator_cancelled=Operation canceled because login was canceled
-WorkbenchUserAuthenticator_1=Host Key Change
-WorkbenchUserAuthenticator_2=The host key for {0} has changed. It is possible that this was intentional but there is also a chance that you are the target of an attack of some kind. If you know that the host key has changed, click OK and existing host key will be purged. Otherwise, click Cancel and consult with your system administrator
-WorkbenchUserAuthenticator_0=Message for {1}\n\n{0}
-
-Unmanage_title=Confirm Disconnect from CVS
-Unmanage_titleN=Confirm Multiple Project Disconnect from CVS
-Unmanage_option1=Do not delete the CVS meta information (e.g. CVS sub-directories).
-Unmanage_option2=Also delete the CVS meta information from the file system.
-Unmanage_unmanagingError=Errors occurred while disconnecting
-
-Unmanage_message=Are you sure you want to disconnect CVS from ''{0}''?
-Unmanage_messageN=Are you sure you want to disconnect CVS from these {0} projects?
-
-Save_To_Clipboard_2=&Save to clipboard
-Save_In_File_System_3=Sa&ve in file system
-Browse____4=Br&owse...
-Save_Patch_As_5=Save Patch As
-patch_txt_6=patch.txt
-Save_In_Workspace_7=Save in &workspace
-Select_a_folder_then_type_in_the_file_name__8=Select a Fol&der in the Workspace and Type in the Patch Name
-Fi_le_name__9=Fi&le name:
-Diff_output_format_12=Diff Output Format
-Unified__format_required_by_Compare_With_Patch_feature__13=&Unified (format required by the Apply Patch wizard)
-Context_14=&Context
-Standard_15=&Standard
-Advanced_options_19=Advanced Options
-Configure_the_options_used_for_the_CVS_diff_command_20=Configure the options used for the CVS diff command.
-
-
-TagSelectionDialog_Select_a_Tag_1=&Select a branch or version
-TagSelectionDialog_recurseOption=Recurse into sub-&folders
-TagSelectionDialog_0=&Add Date...
-TagSelectionDialog_1=&Remove
-TagSelectionDialog_7=Refreshing tags
-TagSelectionDialog_8=Error refreshing tags
-
-TagSelectionArea_0=&Matching tags:
-TagSelectionArea_1={0}:
-TagSelectionArea_2={0} (? = any character, * = any String):
-TagSelectionArea_3=Select a &tag
-TagSelectionWizardPage_0=&Use the tag currently associated with the workspace resources
-TagSelectionWizardPage_1=&Select the tag from the following list
-
-
-ExtMethodPreferencePage_message=These variables define the external connection program to use with the \'ext\' connection method. These values should be the same as the \'ext\' CVS command-line environment variable settings.
-ExtMethodPreferencePage_CVS_RSH=CVS_R&SH:
-ExtMethodPreferencePage_Browse=&Browse...
-ExtMethodPreferencePage_0=Use an &external program to connect
-ExtMethodPreferencePage_2=Choosing to use another connection method allows the meta information in CVS projects to be compatible with external CVS tools while using a custom connection method.
-ExtMethodPreferencePage_1=Use another connection &method type to connect
-ExtMethodPreferencePage_Details=Select a program or script
-ExtMethodPreferencePage_CVS_RSH_Parameters=&Parameters:
-ExtMethodPreferencePage_CVS_SERVER__7=CVS_SER&VER:
-UpdateMergeActionProblems_merging_remote_resources_into_workspace_1=Problems merging remote resources into workspace
-
-TagConfigurationDialog_1=Configure Branches and Versions for {0}
-TagConfigurationDialog_5=&Browse files for tags:
-TagConfigurationDialog_6=&New tags found in the selected files:
-TagConfigurationDialog_7=Remembered &tags for these projects:
-TagConfigurationDialog_8=&Add Checked Tags
-TagConfigurationDialog_9=&Remove
-TagConfigurationDialog_0=Add &Date...
-TagConfigurationDialog_10=Re&move All
-TagConfigurationDialog_11=&List of files to be automatically examined when refreshing tags:
-TagConfigurationDialog_12=A&dd Selected Files
-TagConfigurationDialog_13=Rem&ove
-TagConfigurationDialog_14=Error fetching tags from remote CVS files
-TagConfigurationDialog_20=&Refresh Tags
-TagConfigurationDialog_21=&Configure Tags...
-TagConfigurationDialog_22=Updating Tags
-TagConfigurationDialog_AddDateTag=Add Date...
-
-ConfigureTagsFromRepoViewConfigure_Tag_Error_1=Configure Tag Error
-RemoteRootAction_label=Discard location
-RemoteLogOperation_0=Fetching log information from {0}
-RemoteLogOperation_1=Fetching log information
-RemoveDateTagAction_0=&Remove
-RemoteRootAction_Unable_to_Discard_Location_1=Unable to Discard Location
-RemoveRootAction_RepositoryRemovalDialogTitle=Confirm Discard
-RemoteRootAction_Projects_in_the_local_workspace_are_shared_with__2=Projects in the local workspace are shared with {0}. This location cannot be discarded until all local projects are disconnected from it.
-RemoteRootAction_The_projects_that_are_shared_with_the_above_repository_are__4=The projects that are shared with the above repository are:
-
-BranchCategory_Branches_1=Branches
-VersionCategory_Versions_1=Versions
-HistoryView_______4=[...]
-
-CVSProjectPropertiesPage_connectionType=Connection type:
-CVSProjectPropertiesPage_user=User:
-CVSProjectPropertiesPage_Select_a_Repository_1=Select a Repository
-CVSProjectPropertiesPage_Select_a_CVS_repository_location_to_share_the_project_with__2=Select a compatible CVS repository location to share the project with:
-CVSProjectPropertiesPage_Change_Sharing_5=&Change Sharing...
-CVSProjectPropertiesPage_fetchAbsentDirectoriesOnUpdate=&Fetch absent or new directories when updating
-CVSProjectPropertiesPage_configureForWatchEdit=&Enable watch/edit for this project
-CVSProjectPropertiesPage_progressTaskName=Updating project's CVS properties
-CVSProjectPropertiesPage_setReadOnly=Setting all files read-only
-CVSPreferencesPage_QuickDiffAnnotate=Use &Quick Diff annotate mode for local file annotations
-CVSProjectPropertiesPage_clearReadOnly=Setting all files writable
-CVSRepositoryPropertiesPage_Confirm_Project_Sharing_Changes_1=Confirm Project Sharing Changes
-CVSRepositoryPropertiesPage_There_are_projects_in_the_workspace_shared_with_this_repository_2=There are projects in the workspace shared with this repository. The projects will be updated with the new information that you have entered
-CVSRepositoryPropertiesPage_sharedProject=The projects that are shared with {0} are:
-CVSHistoryFilterDialog_showLocalRevisions=Show local revisions
-CVSHistoryTableProvider_currentVersion=<current version>
-CVSHistoryPage_CombinedModeTooltip=Local and Remote Revisions
-CVSHistoryPage_ValidateChangeTitle=Modify Contents
-CVSHistoryPage_CompareRevisionAction=Compare
-CVSHistoryPage_ValidateChangeMessage=The contents of {0} are about to be modified.
-CVSHistoryPage_CompareModeToggleAction=Compare Mode
-CVSHistoryPage_CompareModeTooltip=Compare Mode
-CVSHistoryPage_FilterHistoryTooltip=Filter History
-CVSRepositoryPropertiesPage_useLocationAsLabel=Use the &repository identification string as the label
-CVSRepositoryPropertiesPage_useCustomLabel=Use a custom &label:
-
-CVSProjectSetSerializer_Confirm_Overwrite_Project_8=Confirm Overwrite Project
-CVSProjectSetSerializer_The_project__0__already_exists__Do_you_wish_to_overwrite_it__9=The project {0} already exists. Do you wish to overwrite it?
-
-IgnoreResourcesDialog_dialogTitle=Add to .cvsignore
-IgnoreResourcesDialog_title=.cvsignore
-IgnoreResourcesDialog_messageSingle=You have chosen to ignore ''{0}''. Select what to add to the .cvsignore file.
-IgnoreResourcesDialog_messageMany=You have chosen to ignore {0} resources. Select what to add to the .cvsignore file(s).
-IgnoreResourcesDialog_filesWithSpaceWarningMessage=You want to ignore at least one filename which contains a space.
-IgnoreResourcesDialog_filesWithSpaceWarning=There is no direct way to add a filename with spaces to a .cvsignore file,\nbut you can use a pattern with ? as initially suggested. However, please be aware\nthat this could potentially ignore other files which matches the pattern.
-IgnoreResourcesDialog_filesWithNoExtensionWarningMessage=You want to ignore at least one with no extension. It's name will be used instead.
-IgnoreResourcesDialog_addNameEntryButton=&Resource(s) by name
-IgnoreResourcesDialog_addNameEntryExample=&Examples: file1.so, file2.so, .rcfile, bin
-IgnoreResourcesDialog_addExtensionEntryButton=&Wildcard extension
-IgnoreResourcesDialog_addExtensionEntryExample=E&xamples: *.so, *.rcfile, bin
-IgnoreResourcesDialog_addCustomEntryButton=&Custom pattern
-IgnoreResourcesDialog_addCustomEntryExample=&The wildcard characters '*' and '?' are permitted.
-IgnoreResourcesDialog_patternMustNotBeEmpty=Pattern must not be empty.
-IgnoreResourcesDialog_patternDoesNotMatchFile=Pattern does not match all selected resources: e.g. ''{0}''.
-
-
-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
-
-WorkingSetSelectionArea_workingSetOther=&Other...
-ListSelectionArea_selectAll=&Select All
-ListSelectionArea_deselectAll=&Deselect All
-
-RestoreFromRepositoryWizard_fileSelectionPageTitle=Restore from Repository
-RestoreFromRepositoryWizard_fileSelectionPageDescription=Select the revision of each file that should be restored.
-RestoreFromRepositoryFileSelectionPage_fileSelectionPaneTitle={0} - Select file to be restored:
-RestoreFromRepositoryFileSelectionPage_revisionSelectionPaneTitle={0} - Check revision to be restored:
-RestoreFromRepositoryFileSelectionPage_fileToRestore={0} ({1} to be restored)
-RestoreFromRepositoryFileSelectionPage_fileContentPaneTitle={0} {1} in ''{2}''
-RestoreFromRepositoryFileSelectionPage_emptyRevisionPane=Remote revisions of selected file:
-RestoreFromRepositoryFileSelectionPage_fileExists=File ''{0}'' already exists locally.
-RestoreFromRepositoryFileSelectionPage_revisionIsDeletion=Revision {0} of {1} is the deletion and can not be restored. Select another revision of this file.
-RestoreFromRepositoryAction_noFilesTitle=No Deleted Files Found
-RestoreFromRepositoryAction_noFilesMessage=There were no deleted files found on the repository in folder ''{0}''.
-
-RepositoryRoot_folderInfoMissing=Local folder ''{0}'' is not properly mapped to a remote folder.
-
-RepositoriesViewContentHandler_unmatchedTag=No matching end tag found for tag ''{0}'' while reading repositories View configuration file.
-RepositoriesViewContentHandler_missingAttribute=Required attribute ''{1}'' missing from tag ''{0}'' while reading repositories View configuration file.
-RepositoriesViewContentHandler_errorCreatingRoot=An error occurred trying to create repository ''{0}''.
-
-
-
-
-WatchEditPreferencePage_description=Settings for CVS Watch/Edit.
-WatchEditPreferencePage_checkoutReadOnly=&Configure projects to use Watch/Edit on checkout
-WatchEditPreferencePage_validateEditSaveAction=When read-only files are modified in an editor
-WatchEditPreferencePage_edit=Send a CVS &edit notification to the server
-WatchEditPreferencePage_0=Enable temporary &watches on edit
-WatchEditPreferencePage_editInBackground=Send a CVS edit notification to the server in the &background
-WatchEditPreferencePage_highjack=Edit the file &without informing the server
-WatchEditPreferencePage_editPrompt=Before a CVS edit notification is sent to the server
-WatchEditPreferencePage_neverPrompt=&Never prompt
-WatchEditPreferencePage_alwaysPrompt=Always &prompt
-WatchEditPreferencePage_onlyPrompt=&Only prompt if there are other editors
-WatchEditPreferencePage_updatePrompt=Update edited files
-WatchEditPreferencePage_autoUpdate=Always &update before editing
-WatchEditPreferencePage_promptUpdate=Prompt to update if out of &date
-WatchEditPreferencePage_neverUpdate=Ne&ver update
-
-Uneditaction_confirmMessage=Overwrite local changes to edited files?
-Uneditaction_confirmTitle=Confirm Unedit
-
-FileModificationValidator_vetoMessage=User vetoed file modification
-
-RefreshRemoteProjectWizard_title=Refresh Branches
-RefreshRemoteProjectWizard_0=Tags not found for some modules
-RefreshRemoteProjectWizard_1=Search Deeply
-RefreshRemoteProjectWizard_2=Skip
-RefreshRemoteProjectWizard_3=Tags were not found on module {0} using the auto-refresh files and a shallow cvs log operation. You can choose to search this module using a deep cvs log operation or skip it.
-RefreshRemoteProjectWizard_4=Tags were not found on {0} modules using the auto-refresh files and a shallow cvs log operation. You can choose to search these module using a deep cvs log operation or skip them.
-RefreshRemoteProjectSelectionPage_pageTitle=Select Projects
-RefreshRemoteProjectSelectionPage_pageDescription=Select the remote projects whose tags should be refreshed.
-RefreshRemoteProjectSelectionPage_selectRemoteProjects=This wizard helps discover the tags associated with one or more remote projects. &Check the projects whose tags you wish to refresh.
-RefreshRemoteProjectSelectionPage_noWorkingSet=Do not &use a working set
-RefreshRemoteProjectSelectionPage_workingSet=Select a &working set (matching projects will be checked):
-
-EditorsView_file=File name
-EditorsView_user=User name
-EditorsView_date=Date
-EditorsView_computer=Computer name
-
-EditorsDialog_title=Editors
-EditorsDialog_question=The resource already has editors. Do you still want to edit the resource and send a CVS edit notification to server?
-EditorsAction_classNotInitialized={0} not initialized
-
-
-RemoteFileEditorInput_fullPathAndRevision={0} {1}
-
-CheckoutOperation_thisResourceExists=The resource ''{0}'' already exists in the workspace and will be deleted. Proceed with the check out of ''{1}''?
-CheckoutOperation_thisExternalFileExists=The folder ''{0}'' exists in the local file system and will be deleted. Proceed with the check out of ''{1}''?
-CheckoutOperation_confirmOverwrite=Confirm Overwrite
-CheckoutOperation_scrubbingProject=Scrubbing project ''{0}''.
-CheckoutOperation_refreshingProject=Configuring project ''{0}''.
-
-CheckoutSingleProjectOperation_taskname=Checking out ''{0}'' from CVS
-CheckoutMultipleProjectsOperation_taskName=Checking out {0} folders from CVS
-
-CheckoutIntoOperation_taskname=Checking out {0} folders from CVS into ''{1}''
-CheckoutIntoOperation_targetIsFile=Folder ''{0}'' cannot be checked out because file ''{1}'' is in the way.
-CheckoutIntoOperation_targetIsFolder=Folder ''{0}'' cannot be checked out because folder ''{1}'' is in the way.
-CheckoutIntoOperation_targetIsPrunedFolder=Folder ''{0}'' cannot be checked out because it conflicts with the pruned folder ''{1}''.
-CheckoutIntoOperation_mappingAlreadyExists=Cannot checkout remote folder ''{0}'' into ''{1}'' because local folder ''{2}'' is already mapped to remote folder ''{0}''.
-CheckoutIntoOperation_cancelled=Checkout of ''{1}'' canceled by user.
-CheckoutIntoOperation_overwriteMessage=Folder ''{0}'' already exists and will be deleted. Continue?
-
-
-
-
-CheckoutAsWizard_title=Check Out As
-CheckoutAsWizard_error=Problems encountered performing checkout
-CheckoutAsMainPage_title=Check Out As
-CheckoutAsMainPage_Browse=B&rowse...
-CheckoutAsMainPage_description=Select the method of check out
-CheckoutAsMainPage_singleFolder=Choose how to check out folder ''{0}''
-CheckoutAsMainPage_asConfiguredProject=Check out as a project &configured using the New Project Wizard
-CheckoutAsMainPage_WorkingSetMultiple=&Add projects to a working set
-CheckoutAsMainPage_EmptyWorkingSetErrorMessage=No name in the Working Set field
-CheckoutAsMainPage_asSimpleProject=Check out as a &project in the workspace
-CheckoutAsMainPage_projectNameLabel=&Project Name:
-CheckoutAsMainPage_WorkingSetSingle=&Add project to a working set
-CheckoutAsMainPage_multipleFolders=Choose how to check out the {0} folders
-CheckoutAsMainPage_asProjects=Check out into the &workspace as projects
-CheckoutAsMainPage_intoProject=Check out &into an existing project
-
-CheckoutAsLocationSelectionPage_title=Check Out As
-CheckoutAsLocationSelectionPage_description=Select the project location
-CheckoutAsLocationSelectionPage_useDefaultLabel=Use default &workspace location
-CheckoutAsLocationSelectionPage_locationLabel=&Location:
-CheckoutAsLocationSelectionPage_parentDirectoryLabel=&Directory:
-CheckoutAsLocationSelectionPage_browseLabel=&Browse...
-CheckoutAsLocationSelectionPage_locationEmpty=Project contents directory must be specified.
-CheckoutAsLocationSelectionPage_invalidLocation=Invalid location path.
-CheckoutAsLocationSelectionPage_messageForSingle=Select the parent directory for project {0}.
-CheckoutAsLocationSelectionPage_messageForMulti=Select the parent directory for the {0} projects.
-CheckoutAsMainPage_WorkingSetExistsErrorMessage=A non-Resource Working Set already exists with the same name
-
-CheckoutAsProjectSelectionPage_title=Check Out Into
-CheckoutAsProjectSelectionPage_description=Select the local folder that is the target of the checkout operation.
-CheckoutAsProjectSelectionPage_name=Target folder &name:
-CheckoutAsProjectSelectionPage_treeLabel=&Parent of target folder:
-CheckoutAsProjectSelectionPage_showLabel=&Filter project list:
-CheckoutAsProjectSelectionPage_recurse=&Checkout subfolders
-CheckoutAsProjectSelectionPage_showAll=Show all valid target projects
-CheckoutAsProjectSelectionPage_showUnshared=Show unshared projects
-CheckoutAsProjectSelectionPage_showSameRepo=Show projects shared with the same repository
-CheckoutAsProjectSelectionPage_invalidFolderName=''{0}'' is not a valid folder name
-
-
-WorkspaceChangeSetCapability_1=New Set
-OpenCommitSetAction_20=Open Change in Compare Editor
-OpenCommitSetAction_21=Could not determine the repository location of the selected resources
-OpenChangeSetAction_0=[{0}] ({1})
-OpenChangeSetAction_1=CVS Change
-WorkspaceChangeSetCapability_2=New Change Set
-WorkspaceChangeSetCapability_3=Enter the name and comment for the new change set
-CVSChangeSetCollector_4=Retrieving revision histories
-CVSChangeSetCollector_0=Unassigned Remote Changes
-WorkspaceChangeSetCapability_7=Edit Change Set Comment
-WorkspaceChangeSetCapability_8=Edit the name and comment for the change set
-WorkspaceChangeSetCapability_9=A change set with that name already exists
-WorkspaceSubscriberContext_0=Could not update the meta-data for file {0} due to inconsistent internal state.
-WorkspaceSubscriberContext_1=Overwriting {0}
-WorkspaceSubscriberContext_2=Overwriting {0} resources
-WorkspaceSubscriberContext_3=Updating {0}
-WorkspaceSubscriberContext_4=Updating {0} resources
-WorkspaceTraversalAction_0=Looking for uncommitted changes
-WorkspaceModelParticipant_0=Updating all changes in {0}
-
-
-ProjectMetaFile_taskName=Looking for a remote meta file
-TagFromWorkspace_taskName=Tagging from workspace
-TagFromRepository_taskName=Tagging from repository
-UpdateOnlyMergeable_taskName=Updating mergeable changes
-UpdateDialog_overwriteTitle=Overwrite Local Changes?
-UpdateMergePreferencePage_0=&Never preview and use CVS text markup to indicate conflicts
-UpdateMergePreferencePage_1=When an update preview is required
-UpdateMergePreferencePage_2=Preview updates in a &dialog
-UpdateMergePreferencePage_3=Preview updates in the &Synchronize view
-UpdateDialog_overwriteMessage=Do you want to overwrite local changes?
-ReplaceOperation_taskName=CVS Replace
-UpdateOperation_taskName=CVS Update
-
-SafeUpdateAction_warnFilesWithConflictsTitle=Non-mergeable files
-SafeUpdateAction_warnFilesWithConflictsDescription=Some conflicting files cannot be merged automatically with the update action. They contain conflicting changes that will have to be merged manually. Use the Synchronize View to find the conflicts then merge the changes in a compare editor.
-
-ShowAnnotationAction_2=Annotate Binary File?
-ShowAnnotationAction_3=File {0} is marked as a binary file. The CVS annotation operation only works properly for files that contain text. Do you wish to continue?
-
-UpdateAction_jobName=CVS Update
-MergeUpdateAction_jobName=CVS Merge
-MergeUpdateAction_invalidSubscriber=Invalid subscriber: {0}
-CommitAction_jobName=CVS Commit
-CommitAction_0=Preparing to Commit
-CommitAction_3=An inconsistency in the selection state of the Synchronize view was detected. Please try committing again.
-CommitAction_1=Consult Change Sets
-CommitAction_2=Should change sets be consulted in order to determine which resources should be included in the commit?
-
-CommitCommentArea_0=<Click here to enter a commit comment>
-CommitCommentArea_1=<Choose a previously entered comment>
-CommitCommentArea_10=Select &All
-CommitCommentArea_2=Empty commit comment
-CommitCommentArea_3=The commit comment is empty. Are you sure you would like to continue with an empty comment?
-CommitCommentArea_4=Re&member decision?
-CommitCommentArea_5=Configure Comment Templates...
-CommitCommentArea_6=Template
-CommitCommentArea_7=C&ut
-CommitCommentArea_8=&Copy
-CommitCommentArea_9=&Paste
-
-CheckoutProjectOperation_8=Checking out ''{0}'' into project ''{1}''
-CheckoutProjectOperation_9=Checking out ''{0}'' into {1} projects
-CheckoutProjectOperation_0=Checkout of remote folder {0} canceled by user
-CheckoutProjectOperation_1=An error occurred checking out {0}: {1}
-ChangeSetContentProvider_0=<Unassigned>
-CVSOperation_0=Errors occurred in {0} of {1} operations.
-CVSOperation_1=Show CVS Console
-CVSOperation_2=Show CVS Console
-CVSModelElement_0=Error
-CVSModelElement_1=Error fetching resource list from repository.
-CVSMergeContext_0=Determining remote changes
-CVSMergeContext_1=The state of {0} has been changed concurrently.
-CVSMergeContext_2=Refreshing remote changes
-CVSDecorator_exceptionMessage=Errors occurred while applying CVS decorations to resources.
-CVSDecoratorConfiguration_0=>
-CVSDecoratorConfiguration_1=*
-CVSDecoratorConfiguration_2={outgoing_change_flag}{name} {revision} {tag} ({keyword})
-CVSDecoratorConfiguration_3={outgoing_change_flag}{name} {tag}
-CVSDecoratorConfiguration_4={outgoing_change_flag}{name} {tag} [{host}]
-FetchMembersOperation_0=Fetching members of {0}
-FetchAllMembersOperation_0=Fetching Members
-
-RemoteRevisionQuickDiffProvider_readingFile=Error reading remote file
-RemoteRevisionQuickDiffProvider_closingFile=Error closing remote file
-RemoteRevisionQuickDiffProvider_fetchingFile=CVS QuickDiff: fetching remote contents
-RemoteCompareOperation_0=Comparing tags {0} and {1} of {2}
-RefreshDirtyStateOperation_0=Problems encountered cleaning timestamps
-RefreshDirtyStateOperation_1=CVS Clean Timestamps
-IgnoreAction_0=Ignoring selected resources for project {0}
-IgnoreAction_1=Ignoring Resources
-GenerateDiffFileOperation_0=The file could not be written. Possible reasons are the directory is write-protected or not enough disk space is available.
-GenerateDiffFileOperation_1=The file could not be written due to an I/O error.
-GenerateDiffFileOperation_2=An I/O error occurred.
-GenerateDiffFileWizard_0=Please enter a valid location.
-GenerateDiffFileWizard_2=Please enter a file name.
-GenerateDiffFileWizard_3=The specified directory does not exist.
-GenerateDiffFileWizard_4=Please select a location in the workspace by browsing.
-GenerateDiffFileWizard_5=Please enter a valid filename.
-GenerateDiffFileWizard_6=&Workspace (Multi-project Apply Patch wizard specific)
-GenerateDiffFileWizard_7=&Project
-GenerateDiffFileWizard_8=S&election
-GenerateDiffFileWizard_9=Save Patch in Workspace
-GenerateDiffFileWizard_10=Patch Root
-GenerateDiffFileWizard_11=Include Binary Files?
-GenerateDiffFileWizard_12=The selected resources include files marked as binary. CVS does not handle the creation of patches for binary files. Should the files marked as binary be included?
-GenerateDiffFileWizard_File_multisegments=File name cannot contain multiple segments
-GenerateDiffFileWizard_SelectAll=Select &All
-GenerateDiffFileWizard_DeselectAll=&Deselect All
-
-MergeSynchronizeParticipant_8=Missing id initializing cvs merge participant
-MergeSynchronizeParticipant_9=Unable to initialize cvs merge subscriber
-MergeSynchronizeParticipant_10=Could not restore CVS Merge in Synchronize view: {0}
-MergeSynchronizeParticipant_11=Root resource in cvs merge subscriber is no longer in workspace, ignoring: {0}
-MergeSynchronizeParticipant_12=Missing root resources for cvs merge subscriber: {0}
-DisconnectOperation_0=Disconnecting
-DisconnectOperation_1=Disconnecting {0}
-SubscriberConfirmMergedAction_0=Synchronization information is missing for resource {0}
-SubscriberConfirmMergedAction_jobName=Performing a CVS Mark as Merged operation on {0} resources.
-CVSSubscriberAction_0=Invalid attempt to make unsupervised resource {0} in-sync.
-ReconcileProjectOperation_0=Reconciling project {0} with remote folder {1}
-CheckoutToRemoteFolderOperation_0=Downloading folder {0}
-CVSRepositoryPropertiesPage_0=Confirm Host or Path Change
-CVSRepositoryPropertiesPage_1=You have chosen to change the host name or repository root path for this location. You should ensure that this new information still identifies the same repository.
-CompareRevertAction_0=Reverting {0} resources
-CompareParticipant_0={0} ({1})
-
-ComparePreferencePage_0=Options for CVS comparisons:
-ComparePreferencePage_1=Show the &file author in compare editors
-ComparePreferencePage_2=Automatically enable chan&ge set grouping in CVS synchronizations
-ComparePreferencePage_3=Show revision &comparisons in a dialog
-ComparePreferencePage_4=Con&sider file contents in comparisons
-ComparePreferencePage_6=See <a>''{0}''</a> for compare editor preferences.
-ComparePreferencePage_7=Allow &models (e.g. Java) to participate in synchronizations
-ComparePreferencePage_8=&Open a compare editor when comparing a single file
-
-FileModificationValidator_3=Perform Edit?
-FileModificationValidator_4=A CVS edit notification is required to be sent to the server in order to allow editing of one or more selected files. Continue?
-FileModificationValidator_5=Perform Update?
-FileModificationValidator_6=Some of the files being edited have been modified on the server. Would you like to update before continuing?
-CVSSynchronizeWizard_0=Unknown
-Participant_comparing=Comparing
-Participant_merging=Merging
-
-
-CompareWithRevisionAction_4=Compare With Revision
-ReplaceWithRevisionAction_0=Replace {0}
-ReplaceWithRevisionAction_1=Replace With Revision
-
-ConsolePreferencesPage_4=&Show CVS console automatically when command is run
-ConsolePreferencesPage_5=&Limit console output
-ConsolePreferencesPage_6=&Fixed width console
-ConsolePreferencesPage_7=Character &width:
-ConsolePreferencesPage_8=Console &buffer size (characters):
-ConsolePreferencesPage_9=CVS Console Settings:
-
-SharingWizard_23=Share Project Resources
-SharingWizard_24=Review and commit resources to the repository. Use the context menu to perform additional operations on the resources.
-SharingWizard_25=Module ''{0}'' exists on the server. Select the tag to synchronize with.
-ReconcileProjectOperation_1=Local resource {0} is a file while the corresponding remote {1} is a folder
-ReconcileProjectOperation_2=Local resource {0} is a folder while the corresponding remote {1} is a file
-ShareProjectOperation_0=Sharing project {0} as {1}.
-SharingWizard_26=Keep Sharing?
-SharingWizard_27=Project {0} has been shared with a CVS repository. Do you want to keep it shared?
-SharingWizardSyncPage_3=The resources of project {0} are in-sync with the repository.
-SharingWizardSyncPage_4=An error has occurred populating this view.
-SharingWizardSyncPage_5=Show Errors
-SharingWizardSyncPage_8=Errors Occurred
-SharingWizardSyncPage_9=The following errors occurred.
-SharingWizardSyncPage_12=Launch the &Commit wizard
-ShareProjectOperation_1=Calculating synchronization states
-ShareProjectOperation_3=Mapping project {0} to {1}
-ShareProjectOperation_2=Preparing folder {0} for sharing
-CVSProjectPropertiesPage_31=&Show only compatible repository locations
-CVSProjectPropertiesPage_32=Confirm
-CVSProjectPropertiesPage_33=The selected repository location may not be compatible with the current location. Are you sure you want to change sharing to the new location?
-RepositoryEncodingPropertyPage_2=Identify the file system encoding used by the server where the repository is located. Setting this will allow file names and commit comments to be properly translated between the client and server in cases where the server encoding differs from the client.
-RepositoryEncodingPropertyPage_3=Server Encoding
-RepositoryEncodingPropertyPage_0=Cannot Change Encoding
-RepositoryEncodingPropertyPage_1=Properties for location {0} have been changed on another page. Please reopen the properties dialog to set the encoding.
-RepositoryEncodingPropertyPage_4=Note: this setting does not apply to file content encodings. File content encodings can be set on the <a>General/Workspace</a> preference page and on the Info property page of a project.
-CheckoutWizard_7=Checkout Project from CVS Repository
-CheckoutWizard_8=This wizard allows you to checkout projects from a CVS Repository.
-CheckoutWizard_0=Checkout from CVS
-CheckoutWizard_10=Select Module
-CheckoutWizard_11=Select the module to be checked out from CVS
-ModuleSelectionPage_2=Use an existing &module (this will allow you to browse the modules in the repository)
-CheckoutAsWizard_3=Select Tag
-CheckoutAsWizard_4=Choose the tag to check out from
-CheckoutAsMainPage_10=(Only available when the .project file does not exist in the repository)
-CVSTeamProvider_updatingFile=Updating {0}
-CVSHistoryTableProvider_base=<base>
-CVSHistoryPage_LocalModeAction=Local Mode
-CVSHistoryPage_OpenAction=&Open
-CVSHistoryPage_GroupByDate=Group Revisions by Date
-CVSHistoryPage_Today=Today
-CVSHistoryPage_Yesterday=Yesterday
-CVSHistoryPage_ThisMonth=This Month
-CVSHistoryPage_Previous=Older than This Month
-CVSHistoryPage_NoFilter=&Remove Filters
-CVSHistoryPage_FilterOn=&Filter...
-CVSHistoryPage_FilterDescription = {0} {1}
-CVSHistoryPage_FilterOnMessage=(Filter matched {0} of {1} revisions)
-CVSHistoryPage_EnterSearchTerm=Enter search term
-CVSHistoryPage_ShowSearchField=Show &Search Field
-CVSHistoryPage_LocalModeTooltip=Local Revisions
-CVSHistoryPage_RemoteModeAction=Remote Mode
-CVSHistoryPage_RemoteModeTooltip=Remote Revisions
-CVSHistoryPage_CombinedModeAction=Remote Local Mode
-CVSHistoryPage_CollapseAllAction=Collapse All
-CVSHistoryPage_CollapseAllTooltip=Collapse All
-CVSHistoryPage_NoRevisionsForMode=No {0}
-CVSHistoryPage_NoRevisions=Revisions
-CVSTeamProvider_makeBranch=Creating branch
-CVSTeamProvider_folderInfo=Updating folder synchronization information for project {0}
-CVSTeamProvider_updatingFolder=Updating {0}
-AddOperation_0=Adding resources in {0} to version control
-BranchOperation_0=Branching
-BranchOperation_1=Branching {0}
-CommitOperation_0=Committing {0}
-CommitSetDialog_0=&Name:
-CommitSetDialog_2=Custom change set &title
-CommitWizard_0=Committing resources
-CommitWizard_1=Committing resources
-CommitWizard_10=Always allow commits with warnings
-CommitWizard_11=Commit resources
-CommitWizard_12=One or more of the files being committed contain errors. Do you want to proceed with the commit?
-CommitWizard_13=Always allow commits with errors
-CommitWizard_2=Commit Files
-CommitWizard_4=Collecting outgoing changes
-CommitWizard_6=Nothing to Commit
-CommitWizard_7=The selected resources do not contain any changes.
-CommitWizard_8=Commit resources
-CommitWizard_9=One or more of the files being committed contain warnings. Do you want to proceed with the commit?
-UpdateOperation_0=Updating {0}
-ReplaceOperation_0=Replacing {0}
-ReplaceOperation_1=Scrubbing {0}
-TagOperation_0=Tagging {0}
-RemoteAnnotationStorage_1=As error occurred computing the content type of remote resource {0}
-DateTagCategory_0=Dates
-DateTagDialog_0=Date:
-DateTagDialog_1=Include time component in tag
-DateTagDialog_2=Time:
-DateTagDialog_3=Time is local
-DateTagDialog_4=Time is in universal time coordinates (UTC)
-DateTagDialog_5=Create Date Tag
-
-LogEntryCacheUpdateHandler_0=Errors have occurred while maintaining the log entry cache.
-LogEntryCacheUpdateHandler_1=Updating revision histories
-LogEntryCacheUpdateHandler_2=Could not fetch revision histories due to an internal timeout.
-MultiFolderTagSource_0={0} folders
-LocalProjectTagSource_0={0} Projects
-ModeWizard_0=ModeWizard
-ModeWizard_1=Change the ASCII/Binary Property
-ModeWizard_2=An error occurred
-ModeWizard_3=Setting file transfer mode...
-ModeWizard_4=Problems encountered while setting file transfer mode
-ModeWizard_5=Errors occurred
-ModeWizard_6=Warnings occurred
-
-ModeWizardSelectionPage_2=File
-ModeWizardSelectionPage_3=ASCII/Binary Property
-ModeWizardSelectionPage_4=Path
-ModeWizardSelectionPage_8=&Reset
-ModeWizardSelectionPage_9=Reset the selected files to their current mode
-ModelReplaceOperation_0=Overwrite Local Changes?
-ModelReplaceOperation_1=The selected elements contain local changes. You may choose to overwrite the changes or preview them.
-ModelReplaceOperation_2=&Overwrite
-ModelReplaceOperation_3=&Preview
-ModelCompareOperation_0=CVS Compare
-
-ReplaceWithTagAction_0=The selected elements contain uncommitted changes that will be overwritten. Should the replace proceed?
-ReplaceWithTagAction_1=The following elements contain &uncommitted changes that will be overwritten.
-ReplaceWithTagAction_2=Overwrite Uncommitted Changes
-UncommittedChangesDialog_2=Select an item to see the dirty resources it contains.
-UncommittedChangesDialog_3=&The dirty resources contained in ''{0}''
-UncommittedChangesDialog_4=&The full path of ''{0}''
-AddWizard_0=Add to Version Control
-
-CommentTemplatesPreferencePage_Description=&Create, edit or remove comment templates:
-CommentTemplatesPreferencePage_New=&New...
-CommentTemplatesPreferencePage_Edit=&Edit...
-CommentTemplatesPreferencePage_Remove=&Remove
-CommentTemplatesPreferencePage_Preview=Previe&w:
-CommentTemplatesPreferencePage_EditCommentTemplateTitle=Enter Comment Template
-CommentTemplatesPreferencePage_EditCommentTemplateMessage=Please enter a comment template:
-DiffOperation_0=Creating Patch on {0}
-DiffOperation_1=Creating Patch
-WorkInProgress_EnableModelUpdate=&Allow models to participate when performing a CVS merge
-WorkInProgressPage_0=When performing an update
-WorkInProgressPage_1=&Preview all incoming changes before updating
-WorkInProgressPage_2=&Update all non-conflicting changes and then preview remaining conflicts
-CVSMappingMergeOperation_MergeInfoTitle=Conflicts Occurred
-CVSMappingMergeOperation_MergeInfoText=Some elements contained conflicts that could not be handled automatically. Conflicts will appear in the Synchronize View.
-CacheTreeContentsOperation_0=Fetching contents for changed files in {0}
-CacheTreeContentsOperation_1=Fetching contents for changed files
-OutgoingChangesDialog_0=An error occurred creating the details section.
-OutgoingChangesDialog_1=Creation of the details section was canceled.
-SyncAction_0=Synchronizing CVS
-SyncAction_1=Should change sets be consulted to determine which resources should be included in the synchronization?
-CreatePatchAction_0=Create Patch
-CreatePatchAction_1=There were no changes found to be included in a patch.
-AnnotatePreferencePage_AnnotatePrefPageTitle=Annotate
-AnnotatePreferencePage_AnnotatePrefPageMessage=Options for CVS Annotate:
-AnnotatePreferencePage_AnnotatePrefPageBinaryFileMessage=Attempt to annotate a &binary file
-DiffOperation_CreatePatchConflictTitle=Patch Already Being Created
-DiffOperation_CreatePatchConflictMessage=A patch is already in the process of being written to {0}. Do you want to cancel the previous patch creation and continue with this one?
-ClipboardDiffOperation_Clipboard=the clipboard
-RemoveRootAction_RepositoryRemovalDialogMessageSingle=Are you sure you want to discard ''{0}''?
-RemoveRootAction_RepositoryRemovalDialogMessageMultiple=Are you sure you want to discard these {0} repositories?
-AddAction_confirmAddingResourcesTitle=Confirm adding resources to Version Control
-AddAction_confirmAddingResourcesMessage=Are you sure you want to add selected resources to the version control?
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 abecf5199..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * AllRootsElement is the model element for the repositories view.
- * Its children are the array of all known repository roots.
- */
-public class AllRootsElement extends CVSModelElement implements IAdaptable {
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryRoots();
- }
- public String getLabel(Object o) {
- return null;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java
deleted file mode 100644
index f6ec4f44b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-/**
- * BranchCategory is the model element for the branches category
- * for a particular repository in the repositories view. Its children
- * are the array of all known branch tags, other than HEAD, for the
- * given repository.
- */
-public class BranchCategory extends TagCategory {
-
- public BranchCategory(ICVSRepositoryLocation repository) {
- super(repository);
- }
-
- protected CVSTag[] getTags(IProgressMonitor monitor) throws CVSException {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(repository, getWorkingSet(), CVSTag.BRANCH, monitor);
- }
-
- /**
- * Returns an image descriptor to be used for displaying an object in the workbench.
- * Returns null if there is no appropriate image.
- *
- * @param object The object to get an image descriptor for.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY);
- }
-
- /**
- * Returns the name of this element. This will typically
- * be used to assign a label to this object when displayed
- * in the UI. Returns an empty string if there is no appropriate
- * name for this object.
- *
- * @param object The object to get a label for.
- */
- public String getLabel(Object o) {
- return CVSUIMessages.BranchCategory_Branches_1;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
deleted file mode 100644
index d5ef132ff..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetCompareAdapter;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.team.ui.history.IHistoryPageSource;
-import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
-import org.eclipse.team.ui.mapping.ITeamStateProvider;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-public class CVSAdapterFactory implements IAdapterFactory {
- private static Object fileAdapter = new RemoteFileElement();
- private static Object folderAdapter = new RemoteFolderElement();
- private static Object rootAdapter = new CVSRepositoryRootElement();
-
- private static Object historyParticipant = new CVSHistoryPageSource();
-
- private static Object teamStateProvider;
-
- // Property cache
- private Object cachedPropertyObject = null;
- private Object cachedPropertyValue = null;
- private ChangeSetCompareAdapter compareAdapter;
-
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (IWorkbenchAdapter.class == adapterType) {
- return getWorkbenchAdapter(adaptableObject);
- }
-
- if(IDeferredWorkbenchAdapter.class == adapterType) {
- Object o = getWorkbenchAdapter(adaptableObject);
- if(o != null && o instanceof IDeferredWorkbenchAdapter) {
- return o;
- }
- return null;
- }
-
- if (IPropertySource.class == adapterType) {
- return getPropertySource(adaptableObject);
- }
-
- if (IHistoryPageSource.class == adapterType){
- return historyParticipant;
- }
-
- if (ITeamStateProvider.class == adapterType) {
- synchronized (this) {
- if (teamStateProvider == null)
- teamStateProvider = new CVSTeamStateProvider(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
- return teamStateProvider;
- }
-
- if (ISynchronizationCompareAdapter.class == adapterType) {
- if (compareAdapter == null)
- compareAdapter = new ChangeSetCompareAdapter();
- return compareAdapter;
- }
-
- return null;
- }
-
- protected Object getWorkbenchAdapter(Object o) {
- if (o instanceof ICVSRemoteFile) {
- return fileAdapter;
- } else if (o instanceof ICVSRepositoryLocation) {
- return rootAdapter;
- } else if (o instanceof RepositoryRoot) {
- return rootAdapter;
- } else if (o instanceof ICVSRemoteFolder) {
- return folderAdapter;
- }
- return null;
- }
-
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Class[] getAdapterList() {
- return new Class[] { IWorkbenchAdapter.class, IPropertySource.class,
- IDeferredWorkbenchAdapter.class, IHistoryPageSource.class,
- ISynchronizationCompareAdapter.class, ITeamStateProvider.class,
- IFileRevision.class};
- }
-
- /**
- * Returns the property source for the given object. Caches
- * the result because the property sheet is extremely inefficient,
- * it asks for the source seven times in a row.
- */
- public Object getPropertySource(Object adaptableObject) {
- if (adaptableObject == cachedPropertyObject) {
- return cachedPropertyValue;
- }
- cachedPropertyObject = adaptableObject;
- if (adaptableObject instanceof ICVSRemoteFile) {
- cachedPropertyValue = new CVSRemoteFilePropertySource((ICVSRemoteFile)adaptableObject);
- } else if (adaptableObject instanceof ICVSRemoteFolder) {
- cachedPropertyValue = new CVSRemoteFolderPropertySource((ICVSRemoteFolder)adaptableObject);
- } else if (adaptableObject instanceof ICVSRepositoryLocation) {
- cachedPropertyValue = new CVSRepositoryLocationPropertySource((ICVSRepositoryLocation)adaptableObject);
- } else if (adaptableObject instanceof RepositoryRoot) {
- cachedPropertyValue = new CVSRepositoryLocationPropertySource(((RepositoryRoot)adaptableObject).getRoot());
- } else {
- cachedPropertyValue = null;
- }
- return cachedPropertyValue;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
deleted file mode 100644
index 2efc16590..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public abstract class CVSModelElement implements IWorkbenchAdapter, IAdaptable {
-
- private IRunnableContext runnableContext;
- private IWorkingSet workingSet;
-
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if ((adapter == IDeferredWorkbenchAdapter.class) && this instanceof IDeferredWorkbenchAdapter)
- return this;
- return null;
- }
-
- /**
- * Returns the runnableContext.
- * @return ITeamRunnableContext
- */
- public IRunnableContext getRunnableContext() {
- if (runnableContext == null) {
- return PlatformUI.getWorkbench().getProgressService();
- }
- return runnableContext;
- }
-
- /**
- * Sets the runnableContext.
- * @param runnableContext The runnableContext to set
- */
- public void setRunnableContext(IRunnableContext runnableContext) {
- this.runnableContext = runnableContext;
- }
-
- public Object[] getChildren(Object o) {
- try {
- return fetchChildren(o, null);
- } catch (TeamException e) {
- handle(e);
- }
-
- return new Object[0];
- }
-
- abstract protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException;
-
- /**
- * Handle an exception that occurred in CVS model elements by displaying an error dialog.
- * @param title the title of the error dialog
- * @param description the description to be displayed
- * @param e the exception that occurred
- */
- protected void handle(final String title, final String description, final Throwable e) {
- CVSUIPlugin.openError(null, title, description, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS | CVSUIPlugin.PERFORM_SYNC_EXEC);
- }
-
- /**
- * Helper methed error handler that displayes a generic dialog title and message when displaying an error to the user.
- * @param t the exception that occurred.
- */
- protected void handle(Throwable t) {
- handle(CVSUIMessages.CVSModelElement_0, CVSUIMessages.CVSModelElement_1, t); //
- }
-
- /**
- * Handle an exception that occurred while fetching the children for a deferred workbench adapter.
- * @param collector the collector for the adapter
- * @param e the exception that occurred
- */
- protected void handle(IElementCollector collector, Throwable t) {
- // TODO: For now, just display a dialog (see bug 65008 and 65741)
- handle(t);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
deleted file mode 100644
index 7df5f7be9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-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 = CVSUIMessages.cvs;
-
- // resource name
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, CVSUIMessages.CVSRemoteFilePropertySource_name);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[0] = descriptor;
- // revision
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_REVISION, CVSUIMessages.CVSRemoteFilePropertySource_revision);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[1] = descriptor;
- // date
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_DATE, CVSUIMessages.CVSRemoteFilePropertySource_date);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[2] = descriptor;
- // author
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_AUTHOR, CVSUIMessages.CVSRemoteFilePropertySource_author);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[3] = descriptor;
- // comment
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_COMMENT, CVSUIMessages.CVSRemoteFilePropertySource_comment);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[4] = descriptor;
- }
-
- /**
- * Create a PropertySource and store its file
- */
- public CVSRemoteFilePropertySource(ICVSRemoteFile file) {
- this.file = file;
- }
-
- /**
- * Do nothing because properties are read only.
- */
- public Object getEditableValue() {
- return this;
- }
-
- /**
- * Return the Property Descriptors for the receiver.
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- /*
- * @see IPropertySource#getPropertyValue(Object)
- */
- public Object getPropertyValue(Object id) {
- if (!initialized) {
- initialize();
- initialized = true;
- }
- if (id.equals(ICVSUIConstants.PROP_NAME)) {
- return file.getName();
- }
- if (entry != null) {
- if (id.equals(ICVSUIConstants.PROP_REVISION)) {
- return entry.getRevision();
- }
- if (id.equals(ICVSUIConstants.PROP_DATE)) {
- return entry.getDate();
- }
- if (id.equals(ICVSUIConstants.PROP_AUTHOR)) {
- return entry.getAuthor();
- }
- if (id.equals(ICVSUIConstants.PROP_COMMENT)) {
- return entry.getComment();
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Answer true if the value of the specified property
- * for this object has been changed from the default.
- */
- public boolean isPropertySet(Object property) {
- return false;
- }
- /**
- * Reset the specified property's value to its default value.
- * Do nothing because properties are read only.
- *
- * @param property The property to reset.
- */
- public void resetPropertyValue(Object property) {
- }
- /**
- * Do nothing because properties are read only.
- */
- public void setPropertyValue(Object name, Object value) {
- }
-
- private void initialize() {
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ILogEntry[] entries = file.getLogEntries(monitor);
- String revision = file.getRevision();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getRevision().equals(revision)) {
- entry = entries[i];
- return;
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) { // ignore cancellation
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(null, null, null, e);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
deleted file mode 100644
index 607157481..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-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 = CVSUIMessages.cvs;
-
- // resource name
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, CVSUIMessages.CVSRemoteFolderPropertySource_name);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[0] = descriptor;
- // tag
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_TAG, CVSUIMessages.CVSRemoteFolderPropertySource_tag);
- 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 CVSUIMessages.CVSRemoteFolderPropertySource_none;
- }
- 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 8b8c341c7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-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 = CVSUIMessages.cvs;
-
- // host
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_HOST, CVSUIMessages.CVSRepositoryLocationPropertySource_host);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[0] = descriptor;
- // user
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_USER, CVSUIMessages.CVSRepositoryLocationPropertySource_user);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[1] = descriptor;
- // port
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_PORT, CVSUIMessages.CVSRepositoryLocationPropertySource_port);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[2] = descriptor;
- // root
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_ROOT, CVSUIMessages.CVSRepositoryLocationPropertySource_root);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[3] = descriptor;
- // method
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_METHOD, CVSUIMessages.CVSRepositoryLocationPropertySource_method);
- 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 CVSUIMessages.CVSRepositoryLocationPropertySource_default;
- }
- 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 eff02ff08..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-
-/**
- * RemoteRootElement is the model element for a repository that
- * appears in the repositories view. Its children are:
- * a) HEAD
- * b) Branch tags category
- * c) Version tags category
- */
-public class CVSRepositoryRootElement extends CVSModelElement {
- public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof ICVSRepositoryLocation || object instanceof RepositoryRoot) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REPOSITORY);
- }
- return null;
- }
- public String getLabel(Object o) {
- if (o instanceof ICVSRepositoryLocation) {
- ICVSRepositoryLocation root = (ICVSRepositoryLocation)o;
- o = CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(root);
- if (o == null) {
- return root.getLocation(true);
- }
- }
- if (o instanceof RepositoryRoot) {
- RepositoryRoot root = (RepositoryRoot)o;
- String name = root.getName();
- if (name == null)
- return root.getRoot().getLocation(true);
- else
- return name;
- }
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- ICVSRepositoryLocation location = null;
- if (o instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)o;
- }
- if (o instanceof RepositoryRoot) {
- RepositoryRoot root = (RepositoryRoot)o;
- location = root.getRoot();
- }
- if (location == null) return null;
- return new Object[] {
- new CVSTagElement(CVSTag.DEFAULT, location),
- new BranchCategory(location),
- new VersionCategory(location),
- new DateTagCategory(location)
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
deleted file mode 100644
index ec49cc3cb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public abstract class CVSResourceElement extends CVSModelElement implements IAdaptable {
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- /**
- * Initial implementation: return the resource's name
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSResource)) return null;
- return ((ICVSResource)o).getName();
- }
- /**
- * Return null.
- */
- public Object getParent(Object o) {
- if (!(o instanceof ICVSResource)) return null;
- return null;
- }
-
- abstract public ICVSResource getCVSResource();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
deleted file mode 100644
index 2a082abac..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import java.lang.reflect.InvocationTargetException;
-import com.ibm.icu.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-import com.ibm.icu.util.TimeZone;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation.RemoteFolderFilter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public class CVSTagElement extends CVSModelElement implements IDeferredWorkbenchAdapter {
- CVSTag tag;
- ICVSRepositoryLocation root;
-
- private static final String REPO_VIEW_LONG_FORAMT = "dd MMM yyyy HH:mm:ss"; //$NON-NLS-1$
- private static final String REPO_VIEW_SHORT_FORMAT = "dd MMM yyyy"; //$NON-NLS-1$
- private static final String TIME_ONLY_COLUMN_FORMAT = "HH:mm:ss"; //$NON-NLS-1$
- private static SimpleDateFormat localLongFormat = new SimpleDateFormat(REPO_VIEW_LONG_FORAMT,Locale.getDefault());
- private static SimpleDateFormat localShortFormat = new SimpleDateFormat(REPO_VIEW_SHORT_FORMAT,Locale.getDefault());
- private static SimpleDateFormat timeColumnFormat = new SimpleDateFormat(TIME_ONLY_COLUMN_FORMAT, Locale.getDefault());
-
- static synchronized public String toDisplayString(Date date){
- String localTime = timeColumnFormat.format(date);
- timeColumnFormat.setTimeZone(TimeZone.getDefault());
- if(localTime.equals("00:00:00")){ //$NON-NLS-1$
- return localShortFormat.format(date);
- }
- return localLongFormat.format(date);
- }
-
- public CVSTagElement(CVSTag tag, ICVSRepositoryLocation root) {
- this.tag = tag;
- this.root = root;
- }
-
- public ICVSRepositoryLocation getRoot() {
- return root;
- }
-
- public CVSTag getTag() {
- return tag;
- }
-
- public boolean equals(Object o) {
- if (!(o instanceof CVSTagElement))
- return false;
- CVSTagElement t = (CVSTagElement) o;
- if (!tag.equals(t.tag))
- return false;
- return root.equals(t.root);
- }
-
- public int hashCode() {
- return root.hashCode() ^ tag.hashCode();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof CVSTagElement))
- return null;
- if (tag.getType() == CVSTag.BRANCH || tag.getType() == CVSTag.HEAD) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_TAG);
- } else if (tag.getType() == CVSTag.VERSION) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_PROJECT_VERSION);
- } else {
- // This could be a Date tag
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_DATE);
- }
- }
- public String getLabel(Object o) {
- if (!(o instanceof CVSTagElement))
- return null;
- CVSTag aTag = ((CVSTagElement) o).tag;
- if(aTag.getType() == CVSTag.DATE){
- Date date = tag.asDate();
- if (date != null){
- return toDisplayString(date);
- }
- }
- return aTag.getName();
- }
-
- public String toString() {
- return tag.getName();
- }
-
- public Object getParent(Object o) {
- if (!(o instanceof CVSTagElement))
- return null;
- return ((CVSTagElement) o).root;
- }
-
- protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- ICVSRemoteResource[] children = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, tag, monitor);
- if (getWorkingSet() != null)
- children = CVSUIPlugin.getPlugin().getRepositoryManager().filterResources(getWorkingSet(), children);
- return children;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
- if (tag.getType() == CVSTag.HEAD || tag.getType() == CVSTag.DATE) {
- try {
- monitor = Policy.monitorFor(monitor);
- RemoteFolder folder = new RemoteFolder(null, root, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, tag);
- monitor.beginTask(NLS.bind(CVSUIMessages.RemoteFolderElement_fetchingRemoteChildren, new String[] { root.toString() }), 100);
- FetchMembersOperation operation = new FetchMembersOperation(null, folder, collector);
- operation.setFilter(new RemoteFolderFilter() {
- public ICVSRemoteResource[] filter(ICVSRemoteResource[] folders) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().filterResources(getWorkingSet(), folders);
- }
- });
- operation.run(Policy.subMonitorFor(monitor, 100));
- } catch (final InvocationTargetException e) {
- handle(collector, e);
- } catch (InterruptedException e) {
- // Cancelled by the user;
- } finally {
- monitor.done();
- }
- } else {
- try {
- collector.add(fetchChildren(o, monitor), monitor);
- } catch (TeamException e) {
- handle(collector, e);
- }
- }
- }
-
- public ISchedulingRule getRule(Object element) {
- return new RepositoryLocationSchedulingRule(root);
- }
-
- public boolean isContainer() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
deleted file mode 100644
index 36a492b44..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-
-/**
- * The DateTagCategory is the parent of all the date tags in the repositories view.
- */
-public class DateTagCategory extends TagCategory {
-
- public DateTagCategory(ICVSRepositoryLocation repository) {
- super(repository);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.model.TagCategory#getTags(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected CVSTag[] getTags(IProgressMonitor monitor) throws CVSException {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(repository).getDateTags();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return CVSUIMessages.DateTagCategory_0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.model.TagCategory#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter.equals(ICVSRepositoryLocation.class)) {
- return getRepository(null);
- }
- return super.getAdapter(adapter);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
deleted file mode 100644
index f471b5be1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.progress.DeferredTreeContentManager;
-
-/**
- * Extension to the generic workbench content provider mechanism
- * to lazily determine whether an element has children. That is,
- * children for an element aren't fetched until the user clicks
- * on the tree expansion box.
- */
-public class RemoteContentProvider extends WorkbenchContentProvider {
-
- IWorkingSet workingSet;
- DeferredTreeContentManager manager;
-
- HashMap cachedTrees;
-
- public RemoteContentProvider(){
- cachedTrees = new HashMap();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (viewer instanceof AbstractTreeViewer) {
- manager = new DeferredTreeContentManager(this, (AbstractTreeViewer) viewer);
- }
- super.inputChanged(viewer, oldInput, newInput);
- }
-
- public boolean hasChildren(Object element) {
- // the + box will always appear, but then disappear
- // if not needed after you first click on it.
- if (element instanceof ICVSRemoteResource) {
- if (element instanceof ICVSRemoteFolder) {
- return ((ICVSRemoteFolder) element).isExpandable();
- }
- return ((ICVSRemoteResource) element).isContainer();
- } else if (element instanceof CVSResourceElement) {
- ICVSResource r = ((CVSResourceElement) element).getCVSResource();
- if (r instanceof RemoteResource) {
- return r.isFolder();
- }
- } else if (element instanceof VersionCategory) {
- return true;
- } else if (element instanceof BranchCategory) {
- return true;
- } else if (element instanceof CVSTagElement) {
- return true;
- } else if (element instanceof RemoteModule) {
- return true;
- }
- if (manager != null) {
- if (manager.isDeferredAdapter(element))
- return manager.mayHaveChildren(element);
- }
-
- return super.hasChildren(element);
- }
-
- /**
- * Sets the workingSet.
- * @param workingSet The workingSet to set
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- }
-
- /**
- * Returns the workingSet.
- * @return IWorkingSet
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.WorkbenchContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object element) {
- //check to see if we already have the children cached in the tree map
- Object tree = cachedTrees.get(element);
- if (tree != null) {
- return ((RemoteFolderTree) tree).getChildren();
- }
-
- if (manager != null) {
- Object[] children = manager.getChildren(element);
- if (children != null) {
- // This will be a placeholder to indicate
- // that the real children are being fetched
- return children;
- }
- }
- Object[] children = super.getChildren(element);
- for (int i = 0; i < children.length; i++) {
- Object object = children[i];
- if (object instanceof CVSModelElement)
- ((CVSModelElement)object).setWorkingSet(getWorkingSet());
- }
- return children;
- }
-
- public void cancelJobs(RepositoryRoot[] roots) {
- if (manager != null) {
- for (int i = 0; i < roots.length; i++) {
- RepositoryRoot root = roots[i];
- cancelJobs(root.getRoot());
- }
- }
- }
-
- /**
- * Cancel any jobs that are fetching content from the given location.
- * @param location
- */
- public void cancelJobs(ICVSRepositoryLocation location) {
- if (manager != null) {
- manager.cancel(location);
- }
- }
-
- /**
- * Adds a remote folder tree to the cache
- * @param project
- *
- */
- public void addCachedTree(ICVSRemoteFolder project, RemoteFolderTree tree){
- cachedTrees.put(project, tree);
- }
-
- public void purgeCache(){
- cachedTrees.clear();
- }
-
-
-}
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 ef6e383cb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.PlatformUI;
-
-public class RemoteFileElement extends RemoteResourceElement {
- /**
- * Initial implementation: return null;
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return new Object[0];
- }
- /**
- * Initial implementation: return null.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof ICVSRemoteFile)) return null;
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(((ICVSRemoteFile)object).getName());
- }
- /**
- * Initial implementation: return the file's name and version
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRemoteFile)) return null;
- ICVSRemoteFile file = (ICVSRemoteFile)o;
- try {
- return NLS.bind(CVSUIMessages.nameAndRevision, new String[] { file.getName(), file.getRevision() });
- } catch (TeamException e) {
- handle(null, null, e);
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java
deleted file mode 100644
index 65c4e782b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.model;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public class RemoteFolderElement extends RemoteResourceElement implements IDeferredWorkbenchAdapter {
-
- /**
- * Overridden to append the version name to remote folders which
- * have version tags and are top-level folders.
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRemoteFolder))
- return null;
- ICVSRemoteFolder folder = (ICVSRemoteFolder) o;
- CVSTag tag = folder.getTag();
- if (tag != null && tag.getType() != CVSTag.HEAD) {
- if (folder.getRemoteParent() == null) {
- return NLS.bind(CVSUIMessages.RemoteFolderElement_nameAndTag, new String[] { folder.getName(), tag.getName() });
- }
- }
- return folder.getName();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof ICVSRemoteFolder))
- return null;
- ICVSRemoteFolder folder = (ICVSRemoteFolder) object;
- if (folder.isDefinedModule()) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MODULE);
- }
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- if (!(o instanceof ICVSRemoteFolder))
- return new Object[0];
- return ((ICVSRemoteFolder) o).members(monitor);
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
- // If it's not a folder, return an empty array
- if (!(o instanceof ICVSRemoteFolder)) {
- collector.add(new Object[0], monitor);
- }
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(NLS.bind(CVSUIMessages.RemoteFolderElement_fetchingRemoteChildren, new String[] { getLabel(o) }), 100);
- FetchMembersOperation operation = new FetchMembersOperation(null, (ICVSRemoteFolder)o, collector);
- operation.run(Policy.subMonitorFor(monitor, 100));
- } catch (InvocationTargetException e) {
- handle(collector, e);
- } catch (InterruptedException e) {
- // Cancelled by the user;
- } finally {
- monitor.done();
- }
- }
-
- public ISchedulingRule getRule(Object element) {
- ICVSRepositoryLocation location = getRepositoryLocation(element);
- return new RepositoryLocationSchedulingRule(location);
- }
-
- private ICVSRepositoryLocation getRepositoryLocation(Object o) {
- if (!(o instanceof ICVSRemoteFolder))
- return null;
- return ((ICVSRemoteFolder)o).getRepository();
- }
-
- public boolean isContainer() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
deleted file mode 100644
index 02164aacc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-/**
- * This class represents an IProject resource in a repository. The children of a
- * RemoteModule are its versions. A RemoteModule is a child of the
- * VersionsCategory.
- */
-public class RemoteModule extends CVSModelElement implements IAdaptable,
- IDeferredWorkbenchAdapter {
- ICVSRemoteFolder folder;
-
- VersionCategory parent;
-
- /**
- * RemoteProject constructor.
- */
- public RemoteModule(ICVSRemoteFolder folder, VersionCategory parent) {
- this.folder = folder;
- this.parent = parent;
- }
-
- /**
- * Returns an object which is an instance of the given class associated with
- * this object. Returns <code>null</code> if no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IDeferredWorkbenchAdapter.class)
- return this;
- return null;
- }
-
- /**
- * Returns an image to be used for displaying an object in the desktop.
- *
- * @param object The object to get an image for.
- * @param owner The viewer that the image will be used in. The image will be
- * disposed when this viewer is closed. If the owner is null, a
- * new image is returned, and the caller is responsible for
- * disposing it.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_PROJECT_VERSION);
- }
-
- /**
- * Returns the name of this element. This will typically be used to assign a
- * label to this object when displayed in the UI.
- */
- public String getLabel(Object o) {
- return folder.getName();
- }
-
- /**
- * Returns the logical parent of the given object in its tree.
- */
- public Object getParent(Object o) {
- return parent;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return folder.getRepository();
- }
-
- /**
- * (Non-javadoc) For debugging purposes only.
- */
- public String toString() {
- return "RemoteModule(" + folder.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public ICVSRemoteResource getCVSResource() {
- return folder;
- }
-
- /**
- * Returns the children of this object. When this object is displayed in a
- * tree, the returned objects will be this element's children. Returns an
- * empty enumeration if this object has no children. The children of the
- * RemoteModule are the versions for that module.
- *
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#internalGetChildren(java.lang.Object,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor)
- throws TeamException {
- RepositoryManager manager = CVSUIPlugin.getPlugin()
- .getRepositoryManager();
- try {
- manager.refreshDefinedTags(folder, false /* recurse */, false /* notify */, monitor);
- } catch (TeamException e) {
- // continue
- }
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager()
- .getKnownTags(folder, CVSTag.VERSION);
- Object[] versions = new Object[tags.length];
- for (int i = 0; i < versions.length; i++) {
- versions[i] = folder.forTag(tags[i]);
- }
- return versions;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector,
- IProgressMonitor monitor) {
- try {
- collector.add(fetchChildren(o, monitor), monitor);
- } catch (TeamException e) {
- handle(collector, e);
- }
- }
-
- public boolean isContainer() {
- return true;
- }
-
- public ISchedulingRule getRule(Object element) {
- return new RepositoryLocationSchedulingRule(folder.getRepository());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java
deleted file mode 100644
index eaf431fde..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-/**
- * This model element provides the remote projects for a given repository and
- * tag.
- */
-public class RemoteProjectsElement extends CVSTagElement {
-
- /**
- * Constructor for RemoteProjectsElement.
- */
- public RemoteProjectsElement() {
- super(CVSTag.DEFAULT, null);
- }
-
- /**
- * Sets the root.
- * @param root The root to set
- */
- public void setRoot(ICVSRepositoryLocation root) {
- this.root = root;
- }
-
- /**
- * Sets the tag.
- * @param tag The tag to set
- */
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (!(o instanceof RemoteProjectsElement)) return false;
- RemoteProjectsElement element = (RemoteProjectsElement)o;
- if (root == null) {
- return element.root == null && tag.equals(element.tag);
- }
- return super.equals(o);
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- if (root == null) return tag.hashCode();
- return super.hashCode();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#internalGetChildren(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- if (root == null) return new Object[0];
- return super.fetchChildren(o, monitor);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java
deleted file mode 100644
index ec88e43b8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-
-public abstract class RemoteResourceElement extends CVSModelElement {
- /**
- * Initial implementation: return the resource's name
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRemoteResource)) return null;
- return ((ICVSRemoteResource)o).getName();
- }
- /**
- * Return null.
- */
- public Object getParent(Object o) {
- if (!(o instanceof ICVSRemoteResource)) return null;
- ICVSRemoteResource rr = (ICVSRemoteResource)o;
- return rr.getParent();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java
deleted file mode 100644
index 843ca1ea1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-/**
- * A simple job scheduling rule for serializing jobs for an ICVSRepositoryLocation
- */
-public class RepositoryLocationSchedulingRule implements ISchedulingRule {
- ICVSRepositoryLocation location;
- public RepositoryLocationSchedulingRule(ICVSRepositoryLocation location) {
- this.location = location;
- }
- public boolean isConflicting(ISchedulingRule rule) {
- if(rule instanceof RepositoryLocationSchedulingRule) {
- return ((RepositoryLocationSchedulingRule)rule).location.equals(location);
- }
- return false;
- }
- public boolean contains(ISchedulingRule rule) {
- return isConflicting(rule);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
deleted file mode 100644
index f502ff396..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This class provides common behavior between the branch and date tag categories
- */
-public abstract class TagCategory extends CVSModelElement {
- protected ICVSRepositoryLocation repository;
-
- public TagCategory(ICVSRepositoryLocation repository) {
- this.repository = repository;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#fetchChildren(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws CVSException {
- CVSTag[] tags = getTags(monitor);
- CVSTagElement[] elements = new CVSTagElement[tags.length];
- for (int i = 0; i < tags.length; i++) {
- elements[i] = new CVSTagElement(tags[i], repository);
- }
- return elements;
- }
-
- /**
- * Return the tags that are to be displyed as children of this category
- * @param monitor
- * @return
- */
- protected abstract CVSTag[] getTags(IProgressMonitor monitor) throws CVSException;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return repository;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return repository;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
deleted file mode 100644
index fce52463f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public class VersionCategory extends CVSModelElement implements IAdaptable,
- IDeferredWorkbenchAdapter {
- private ICVSRepositoryLocation repository;
-
- /**
- * ProjectVersionsCategory constructor.
- */
- public VersionCategory(ICVSRepositoryLocation repo) {
- super();
- this.repository = repo;
- }
-
- /**
- * Returns an object which is an instance of the given class associated with
- * this object. Returns <code>null</code> if no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IDeferredWorkbenchAdapter.class)
- return this;
- return null;
- }
-
- /**
- * Returns the children of this object. When this object is displayed in a
- * tree, the returned objects will be this element's children. Returns an
- * empty enumeration if this object has no children.
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor)
- throws TeamException {
- if (CVSUIPlugin.getPlugin().getRepositoryManager()
- .isDisplayingProjectVersions(repository)) {
- return getProjectVersionChildren(o, monitor);
- } else {
- return getVersionTagChildren(o, monitor);
- }
- }
-
- /*
- * Return the children as a list of versions whose children are projects
- */
- private Object[] getVersionTagChildren(Object o, IProgressMonitor monitor)
- throws CVSException {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager()
- .getKnownTags(repository, getWorkingSet(), CVSTag.VERSION, monitor);
- CVSTagElement[] versionElements = new CVSTagElement[tags.length];
- for (int i = 0; i < tags.length; i++) {
- versionElements[i] = new CVSTagElement(tags[i], repository);
- }
- return versionElements;
- }
-
- /*
- * Return the children as a list of projects whose children ar project
- * versions
- */
- private Object[] getProjectVersionChildren(Object o,
- IProgressMonitor monitor) throws TeamException {
-
- ICVSRemoteResource[] resources = CVSUIPlugin.getPlugin()
- .getRepositoryManager().getFoldersForTag(repository,
- CVSTag.DEFAULT, monitor);
- if (getWorkingSet() != null)
- resources = CVSUIPlugin.getPlugin().getRepositoryManager()
- .filterResources(getWorkingSet(), resources);
- Object[] modules = new Object[resources.length];
- for (int i = 0; i < resources.length; i++) {
- modules[i] = new RemoteModule((ICVSRemoteFolder) resources[i],
- VersionCategory.this);
- }
- return modules;
- }
-
- /**
- * Returns an image descriptor to be used for displaying an object in the
- * workbench. Returns null if there is no appropriate image.
- *
- * @param object The object to get an image descriptor for.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_VERSIONS_CATEGORY);
- }
-
- /**
- * Returns the name of this element. This will typically be used to assign a
- * label to this object when displayed in the UI. Returns an empty string if
- * there is no appropriate name for this object.
- *
- * @param object The object to get a label for.
- */
- public String getLabel(Object o) {
- return CVSUIMessages.VersionCategory_Versions_1;
- }
-
- /**
- * Returns the logical parent of the given object in its tree. Returns null
- * if there is no parent, or if this object doesn't belong to a tree.
- *
- * @param object The object to get the parent for.
- */
- public Object getParent(Object o) {
- return repository;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return repository;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector,
- IProgressMonitor monitor) {
- try {
- collector.add(fetchChildren(o, monitor), monitor);
- } catch (TeamException e) {
- handle(collector, e);
- }
- }
-
- public boolean isContainer() {
- return true;
- }
-
- public ISchedulingRule getRule(Object element) {
- return new RepositoryLocationSchedulingRule(repository);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
deleted file mode 100644
index 14a282394..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Performs a "cvs add"
- */
-public class AddOperation extends RepositoryProviderOperation {
-
- private Map fModesForExtensions;
- private Map fModesForFiles;
-
- public AddOperation(IWorkbenchPart part, ResourceMapping[] mappers) {
- super(part, mappers);
- fModesForExtensions= Collections.EMPTY_MAP;
- fModesForFiles= Collections.EMPTY_MAP;
- }
-
- public void addModesForExtensions(Map modes) {
- fModesForExtensions= modes;
- }
-
- public void addModesForNames(Map modes) {
- fModesForFiles= modes;
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- if (resources.length == 0)
- return;
- add(provider, resources, recurse ? IResource.DEPTH_INFINITE : IResource.DEPTH_ONE, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.AddAction_adding;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.AddOperation_0, new String[] { provider.getProject().getName() });
- }
-
- /*
- * Add the given resources to the project.
- * <p>
- * The sematics follow that of CVS in the sense that any folders
- * being added are created remotely as a result of this operation
- * while files are created remotely on the next commit.
- * </p>
- * <p>
- * This method uses the team file type registry to determine the type
- * of added files. If the extension of the file is not in the registry,
- * the file is assumed to be binary.
- * </p>
- * <p>
- * NOTE: for now we do three operations: one each for folders, text files and binary files.
- * We should optimize this when time permits to either use one operations or defer server
- * contact until the next commit.
- * </p>
- *
- * <p>
- * There are special semantics for adding the project itself to the repo. In this case, the project
- * must be included in the resources array.
- * </p>
- */
- private void add(CVSTeamProvider provider, IResource[] resources, int depth, IProgressMonitor progress) throws CVSException {
-
- // Visit the children of the resources using the depth in order to
- // determine which folders, text files and binary files need to be added
- // A TreeSet is needed for the folders so they are in the right order (i.e. parents created before children)
- final SortedSet folders = new TreeSet();
- // Sets are required for the files to ensure that files will not appear twice if there parent was added as well
- // and the depth isn't zero
- final Map /* from KSubstOption to Set */ files = new HashMap();
- final CVSException[] eHolder = new CVSException[1];
- for (int i=0; i<resources.length; i++) {
-
- final IResource currentResource = resources[i];
-
- try {
- // Auto-add parents if they are not already managed
- IContainer parent = currentResource.getParent();
- ICVSResource cvsParentResource = CVSWorkspaceRoot.getCVSResourceFor(parent);
- while (parent.getType() != IResource.ROOT && parent.getType() != IResource.PROJECT && ! isManaged(cvsParentResource)) {
- folders.add(cvsParentResource);
- parent = parent.getParent();
- cvsParentResource = cvsParentResource.getParent();
- }
-
- // Auto-add children
- final TeamException[] exception = new TeamException[] { null };
- currentResource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- try {
- ICVSResource mResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- // Add the resource is its not already managed and it was either
- // added explicitly (is equal currentResource) or is not ignored
- if (! isManaged(mResource) && (currentResource.equals(resource) || ! mResource.isIgnored())) {
- if (resource.getType() == IResource.FILE) {
- KSubstOption ksubst= getKSubstOption((IFile)resource);
- Set set = (Set) files.get(ksubst);
- if (set == null) {
- set = new HashSet();
- files.put(ksubst, set);
- }
- set.add(mResource);
- } else if (!isManagedProject(resource, mResource)){
- folders.add(mResource);
- }
- }
- // Always return true and let the depth determine if children are visited
- return true;
- } catch (CVSException e) {
- exception[0] = e;
- return false;
- }
- }
-
- }, depth, false);
- if (exception[0] != null) {
- throw exception[0];
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
- // If an exception occured during the visit, throw it here
- if (eHolder[0] != null)
- throw eHolder[0];
-
- // Add the folders, followed by files!
- progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
- try {
- if (!folders.isEmpty()) {
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- (ICVSResource[])folders.toArray(new ICVSResource[folders.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- session.close();
- }
- }
- for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- final KSubstOption ksubst = (KSubstOption) entry.getKey();
- final Set set = (Set) entry.getValue();
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { ksubst },
- (ICVSResource[])set.toArray(new ICVSResource[set.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- session.close();
- }
- }
- } finally {
- progress.done();
- }
- }
-
- /*
- * Return true if the resource is a project that is already a CVS folder
- */
- protected boolean isManagedProject(IResource resource, ICVSResource resource2) throws CVSException {
- return resource.getType() == IResource.PROJECT && ((ICVSFolder)resource2).isCVSFolder();
- }
-
- /*
- * Consider a folder managed only if it's also a CVS folder
- */
- protected boolean isManaged(ICVSResource cvsResource) throws CVSException {
- return cvsResource.isManaged() && (!cvsResource.isFolder() || ((ICVSFolder)cvsResource).isCVSFolder());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
- */
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return CVSUIMessages.AddAction_addFailed;
- }
-
- protected KSubstOption getKSubstOption(IFile file) {
- final String extension= file.getFileExtension();
- final Integer mode;
- if (extension == null) {
- mode= (Integer)fModesForFiles.get(file.getName());
- } else {
- mode= (Integer)fModesForExtensions.get(extension);
- }
- if (mode != null) {
- return mode.intValue() == Team.BINARY ? Command.KSUBST_BINARY : KSubstOption.getDefaultTextMode();
- } else {
- return KSubstOption.fromFile(file);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
deleted file mode 100644
index ac8896c9c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.BranchPromptDialog;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Perform a CVS branch operaiton
- */
-public class BranchOperation extends RepositoryProviderOperation {
-
- private boolean update;
- private CVSTag rootVersionTag;
- private CVSTag branchTag;
-
- public BranchOperation(IWorkbenchPart part, ResourceMapping[] mappers) {
- super(part, mappers);
- }
-
- public void setTags(CVSTag rootVersionTag, CVSTag branchTag, boolean updateToBranch) {
- this.rootVersionTag = rootVersionTag;
- this.branchTag = branchTag;
- this.update = updateToBranch;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- protected boolean shouldRun() {
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- buildScope(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e1) {
- CVSUIPlugin.openError(getShell(), null, null, e1);
- } catch (InterruptedException e1) {
- throw new OperationCanceledException();
- }
-
- IResource[] resources = getTraversalRoots();
- boolean allSticky = areAllResourcesSticky(resources);
- String initialVersionName = calculateInitialVersionName(resources,allSticky);
- final BranchPromptDialog dialog = new BranchPromptDialog(getShell(),
- CVSUIMessages.BranchWizard_title,
- resources,
- allSticky,
- initialVersionName);
- if (dialog.open() != Window.OK) return false;
-
- // Capture the dialog info in local variables
- final String tagString = dialog.getBranchTagName();
- update = dialog.getUpdate();
- branchTag = new CVSTag(tagString, CVSTag.BRANCH);
-
- // Only set the root version tag if the name from the dialog differs from the initial name
- String versionString = dialog.getVersionTagName();
- if (versionString != null
- && (initialVersionName == null || !versionString.equals(initialVersionName))) {
- 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 be mixing tags
- if (update) {
- try {
- if(!CVSAction.checkForMixingTags(getShell(), resources, branchTag)) {
- return false;
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- return super.shouldRun();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] providerResources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(null, 100);
- makeBranch(provider, providerResources, rootVersionTag, branchTag, update, recurse, Policy.subMonitorFor(monitor, 90));
- updateRememberedTags(providerResources);
- if (update) {
- updateWorkspaceSubscriber(provider, getCVSArguments(providerResources), recurse, Policy.subMonitorFor(monitor, 10));
- }
- collectStatus(Status.OK_STATUS);
- } catch (TeamException e) {
- // Accumulate the status which will be displayed by CVSAction#endOperation(IAction)
- collectStatus(e.getStatus());
- } finally {
- monitor.done();
- }
- }
-
- private void makeBranch(CVSTeamProvider provider, IResource[] resources, final CVSTag versionTag, final CVSTag branchTag, boolean moveToBranch, boolean recurse, IProgressMonitor monitor) throws TeamException {
-
- // Determine the total amount of work
- int totalWork = (versionTag!= null ? 60 : 40) + (moveToBranch ? 20 : 0);
- monitor.beginTask(CVSUIMessages.CVSTeamProvider_makeBranch, totalWork);
- try {
- // Build the arguments list
- ICVSResource[] arguments = getCVSArguments(resources);
- LocalOption[] localOptions = getLocalOptions(recurse);
-
- // Tag the remote resources
- IStatus status = null;
- if (versionTag != null) {
- // Version using a custom tag command that skips added but not commited reesources
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
- try {
- status = Command.CUSTOM_TAG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- localOptions,
- versionTag,
- arguments,
- null,
- Policy.subMonitorFor(monitor, 35));
- } finally {
- session.close();
- }
- if (status.isOK()) {
- // Branch using the tag
- session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
- try {
- status = Command.CUSTOM_TAG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- localOptions,
- branchTag,
- arguments,
- null,
- Policy.subMonitorFor(monitor, 15));
- } finally {
- session.close();
- }
- }
- } else {
- // Just branch using tag
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
- try {
- status = Command.CUSTOM_TAG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- localOptions,
- branchTag,
- arguments,
- null,
- Policy.subMonitorFor(monitor, 35));
- } finally {
- session.close();
- }
-
- }
- if ( ! status.isOK()) {
- throw new CVSServerException(status);
- }
-
- // Set the tag of the local resources to the branch tag (The update command will not
- // properly update "cvs added" and "cvs removed" resources so a custom visitor is used
- if (moveToBranch) {
- setTag(provider, resources, branchTag, recurse, Policy.subMonitorFor(monitor, 20));
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * This method sets the tag for a project.
- * It expects to be passed an InfiniteSubProgressMonitor
- */
- private void setTag(final CVSTeamProvider provider, final IResource[] resources, final CVSTag tag, final boolean recurse, IProgressMonitor monitor) throws TeamException {
- getLocalRoot(provider).run(new ICVSRunnable() {
- public void run(IProgressMonitor progress) throws CVSException {
- try {
- // 512 ticks gives us a maximum of 2048 which seems reasonable for folders and files in a project
- progress.beginTask(null, 100);
- final IProgressMonitor monitor = Policy.infiniteSubMonitorFor(progress, 100);
- monitor.beginTask(NLS.bind(CVSUIMessages.CVSTeamProvider_folderInfo, new String[] { provider.getProject().getName() }), 512);
-
- // Visit all the children folders in order to set the root in the folder sync info
- for (int i = 0; i < resources.length; i++) {
- CVSWorkspaceRoot.getCVSResourceFor(resources[i]).accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- monitor.worked(1);
- //ResourceSyncInfo info = file.getSyncInfo();
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- monitor.subTask(NLS.bind(CVSUIMessages.CVSTeamProvider_updatingFile, new String[] { file.getName() }));
- file.setSyncBytes(ResourceSyncInfo.setTag(syncBytes, tag), ICVSFile.UNKNOWN);
- }
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- monitor.worked(1);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null) {
- monitor.subTask(NLS.bind(CVSUIMessages.CVSTeamProvider_updatingFolder, new String[] { info.getRepository() }));
- MutableFolderSyncInfo newInfo = info.cloneMutable();
- newInfo.setTag(tag);
- folder.setFolderSyncInfo(newInfo);
- }
- }
- }, recurse);
- }
- } finally {
- progress.done();
- }
- }
- }, monitor);
- }
-
- private void updateRememberedTags(IResource[] providerResources) throws CVSException {
- if (rootVersionTag != null || update) {
- for (int i = 0; i < providerResources.length; i++) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(providerResources[i]);
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
-
- if (rootVersionTag != null) {
- manager.addTags(cvsResource, new CVSTag[] { rootVersionTag });
- }
- if (update) {
- manager.addTags(cvsResource, new CVSTag[] { branchTag });
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.BranchOperation_0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.BranchOperation_1, new String[] { provider.getProject().getName() });
- }
-
- /**
- * Answers <code>true</code> if all resources in the array have a sticky tag
- */
- private boolean areAllResourcesSticky(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- if(!hasStickyTag(resources[i])) return false;
- }
- return true;
- }
-
- /**
- * Answers <code>true</code> if the resource has a sticky tag
- */
- private boolean hasStickyTag(IResource resource) {
- try {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag tag;
- if(cvsResource.isFolder()) {
- FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- tag = folderInfo.getTag();
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- tag = info.getTag();
- }
- if(tag!=null) {
- int tagType = tag.getType();
- if(tagType==CVSTag.VERSION) {
- return true;
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- return false;
- }
- return false;
- }
-
- private String calculateInitialVersionName(IResource[] resources, boolean allSticky) {
- String versionName = ""; //$NON-NLS-1$
- try {
- if(allSticky) {
- IResource stickyResource = resources[0];
- if(stickyResource.getType()==IResource.FILE) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)stickyResource);
- versionName = cvsFile.getSyncInfo().getTag().getName();
- } else {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)stickyResource);
- versionName = cvsFolder.getFolderSyncInfo().getTag().getName();
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- versionName = ""; //$NON-NLS-1$
- }
- return versionName;
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
deleted file mode 100644
index ebd17a6a9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole;
-import org.eclipse.team.internal.ui.dialogs.MultipleYesNoPrompter;
-import org.eclipse.team.ui.TeamOperation;
-import org.eclipse.ui.IWorkbenchPart;
-
-
-/**
- * This class is the abstract superclass for CVS operations. It provides
- * error handling, prompting and other UI.
- */
-public abstract class CVSOperation extends TeamOperation implements IShellProvider {
-
- private int statusCount;
-
- private boolean involvesMultipleResources = false;
-
- private List errors = new ArrayList(); // of IStatus
-
- protected static final IStatus OK = Status.OK_STATUS;
-
- private Shell shell;
-
- private MultipleYesNoPrompter prompter;
-
- protected CVSOperation(IWorkbenchPart part) {
- super(part);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
- */
- protected String getJobName() {
- return getTaskName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getOperationIcon()
- */
- protected URL getOperationIcon() {
- return Platform.find(CVSUIPlugin.getPlugin().getBundle(), new Path(ICVSUIConstants.ICON_PATH + ICVSUIConstants.IMG_CVS_PERSPECTIVE));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- startOperation();
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- monitor.setTaskName(getTaskName());
- execute(Policy.subMonitorFor(monitor, 100));
- endOperation();
- } catch (CVSException e) {
- // TODO: errors may not be empty (i.e. endOperation has not been executed)
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected void startOperation() {
- statusCount = 0;
- resetErrors();
- }
-
- protected void endOperation() throws CVSException {
- handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()]));
- }
-
- /**
- * Subclasses must override this method to perform the operation.
- * Clients should never call this method directly.
- *
- * @param monitor
- * @throws CVSException
- * @throws InterruptedException
- */
- protected abstract void execute(IProgressMonitor monitor) throws CVSException, InterruptedException;
-
- protected void addError(IStatus status) {
- if (status.isOK()) return;
- if (isLastError(status)) return;
- errors.add(status);
- }
-
- protected void collectStatus(IStatus status) {
- if (isLastError(status)) return;
- statusCount++;
- if (!status.isOK()) addError(status);
- }
-
- protected void resetErrors() {
- errors.clear();
- statusCount = 0;
- }
-
- protected IStatus[] getErrors() {
- return (IStatus[]) errors.toArray(new IStatus[errors.size()]);
- }
-
- /**
- * Get the last error taht occured. This can be useful when a method
- * has a return type but wants to signal an error. The method in question
- * can add the error using <code>addError(IStatus)</code> and return null.
- * The caller can then query the error using this method. Also, <code>addError(IStatus)</code>
- * will not add the error if it is already on the end of the list (using identity comparison)
- * which allows the caller to still perform a <code>collectStatus(IStatus)</code>
- * to get a valid operation count.
- * @return
- */
- protected IStatus getLastError() {
- Assert.isTrue(errors.size() > 0);
- IStatus status = (IStatus)errors.get(errors.size() - 1);
- return status;
- }
-
- private boolean isLastError(IStatus status) {
- return (errors.size() > 0 && getLastError() == status);
- }
-
- /**
- * Throw an exception that contains the given error status
- * @param errors the errors that occurred during the operation
- * @throws CVSException an exception that wraps the errors
- */
- protected void asException(IStatus[] errors) throws CVSException {
- if (errors.length == 0) return;
- if (errors.length == 1 && statusCount == 1) {
- throw new CVSException(errors[0]);
- }
- MultiStatus result = new MultiStatus(CVSUIPlugin.ID, 0, getErrorMessage(errors, statusCount), null);
- for (int i = 0; i < errors.length; i++) {
- IStatus s = errors[i];
- if (s.isMultiStatus()) {
- result.add(new CVSStatus(s.getSeverity(), s.getMessage(), s.getException()));
- result.addAll(s);
- } else {
- result.add(s);
- }
- }
- throw new CVSException(result);
- }
-
- /**
- * Handle the errors that occured during an operation.
- * The default is to throw an exception containing an status
- * that are reportable (determined using <code>isReportableError</code>).
- * @param errors the errors that occurred during the operation.
- * Subclasses may override.
- * @throws CVSException an exception if appropriate
- */
- protected final void handleErrors(IStatus[] errors) throws CVSException {
- // We are only concerned with reportable errors.
- // Others will appear in the console
- List reportableErrors = new ArrayList();
- for (int i = 0; i < errors.length; i++) {
- IStatus status = errors[i];
- if (isReportableError(status)) {
- reportableErrors.add(status);
- } else if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int j = 0; j < children.length; j++) {
- IStatus child = children[j];
- if (isReportableError(child)) {
- reportableErrors.add(status);
- break;
- }
- }
- }
- }
- if (!reportableErrors.isEmpty())
- asException((IStatus[]) reportableErrors.toArray(new IStatus[reportableErrors.size()]));
- }
-
- /**
- * Return whether the given status is reportable. By default,
- * only server errors are reportable. Subclasses may override.
- * @param status an error status
- * @return whether the status is reportable or should be ignored
- */
- protected boolean isReportableError(IStatus status) {
- return status.getCode() == CVSStatus.SERVER_ERROR || CVSStatus.isInternalError(status) || status.getCode() == TeamException.UNABLE;
- }
-
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return NLS.bind(CVSUIMessages.CVSOperation_0, new String[] { String.valueOf(failures.length), String.valueOf(totalOperations) });
- }
-
- /**
- * This method prompts the user to overwrite an existing resource. It uses the
- * <code>involvesMultipleResources</code> to determine what buttons to show.
- * @param resource
- * @param project
- * @return
- */
- protected boolean promptToOverwrite(final String title, final String message, IResource resource) {
- if (prompter == null) {
- prompter = new MultipleYesNoPrompter(this, title, involvesMultipleResources(), false);
- } else {
- prompter.setTitle(title);
- }
- try {
- return prompter.shouldInclude(message);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- /**
- * This method is used by <code>promptToOverwrite</code> to determine which
- * buttons to show in the prompter.
- *
- * @return
- */
- protected boolean involvesMultipleResources() {
- return involvesMultipleResources;
- }
-
- public void setInvolvesMultipleResources(boolean b) {
- involvesMultipleResources = b;
- }
-
- /**
- * Return the string that is to be used as the task name for the operation
- *
- * @param remoteFolders
- * @return
- */
- protected abstract String getTaskName();
-
- /**
- * Return true if any of the accumulated status have a severity of ERROR
- * @return
- */
- protected boolean errorsOccurred() {
- for (Iterator iter = errors.iterator(); iter.hasNext();) {
- IStatus status = (IStatus) iter.next();
- if (isReportableError(status)) return true;
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int j = 0; j < children.length; j++) {
- IStatus child = children[j];
- if (isReportableError(child)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getShell()
- */
- public Shell getShell() {
- // Use the shell assigned to the operation if possible
- if (shell != null && !shell.isDisposed()) {
- return shell;
- }
- return super.getShell();
- }
-
- /**
- * Set the shell to be used by the operation. This only needs
- * to be done if the operation does not have a workbench part.
- * For example, if the operation is being run in a wizard.
- * @param shell The shell to set.
- */
- public void setShell(Shell shell) {
- this.shell = shell;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#canRunAsJob()
- */
- protected boolean canRunAsJob() {
- // Put CVS jobs in the background by default.
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#isSameFamilyAs(org.eclipse.team.ui.TeamOperation)
- */
- protected boolean isSameFamilyAs(TeamOperation operation) {
- // Trat all CVS operations as a single family
- return operation instanceof CVSOperation;
- }
-
- /*
- * Action to show the console that can be used by subclasses
- * that wish to link the progress service to the console
- */
- protected IAction getShowConsoleAction() {
- // Show the console as the goto action
- return new Action(CVSUIMessages.CVSOperation_1) {
- public void run() {
- CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole();
- if (console != null)
- console.show(true);
- }
- public String getToolTipText() {
- return CVSUIMessages.CVSOperation_2;
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
deleted file mode 100644
index c6785f4b8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.IResourceDiff;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.core.synchronize.SyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation that ensures that the contents for base
- * of each local resource is cached.
- */
-public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
-
-
- public CacheBaseContentsOperation(IWorkbenchPart part, ResourceMapping[] mappings, IResourceDiffTree tree, boolean includeOutgoing) {
- super(part, mappings, tree);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#getRemoteFileState(org.eclipse.team.core.diff.IThreeWayDiff)
- */
- protected IFileRevision getRemoteFileState(IThreeWayDiff twd) {
- IResourceDiff diff = (IResourceDiff)twd.getRemoteChange();
- if (diff == null)
- diff = (IResourceDiff)twd.getLocalChange();
- IFileRevision base = diff.getBeforeState();
- return base;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#isEnabledForDirection(int)
- */
- protected boolean isEnabledForDirection(int direction) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#buildTree(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected ICVSRemoteResource buildTree(CVSTeamProvider provider) throws TeamException {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().buildBaseTree(provider.getProject(), true, new NullProgressMonitor());
- }
-
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- IResource[] localChanges = getFilesWithLocalChanges(resources, recurse);
- super.execute(provider, resources, recurse, monitor);
- // Now that the contents are cached, reset the timestamps for any false local changes
- if (localChanges.length > 0) {
- performCleanTimestamps(localChanges[0].getProject(), localChanges, monitor);
- }
- }
-
- private IResource[] getFilesWithLocalChanges(IResource[] resources, boolean recurse) {
- ArrayList result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IDiff[] nodes = getTree().getDiffs(resource, recurse ? IResource.DEPTH_INFINITE: IResource.DEPTH_ONE);
- for (int j = 0; j < nodes.length; j++) {
- IDiff node = nodes[j];
- if (isFileWithLocalChange(node)) {
- result.add(getTree().getResource(node));
- }
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- private boolean isFileWithLocalChange(IDiff node) {
- if (node instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) node;
- return (twd.getDirection() == IThreeWayDiff.OUTGOING || twd.getDirection() == IThreeWayDiff.CONFLICTING)
- && getTree().getResource(node).getType() == IResource.FILE;
- }
- return false;
- }
-
- private void performCleanTimestamps(IProject project, final IResource[] resources, IProgressMonitor monitor) throws CVSException {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- folder.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, resources.length * 100);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.exists() && resource.getType() == IResource.FILE) {
- IResourceVariant remoteResource = (IResourceVariant)CVSWorkspaceRoot.getRemoteResourceFor(resource);
- if (remoteResource != null && comparator.compareContents((IFile)resource, remoteResource, Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
- }
- }
- monitor.done();
- }
- }, Policy.subMonitorFor(monitor, 100));
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java
deleted file mode 100644
index 6b5d03048..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.IResourceDiff;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation that ensures that the contents for remote
- * of each local resource is cached.
- */
-public class CacheRemoteContentsOperation extends CacheTreeContentsOperation {
-
- public CacheRemoteContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, IResourceDiffTree tree) {
- super(part, mappers, tree);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#getRemoteFileState(org.eclipse.team.core.diff.IThreeWayDiff)
- */
- protected IFileRevision getRemoteFileState(IThreeWayDiff twd) {
- IResourceDiff diff = (IResourceDiff)twd.getRemoteChange();
- if (diff == null)
- return null;
- return diff.getAfterState();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#isEnabledForDirection(int)
- */
- protected boolean isEnabledForDirection(int direction) {
- return direction == IThreeWayDiff.CONFLICTING ||
- direction == IThreeWayDiff.INCOMING;
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#buildTree(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected ICVSRemoteResource buildTree(CVSTeamProvider provider) throws TeamException {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().buildRemoteTree(provider.getProject(), true, new NullProgressMonitor());
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
deleted file mode 100644
index 876f12dae..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.IUpdateMessageListener;
-import org.eclipse.team.internal.ccvs.core.client.listeners.UpdateListener;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Abstract operation for caching the contents for any files
- * in a particular remote tree that differ from the local contents.*
- */
-public abstract class CacheTreeContentsOperation extends SingleCommandOperation {
-
- private final IResourceDiffTree tree;
-
- public CacheTreeContentsOperation(IWorkbenchPart part, ResourceMapping[] mappings, IResourceDiffTree tree) {
- super(part, mappings, Command.NO_LOCAL_OPTIONS);
- this.tree = tree;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- IResource[] files = getFilesWithUncachedContents(resources, recurse);
- if (files.length > 0)
- super.execute(provider, files, recurse, monitor);
- }
-
- private IResource[] getFilesWithUncachedContents(IResource[] resources, boolean recurse) {
- ArrayList result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IDiff[] nodes = tree.getDiffs(resource, recurse ? IResource.DEPTH_INFINITE: IResource.DEPTH_ONE);
- for (int j = 0; j < nodes.length; j++) {
- IDiff node = nodes[j];
- if (needsContents(node)) {
- result.add(tree.getResource(node));
- }
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- protected boolean needsContents(IDiff node) {
- if (node instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) node;
- IResource local = getTree().getResource(node);
- IFileRevision remote = getRemoteFileState(twd);
- if (remote != null) {
- IResourceVariant variant = (IResourceVariant)Utils.getAdapter(remote, IResourceVariant.class);
- if (local.getType() == IResource.FILE
- && isEnabledForDirection(twd.getDirection())
- && variant instanceof RemoteFile) {
- RemoteFile rf = (RemoteFile) variant;
- if (!rf.isContentsCached()) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Get the remote file state that is of interest.
- * @param twd a three way diff
- * @return the remote file state that is of interest
- */
- protected abstract IFileRevision getRemoteFileState(IThreeWayDiff twd);
-
- /**
- * Return whether the direction is of interest.
- * @param direction the direction of a diff
- * @return whether the direction is of interest
- */
- protected abstract boolean isEnabledForDirection(int direction);
-
- /* (non-Javadoc)
- *
- * Use a local root that is really the base tree so we can cache
- * the base contents without affecting the local contents.
- *
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getLocalRoot(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected ICVSFolder getLocalRoot(CVSTeamProvider provider)
- throws CVSException {
- try {
- ICVSRemoteResource tree = buildTree(provider);
- return (ICVSFolder)tree;
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- protected abstract ICVSRemoteResource buildTree(CVSTeamProvider provider) throws TeamException;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getCVSArguments(org.eclipse.core.resources.IResource[])
- */
- protected ICVSResource[] getCVSArguments(Session session, IResource[] resources) {
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- try {
- ICVSResource file = session.getLocalRoot().getChild(resource.getProjectRelativePath().toString());
- result.add(file);
- } catch (CVSException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
-
- return (ICVSResource[]) result.toArray(new ICVSResource[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- return Command.UPDATE.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(true),
- resources,
- new UpdateListener(new IUpdateMessageListener() {
- public void fileInformation(int type, ICVSFolder parent, String filename) {
- // Do nothing
- }
- public void fileDoesNotExist(ICVSFolder parent, String filename) {
- // Do nothing
- }
- public void directoryInformation(ICVSFolder commandRoot, String path,
- boolean newDirectory) {
- // Do nothing
- }
- public void directoryDoesNotExist(ICVSFolder commandRoot, String path) {
- // Do nothing
- }
- }),
- monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#getLocalOptions(boolean)
- */
- protected LocalOption[] getLocalOptions(boolean recurse) {
- return Update.IGNORE_LOCAL_CHANGES.addTo(super.getLocalOptions(recurse));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.CacheTreeContentsOperation_0, new String[] {provider.getProject().getName()});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.CacheTreeContentsOperation_1;
- }
-
- /**
- * Return the diff tree whose contents are being cached
- * @return
- */
- protected IResourceDiffTree getTree() {
- return tree;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings()
- */
- public boolean consultModelsForMappings() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#isReportableError(org.eclipse.core.runtime.IStatus)
- */
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status) && status.getSeverity() == IStatus.ERROR;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
deleted file mode 100644
index 385026a7b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This method checks out one or more remote folders from the same repository
- * into an existing project or folder in the workspace. The target project
- * must either be shared with the same repository or it must not be shared
- * with any repository
- */
-public class CheckoutIntoOperation extends CheckoutOperation {
-
- private boolean recursive;
- private ICVSFolder localFolder;
- private String localFolderName;
-
- /**
- * Constructor which takes a set of remote folders and the local folder into which the folders should be
- * loaded.
- */
- public CheckoutIntoOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, IContainer localFolder, boolean recursive) {
- super(part, remoteFolders);
- this.recursive = recursive;
- this.localFolder = CVSWorkspaceRoot.getCVSFolderFor(localFolder);
- }
-
- /**
- * Constructor which takes a single remote folder and the target local folder.
- */
- public CheckoutIntoOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IContainer localFolder, boolean recursive) {
- this(part, new ICVSRemoteFolder[] { remoteFolder }, localFolder.getParent(), recursive);
- this.localFolderName = localFolder.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#getTaskName()
- */
- protected String getTaskName() {
- ICVSRemoteFolder[] remoteFolders = getRemoteFolders();
- String localFolderName = ""; //$NON-NLS-1$
- localFolderName = getLocalFolder().getIResource().getFullPath().toString();
- return NLS.bind(CVSUIMessages.CheckoutIntoOperation_taskname, new String[] { new Integer(remoteFolders.length).toString(), localFolderName });
- }
-
- /**
- * @return
- */
- public ICVSFolder getLocalFolder() {
- return localFolder;
- }
-
- /**
- * @return
- */
- public boolean isRecursive() {
- return recursive;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(final ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
- final IStatus[] result = new IStatus[] { null };
- try {
- // Wrap in a workspace runnable to avoid auto-build.
- // This is necessary because CVS has a POST_BUILD
- // listener that will clear the sync info from
- // orphaned (i.e. unmanaged) subtrees and we will
- // purposely create some which we subsequently manage
- // from their parent (see manageFolders())
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- result[0] = checkout(folder, getLocalFolder(), isRecursive(), monitor);
- }
- }, getSchedulingRule(), 0, monitor);
- } catch (CoreException e) {
- result[0] = CVSException.wrapException(e).getStatus();
- }
- return result[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void checkout(final ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
- // Batch sync info changes with the CVS synchronizer to optimize cache writing
- EclipseSynchronizer.getInstance().run(getSchedulingRule(), new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 100);
- try {
- // Obtain a scheduling rule on the projects were about to overwrite
- CheckoutIntoOperation.super.checkout(folders, Policy.subMonitorFor(monitor, 90));
- refreshRoot(getLocalRoot(getLocalFolder()), Policy.subMonitorFor(monitor, 10));
- } finally {
- monitor.done();
- }
- }
- }, Policy.monitorFor(monitor));
- }
-
- /*
- * Prepare the local folders to receive the remote folders. If localFolderName is not null, then
- * if will be the only target folder of the checkout. Otherwise, the remote folder
- * could expand to multiple local folders witinb the given parent folder.
- */
- private ICVSFolder[] prepareLocalFolders(Session session, ICVSRemoteFolder remoteFolder, ICVSFolder parentFolder, String localFolderName, IProgressMonitor monitor) throws CVSException {
- Set targetFolderSet = new HashSet();
- monitor.beginTask(null, 30);
- if (localFolderName == null) {
-
- // Determine which local folders will be afected
- IStatus status = Request.EXPAND_MODULES.execute(session, new String[] { remoteFolder.getRepositoryRelativePath()}, Policy.subMonitorFor(monitor, 10));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- addError(status);
- return null;
- }
-
- // Convert the module expansions to target folders
- String[] expansions = session.getModuleExpansions();
- for (int j = 0; j < expansions.length; j++) {
- String childPath = new Path(null, expansions[j]).segment(0);
- ICVSResource resource = parentFolder.getChild(childPath);
- if (resource != null && !resource.isFolder()) {
- // The target folder conflicts with an existing file
- addError(new CVSStatus(IStatus.ERROR, NLS.bind(CVSUIMessages.CheckoutIntoOperation_targetIsFile, new String[] { remoteFolder.getName(), resource.getIResource().getFullPath().toString() })));
- return null;
- }
- targetFolderSet.add(parentFolder.getFolder(childPath));
- }
-
- } else {
- targetFolderSet.add(parentFolder.getFolder(localFolderName));
- }
-
- final ICVSFolder[] targetFolders = (ICVSFolder[]) targetFolderSet.toArray(new ICVSFolder[targetFolderSet.size()]);
-
- // Ensure that the checkout will not conflict with existing resources
- IStatus status = validateTargetFolders(remoteFolder, targetFolders, Policy.subMonitorFor(monitor, 10));
- if (!status.isOK()) {
- addError(status);
- return null;
- }
-
- // Prepare the target projects to receive resources
- status = scrubFolders(remoteFolder, targetFolders, Policy.subMonitorFor(monitor, 10));
- // return the target projects if the scrub succeeded
- if (status.isOK()) {
- return targetFolders;
- } else {
- addError(status);
- return null;
- }
- }
-
- /*
- * Ensure that the new folders will not conflict with existing folders (even those that are pruned).
- */
- private IStatus validateTargetFolders(ICVSRemoteFolder remoteFolder, ICVSFolder[] targetFolders, IProgressMonitor monitor) throws CVSException {
- for (int i = 0; i < targetFolders.length; i++) {
- ICVSFolder targetFolder = targetFolders[i];
- FolderSyncInfo localInfo = targetFolder.getFolderSyncInfo();
- FolderSyncInfo remoteInfo = remoteFolder.getFolderSyncInfo();
-
- if (!remoteInfo.isSameMapping(localInfo)) {
- if (localInfo != null ) {
- if (isRemoteChildOfParent(targetFolder)) {
- // if the local folder is child of it's parent remotely (i.e. path of child is parent/child)
- // then the remote cannot be loaded.
- String message;
- if (targetFolder.exists()) {
- message = NLS.bind(CVSUIMessages.CheckoutIntoOperation_targetIsFolder, new String[] { remoteFolder.getName(), targetFolder.getIResource().getFullPath().toString() });
- } else {
- message = NLS.bind(CVSUIMessages.CheckoutIntoOperation_targetIsPrunedFolder, new String[] { remoteFolder.getName(), targetFolder.getFolderSyncInfo().getRepository() });
- }
- return new CVSStatus(IStatus.ERROR, message);
- }
- }
- // Verify that no other folders in the local workspace are mapped to the remote folder
- IStatus status = validateUniqueMapping(remoteFolder, targetFolder, Policy.subMonitorFor(monitor, 10));
- if (!status.isOK()) return status;
- }
- }
- return OK;
- }
-
- /*
- * Return true if the given local folder is a direct descendant of it's local parent in
- * the repository as well
- */
- private boolean isRemoteChildOfParent(ICVSFolder targetFolder) throws CVSException {
- FolderSyncInfo localInfo = targetFolder.getFolderSyncInfo();
- if (localInfo == null) return false;
- FolderSyncInfo parentInfo = targetFolder.getParent().getFolderSyncInfo();
- if (parentInfo == null) return false;
- IPath childPath = new Path(null, localInfo.getRepository());
- IPath parentPath = new Path(null, parentInfo.getRepository());
- return parentPath.isPrefixOf(childPath);
- }
-
- /**
- * @param targetFolder
- * @return
- */
- private IContainer getLocalRoot(ICVSFolder targetFolder) throws CVSException {
- return targetFolder.getIResource().getProject();
- }
-
- /*
- * Ensure that there is no equivalent mapping alreay in the local workspace
- */
- private IStatus validateUniqueMapping(final ICVSRemoteFolder remoteFolder, final ICVSFolder targetFolder, IProgressMonitor iProgressMonitor) throws CVSException {
-
- final IContainer root = getLocalRoot(targetFolder);
- final FolderSyncInfo remoteInfo = remoteFolder.getFolderSyncInfo();
- if (remoteInfo.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)) {
- // We can't really check the mapping ahead of time
- // so we'll let the operation continue
- return OK;
- }
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(root);
- try {
- cvsFolder.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // do nothing
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- if (!folder.isCVSFolder()) return;
- IResource resource = folder.getIResource();
- if (resource == null) return;
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info.isSameMapping(remoteInfo)) {
- throw new CVSException(NLS.bind(CVSUIMessages.CheckoutIntoOperation_mappingAlreadyExists, (new Object[] {
- remoteFolder.getName(),
- targetFolder.getIResource().getFullPath().toString(),
- resource.getFullPath().toString()
- })));
- }
- folder.acceptChildren(this);
- }
- });
- } catch (CVSException e) {
- return e.getStatus();
- }
- return OK;
- }
-
- /*
- * Purge the local contents of the given folders
- */
- private IStatus scrubFolders(ICVSRemoteFolder remoteFolder, ICVSFolder[] targetFolders, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 100 * targetFolders.length);
-
- // Prompt first before any work is done
- if (targetFolders.length > 1) {
- setInvolvesMultipleResources(true);
- }
- for (int i=0;i<targetFolders.length;i++) {
- ICVSFolder targetFolder = targetFolders[i];
- if (needsPromptForOverwrite(targetFolder, Policy.subMonitorFor(monitor, 50)) && !promptToOverwrite(targetFolder)) {
- return new CVSStatus(IStatus.INFO, NLS.bind(CVSUIMessages.CheckoutIntoOperation_cancelled, new String[] { remoteFolder.getName() }));
- }
- }
-
- for (int i = 0; i < targetFolders.length; i++) {
- IStatus status = scrubFolder(targetFolders[i], Policy.subMonitorFor(monitor, 50));
- if (!status.isOK()) return status;
- }
- monitor.done();
- return OK;
- }
-
- private boolean needsPromptForOverwrite(ICVSFolder targetFolder, IProgressMonitor monitor) throws CVSException {
- return targetFolder.isModified(monitor);
- }
-
- private boolean promptToOverwrite(ICVSFolder folder) {
- return promptToOverwrite(
- CVSUIMessages.CheckoutOperation_confirmOverwrite,
- NLS.bind(CVSUIMessages.CheckoutIntoOperation_overwriteMessage, new String[] { folder.getName() }),
- folder.getIResource());
- }
-
- private IStatus scrubFolder(ICVSFolder folder, IProgressMonitor monitor) throws CVSException {
- if (folder.exists() || folder.isCVSFolder()) {
- // Unmanage first so we don't get outgoing deletions
- folder.unmanage(Policy.subMonitorFor(monitor, 50));
- if (folder.exists()) folder.delete();
- }
- return OK;
- }
-
- /* private */ IStatus checkout(final ICVSRemoteFolder remoteFolder, ICVSFolder parentFolder, boolean recurse, IProgressMonitor monitor) throws CVSException {
- // Open a connection session to the repository
- monitor.beginTask(null, 100);
- ICVSRepositoryLocation repository = remoteFolder.getRepository();
- Session session = new Session(repository, parentFolder);
- try {
- session.open(Policy.subMonitorFor(monitor, 5), false /* read-only */);
-
- // Determine which local folders will be affected
- String localName = localFolderName;
- if (localName == null) {
- IPath path = new Path(null, remoteFolder.getRepositoryRelativePath());
- if (path.segmentCount() > 1) {
- localName = path.lastSegment();
- }
- }
- ICVSFolder[] targetFolders = prepareLocalFolders(session, remoteFolder, parentFolder, localName, Policy.subMonitorFor(monitor, 5));
- if (targetFolders == null) {
- // an error occured and has been added to the operation's error list
- return getLastError();
- }
-
- // Add recurse option
- List localOptions = new ArrayList();
- if (!recurse)
- localOptions.add(Command.DO_NOT_RECURSE);
- if (localName != null) {
- localOptions.add(Checkout.makeDirectoryNameOption(localName));
- }
-
- // Prune empty directories if pruning enabled
- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories())
- localOptions.add(Command.PRUNE_EMPTY_DIRECTORIES);
- // Add the options related to the CVSTag
- CVSTag tag = remoteFolder.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
-
- // Perform the checkout
- IStatus status = Command.CHECKOUT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[] { remoteFolder.getRepositoryRelativePath() },
- null,
- Policy.subMonitorFor(monitor, 80));
- if (!status.isOK()) {
- return status;
- }
-
- manageFolders(targetFolders, repository.getLocation(false));
-
- return OK;
-
- } finally {
- session.close();
- }
- }
-
- private void manageFolders(ICVSFolder[] targetFolders, String root) throws CVSException {
- for (int i = 0; i < targetFolders.length; i++) {
- manageFolder(targetFolders[i], root);
- }
- }
-
- private static void manageFolder(ICVSFolder folder, String root) throws CVSException {
- // Ensure that the parent is a CVS folder
- ICVSFolder parent = folder.getParent();
- if (!parent.isCVSFolder()) {
- parent.setFolderSyncInfo(new FolderSyncInfo(FolderSyncInfo.VIRTUAL_DIRECTORY, root, CVSTag.DEFAULT, true));
- IResource resource = parent.getIResource();
- if (resource.getType() != IResource.PROJECT) {
- manageFolder(parent, root);
- }
- }
- // reset the folder sync info so it will be managed by it's parent
- folder.setFolderSyncInfo(folder.getFolderSyncInfo());
- }
-
- /*
- * Bring the provided projects into the workspace
- */
- private static void refreshRoot(IContainer root, IProgressMonitor monitor) throws CVSException {
- try {
- IProject project = root.getProject();
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- if (folder.isCVSFolder()) {
- // Register the project with Team
- RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
-
- // TODO: This should be somewhere else
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- provider.setWatchEditEnabled(CVSProviderPlugin.getPlugin().isWatchEditEnabled());
- }
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getSchedulingRule()
- */
- protected ISchedulingRule getSchedulingRule() {
- //use the modfiy rule for the time being
- //TODO: Just lock the project not the entire workspace (so can't use modifyRule)
- //since the project already exists
- IProject tempProject = getLocalFolder().getIResource().getProject();
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
- return ruleFactory.modifyRule(tempProject);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java
deleted file mode 100644
index 2777e0a2f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation checks out a multiple remote folders into the workspace.
- * Each one will become a new project (overwritting any exsiting projects
- * with the same name).
- */
-public class CheckoutMultipleProjectsOperation extends CheckoutProjectOperation {
-
- boolean hasTargetLocation;
- //The name of the working set to add all of the projects to
- String workingSetName;
-
- public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation) {
- this(part,remoteFolders,targetLocation,null);
- }
-
- public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation, String wsName) {
- super(part, remoteFolders, targetLocation);
- hasTargetLocation = targetLocation != null;
- setInvolvesMultipleResources(remoteFolders.length > 1);
- this.workingSetName=wsName;
- }
-
- /**
- * Return the target location where the given project should be located or
- * null if the default location should be used.
- *
- * @param project
- */
- protected IPath getTargetLocationFor(IProject project) {
- IPath targetLocation = super.getTargetLocationFor(project);
- if (targetLocation == null) return null;
- return targetLocation.append(project.getName());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
- return checkout(folder, null, monitor);
- }
-
- protected String getWorkingSetName(){
- return workingSetName;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
deleted file mode 100644
index 8298c9b69..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class CheckoutOperation extends RemoteOperation {
-
- public CheckoutOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders) {
- super(part, remoteFolders);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteFolder[] folders = getRemoteFolders();
- checkout(folders, monitor);
- }
-
- /**
- * This method invokes <code>checkout(ICVSRemoteFolder, IProgressMonitor)</code>
- * for each remote folder of the operation.
- * @param folders the remote folders for the operation
- * @param monitor the progress monitor
- * @throws CVSException if an error occured that should prevent the remaining
- * folders from being checked out
- */
- protected void checkout(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, folders.length * 100);
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
- IStatus result = checkout(folder, Policy.subMonitorFor(monitor, 100));
- collectStatus(result);
- Policy.checkCanceled(monitor);
- }
- monitor.done();
- }
-
- protected ICVSRemoteFolder[] getRemoteFolders() {
- return (ICVSRemoteFolder[])getRemoteResources();
- }
-
- /**
- * Checkout the selected remote folders in a form appropriate for the operation subclass.
- * @param folders
- * @param monitor
- */
- protected abstract IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
- */
- public boolean canRunAsJob() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#isKeepOneProgressServiceEntry()
- */
- public boolean isKeepOneProgressServiceEntry() {
- // Keep the last repository provider operation in the progress service
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getGotoAction()
- */
- protected IAction getGotoAction() {
- return getShowConsoleAction();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
deleted file mode 100644
index 8847c0eab..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.wizards.WorkingSetsDialog;
-import org.eclipse.ui.*;
-/**
- * This class acts as an abstract class for checkout operations.
- * It provides a few common methods.
- */
-public abstract class CheckoutProjectOperation extends CheckoutOperation {
-
- private String targetLocation;
-
- public CheckoutProjectOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation) {
- super(part, remoteFolders);
- this.targetLocation = targetLocation;
- }
-
- /**
- * Create and open the project, using a custom location if there is one.
- *
- * @param project
- * @param monitor
- * @throws CVSException
- */
- protected void createAndOpenProject(IProject project, IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 5);
- IProjectDescription desc = getDescriptionFor(project);
- if (project.exists()) {
- if (desc != null) {
- project.move(desc, true, Policy.subMonitorFor(monitor, 3));
- }
- } else {
- if (desc == null) {
- // create in default location
- project.create(Policy.subMonitorFor(monitor, 3));
- } else {
- // create in some other location
- project.create(desc, Policy.subMonitorFor(monitor, 3));
- }
- }
- if (!project.isOpen()) {
- project.open(Policy.subMonitorFor(monitor, 2));
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected IProjectDescription getDescriptionFor(IProject project) {
- if (targetLocation == null) return null;
- String projectName = project.getName();
- IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
- description.setLocation(getTargetLocationFor(project));
- return description;
- }
-
- /**
- * Return the target location where the given project should be located or
- * null if the default location should be used.
- *
- * @param project
- */
- protected IPath getTargetLocationFor(IProject project) {
- if (targetLocation == null) return null;
- return new Path(targetLocation);
- }
-
- protected String getRemoteModuleName(ICVSRemoteFolder resource) {
- String moduleName;
- if (resource.isDefinedModule()) {
- moduleName = resource.getName();
- } else {
- moduleName = resource.getRepositoryRelativePath();
- }
- return moduleName;
- }
-
- protected IStatus checkout(final ICVSRemoteFolder resource, IProject project, IProgressMonitor pm) throws CVSException {
- // Get the location and the workspace root
- ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot());
- ICVSRepositoryLocation repository = resource.getRepository();
- // Open a connection session to the repository
- final Session session = new Session(repository, root);
- pm.beginTask(null, 100);
- Policy.checkCanceled(pm);
- session.open(Policy.subMonitorFor(pm, 5), false /* read-only */);
- try {
-
- // Check to see if the entire repo is being checked out.
- if (project == null && resource.getName().equals(".")) { //$NON-NLS-1$
- // No project was specified but we need on for this to work
- String name = new Path(null, resource.getRepository().getRootDirectory()).lastSegment();
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
-
- // Check to see if using remote metafile project description name is preferred
- if (project == null
- && CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout()
- && resource instanceof RemoteProjectFolder) {
- RemoteProjectFolder rpf = (RemoteProjectFolder) resource;
- if (rpf.hasProjectName())
- {
- // no project was specified but we need to attempt the creation of one
- // based on the metafile project name
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(rpf.getProjectName());
- }
- }
-
- // Determine the local target projects (either the project provider or the module expansions)
- // Note: Module expansions can be run over the same connection as a checkout
- final IProject[] targetProjects = determineProjects(session, resource, project, Policy.subMonitorFor(pm, 5));
- if (targetProjects == null) {
- // An error occurred and was recorded so return it
- return getLastError();
- } else if (targetProjects.length == 0) {
- return OK;
- }
-
- final boolean sendModuleName = project != null;
- final IStatus[] result = new IStatus[] { null };
- final ISchedulingRule schedulingRule = getSchedulingRule(targetProjects);
- if (schedulingRule instanceof IResource && ((IResource)schedulingRule).getType() == IResource.ROOT) {
- // One of the projects is mapped to a provider that locks the workspace.
- // Just return the workspace root rule
- try {
- Job.getJobManager().beginRule(schedulingRule, pm);
- // Still use the projects as the inner rule so we get the proper batching of sync info write
- EclipseSynchronizer.getInstance().run(MultiRule.combine(targetProjects), new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = performCheckout(session, resource, targetProjects, sendModuleName, monitor);
- }
- }, Policy.subMonitorFor(pm, 90));
- } finally {
- Job.getJobManager().endRule(schedulingRule);
- }
- } else {
- EclipseSynchronizer.getInstance().run(schedulingRule, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = performCheckout(session, resource, targetProjects, sendModuleName, monitor);
- }
- }, Policy.subMonitorFor(pm, 90));
- }
- String wsName = getWorkingSetName();
- if (wsName != null){
- createWorkingSet(wsName, targetProjects);
- }
- return result[0];
- } catch (CVSException e) {
- // An exception occurred either during the module-expansion or checkout
- // Since we were able to make a connection, return the status so the
- // checkout of any other modules can proceed
- return new CVSStatus(e.getStatus().getSeverity(), NLS.bind(CVSUIMessages.CheckoutProjectOperation_1, new String[] {resource.getRepositoryRelativePath(), e.getMessage()}), e);
- } finally {
- session.close();
- pm.done();
- }
- }
-
- private ISchedulingRule getSchedulingRule(IProject[] projects) {
- if (projects.length == 1) {
- return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[0]);
- } else {
- Set rules = new HashSet();
- for (int i = 0; i < projects.length; i++) {
- ISchedulingRule modifyRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[i]);
- if (modifyRule instanceof IResource && ((IResource)modifyRule).getType() == IResource.ROOT) {
- // One of the projects is mapped to a provider that locks the workspace.
- // Just return the workspace root rule
- return modifyRule;
- }
- rules.add(modifyRule);
- }
- return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
- }
- }
-
- /* private */ IStatus performCheckout(Session session, ICVSRemoteFolder resource, IProject[] targetProjects, boolean sendModuleName, IProgressMonitor pm) throws CVSException {
- // Set the task name of the progress monitor to let the user know
- // which project we're on. Don't use subTask since that will be
- // changed when the checkout command is run.
- String taskName;
- if (targetProjects.length == 1) {
- taskName = NLS.bind(CVSUIMessages.CheckoutProjectOperation_8, new String[] { resource.getName(), targetProjects[0].getName() });
- } else {
- taskName = NLS.bind(CVSUIMessages.CheckoutProjectOperation_9, new String[] { resource.getName(), String.valueOf(targetProjects.length) });
- }
- pm.beginTask(taskName, 100);
- pm.setTaskName(taskName);
- Policy.checkCanceled(pm);
- try {
- // Scrub the local contents if requested
- if (performScrubProjects()) {
- IStatus result = scrubProjects(resource, targetProjects, Policy.subMonitorFor(pm, 9));
- if (!result.isOK()) {
- return result;
- }
- }
-
- // Determine if t
- // in which case we'll use -d to flatten the directory structure.
- // Only flatten the directory structure if the folder is not a root folder
- IProject project = null;
- if (targetProjects.length == 1) {
- if (sendModuleName) {
- project = targetProjects[0];
- } else if (targetProjects[0].getName().equals(resource.getName())) {
- // The target project has the same name as the remote folder.
- // If the repository relative path has multiple segments
- // we will want to flatten the directory structure
- String path = resource.getRepositoryRelativePath();
- if (!path.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)
- && new Path(null, path).segmentCount() > 1) {
- project = targetProjects[0];
- }
- }
- }
-
- try {
- // Build the local options
- List localOptions = new ArrayList();
- // Add the option to load into the target project if one was supplied
- if (project != null) {
- localOptions.add(Checkout.makeDirectoryNameOption(project.getName()));
- }
- // Prune empty directories if pruning enabled
- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories())
- localOptions.add(Command.PRUNE_EMPTY_DIRECTORIES);
- // Add the options related to the CVSTag
- CVSTag tag = resource.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
- if (!isRecursive())
- localOptions.add(Command.DO_NOT_RECURSE);
-
- // Perform the checkout
- IStatus status = Command.CHECKOUT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[]{getRemoteModuleName(resource)},
- null,
- Policy.subMonitorFor(pm, 90));
- return status;
- } finally {
- // Map the projects if they have CVS meta infomation even if a failure occurred
- refreshProjects(targetProjects, Policy.subMonitorFor(pm, 1));
- }
- } finally {
- pm.done();
- }
- }
-
- protected boolean isRecursive() {
- return true;
- }
-
- /*
- * Determine the workspace project(s) that will be affected by the checkout.
- * If project is not null, then it will be the only target project of the checkout.
- * Otherwise, the remote folder could expand to multiple projects.
- *
- * If the remote resource is a folder which is not a root folder (i.e. a/b/c),
- * then the target project will be the last segment (i.e. c).
- */
- private IProject[] determineProjects(Session session, final ICVSRemoteFolder remoteFolder, IProject project, IProgressMonitor pm) throws CVSException {
-
- Set targetProjectSet = new HashSet();
- String moduleName = getRemoteModuleName(remoteFolder);
- if (project == null) {
-
- // Fetch the module expansions
- Policy.checkCanceled(pm);
- IStatus status = Request.EXPAND_MODULES.execute(session, new String[] {moduleName}, pm);
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- collectStatus(status);
- return null;
- }
-
- // Convert the module expansions to local projects
- String[] expansions = session.getModuleExpansions();
- if (expansions.length == 1 && expansions[0].equals(moduleName)) {
- // For a remote folder, use the last segment as the project to be created
- String lastSegment = new Path(null, expansions[0]).lastSegment();
- // if using metafile project name is preferred, use it
- if (CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout() && remoteFolder instanceof RemoteProjectFolder) {
- RemoteProjectFolder rpf = (RemoteProjectFolder) remoteFolder;
- if (rpf.hasProjectName()) {
- lastSegment = rpf.getProjectName();
- }
- }
- targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(lastSegment));
- } else {
- for (int j = 0; j < expansions.length; j++) {
- targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(null, expansions[j]).segment(0)));
- }
- }
-
- } else {
- targetProjectSet.add(project);
- }
-
- // Return the local projects affected by the checkout
- IProject[] targetProjects = (IProject[]) targetProjectSet.toArray(new IProject[targetProjectSet.size()]);
- return targetProjects;
- }
-
- /**
- * Return true if the target projects should be scrubbed before the checkout occurs.
- * Default is to scrub the projects. Can be overridden by subclasses.
- */
- protected boolean performScrubProjects() {
- return true;
- }
-
- /*
- * This method is invoked to scrub the local projects that are the check out target of
- * a single remote module.
- */
- private IStatus scrubProjects(ICVSRemoteFolder remoteFolder, IProject[] projects, IProgressMonitor monitor) throws CVSException {
- if (projects == null) {
- monitor.done();
- return OK;
- }
- // Prompt first before any work is done
- if (projects.length > 1) {
- setInvolvesMultipleResources(true);
- }
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
- Policy.checkCanceled(monitor);
- if (needsPromptForOverwrite(project) && !promptToOverwrite(remoteFolder, project)) {
- // User said no to this project but not no to all
- return new CVSStatus(IStatus.INFO, IStatus.CANCEL, NLS.bind(CVSUIMessages.CheckoutProjectOperation_0, new String[] { remoteFolder.getRepositoryRelativePath() }), remoteFolder);
- }
- }
- // Create the projects and remove any previous content
- monitor.beginTask(null, projects.length * 100);
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
- createAndOpenProject(project, Policy.subMonitorFor(monitor, 10));
- scrubProject(project, Policy.subMonitorFor(monitor, 90));
- }
- monitor.done();
- return OK;
- }
-
- private void scrubProject(IProject project, IProgressMonitor monitor) throws CVSException {
- try {
- // unmap the project from any previous repository provider
- if (RepositoryProvider.getProvider(project) != null)
- RepositoryProvider.unmap(project);
- // We do not want to delete the project to avoid a project deletion delta
- // We do not want to delete the .project to avoid core exceptions
- IResource[] children = project.members(IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
- Policy.checkCanceled(monitor);
- monitor.beginTask(null, 100 + children.length * 100);
- monitor.subTask(NLS.bind(CVSUIMessages.CheckoutOperation_scrubbingProject, new String[] { project.getName() })); //
- try {
- for (int j = 0; j < children.length; j++) {
- if ( ! children[j].getName().equals(".project")) {//$NON-NLS-1$
- children[j].delete(true /*force*/, Policy.subMonitorFor(monitor, 100));
- }
- }
- // Make sure there is no sync info cached for the project since
- // a reader thread may have caused it to be loaded since the unmap.
- EclipseSynchronizer.getInstance().flush(project, true, Policy.subMonitorFor(monitor, 100));
- } finally {
- monitor.done();
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- protected boolean needsPromptForOverwrite(IProject project) {
-
- // First, check the description location
- IProjectDescription desc = getDescriptionFor(project);
- if (desc != null) {
- File localLocation = desc.getLocation().toFile();
- if (localLocation.exists()) return true;
- }
-
- // Next, check if the resource itself exists
- if (project.exists()) return true;
-
- // Finally, check if the location in the workspace exists;
- File localLocation = getFileLocation(project);
- if (localLocation.exists()) return true;
-
- // The target doesn't exist
- return false;
- }
-
- protected File getFileLocation(IProject project) {
- return new File(project.getParent().getLocation().toFile(), project.getName());
- }
-
- private boolean promptToOverwrite(ICVSRemoteFolder remoteFolder, IProject project) {
- // First, if the project exists in the workspace, prompt
- if (project.exists()) {
- if (!promptToOverwrite(
- CVSUIMessages.CheckoutOperation_confirmOverwrite,
- NLS.bind(CVSUIMessages.CheckoutOperation_thisResourceExists, new String[] { project.getName(), getRemoteModuleName(remoteFolder) }),
- project)) {
- return false;
- }
- }
- // Even if the project exists, check the target location
- IPath path = getTargetLocationFor(project);
- File localLocation = null;
- if (path == null) {
- try {
- // There is no custom location. However, still prompt
- // if the project directory in the workspace directory
- // would be overwritten.
- if (!project.exists() || !project.isOpen() || project.getDescription().getLocation() != null) {
- localLocation = getFileLocation(project);
- }
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- } else {
- localLocation = path.toFile();
- }
- if (localLocation != null && localLocation.exists()) {
- try {
- return (promptToOverwrite(
- CVSUIMessages.CheckoutOperation_confirmOverwrite,
- NLS.bind(CVSUIMessages.CheckoutOperation_thisExternalFileExists, new String[] { localLocation.getCanonicalPath(), getRemoteModuleName(remoteFolder) }),
- project));
- } catch (IOException e) {
- CVSUIPlugin.log(CVSException.wrapException(e));
- }
- }
- return true;
- }
-
- /*
- * Bring the provied projects into the workspace
- */
- private void refreshProjects(IProject[] projects, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, projects.length * 100);
- try {
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- // Register the project with Team
- try {
- monitor.subTask(NLS.bind(CVSUIMessages.CheckoutOperation_refreshingProject, new String[] { project.getName() }));
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- if (folder.isCVSFolder()) {
- RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider != null) {
- provider.setWatchEditEnabled(CVSProviderPlugin.getPlugin().isWatchEditEnabled());
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- protected String getTaskName() {
- ICVSRemoteFolder[] remoteFolders = getRemoteFolders();
- if (remoteFolders.length == 1) {
- return NLS.bind(CVSUIMessages.CheckoutSingleProjectOperation_taskname, new String[] { remoteFolders[0].getName() });
- } else {
- return NLS.bind(CVSUIMessages.CheckoutMultipleProjectsOperation_taskName, new String[] { new Integer(remoteFolders.length).toString() });
- }
- }
-
- /* private */ void createWorkingSet(String workingSetName, IProject[] projects) {
- IWorkingSetManager manager = CVSUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSet oldSet = manager.getWorkingSet(workingSetName);
- if (oldSet == null) {
- IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects);
- newSet.setId(WorkingSetsDialog.resourceWorkingSetId);
- manager.addWorkingSet(newSet);
- } else {
- //don't overwrite the old elements
- IAdaptable[] tempElements = oldSet.getElements();
- IAdaptable[] adaptedProjects = oldSet.adaptElements(projects);
- IAdaptable[] finalElementList = new IAdaptable[tempElements.length + adaptedProjects.length];
- System.arraycopy(tempElements, 0, finalElementList, 0, tempElements.length);
- System.arraycopy(adaptedProjects, 0,finalElementList, tempElements.length, adaptedProjects.length);
- oldSet.setElements(finalElementList);
- }
- }
-
- /*
- * Returns the name of the working set to add the checked out projects to or null for none
- */
- protected String getWorkingSetName(){
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java
deleted file mode 100644
index 39814160e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation checks out a single remote folder into the workspace as
- * a project.
- */
-public class CheckoutSingleProjectOperation extends CheckoutProjectOperation {
-
- private boolean preconfigured;
- private IProject targetProject;
- private String workingSetName;
-
- public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured) {
- this(part,remoteFolder,targetProject,targetLocation,preconfigured,null);
- }
-
- public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured, String wsName) {
- super(part, new ICVSRemoteFolder[] { remoteFolder }, targetLocation);
- this.targetProject = targetProject;
- this.preconfigured = preconfigured;
- this.workingSetName = wsName;
- }
-
- private boolean isPreconfigured() {
- return preconfigured;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#needsPromptForOverwrite(org.eclipse.core.resources.IProject)
- */
- public boolean needsPromptForOverwrite(IProject project) {
- // No need to prompt if the project was preconfigured
- if (isPreconfigured()) return false;
- return super.needsPromptForOverwrite(project);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutProjectOperation#performScrubProjects()
- */
- protected boolean performScrubProjects() {
- // Do not scrub the projects if they were preconfigured.
- return !isPreconfigured();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
- return checkout(folder, targetProject, monitor);
- }
-
- protected String getWorkingSetName(){
- return workingSetName;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java
deleted file mode 100644
index 0811d754d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderSandbox;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Checkout a remote folder into a sandbox that is contained within remote folder handles and
- * the file contents cache.
- */
-public class CheckoutToRemoteFolderOperation extends CheckoutOperation {
-
- RemoteFolderSandbox sandbox;
-
- /**
- * This class overrides the "Created" handler in order to configure the remote file
- * to recieve and cache the contents
- */
- public class CreatedResponseHandler extends UpdatedHandler {
- public CreatedResponseHandler() {
- super(UpdatedHandler.HANDLE_CREATED);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.UpdatedHandler#receiveTargetFile(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.ICVSFile, java.lang.String, java.util.Date, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void receiveTargetFile(
- Session session,
- ICVSFile mFile,
- String entryLine,
- Date modTime,
- boolean binary,
- boolean readOnly,
- boolean executable,
- IProgressMonitor monitor)
- throws CVSException {
-
- if (mFile instanceof RemoteFile) {
- try {
- ((RemoteFile)mFile).aboutToReceiveContents(entryLine.getBytes());
- super.receiveTargetFile(
- session,
- mFile,
- entryLine,
- modTime,
- binary,
- readOnly,
- executable,
- monitor);
- } finally {
- ((RemoteFile)mFile).doneReceivingContents();
- }
- } else {
- super.receiveTargetFile(
- session,
- mFile,
- entryLine,
- modTime,
- binary,
- readOnly,
- executable,
- monitor);
- }
- }
- }
-
- public class SandboxCheckout extends Checkout {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.Command#commandFinished(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IStatus)
- */
- protected IStatus commandFinished(
- Session session,
- GlobalOption[] globalOptions,
- LocalOption[] localOptions,
- ICVSResource[] resources,
- IProgressMonitor monitor,
- IStatus status)
- throws CVSException {
-
- // Don't do anything (i.e. don't prune)
- return status;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.Command#doExecute(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], java.lang.String[], org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus doExecute(
- Session session,
- GlobalOption[] globalOptions,
- LocalOption[] localOptions,
- String[] arguments,
- ICommandOutputListener listener,
- IProgressMonitor monitor)
- throws CVSException {
-
- ResponseHandler newCreated = new CreatedResponseHandler();
- ResponseHandler oldCreated = session.getResponseHandler(newCreated.getResponseID());
- session.registerResponseHandler(newCreated);
- try {
- return super.doExecute(
- session,
- globalOptions,
- localOptions,
- arguments,
- listener,
- monitor);
- } finally {
- session.registerResponseHandler(oldCreated);
- }
- }
-
-}
- public static ICVSRemoteFolder checkoutRemoteFolder(IWorkbenchPart part, ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException, InvocationTargetException, InterruptedException {
- CheckoutToRemoteFolderOperation op = new CheckoutToRemoteFolderOperation(part, folder);
- op.run(monitor);
- return op.getResultingFolder();
- }
- public CheckoutToRemoteFolderOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) {
- super(part, new ICVSRemoteFolder[] { remoteFolder });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(
- ICVSRemoteFolder folder,
- IProgressMonitor monitor)
- throws CVSException {
-
- IPath sandboxPath = new Path(null, folder.getRepositoryRelativePath()).removeLastSegments(1);
- String pathString;
- if (sandboxPath.isEmpty()) {
- pathString = ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME;
- } else {
- pathString = sandboxPath.toString();
- }
- sandbox = new RemoteFolderSandbox(null, folder.getRepository(), pathString, folder.getTag());
- return checkout(folder, sandbox, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return NLS.bind(CVSUIMessages.CheckoutToRemoteFolderOperation_0, new String[] { getRemoteFolders()[0].getName() });
- }
-
- protected IStatus checkout(final ICVSRemoteFolder resource, final ICVSFolder sandbox, IProgressMonitor pm) throws CVSException {
- // Get the location and the workspace root
- ICVSRepositoryLocation repository = resource.getRepository();
- // Open a connection session to the repository
- final Session session = new Session(repository, sandbox);
- pm.beginTask(null, 100);
- Policy.checkCanceled(pm);
- session.open(Policy.subMonitorFor(pm, 5), false /* read-only */);
- try {
- // Build the local options
- List localOptions = new ArrayList();
- // Add the options related to the CVSTag
- CVSTag tag = resource.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
- localOptions.add(Checkout.makeDirectoryNameOption(resource.getName()));
-
- // Perform the checkout
- IStatus status = new SandboxCheckout().execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[]{resource.getRepositoryRelativePath()},
- null,
- Policy.subMonitorFor(pm, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- // Any created projects will exist but will not be mapped to CVS
- return status;
- }
- return OK;
- } catch (CVSException e) {
- // An exception occurred either during the module-expansion or checkout
- // Since we were able to make a connection, return the status so the
- // checkout of any other modules can proceed
- return e.getStatus();
- } finally {
- session.close();
- pm.done();
- }
- }
-
- public ICVSRemoteFolder getResultingFolder() throws CVSException {
- return (ICVSRemoteFolder)sandbox.getFolder(getRemoteFolders()[0].getName());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java
deleted file mode 100644
index bd63ec94a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class ClipboardDiffOperation extends DiffOperation {
-
- private static final Object DESTINATION_CLIPBOARD = CVSUIMessages.ClipboardDiffOperation_Clipboard;
-
- final ByteArrayOutputStream os = new ByteArrayOutputStream();
-
- public ClipboardDiffOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options, boolean isMultiPatch, boolean includeFullPathInformation, IPath patchRoot) {
- super(part, mappings, options, isMultiPatch, includeFullPathInformation, patchRoot, DESTINATION_CLIPBOARD);
- }
-
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- super.execute(monitor);
-
- if (os.size() == 0 ||
- (!patchHasContents && !patchHasNewFiles)) {
- reportEmptyDiff();
- } else {
- copyToClipboard(os);
- }
- }
-
- private void copyToClipboard(final ByteArrayOutputStream baos) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- Clipboard clipboard = new Clipboard(getShell().getDisplay());
- clipboard.setContents(
- new String[]{baos.toString()},
- new Transfer[]{plainTextTransfer});
- clipboard.dispose();
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.DiffOperation#openStream()
- */
- protected PrintStream openStream() {
- return new PrintStream(os);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
deleted file mode 100644
index acf6e5360..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Perform a "cvs commit"
- */
-public class CommitOperation extends SingleCommandOperation {
-
- public CommitOperation(IWorkbenchPart part, ResourceMapping[] mappers, LocalOption[] options, String comment) {
- super(part, mappers, options);
- addLocalOption(Command.makeArgumentOption(Command.MESSAGE_OPTION, comment));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- return Command.COMMIT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(recurse),
- resources,
- null,
- monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.RepositoryManager_committing;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.CommitOperation_0, new String[] { provider.getProject().getName() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
- */
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return CVSUIMessages.CommitAction_commitFailed;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#isServerModificationOperation()
- */
- protected boolean isServerModificationOperation() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getResourceMappingContext()
- */
- protected ResourceMappingContext getResourceMappingContext() {
- return SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java
deleted file mode 100644
index 457ce6744..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.RGB;
-
-
-/**
- * Default implementation, assigns random colors to revisions based on committer id.
- *
- * @since 3.2
- */
-final class CommitterColors {
-
- private static CommitterColors fInstance;
-
- // Fixed committer color RGBs provided by the UI Designer
- private static final RGB[] COMMITTER_RGBs= new RGB[] {
- new RGB(131, 150, 98), new RGB(132, 164, 118), new RGB(221, 205, 93), new RGB(199, 134, 57), new RGB(197, 123, 127),
- new RGB(133, 166, 214), new RGB(143, 163, 54), new RGB(180, 148, 74), new RGB(139, 136, 140), new RGB(48, 135, 144),
- new RGB(190, 93, 66), new RGB(101, 101, 217), new RGB(23, 101, 160), new RGB(72, 153, 119),
-
- new RGB(136, 176, 70), new RGB(123, 187, 95), new RGB(255, 230, 59), new RGB(255, 138, 1), new RGB(233, 88, 98),
- new RGB(93, 158, 254), new RGB(175, 215, 0), new RGB(232, 168, 21), new RGB(140, 134, 142), new RGB(0, 172, 191),
- new RGB(251, 58, 4), new RGB(63, 64, 255), new RGB(0, 104, 183), new RGB(27, 194, 130)
- };
-
-
- /**
- * Returns the committer color singleton.
- *
- * @return the committer color singleton
- */
- public static CommitterColors getDefault() {
- if (fInstance == null)
- fInstance= new CommitterColors();
- return fInstance;
- }
-
- /** The color map. */
- private Map fColors= new HashMap();
-
- /** The number of colors that have been issued. */
- private int fCount= 0;
-
- private CommitterColors() {
- }
-
- /**
- * Returns a unique color description for each string passed in. Colors for new committers are
- * allocated to be as different as possible from the existing colors.
- *
- * @param committer the committers unique name
- * @return the corresponding color
- */
- public RGB getCommitterRGB(String committer) {
- RGB rgb= (RGB) fColors.get(committer);
- if (rgb == null) {
- rgb= COMMITTER_RGBs[fCount++ % COMMITTER_RGBs.length];
- fColors.put(committer, rgb);
- }
- return rgb;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
deleted file mode 100644
index f7e053fb4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.compare.patch.WorkspacePatcherUI;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.DiffListener;
-import org.eclipse.team.internal.ccvs.core.connection.CVSCommunicationException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class DiffOperation extends SingleCommandOperation {
-
- private static final int UNIFIED_FORMAT = 0;
- private static final int CONTEXT_FORMAT = 1;
- private static final int STANDARD_FORMAT = 2;
-
- protected boolean isMultiPatch;
- protected boolean includeFullPathInformation;
- protected PrintStream stream;
- protected IPath patchRoot;
- protected boolean patchHasContents;
- protected boolean patchHasNewFiles;
-
- /* see bug 116427 */
- private Object destination = null;
-
- /* see bug 159894 */
- private class CustomizableEOLPrintStream extends PrintStream{
-
- private boolean error = false;
-
- private String defaultLineEnding = "\n"; //$NON-NLS-1$
-
- public CustomizableEOLPrintStream(PrintStream openStream) {
- super(openStream);
- if(CVSProviderPlugin.getPlugin().isUsePlatformLineend()){
- defaultLineEnding = System.getProperty("line.separator"); //$NON-NLS-1$
- }
- }
-
- public boolean checkError() {
- return error || super.checkError();
- }
-
- public void println() {
- try{
- write(defaultLineEnding.getBytes());
- } catch (IOException e){
- error = true;
- }
- }
-
- public void println(boolean x) {
- print(x);
- println();
- }
-
- public void println(char x) {
- print(x);
- println();
- }
-
- public void println(char[] x) {
- print(x);
- println();
- }
-
- public void println(double x) {
- print(x);
- println();
- }
-
- public void println(float x) {
- print(x);
- println();
- }
-
- public void println(int x) {
- print(x);
- println();
- }
-
- public void println(long x) {
- print(x);
- println();
- }
-
- public void println(Object x) {
- print(x);
- println();
- }
-
- public void println(String x) {
- print(x);
- println();
- }
- }
-
- public DiffOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options, boolean isMultiPatch, boolean includeFullPathInformation, IPath patchRoot, Object destination) {
- super(part, mappings, options);
- this.isMultiPatch = isMultiPatch;
- this.includeFullPathInformation=includeFullPathInformation;
- this.patchRoot=patchRoot;
- this.patchHasContents=false;
- this.patchHasNewFiles=false;
- this.destination = destination;
- }
-
- protected boolean shouldRun(){
- if (super.shouldRun() == false){
- return false;
- }
- Job[] jobs = Job.getJobManager().find(destination);
- if(jobs.length != 0){
- MessageDialog question = new MessageDialog(getShell(),
- CVSUIMessages.DiffOperation_CreatePatchConflictTitle, null,
- NLS.bind(CVSUIMessages.DiffOperation_CreatePatchConflictMessage, destination.toString()),
- MessageDialog.QUESTION,
- new String[]{IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 1);
- if(question.open() == 0){
- Job.getJobManager().cancel(destination);
- } else {
- return false;
- }
- }
- return true;
- }
-
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- stream = new CustomizableEOLPrintStream(openStream());
- if (isMultiPatch){
- stream.println(WorkspacePatcherUI.getWorkspacePatchHeader());
- }
- super.execute(monitor);
- } finally {
- if (stream != null) {
- stream.close();
- }
- }
- }
-
- /**
- * Open and return a stream for the diff output.
- * @return a stream for the diff output
- */
- protected abstract PrintStream openStream() throws CVSException;
-
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
-
- //add this project to the total projects encountered
- final HashSet newFiles = new HashSet(); //array of ICVSResource - need HashSet to guard for duplicate entries
- final HashSet existingFiles = new HashSet(); //array of IResource - need HashSet to guard for duplicate entries
-
- monitor.beginTask(null,100);
- final IProgressMonitor subMonitor = Policy.subMonitorFor(monitor,10);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- cvsResource.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- if (!(file.isIgnored())) {
- if (!file.isManaged() || file.getSyncInfo().isAdded() ){
- //this is a new file
- if (file.exists())
- newFiles.add(file);
- }else if (file.isModified(subMonitor)){
- existingFiles.add(file.getIResource());
- }
- }
- }
-
- public void visitFolder(ICVSFolder folder) throws CVSException {
- // Even if we are not supposed to recurse we still need to go into
- // the root directory.
- if (!folder.exists() || folder.isIgnored() ) {
- return;
- }
-
- folder.acceptChildren(this);
-
- }
- }, recurse);
- }
- subMonitor.done();
-
- //Check options
- //Append our diff output to the server diff output.
- // Our diff output includes new files and new files in new directories.
- int format = STANDARD_FORMAT;
-
- LocalOption[] localoptions = getLocalOptions(recurse);
- for (int i = 0; i < localoptions.length; i++) {
- LocalOption option = localoptions[i];
- if (option.equals(Diff.UNIFIED_FORMAT) ||
- isMultiPatch) {
- format = UNIFIED_FORMAT;
- } else if (option.equals(Diff.CONTEXT_FORMAT)) {
- format = CONTEXT_FORMAT;
- }
- }
-
- boolean haveAddedProjectHeader=false;
-
- if (!existingFiles.isEmpty()){
- if (isMultiPatch && !haveAddedProjectHeader){
- haveAddedProjectHeader=true;
- IProject project=resources[0].getProject();
- stream.println(WorkspacePatcherUI.getWorkspacePatchProjectHeader(project));
- }
- try{
- super.execute(provider, (IResource[]) existingFiles.toArray(new IResource[existingFiles.size()]), recurse, Policy.subMonitorFor(monitor, 90));
- } catch(CVSCommunicationException ex){ // see bug 123430
- CVSUIPlugin.openError(getShell(), null, null, ex, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_OTHER_EXCEPTIONS);
- } catch (CVSException ex){
- //ignore
- }
- }
-
- if (!newFiles.isEmpty() && Diff.INCLUDE_NEWFILES.isElementOf(localoptions)){
- //Set new file to flag to let us know that we have added something to the current patch
- patchHasNewFiles=true;
-
- if (isMultiPatch &&!haveAddedProjectHeader){
- haveAddedProjectHeader=true;
- IProject project=resources[0].getProject();
- stream.println(WorkspacePatcherUI.getWorkspacePatchProjectHeader(project));
- }
-
- for (Iterator iter = newFiles.iterator(); iter.hasNext();) {
- ICVSFile cvsFile = (ICVSFile) iter.next();
- addFileToDiff(getNewFileRoot(cvsFile), cvsFile,stream,format);
- }
- }
-
- monitor.done();
- }
-
- private ICVSFolder getNewFileRoot(ICVSFile cvsFile) {
- ICVSFolder patchRootFolder = getPatchRootFolder();
- if (patchRootFolder != null)
- return patchRootFolder;
- return CVSWorkspaceRoot.getCVSFolderFor(cvsFile.getIResource().getProject());
- }
-
- protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
-
- DiffListener diffListener = new DiffListener(stream);
-
- IStatus status = Command.DIFF.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(recurse),
- resources,
- diffListener,
- monitor);
-
- //Once any run of the Diff commands reports that it has written something to the stream, the patch
- //in its entirety is considered non-empty - until then keep trying to set the flag.
- if (!patchHasContents)
- patchHasContents = diffListener.wroteToStream();
-
- return status;
- }
-
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.DiffOperation_0, new String[]{provider.getProject().getName()});
- }
-
- protected String getTaskName() {
- return CVSUIMessages.DiffOperation_1;
- }
-
- private void addFileToDiff(ICVSFolder patchRoot, ICVSFile file, PrintStream printStream, int format) throws CVSException {
-
- String nullFilePrefix = ""; //$NON-NLS-1$
- String newFilePrefix = ""; //$NON-NLS-1$
- String positionInfo = ""; //$NON-NLS-1$
- String linePrefix = ""; //$NON-NLS-1$
-
- String pathString=""; //$NON-NLS-1$
-
-
- //get the path string for this file
- pathString= file.getRelativePath(patchRoot);
-
- int lines = 0;
- BufferedReader fileReader = new BufferedReader(new InputStreamReader(file.getContents()));
- try {
- while (fileReader.readLine() != null) {
- lines++;
- }
- } catch (IOException e) {
- throw CVSException.wrapException(file.getIResource(), NLS.bind(CVSMessages.CVSTeamProvider_errorAddingFileToDiff, new String[] { pathString }), e);
- } finally {
- try {
- fileReader.close();
- } catch (IOException e1) {
- //ignore
- }
- }
-
- // Ignore empty files
- if (lines == 0)
- return;
-
- switch (format) {
- case UNIFIED_FORMAT:
- nullFilePrefix = "--- "; //$NON-NLS-1$
- newFilePrefix = "+++ "; //$NON-NLS-1$
- positionInfo = "@@ -0,0 +1," + lines + " @@" ; //$NON-NLS-1$ //$NON-NLS-2$
- linePrefix = "+"; //$NON-NLS-1$
- break;
-
- case CONTEXT_FORMAT :
- nullFilePrefix = "*** "; //$NON-NLS-1$
- newFilePrefix = "--- "; //$NON-NLS-1$
- positionInfo = "--- 1," + lines + " ----"; //$NON-NLS-1$ //$NON-NLS-2$
- linePrefix = "+ "; //$NON-NLS-1$
- break;
-
- default :
- positionInfo = "0a1," + lines; //$NON-NLS-1$
- linePrefix = "> "; //$NON-NLS-1$
- break;
- }
-
- fileReader = new BufferedReader(new InputStreamReader(file.getContents()));
- try {
-
- printStream.println("Index: " + pathString); //$NON-NLS-1$
- printStream.println("==================================================================="); //$NON-NLS-1$
- printStream.println("RCS file: " + pathString); //$NON-NLS-1$
- printStream.println("diff -N " + pathString); //$NON-NLS-1$
-
-
- if (format != STANDARD_FORMAT) {
- printStream.println(nullFilePrefix + "/dev/null 1 Jan 1970 00:00:00 -0000"); //$NON-NLS-1$
- // Technically this date should be the local file date but nobody really cares.
- printStream.println(newFilePrefix + pathString + " 1 Jan 1970 00:00:00 -0000"); //$NON-NLS-1$
- }
-
- if (format == CONTEXT_FORMAT) {
- printStream.println("***************"); //$NON-NLS-1$
- printStream.println("*** 0 ****"); //$NON-NLS-1$
- }
-
- printStream.println(positionInfo);
-
- for (int i = 0; i < lines; i++) {
- printStream.print(linePrefix);
- printStream.println(fileReader.readLine());
- }
- } catch (IOException e) {
- throw CVSException.wrapException(file.getIResource(), NLS.bind(CVSMessages.CVSTeamProvider_errorAddingFileToDiff, new String[] { pathString }), e);
- } finally {
- try {
- fileReader.close();
- } catch (IOException e1) {
- }
- }
- }
-
- public void setStream(PrintStream stream) {
- this.stream = new CustomizableEOLPrintStream(stream);
- }
-
- protected void reportEmptyDiff() {
- CVSUIPlugin.openDialog(getShell(), new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- MessageDialog.openInformation(
- shell,
- CVSUIMessages.GenerateCVSDiff_noDiffsFoundTitle,
- CVSUIMessages.GenerateCVSDiff_noDiffsFoundMsg);
- }
- }, CVSUIPlugin.PERFORM_SYNC_EXEC);
- }
-
- protected ICVSFolder getLocalRoot(CVSTeamProvider provider) throws CVSException {
- ICVSFolder root = getPatchRootFolder();
- if (root != null)
- return root;
- return super.getLocalRoot(provider);
- }
-
- private ICVSFolder getPatchRootFolder() {
- if (!isMultiPatch &&
- !includeFullPathInformation){
- //Check to see if the selected patchRoot has enough segments to consider it a folder/resource
- //if not just get the project
-
- IResource patchFolder = null;
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if (patchRoot.segmentCount() > 1){
- patchFolder = root.getFolder(patchRoot);
- } else {
- patchFolder = root.getProject(patchRoot.toString());
- }
-
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(patchFolder);
- if (!cvsResource.isFolder()) {
- cvsResource = cvsResource.getParent();
- }
- return (ICVSFolder) cvsResource;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings()
- */
- public boolean consultModelsForMappings() {
- return false;
- }
-
- public boolean belongsTo(Object family){
- if(family != null && family.equals(destination))
- return true;
- return super.belongsTo(family);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java
deleted file mode 100644
index ee82c0add..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Disconnect the given projects from CVS control
- */
-public class DisconnectOperation extends RepositoryProviderOperation {
-
- private boolean unmanage;
-
- public DisconnectOperation(IWorkbenchPart part, IProject[] projects, boolean unmanage) {
- super(part, projects);
- this.unmanage = unmanage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(
- CVSTeamProvider provider,
- IResource[] resources,
- boolean recurse, IProgressMonitor monitor)
- throws CVSException, InterruptedException {
-
- // This method will be invoked for each provider being disconnected
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- IProject project = provider.getProject();
- try {
- RepositoryProvider.unmap(project);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- if (unmanage) {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(project);
- cvsFolder.unmanage(monitor);
- EclipseSynchronizer.getInstance().deconfigure(project, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- }
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.DisconnectOperation_0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.DisconnectOperation_1, new String[] { provider.getProject().getName() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
- */
- public boolean canRunAsJob() {
- // Do not run in the background
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings()
- */
- public boolean consultModelsForMappings() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getSchedulingRule(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected ISchedulingRule getSchedulingRule(CVSTeamProvider provider) {
- return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(provider.getProject());
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
deleted file mode 100644
index 89af326cc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
-import org.eclipse.team.internal.ccvs.core.client.listeners.LogListener;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoriesView;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class FetchAllMembersOperation extends RemoteOperation {
-
- class RLogTreeBuilder {
-
- private ICVSRepositoryLocation location;
- private RemoteFolderTree tree;
- private CVSTag tag;
-
- public RLogTreeBuilder(ICVSRepositoryLocation location, CVSTag tag) {
- this.tag = tag;
- this.location = location;
- reset();
- }
-
- public RemoteFolderTree getTree() {
- return tree;
- }
-
- /**
- * Reset the builder to prepare for a new build
- */
- public void reset() {
- tree = new RemoteFolderTree(null, location, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, tag);
- tree.setChildren(new ICVSRemoteResource[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#newFile(java.lang.String, java.lang.String)
- */
- public void newFile(IPath remoteFilePath, ICVSRemoteFile remoteFile) {
- try {
- addFile(tree,tag,remoteFile, remoteFilePath);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- private void addFile(RemoteFolderTree tree, CVSTag tag, ICVSRemoteFile file,IPath filePath) throws CVSException {
- RemoteFolderTree parent = (RemoteFolderTree)getFolder(tree, tag, filePath.removeLastSegments(1), Path.EMPTY);
- addChild(parent, file);
- }
-
- private void addChild(RemoteFolderTree tree, ICVSRemoteResource resource) {
- ICVSRemoteResource[] children = tree.getChildren();
- ICVSRemoteResource[] newChildren;
- if (children == null) {
- newChildren = new ICVSRemoteResource[] { resource };
- } else {
- newChildren = new ICVSRemoteResource[children.length + 1];
- System.arraycopy(children, 0, newChildren, 0, children.length);
- newChildren[children.length] = resource;
- }
- tree.setChildren(newChildren);
- }
-
- /*
- * Get the folder at the given path in the given tree, creating any missing folders as needed.
- */
- private ICVSRemoteFolder getFolder(RemoteFolderTree tree, CVSTag tag, IPath remoteFolderPath, IPath parentPath) throws CVSException {
- if (remoteFolderPath.segmentCount() == 0) return tree;
- String name = remoteFolderPath.segment(0);
- ICVSResource child;
- IPath childPath = parentPath.append(name);
- if (tree.childExists(name)) {
- child = tree.getChild(name);
- } else {
- child = new RemoteFolderTree(tree, tree.getRepository(), childPath.toString(), tag);
- ((RemoteFolderTree)child).setChildren(new ICVSRemoteResource[0]);
- addChild(tree, (ICVSRemoteResource)child);
- }
- return getFolder((RemoteFolderTree)child, tag, remoteFolderPath.removeFirstSegments(1), childPath);
- }
- }
-
- static final String DEAD_STATE = "dead"; //$NON-NLS-1$
- ICVSRepositoryLocation repoLocation;
-
- public FetchAllMembersOperation(IWorkbenchPart part, ICVSRemoteResource[] folders, ICVSRepositoryLocation repoLocation) {
- super(part, folders);
- this.repoLocation = repoLocation;
- }
-
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- //expand each folder selected in the tree
- ICVSRemoteResource[] restest = getRemoteResources();
- ICVSRemoteFolder testfolder = (ICVSRemoteFolder) restest[0];
- CVSTag tag = testfolder.getTag();
- if (tag == null)
- tag = CVSTag.DEFAULT;
- LogEntryCache cache = new LogEntryCache();
-
- RemoteLogOperation operation = new RemoteLogOperation(getPart(), getRemoteResources(), tag, null, cache);
- try {
- operation.run(monitor);
- ICVSRemoteResource[] remoteRes = getRemoteResources();
- final ICVSRemoteFolder project = (ICVSRemoteFolder) remoteRes[0];
- //Get the entry paths
- String[] entry = cache.getCachedFilePaths();
- //Strip repo + project info from entries
- RLogTreeBuilder treeBuilder = new RLogTreeBuilder(project.getRepository(),tag);
- for (int i = 0; i < entry.length; i++) {
- ILogEntry[] logEntry = cache.getLogEntries(entry[i]);
-
- //might not have state if this a branch entry
- if (logEntry[0].getState() != null &&
- logEntry[0].getState().equals(DEAD_STATE))
- continue;
-
-
- ICVSRemoteFile remoteFile = logEntry[0].getRemoteFile();
- //if the current folder tag is a branch tag, we need to take the extra step
- //of making sure that the file's revision number has been set appropriately
- if (tag.getType() == CVSTag.BRANCH &&
- remoteFile.getRevision().equals(LogListener.BRANCH_REVISION))
- verifyRevision(tag, logEntry[0], remoteFile);
-
- IPath logPath = new Path(null,remoteFile.getRepositoryRelativePath());
- if (logPath.segmentCount()>0)
- logPath = logPath.removeFirstSegments(1);
-
- treeBuilder.newFile(logPath, remoteFile);
- }
-
- RemoteFolderTree remoteTree = treeBuilder.getTree();
- IWorkbenchPart part = this.getPart();
- if (part instanceof RepositoriesView ){
- final RepositoriesView repView = (RepositoriesView) part;
- RemoteContentProvider prov = repView.getContentProvider();
- prov.addCachedTree(project, remoteTree);
- final TreeViewer tree = repView.getViewer();
-
- Utils.asyncExec( new Runnable() {
- public void run() {
- tree.expandToLevel(project, AbstractTreeViewer.ALL_LEVELS);
- }
- }, repView.getViewer());
- }
-
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore;
- } catch (TeamException e){
- throw CVSException.wrapException(e);
- }
-
- }
-
- private void verifyRevision(CVSTag tag, ILogEntry entry, ICVSRemoteFile remoteFile) throws CVSException {
- if (entry instanceof LogEntry){
- LogEntry logEntry = (LogEntry) entry;
- String[] allBranchRevisions = logEntry.getBranchRevisions();
- CVSTag[] allCVSTags = entry.getTags();
- for (int i = 0; i < allCVSTags.length; i++) {
- if (allCVSTags[i].equals(tag)){
- //get the revision number stored for this tag
- ((RemoteFile) remoteFile).setRevision(allBranchRevisions[i]);
- break;
- }
- }
- }
- }
-
- protected String getTaskName() {
- return CVSUIMessages.FetchAllMembersOperation_0;
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java
deleted file mode 100644
index 2d9dde119..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderMemberFetcher;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.progress.IElementCollector;
-
-/**
- * Fetch the members of a remote folder in the background, passing incremental
- * results through an IElementCollector.
- */
-public class FetchMembersOperation extends RemoteOperation {
-
- /* internal uzse only */ IElementCollector collector;
- /* internal uzse only */ RemoteFolderFilter filter = new RemoteFolderFilter();
-
- public static class RemoteFolderFilter {
- public ICVSRemoteResource[] filter(ICVSRemoteResource[] resource) {
- return resource;
- }
- }
-
- public class InternalRemoteFolderMemberFetcher extends RemoteFolderMemberFetcher {
- long sendIncrement = 100;
- List unsent = new ArrayList();
- long intervalStart;
- protected InternalRemoteFolderMemberFetcher(RemoteFolder parentFolder, CVSTag tag) {
- super(parentFolder, tag);
- }
- protected void parentDoesNotExist() {
- super.parentDoesNotExist();
- // Indicate that there are no children
- collector.add(new Object[0], getProgressMonitor());
- }
- protected RemoteFolder recordFolder(String name) {
- RemoteFolder folder = super.recordFolder(name);
- unsent.add(folder);
- if (isTimeToSend()) {
- sendFolders();
- }
- return folder;
- }
- private boolean isTimeToSend() {
- long currentTime = System.currentTimeMillis();
- return ((currentTime - intervalStart) > sendIncrement) || unsent.size() > sendIncrement;
- }
- protected IStatus performUpdate(IProgressMonitor progress, CVSTag tag) throws CVSException {
- intervalStart = System.currentTimeMillis();
- IStatus status = super.performUpdate(progress, tag);
- sendFolders();
- return status;
- }
- protected void updateFileRevisions(ICVSFile[] files, IProgressMonitor monitor) throws CVSException {
- super.updateFileRevisions(files, monitor);
- sendFiles();
- }
- private void sendFolders() {
- updateParentFolderChildren();
- collector.add(filter.filter((ICVSRemoteFolder[]) unsent.toArray(new ICVSRemoteFolder[unsent.size()])), getProgressMonitor());
- unsent.clear();
- intervalStart = System.currentTimeMillis();
- }
- private void sendFiles() {
- collector.add(getFiles(), getProgressMonitor());
- unsent.clear();
- }
- private IProgressMonitor getProgressMonitor() {
- return null;
- }
- }
-
- public FetchMembersOperation(IWorkbenchPart part, ICVSRemoteFolder folder, IElementCollector collector) {
- super(part, new ICVSRemoteResource[] { folder });
- this.collector = collector;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteFolder remote = getRemoteFolder();
- if (remote.getClass().equals(RemoteFolder.class)) {
- monitor = Policy.monitorFor(monitor);
- boolean isRoot = remote.getName().equals(ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME);
- monitor.beginTask(null, 100 + (isRoot ? 30 : 0));
- RemoteFolderMemberFetcher fetcher = new InternalRemoteFolderMemberFetcher((RemoteFolder)remote, remote.getTag());
- fetcher.fetchMembers(Policy.subMonitorFor(monitor, 100));
- if (isRoot) {
- ICVSRemoteResource[] modules = CVSUIPlugin.getPlugin()
- .getRepositoryManager()
- .getRepositoryRootFor(remote.getRepository())
- .getDefinedModules(remote.getTag(), Policy.subMonitorFor(monitor, 25));
- collector.add(filter.filter(modules), Policy.subMonitorFor(monitor, 5));
- }
- } else {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(null, 100);
- ICVSRemoteResource[] children = remote.members(Policy.subMonitorFor(monitor, 95));
- collector.add(children, Policy.subMonitorFor(monitor, 5));
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return NLS.bind(CVSUIMessages.FetchMembersOperation_0, new String[] { getRemoteFolder().getName() });
- }
-
- private ICVSRemoteFolder getRemoteFolder() {
- return (ICVSRemoteFolder)getRemoteResources()[0];
- }
-
- public void setFilter(RemoteFolderFilter filter) {
- this.filter = filter;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FileDiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FileDiffOperation.java
deleted file mode 100644
index 91b2f6d75..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FileDiffOperation.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.*;
-import java.nio.channels.FileChannel;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class FileDiffOperation extends DiffOperation {
-
- FileOutputStream os;
- PrintStream printStream;
- File file;
- File tempFile;
-
- public FileDiffOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options, File file, boolean isMultiPatch, boolean includeFullPathInformation, IPath patchRoot) {
- super(part, mappings, options, isMultiPatch, includeFullPathInformation, patchRoot, file.getAbsolutePath());
- IPath teamLocation= TeamPlugin.getPlugin().getStateLocation();
- IPath tempFilePath = teamLocation.append(new Path(IPath.SEPARATOR + "tempDiff" + System.currentTimeMillis())); //$NON-NLS-1$
- tempFile = tempFilePath.toFile();
- this.file = file;
- }
-
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- super.execute(monitor);
-
- if (tempFile.length() == 0) {
- tempFile.delete();
- reportEmptyDiff();
- return;
- }
-
- if (this.isMultiPatch &&
- (!patchHasContents && !patchHasNewFiles)){
- tempFile.delete();
- reportEmptyDiff();
- return;
- }
-
- copyFile();
- }
-
- protected void copyFile() throws CVSException {
- FileChannel tempFileChannel=null;
- FileChannel fileChannel=null;
- try {
- tempFileChannel = new FileInputStream(tempFile).getChannel();
- fileChannel = new FileOutputStream(file).getChannel();
-
- long size= tempFileChannel.size();
- long bytesTransferred = fileChannel.transferFrom(tempFileChannel, 0, size);
- while (bytesTransferred != size){
- //Transfer from point left off until the end of the file
- bytesTransferred += fileChannel.transferFrom(tempFileChannel, bytesTransferred, size);
- }
- } catch (IOException e) {
- throw CVSException.wrapException(e);
- } finally {
- if (tempFileChannel!=null)
- try {
- tempFileChannel.close();
- } catch (IOException e) {
- throw CVSException.wrapException(e);
- }
-
- if (fileChannel!=null)
- try {
- fileChannel.close();
- } catch (IOException e) {
- throw CVSException.wrapException(e);
- }
-
- if (tempFile != null)
- tempFile.delete();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.DiffOperation#openStream()
- */
- protected PrintStream openStream() throws CVSException {
- try {
- os = new FileOutputStream(tempFile);
- return new PrintStream(os);
- } catch (FileNotFoundException e) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, CVSUIMessages.GenerateDiffFileOperation_0, e);
- throw new CVSException(status);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
deleted file mode 100644
index 608a5d348..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-
-public interface ITagOperation {
- public abstract CVSTag getTag();
- public abstract void setTag(CVSTag tag);
- public abstract void run() throws InvocationTargetException, InterruptedException;
- /**
- * Return whether the tag operation contains any resource that would be operated on.
- * @return whether the tag operation contains any resource that would be operated on
- */
- public abstract boolean isEmpty();
- public abstract void moveTag();
- public abstract void doNotRecurse();
- public abstract TagSource getTagSource();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java
deleted file mode 100644
index d6197a0d3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * A specialized Replace operation that will update managed resources and
- * unmanaged resources that are conflicting additions (so that the remote is fetched)
- */
-public class OverrideAndUpdateOperation extends ReplaceOperation {
-
- private IResource[] conflictingAdditions;
- private final IProject project;
-
- public OverrideAndUpdateOperation(IWorkbenchPart part, IProject project, IResource[] allResources, IResource[] conflictingAdditions, CVSTag tag, boolean recurse) {
- super(part, allResources, tag, recurse);
- this.project = project;
- this.conflictingAdditions = conflictingAdditions;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation#getResourcesToUpdate(org.eclipse.team.internal.ccvs.core.ICVSResource[])
- */
- protected ICVSResource[] getResourcesToUpdate(ICVSResource[] resources, IProgressMonitor monitor) throws CVSException {
- // Add the conflicting additions to the list of resources to update
- Set update = new HashSet();
- ICVSResource[] conflicts = getCVSArguments(conflictingAdditions);
- update.addAll(Arrays.asList(conflicts));
- update.addAll(Arrays.asList(super.getResourcesToUpdate(resources, monitor)));
- return (ICVSResource[]) update.toArray(new ICVSResource[update.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation#getResourceMappingContext()
- */
- protected ResourceMappingContext getResourceMappingContext() {
- return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
- }
-
- protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
- return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ProjectMetaFileOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ProjectMetaFileOperation.java
deleted file mode 100644
index ad69d013e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ProjectMetaFileOperation.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation which checks for the existence of the .project file
- * in a remote folder, or to retrieve the project name for one or more
- * folders based on what is in the .project file.
- *
- * To check for meta file exitence, the operation can be run
- * by executing the operation and then checking <code>metaFileExists</code>
- * Use the retrieveContent as false in the constructor, to avoid the
- * overhead of retrieving the file content too.
- *
- * To update the folders with project names, the operation can be run
- * by calling the static method <code>updateFoldersWithProjectName</code>
- * or by executing the operation and then checking <code>getUpdatedFolders</code>
- * to retrieve updated folders.
- * Use the retrieveContent as true in the constructor to retrieve the content.
- *
- * The <code>metaFileExists</code> flag is always updated regardless of the
- * retrieveContent constructor argument value
- */
-public class ProjectMetaFileOperation extends CVSOperation {
-
- private ICVSRemoteFolder[] remoteFolders;
- private boolean metaFileExists;
- private boolean retrieveContent;
-
- /*
- * Update a list of folders with their project names
- * for those folders that have one.
- */
- public static ICVSRemoteFolder[] updateFoldersWithProjectName(IWorkbenchPart part, ICVSRemoteFolder[] folders)
- throws InvocationTargetException, InterruptedException {
- ProjectMetaFileOperation op = new ProjectMetaFileOperation(part, folders, true /*retrieve metafile content*/);
- op.run();
- return op.getUpdatedFolders();
- }
-
- public ProjectMetaFileOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, boolean retrieveContent) {
- super(part);
- this.remoteFolders = remoteFolders;
- this.retrieveContent = retrieveContent;
- }
-
- /*
- * Update the folders with a project name if the provided remote folder contains a non empty project name
- * in its meta-file (i.e. .project file)
- * Set the metafile existence to true as needed
- */
- private void checkForMetafileAndUpdateFoldersWithRemoteProjectName(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
- metaFileExists = false;
- monitor.beginTask(null, folders.length*100);
- for (int i = 0; i < folders.length; i++) {
- // make a copy of the folder so that we will not effect the original
- // folder when we refetch the members
- // TODO: this is a strange thing to need to do. We should fix this.
- ICVSRemoteFolder folder = (ICVSRemoteFolder) folders[i].forTag(folders[i].getTag());
-
- try {
- folder.members(Policy.subMonitorFor(monitor, 50));
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- // Check for the existance of the .project file
- // and attempt to create an IProjectDescription of it
- // and extract the project name
- InputStream in = null;
- try {
- ICVSRemoteFile remote = (ICVSRemoteFile) folder.getFile(".project"); //$NON-NLS-1$
- //if we have gone so far, then a metafile exists.
- metaFileExists = true;
- // retrieve the file content optionally, if requested
- if (retrieveContent && folder instanceof RemoteFolder) {
- RemoteFolder rf = (RemoteFolder) folder;
-
- //load the project description from the retrieved metafile
- in = remote.getContents(Policy.subMonitorFor(monitor, 50));
- if (in == null || monitor.isCanceled()) {
- break;
- }
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProjectDescription projectDesc = workspace.loadProjectDescription(in);
-
- //clone the remote folder into a remote project folder
- //set the project name
- RemoteProjectFolder rpf = new RemoteProjectFolder(rf, projectDesc.getName());
- // ... and update back our folder
- folders[i] = rpf;
- }
- } catch (TeamException e) {
- // We couldn't retrieve the project meta file so assume it doesn't
- // exist
- } catch (CoreException e) {
- // We couldn't read the project description, so assume the
- // metafile is not a metafile, or is incorrect
- // which is as if it does not exist
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- } catch (IOException e) {
- // ignore : we cannot read the file, so it's like it is not there
- }
- }
- }
- monitor.done();
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- checkForMetafileAndUpdateFoldersWithRemoteProjectName(remoteFolders, monitor);
- }
-
- /**
- * Return true if the meta file exists remotely. This method should only be invoked
- * after the operation has been executed;
- * @return
- */
- public boolean metaFileExists() {
- return metaFileExists;
- }
-
- /**
- * @return the updated folders with project name from the remote project meta
- * information if the .project file was properly retrieved or the
- * unmodified folders if retrieval failed. This method should only be
- * invoked after the operation has been executed;
- */
- public ICVSRemoteFolder[] getUpdatedFolders() {
- return remoteFolders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.ProjectMetaFile_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
- */
- public boolean canRunAsJob() {
- // This operation should never be run in the background.
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
deleted file mode 100644
index 2a8eac0bb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Reconcile an existing unshared local project with an existing remote folder.
- */
-public class ReconcileProjectOperation extends ShareProjectOperation {
-
- private ICVSRemoteFolder folder;
- private ContentComparisonSyncInfoFilter contentCompare = new ContentComparisonSyncInfoFilter(false);
-
- public ReconcileProjectOperation(Shell shell, IProject project, ICVSRemoteFolder folder) {
- super(shell, folder.getRepository(), project, folder.getRepositoryRelativePath());
- this.folder = folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return NLS.bind(CVSUIMessages.ReconcileProjectOperation_0, new String[] { getProject().getName(), folder.getRepositoryRelativePath() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation#createRemoteFolder(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected ICVSRemoteFolder createRemoteFolder(IProgressMonitor monitor) throws CVSException {
- // The folder already exists so just return the handle
- return folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation#mapProjectToRemoteFolder(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void mapProjectToRemoteFolder(ICVSRemoteFolder remote, IProgressMonitor monitor) throws TeamException {
- // Map the project
- monitor.beginTask(null, 100);
- super.mapProjectToRemoteFolder(remote, Policy.subMonitorFor(monitor, 10));
- // Reconcile the sync info
- reconcileSyncInfo(Policy.subMonitorFor(monitor, 90));
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void reconcileSyncInfo(IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 100);
- // Fetch the entire remote tree
- ICVSRemoteFolder remote = CheckoutToRemoteFolderOperation.checkoutRemoteFolder(getPart(), folder, Policy.subMonitorFor(monitor, 80));
- // Traverse the tree and populate the workspace base or remote
- // with the sync info depending on file contents
- populateWorkspace(remote, Policy.subMonitorFor(monitor, 20));
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- } finally {
- monitor.done();
- }
-
- }
-
- private void populateWorkspace(final ICVSRemoteFolder remote, IProgressMonitor monitor) throws CVSException {
- CVSWorkspaceRoot.getCVSFolderFor(getProject()).run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- populateWorkspace(getProject(), remote, monitor);
- }
- }, monitor);
-
- }
-
- /* private */ void populateWorkspace(IResource resource, ICVSRemoteResource remote, IProgressMonitor monitor) throws CVSException {
- try {
- if (resource.getType() == IResource.FILE) {
- if (remote.isContainer()) {
- CVSUIPlugin.log(IStatus.ERROR, NLS.bind(CVSUIMessages.ReconcileProjectOperation_1, new String[] { resource.getFullPath().toString(), remote.getRepositoryRelativePath() }), null);
- } else {
- IFile file = (IFile)resource;
- IResourceVariant variant = (IResourceVariant)remote;
- if (file.exists()
- && variant != null
- && contentCompare.compareContents(file, variant, monitor)) {
- // The contents are the same so populate the local workspace
- // with the remote sync info and make the file in-sync
- makeInSync(file, remote, monitor);
- } else {
- // Would like to put the bytes in the remote but this
- // is complicated due to subscriber events.
- // We'll refresh the subcriber at the end.
- }
- }
- } else {
- if (!remote.isContainer()) {
- CVSUIPlugin.log(IStatus.ERROR, NLS.bind(CVSUIMessages.ReconcileProjectOperation_2, new String[] { resource.getFullPath().toString(), remote.getRepositoryRelativePath() }), null);
- } else {
- // Map the local folder to the remote folder.
- // (Note that this will make phantoms for non-exisiting local folders)
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(resource);
- folder.setFolderSyncInfo(((ICVSFolder)remote).getFolderSyncInfo());
- // Traverse the children of the remote
- // (The members were prefetched).
- ICVSRemoteResource[] members = remote.members(monitor);
- for (int i = 0; i < members.length; i++) {
- ICVSRemoteResource member = members[i];
- populateWorkspace(getLocalChild((IContainer)resource, member), member, monitor);
- }
- }
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- /*
- * Get the local resource handle for corresponding to the remote resource
- */
- private IResource getLocalChild(IContainer parent, ICVSRemoteResource member) {
- IResource resource = parent.findMember(member.getName());
- if (resource == null) {
- if (member.isContainer()) {
- resource = parent.getFolder(new Path(null, member.getName()));
- } else {
- resource = parent.getFile(new Path(null, member.getName()));
- }
- }
- return resource;
- }
-
- /*
- * Make the file in-sync with its corresponding remote.
- */
- private void makeInSync(IFile file, ICVSRemoteResource remote, IProgressMonitor monitor) throws CVSException {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- ResourceSyncInfo info = remote.getSyncInfo();
- Date modTime = info.getTimeStamp();
- if (modTime != null) {
- cvsFile.setTimeStamp(modTime);
- }
- modTime = cvsFile.getTimeStamp();
- MutableResourceSyncInfo newInfoWithTimestamp = info.cloneMutable();
- newInfoWithTimestamp.setTimeStamp(modTime);
- cvsFile.setSyncInfo(newInfoWithTimestamp, ICVSFile.CLEAN);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
deleted file mode 100644
index e84298749..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener;
-import org.eclipse.team.internal.ccvs.core.resources.*;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Compare the two versions of given remote folders obtained from the two tags specified.
- */
-public class RemoteCompareOperation extends RemoteOperation {
-
- private CompareTreeBuilder builder;
- private CVSTag left, right;
-
- /**
- * Helper class for builder and comparing the resource trees
- */
- public static class CompareTreeBuilder implements RDiffSummaryListener.IFileDiffListener {
- private ICVSRepositoryLocation location;
- private RemoteFolderTree leftTree, rightTree;
- private CVSTag left, right;
-
- public CompareTreeBuilder(ICVSRepositoryLocation location, CVSTag left, CVSTag right) {
- this.left = left;
- this.right = right;
- this.location = location;
- reset();
- }
-
- public RemoteFolderTree getLeftTree() {
- return leftTree;
- }
- public RemoteFolderTree getRightTree() {
- return rightTree;
- }
-
- /**
- * Reset the builder to prepare for a new build
- */
- public void reset() {
- leftTree = new RemoteFolderTree(null, location, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, left);
- leftTree.setChildren(new ICVSRemoteResource[0]);
- rightTree = new RemoteFolderTree(null, location, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, right);
- rightTree.setChildren(new ICVSRemoteResource[0]);
- }
-
- /**
- * Cache the contents for the files that are about to be compares
- * @throws CVSException
- */
- public void cacheContents(IProgressMonitor monitor) throws CVSException {
- String[] overlappingFilePaths = getOverlappingFilePaths();
- if (overlappingFilePaths.length > 0) {
- monitor.beginTask(null, 100);
- fetchFileContents(leftTree, overlappingFilePaths, Policy.subMonitorFor(monitor, 50));
- fetchFileContents(rightTree, overlappingFilePaths, Policy.subMonitorFor(monitor, 50));
- monitor.done();
- }
- }
-
- /**
- * Open the comparison in a compare editor
- */
- public void openCompareEditor(final IWorkbenchPage page, final String title, final String toolTip) {
- if (leftTree == null || rightTree == null) return;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- CompareUI.openCompareEditorOnPage(
- new CVSCompareEditorInput(title, toolTip, new ResourceEditionNode(leftTree), new ResourceEditionNode(rightTree)), page);
- }
- });
- }
-
- /**
- * Add the predecessor to the left tree and the remote to the right tree.
- * @param predecessor
- * @param remote
- */
- public void addToTrees(ICVSRemoteFile predecessor, ICVSRemoteFile remote) {
- if (remote != null) {
- try {
- Path filePath = new Path(null, remote.getRepositoryRelativePath());
- addFile(rightTree, right, filePath, remote.getRevision());
- getFolder(leftTree, left, filePath.removeLastSegments(1), Path.EMPTY);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- if (predecessor != null) {
- try {
- Path filePath = new Path(null, predecessor.getRepositoryRelativePath());
- addFile(leftTree, left, filePath, predecessor.getRevision());
- getFolder(rightTree, right, filePath.removeLastSegments(1), Path.EMPTY);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
-
- private void addFile(RemoteFolderTree tree, CVSTag tag, Path filePath, String revision) throws CVSException {
- RemoteFolderTree parent = (RemoteFolderTree)getFolder(tree, tag, filePath.removeLastSegments(1), Path.EMPTY);
- String name = filePath.lastSegment();
- ICVSRemoteFile file = new RemoteFile(parent, 0, name, revision, null, getTag(revision, tag));
- addChild(parent, file);
- }
-
- private CVSTag getTag(String revision, CVSTag tag) {
- if (tag == null) {
- tag = new CVSTag(revision, CVSTag.VERSION);
- }
- return tag;
- }
-
- /*
- * Get the folder at the given path in the given tree, creating any missing folders as needed.
- */
- private ICVSRemoteFolder getFolder(RemoteFolderTree tree, CVSTag tag, IPath remoteFolderPath, IPath parentPath) throws CVSException {
- if (remoteFolderPath.segmentCount() == 0) return tree;
- String name = remoteFolderPath.segment(0);
- ICVSResource child;
- IPath childPath = parentPath.append(name);
- if (tree.childExists(name)) {
- child = tree.getChild(name);
- } else {
- child = new RemoteFolderTree(tree, tree.getRepository(), childPath.toString(), tag);
- ((RemoteFolderTree)child).setChildren(new ICVSRemoteResource[0]);
- addChild(tree, (ICVSRemoteResource)child);
- }
- return getFolder((RemoteFolderTree)child, tag, remoteFolderPath.removeFirstSegments(1), childPath);
- }
-
- private void addChild(RemoteFolderTree tree, ICVSRemoteResource resource) {
- ICVSRemoteResource[] children = tree.getChildren();
- ICVSRemoteResource[] newChildren;
- if (children == null) {
- newChildren = new ICVSRemoteResource[] { resource };
- } else {
- newChildren = new ICVSRemoteResource[children.length + 1];
- System.arraycopy(children, 0, newChildren, 0, children.length);
- newChildren[children.length] = resource;
- }
- tree.setChildren(newChildren);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#fileDiff(java.lang.String, java.lang.String, java.lang.String)
- */
- public void fileDiff(String remoteFilePath, String leftRevision, String rightRevision) {
- try {
- addFile(rightTree, right, new Path(null, remoteFilePath), rightRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- try {
- addFile(leftTree, left, new Path(null, remoteFilePath), leftRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#newFile(java.lang.String, java.lang.String)
- */
- public void newFile(String remoteFilePath, String rightRevision) {
- try {
- addFile(rightTree, right, new Path(null, remoteFilePath), rightRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#deletedFile(java.lang.String)
- */
- public void deletedFile(String remoteFilePath, String leftRevision) {
- // The leftRevision may be null in which case the tag is used
- try {
- addFile(leftTree, left, new Path(null, remoteFilePath), leftRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#directory(java.lang.String)
- */
- public void directory(String remoteFolderPath) {
- try {
- getFolder(leftTree, left, new Path(null, remoteFolderPath), Path.EMPTY);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- try {
- getFolder(rightTree, right, new Path(null, remoteFolderPath), Path.EMPTY);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- private String[] getOverlappingFilePaths() {
- String[] leftFiles = getFilePaths(leftTree);
- String[] rightFiles = getFilePaths(rightTree);
- Set set = new HashSet();
- for (int i = 0; i < rightFiles.length; i++) {
- String rightFile = rightFiles[i];
- for (int j = 0; j < leftFiles.length; j++) {
- String leftFile = leftFiles[j];
- if (leftFile.equals(rightFile)) {
- set.add(leftFile);
- }
- }
- }
- return (String[]) set.toArray(new String[set.size()]);
- }
-
- private void fetchFileContents(RemoteFolderTree tree, String[] overlappingFilePaths, IProgressMonitor monitor) throws CVSException {
- FileContentCachingService.fetchFileContents(tree, overlappingFilePaths, monitor);
- }
-
- private String[] getFilePaths(RemoteFolderTree tree) {
- ICVSRemoteResource[] children = tree.getChildren();
- List result = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- ICVSRemoteResource resource = children[i];
- if (resource.isContainer()) {
- result.addAll(Arrays.asList(getFilePaths((RemoteFolderTree)resource)));
- } else {
- result.add(resource.getRepositoryRelativePath());
- }
- }
- return (String[]) result.toArray(new String[result.size()]);
- }
- }
-
- public static CVSTag getTag(ICVSRemoteResource resource) throws CVSException {
- CVSTag tag = null;
- try {
- if (resource.isContainer()) {
- tag = ((ICVSRemoteFolder)resource).getTag();
- } else {
- ICVSRemoteFile file = (ICVSRemoteFile)resource;
- String revision = file.getRevision();
- if (revision.equals(ResourceSyncInfo.ADDED_REVISION)) {
- ResourceSyncInfo info =file.getSyncInfo();
- if (info != null) tag = info.getTag();
- } else {
- tag = new CVSTag(revision, CVSTag.VERSION);
- }
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- if (tag == null) tag = CVSTag.DEFAULT;
- return tag;
- }
-
- public static RemoteCompareOperation create(IWorkbenchPart part, ICVSRemoteResource remoteResource, CVSTag tag) throws CVSException {
- CVSTag tag0 = getTag(remoteResource);
- CVSTag tag1 = tag;
- if (tag0.getType() == CVSTag.DATE && tag1.getType() == CVSTag.DATE) {
- if (tag0.asDate().after(tag1.asDate())) {
- tag = tag0;
- remoteResource = remoteResource.forTag(tag1);
- }
- }
- return new RemoteCompareOperation(part, remoteResource, tag);
- }
-
- /**
- * Compare two versions of the given remote resource.
- * @param shell
- * @param remoteResource the resource whose tags are being compared
- * @param left the earlier tag (not null)
- * @param right the later tag (not null)
- */
- protected RemoteCompareOperation(IWorkbenchPart part, ICVSRemoteResource remoteResource, CVSTag tag) {
- super(part, new ICVSRemoteResource[] {remoteResource});
- Assert.isNotNull(tag);
- this.right = tag;
- try {
- this.left = getTag(remoteResource);
- } catch (CVSException e) {
- // This shouldn't happen but log it just in case
- CVSProviderPlugin.log(e);
- }
- if (this.left == null) {
- this.left = CVSTag.DEFAULT;
- }
- builder = new CompareTreeBuilder(remoteResource.getRepository(), left, right);
- }
-
- /*
- * This command only supports the use of a single resource
- */
- private ICVSRemoteResource getRemoteResource() {
- return getRemoteResources()[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException {
- boolean fetchContents = CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
- monitor.beginTask(getTaskName(), 50 + (fetchContents ? 100 : 0));
- try {
- ICVSRemoteResource resource = getRemoteResource();
- IStatus status = buildTrees(resource, Policy.subMonitorFor(monitor, 50));
- if (status.isOK() && fetchContents) {
- builder.cacheContents(Policy.subMonitorFor(monitor, 100));
- }
- collectStatus(status);
- openCompareEditor(builder);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * This method is here to allow subclasses to override
- */
- protected void openCompareEditor(CompareTreeBuilder builder) {
- builder.openCompareEditor(getTargetPage(), null, null);
- }
-
- /*
- * Build the two trees uses the reponses from "cvs rdiff -s ...".
- */
- private IStatus buildTrees(ICVSRemoteResource resource, IProgressMonitor monitor) throws CVSException {
- // Initialize the resulting trees
- builder.reset();
- Command.QuietOption oldOption= CVSProviderPlugin.getPlugin().getQuietness();
- Session session = new Session(resource.getRepository(), builder.getLeftTree(), false);
- try {
- monitor.beginTask(getTaskName(), 100);
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- session.open(Policy.subMonitorFor(monitor, 10));
- IStatus status = Command.RDIFF.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(),
- new ICVSResource[] { resource },
- new RDiffSummaryListener(builder),
- Policy.subMonitorFor(monitor, 90));
- return status;
- } finally {
- try {
- session.close();
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(oldOption);
- }
- monitor.done();
- }
- }
-
- private LocalOption[] getLocalOptions() {
- return new LocalOption[] {RDiff.SUMMARY, RDiff.makeTagOption(left), RDiff.makeTagOption(right)};
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return NLS.bind(CVSUIMessages.RemoteCompareOperation_0, (new Object[] {left.getName(), right.getName(), getRemoteResource().getRepositoryRelativePath()}));
- }
-
- protected IWorkbenchPage getTargetPage() {
- return TeamUIPlugin.getActivePage();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
deleted file mode 100644
index 03b68fc3c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-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.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.RLog;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.listeners.ILogEntryListener;
-import org.eclipse.team.internal.ccvs.core.client.listeners.LogListener;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Performs an rlog on the resources and caches the results.
- */
-public class RemoteLogOperation extends RepositoryLocationOperation {
-
- private RLog rlog = new RLog();
- private CVSTag tag1;
- private CVSTag tag2;
- private LogEntryCache entryCache;
-
- /**
- * A log entry cache that can be shared by multiple instances of the
- * remote log operation.
- */
- public static class LogEntryCache implements ILogEntryListener {
-
- /*
- * Cache of all log entries
- */
- private Map entries = new HashMap(); /* Map String:remoteFilePath->Map (String:revision -> ILogEntry) */
-
- private Map internalGetLogEntries(String path) {
- return (Map)entries.get(path);
- }
-
- /**
- * Return all the log entries at the given path
- * @param path the file path
- * @return the log entries for the file
- */
- public ILogEntry[] getLogEntries(String path) {
- Map map = internalGetLogEntries(path);
- return (ILogEntry[]) map.values().toArray(new ILogEntry[map.values().size()]);
- }
-
- private ILogEntry internalGetLogEntry(String path, String revision) {
- Map fileEntries = internalGetLogEntries(path);
- if (fileEntries != null) {
- return (ILogEntry)fileEntries.get(revision);
- }
- return null;
- }
-
- public String[] getCachedFilePaths() {
- return (String[]) entries.keySet().toArray(new String[entries.size()]);
- }
-
- /**
- * Return the log entry that for the given resource
- * or <code>null</code> if no entry was fetched or the
- * resource is not a file.
- * @param getFullPath(resource) the resource
- * @return the log entry or <code>null</code>
- */
- public synchronized ILogEntry getLogEntry(ICVSRemoteResource resource) {
- if (resource instanceof ICVSRemoteFile) {
- try {
- String path = getFullPath(resource);
- String revision = ((ICVSRemoteFile)resource).getRevision();
- return internalGetLogEntry(path, revision);
- } catch (TeamException e) {
- // Log and return null
- CVSUIPlugin.log(e);
- }
- }
- return null;
- }
-
- /**
- * Return the log entries that were fetched for the given resource
- * or an empty list if no entry was fetched.
- * @param getFullPath(resource) the resource
- * @return the fetched log entries or an empty list is none were found
- */
- public synchronized ILogEntry[] getLogEntries(ICVSRemoteResource resource) {
- Map fileEntries = internalGetLogEntries(getFullPath(resource));
- if (fileEntries != null) {
- return (ILogEntry[]) fileEntries.values().toArray(new ILogEntry[fileEntries.size()]);
- }
- return new ILogEntry[0];
- }
-
- /*
- * Return the full path that uniquely identifies the resource
- * accross repositories. This path include the repository and
- * resource path but does not include the revision so that
- * all log entries for a file can be retrieved.
- */
- private String getFullPath(ICVSRemoteResource resource) {
- return Util.appendPath(resource.getRepository().getLocation(false), resource.getRepositoryRelativePath());
- }
-
- public synchronized void clearEntries() {
- entries.clear();
- }
-
- public synchronized ICVSRemoteFile getImmediatePredecessor(ICVSRemoteFile file) throws TeamException {
- ILogEntry[] allLogs = getLogEntries(file);
- String revision = file.getRevision();
- // First decrement the last digit and see if that revision exists
- String predecessorRevision = getPredecessorRevision(revision);
- ICVSRemoteFile predecessor = findRevison(allLogs, predecessorRevision);
- // If nothing was found, try to fond the base of a branch
- if (predecessor == null && isBrancheRevision(revision)) {
- predecessorRevision = getBaseRevision(revision);
- predecessor = findRevison(allLogs, predecessorRevision);
- }
- // If that fails, it is still possible that there is a revision.
- // This can happen if the revision has been manually set.
- if (predecessor == null) {
- // We don't search in this case since this is costly and would be done
- // for any file that is new as well.
- }
- return predecessor;
- }
-
- /*
- * Find the given revision in the list of log entries.
- * Return null if the revision wasn't found.
- */
- private ICVSRemoteFile findRevison(ILogEntry[] allLogs, String predecessorRevision) throws TeamException {
- for (int i = 0; i < allLogs.length; i++) {
- ILogEntry entry = allLogs[i];
- ICVSRemoteFile file = entry.getRemoteFile();
- if (file.getRevision().equals(predecessorRevision)) {
- return file;
- }
- }
- return null;
- }
- /*
- * Decrement the trailing digit by one.
- */
- private String getPredecessorRevision(String revision) {
- int digits[] = Util.convertToDigits(revision);
- digits[digits.length -1]--;
- StringBuffer buffer = new StringBuffer(revision.length());
- for (int i = 0; i < digits.length; i++) {
- buffer.append(Integer.toString(digits[i]));
- if (i < digits.length - 1) {
- buffer.append('.');
- }
- }
- return buffer.toString();
- }
-
- /*
- * Return true if there are more than 2 digits in the revision number
- * (i.e. the revision is on a branch)
- */
- private boolean isBrancheRevision(String revision) {
- return Util.convertToDigits(revision).length > 2;
- }
-
- /*
- * Remove the trailing revision digits such that the
- * returned revision is shorter than the given revision
- * and is an even number of digits long
- */
- private String getBaseRevision(String revision) {
- int digits[] = Util.convertToDigits(revision);
- int length = digits.length - 1;
- if (length % 2 == 1) {
- length--;
- }
- StringBuffer buffer = new StringBuffer(revision.length());
- for (int i = 0; i < length; i++) {
- buffer.append(Integer.toString(digits[i]));
- if (i < length - 1) {
- buffer.append('.');
- }
- }
- return buffer.toString();
- }
- /**
- * Remove any entries for the remote resources
- * @param resource the remote resource
- */
- public synchronized void clearEntries(ICVSRemoteResource resource) {
- String remotePath = getFullPath(resource);
- entries.remove(remotePath);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.ILogEntryListener#addEntry(org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry)
- */
- public void handleLogEntryReceived(ILogEntry entry) {
- ICVSRemoteFile file = entry.getRemoteFile();
- String fullPath = getFullPath(file);
- String revision = entry.getRevision();
- Map fileEntries = internalGetLogEntries(fullPath);
- if (fileEntries == null) {
- fileEntries = new HashMap();
- entries.put(fullPath, fileEntries);
- }
- fileEntries.put(revision, entry);
- }
- }
-
- public RemoteLogOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources, CVSTag tag1, CVSTag tag2, LogEntryCache cache) {
- super(part, remoteResources);
- this.tag1 = tag1;
- this.tag2 = tag2;
- this.entryCache = cache;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryLocationOperation#execute(org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, org.eclipse.team.internal.ccvs.core.ICVSRemoteResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(ICVSRepositoryLocation location, ICVSRemoteResource[] remoteResources, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(NLS.bind(CVSUIMessages.RemoteLogOperation_0, new String[] { location.getHost() }), 100);
- Session s = new Session(location, CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()), false /* do not output to console */);
- // Create a log listener that will update the cache as entries are received
- LogListener listener = new LogListener(entryCache);
-
- ICVSRemoteResource[] remotes = remoteResources;
- Command.LocalOption[] localOptions = getLocalOptions(tag1, tag2);
- if(tag1 == null || tag2 == null) {
- // Optimize the cases were we are only fetching the history for a single revision. If it is
- // already cached, don't fetch it again.
- ArrayList unCachedRemotes = new ArrayList();
- for (int i = 0; i < remoteResources.length; i++) {
- ICVSRemoteResource r = remoteResources[i];
- if(entryCache.getLogEntry(r) == null) {
- unCachedRemotes.add(r);
- }
- }
- remotes = (ICVSRemoteResource[]) unCachedRemotes.toArray(new ICVSRemoteResource[unCachedRemotes.size()]);
- }
- if (remotes.length > 0) {
- try {
- s.open(Policy.subMonitorFor(monitor, 10));
- IStatus status = rlog.execute(s, Command.NO_GLOBAL_OPTIONS, localOptions, remotes, listener, Policy.subMonitorFor(monitor, 90));
- collectStatus(status);
- } finally {
- s.close();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.RemoteLogOperation_1;
- }
-
- protected Command.LocalOption[] getLocalOptions(CVSTag tag1, CVSTag tag2) {
- if(tag1 != null && tag2 != null) {
- return new Command.LocalOption[] {RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.makeTagOption(tag1, tag2)};
- }
- else if (tag1 != null){
- if (tag1.getType() == CVSTag.HEAD ||
- tag1.getType() == CVSTag.VERSION)
- return new Command.LocalOption[] {RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.getCurrentTag(tag1)};
-
- if (tag1.getType() == CVSTag.DATE)
- return new Command.LocalOption[] {RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.REVISIONS_ON_DEFAULT_BRANCH, RLog.getCurrentTag(tag1)};
- //branch tag
- return new Command.LocalOption[] {RLog.getCurrentTag(tag1)};
- }
- else {
- return new Command.LocalOption[] {RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES};
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java
deleted file mode 100644
index ba8b9e684..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class RemoteOperation extends CVSOperation {
-
- private ICVSRemoteResource[] remoteResources;
-
- protected RemoteOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources) {
- super(part);
- this.remoteResources =remoteResources;
- }
-
- protected ICVSRemoteResource[] getRemoteResources() {
- return remoteResources;
- }
-
- public ICVSResource[] getCVSResources() {
- ICVSResource[] cvsResources = new ICVSResource[remoteResources.length];
- for (int i = 0; i < remoteResources.length; i++) {
- cvsResources[i] = remoteResources[i];
- }
- return cvsResources;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteProjectFolder.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteProjectFolder.java
deleted file mode 100644
index a7cb3cbb6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteProjectFolder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-
-/**
- * This specialized RemoteFolder represents a RemoteFolder that contains
- * a .project metafile and has an additional field representing the project
- * name retrieved from this .project metafile
- */
-public class RemoteProjectFolder extends RemoteFolder {
-
- protected String projectName;
-
- /**
- * The Constructor for the RemoteProjectFolder
- * @param folder the original RemoteFolder to 'clone'
- * @param projectName the project name retrieved from the project metafile
- */
- public RemoteProjectFolder(RemoteFolder folder, String projectName) {
- super((RemoteFolder) folder.getParent(), folder.getName(), folder.getRepository(),
- folder.getRepositoryRelativePath(), folder.getTag(), folder.getFolderSyncInfo().getIsStatic());
- this.projectName = projectName;
- }
-
- /**
- * @return true is the project name has been set and is not null or empty, false otherwise.
- */
- public boolean hasProjectName() {
- if (isProjectNameEmpty())
- return false;
- return true;
- }
-
- /**
- * @return the project name derived from the project description The name is guaranteed to be a null or a non empty string
- */
- public String getProjectName() {
- if (isProjectNameEmpty())
- return null;
- return projectName;
- }
-
- private boolean isProjectNameEmpty() {
- return projectName == null || projectName.equals(""); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
deleted file mode 100644
index 2c6074027..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Matt McCutchen <hashproduct+eclipse@gmail.com> - Bug 179174 CVS client sets timestamps back when replacing
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.PrepareForReplaceVisitor;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation replaces the local resources with their remote contents
- */
-public class ReplaceOperation extends UpdateOperation {
-
- public ReplaceOperation(IWorkbenchPart part, IResource[] resources, CVSTag tag, boolean recurse) {
- super(part, asResourceMappers(resources, recurse ? IResource.DEPTH_INFINITE : IResource.DEPTH_ONE), new LocalOption[] { Update.IGNORE_LOCAL_CHANGES }, tag);
- }
-
- public ReplaceOperation(IWorkbenchPart part, ResourceMapping[] mappings, CVSTag tag) {
- super(part, mappings, new LocalOption[] { Update.IGNORE_LOCAL_CHANGES }, tag);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.ReplaceOperation_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(
- final Session session,
- final CVSTeamProvider provider,
- final ICVSResource[] resources,
- final boolean recurse, IProgressMonitor monitor)
- throws CVSException, InterruptedException {
-
- final IStatus[] status = new IStatus[] { Status.OK_STATUS };
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- status[0] = internalExecuteCommand(session, provider, resources, recurse, monitor);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- }, null, IWorkspace.AVOID_UPDATE, monitor);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- return status[0];
- }
-
- // Files deleted by the PrepareForReplaceVisitor.
- private Set/*<ICVSFile>*/ prepDeletedFiles;
-
- private IStatus internalExecuteCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- monitor.beginTask(null, 100);
- ICVSResource[] managedResources = getResourcesToUpdate(resources, Policy.subMonitorFor(monitor, 5));
- try {
- // Purge any unmanaged or added files
- PrepareForReplaceVisitor pfrv = new PrepareForReplaceVisitor(session, getTag());
- pfrv.visitResources(
- provider.getProject(),
- resources,
- CVSUIMessages.ReplaceOperation_1,
- recurse ? IResource.DEPTH_INFINITE : IResource.DEPTH_ONE,
- Policy.subMonitorFor(monitor, 25));
- prepDeletedFiles = pfrv.getDeletedFiles();
-
- // Only perform the remote command if some of the resources being replaced were managed
- IStatus status = OK;
- if (managedResources.length > 0) {
- // Perform an update, ignoring any local file modifications
- status = super.executeCommand(session, provider, managedResources, recurse, Policy.subMonitorFor(monitor, 70));
- }
-
- // Prune any empty folders left after the resources were purged.
- // This is done to prune any empty folders that contained only unmanaged resources
- if (status.isOK() && CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) {
- new PruneFolderVisitor().visit(session, resources);
- }
-
- return status;
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Return the resources that need to be updated from the server.
- * By default, this is all resources that are managed.
- * @param resources all resources being replaced
- * @return resources that are to be updated from the server
- * @throws CVSException
- */
- protected ICVSResource[] getResourcesToUpdate(ICVSResource[] resources, IProgressMonitor monitor) throws CVSException {
- // Accumulate the managed resources from the list of provided resources
- List managedResources = new ArrayList();
- monitor.beginTask(null, resources.length * 100);
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- if ((resource.isFolder() && ((ICVSFolder)resource).isCVSFolder())) {
- addResourceIfTagExists(managedResources, resource, Policy.subMonitorFor(monitor, 100));
- } else if (!resource.isFolder()){
- byte[] syncBytes = ((ICVSFile)resource).getSyncBytes();
- if (syncBytes != null && !ResourceSyncInfo.isAddition(syncBytes)) {
- addResourceIfTagExists(managedResources, resource, Policy.subMonitorFor(monitor, 100));
- }
- }
- }
- monitor.done();
- return (ICVSResource[]) managedResources.toArray(new ICVSResource[managedResources.size()]);
- }
-
- private void addResourceIfTagExists(List managedResources, ICVSResource resource, IProgressMonitor monitor) {
- CVSTag tag = getTag();
- if (tag == null || tag.getType() == CVSTag.DATE || tag.isHeadTag() || tag.isBaseTag()) {
- // No need to check for date, head or base tags
- managedResources.add(resource);
- } else {
- TagSource tagSource= TagSource.create(new ICVSResource[] { resource });
- if (isTagPresent(tagSource, tag)) {
- managedResources.add(resource);
- } else {
- // If the tag usn't present, lets refresh just to make sure
- try {
- tagSource.refresh(false, monitor);
- if (isTagPresent(tagSource, tag)) {
- managedResources.add(resource);
- } else {
- tagSource.refresh(true, monitor);
- if (isTagPresent(tagSource, tag)) {
- managedResources.add(resource);
- }
- }
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- }
-
- private boolean isTagPresent(TagSource tagSource, CVSTag tag) {
- CVSTag[] tags= tagSource.getTags(TagSource.convertIncludeFlaqsToTagTypes(TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS));
- return Arrays.asList(tags).contains(tag);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation#getUpdateCommand()
- */
- protected Update getUpdateCommand() {
- // Use a special replace command that doesn't set back the timestamps
- // of files in the passed set if it recreates them.
- return new Replace(prepDeletedFiles);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.ReplaceOperation_0, new String[] { provider.getProject().getName() });
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
deleted file mode 100644
index adac516c1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation that divides the resources by location
- */
-public abstract class RepositoryLocationOperation extends RemoteOperation {
-
- protected RepositoryLocationOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources) {
- super(part, remoteResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- Map table = getLocationMapping(getRemoteResources());
- Set keySet = table.keySet();
- monitor.beginTask(null, keySet.size() * 100);
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- ICVSRepositoryLocation location = (ICVSRepositoryLocation)iterator.next();
- List list = (List)table.get(location);
- ICVSRemoteResource[] remoteResources = (ICVSRemoteResource[])list.toArray(new ICVSRemoteResource[list.size()]);
- execute(location, remoteResources, Policy.subMonitorFor(monitor, 100));
- }
- }
-
- /**
- * Perform the operation for the given resources found on the
- * given repository.
- * @param location the repository location
- * @param resources the resources of this operation found in the repository
- * @param monitor a progres monitor
- */
- protected abstract void execute(ICVSRepositoryLocation location, ICVSRemoteResource[] resources, IProgressMonitor monitor) throws CVSException;
-
- /*
- * Return a map that maps a location to all the resources
- * from the given list that are located in that repository.
- */
- private Map getLocationMapping(ICVSRemoteResource[] remoteResources) {
- Map locationsMap = new HashMap();
- for (int i = 0; i < remoteResources.length; i++) {
- ICVSRemoteResource resource = remoteResources[i];
- ICVSRepositoryLocation location = resource.getRepository();
- List resources = (List)locationsMap.get(location);
- if (resources == null) {
- resources = new ArrayList();
- locationsMap.put(location, resources);
- }
- resources.add(resource);
- }
- return locationsMap;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java
deleted file mode 100644
index a7c14bd9e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.mapping.ISynchronizationScope;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.mapping.BuildScopeOperation;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Performs a cvs operation on multiple repository providers
- */
-public abstract class RepositoryProviderOperation extends CVSOperation {
-
- /**
- * Flag to indicate whether models are to be consulted when building
- * the scope. This is provided for testing purposes and is not expected
- * to be used otherwise.
- */
- public static boolean consultModelsWhenBuildingScope = true;
-
- private ISynchronizationScopeManager manager;
- private final ResourceMapping[] selectedMappings;
-
- /**
- * Interface that is available to sublcasses which identifies
- * the depth for various resources. The files will be included
- * in whichever group (deep or shallow) has resources.
- */
- public interface ICVSTraversal {
- IResource[] getShallowResources();
- IResource[] getDeepResources();
- IResource[] getNontraversedFolders();
- }
-
- /*
- * A map entry for a provider that divides the traversals to be performed by depth.
- * There are really only
- */
- private static class TraversalMapEntry implements ICVSTraversal {
- // The provider for this entry
- RepositoryProvider provider;
- // Files are always shallow
- List files = new ArrayList();
- // Not sure what to do with zero depth folders but we'll record them
- List zeroFolders = new ArrayList();
- // Non-recursive folder (-l)
- List shallowFolders = new ArrayList();
- // Recursive folders (-R)
- List deepFolders = new ArrayList();
- public TraversalMapEntry(RepositoryProvider provider) {
- this.provider = provider;
- }
- /**
- * Add the resources from the traversals to the entry
- * @param traversals the traversals
- */
- public void add(ResourceTraversal[] traversals) {
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- add(traversal);
- }
- }
- /**
- * Add the resources from the traversal to the entry
- * @param traversal the traversal
- */
- public void add(ResourceTraversal traversal) {
- IResource[] resources = traversal.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getProject().equals(provider.getProject())) {
- if (resource.getType() == IResource.FILE) {
- files.add(resource);
- } else {
- switch (traversal.getDepth()) {
- case IResource.DEPTH_ZERO:
- zeroFolders.add(resource);
- break;
- case IResource.DEPTH_ONE:
- shallowFolders.add(resource);
- break;
- case IResource.DEPTH_INFINITE:
- deepFolders.add(resource);
- break;
- default:
- deepFolders.add(resource);
- }
- }
- }
- }
- }
- /**
- * Return the resources that can be included in a shallow operation.
- * Include files with the shallow resources if there are shallow folders
- * or if there are no shallow or deep folders.
- * @return the resources that can be included in a shallow operation
- */
- public IResource[] getShallowResources() {
- if (shallowFolders.isEmpty() && deepFolders.isEmpty() && !files.isEmpty()) {
- return (IResource[]) files.toArray(new IResource[files.size()]);
- }
- if (!shallowFolders.isEmpty()) {
- if (files.isEmpty()) {
- return (IResource[]) shallowFolders.toArray(new IResource[shallowFolders.size()]);
- }
- List result = new ArrayList();
- result.addAll(shallowFolders);
- result.addAll(files);
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
- return new IResource[0];
- }
- /**
- * Return the resources to be included in a deep operation.
- * If there are no shallow folders, this will include any files.
- * @return
- */
- public IResource[] getDeepResources() {
- if (deepFolders.isEmpty())
- return new IResource[0];
- if (!shallowFolders.isEmpty())
- return (IResource[]) deepFolders.toArray(new IResource[deepFolders.size()]);
- List result = new ArrayList();
- result.addAll(deepFolders);
- result.addAll(files);
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
- /**
- * Return the folders that are depth zero
- */
- public IResource[] getNontraversedFolders() {
- return (IResource[]) zeroFolders.toArray(new IResource[zeroFolders.size()]);
- }
- }
-
-
- /**
- * Convert the provided resources to one or more resource mappers
- * that traverse the elements deeply. The model element of the resource
- * mappers will be an IStructuredSelection.
- * @param resources the resources
- * @return a resource mappers that traverses the resources
- */
- public static ResourceMapping[] asResourceMappers(final IResource[] resources) {
- return asResourceMappers(resources, IResource.DEPTH_INFINITE);
- }
-
- /**
- * Convert the provided resources to one or more resource mappers
- * that traverse the elements deeply. The model element of the resource
- * mappers will be an IStructuredSelection.
- * @param resources the resources
- * @return a resource mappers that traverses the resources
- */
- public static ResourceMapping[] asResourceMappers(final IResource[] resources, int depth) {
- return WorkspaceResourceMapper.asResourceMappers(resources, depth);
- }
-
- public RepositoryProviderOperation(IWorkbenchPart part, final IResource[] resources) {
- this(part, asResourceMappers(resources));
- }
-
- public RepositoryProviderOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings) {
- super(part);
- this.selectedMappings = selectedMappings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(null, 100);
- buildScope(monitor);
- Map table = getProviderTraversalMapping(Policy.subMonitorFor(monitor, 30));
- execute(table, Policy.subMonitorFor(monitor, 30));
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected void endOperation() throws CVSException {
- if (manager != null) {
- manager.dispose();
- manager = null;
- }
- super.endOperation();
- }
-
- public ISynchronizationScope buildScope(IProgressMonitor monitor) throws InterruptedException, CVSException {
- if (manager == null) {
- manager = createScopeManager(consultModelsWhenBuildingScope && consultModelsForMappings());
- BuildScopeOperation op = new BuildScopeOperation(getPart(), manager);
- try {
- op.run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- }
- }
- return manager.getScope();
- }
-
- /**
- * Create the scope manager to be used by this operation.
- * @param consultModels whether models should be consulted to include additional mappings
- * @return a scope manager
- */
- protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
- return new SynchronizationScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels);
- }
-
- private void execute(Map providerTraversal, IProgressMonitor monitor) throws CVSException, InterruptedException {
- Set keySet = providerTraversal.keySet();
- monitor.beginTask(null, keySet.size() * 1000);
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- monitor.setTaskName(getTaskName(provider));
- TraversalMapEntry entry = (TraversalMapEntry)providerTraversal.get(provider);
- execute(provider, entry, Policy.subMonitorFor(monitor, 1000));
- }
- }
-
- /**
- * Execute the operation on the given set of traversals
- * @param provider
- * @param entry
- * @param subMonitor
- * @throws CVSException
- * @throws InterruptedException
- */
- protected void execute(CVSTeamProvider provider, ICVSTraversal entry, IProgressMonitor monitor) throws CVSException, InterruptedException {
- IResource[] deepResources = entry.getDeepResources();
- IResource[] shallowResources = entry.getShallowResources();
- IResource[] nontraversedFolders = entry.getNontraversedFolders();
- try {
- monitor.beginTask(getTaskName(provider), (deepResources.length > 0 ? 100 : 0) + (shallowResources.length > 0 ? 100 : 0) + (nontraversedFolders.length > 0 ? 10 : 0));
- if (deepResources.length == 0 && shallowResources.length == 0 && nontraversedFolders.length == 0)
- return;
- final ISchedulingRule rule = getSchedulingRule(provider);
- try {
- Platform.getJobManager().beginRule(rule, monitor);
- if (deepResources.length > 0)
- execute(provider, deepResources, true /* recurse */, Policy.subMonitorFor(monitor, 100));
- if (shallowResources.length > 0)
- execute(provider, shallowResources, false /* recurse */, Policy.subMonitorFor(monitor, 100));
- if (nontraversedFolders.length > 0) {
- handleNontraversedFolders(provider, nontraversedFolders, Policy.subMonitorFor(monitor, 10));
- }
- } finally {
- Platform.getJobManager().endRule(rule);
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Handle any non-traversed (depth-zero) folders that were in the logical modle that primed this operation.
- * @param provider the repository provider associated with the project containing the folders
- * @param nontraversedFolders the folders
- * @param monitor a progress monitor
- */
- protected void handleNontraversedFolders(CVSTeamProvider provider, IResource[] nontraversedFolders, IProgressMonitor monitor) throws CVSException {
- // Default is do nothing
- }
-
- /**
- * Return the taskname to be shown in the progress monitor while operating
- * on the given provider.
- * @param provider the provider being processed
- * @return the taskname to be shown in the progress monitor
- */
- protected abstract String getTaskName(CVSTeamProvider provider);
-
- /**
- * Retgurn the scheduling rule to be obtained before work
- * begins on the given provider. By default, it is the provider's project.
- * This can be changed by subclasses.
- * @param provider
- * @return
- */
- protected ISchedulingRule getSchedulingRule(CVSTeamProvider provider) {
- return provider.getProject();
- }
-
- /*
- * Helper method. Return a Map mapping provider to a list of resources
- * shared with that provider.
- */
- private Map getProviderTraversalMapping(IProgressMonitor monitor) throws CoreException {
- Map result = new HashMap();
- ResourceMapping[] mappings = getScope().getMappings();
- for (int j = 0; j < mappings.length; j++) {
- ResourceMapping mapping = mappings[j];
- IProject[] projects = mapping.getProjects();
- ResourceTraversal[] traversals = getScope().getTraversals(mapping);
- for (int k = 0; k < projects.length; k++) {
- IProject project = projects[k];
- RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider != null) {
- TraversalMapEntry entry = (TraversalMapEntry)result.get(provider);
- if (entry == null) {
- entry = new TraversalMapEntry(provider);
- result.put(provider, entry);
- }
- entry.add(traversals);
- }
- }
- }
- return result;
- }
-
- /**
- * Return the resource mapping context that is to be usd by this operation.
- * By defautl, <code>null</code> is returned but subclasses may override
- * to provide a specific context.
- * @return the resource mapping context for this operaton
- */
- protected ResourceMappingContext getResourceMappingContext() {
- return ResourceMappingContext.LOCAL_CONTEXT;
- }
-
- /**
- * Execute the operation on the resources for the given provider.
- * @param provider the provider for the project that contains the resources
- * @param resources the resources to be operated on
- * @param recurse whether the operation is deep or shallow
- * @param monitor a progress monitor
- * @throws CVSException
- * @throws InterruptedException
- */
- protected abstract void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException;
-
- /**
- * Return the local options for this operation including the
- * option to provide the requested traversal.
- * @param recurse deep or shallow
- * @return the local options for the operation
- */
- protected LocalOption[] getLocalOptions(boolean recurse) {
- if (!recurse) {
- return new LocalOption[] { Command.DO_NOT_RECURSE };
- }
- return Command.NO_LOCAL_OPTIONS;
- }
-
- protected ICVSResource[] getCVSArguments(IResource[] resources) {
- ICVSResource[] cvsResources = new ICVSResource[resources.length];
- for (int i = 0; i < cvsResources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- }
- return cvsResources;
- }
-
- /*
- * Get the arguments to be passed to a commit or update
- */
- protected String[] getStringArguments(IResource[] resources) throws CVSException {
- List arguments = new ArrayList(resources.length);
- for (int i=0;i<resources.length;i++) {
- IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
- if (cvsPath.segmentCount() == 0) {
- arguments.add(Session.CURRENT_LOCAL_FOLDER);
- } else {
- arguments.add(cvsPath.toString());
- }
- }
- return (String[])arguments.toArray(new String[arguments.size()]);
- }
-
- protected ICVSRepositoryLocation getRemoteLocation(CVSTeamProvider provider) throws CVSException {
- CVSWorkspaceRoot workspaceRoot = provider.getCVSWorkspaceRoot();
- return workspaceRoot.getRemoteLocation();
- }
-
- protected ICVSFolder getLocalRoot(CVSTeamProvider provider) throws CVSException {
- CVSWorkspaceRoot workspaceRoot = provider.getCVSWorkspaceRoot();
- return workspaceRoot.getLocalRoot();
- }
-
- /**
- * Update the workspace subscriber for an update operation performed on the
- * given resources. After an update, the remote tree is flushed in order
- * to ensure that stale incoming additions are removed. This need only
- * be done for folders. At the time of writting, all update operations
- * are deep so the flush is deep as well.
- * @param provider the provider (projedct) for all the given resources
- * @param resources the resources that were updated
- * @param recurse
- * @param monitor a progress monitor
- */
- protected void updateWorkspaceSubscriber(CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) {
- CVSWorkspaceSubscriber s = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- if (resource.isFolder()) {
- try {
- s.updateRemote(provider, (ICVSFolder)resource, recurse, Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- // Just log the error and continue
- CVSUIPlugin.log(e);
- }
- } else {
- monitor.worked(100);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#isKeepOneProgressServiceEntry()
- */
- public boolean isKeepOneProgressServiceEntry() {
- // Keep the last repository provider operation in the progress service
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getGotoAction()
- */
- protected IAction getGotoAction() {
- return getShowConsoleAction();
- }
-
- /**
- * Return the root resources for all the traversals of this operation.
- * Tis method may only be invoked after {@link #buildScope(IProgressMonitor) }.
- * @return the root resources for all the traversals of this operation
- * @throws CoreException
- */
- protected IResource[] getTraversalRoots() {
- List result = new ArrayList();
- ResourceTraversal[] traversals = getTraversals();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- result.addAll(Arrays.asList(traversal.getResources()));
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- /**
- * Return the traversals that will be used by this operation.
- * This method can only be called after {@link #buildScope(IProgressMonitor) }.
- * @return the traversals that will be used by this operation
- * @throws CoreException
- */
- public ResourceTraversal[] getTraversals() {
- return getScope().getTraversals();
- }
-
- public boolean consultModelsForMappings() {
- return true;
- }
-
- public ResourceMapping[] getSelectedMappings() {
- return selectedMappings;
- }
-
- public ISynchronizationScope getScope() {
- return manager.getScope();
- }
-
- public ISynchronizationScopeManager getScopeManager() {
- return manager;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
deleted file mode 100644
index 060b18ec1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Create a folder and any missing parents in the repository
- */
-public class ShareProjectOperation extends CVSOperation {
-
- private ICVSRepositoryLocation location;
- private IProject project;
- private String moduleName;
- private Shell shell;
-
- public ShareProjectOperation(Shell shell, ICVSRepositoryLocation location, IProject project, String moduleName) {
- super(null);
- this.shell = shell;
- this.moduleName = moduleName;
- this.project = project;
- this.location = location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(getTaskName(), 100);
- // Create the remote module
- final ICVSRemoteFolder remote = createRemoteFolder(Policy.subMonitorFor(monitor, 50));
- // Map the project to the module in a workspace runnable
- final TeamException[] exception = new TeamException[] {null};
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- mapProjectToRemoteFolder(remote, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
- }
- }, ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project), 0, Policy.subMonitorFor(monitor, 100));
- if (exception[0] != null)
- throw exception[0];
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Create the remote folder to which the project is being mapped
- * (as well as any ancestors) and return it. If the remote folder does not
- * exist remotely, this method will create it.
- * @param monitor a progress monitor
- * @return the existing remote folder to which the project is being mapped
- * @throws CVSException
- */
- protected ICVSRemoteFolder createRemoteFolder(IProgressMonitor monitor) throws CVSException {
- String projectName = project.getName();
- if (moduleName == null)
- moduleName = projectName;
-
- RemoteFolderTree root = new RemoteFolderTree(null, location, Path.EMPTY.toString(), null);
- Path path = new Path(null, moduleName);
-
- try {
- monitor.beginTask(getTaskName(), 100 * path.segmentCount());
- return ensureTreeExists(root, path, monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Map the project to the remote folder by associating the CVS
- * Repository Provider with the project and, at the very least,
- * assigning the folder sync info for the remote folder as the
- * folder sync info for the project.
- * @param remote the remote folder to which the projetc is being mapped
- * @param monitor a progress monitor
- * @throws CVSException
- */
- protected void mapProjectToRemoteFolder(final ICVSRemoteFolder remote, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- purgeAnyCVSFolders(Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- // Link the project to the newly created module
- monitor.subTask(NLS.bind(CVSUIMessages.ShareProjectOperation_3, new String[] { project.getName(), remote.getRepositoryRelativePath() }));
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- folder.setFolderSyncInfo(remote.getFolderSyncInfo());
- //Register it with Team. If it already is, no harm done.
- RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
- monitor.done();
- }
-
- /*
- * Create handles for all the children in the moduleName path
- */
- private RemoteFolderTree createChild(RemoteFolderTree parent, String name, IProgressMonitor monitor) throws CVSException, TeamException {
- RemoteFolderTree child = new RemoteFolderTree(parent, name, location, new Path(null, parent.getRepositoryRelativePath()).append(name).toString(), null);
- parent.setChildren(new ICVSRemoteResource[] { child });
- if (child.exists(Policy.subMonitorFor(monitor, 50))) {
- // The child exists so get the handle that was received from the server
- return (RemoteFolderTree)parent.getFolder(name);
- } else {
- // Create the folder remotely
- createFolder(child, Policy.subMonitorFor(monitor, 50));
- return child;
- }
- }
-
- /*
- * Ensure that all the folders in the tree exist
- */
- private ICVSRemoteFolder ensureTreeExists(RemoteFolderTree folder, IPath path, IProgressMonitor monitor) throws TeamException {
- if (path.isEmpty()) return folder;
- String name = path.segment(0);
- RemoteFolderTree child = createChild(folder, name, monitor);
- return ensureTreeExists(child, path.removeFirstSegments(1), monitor);
- }
-
- private void createFolder(RemoteFolderTree folder, IProgressMonitor monitor) throws TeamException {
- Session s = new Session(location, folder.getParent());
- s.open(monitor, true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- new String[] { folder.getName() },
- null,
- monitor);
- // If we get a warning, the operation most likely failed so check that the status is OK
- if (status.getCode() == CVSStatus.SERVER_ERROR || ! status.isOK()) {
- throw new CVSServerException(status);
- }
- } finally {
- s.close();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return NLS.bind(CVSUIMessages.ShareProjectOperation_0, new String[] { project.getName(), moduleName });
- }
-
- /**
- * @return Returns the project.
- */
- public IProject getProject() {
- return project;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getShell()
- */
- public Shell getShell() {
- return shell;
- }
-
- /**
- * Method findCommonRootInSubfolders.
- * @param monitor
- * @return String
- */
- private void purgeAnyCVSFolders(final IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- folder.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // nothing to do for files
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- monitor.subTask(NLS.bind(CVSUIMessages.ShareProjectOperation_2, new String[] { folder.getIResource().getFullPath().toString() } ));
- if (folder.isCVSFolder()) {
- // for now, just unmanage
- folder.unmanage(null);
- }
- }
- }, true /* recurse */);
- } catch (CVSException e) {
- // log the exception and return null
- CVSUIPlugin.log(e);
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
deleted file mode 100644
index c166321e8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Eugene Kuleshov <eu@md.pp.ru> - Bug 173959 add mechanism for navigating from team annotation to corresponding task
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.revisions.Revision;
-import org.eclipse.jface.text.revisions.RevisionInformation;
-import org.eclipse.jface.text.source.LineRange;
-import org.eclipse.swt.SWT;
-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.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.AnnotateListener;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.history.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
-
-import com.ibm.icu.text.DateFormat;
-
-/**
- * An operation to fetch the annotations for a file from the repository and
- * display them in the annotations view.
- */
-public class ShowAnnotationOperation extends CVSOperation {
-
- private final ICVSResource fCVSResource;
- private final String fRevision;
- private final boolean fBinary;
-
- public ShowAnnotationOperation(IWorkbenchPart part, ICVSResource cvsResource, String revision, boolean binary) {
- super(part);
- fCVSResource= cvsResource;
- fRevision= revision;
- fBinary = binary;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
-
- monitor.beginTask(null, 100);
-
- // Get the annotations from the repository.
- final AnnotateListener listener= new AnnotateListener();
- fetchAnnotation(listener, fCVSResource, fRevision, Policy.subMonitorFor(monitor, 80));
-
- // this is not needed if there is no live annotate
- final RevisionInformation information = createRevisionInformation(listener, Policy.subMonitorFor(monitor, 20));
-
- // Open the view and display it from the UI thread.
- final Display display= getPart().getSite().getShell().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- try {
- //is there an open editor for the given input? If yes, use live annotate
- final AbstractDecoratedTextEditor editor= getEditor(listener);
- if (editor != null) {
- editor.showRevisionInformation(information, "org.eclipse.quickdiff.providers.CVSReferenceProvider"); //$NON-NLS-1$
- final IWorkbenchPage page= getPart().getSite().getPage();
- showHistoryView(page, editor);
- page.activate(editor);
- }
- } catch (PartInitException e) {
- CVSException.wrapException(e);
- }
- }
- });
-
- monitor.done();
- }
-
- /**
- * Shows the history view, creating it if necessary, but does not give it focus.
- *
- * @param page the workbench page to operate in
- * @param editor the editor that is showing the file
- * @return the history view
- * @throws PartInitException
- */
- private IHistoryView showHistoryView(IWorkbenchPage page, AbstractDecoratedTextEditor editor) throws PartInitException {
- Object object = fCVSResource.getIResource();
- if (object == null)
- object = editor.getEditorInput();
- IHistoryView historyView= TeamUI.showHistoryFor(page, object, null);
- IHistoryPage historyPage = historyView.getHistoryPage();
- if (historyPage instanceof CVSHistoryPage){
- CVSHistoryPage cvsHistoryPage = (CVSHistoryPage) historyPage;
- cvsHistoryPage.setMode(CVSHistoryPage.REMOTE_MODE);
- // We need to call link to ensure that the history page gets linked
- // even if the page input did not change
- cvsHistoryPage.linkWithEditor();
- }
- return historyView;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.ShowAnnotationOperation_taskName;
- }
-
- protected boolean hasCharset(ICVSResource cvsResource, InputStream contents) {
- try {
- return TeamPlugin.getCharset(cvsResource.getName(), contents) != null;
- } catch (IOException e) {
- // Assume that the contents do have a charset
- return true;
- }
- }
-
- private AbstractDecoratedTextEditor getEditor(AnnotateListener listener) throws PartInitException {
- IResource resource= fCVSResource.getIResource();
- if (resource instanceof IFile){
- return RevisionAnnotationController.openEditor(getPart().getSite().getPage(), (IFile)resource);
- }
- if (fCVSResource instanceof ICVSRemoteResource) {
- return RevisionAnnotationController.openEditor(getPart().getSite().getPage(), fCVSResource, new RemoteAnnotationStorage((ICVSRemoteFile)fCVSResource, listener.getContents()));
- }
- return null;
- }
-
- private void fetchAnnotation(AnnotateListener listener, ICVSResource cvsResource, String revision, IProgressMonitor monitor) throws CVSException {
-
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
-
- final ICVSFolder folder = cvsResource.getParent();
- final FolderSyncInfo info = folder.getFolderSyncInfo();
- final ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
-
- final Session session = new Session(location, folder, true /*output to console*/);
- session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
- try {
- final Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- List localOptions = new ArrayList();
- if (revision != null) {
- localOptions.add(Annotate.makeRevisionOption(revision));
- }
- if (fBinary) {
- localOptions.add(Annotate.FORCE_BINARY_ANNOTATE);
- }
- final IStatus status = Command.ANNOTATE.execute(session, Command.NO_GLOBAL_OPTIONS, (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]), new ICVSResource[]{cvsResource}, listener, Policy.subMonitorFor(monitor, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
- }
- } finally {
- session.close();
- }
- }
-
- private RevisionInformation createRevisionInformation(final AnnotateListener listener, IProgressMonitor monitor) throws CVSException {
- Map logEntriesByRevision= new HashMap();
- if (fCVSResource instanceof ICVSFile) {
- try {
- ILogEntry[] logEntries= ((ICVSFile) fCVSResource).getLogEntries(monitor);
- for (int i= 0; i < logEntries.length; i++) {
- ILogEntry entry= logEntries[i];
- logEntriesByRevision.put(entry.getRevision(), entry);
- }
- } catch (CVSException e) {
- throw e;
- } catch (TeamException e) {
- // XXX why does getLogEntries throw TeamException?
- throw CVSException.wrapException(e);
- }
- }
-
- final CommitterColors colors= CommitterColors.getDefault();
- RevisionInformation info= new RevisionInformation();
-
- class AnnotationControlCreator implements IInformationControlCreator {
- private final boolean showTooltipAffordance;
-
- public AnnotationControlCreator(boolean showTooltipAffordance) {
- this.showTooltipAffordance = showTooltipAffordance;
- }
-
- public IInformationControl createInformationControl(Shell parent) {
- String statusFieldText = showTooltipAffordance ? EditorsUI.getTooltipAffordanceString() : null;
- return new SourceViewerInformationControl(parent, SWT.TOOL,
- SWT.NONE, JFaceResources.DEFAULT_FONT, statusFieldText);
- }
- }
-
- info.setHoverControlCreator(new AnnotationControlCreator(true));
- info.setInformationPresenterControlCreator(new AnnotationControlCreator(false));
-
- HashMap sets= new HashMap();
- List annotateBlocks= listener.getCvsAnnotateBlocks();
- for (Iterator blocks= annotateBlocks.iterator(); blocks.hasNext();) {
- final CVSAnnotateBlock block= (CVSAnnotateBlock) blocks.next();
- final String revisionString= block.getRevision();
- Revision revision= (Revision) sets.get(revisionString);
- if (revision == null) {
- final ILogEntry entry= (ILogEntry) logEntriesByRevision.get(revisionString);
- if (entry == null)
- continue;
-
- revision= new Revision() {
- private String fCommitter= null;
-
- public Object getHoverInfo() {
- if (entry != null)
- return entry.getAuthor() + " " + entry.getRevision() + " " + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(entry.getDate()) //$NON-NLS-1$ //$NON-NLS-2$
- + "\n\n" + entry.getComment(); //$NON-NLS-1$
-
- return block.toString().substring(0, block.toString().indexOf(" (")); //$NON-NLS-1$
- }
-
- private String getCommitterId() {
- if (fCommitter == null)
- fCommitter= block.toString().substring(0, block.toString().indexOf(' '));
- return fCommitter;
- }
-
- public String getId() {
- return revisionString;
- }
-
- public Date getDate() {
- return entry.getDate();
- }
-
- public RGB getColor() {
- return colors.getCommitterRGB(getCommitterId());
- }
-
- public String getAuthor() {
- return getCommitterId();
- }
- };
- sets.put(revisionString, revision);
- info.addRevision(revision);
- }
- revision.addRange(new LineRange(block.getStartLine(), block.getEndLine() - block.getStartLine() + 1));
- }
-
- return info;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
deleted file mode 100644
index 2b2eceff3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class SingleCommandOperation extends RepositoryProviderOperation {
-
- private LocalOption[] options = Command.NO_LOCAL_OPTIONS;
-
- public SingleCommandOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options) {
- super(part, mappings);
- if (options != null) {
- this.options = options;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- monitor.beginTask(null, 100);
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 10), isServerModificationOperation());
- try {
- IStatus status = executeCommand(session, provider, getCVSArguments(session, resources), recurse, Policy.subMonitorFor(monitor, 90));
- if (isReportableError(status)) {
- throw new CVSException(status);
- }
- } finally {
- session.close();
- }
- }
-
- protected final ICVSResource[] getCVSArguments(IResource[] resources) {
- return super.getCVSArguments(resources);
- }
-
- protected ICVSResource[] getCVSArguments(Session session, IResource[] resources) {
- return getCVSArguments(resources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation.ICVSTraversal, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, ICVSTraversal entry, IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- // TODO: This does not properly count the number of operations
- // Changing it causes an error in the test cases
- super.execute(provider, entry, monitor);
- collectStatus(Status.OK_STATUS);
- } catch (CVSException e) {
- collectStatus(e.getStatus());
- }
- }
- /**
- * Indicate whether the operation requires write access to the server (i.e.
- * the operation changes state on the server whether it be to commit, tag, admin, etc).
- * @return
- */
- protected boolean isServerModificationOperation() {
- return false;
- }
-
- /**
- * Method overridden by subclasses to issue the command to the CVS repository using the given session.
- * @param session an open session which will be closed by the caller
- * @param provider the provider for the project that contains the resources
- * @param resources the resources to be operated on
- * @param recurse whether the operation is deep or shallow
- * @param monitor a progress monitor
- */
- protected abstract IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException;
-
- protected LocalOption[] getLocalOptions(boolean recurse) {
- LocalOption[] result = options;
- if (recurse) {
- // For deep operations, we just need to make sure that the -l option isn't present
- result = Command.DO_NOT_RECURSE.removeFrom(options);
- } else {
- result = Command.RECURSE.removeFrom(options);
- result = Command.DO_NOT_RECURSE.addTo(options);
- }
- return result;
- }
-
- protected void setLocalOptions(LocalOption[] options) {
- this.options = options;
- }
-
- protected void addLocalOption(LocalOption option) {
- options = option.addTo(options);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectScopeManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectScopeManager.java
deleted file mode 100644
index 9265358ad..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectScopeManager.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-
-public final class SingleProjectScopeManager extends SynchronizationScopeManager {
- private final IProject project;
- public SingleProjectScopeManager(String name, ResourceMapping[] mappings, ResourceMappingContext context, boolean models, IProject project) {
- super(name, mappings, context, models);
- this.project = project;
- }
- public ISchedulingRule getSchedulingRule() {
- return project;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectSubscriberContext.java
deleted file mode 100644
index 933bf1ad5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleProjectSubscriberContext.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
-
-public final class SingleProjectSubscriberContext extends SubscriberResourceMappingContext {
- private final IProject project;
-
- public SingleProjectSubscriberContext(Subscriber subscriber, boolean refresh, IProject project) {
- super(subscriber, refresh);
- this.project = project;
- }
-
- public IProject[] getProjects() {
- return new IProject[] { project };
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SourceViewerInformationControl.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SourceViewerInformationControl.java
deleted file mode 100644
index 9611f31fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SourceViewerInformationControl.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Eugene Kuleshov <eu@md.pp.ru> - Bug 173959 add mechanism for navigating from team annotation to corresponding task
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-
-/**
- * Source viewer based implementation of {@link org.eclipse.jface.text.IInformationControl}.
- * Displays information in a source viewer.
- *
- * @since 3.0
- *
- * This class is copied from org.eclipse.jface.text.source.projection.SourceViewerInformationControl
- * Several changes are made in order to handle hover for CVS annotations
- */
-class SourceViewerInformationControl implements IInformationControl, IInformationControlExtension, DisposeListener {
-
- /** Border thickness in pixels. */
- private static final int BORDER= 1;
-
-
- /** The control's shell */
- private Shell fShell;
- /** The control's text widget */
- private StyledText fText;
- /** The control's source viewer */
- private SourceViewer fViewer;
- /** The optional status field. */
- private Label fStatusField;
- /** The separator for the optional status field. */
- private Label fSeparator;
- /** The font of the optional status text label.*/
- private Font fStatusTextFont;
- /** The maximal widget width. */
- private int fMaxWidth;
- /** The maximal widget height. */
- private int fMaxHeight;
-
-
- /**
- * Creates a source viewer information control with the given shell as
- * parent and the given font.
- *
- * @param parent the parent shell
- * @param symbolicFontName the symbolic font name
- */
- public SourceViewerInformationControl(Shell parent, String symbolicFontName) {
- this(parent, SWT.NO_TRIM | SWT.TOOL, SWT.NONE, symbolicFontName, null);
- }
-
- /**
- * Creates a source viewer information control with the given shell as
- * parent. The given shell styles are applied to the created shell. The
- * given styles are applied to the created styled text widget. The text
- * widget will be initialized with the given font. The status field will
- * contain the given text or be hidden.
- *
- * @param parent the parent shell
- * @param shellStyle the additional styles for the shell
- * @param style the additional styles for the styled text widget
- * @param symbolicFontName the symbolic font name
- * @param statusFieldText the text to be used in the optional status field
- * or <code>null</code> if the status field should be hidden
- */
- public SourceViewerInformationControl(Shell parent, int shellStyle, int style, String symbolicFontName, String statusFieldText) {
- GridLayout layout;
- GridData gd;
-
- fShell= new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP | shellStyle);
- Display display= fShell.getDisplay();
- fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
-
- Composite composite= fShell;
- layout= new GridLayout(1, false);
- int border= ((shellStyle & SWT.NO_TRIM) == 0) ? 0 : BORDER;
- layout.marginHeight= border;
- layout.marginWidth= border;
- composite.setLayout(layout);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- composite.setLayoutData(gd);
-
- if (statusFieldText != null) {
- composite= new Composite(composite, SWT.NONE);
- layout= new GridLayout(1, false);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- composite.setLayout(layout);
- gd= new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(gd);
- composite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- composite.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- }
-
- // Source viewer
- fViewer= new SourceViewer(composite, null, style);
- fViewer.setEditable(false);
-
- // configure hyperlink detectors
- // fViewer.configure(new SourceViewerConfiguration());
- fViewer.configure(new TextSourceViewerConfiguration(EditorsUI.getPreferenceStore()) {
- protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
- return Collections.singletonMap("org.eclipse.ui.DefaultTextEditor", //$NON-NLS-1$
- null);
-// new IAdaptable() {
-// public Object getAdapter(Class adapter) {
-// // return Platform.getAdapterManager().getAdapter(CVSHistoryPage.this, adapter);
-// return null;
-// }
-// });
- }
- });
-
- fText= fViewer.getTextWidget();
- gd= new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
- fText.setLayoutData(gd);
- fText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- fText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- fText.setFont(JFaceResources.getFont(symbolicFontName));
-
- fText.addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
- if (e.character == 0x1B) // ESC
- fShell.dispose();
- }
-
- public void keyReleased(KeyEvent e) {}
- });
-
- // Status field
- if (statusFieldText != null) {
-
- // Horizontal separator line
- fSeparator= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.LINE_DOT);
- fSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Status field label
- fStatusField= new Label(composite, SWT.RIGHT);
- fStatusField.setText(statusFieldText);
- Font font= fStatusField.getFont();
- FontData[] fontDatas= font.getFontData();
- for (int i= 0; i < fontDatas.length; i++)
- fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
- fStatusTextFont= new Font(fStatusField.getDisplay(), fontDatas);
- fStatusField.setFont(fStatusTextFont);
- GridData gd2= new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
- fStatusField.setLayoutData(gd2);
-
- // Regarding the color see bug 41128
- fStatusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
-
- fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- }
-
- addDisposeListener(this);
- }
-
- /**
- * @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
- * @param input the input object
- */
- public void setInput(Object input) {
- if (input instanceof String)
- setInformation((String)input);
- else
- setInformation(null);
- }
-
- /*
- * @see IInformationControl#setInformation(String)
- */
- public void setInformation(String content) {
- if (content == null) {
- fViewer.setInput(null);
- return;
- }
-
- IDocument doc= new Document(content);
- fViewer.setInput(doc);
-
- // decorate text
- StyleRange styleRange = new StyleRange();
- styleRange.start = 0;
- styleRange.length = content.indexOf('\n');
- styleRange.fontStyle = SWT.BOLD;
- fViewer.getTextWidget().setStyleRange(styleRange);
- }
-
- /*
- * @see IInformationControl#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- fShell.setVisible(visible);
- }
-
- /*
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
- */
- public void widgetDisposed(DisposeEvent event) {
- if (fStatusTextFont != null && !fStatusTextFont.isDisposed())
- fStatusTextFont.dispose();
-
- fStatusTextFont= null;
- fShell= null;
- fText= null;
- }
-
- /*
- * @see org.eclipse.jface.text.IInformationControl#dispose()
- */
- public final void dispose() {
- if (fShell != null && !fShell.isDisposed())
- fShell.dispose();
- else
- widgetDisposed(null);
- }
-
- /*
- * @see IInformationControl#setSize(int, int)
- */
- public void setSize(int width, int height) {
-
- if (fStatusField != null) {
- GridData gd= (GridData)fViewer.getTextWidget().getLayoutData();
- Point statusSize= fStatusField.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- Point separatorSize= fSeparator.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- gd.heightHint= height - statusSize.y - separatorSize.y;
- }
- fShell.setSize(width, height);
-
- if (fStatusField != null)
- fShell.pack(true);
- }
-
- /*
- * @see IInformationControl#setLocation(Point)
- */
- public void setLocation(Point location) {
- fShell.setLocation(location);
- }
-
- /*
- * @see IInformationControl#setSizeConstraints(int, int)
- */
- public void setSizeConstraints(int maxWidth, int maxHeight) {
- fMaxWidth= maxWidth;
- fMaxHeight= maxHeight;
- }
-
- /*
- * @see IInformationControl#computeSizeHint()
- */
- public Point computeSizeHint() {
- // compute the preferred size
- int x= SWT.DEFAULT;
- int y= SWT.DEFAULT;
- Point size= fShell.computeSize(x, y);
- if (size.x > fMaxWidth)
- x= fMaxWidth;
- if (size.y > fMaxHeight)
- y= fMaxHeight;
-
- // recompute using the constraints if the preferred size is larger than the constraints
- if (x != SWT.DEFAULT || y != SWT.DEFAULT)
- size= fShell.computeSize(x, y, false);
-
- return size;
- }
-
- /*
- * @see IInformationControl#addDisposeListener(DisposeListener)
- */
- public void addDisposeListener(DisposeListener listener) {
- fShell.addDisposeListener(listener);
- }
-
- /*
- * @see IInformationControl#removeDisposeListener(DisposeListener)
- */
- public void removeDisposeListener(DisposeListener listener) {
- fShell.removeDisposeListener(listener);
- }
-
- /*
- * @see IInformationControl#setForegroundColor(Color)
- */
- public void setForegroundColor(Color foreground) {
- fText.setForeground(foreground);
- }
-
- /*
- * @see IInformationControl#setBackgroundColor(Color)
- */
- public void setBackgroundColor(Color background) {
- fText.setBackground(background);
- }
-
- /*
- * @see IInformationControl#isFocusControl()
- */
- public boolean isFocusControl() {
- return fText.isFocusControl();
- }
-
- /*
- * @see IInformationControl#setFocus()
- */
- public void setFocus() {
- fShell.forceFocus();
- fText.setFocus();
- }
-
- /*
- * @see IInformationControl#addFocusListener(FocusListener)
- */
- public void addFocusListener(FocusListener listener) {
- fText.addFocusListener(listener);
- }
-
- /*
- * @see IInformationControl#removeFocusListener(FocusListener)
- */
- public void removeFocusListener(FocusListener listener) {
- fText.removeFocusListener(listener);
- }
-
- /*
- * @see IInformationControlExtension#hasContents()
- */
- public boolean hasContents() {
- return fText.getCharCount() > 0;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java
deleted file mode 100644
index e34526ad5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.RTag;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.actions.TagAction;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class TagInRepositoryOperation extends RemoteOperation implements ITagOperation {
-
- private Set localOptions = new HashSet();
- private CVSTag tag;
-
- public TagInRepositoryOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResource) {
- super(part, remoteResource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteResource[] resources = getRemoteResources();
- monitor.beginTask(null, 1000 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IStatus status = resources[i].tag(getTag(), getLocalOptions(), new SubProgressMonitor(monitor, 1000));
- collectStatus(status);
- }
- if (!errorsOccurred()) {
- try {
- TagAction.broadcastTagChange(getCVSResources(), getTag());
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- }
- }
- }
-
- /**
- * Override to dislay the number of tag operations that succeeded
- */
- protected String getErrorMessage(IStatus[] problems, int operationCount) {
- if(operationCount == 1) {
- return CVSUIMessages.TagInRepositoryAction_tagProblemsMessage;
- } else {
- return NLS.bind(CVSUIMessages.TagInRepositoryAction_tagProblemsMessageMultiple, new String[] { Integer.toString(operationCount - problems.length), Integer.toString(problems.length) });
- }
- }
-
- private LocalOption[] getLocalOptions() {
- return (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTag()
- */
- public CVSTag getTag() {
- return tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#setTag(org.eclipse.team.internal.ccvs.core.CVSTag)
- */
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#addLocalOption(org.eclipse.team.internal.ccvs.core.client.Command.LocalOption)
- */
- public void addLocalOption(LocalOption option) {
- localOptions.add(option);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#moveTag()
- */
- public void moveTag() {
- addLocalOption(RTag.FORCE_REASSIGNMENT);
- addLocalOption(RTag.CLEAR_FROM_REMOVED);
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- addLocalOption(RTag.FORCE_BRANCH_REASSIGNMENT);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#recurse()
- */
- public void doNotRecurse() {
- addLocalOption(Command.DO_NOT_RECURSE);
- }
-
- protected String getTaskName() {
- return CVSUIMessages.TagFromRepository_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource()
- */
- public TagSource getTagSource() {
- return TagSource.create(getCVSResources());
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#isEmpty()
- */
- public boolean isEmpty() {
- return getCVSResources().length == 0;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java
deleted file mode 100644
index 0a7490e78..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.TagAction;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class TagOperation extends RepositoryProviderOperation implements ITagOperation {
-
- private Set localOptions = new HashSet();
- private CVSTag tag;
-
- public TagOperation(IWorkbenchPart part, ResourceMapping[] mappers) {
- super(part, mappers);
- }
-
- public CVSTag getTag() {
- return tag;
- }
-
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- IStatus status = tag(provider, resources, recurse, monitor);
- collectStatus(status);
- }
-
- /**
- * Override to dislay the number of tag operations that succeeded
- */
- protected String getErrorMessage(IStatus[] problems, int operationCount) {
- // We accumulated 1 status per resource above.
- if(operationCount == 1) {
- return CVSUIMessages.TagAction_tagProblemsMessage;
- } else {
- return NLS.bind(CVSUIMessages.TagAction_tagProblemsMessageMultiple, new String[] { Integer.toString(operationCount - problems.length), Integer.toString(problems.length) });
- }
- }
-
- /**
- * Tag the resources in the CVS repository with the given tag.
- *
- * The returned IStatus will be a status containing any errors or warnings.
- * If the returned IStatus is a multi-status, the code indicates the severity.
- * Possible codes are:
- * CVSStatus.OK - Nothing to report
- * CVSStatus.SERVER_ERROR - The server reported an error
- * any other code - warning messages received from the server
- * @param recurse
- */
- public IStatus tag(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor progress) throws CVSException {
-
- LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
- if (recurse) {
- commandOptions = Command.DO_NOT_RECURSE.removeFrom(commandOptions);
- } else {
- commandOptions = Command.RECURSE.removeFrom(commandOptions);
- commandOptions = Command.DO_NOT_RECURSE.addTo(commandOptions);
- }
-
- // Build the arguments list
- String[] arguments = getStringArguments(resources);
-
- // Execute the command
- CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
- Session s = new Session(root.getRemoteLocation(), root.getLocalRoot());
- progress.beginTask(null, 100);
- try {
- // Opening the session takes 20% of the time
- s.open(Policy.subMonitorFor(progress, 20), true /* open for modification */);
- return Command.TAG.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- commandOptions,
- tag,
- arguments,
- null,
- Policy.subMonitorFor(progress, 80));
- } finally {
- s.close();
- progress.done();
- }
- }
-
- public void addLocalOption(LocalOption option) {
- localOptions.add(option);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#moveTag()
- */
- public void moveTag() {
- addLocalOption(Tag.FORCE_REASSIGNMENT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#recurse()
- */
- public void doNotRecurse() {
- addLocalOption(Command.DO_NOT_RECURSE);
- }
-
- protected String getTaskName() {
- return CVSUIMessages.TagFromWorkspace_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.TagOperation_0, new String[] { provider.getProject().getName() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- super.execute(monitor);
- if (!errorsOccurred()) {
- try {
- TagAction.broadcastTagChange(getCVSResources(), getTag());
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- }
- }
- }
-
- private ICVSResource[] getCVSResources() {
- IResource[] resources = getTraversalRoots();
- ICVSResource[] cvsResources = new ICVSResource[resources.length];
- for (int i = 0; i < resources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- }
- return cvsResources;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource()
- */
- public TagSource getTagSource() {
- return TagSource.create(getProjects());
- }
-
- private IProject[] getProjects() {
- ResourceMapping[] mappings = getSelectedMappings();
- Set projects = new HashSet();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
- projects.addAll(Arrays.asList(mapping.getProjects()));
- }
- return (IProject[]) projects.toArray(new IProject[projects.size()]);
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#isEmpty()
- */
- public boolean isEmpty() {
- return getSelectedMappings().length == 0;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java
deleted file mode 100644
index ac3bd2979..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation performs an update that will only effect files
- * that have no conflicts or automergable conflicts.
- */
-public class UpdateOnlyMergableOperation extends SingleCommandOperation {
-
- List skippedFiles = new ArrayList();
- private final IProject project;
-
- public UpdateOnlyMergableOperation(IWorkbenchPart part, IProject project, IResource[] resources, LocalOption[] localOptions) {
- super(part, asResourceMappers(resources), localOptions);
- this.project = project;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
- UpdateMergableOnly update = new UpdateMergableOnly();
- IStatus status = update.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(recurse),
- resources,
- null,
- monitor);
- if (status.getSeverity() != IStatus.ERROR) {
- addSkippedFiles(update.getSkippedFiles());
- return OK;
- }
- return status;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.UpdateOnlyMergeable_taskName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.UpdateOperation_0, new String[] { provider.getProject().getName() });
- }
-
- protected void addSkippedFiles(IFile[] files) {
- skippedFiles.addAll(Arrays.asList(files));
- }
-
- public IFile[] getSkippedFiles() {
- return (IFile[]) skippedFiles.toArray(new IFile[skippedFiles.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation#getResourceMappingContext()
- */
- protected ResourceMappingContext getResourceMappingContext() {
- return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
- }
-
- protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
- return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
deleted file mode 100644
index 4314d9627..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation which performs a CVS update
- */
-public class UpdateOperation extends SingleCommandOperation {
-
- private CVSTag tag;
-
- /**
- * Create an UpdateOperation that will perform on update on the given resources
- * using the given local option. If a tag is provided, it will be added to the
- * local options using the appropriate argument (-r or -D). If the tag is <code>null</code>
- * then the tag will be omitted from the local options and the tags on the local resources
- * will be used.
- */
- public UpdateOperation(IWorkbenchPart part, IResource[] resources, LocalOption[] options, CVSTag tag) {
- this(part, asResourceMappers(resources), options, tag);
- }
-
- /**
- * Create an UpdateOperation that will perform on update on the given resources
- * using the given local option. If a tag is provided, it will be added to the
- * local options using the appropriate argument (-r or -D). If the tag is <code>null</code>
- * then the tag will be omitted from the local options and the tags on the local resources
- * will be used.
- */
- public UpdateOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options, CVSTag tag) {
- super(part, mappings, options);
- this.tag = tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(
- Session session,
- CVSTeamProvider provider,
- ICVSResource[] resources,
- boolean recurse, IProgressMonitor monitor)
- throws CVSException, InterruptedException {
-
- LocalOption[] commandOptions = getLocalOptions(recurse);
-
- monitor.beginTask(null, 100);
- IStatus execute = getUpdateCommand().execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- commandOptions,
- resources,
- getCommandOutputListener(),
- Policy.subMonitorFor(monitor, 95));
-
- updateWorkspaceSubscriber(provider, resources, recurse, Policy.subMonitorFor(monitor, 5));
- monitor.done();
- return execute;
- }
-
- protected LocalOption[] getLocalOptions(boolean recurse) {
- // Build the local options
- List localOptions = new ArrayList();
- // Use the appropriate tag options
- if (tag != null) {
- localOptions.add(Update.makeTagOption(tag));
- }
- // Build the arguments list
- localOptions.addAll(Arrays.asList(super.getLocalOptions(recurse)));
- LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
- return commandOptions;
- }
-
- protected Update getUpdateCommand() {
- return Command.UPDATE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return CVSUIMessages.UpdateOperation_taskName; //;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return NLS.bind(CVSUIMessages.UpdateOperation_0, new String[] { provider.getProject().getName() });
- }
-
- /**
- * Return the listener that is used to process E and M messages.
- * The default is <code>null</code>.
- * @return
- */
- protected ICommandOutputListener getCommandOutputListener() {
- return null;
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.UNMEGERED_BINARY_CONFLICT
- || status.getCode() == CVSStatus.INVALID_LOCAL_RESOURCE_PATH
- || status.getCode() == CVSStatus.RESPONSE_HANDLING_FAILURE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
- */
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return CVSUIMessages.UpdateAction_update;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getResourceMappingContext()
- */
- protected ResourceMappingContext getResourceMappingContext() {
- return SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-
- public CVSTag getTag() {
- return tag;
- }
-
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceFileDiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceFileDiffOperation.java
deleted file mode 100644
index 39531c8ea..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceFileDiffOperation.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class WorkspaceFileDiffOperation extends FileDiffOperation {
-
- public WorkspaceFileDiffOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options, File file, boolean isMultiPatch, boolean includeFullPathInformation, IPath patchRoot) {
- super(part, mappings, options, file, isMultiPatch, includeFullPathInformation, patchRoot);
- }
-
- protected void copyFile() throws CVSException {
-
- IWorkspaceRoot root =ResourcesPlugin.getWorkspace().getRoot();
- IFile finalFile = root.getFileForLocation(new Path(this.file.getPath()));
- InputStream fileInputStream = null;
- try {
- fileInputStream = new BufferedInputStream(new FileInputStream(tempFile));
- if(!finalFile.exists()) {
- finalFile.create(fileInputStream, IResource.FORCE , null);
- } else {
- finalFile.setContents(fileInputStream, IResource.FORCE, null);
- }
- } catch (FileNotFoundException e) {
- throw CVSException.wrapException(e);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- finally{
- if (fileInputStream != null) {
- try {
- fileInputStream.close();
- } catch (IOException e) {
- // Ignore
- } finally {
- if (tempFile != null)
- tempFile.delete();
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceResourceMapper.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceResourceMapper.java
deleted file mode 100644
index e2acfe134..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceResourceMapper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * Utility class used to warp an set of resources in a resource mapper.
- * The resulting mapper will return the workspace root as the model
- * object.
- *
- * TODO: The ability to wrap multiple resources in a single mapping
- * should be provided by the resources plugin.
- *
- * @since 3.1
- */
-public final class WorkspaceResourceMapper extends ResourceMapping {
-
- private final IResource resource;
- private final int depth;
-
- /**
- * Convert the provided resources to one or more resource mappers
- * that traverse the elements deeply. The model element of the resource
- * mappers will be the workspace root.
- * @param resources the resources
- * @return a resource mappers that traverses the resources
- */
- public static ResourceMapping[] asResourceMappers(final IResource[] resources, int depth) {
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- result.add(new WorkspaceResourceMapper(resource, depth));
- }
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
- }
-
- public WorkspaceResourceMapper(IResource resource, int depth) {
- this.resource = resource;
- this.depth = depth;
- }
- public Object getModelObject() {
- return resource;
- }
- public IProject[] getProjects() {
- return new IProject[] { resource.getProject() };
- }
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- return asTraversal(resource, depth, context);
- }
- private ResourceTraversal[] asTraversal(IResource resource, final int depth, ResourceMappingContext context) {
- return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { resource }, depth, IResource.NONE)} ;
- }
- public boolean contains(ResourceMapping mapping) {
- return false;
- }
-
- public String getModelProviderId() {
- return ModelProvider.RESOURCE_MODEL_PROVIDER_ID;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
deleted file mode 100644
index b67a7ca19..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.*;
-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.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-
-/**
- * Action to add a root remote folder to a branch
- */
-public class AddToBranchAction extends CVSAction {
-
- IInputValidator validator = new IInputValidator() {
- public String isValid(String newText) {
- IStatus status = CVSTag.validateTagName(newText);
- if (status.isOK()) return null;
- return status.getMessage();
- }
- };
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRemoteFolder folder = getSelectedRootFolder();
- if (folder == null) return;
- Shell shell = getShell();
- final CVSException[] exception = new CVSException[] { null };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- InputDialog dialog = new InputDialog(getShell(), CVSUIMessages.AddToBranchAction_enterTag, CVSUIMessages.AddToBranchAction_enterTagLong, null, validator); //
- if (dialog.open() == Window.OK) {
- CVSTag tag = new CVSTag(dialog.getValue(), CVSTag.BRANCH);
- try {
- CVSUIPlugin.getPlugin().getRepositoryManager().addTags(folder, new CVSTag[] {tag});
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- }
- });
- if (exception[0] != null)
- throw new InvocationTargetException(exception[0]);
- }
- }, false, PROGRESS_BUSYCURSOR);
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- return getSelectedRootFolder() != null;
- }
-
- protected ICVSRemoteFolder getSelectedRootFolder() {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- ICVSRemoteFolder selectedFolder = null;
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
- if (folder.isDefinedModule() || new Path(null, folder.getRepositoryRelativePath()).segmentCount()==1) {
- // only return a folder if one valid one is selected.
- if (selectedFolder != null) return null;
- selectedFolder = folder;
- }
- }
- return selectedFolder;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java
deleted file mode 100644
index 889e586b3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
-
-/**
- * Abstract superclass for actions in the repositories view
- */
-public abstract class CVSRepoViewAction extends CVSAction {
-
- /**
- * Returns the selected CVS Repository locations
- */
- protected ICVSRepositoryLocation[] getSelectedRepositoryLocations() {
- ArrayList tags = new ArrayList();
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object element = elements.next();
- Object adapter = getAdapter(element, ICVSRepositoryLocation.class);
- if (adapter != null) {
- tags.add(adapter);
- } else {
- adapter = getAdapter(element, BranchCategory.class);
- if(adapter != null) {
- tags.add(((BranchCategory)adapter).getRepository(adapter));
- }
- }
- }
- }
- return (ICVSRepositoryLocation[])tags.toArray(new ICVSRepositoryLocation[tags.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
deleted file mode 100644
index 3c2c9e9cb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
+++ /dev/null
@@ -1,604 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.ConfigurationWizardMainPage;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class CVSRepositoryPropertiesPage extends PropertyPage {
- private static final String FAKE_PASSWORD = "*********"; //$NON-NLS-1$
- ICVSRepositoryLocation location;
-
- // Widgets
- Text userText;
- Text passwordText;
- Combo methodType;
- Text hostText;
- Text pathText;
- // Port
- private Text portText;
- private Button useDefaultPort;
- private Button useCustomPort;
-
- // Caching password
- private Button allowCachingButton;
- private boolean allowCaching = false;
-
- boolean passwordChanged;
- boolean connectionInfoChanged;
-
- IUserInfo info;
-
- // Label
- private Button useLocationAsLabel;
- private Button useCustomLabel;
- private Text labelText;
-
- /*
- * @see PreferencesPage#createContents
- */
- protected Control createContents(Composite parent) {
- initialize();
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
-
- // Repository Label
- // create a composite to ensure the radio buttons come in the correct order
- Composite labelGroup = new Composite(composite, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 3;
- labelGroup.setLayoutData(data);
- layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- labelGroup.setLayout(layout);
- Listener labelListener = new Listener() {
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- }
- };
- useLocationAsLabel = createRadioButton(labelGroup, CVSUIMessages.CVSRepositoryPropertiesPage_useLocationAsLabel, 3);
- useCustomLabel = createRadioButton(labelGroup, CVSUIMessages.CVSRepositoryPropertiesPage_useCustomLabel, 1);
- useCustomLabel.addListener(SWT.Selection, labelListener);
- labelText = createTextField(labelGroup);
- labelText.addListener(SWT.Modify, labelListener);
-
- // Add some extra space
- createLabel(composite, "", 3); //$NON-NLS-1$
-
- createLabel(composite, CVSUIMessages.CVSPropertiesPage_connectionType, 1);
- methodType = createCombo(composite);
-
- createLabel(composite, CVSUIMessages.CVSPropertiesPage_user, 1);
- userText = createTextField(composite);
-
- createLabel(composite, CVSUIMessages.CVSPropertiesPage_password, 1);
- passwordText = createPasswordField(composite);
-
- createLabel(composite, CVSUIMessages.CVSPropertiesPage_host, 1);
- hostText = createTextField(composite);
-
- createLabel(composite, CVSUIMessages.CVSPropertiesPage_path, 1);
- pathText = createTextField(composite);
-
- // Port number
- // create a composite to ensure the radio buttons come in the correct order
- Composite portGroup = new Composite(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 3;
- portGroup.setLayoutData(data);
- layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- portGroup.setLayout(layout);
- useDefaultPort = createRadioButton(portGroup, CVSUIMessages.ConfigurationWizardMainPage_useDefaultPort, 3);
- useCustomPort = createRadioButton(portGroup, CVSUIMessages.ConfigurationWizardMainPage_usePort, 1);
- portText = createTextField(portGroup);
-
- // Add some extra space
- createLabel(composite, "", 3); //$NON-NLS-1$
-
- allowCachingButton = new Button(composite, SWT.CHECK);
- allowCachingButton.setText(CVSUIMessages.UserValidationDialog_6);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
-
- Composite warningComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(CVSUIMessages.UserValidationDialog_7);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- warningText.setLayoutData(data);
-
- // Add some extra space
- createLabel(composite, "", 3); //$NON-NLS-1$
-
- initializeValues();
- updateWidgetEnablements();
- Listener connectionInfoChangedListener = new Listener() {
- public void handleEvent(Event event) {
- connectionInfoChanged = true;
- updateWidgetEnablements();
- }
- };
- passwordText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- passwordChanged = !passwordText.getText().equals(FAKE_PASSWORD);
- }
- });
- userText.addListener(SWT.Modify, connectionInfoChangedListener);
- methodType.addListener(SWT.Modify, connectionInfoChangedListener);
- hostText.addListener(SWT.Modify, connectionInfoChangedListener);
- portText.addListener(SWT.Modify, connectionInfoChangedListener);
- useCustomPort.addListener(SWT.Selection, connectionInfoChangedListener);
- pathText.addListener(SWT.Modify, connectionInfoChangedListener);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.REPOSITORY_LOCATION_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- data.horizontalSpan = 2;
- combo.setLayoutData(data);
- return combo;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Create a text field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- protected Text createTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- return layoutTextField(text);
- }
- /**
- * Create a password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- protected Text createPasswordField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
- return layoutTextField(text);
- }
- /**
- * Layout a text or password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- protected Text layoutTextField(Text text) {
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- data.horizontalSpan = 2;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Utility method to create a radio button
- *
- * @param parent the parent of the radio button
- * @param label the label of the radio button
- * @param span the number of columns to span
- * @return the created radio button
- */
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- location = null;
- IAdaptable element = getElement();
- if (element instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)element;
- } else {
- Object adapter = element.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)adapter;
- }
- }
- }
- /**
- * Set the initial values of the widgets
- */
- private void initializeValues() {
- passwordChanged = false;
- connectionInfoChanged = false;
-
- IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- methodType.add(methods[i].getName());
- }
- String method = location.getMethod().getName();
- methodType.select(methodType.indexOf(method));
- info = location.getUserInfo(true);
- userText.setText(info.getUsername());
- passwordText.setText(FAKE_PASSWORD);
- hostText.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- useDefaultPort.setSelection(true);
- useCustomPort.setSelection(false);
- portText.setEnabled(false);
- } else {
- useDefaultPort.setSelection(false);
- useCustomPort.setSelection(true);
- portText.setText("" + port); //$NON-NLS-1$
- }
- pathText.setText(location.getRootDirectory());
- allowCachingButton.setSelection(location.getUserInfoCached());
-
- // get the repository label
- String label = null;
- RepositoryRoot root = CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(location);
- label = root.getName();
- useLocationAsLabel.setSelection(label == null);
- useCustomLabel.setSelection(!useLocationAsLabel.getSelection());
- if (label == null) {
- label = location.getLocation(true);
- }
- labelText.setText(label);
- }
-
- private boolean performConnectionInfoChanges() {
- // Set the caching mode of the location
- if (!connectionInfoChanged) {
- location.setAllowCaching(allowCaching);
- if (!passwordChanged) {
- ((CVSRepositoryLocation)location).updateCache();
- }
- }
- // Don't do anything else if there wasn't a password or connection change
- if (!passwordChanged && !connectionInfoChanged) return true;
-
- try {
- // Check if the password was the only thing to change.
- if (passwordChanged && !connectionInfoChanged) {
- CVSRepositoryLocation oldLocation = (CVSRepositoryLocation)location;
- oldLocation.setPassword(getNewPassword());
- if (allowCaching) {
- oldLocation.updateCache();
- }
- passwordChanged = false;
- return true;
- }
-
- // Otherwise change the connection info and the password
- // This operation is done inside a workspace operation in case the sharing
- // info for existing projects is changed
- if (!(location.getHost().equals(hostText.getText()) && location.getRootDirectory().equals(pathText.getText()))) {
- // The host or path has changed
- if (!MessageDialog.openConfirm(getShell(),
- CVSUIMessages.CVSRepositoryPropertiesPage_0,
- CVSUIMessages.CVSRepositoryPropertiesPage_1)) {
- return false;
- }
- }
- final boolean[] result = new boolean[] { false };
- final ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell());
- progressMonitorDialog.run(false, false, new WorkspaceModifyOperation(null) {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // Create a new repository location with the new information
- CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromProperties(createProperties());
- newLocation.setEncoding(location.getEncoding());
- location.setAllowCaching(allowCaching);
- try {
- // For each project shared with the old location, set connection info to the new one
- List projects = new ArrayList();
- IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < allProjects.length; i++) {
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(allProjects[i], CVSProviderPlugin.getTypeId());
- if (teamProvider != null) {
- CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
- if (cvsProvider.getCVSWorkspaceRoot().getRemoteLocation().equals(location)) {
- projects.add(allProjects[i]);
- }
- }
- }
- if (projects.size() > 0) {
- // To do: warn the user
- DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(
- progressMonitorDialog.getShell(),
- CVSUIMessages.CVSRepositoryPropertiesPage_Confirm_Project_Sharing_Changes_1,
- CVSUIMessages.CVSRepositoryPropertiesPage_There_are_projects_in_the_workspace_shared_with_this_repository_2,
- NLS.bind(CVSUIMessages.CVSRepositoryPropertiesPage_sharedProject, new String[] { location.toString() }),
- (IProject[]) projects.toArray(new IProject[projects.size()]),
- true,
- Dialog.DLG_IMG_WARNING);
- int r = dialog.open();
- if (r != Window.OK) {
- result[0] = false;
- return;
- }
- monitor.beginTask(null, 1000 * projects.size());
- try {
- Iterator it = projects.iterator();
- while (it.hasNext()) {
- IProject project = (IProject)it.next();
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
- cvsProvider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- }
-
- // Dispose the old repository location
- CVSUIPlugin.getPlugin().getRepositoryManager().replaceRepositoryLocation(location, newLocation);
-
- } finally {
- // Even if we failed, ensure that the new location appears in the repo view.
- newLocation = (CVSRepositoryLocation)KnownRepositories.getInstance().addRepository(newLocation, !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation()));
- }
-
- // Set the location of the page to the new location in case Apply was chosen
- location = newLocation;
- connectionInfoChanged = false;
- passwordChanged = false;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- result[0] = true;
- }
- });
- return result[0];
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- }
- return false; /* we only get here if an exception occurred */
- }
-
- private void performNonConnectionInfoChanges() {
- recordNewLabel((CVSRepositoryLocation)location);
- }
- /*
- * @see PreferencesPage#performOk
- */
- public boolean performOk() {
- if (performConnectionInfoChanges()) {
- performNonConnectionInfoChanges();
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- super.performDefaults();
- initializeValues();
- }
-
- /**
- * Shows the given errors to the user.
- */
- protected void handle(Throwable e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- }
-
- /**
- * Updates widget enablements and sets error message if appropriate.
- */
- protected void updateWidgetEnablements() {
- if (useLocationAsLabel.getSelection()) {
- labelText.setEnabled(false);
- } else {
- labelText.setEnabled(true);
- }
- if (useDefaultPort.getSelection()) {
- portText.setEnabled(false);
- } else {
- portText.setEnabled(true);
- }
- validateFields();
- }
-
- private void validateFields() {
- if (labelText.isEnabled()) {
- if (labelText.getText().length() == 0) {
- setValid(false);
- return;
- }
- }
- String user = userText.getText();
- IStatus status = ConfigurationWizardMainPage.validateUserName(user);
- if (!isStatusOK(status)) {
- return;
- }
-
- String host = hostText.getText();
- status = ConfigurationWizardMainPage.validateHost(host);
- if (!isStatusOK(status)) {
- return;
- }
-
- if (portText.isEnabled()) {
- String port = portText.getText();
- status = ConfigurationWizardMainPage.validatePort(port);
- if (!isStatusOK(status)) {
- return;
- }
- }
-
- String pathString = pathText.getText();
- status = ConfigurationWizardMainPage.validatePath(pathString);
- if (!isStatusOK(status)) {
- return;
- }
-
- try {
- CVSRepositoryLocation l = CVSRepositoryLocation.fromProperties(createProperties());
- if (!l.equals(location) && KnownRepositories.getInstance().isKnownRepository(l.getLocation())) {
- setErrorMessage(CVSUIMessages.ConfigurationWizardMainPage_0);
- setValid(false);
- return;
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- // Let it pass. Creation should fail
- }
-
- setErrorMessage(null);
- setValid(true);
- }
-
- private boolean isStatusOK(IStatus status) {
- if (!status.isOK()) {
- setErrorMessage(status.getMessage());
- setValid(false);
- return false;
- }
- return true;
- }
-
- private void recordNewLabel(CVSRepositoryLocation location) {
- String newLabel = getNewLabel(location);
- if (newLabel == null) {
- String oldLabel = getOldLabel(location);
- if (oldLabel == null || oldLabel.equals(location.getLocation())) {
- return;
- }
- } else if (newLabel.equals(getOldLabel(location))) {
- return;
- }
- CVSUIPlugin.getPlugin().getRepositoryManager().setLabel(location, newLabel);
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this,
- CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
-
- }
- private String getOldLabel(CVSRepositoryLocation location) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(location).getName();
- }
- private String getNewLabel(CVSRepositoryLocation location) {
- String label = null;
- if (useCustomLabel.getSelection()) {
- label = labelText.getText();
- if (label.equals(location.getLocation())) {
- label = null;
- }
- }
- return label;
- }
- /* internal use only */ String getNewPassword() {
- return passwordText.getText();
- }
-
- private Properties createProperties() {
- Properties result = new Properties();
- result.setProperty("connection", methodType.getText()); //$NON-NLS-1$
- result.setProperty("user", userText.getText()); //$NON-NLS-1$
- if (passwordChanged) {
- result.setProperty("password", passwordText.getText()); //$NON-NLS-1$
- }
- result.setProperty("host", hostText.getText()); //$NON-NLS-1$
- if (useCustomPort.getSelection()) {
- result.setProperty("port", portText.getText()); //$NON-NLS-1$
- }
- result.setProperty("root", pathText.getText()); //$NON-NLS-1$
- return result;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
deleted file mode 100644
index ddd2c8ef7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * William Mitsuda (wmitsuda@gmail.com) - Bug 153879 [Wizards] configurable size of cvs commit comment history
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.Vector;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.Attributes;
-
-class CommentHistoryContentHandler extends DefaultHandler {
-
- private StringBuffer buffer;
- private Vector comments;
- public CommentHistoryContentHandler() {
- }
-
- /**
- * @see ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] chars, int startIndex, int length) throws SAXException {
- if (buffer == null) return;
- buffer.append(chars, startIndex, length);
- }
-
- /**
- * @see ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(
- String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
- buffer = new StringBuffer();
- return;
- }
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
- comments = new Vector(RepositoryManager.DEFAULT_MAX_COMMENTS);
- return;
- }
- }
-
- /**
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String namespaceURI, String localName, String qName) {
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
- comments.add(buffer.toString());
- buffer = null;
- return;
- }
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
- RepositoryManager.previousComments = new String[comments.size()];
- comments.copyInto(RepositoryManager.previousComments);
- return;
- }
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for project sets doesn't use namespaces so either of the two names
- * is fine. Therefore, use whichever one is provided.
- */
- private String getElementName(String namespaceURI, String localName, String qName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- } else {
- return qName;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentTemplatesContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentTemplatesContentHandler.java
deleted file mode 100644
index c25ddc5ea..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentTemplatesContentHandler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.DefaultHandler;
-
-class CommentTemplatesContentHandler extends DefaultHandler {
-
- private StringBuffer buffer;
- private Vector comments;
- public CommentTemplatesContentHandler() {
- }
-
- /**
- * @see ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] chars, int startIndex, int length) {
- if (buffer == null) return;
- buffer.append(chars, startIndex, length);
- }
-
- /**
- * @see ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(
- String namespaceURI,
- String localName,
- String qName,
- Attributes atts) {
-
- String elementName = getElementName(localName, qName);
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
- buffer = new StringBuffer();
- return;
- }
- if (elementName.equals(RepositoryManager.ELEMENT_COMMENT_TEMPLATES)) {
- comments = new Vector();
- return;
- }
- }
-
- /**
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String namespaceURI, String localName, String qName) {
- String elementName = getElementName(localName, qName);
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
- comments.add(buffer.toString());
- buffer = null;
- return;
- }
- if (elementName.equals(RepositoryManager.ELEMENT_COMMENT_TEMPLATES)) {
- RepositoryManager.commentTemplates = new String[comments.size()];
- comments.copyInto(RepositoryManager.commentTemplates);
- return;
- }
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for project sets doesn't use namespaces so either of the two names
- * is fine. Therefore, use whichever one is provided.
- */
- private String getElementName(String localName, String qName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- }
- return qName;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java
deleted file mode 100644
index 009d587d6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-
-public class CopyRepositoryNameAction extends CVSAction {
- public boolean isEnabled() {
- return true;
- }
- public void execute(IAction action) {
- ICVSRepositoryLocation[] locations = getSelectedRepositories();
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < locations.length; i++) {
- buffer.append(locations[i].getLocation(true));
- if (i < locations.length - 1) buffer.append("\n"); //$NON-NLS-1$
- }
- copyToClipbard(Display.getDefault(), buffer.toString());
- }
- protected ICVSRepositoryLocation[] getSelectedRepositories() {
- ArrayList repositories = null;
- IStructuredSelection selection = getSelection();
- if (!selection.isEmpty()) {
- repositories = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = getAdapter(elements.next(), ICVSRepositoryLocation.class);
- if (next instanceof ICVSRepositoryLocation) {
- repositories.add(next);
- continue;
- }
- }
- }
- if (repositories != null && !repositories.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[repositories.size()];
- repositories.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
- private void copyToClipbard(Display display, String str) {
- Clipboard clipboard = new Clipboard(display);
- clipboard.setContents(new String[] { str }, new Transfer[] { TextTransfer.getInstance()});
- clipboard.dispose();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java
deleted file mode 100644
index 9222d4cb2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * Called from Welcome page only.
- */
-public class NewCVSRepositoryAction extends Action {
- public void run() {
- Shell shell;
- IWorkbenchWindow window = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- shell = window.getShell();
- } else {
- Display display = Display.getCurrent();
- shell = new Shell(display);
- }
- NewLocationWizard wizard = new NewLocationWizard();
- wizard.setSwitchPerspectives(false);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
deleted file mode 100644
index 38115600a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.DateTagDialog;
-
-/**
- * Action for creating a CVS Date tag.
- */
-public class NewDateTagAction extends CVSRepoViewAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- if (locations.length != 1) return;
- CVSTag tag = getDateTag(getShell(), locations[0]);
- CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(locations[0], tag);
- }
-
- public static CVSTag getDateTag(Shell shell, ICVSRepositoryLocation location) {
- DateTagDialog dialog = new DateTagDialog(shell);
- if (dialog.open() == Window.OK) {
- Date date = dialog.getDate();
- CVSTag tag = new CVSTag(date);
- return tag;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- if (locations.length != 1) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/PasteConnectionStringAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/PasteConnectionStringAction.java
deleted file mode 100644
index a0ba2c7e4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/PasteConnectionStringAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda <wmitsuda@gmail.com> - initial implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionDelegate;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * Try to paste a CVS connection string from clipboard as a repository location
- */
-public class PasteConnectionStringAction extends ActionDelegate implements
- IViewActionDelegate {
-
- private IAction action;
-
- public void run(IAction action) {
- Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench()
- .getDisplay());
- try {
- Object contents = clipboard.getContents(TextTransfer.getInstance());
- if (contents != null && contents instanceof String) {
- String connectionString = (String) contents;
- CVSRepositoryLocation location = CVSRepositoryLocation
- .fromString(connectionString);
- if (location != null) {
- KnownRepositories.getInstance().addRepository(location,
- true);
- }
- }
- } catch (Exception e) {
- // Fail silently
- } finally {
- clipboard.dispose();
- }
- }
-
- public void init(IAction action) {
- super.init(action);
- this.action = action;
- }
-
- public void init(IViewPart view) {
- IActionBars actionBars = view.getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), action);
- actionBars.updateActionBars();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
deleted file mode 100644
index 4e019db91..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Page that allows the user to select the remote projects whose tags should be
- * refreshed.
- */
-public class RefreshRemoteProjectSelectionPage extends CVSWizardPage {
-
- private ICVSRemoteResource[] rootFolders;
- private ListSelectionArea listArea;
- private WorkingSetSelectionArea workingSetArea;
- private IWorkingSet workingSet;
- private IDialogSettings settings;
-
- /**
- * Custom input provider which returns the list of root folders
- */
- private class InputElement implements IWorkbenchAdapter, IAdaptable {
- public Object[] getChildren(Object o) {
- return rootFolders;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- public String getLabel(Object o) {
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- }
-
- /**
- * Constructor for RemoteProjectSelectionPage.
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public RefreshRemoteProjectSelectionPage(
- String pageName,
- String title,
- ImageDescriptor titleImage,
- String description,
- IDialogSettings settings,
- ICVSRepositoryLocation root,
- ICVSRemoteResource[] rootFolders) {
- super(pageName, title, titleImage, description);
- this.settings = settings;
- this.rootFolders = rootFolders;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
-
- setControl(composite);
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.REFRESH_REMOTE_PROJECT_SELECTION_PAGE);
-
- listArea = new ListSelectionArea(
- new InputElement(),
- new RemoteContentProvider(),
- new WorkbenchLabelProvider(),
- CVSUIMessages.RefreshRemoteProjectSelectionPage_selectRemoteProjects);
- listArea.createArea(composite);
-
- listArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- updateEnablement();
- }
- });
- listArea.getViewer().setComparator(new RepositoryComparator());
-
- workingSetArea = new WorkingSetSelectionArea(getShell(), CVSUIMessages.RefreshRemoteProjectSelectionPage_noWorkingSet, CVSUIMessages.RefreshRemoteProjectSelectionPage_workingSet, settings); //
- setWorkingSet(workingSet);
- workingSetArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- workingSet = (IWorkingSet)event.getNewValue();
- handleWorkingSetChange();
- }
- });
- workingSetArea.createArea(composite);
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Sets the working set that should be selected in the most recently
- * used working set list.
- *
- * @param workingSet the working set that should be selected.
- * has to exist in the list returned by
- * org.eclipse.ui.IWorkingSetManager#getRecentWorkingSets().
- * Must not be null.
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
-
- if (workingSetArea != null) {
- workingSetArea.setWorkingSet(workingSet);
- }
- }
-
- private void handleWorkingSetChange() {
- if (workingSet != null) {
- // check any projects in the working set
- listArea.getViewer().setAllChecked(false);
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- ICVSRemoteResource[] resources = manager.filterResources(workingSet, rootFolders);
- for (int i = 0; i < resources.length; i++) {
- ICVSRemoteResource resource = resources[i];
- listArea.getViewer().setChecked(resource, true);
- }
- }
- }
-
- private void updateEnablement() {
- boolean atLeastOne = listArea.getViewer().getCheckedElements().length > 0;
- setPageComplete(atLeastOne);
- }
-
- /**
- * Method getSelectedRemoteProject.
- * @return ICVSRemoteResource[]
- */
- public ICVSRemoteResource[] getSelectedRemoteProject() {
- Object[] checked = listArea.getViewer().getCheckedElements();
- return (ICVSRemoteResource[]) Arrays.asList(checked).toArray(new ICVSRemoteResource[checked.length]);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
deleted file mode 100644
index 117ca7669..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Wizard for refreshing the tags for a CVS repository location
- */
-public class RefreshRemoteProjectWizard extends Wizard {
-
- // The initial size of this wizard.
- private final static int INITIAL_WIDTH = 300;
- private final static int INITIAL_HEIGHT = 350;
-
- private ICVSRepositoryLocation root;
- private ICVSRemoteResource[] rootFolders;
- private RefreshRemoteProjectSelectionPage projectSelectionPage;
- private IDialogSettings settings;
-
- public static boolean execute(Shell shell, final ICVSRepositoryLocation root) {
- final ICVSRemoteResource[][] rootFolders = new ICVSRemoteResource[1][0];
- rootFolders[0] = null;
- try {
- new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- rootFolders[0] = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, CVSTag.DEFAULT, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(shell, null, null, e);
- return false;
- } catch (InterruptedException e) {
- return false;
- }
- RefreshRemoteProjectWizard wizard = new RefreshRemoteProjectWizard(root, rootFolders[0]);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- /**
- * This is the only place where a size hint > 0 is required. The wizard
- * page should in general have hints of 0 (and grab excessive space).
- */
- dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT);
- return (dialog.open() == Window.OK);
- }
-
- public RefreshRemoteProjectWizard(ICVSRepositoryLocation root, ICVSRemoteResource[] rootFolders) {
- this.root = root;
- this.rootFolders = rootFolders;
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("RefreshRemoteProjectWizard");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("RefreshRemoteProjectWizard");//$NON-NLS-1$
- }
- setWindowTitle(CVSUIMessages.RefreshRemoteProjectWizard_title);
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION);
- projectSelectionPage = new RefreshRemoteProjectSelectionPage(
- "ProjectSelectionPage", //$NON-NLS-1$
- CVSUIMessages.RefreshRemoteProjectSelectionPage_pageTitle,
- substImage,
- CVSUIMessages.RefreshRemoteProjectSelectionPage_pageDescription,
- settings, root, rootFolders);
- addPage(projectSelectionPage);
- }
-
- /**
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- public boolean performFinish() {
- final ICVSRemoteResource[] selectedFolders = projectSelectionPage.getSelectedRemoteProject();
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- // Run in the manager to avoid multiple repo view updates
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException {
- monitor.beginTask(null, 100);
- ICVSRemoteResource[] failedFolders = internalRefresh(manager, selectedFolders, false /* recurse */, Policy.subMonitorFor(monitor, 80));
- if (failedFolders.length > 0) {
- // Go deep any any failed folders.
- if (promptForDeepRefresh(failedFolders))
- internalRefresh(manager, failedFolders, true /* recurse */, Policy.subMonitorFor(monitor, 20));
- }
- monitor.done();
- }
- }, monitor);
- }
- });
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null ,e);
- } catch (InterruptedException e) {
- }
- return false;
- }
-
- /*
- * Refresh the tags of the given resources and return those for which no tags were found.
- */
- private ICVSRemoteResource[] internalRefresh(final RepositoryManager manager, final ICVSRemoteResource[] selectedFolders, final boolean recurse, IProgressMonitor monitor) throws InvocationTargetException {
- List failedFolders = new ArrayList();
- monitor.beginTask(null, 100 * selectedFolders.length);
- for (int i = 0; i < selectedFolders.length; i++) {
- try {
- ICVSRemoteResource resource = selectedFolders[i];
- if (resource instanceof ICVSFolder) {
- CVSTag[] tags = manager.refreshDefinedTags((ICVSFolder)resource, recurse, true /* notify */, Policy.subMonitorFor(monitor, 100));
- if (tags.length == 0) {
- failedFolders.add(resource);
- }
- }
- } catch (TeamException e) {
- CVSUIPlugin.log(IStatus.ERROR, NLS.bind("An error occurred while fetching the tags for {0}", selectedFolders[i].getName()), e); //$NON-NLS-1$
- }
- }
- return (ICVSRemoteResource[]) failedFolders.toArray(new ICVSRemoteResource[failedFolders.size()]);
- }
-
- private boolean promptForDeepRefresh(final ICVSRemoteResource[] folders) {
- final boolean[] prompt = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.RefreshRemoteProjectWizard_0, null,
- getNoTagsMessage(folders),
- MessageDialog.INFORMATION,
- new String[] {
- CVSUIMessages.RefreshRemoteProjectWizard_1,
- CVSUIMessages.RefreshRemoteProjectWizard_2
- }, 1);
- int code = dialog.open();
- if (code == 0) {
- prompt[0] = true;
- }
-
- }
- });
- return prompt[0];
- }
-
- private String getNoTagsMessage(ICVSRemoteResource[] folders) {
- if (folders.length == 1) {
- return NLS.bind(CVSUIMessages.RefreshRemoteProjectWizard_3, new String[] { folders[0].getRepositoryRelativePath() });
- }
- return NLS.bind(CVSUIMessages.RefreshRemoteProjectWizard_4, new String[] { Integer.toString(folders.length) });
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java
deleted file mode 100644
index 7736eef84..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-/**
- * Action that refreshs the tags in the CVS repositories view.
- */
-public class RefreshTagsAction extends CVSRepoViewAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- RefreshRemoteProjectWizard.execute(getShell(), locations[0]);
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- public boolean isEnabled() {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- if (locations.length != 1) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
deleted file mode 100644
index b0de8a5a4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.osgi.util.TextProcessor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.OpenRemoteFileAction;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.*;
-
-/**
- * This class acts as a superclass to all remote CVS tree views.
- */
-public abstract class RemoteViewPart extends ViewPart implements ISelectionListener {
-
- // The tree viewer
- protected TreeViewer viewer;
-
- // Drill down adapter
- private DrillDownAdapter drillPart;
-
- private Action refreshAction;
- private Action collapseAllAction;
-
- private OpenRemoteFileAction openAction;
-
- private WorkingSetFilterActionGroup workingSetActionGroup;
- private RemoteContentProvider contentProvider;
- private IDialogSettings settings;
-
- private static final String SELECTED_WORKING_SET = "SelectedWorkingSet"; //$NON-NLS-1$
-
- /* package */ class DecoratingRepoLabelProvider extends WorkbenchLabelProvider {
- protected String decorateText(String input, Object element) {
- //Used to process RTL locales only
- return TextProcessor.process(input, ":@/"); //$NON-NLS-1$
- }
- }
-
- protected RemoteViewPart(String partName) {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- settings = workbenchSettings.getSection(partName);
- if (settings == null) {
- settings = workbenchSettings.addNewSection(partName);
- }
- String name = settings.get(SELECTED_WORKING_SET);
- IWorkingSet set = null;
- if (name != null)
- set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
- setWorkingSet(set, false);
- }
-
- /**
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(getContentProvider());
- viewer.setLabelProvider(new DecoratingRepoLabelProvider()/*WorkbenchLabelProvider()*/);
- getSite().setSelectionProvider(viewer);
- viewer.setInput(getTreeInput());
- viewer.setComparator(new RepositoryComparator());
- viewer.getControl().addKeyListener(getKeyListener());
- drillPart = new DrillDownAdapter(viewer);
-
- contributeActions();
- initializeListeners();
-
- getWorkingSetActionGroup().fillActionBars(getViewSite().getActionBars());
-
- // F1 Help
- String helpID = getHelpContextId();
- if (helpID != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), helpID);
- }
-
- /**
- * @see WorkbenchPart#setFocus
- */
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- /**
- * Method getHelpContextId should be overridden by subclasses to provide the
- * appropriate help id.
- *
- * @return String
- */
- protected String getHelpContextId() {
- return null;
- }
-
- /**
- * Method getTreeInput.
- * @return Object
- */
- protected abstract Object getTreeInput();
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getContentProvider()
- */
- public RemoteContentProvider getContentProvider() {
- if (contentProvider == null) {
- contentProvider = new RemoteContentProvider();
- }
- return contentProvider;
- };
-
- protected KeyAdapter getKeyListener() {
- return new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- refreshAll();
- }
- }
- };
- }
-
- protected void initializeListeners() {
- // listen for selection changes in the repo view
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
- }
-
- protected IWorkingSet getWorkingSet() {
- return getContentProvider().getWorkingSet();
- }
-
- protected void setWorkingSet(IWorkingSet workingSet, boolean refreshViewer) {
- if (settings != null) {
- String name = null;
- if (workingSet != null)
- name = workingSet.getName();
- settings.put(SELECTED_WORKING_SET, name);
- }
- getContentProvider().setWorkingSet(workingSet);
- String toolTip;
- if (workingSet == null) {
- toolTip = null;
- } else {
- toolTip = NLS.bind(CVSUIMessages.RemoteViewPart_workingSetToolTip, new String[] { workingSet.getName() });
- }
- setTitleToolTip(toolTip);
- if (refreshViewer) refreshViewer();
- }
-
- /**
- * Contribute actions to the view
- */
- protected void contributeActions() {
-
- final Shell shell = getShell();
-
- // Refresh (toolbar)
- CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
- refreshAction = new Action(CVSUIMessages.RepositoriesView_refresh, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED)) {
- public void run() {
- refreshAll();
- }
- };
- refreshAction.setToolTipText(CVSUIMessages.RepositoriesView_refreshTooltip);
- refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED));
- refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH));
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
-
- collapseAllAction = new Action(CVSUIMessages.RepositoriesView_collapseAll, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED)) {
- public void run() {
- collapseAll();
- }
- };
- collapseAllAction.setToolTipText(CVSUIMessages.RepositoriesView_collapseAllTooltip);
- collapseAllAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL));
-
- // Working Set action group
- IPropertyChangeListener workingSetUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET
- .equals(property)) {
- Object newValue = event.getNewValue();
- setWorkingSet((IWorkingSet) newValue, true);
- }
- }
- };
- setActionGroup(new WorkingSetFilterActionGroup(shell, workingSetUpdater));
- getWorkingSetActionGroup().setWorkingSet(getContentProvider().getWorkingSet());
-
- // Create the popup menu
- MenuManager menuMgr = new MenuManager();
- Tree tree = viewer.getTree();
- Menu menu = menuMgr.createContextMenu(tree);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addWorkbenchActions(manager);
- }
-
- });
- menuMgr.setRemoveAllWhenShown(true);
- tree.setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
-
- // Create the local tool bar
- IActionBars bars = getViewSite().getActionBars();
- IToolBarManager tbm = bars.getToolBarManager();
- drillPart.addNavigationActions(tbm);
- tbm.add(refreshAction);
- tbm.add(new Separator());
- tbm.add(collapseAllAction);
- tbm.update(false);
-
- // Register the open handler
- openAction = new OpenRemoteFileAction();
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- handleOpen(event);
- }
- });
-
- bars.updateActionBars();
- }
-
- /**
- * Returns the action group.
- *
- * @return the action group
- */
- private WorkingSetFilterActionGroup getWorkingSetActionGroup() {
- return workingSetActionGroup;
- }
-
- /**
- * Sets the action group.
- *
- * @param actionGroup the action group
- */
- private void setActionGroup(WorkingSetFilterActionGroup actionGroup) {
- this.workingSetActionGroup = actionGroup;
- }
-
- /**
- * Add the menu actions that were contributed in plugin.xml
- *
- * @param manager
- */
- protected void addWorkbenchActions(IMenuManager manager) {
- // File actions go first (view file)
- manager.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
- // Misc additions
- manager.add(new Separator("checkoutGroup")); //$NON-NLS-1$
- manager.add(new Separator("tagGroup")); //$NON-NLS-1$
- manager.add(new Separator("miscGroup")); //$NON-NLS-1$
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- manager.add(refreshAction);
- }
-
- /**
- * Method getShell.
- * @return Shell
- */
- protected Shell getShell() {
- return viewer.getTree().getShell();
- }
-
- protected void refreshAll() {
- //CVSUIPlugin.getPlugin().getRepositoryManager().clearCaches();
- refreshViewer();
- }
-
- protected void refreshViewer() {
- if (viewer == null) return;
- ((RemoteContentProvider)viewer.getContentProvider()).cancelJobs(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryRoots());
- ((RemoteContentProvider)viewer.getContentProvider()).purgeCache();
- CVSUIPlugin.getPlugin().getRepositoryManager().purgeCache();
- viewer.getControl().setRedraw(false);
- viewer.refresh();
- viewer.getControl().setRedraw(true);
- }
-
- public void collapseAll() {
- if (viewer == null) return;
- viewer.getControl().setRedraw(false);
- viewer.collapseToLevel(viewer.getInput(), AbstractTreeViewer.ALL_LEVELS);
- viewer.getControl().setRedraw(true);
- }
- /**
- * Handle open request.
- */
- /* package */ void handleOpen(OpenEvent e) {
- // Only act on single selection
- ISelection selection = e.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection)selection;
- if (structured.size() == 1) {
- Object first = structured.getFirstElement();
- if (first instanceof ICVSRemoteFile) {
- // It's a file, open it.
- openAction.selectionChanged(null, selection);
- openAction.run(null);
- } else {
- // Try to expand/contract
- viewer.setExpandedState(first, !viewer.getExpandedState(first));
- }
- }
- }
- }
-
- /**
- * Returns the viewer.
- * @return TreeViewer
- */
- public TreeViewer getViewer() {
- return viewer;
- }
-
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(this);
- if (getWorkingSetActionGroup() != null) {
- getWorkingSetActionGroup().dispose();
- }
- super.dispose();
- viewer = null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java
deleted file mode 100644
index 8d1246e76..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.SelectionListenerAction;
-
-
-public class RemoveDateTagAction extends SelectionListenerAction {
- private IStructuredSelection selection;
-
- public RemoveDateTagAction() {
- super(CVSUIMessages.RemoveDateTagAction_0);
- }
-
- public void run() {
- CVSTagElement[] elements = getSelectedCVSTagElements();
- if (elements.length == 0) return;
- for(int i = 0; i < elements.length; i++){
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- CVSTag tag = elements[i].getTag();
- if(tag.getType() == CVSTag.DATE){
- mgr.removeDateTag(elements[i].getRoot(),tag);
- }
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- this.selection = selection;
- boolean b = containsDataTag();
- setEnabled(b);
- return b;
- }
-
- private boolean containsDataTag(){
- CVSTagElement[] elements = getSelectedCVSTagElements();
- if (elements.length > 0){
- for(int i = 0; i < elements.length; i++){
- CVSTag tag = elements[i].getTag();
- if(tag.getType() == CVSTag.DATE){
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns the selected CVS date tag elements
- */
- private CVSTagElement[] getSelectedCVSTagElements() {
- ArrayList cvsTagElements = null;
- if (selection!=null && !selection.isEmpty()) {
- cvsTagElements = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = TeamAction.getAdapter(elements.next(), CVSTagElement.class);
- if (next instanceof CVSTagElement) {
- cvsTagElements.add(next);
- }
- }
- }
- if (cvsTagElements != null && !cvsTagElements.isEmpty()) {
- CVSTagElement[] result = new CVSTagElement[cvsTagElements.size()];
- cvsTagElements.toArray(result);
- return result;
- }
- return new CVSTagElement[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
deleted file mode 100644
index dac068fd2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.model.RepositoryLocationSchedulingRule;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.progress.IProgressService;
-
-
-/**
- * RemoveRootAction removes a repository
- */
-public class RemoveRootAction extends SelectionListenerAction {
- private IStructuredSelection selection;
- /* internal use only */ Shell shell;
- private RepositoriesView view;
-
- public RemoveRootAction(Shell shell, RepositoriesView view) {
- super(CVSUIMessages.RemoteRootAction_label);
- this.view = view;
- this.shell = shell;
- }
-
- /**
- * Returns the selected remote files
- */
- protected ICVSRepositoryLocation[] getSelectedRemoteRoots() {
- ArrayList resources = null;
- if (selection!=null && !selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = TeamAction.getAdapter(elements.next(), RepositoryRoot.class);
- if (next instanceof RepositoryRoot) {
- resources.add(((RepositoryRoot)next).getRoot());
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
-
- public void run() {
- final ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length == 0) return;
- final boolean[] proceed = new boolean[1];
- shell.getDisplay().syncExec(new Runnable(){
- public void run() {
- String message;
- if(roots.length == 1){
- message = NLS.bind(CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogMessageSingle, roots[0].getLocation(true));
- } else {
- message = NLS.bind(CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogMessageMultiple, new Integer(roots.length));
- }
- proceed[0] = MessageDialog.openQuestion(shell,
- CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogTitle,
- message);
- }
- });
- if(!proceed[0]){
- return;
- }
- for (int i = 0; i < roots.length; i++) {
- final ICVSRepositoryLocation root = roots[i];
- try {
- // Check if any projects are shared with the repository
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- final ArrayList shared = new ArrayList();
- for (int j = 0; j < projects.length; j++) {
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(projects[j], CVSProviderPlugin.getTypeId());
- if (teamProvider!=null) {
- CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
- if (cvsProvider.getCVSWorkspaceRoot().getRemoteLocation().equals(roots[i])) {
- shared.add(projects[j]);
- }
- }
- }
-
- // This will notify the RepositoryManager of the removal
- if (!shared.isEmpty()) {
- final String location = roots[i].getLocation(true);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(
- shell,
- CVSUIMessages.RemoteRootAction_Unable_to_Discard_Location_1,
- NLS.bind(CVSUIMessages.RemoteRootAction_Projects_in_the_local_workspace_are_shared_with__2, new String[] { location }),
- CVSUIMessages.RemoteRootAction_The_projects_that_are_shared_with_the_above_repository_are__4,
- (IProject[]) shared.toArray(new IProject[shared.size()]),
- false,
- Dialog.DLG_IMG_ERROR);
- dialog.open();
- }
- });
- } else {
- IProgressService manager = PlatformUI.getWorkbench().getProgressService();
- try {
- manager.busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final ISchedulingRule rule = new RepositoryLocationSchedulingRule(root);
- try {
- Job.getJobManager().beginRule(rule, monitor);
- view.getContentProvider().cancelJobs(root);
- KnownRepositories.getInstance().disposeRepository(root);
- } finally {
- Job.getJobManager().endRule(rule);
- }
-
- }
- });
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Canceled
- return;
- }
- }
- } catch (CVSException e) {
- CVSUIPlugin.openError(view.getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_TEAM_EXCEPTIONS | CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- this.selection = selection;
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- boolean b = roots.length > 0;
- setEnabled(b);
- return b;
- }
-
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesSortingActionGroup.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesSortingActionGroup.java
deleted file mode 100644
index 9895697ad..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesSortingActionGroup.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionGroup;
-
-public class RepositoriesSortingActionGroup extends ActionGroup {
- // Sorting actions
- private Action labelSortingAction;
- private Action locationSortingAction;
- private Action hostSortingAction;
- // action for switching between asc/desc sorting order
- private Action reverseSortingOrderAction;
-
- /**
- * Current comparator set.
- */
- private RepositoryComparator comparator;
- private IPropertyChangeListener comparatorUpdater;
-
- /* package */static final RepositoryComparator orderByLabelComparator = new RepositoryComparator(/* default */);
- /* package */static final RepositoryComparator orderByLocationComparator = new RepositoryComparator(
- RepositoryComparator.ORDER_LOCATION);
- /* package */static final RepositoryComparator orderByHostComparator = new RepositoryComparator(
- RepositoryComparator.ORDER_HOST);
-
- /**
- * Indicates if comparator was changed
- */
- public static final String CHANGE_COMPARATOR = "changeComparator"; //$NON-NLS-1$
-
- private static final String REPOSITORIES_SORTING_ACTION_GROUP = "repositoriesSortingActionGroup"; //$NON-NLS-1$
-
- public RepositoriesSortingActionGroup(Shell shell,
- IPropertyChangeListener comparatorUpdater) {
- Assert.isNotNull(shell);
-
- this.comparatorUpdater = comparatorUpdater;
- labelSortingAction = new Action(
- CVSUIMessages.RepositoriesSortingActionGroup_label,
- Action.AS_RADIO_BUTTON) {
- public void run() {
- if (labelSortingAction.isChecked())
- setComparator(orderByLabelComparator);
- }
- };
- locationSortingAction = new Action(
- CVSUIMessages.RepositoriesSortingActionGroup_location,
- Action.AS_RADIO_BUTTON) {
- public void run() {
- if (locationSortingAction.isChecked())
- setComparator(orderByLocationComparator);
- }
- };
- hostSortingAction = new Action(
- CVSUIMessages.RepositoriesSortingActionGroup_host,
- Action.AS_RADIO_BUTTON) {
- public void run() {
- if (hostSortingAction.isChecked())
- setComparator(orderByHostComparator);
- }
- };
- reverseSortingOrderAction = new Action(
- CVSUIMessages.RepositoriesSortingActionGroup_descending,
- Action.AS_CHECK_BOX) {
- public void run() {
- switchOrder(comparator);
- }
- };
- // set sorting by label as default
- setSelectedComparator(orderByLabelComparator);
- labelSortingAction.setChecked(true);
- reverseSortingOrderAction.setChecked(!orderByLabelComparator.isAscending());
- }
-
- /* package */void setComparator(RepositoryComparator newComparator) {
- RepositoryComparator oldComparator = this.comparator;
- // preserve sorting order
- if (oldComparator != null)
- newComparator.setAscending(oldComparator.isAscending());
- this.comparator = newComparator;
- firePropertyChange(newComparator, oldComparator);
- }
-
- private void switchOrder(RepositoryComparator currentComparator) {
- RepositoryComparator oldComparator = this.comparator;
- RepositoryComparator switchedComparator = currentComparator
- .getReversedComparator();
- this.comparator = switchedComparator;
- firePropertyChange(switchedComparator, oldComparator);
- }
-
- private void firePropertyChange(RepositoryComparator newComparator,
- RepositoryComparator oldComparator) {
- // Update viewer
- if (comparatorUpdater != null) {
- comparatorUpdater.propertyChange(new PropertyChangeEvent(this,
- CHANGE_COMPARATOR, oldComparator, newComparator));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- IMenuManager menuManager = actionBars.getMenuManager();
-
- if (menuManager.find(IWorkbenchActionConstants.MB_ADDITIONS) != null)
- menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS,
- new Separator(REPOSITORIES_SORTING_ACTION_GROUP));
- else
- menuManager.add(new Separator(REPOSITORIES_SORTING_ACTION_GROUP));
-
- IMenuManager sortSubmenu = new MenuManager(
- CVSUIMessages.RepositoriesSortingActionGroup_sortBy);
- menuManager.appendToGroup(REPOSITORIES_SORTING_ACTION_GROUP,
- sortSubmenu);
- sortSubmenu.add(labelSortingAction);
- sortSubmenu.add(locationSortingAction);
- sortSubmenu.add(hostSortingAction);
- sortSubmenu.add(new Separator());
- sortSubmenu.add(reverseSortingOrderAction);
- }
-
- public void setSelectedComparator(RepositoryComparator selectedComparator) {
- this.comparator = selectedComparator;
-
- labelSortingAction
- .setChecked(selectedComparator.getOrderBy() == RepositoryComparator.ORDER_DEFAULT);
- locationSortingAction
- .setChecked(selectedComparator.getOrderBy() == RepositoryComparator.ORDER_LOCATION);
- hostSortingAction
- .setChecked(selectedComparator.getOrderBy() == RepositoryComparator.ORDER_HOST);
-
- reverseSortingOrderAction.setChecked(!selectedComparator.isAscending());
-
- firePropertyChange(comparator, null);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
deleted file mode 100644
index 06b7ae543..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.model.AllRootsElement;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.PluginTransferData;
-
-/**
- * RepositoriesView is a view on a set of known CVS repositories
- * which allows navigation of the structure of the repository and
- * the performing of CVS-specific operations on the repository contents.
- */
-public class RepositoriesView extends RemoteViewPart {
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.RepositoriesView"; //$NON-NLS-1$
-
- // The root
- private AllRootsElement root;
-
- // Actions
- private IAction removeAction;
- private Action newAction;
- private Action newAnonAction;
- private PropertyDialogAction propertiesAction;
- private RemoveRootAction removeRootAction;
- private RemoveDateTagAction removeDateTagAction;
-
- private RepositoriesSortingActionGroup repositoriesSortingActionGroup;
- private IDialogSettings dialogSettings;
- private static final String SELECTED_ORDER_BY = "selectedOrderBy"; //$NON-NLS-1$
- private static final String SELECTED_SORTING_ORDER = "selectedSortingOrder"; //$NON-NLS-1$
- private RepositoryComparator savedComparator = RepositoriesSortingActionGroup.orderByLabelComparator;
-
- IRepositoryListener listener = new IRepositoryListener() {
- public void repositoryAdded(final ICVSRepositoryLocation root) {
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refreshViewer();
- getViewer().setSelection(new StructuredSelection(root));
- }
- });
- }
- public void repositoriesChanged(ICVSRepositoryLocation[] roots) {
- refresh();
- }
- private void refresh() {
- Display display = getViewer().getControl().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- RepositoriesView.this.refreshViewer();
- }
- });
- }
- };
-
- private static final class RepositoryDragSourceListener implements DragSourceListener {
- private IStructuredSelection selection;
-
- public void dragStart(DragSourceEvent event) {
- if(selection!=null) {
- final Object[] array = selection.toArray();
- // event.doit = Utils.getResources(array).length > 0;
- for (int i = 0; i < array.length; i++) {
- if (array[i] instanceof ICVSRemoteFile) {
- event.doit = true;
- return;
- }
- }
- event.doit = false;
- }
- }
-
- public void dragSetData(DragSourceEvent event) {
- if (selection!=null && CVSResourceTransfer.getInstance().isSupportedType(event.dataType)) {
- final Object[] array = selection.toArray();
- for (int i = 0; i < array.length; i++) {
- if (array[i] instanceof ICVSRemoteFile) {
- event.data = array[i];
- return;
- }
- }
- } else if (PluginTransfer.getInstance().isSupportedType(event.dataType)) {
- final Object[] array = selection.toArray();
- for (int i = 0; i < array.length; i++) {
- if (array[i] instanceof ICVSRemoteFile) {
- event.data = new PluginTransferData("org.eclipse.team.cvs.ui.cvsRemoteDrop", CVSResourceTransfer.getInstance().toByteArray((ICVSRemoteFile) array[i])); //$NON-NLS-1$
- return;
- }
- }
-
- }
- }
-
- public void dragFinished( DragSourceEvent event) {
- }
-
- public void updateSelection( IStructuredSelection selection) {
- this.selection = selection;
- }
- }
-
- RepositoryDragSourceListener repositoryDragSourceListener;
-
- /**
- * Constructor for RepositoriesView.
- */
- public RepositoriesView() {
- super(VIEW_ID);
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- dialogSettings = workbenchSettings.getSection(VIEW_ID);
- if (dialogSettings == null) {
- dialogSettings = workbenchSettings.addNewSection(VIEW_ID);
- }
-
- try {
- // parse the values
- String selectedOrderBy = dialogSettings.get(SELECTED_ORDER_BY);
- String selectedSortingOrder = dialogSettings.get(SELECTED_SORTING_ORDER);
-
- int orderBy = Integer.parseInt(selectedOrderBy);
- boolean ascending = Boolean.valueOf(selectedSortingOrder).booleanValue();
-
- savedComparator = new RepositoryComparator(orderBy, ascending);
- } catch (NumberFormatException e) {
- // ignore, use default comparator
- }
- }
-
- /**
- * Contribute actions to the view
- */
- protected void contributeActions() {
-
- final Shell shell = getShell();
-
- // Create actions
-
- // New Repository (popup)
- newAction = new Action(CVSUIMessages.RepositoriesView_new, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) {
- public void run() {
- NewLocationWizard wizard = new NewLocationWizard();
- wizard.setSwitchPerspectives(false);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- };
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newAction, IHelpContextIds.NEW_REPOSITORY_LOCATION_ACTION);
-
- if (includeAnonConnection()) {
- newAnonAction = new Action(CVSUIMessages.RepositoriesView_newAnonCVS, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) {
- 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", "/cvsroot/eclipse"); //$NON-NLS-1$ //$NON-NLS-2$
- NewLocationWizard wizard = new NewLocationWizard(p);
- wizard.setSwitchPerspectives(false);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- };
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newAnonAction, IHelpContextIds.NEW_DEV_ECLIPSE_REPOSITORY_LOCATION_ACTION);
- }
-
- // Properties
- propertiesAction = new PropertyDialogAction(shell, getViewer());
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
- propertiesAction.setEnabled(true);
- } else {
- propertiesAction.setEnabled(false);
- }
- getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = (IStructuredSelection)event.getSelection();
- boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof RepositoryRoot;
- propertiesAction.setEnabled(enabled);
- }
- });
- removeRootAction = new RemoveRootAction(viewer.getControl().getShell(), this);
- removeRootAction.selectionChanged((IStructuredSelection)null);
- removeDateTagAction = new RemoveDateTagAction();
- removeDateTagAction.selectionChanged( (IStructuredSelection)null);
- removeAction = new Action(){
- public void run(){
- if(removeRootAction.isEnabled()){
- removeRootAction.run();
- }
- if(removeDateTagAction.isEnabled()){
- removeDateTagAction.run();
- }
- }
- };
- PlatformUI.getWorkbench().getHelpSystem().setHelp(removeRootAction, IHelpContextIds.REMOVE_REPOSITORY_LOCATION_ACTION);
- IActionBars bars = getViewSite().getActionBars();
- bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction);
-
- // Sort By action group
- IPropertyChangeListener comparatorUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (RepositoriesSortingActionGroup.CHANGE_COMPARATOR
- .equals(property)) {
- Object newValue = event.getNewValue();
- getViewer().setComparator((ViewerComparator) newValue);
- saveSelectedComparator((RepositoryComparator) newValue);
- }
- }
- };
- setActionGroup(new RepositoriesSortingActionGroup(shell, comparatorUpdater));
- // restore comparator selection
- getRepositoriesSortingActionGroup().setSelectedComparator(savedComparator);
-
- super.contributeActions();
- }
-
- private void saveSelectedComparator(RepositoryComparator selectedComparator) {
- if (dialogSettings != null) {
- dialogSettings.put(SELECTED_ORDER_BY, selectedComparator.getOrderBy());
- dialogSettings.put(SELECTED_SORTING_ORDER, selectedComparator.isAscending());
- }
- }
-
- /**
- * Returns the action group.
- *
- * @return the action group
- */
- private RepositoriesSortingActionGroup getRepositoriesSortingActionGroup() {
- return repositoriesSortingActionGroup;
- }
-
- /**
- * Sets the action group.
- *
- * @param actionGroup the action group
- */
- private void setActionGroup(RepositoriesSortingActionGroup actionGroup) {
- this.repositoriesSortingActionGroup = actionGroup;
- }
-
- /**
- * Method includeEclipseConnection.
- * @return boolean
- */
- private boolean includeAnonConnection() {
- return System.getProperty("eclipse.cvs.anon") != null; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#addWorkbenchActions(org.eclipse.jface.action.IMenuManager)
- */
- protected void addWorkbenchActions(IMenuManager manager) {
- // New actions go next
- MenuManager sub = new MenuManager(CVSUIMessages.RepositoriesView_newSubmenu, IWorkbenchActionConstants.GROUP_ADD);
- manager.add(sub);
- super.addWorkbenchActions(manager);
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
-
- removeRootAction.selectionChanged(selection);
- removeDateTagAction.selectionChanged(selection);
- if(removeRootAction.isEnabled()) {
- manager.add(removeRootAction);
- }
- if(removeDateTagAction.isEnabled()){
- manager.add(removeDateTagAction);
- }
- if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
- manager.add(new Separator());
- manager.add(propertiesAction);
- }
- sub.add(newAction);
- if (newAnonAction != null)
- sub.add(newAnonAction);
- sub.add(new Separator("group1")); //$NON-NLS-1$
- }
-
- /*
- * @see WorkbenchPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- CVSUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(listener);
- getRepositoriesSortingActionGroup().fillActionBars(getViewSite().getActionBars());
- }
-
- /*
- * @see WorkbenchPart#dispose
- */
- public void dispose() {
- CVSUIPlugin.getPlugin().getRepositoryManager().removeRepositoryListener(listener);
- if (getRepositoriesSortingActionGroup() != null) {
- getRepositoriesSortingActionGroup().dispose();
- }
- super.dispose();
- }
-
- /**
- * Initialize the repositories and actions
- */
- private void initialize() {
- root = new AllRootsElement();
- }
-
- protected void initializeListeners() {
- super.initializeListeners();
- viewer.addSelectionChangedListener(removeRootAction);
- viewer.addSelectionChangedListener(removeDateTagAction);
- viewer.addSelectionChangedListener(new ISelectionChangedListener(){
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- handleChange(selection);
- }
- });
-
- repositoryDragSourceListener = new RepositoryDragSourceListener();
- viewer.addDragSupport( DND.DROP_LINK | DND.DROP_DEFAULT,
- new Transfer[] { CVSResourceTransfer.getInstance(),PluginTransfer.getInstance()},
- repositoryDragSourceListener);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getTreeInput()
- */
- protected Object getTreeInput() {
- initialize();
- return root;
- }
-
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- String msg = getStatusLineMessage(selection);
- getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
- }
-
- private String getStatusLineMessage(ISelection selection) {
- if (selection==null || selection.isEmpty()) return ""; //$NON-NLS-1$
- if (!(selection instanceof IStructuredSelection)) return ""; //$NON-NLS-1$
- IStructuredSelection s = (IStructuredSelection)selection;
-
- if (s.size() > 1)
- return NLS.bind(CVSUIMessages.RepositoriesView_NItemsSelected, new String[] { String.valueOf(s.size()) });
- Object element = TeamAction.getAdapter(s.getFirstElement(), ICVSResource.class);
- if (element instanceof ICVSRemoteResource) {
- ICVSRemoteResource res = (ICVSRemoteResource)element;
- String name;
- if (res.isContainer()) {
- name = res.getRepositoryRelativePath();
- } else {
- try {
- name = res.getRepositoryRelativePath() + " " + ((ICVSRemoteFile)res).getRevision(); //$NON-NLS-1$
- } catch (TeamException e) {
- TeamPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoriesView_CannotGetRevision, e);
- name = res.getRepositoryRelativePath();
- }
- }
- return NLS.bind(CVSUIMessages.RepositoriesView_ResourceInRepository, new String[] { name, res.getRepository().getLocation(true) });
- }
- return CVSUIMessages.RepositoriesView_OneItemSelected;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IHelpContextIds.REPOSITORIES_VIEW;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getKeyListener()
- */
- protected KeyAdapter getKeyListener() {
- return new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- if (WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- locations[i].flushUserInfo();
- }
- } else {
- refreshAll();
- }
- } else if (event.keyCode == SWT.F9 && WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
- refreshAll();
- }
- }
- };
- }
-
- private void handleChange(IStructuredSelection selection){
- removeRootAction.updateSelection(selection);
- removeDateTagAction.updateSelection(selection);
- removeAction.setEnabled(removeRootAction.isEnabled() || removeDateTagAction.isEnabled());
-
- repositoryDragSourceListener.updateSelection(selection);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
deleted file mode 100644
index 42a041c06..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class RepositoriesViewContentHandler extends DefaultHandler {
-
- public static final String REPOSITORIES_VIEW_TAG = "repositories-view"; //$NON-NLS-1$
-
- public static final String REPOSITORY_TAG = "repository"; //$NON-NLS-1$
- public static final String WORKING_SET_TAG = "working-set"; //$NON-NLS-1$
- public static final String CURRENT_WORKING_SET_TAG = "current-working-set"; //$NON-NLS-1$
- public static final String MODULE_TAG = "module"; //$NON-NLS-1$
- public static final String TAG_TAG = "tag"; //$NON-NLS-1$
- public static final String AUTO_REFRESH_FILE_TAG = "auto-refresh-file"; //$NON-NLS-1$
- public static final String DATE_TAGS_TAG = "date-tags"; //$NON-NLS-1$
- public static final String DATE_TAG_TAG = "date-tag"; //$NON-NLS-1$
-
- public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
- public static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
- public static final String PATH_ATTRIBUTE = "path"; //$NON-NLS-1$
- public static final String FULL_PATH_ATTRIBUTE = "full-path"; //$NON-NLS-1$
- public static final String TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
- public static final String READ_ID_ATTRIBUTE = "read-id"; //$NON-NLS-1$
- public static final String WRITE_ID_ATTRIBUTE = "write-id"; //$NON-NLS-1$
- public static final String LAST_ACCESS_TIME_ATTRIBUTE = "lastAcessTime"; //$NON-NLS-1$
-
- public static final String[] TAG_TYPES = {"head", "branch", "version", "date"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- public static final String DEFAULT_TAG_TYPE = "version"; //$NON-NLS-1$
- public static final String DEFINED_MODULE_TYPE = "defined"; //$NON-NLS-1$
-
- private RepositoryManager manager;
- private StringBuffer buffer = new StringBuffer();
- private Stack tagStack = new Stack();
- private RepositoryRoot currentRepositoryRoot;
- private String currentRemotePath;
- private List tags;
- private List dateTags;
- private List autoRefreshFiles;
- private boolean ignoreElements;
-
- private long lastAccessTime;
-
- public RepositoriesViewContentHandler(RepositoryManager manager) {
- this.manager = manager;
- }
-
- /**
- * @see ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] chars, int startIndex, int length) throws SAXException {
- buffer.append(chars, startIndex, length);
- }
-
- /**
- * @see ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
-
- String elementName = getElementName(namespaceURI, localName, qName);
- if (!elementName.equals(tagStack.peek())) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_unmatchedTag, new String[] { elementName }));
- }
-
- if (elementName.equals(REPOSITORIES_VIEW_TAG)) {
- // all done
- } else if (elementName.equals(REPOSITORY_TAG)) {
- if (!ignoreElements) {
- manager.add(currentRepositoryRoot);
- }
- currentRepositoryRoot = null;
- } else if (elementName.equals(WORKING_SET_TAG)) {
- // This tag is no longer used
- ignoreElements = false;
- } else if (elementName.equals(CURRENT_WORKING_SET_TAG)) {
- // This tag is no longer used
- ignoreElements = false;
- } else if (elementName.equals(MODULE_TAG)) {
- if (! ignoreElements && currentRepositoryRoot != null) {
- currentRepositoryRoot.addTags(currentRemotePath,
- (CVSTag[]) tags.toArray(new CVSTag[tags.size()]));
- if (lastAccessTime > 0)
- currentRepositoryRoot.setLastAccessedTime(currentRemotePath, lastAccessTime);
- currentRepositoryRoot.setAutoRefreshFiles(currentRemotePath,
- (String[]) autoRefreshFiles.toArray(new String[autoRefreshFiles.size()]));
- }
- }else if(elementName.equals(DATE_TAG_TAG)){
- if (! ignoreElements && currentRepositoryRoot != null) {
- Iterator iter = dateTags.iterator();
- while(iter.hasNext()){
- CVSTag tag = (CVSTag)iter.next();
- currentRepositoryRoot.addDateTag(tag);
- }
- }
- }
- tagStack.pop();
- }
-
- /**
- * @see ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(
- String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals(REPOSITORIES_VIEW_TAG)) {
- // just started
- } else if (elementName.equals(REPOSITORY_TAG)) {
- String id = atts.getValue(ID_ATTRIBUTE);
- if (id == null) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_missingAttribute, new String[] { REPOSITORY_TAG, ID_ATTRIBUTE }));
- }
- ICVSRepositoryLocation root;
- try {
- root = KnownRepositories.getInstance().getRepository(id);
- if (!KnownRepositories.getInstance().isKnownRepository(id)) {
- KnownRepositories.getInstance().addRepository(root, false);
- }
- } catch (CVSException e) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_errorCreatingRoot, new String[] { id }), e);
- }
- currentRepositoryRoot = new RepositoryRoot(root);
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name != null) {
- currentRepositoryRoot.setName(name);
- }
- } else if(elementName.equals(DATE_TAGS_TAG)){
- //prepare to collect date tag
- dateTags = new ArrayList();
- } else if (elementName.equals(DATE_TAG_TAG)){
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name == null) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_missingAttribute, new String[] { DATE_TAGS_TAG, NAME_ATTRIBUTE }));
- }
- dateTags.add(new CVSTag(name, CVSTag.DATE));
- }else if (elementName.equals(WORKING_SET_TAG)) {
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name == null) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_missingAttribute, new String[] { WORKING_SET_TAG, NAME_ATTRIBUTE }));
- }
- // Ignore any elements until the corresponding end tag is reached
- ignoreElements = true;
- } else if (elementName.equals(MODULE_TAG)) {
- String path = atts.getValue(PATH_ATTRIBUTE);
- if (path == null) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_missingAttribute, new String[] { MODULE_TAG, PATH_ATTRIBUTE }));
- }
- String type = atts.getValue(TYPE_ATTRIBUTE);
- if (type != null && type.equals(DEFINED_MODULE_TYPE)) {
- path = RepositoryRoot.asDefinedModulePath(path);
- }
- long cachedTime = 0;
- String cachedTimeString = atts.getValue(LAST_ACCESS_TIME_ATTRIBUTE);
- if (cachedTimeString != null) {
- try {
- Long time = Long.valueOf(cachedTimeString);
- cachedTime = time.longValue();
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
- startModule(path, cachedTime);
- } else if (elementName.equals(TAG_TAG)) {
- String type = atts.getValue(TYPE_ATTRIBUTE);
- if (type == null) {
- type = DEFAULT_TAG_TYPE;
- }
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name == null) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_missingAttribute, new String[] { TAG_TAG, NAME_ATTRIBUTE }));
- }
- tags.add(new CVSTag(name, getCVSTagType(type)));
- } else if (elementName.equals(AUTO_REFRESH_FILE_TAG)) {
- String path = atts.getValue(FULL_PATH_ATTRIBUTE);
- if (path == null) {
- // get the old path attribute format which was relative to the module
- path = atts.getValue(PATH_ATTRIBUTE);
- if (path == null) {
- throw new SAXException(NLS.bind(CVSUIMessages.RepositoriesViewContentHandler_missingAttribute, new String[] { AUTO_REFRESH_FILE_TAG, FULL_PATH_ATTRIBUTE }));
- }
- if (RepositoryRoot.isDefinedModuleName(currentRemotePath)) {
- path = null;
- } else {
- path = new Path(null, currentRemotePath).append(path).toString();
- }
- }
- if (path != null) autoRefreshFiles.add(path);
- } else if (elementName.equals(CURRENT_WORKING_SET_TAG)) {
- // Ignore any elements until the corresponding end tag is reached
- ignoreElements = true;
- }
- // empty buffer
- buffer = new StringBuffer();
- tagStack.push(elementName);
- }
-
- private void startModule(String path, long cachedTime) {
- currentRemotePath = path;
- tags = new ArrayList();
- this.lastAccessTime = cachedTime;
- autoRefreshFiles = new ArrayList();
- }
-
- /**
- * Method getCVSTagType.
- * @param type
- */
- public int getCVSTagType(String type) {
- for (int i = 0; i < TAG_TYPES.length; i++) {
- if (TAG_TYPES[i].equals(type))
- return i;
- }
- return CVSTag.VERSION;
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for project sets doesn't use namespaces so either of the two names
- * is fine. Therefore, use whichever one is provided.
- */
- private String getElementName(String namespaceURI, String localName, String qName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- } else {
- return qName;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryComparator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryComparator.java
deleted file mode 100644
index 6e9059bfb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryComparator.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.model.*;
-
-public class RepositoryComparator extends ViewerComparator {
-
- /**
- * Default sorting order, by label.
- */
- public static final int ORDER_DEFAULT = 0;
-
- public static final int ORDER_LOCATION = 1;
-
- public static final int ORDER_HOST = 2;
-
- private int orderBy = ORDER_DEFAULT;
-
- private boolean ascending = true;
-
- public RepositoryComparator(int order, boolean ascending) {
- super();
- this.orderBy = order;
- this.ascending = ascending;
- }
-
- public RepositoryComparator(int order) {
- super();
- this.orderBy = order;
- // default sorting order is ascending
- }
-
- public RepositoryComparator() {
- super();
- // default is sort by label ascending
- }
-
- public int getOrderBy() {
- return orderBy;
- }
-
- public void setOrder(int orderBy) {
- this.orderBy = orderBy;
- }
-
- public void setAscending(boolean ascending) {
- this.ascending = ascending;
- }
-
- public boolean isAscending() {
- return ascending;
- }
-
- public int category(Object element) {
- if (element instanceof ICVSRemoteFolder) {
- if (((ICVSRemoteFolder)element).isDefinedModule()) {
- return 7;
- }
- return 1;
- }
- if (element instanceof RemoteModule) {
- ICVSRemoteResource resource = ((RemoteModule)element).getCVSResource();
- if (resource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder) resource;
- if (folder.isDefinedModule()) {
- return 7;
- }
- }
- return 1;
- }
- if (element instanceof ICVSRemoteFile) {
- return 2;
- }
- if (element instanceof CVSTagElement) {
- CVSTagElement tagElement = (CVSTagElement)element;
- if (tagElement.getTag().getType() == CVSTag.HEAD) {
- return 0;
- } else if (tagElement.getTag().getType() == CVSTag.BRANCH) {
- return 4;
- } else if (tagElement.getTag().getType() == CVSTag.VERSION) {
- return 5;
- } else if (tagElement.getTag().getType() == CVSTag.DATE){
- return 6;
- }else{
- return 7;
- }
- }
- if (element instanceof BranchCategory) {
- return 4;
- }
- if (element instanceof VersionCategory) {
- return 5;
- }
- if (element instanceof DateTagCategory){
- return 6;
- }
- return 0;
- }
-
- public int compare(Viewer viewer, Object o1, Object o2) {
- int cat1 = category(o1);
- int cat2 = category(o2);
- if (cat1 != cat2) return cat1 - cat2;
-
- if (o1 instanceof CVSTagElement && o2 instanceof CVSTagElement) {
- CVSTag tag1 = ((CVSTagElement)o1).getTag();
- CVSTag tag2 = ((CVSTagElement)o2).getTag();
- if (tag1.getType() == CVSTag.BRANCH) {
- return tag1.compareTo(tag2);
- } else {
- return -1 * tag1.compareTo(tag2);
- }
- }
-
- // Sort versions in reverse alphabetical order
- if (o1 instanceof ICVSRemoteFolder && o2 instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder f1 = (ICVSRemoteFolder)o1;
- ICVSRemoteFolder f2 = (ICVSRemoteFolder)o2;
- if (f1.getName().equals(f2.getName())) {
- return compare(f1, f2);
- }
- }
-
- if (o1 instanceof ICVSRepositoryLocation && o2 instanceof ICVSRepositoryLocation) {
- return ((ICVSRepositoryLocation)o1).getLocation(false).compareTo(((ICVSRepositoryLocation)o2).getLocation(false));
- }
-
- if (o1 instanceof RepositoryRoot && o2 instanceof RepositoryRoot) {
- RepositoryRoot rr1 = (RepositoryRoot) o1;
- RepositoryRoot rr2 = (RepositoryRoot) o2;
-
- // use repository location strings to compare RepositoryRoots
- ICVSRepositoryLocation rl1 = rr1.getRoot();
- ICVSRepositoryLocation rl2 = rr2.getRoot();
-
- int compareResult = 0;
- switch (orderBy) {
- case ORDER_HOST:
- compareResult = rl1.getHost().compareTo(rl2.getHost());
- if (compareResult != 0)
- break;
- case ORDER_LOCATION:
- compareResult = rl1.getLocation(false).compareTo(
- rl2.getLocation(false));
- if (compareResult != 0)
- break;
- // add other cases here
- case ORDER_DEFAULT:
- // for default order use super.compare (i.e. compare labels)
- default:
- compareResult = super.compare(viewer, o1, o2);
- }
- return ascending ? compareResult : -compareResult;
- }
-
- return super.compare(viewer, o1, o2);
- }
-
- /*
- * Compare to remote folders whose names are the same.
- */
- private int compare(ICVSRemoteFolder f1, ICVSRemoteFolder f2) {
- CVSTag tag1 = f1.getTag();
- CVSTag tag2 = f2.getTag();
- if (tag1 == null) return 1;
- if (tag2 == null) return -1;
- return tag2.compareTo(tag1);
- }
-
- /**
- * Returns a reversed RepositoryComparator.
- *
- * @return A comparator which sorts repositories by the same criterion but
- * in a reversed order.
- */
- public RepositoryComparator getReversedComparator() {
- RepositoryComparator repositoryComparator = new RepositoryComparator(
- orderBy);
- repositoryComparator.setAscending(!this.ascending);
- return repositoryComparator;
- }
-
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java
deleted file mode 100644
index f1c0f1888..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.ide.dialogs.EncodingFieldEditor;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Repository preference page for setting the encoding of the server
- */
-public class RepositoryEncodingPropertyPage extends PropertyPage implements IPropertyChangeListener {
-
- private static final int LABEL_WIDTH_HINT = 400;
-
- private EncodingFieldEditor encoding;
- private ICVSRepositoryLocation location;
-
- private boolean valueChanged;
-
- public class OSGIPreferenceStore implements IPreferenceStore {
- private Preferences preferences, defaults;
- private boolean dirty;
-
- /**
- * Create a wrapper for the given OSGI preferences node
- * @param preferences an OSGI preferences node
- */
- public OSGIPreferenceStore(Preferences preferences, Preferences defaults) {
- this.preferences = preferences;
- this.defaults = defaults;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, java.lang.Object, java.lang.Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
- */
- public boolean contains(String name) {
- try {
- String[] keys = preferences.keys();
- for (int i = 0; i < keys.length; i++) {
- String string = keys[i];
- if (string.equals(name)) {
- return true;
- }
- }
- return false;
- } catch (BackingStoreException e) {
- CVSUIPlugin.log(new CVSStatus(IStatus.ERROR, CVSUIMessages.internal, e));
- return false;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
- */
- public boolean getBoolean(String name) {
- return preferences.getBoolean(name, getDefaultBoolean(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
- */
- public boolean getDefaultBoolean(String name) {
- if (defaults != null) {
- return defaults.getBoolean(name, false);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
- */
- public double getDefaultDouble(String name) {
- if (defaults != null) {
- return defaults.getDouble(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
- */
- public float getDefaultFloat(String name) {
- if (defaults != null) {
- return defaults.getFloat(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
- */
- public int getDefaultInt(String name) {
- if (defaults != null) {
- return defaults.getInt(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
- */
- public long getDefaultLong(String name) {
- if (defaults != null) {
- return defaults.getLong(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
- */
- public String getDefaultString(String name) {
- if (defaults != null) {
- return defaults.get(name, null);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
- */
- public double getDouble(String name) {
- return preferences.getDouble(name, getDefaultDouble(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
- */
- public float getFloat(String name) {
- return preferences.getFloat(name, getDefaultFloat(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
- */
- public int getInt(String name) {
- return preferences.getInt(name, getDefaultInt(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
- */
- public long getLong(String name) {
- return preferences.getLong(name, getDefaultLong(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
- */
- public String getString(String name) {
- return preferences.get(name, getDefaultString(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
- */
- public boolean isDefault(String name) {
- return !contains(name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return dirty;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String)
- */
- public void putValue(String name, String value) {
- preferences.put(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, double)
- */
- public void setDefault(String name, double value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, float)
- */
- public void setDefault(String name, float value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, int)
- */
- public void setDefault(String name, int value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, long)
- */
- public void setDefault(String name, long value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, java.lang.String)
- */
- public void setDefault(String name, String defaultObject) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, boolean)
- */
- public void setDefault(String name, boolean value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
- */
- public void setToDefault(String name) {
- preferences.remove(name);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, double)
- */
- public void setValue(String name, double value) {
- preferences.putDouble(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, float)
- */
- public void setValue(String name, float value) {
- preferences.putFloat(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, int)
- */
- public void setValue(String name, int value) {
- preferences.putInt(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, long)
- */
- public void setValue(String name, long value) {
- preferences.putLong(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, java.lang.String)
- */
- public void setValue(String name, String value) {
- putValue(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, boolean)
- */
- public void setValue(String name, boolean value) {
- preferences.putBoolean(name, value);
- dirty = true;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- initialize();
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- Label label = createWrappingLabel(composite, CVSUIMessages.RepositoryEncodingPropertyPage_2, 1);
-
- encoding = new EncodingFieldEditor(CVSRepositoryLocation.PREF_SERVER_ENCODING, CVSUIMessages.RepositoryEncodingPropertyPage_3, composite);
- encoding.setPage(this);
- encoding.setPreferenceStore(getLocationPreferenceStore());
- encoding.load();
- encoding.setPropertyChangeListener(this);
-
- Link pageLink = new Link(composite, SWT.LEFT | SWT.WRAP);
- pageLink.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
-
- PreferenceDialog dialog = PreferencesUtil
- .createPreferenceDialogOn(
- getShell(),
- "org.eclipse.ui.preferencePages.Workspace", null, null); //$NON-NLS-1$
- dialog.open();
-
- }
- });
-
- pageLink.setLayoutData(label.getLayoutData());
- pageLink.setText(CVSUIMessages.RepositoryEncodingPropertyPage_4);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.REPOSITORY_ENCODING_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- private IPreferenceStore getLocationPreferenceStore() {
- return new OSGIPreferenceStore(
- ((CVSRepositoryLocation)location).getPreferences(),
- CVSRepositoryLocation.getDefaultPreferences());
- }
-
- private void initialize() {
- location = null;
- IAdaptable element = getElement();
- if (element instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)element;
- } else {
- Object adapter = element.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)adapter;
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == FieldEditor.IS_VALID) {
- setValid(((Boolean)event.getNewValue()).booleanValue());
- return;
- } else if (event.getProperty() == FieldEditor.VALUE) {
- valueChanged = true;
- return;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- if (!valueChanged) {
- // See bug 137073
- // return true;
- }
- if (!KnownRepositories.getInstance().isKnownRepository(location.getLocation(false))) {
- // The location may have been replaced by the main properties page
- MessageDialog.openInformation(getShell(), CVSUIMessages.RepositoryEncodingPropertyPage_0, NLS.bind(CVSUIMessages.RepositoryEncodingPropertyPage_1, new String[] { location.getLocation(true) })); //
- return true;
- }
- encoding.store();
- try {
- ((CVSRepositoryLocation)location).getPreferences().flush();
- } catch (BackingStoreException e) {
- // Log and ignore
- CVSUIPlugin.log(new CVSStatus(IStatus.ERROR, CVSUIMessages.internal, e));
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- super.performDefaults();
- encoding.loadDefault();
- }
-
- private Label createWrappingLabel(Composite parent, String text, int horizontalSpan) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- label.setFont(parent.getFont());
- GridData data = new GridData();
- data.horizontalSpan = horizontalSpan;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = LABEL_WIDTH_HINT;
- label.setLayoutData(data);
- return label;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
deleted file mode 100644
index 829a4cc10..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
+++ /dev/null
@@ -1,972 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids <sdavids@gmx.de> - bug 74959
- * Maik Schreiber - bug 102461
- * William Mitsuda (wmitsuda@gmail.com) - Bug 153879 [Wizards] configurable size of cvs commit comment history
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkingSet;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * This class is repsible for maintaining the UI's list of known repositories,
- * and a list of known tags within each of those repositories.
- *
- * It also provides a number of useful methods for assisting in repository operations.
- */
-public class RepositoryManager {
- // old state file
- private static final String STATE_FILE = ".repositoryManagerState"; //$NON-NLS-1$
- private static final int STATE_FILE_VERSION_1 = -1;
- // new state file
- private static final String REPOSITORIES_VIEW_FILE = "repositoriesView.xml"; //$NON-NLS-1$
- private static final String COMMENT_HIST_FILE = "commitCommentHistory.xml"; //$NON-NLS-1$
- private static final String COMMENT_TEMPLATES_FILE = "commentTemplates.xml"; //$NON-NLS-1$
- static final String ELEMENT_COMMIT_COMMENT = "CommitComment"; //$NON-NLS-1$
- static final String ELEMENT_COMMIT_HISTORY = "CommitComments"; //$NON-NLS-1$
- static final String ELEMENT_COMMENT_TEMPLATES = "CommitCommentTemplates"; //$NON-NLS-1$
-
- private Map repositoryRoots = new HashMap();
-
- List listeners = new ArrayList();
-
- // The previously remembered comment
- static String[] previousComments = new String[0];
- static String[] commentTemplates = new String[0];
-
- public static boolean notifyRepoView = true;
-
- // Cache of changed repository roots
- private int notificationLevel = 0;
- private Map changedRepositories = new HashMap();
-
- public static final int DEFAULT_MAX_COMMENTS = 10;
-
- private int maxComments = DEFAULT_MAX_COMMENTS;
-
- public void setMaxComments(int maxComments) {
- if (maxComments > 0) {
- this.maxComments = maxComments;
- if (maxComments < previousComments.length) {
- String[] newComments = new String[maxComments];
- System.arraycopy(previousComments, 0, newComments, 0, maxComments);
- previousComments = newComments;
- }
- }
- }
-
- /**
- * Answer an array of all known remote roots.
- */
- public ICVSRepositoryLocation[] getKnownRepositoryLocations() {
- return KnownRepositories.getInstance().getRepositories();
- }
-
- /**
- * Method getRepositoryRoots.
- * @param iCVSRepositoryLocations
- * @return RepositoryRoot[]
- */
- private RepositoryRoot[] getRepositoryRoots(ICVSRepositoryLocation[] locations) {
- List roots = new ArrayList();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
- RepositoryRoot root = getRepositoryRootFor(location);
- if (root != null)
- roots.add(root);
- }
- return (RepositoryRoot[]) roots.toArray(new RepositoryRoot[roots.size()]);
- }
-
- public RepositoryRoot[] getKnownRepositoryRoots() {
- return getRepositoryRoots(getKnownRepositoryLocations());
- }
-
- /**
- * Get the list of known branch tags for a given remote root.
- */
- public CVSTag[] getKnownTags(ICVSFolder project, int tagType) {
- try {
- CVSTag[] tags = getKnownTags(project);
- Set result = new HashSet();
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (tag.getType() == tagType)
- result.add(tag);
- }
-
- return (CVSTag[])result.toArray(new CVSTag[result.size()]);
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- return new CVSTag[0];
- }
- }
-
- /**
- * Get the list of known version tags for a given project.
- */
- public CVSTag[] getKnownTags(ICVSRepositoryLocation location, int tagType) {
- Set result = new HashSet();
- RepositoryRoot root = (RepositoryRoot)repositoryRoots.get(location.getLocation(false));
- if (root != null) {
- String[] paths = root.getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- CVSTag[] tags = root.getAllKnownTags(path);
- for (int j = 0; j < tags.length; j++) {
- CVSTag tag = tags[j];
- if (tag.getType() == tagType)
- result.add(tag);
- }
- }
- }
- return (CVSTag[])result.toArray(new CVSTag[0]);
- }
-
- /**
- * Method getKnownTags.
- * @param repository
- * @param set
- * @param i
- * @param monitor
- * @return CVSTag[]
- */
- public CVSTag[] getKnownTags(ICVSRepositoryLocation repository, IWorkingSet set, int tagType, IProgressMonitor monitor) throws CVSException {
- if (set == null) {
- return getKnownTags(repository, tagType);
- }
- ICVSRemoteResource[] folders = getFoldersForTag(repository, CVSTag.DEFAULT, monitor);
- folders = filterResources(set, folders);
- Set tags = new HashSet();
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder)folders[i];
- tags.addAll(Arrays.asList(getKnownTags(folder, tagType)));
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- }
-
- public CVSTag[] getKnownTags(ICVSFolder project) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- return root.getAllKnownTags(remotePath);
- }
-
- /*
- * XXX I hope this methos is not needed in this form
- */
- public Map getKnownProjectsAndVersions(ICVSRepositoryLocation location) {
- Map knownTags = new HashMap();
- RepositoryRoot root = getRepositoryRootFor(location);
- String[] paths = root.getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- Set result = new HashSet();
- result.addAll(Arrays.asList(root.getAllKnownTags(path)));
- knownTags.put(path, result);
- }
- return knownTags;
- }
-
- public ICVSRemoteResource[] getFoldersForTag(ICVSRepositoryLocation location, CVSTag tag, IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(NLS.bind(CVSUIMessages.RepositoryManager_fetchingRemoteFolders, new String[] { tag.getName() }), 100);
- if (tag.getType() == CVSTag.HEAD) {
- ICVSRemoteResource[] resources = location.members(tag, false, Policy.subMonitorFor(monitor, 60));
- RepositoryRoot root = getRepositoryRootFor(location);
- ICVSRemoteResource[] modules = root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40));
- ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length];
- System.arraycopy(resources, 0, result, 0, resources.length);
- System.arraycopy(modules, 0, result, resources.length, modules.length);
- return result;
- }
- if (tag.getType() == CVSTag.DATE) {
- ICVSRemoteResource[] resources = location.members(tag, false, Policy.subMonitorFor(monitor, 60));
- RepositoryRoot root = getRepositoryRootFor(location);
- ICVSRemoteResource[] modules = root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40));
- ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length];
- System.arraycopy(resources, 0, result, 0, resources.length);
- System.arraycopy(modules, 0, result, resources.length, modules.length);
- return result;
- }
- Set result = new HashSet();
- // Get the tags for the location
- RepositoryRoot root = getRepositoryRootFor(location);
- String[] paths = root.getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- List tags = Arrays.asList(root.getAllKnownTags(path));
- if (tags.contains(tag)) {
- ICVSRemoteFolder remote = root.getRemoteFolder(path, tag, Policy.subMonitorFor(monitor, 100));
- result.add(remote);
- }
- }
- return (ICVSRemoteResource[])result.toArray(new ICVSRemoteResource[result.size()]);
- } finally {
- monitor.done();
- }
- }
-
- /*
- * Fetches tags from auto-refresh files if they exist. Then fetches tags from the user defined auto-refresh file
- * list. The fetched tags are cached in the CVS ui plugin's tag cache.
- */
- public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, boolean notify, IProgressMonitor monitor) throws TeamException {
- RepositoryRoot root = getRepositoryRootFor(folder);
- CVSTag[] tags = root.refreshDefinedTags(folder, recurse, monitor);
- if (tags.length > 0 && notify)
- broadcastRepositoryChange(root);
- return tags;
- }
-
- /**
- * A repository root has been added. Notify any listeners.
- */
- public void rootAdded(ICVSRepositoryLocation root) {
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.repositoryAdded(root);
- }
- }
-
- /**
- * A repository root has been removed.
- * Remove the tags defined for this root and notify any listeners
- */
- public void rootRemoved(ICVSRepositoryLocation root) {
- RepositoryRoot repoRoot = (RepositoryRoot)repositoryRoots.remove(root.getLocation(false));
- if (repoRoot != null)
- broadcastRepositoryChange(repoRoot);
- }
-
- /**
- * Accept tags for any CVS resource. However, for the time being,
- * the given version tags are added to the list of known tags for the
- * remote ancestor of the resource that is a direct child of the remote root
- */
- public void addTags(ICVSResource resource, CVSTag[] tags) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(resource);
- // XXX could be a file or folder
- String remotePath = RepositoryRoot.getRemotePathFor(resource);
- root.addTags(remotePath, tags);
- broadcastRepositoryChange(root);
- }
- public void addDateTag(ICVSRepositoryLocation location, CVSTag tag) {
- if(tag == null) return;
- RepositoryRoot root = getRepositoryRootFor(location);
- root.addDateTag(tag);
- broadcastRepositoryChange(root);
- }
- public CVSTag[] getDateTags(ICVSRepositoryLocation location) {
- RepositoryRoot root = getRepositoryRootFor(location);
- return root.getDateTags();
- }
- public void removeDateTag(ICVSRepositoryLocation location, CVSTag tag){
- RepositoryRoot root = getRepositoryRootFor(location);
- root.removeDateTag(tag);
- broadcastRepositoryChange(root);
- }
- public void setAutoRefreshFiles(ICVSFolder project, String[] filePaths) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- root.setAutoRefreshFiles(remotePath, filePaths);
- }
-
- public String[] getAutoRefreshFiles(ICVSFolder project) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- return root.getAutoRefreshFiles(remotePath);
- }
-
- /**
- * Remove the given tags from the list of known tags for the
- * given remote root.
- */
- public void removeTags(ICVSFolder project, CVSTag[] tags) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- root.removeTags(remotePath, tags);
- broadcastRepositoryChange(root);
- }
-
- public void startup() {
- loadState();
- loadCommentHistory();
- loadCommentTemplates();
- CVSProviderPlugin.getPlugin().addRepositoryListener(new ICVSListener() {
- public void repositoryAdded(ICVSRepositoryLocation root) {
- rootAdded(root);
- }
- public void repositoryRemoved(ICVSRepositoryLocation root) {
- rootRemoved(root);
- }
- });
-
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- store.addPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY)) {
- Object newValue = event.getNewValue();
- if (newValue instanceof String) {
- try {
- setMaxComments(Integer.parseInt((String) newValue));
- } catch (NumberFormatException e) {
- // fail silently
- }
- }
- }
- }
-
- });
- setMaxComments(store.getInt(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY));
- }
-
- public void shutdown() throws TeamException {
- saveState();
- saveCommentHistory();
- saveCommentTemplates();
- }
-
- private void loadState() {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(REPOSITORIES_VIEW_FILE);
- File file = pluginStateLocation.toFile();
- if (file.exists()) {
- try {
- BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
- try {
- readState(is);
- } finally {
- is.close();
- }
- } catch (IOException e) {
- CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- } else {
- IPath oldPluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(STATE_FILE);
- file = oldPluginStateLocation.toFile();
- if (file.exists()) {
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(file));
- try {
- readOldState(dis);
- } finally {
- dis.close();
- }
- saveState();
- file.delete();
- } catch (IOException e) {
- CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- }
- private void loadCommentHistory() {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(COMMENT_HIST_FILE);
- File file = pluginStateLocation.toFile();
- if (!file.exists()) return;
- try {
- BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
- try {
- readCommentHistory(is);
- } finally {
- is.close();
- }
- } catch (IOException e) {
- CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- private void loadCommentTemplates() {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(COMMENT_TEMPLATES_FILE);
- File file = pluginStateLocation.toFile();
- if (!file.exists()) return;
- try {
- BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
- try {
- readCommentTemplates(is);
- } finally {
- is.close();
- }
- } catch (IOException e) {
- CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- protected void saveState() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(REPOSITORIES_VIEW_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File stateFile = pluginStateLocation.append(REPOSITORIES_VIEW_FILE).toFile();
- try {
- XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile)));
- try {
- writeState(writer);
- } finally {
- writer.close();
- }
- if (stateFile.exists()) {
- stateFile.delete();
- }
- boolean renamed = tempFile.renameTo(stateFile);
- if (!renamed) {
- throw new TeamException(new Status(IStatus.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, NLS.bind(CVSUIMessages.RepositoryManager_rename, new String[] { tempFile.getAbsolutePath() }), null));
- }
- } catch (IOException e) {
- throw new TeamException(new Status(IStatus.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, NLS.bind(CVSUIMessages.RepositoryManager_save, new String[] { stateFile.getAbsolutePath() }), e));
- }
- }
- private void writeState(XMLWriter writer) {
- writer.startTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG, null, true);
- // Write the repositories
- Collection repos = Arrays.asList(getKnownRepositoryLocations());
- Iterator it = repos.iterator();
- while (it.hasNext()) {
- CVSRepositoryLocation location = (CVSRepositoryLocation)it.next();
- RepositoryRoot root = getRepositoryRootFor(location);
- root.writeState(writer);
- }
- writer.endTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG);
- }
-
- private void readState(InputStream stream) throws IOException, TeamException {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- parser.parse(new InputSource(stream), new RepositoriesViewContentHandler(this));
- } catch (SAXException ex) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSUIMessages.RepositoryManager_parsingProblem, new String[] { REPOSITORIES_VIEW_FILE }), ex);
- throw new CVSException(status);
- } catch (ParserConfigurationException ex) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSUIMessages.RepositoryManager_parsingProblem, new String[] { REPOSITORIES_VIEW_FILE }), ex);
- throw new CVSException(status);
- }
- }
-
- private void readCommentHistory(InputStream stream) throws IOException, TeamException {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- parser.parse(new InputSource(stream), new CommentHistoryContentHandler());
- } catch (SAXException ex) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSUIMessages.RepositoryManager_parsingProblem, new String[] { COMMENT_HIST_FILE }), ex);
- throw new CVSException(status);
- } catch (ParserConfigurationException ex) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSUIMessages.RepositoryManager_parsingProblem, new String[] { COMMENT_HIST_FILE }), ex);
- throw new CVSException(status);
- }
- }
-
- private void readOldState(DataInputStream dis) throws IOException, TeamException {
- int repoSize = dis.readInt();
- boolean version1 = false;
- if (repoSize == STATE_FILE_VERSION_1) {
- version1 = true;
- repoSize = dis.readInt();
- }
- for (int i = 0; i < repoSize; i++) {
- ICVSRepositoryLocation root = KnownRepositories.getInstance().getRepository(dis.readUTF());
- RepositoryRoot repoRoot = getRepositoryRootFor(root);
-
- // read branch tags associated with this root
- int tagsSize = dis.readInt();
- CVSTag[] branchTags = new CVSTag[tagsSize];
- for (int j = 0; j < tagsSize; j++) {
- String tagName = dis.readUTF();
- int tagType = dis.readInt();
- branchTags[j] = new CVSTag(tagName, tagType);
- }
- // Ignore the branch tags since they are handled differently now
- // addBranchTags(root, branchTags);
-
- // read the number of projects for this root that have version tags
- int projSize = dis.readInt();
- if (projSize > 0) {
- for (int j = 0; j < projSize; j++) {
- String name = dis.readUTF();
- Set tagSet = new HashSet();
- int numTags = dis.readInt();
- for (int k = 0; k < numTags; k++) {
- tagSet.add(new CVSTag(dis.readUTF(), CVSTag.VERSION));
- }
- CVSTag[] tags = (CVSTag[]) tagSet.toArray(new CVSTag[tagSet.size()]);
- repoRoot.addTags(name, tags);
- }
- }
- // read the auto refresh filenames for this project
- if (version1) {
- try {
- projSize = dis.readInt();
- if (projSize > 0) {
- for (int j = 0; j < projSize; j++) {
- String name = dis.readUTF();
- Set filenames = new HashSet();
- int numFilenames = dis.readInt();
- for (int k = 0; k < numFilenames; k++) {
- filenames.add(name + "/" + dis.readUTF()); //$NON-NLS-1$
- }
- repoRoot.setAutoRefreshFiles(name, (String[]) filenames.toArray(new String[filenames.size()]));
- }
- }
- } catch (EOFException e) {
- // auto refresh files are not persisted, continue and save them next time.
- }
- }
- broadcastRepositoryChange(repoRoot);
- }
- }
-
- protected void saveCommentHistory() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(COMMENT_HIST_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File histFile = pluginStateLocation.append(COMMENT_HIST_FILE).toFile();
- try {
- XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile)));
- try {
- writeCommentHistory(writer);
- } finally {
- writer.close();
- }
- if (histFile.exists()) {
- histFile.delete();
- }
- boolean renamed = tempFile.renameTo(histFile);
- if (!renamed) {
- throw new TeamException(new Status(IStatus.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, NLS.bind(CVSUIMessages.RepositoryManager_rename, new String[] { tempFile.getAbsolutePath() }), null));
- }
- } catch (IOException e) {
- throw new TeamException(new Status(IStatus.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, NLS.bind(CVSUIMessages.RepositoryManager_save, new String[] { histFile.getAbsolutePath() }), e));
- }
- }
- private void writeCommentHistory(XMLWriter writer) {
- writer.startTag(ELEMENT_COMMIT_HISTORY, null, false);
- for (int i = 0; i < previousComments.length && i < maxComments; i++)
- writer.printSimpleTag(ELEMENT_COMMIT_COMMENT, previousComments[i]);
- writer.endTag(ELEMENT_COMMIT_HISTORY);
- }
-
- public void addRepositoryListener(IRepositoryListener listener) {
- listeners.add(listener);
- }
-
- public void removeRepositoryListener(IRepositoryListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Return the entered comment or null if canceled.
- * @param proposedComment
- */
- public String promptForComment(final Shell shell, IResource[] resourcesToCommit, String proposedComment) {
- final int[] result = new int[1];
- final ReleaseCommentDialog dialog = new ReleaseCommentDialog(shell, resourcesToCommit, proposedComment, IResource.DEPTH_INFINITE);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- if (result[0] != Window.OK) return;
- }
- });
- if (result[0] != Window.OK) return null;
- return dialog.getComment();
- }
-
- /**
- * Prompt to add all or some of the provided resources to version control.
- * The value null is returned if the dialog is cancelled.
- *
- * @param shell
- * @param unadded
- * @return IResource[]
- */
- public IResource[] promptForResourcesToBeAdded(Shell shell, IResource[] unadded) {
- if (unadded == null) return new IResource[0];
- if (unadded.length == 0) return unadded;
- final IResource[][] result = new IResource[1][0];
- result[0] = null;
- final AddToVersionControlDialog dialog = new AddToVersionControlDialog(shell, unadded);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- int code = dialog.open();
- if (code == IDialogConstants.YES_ID) {
- result[0] = dialog.getResourcesToAdd();
- } else if(code == IDialogConstants.NO_ID) {
- // allow the commit to continue.
- result[0] = new IResource[0];
- }
- }
- });
- return result[0];
- }
-
- public ICVSRepositoryLocation getRepositoryLocationFor(ICVSResource resource) {
- try {
- return internalGetRepositoryLocationFor(resource);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
- private ICVSRepositoryLocation internalGetRepositoryLocationFor(ICVSResource resource) throws CVSException {
- ICVSFolder folder;
- if (resource.isFolder()) {
- folder = (ICVSFolder)resource;
- } else {
- folder = resource.getParent();
- }
- if (folder.isCVSFolder()) {
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(folder.getFolderSyncInfo().getRoot());
- return location;
- }
- // XXX This is asking for trouble
- return null;
- }
-
- private RepositoryRoot getRepositoryRootFor(ICVSResource resource) throws CVSException {
- ICVSRepositoryLocation location = internalGetRepositoryLocationFor(resource);
- if (location == null) return null;
- return getRepositoryRootFor(location);
- }
-
- public RepositoryRoot getRepositoryRootFor(ICVSRepositoryLocation location) {
- RepositoryRoot root = (RepositoryRoot)repositoryRoots.get(location.getLocation(false));
- if (root == null) {
- root = new RepositoryRoot(location);
- add(root);
- }
- return root;
- }
-
- /**
- * Add the given repository root to the receiver. The provided instance of RepositoryRoot
- * is used to provide extra information about the repository location
- *
- * @param currentRepositoryRoot
- */
- public void add(RepositoryRoot root) {
- repositoryRoots.put(root.getRoot().getLocation(false), root);
- broadcastRepositoryChange(root);
- }
-
- private void broadcastRepositoryChange(RepositoryRoot root) {
- if (notificationLevel == 0) {
- broadcastRepositoriesChanged(new ICVSRepositoryLocation[] {root.getRoot()});
- } else {
- changedRepositories.put(root.getRoot().getLocation(false), root.getRoot());
- }
- }
-
- private void broadcastRepositoriesChanged(ICVSRepositoryLocation[] roots) {
- if (roots.length == 0) return;
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.repositoriesChanged(roots);
- }
- }
-
- /**
- * Run the given runnable, waiting until the end to perform a refresh
- *
- * @param runnable
- * @param monitor
- */
- public void run(IRunnableWithProgress runnable, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- notificationLevel++;
- runnable.run(monitor);
- } finally {
- notificationLevel = Math.max(0, notificationLevel - 1);
- if (notificationLevel == 0) {
- try {
- Collection roots = changedRepositories.values();
- broadcastRepositoriesChanged((ICVSRepositoryLocation[]) roots.toArray(new ICVSRepositoryLocation[roots.size()]));
- } finally {
- changedRepositories.clear();
- }
- }
- }
- }
-
- /**
- * Method isDisplayingProjectVersions.
- * @param repository
- * @return boolean
- */
- public boolean isDisplayingProjectVersions(ICVSRepositoryLocation repository) {
- return true;
- }
-
- /**
- * Method filterResources filters the given resources using the given
- * working set.
- *
- * @param current
- * @param resources
- * @return ICVSRemoteResource[]
- */
- public ICVSRemoteResource[] filterResources(IWorkingSet workingSet, ICVSRemoteResource[] resources) {
- if (workingSet == null) return resources;
- // get the projects associated with the working set
- IAdaptable[] adaptables = workingSet.getElements();
- Set projects = new HashSet();
- for (int i = 0; i < adaptables.length; i++) {
- IAdaptable adaptable = adaptables[i];
- Object adapted = adaptable.getAdapter(IResource.class);
- if (adapted != null) {
- // Can this code be generalized?
- IProject project = ((IResource)adapted).getProject();
- projects.add(project);
- }
- }
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- ICVSRemoteResource resource = resources[i];
- for (Iterator iter = projects.iterator(); iter.hasNext();) {
- IProject project = (IProject) iter.next();
- if (project.getName().equals(resource.getName())) {
- result.add(resource);
- break;
- }
- }
- }
- return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]);
- }
-
- /**
- * Method setLabel.
- * @param location
- * @param label
- */
- public void setLabel(CVSRepositoryLocation location, String label) {
- RepositoryRoot root = getRepositoryRootFor(location);
- String oldLabel = root.getName();
- if (oldLabel == null) {
- if (label == null) return;
- root.setName(label);
- } else if (label == null) {
- root.setName(label);
- } else if (label.equals(oldLabel)) {
- return;
- } else {
- root.setName(label);
- }
- broadcastRepositoryChange(root);
- }
-
- /**
- * Replace the old repository location with the new one assuming that they
- * are the same location with different authentication informations
- * @param location
- * @param newLocation
- */
- public void replaceRepositoryLocation(
- final ICVSRepositoryLocation oldLocation,
- final CVSRepositoryLocation newLocation) {
-
- try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- RepositoryRoot root = getRepositoryRootFor(oldLocation);
- // Disposing of the old location will result in the deletion of the
- // cached root through a listener callback
- KnownRepositories.getInstance().disposeRepository(oldLocation);
-
- // Get the new location from the CVS plugin to ensure we use the
- // instance that will be returned by future calls to getRepository()
- boolean isNew = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
- root.setRepositoryLocation(
- KnownRepositories.getInstance().addRepository(newLocation, isNew /* broadcast */));
- add(root);
- }
- }, Policy.monitorFor(null));
- } catch (InvocationTargetException e) {
- CVSException.wrapException(e);
- } catch (InterruptedException e) {
- }
- }
-
- /**
- * Purge any cahced information.
- */
- public void purgeCache() {
- for (Iterator iter = repositoryRoots.values().iterator(); iter.hasNext();) {
- RepositoryRoot root = (RepositoryRoot) iter.next();
- root.clearCache();
- }
- }
-
- /**
- * Answer the list of comments that were previously used when committing.
- * @return String[]
- */
- public String[] getPreviousComments() {
- return previousComments;
- }
-
- /**
- * Method addComment.
- * @param string
- */
- public void addComment(String comment) {
- // Make comment first element if it's already there
- int index = getCommentIndex(comment);
- if (index != -1) {
- makeFirstElement(index);
- return;
- }
- if (containsCommentTemplate(comment))
- return;
-
- // Insert the comment as the first element
- String[] newComments = new String[Math.min(previousComments.length + 1, maxComments)];
- newComments[0] = comment;
- for (int i = 1; i < newComments.length; i++) {
- newComments[i] = previousComments[i-1];
- }
- previousComments = newComments;
- }
-
- private int getCommentIndex(String comment) {
- for (int i = 0; i < previousComments.length; i++) {
- if (previousComments[i].equals(comment)) {
- return i;
- }
- }
- return -1;
- }
-
- private void makeFirstElement(int index) {
- String[] newComments = new String[previousComments.length];
- newComments[0] = previousComments[index];
- System.arraycopy(previousComments, 0, newComments, 1, index);
- int maxIndex = previousComments.length - 1;
- if (index != maxIndex) {
- int nextIndex = (index + 1);
- System.arraycopy(previousComments, nextIndex, newComments,
- nextIndex, (maxIndex - index));
- }
- previousComments = newComments;
- }
-
- private void readCommentTemplates(InputStream stream) throws IOException, TeamException {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- parser.parse(new InputSource(stream),
- new CommentTemplatesContentHandler());
- } catch (SAXException ex) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(
- CVSUIMessages.RepositoryManager_parsingProblem,
- new String[] { COMMENT_TEMPLATES_FILE }), ex);
- throw new CVSException(status);
- } catch (ParserConfigurationException ex) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(
- CVSUIMessages.RepositoryManager_parsingProblem,
- new String[] { COMMENT_TEMPLATES_FILE }), ex);
- throw new CVSException(status);
- }
- }
-
- protected void saveCommentTemplates() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(
- COMMENT_TEMPLATES_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File histFile = pluginStateLocation.append(COMMENT_TEMPLATES_FILE)
- .toFile();
- try {
- XMLWriter writer = new XMLWriter(new BufferedOutputStream(
- new FileOutputStream(tempFile)));
- try {
- writeCommentTemplates(writer);
- } finally {
- writer.close();
- }
- if (histFile.exists()) {
- histFile.delete();
- }
- boolean renamed = tempFile.renameTo(histFile);
- if (!renamed) {
- throw new TeamException(new Status(IStatus.ERROR,
- CVSUIPlugin.ID, TeamException.UNABLE, NLS.bind(
- CVSUIMessages.RepositoryManager_rename,
- new String[] { tempFile.getAbsolutePath() }),
- null));
- }
- } catch (IOException e) {
- throw new TeamException(new Status(IStatus.ERROR, CVSUIPlugin.ID,
- TeamException.UNABLE, NLS.bind(
- CVSUIMessages.RepositoryManager_save,
- new String[] { histFile.getAbsolutePath() }), e));
- }
- }
-
- private void writeCommentTemplates(XMLWriter writer) {
- writer.startTag(ELEMENT_COMMENT_TEMPLATES, null, false);
- for (int i = 0; i < commentTemplates.length; i++)
- writer.printSimpleTag(ELEMENT_COMMIT_COMMENT, commentTemplates[i]);
- writer.endTag(ELEMENT_COMMENT_TEMPLATES);
- }
-
- private boolean containsCommentTemplate(String comment) {
- for (int i = 0; i < commentTemplates.length; i++) {
- if (commentTemplates[i].equals(comment)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Get list of comment templates.
- */
- public String[] getCommentTemplates() {
- return commentTemplates;
- }
-
- public void replaceAndSaveCommentTemplates(String[] templates)
- throws TeamException {
- commentTemplates = templates;
- saveCommentTemplates();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
deleted file mode 100644
index 8b2c1c3b0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
+++ /dev/null
@@ -1,627 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-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.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-
-public class RepositoryRoot extends PlatformObject {
-
- public static final String[] DEFAULT_AUTO_REFRESH_FILES = { ".project" }; //$NON-NLS-1$
- private static final String DEFINED_MODULE_PREFIX = "module:"; //$NON-NLS-1$
-
- ICVSRepositoryLocation root;
- String name;
- // Map of String (remote folder path) -> TagCacheEntry
- Map versionAndBranchTags = new HashMap();
- // Map of String (remote folder path) -> Set (file paths that are project relative)
- Map autoRefreshFiles = new HashMap();
- // Map of String (module name) -> ICVSRemoteFolder (that is a defined module)
- Map modulesCache;
- Object modulesCacheLock = new Object();
- // Lis of date tags
- List dateTags = new ArrayList();
-
- public static class TagCacheEntry {
- Set tags = new HashSet();
- long lastAccessTime;
- private static final int CACHE_LIFESPAN_IN_DAYS = 7;
- public TagCacheEntry() {
- accessed();
- }
- public boolean isExpired() {
- long currentTime = System.currentTimeMillis();
- long ms = currentTime - lastAccessTime;
- int seconds = (int)ms / 1000;
- int hours = seconds / 60 / 60;
- int days = hours / 24;
- return days > CACHE_LIFESPAN_IN_DAYS;
- }
- public void accessed() {
- lastAccessTime = System.currentTimeMillis();
- }
- }
-
- public RepositoryRoot(ICVSRepositoryLocation root) {
- this.root = root;
- }
-
- /**
- * Returns the name.
- * @return String
- */
- public String getName() {
- return name;
- }
-
- /**
- * Method getRemoteFolder.
- * @param path
- * @param tag
- * @return ICVSRemoteFolder
- */
- public ICVSRemoteFolder getRemoteFolder(String path, CVSTag tag, IProgressMonitor monitor) {
- if (isDefinedModuleName(path)) {
- return getDefinedModule(getDefinedModuleName(path), tag, monitor);
- } else {
- return root.getRemoteFolder(path, tag);
- }
- }
-
- static boolean isDefinedModuleName(String path) {
- return path.startsWith(DEFINED_MODULE_PREFIX);
- }
-
- static String getDefinedModuleName(String path) {
- return path.substring(DEFINED_MODULE_PREFIX.length());
- }
-
- static String asDefinedModulePath(String path) {
- return DEFINED_MODULE_PREFIX + path;
- }
-
- /**
- * Method getDefinedModule.
- * @param path
- * @param tag
- * @param monitor
- * @return ICVSRemoteFolder
- */
- private ICVSRemoteFolder getDefinedModule(String path, CVSTag tag, IProgressMonitor monitor) {
- Map cache = getDefinedModulesCache(tag, monitor);
- ICVSRemoteFolder folder = (ICVSRemoteFolder)cache.get(path);
- if (folder != null) {
- folder = (ICVSRemoteFolder)folder.forTag(tag);
- }
- return folder;
- }
-
- private Map getDefinedModulesCache(CVSTag tag, IProgressMonitor monitor) {
- if (modulesCache == null) {
- try {
- // Fetch the modules before locking the cache (to avoid deadlock)
- ICVSRemoteResource[] folders = root.members(CVSTag.DEFAULT, true, monitor);
- synchronized(modulesCacheLock) {
- modulesCache = new HashMap();
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteResource resource = folders[i];
- modulesCache.put(resource.getName(), resource);
- }
- }
- } catch (CVSException e) {
- // we could't fetch the modules. Log the problem and continue
- CVSUIPlugin.log(e);
- // Return an empty map but don't save it so the fetching of
- // the modules will occur again
- return new HashMap();
- }
- }
- return modulesCache;
- }
-
- public ICVSRemoteResource[] getDefinedModules(CVSTag tag, IProgressMonitor monitor) {
- Map cache = getDefinedModulesCache(tag, monitor);
- return (ICVSRemoteResource[]) cache.values().toArray(new ICVSRemoteResource[cache.size()]);
- }
-
- public static String getRemotePathFor(ICVSResource resource) throws CVSException {
- if (resource.isFolder()) {
- if (resource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder remoteFolder = (ICVSRemoteFolder) resource;
- if (remoteFolder.isDefinedModule()) {
- return asDefinedModulePath(remoteFolder.getName());
- }
- }
- FolderSyncInfo info = ((ICVSFolder)resource).getFolderSyncInfo();
- if (info == null)
- throw new CVSException(NLS.bind(CVSUIMessages.RepositoryRoot_folderInfoMissing, new String[] { resource.getName() }));
- return info.getRepository();
- } else {
- FolderSyncInfo info = resource.getParent().getFolderSyncInfo();
- if (info == null)
- throw new CVSException(NLS.bind(CVSUIMessages.RepositoryRoot_folderInfoMissing, new String[] { resource.getParent().getName() }));
- String path = new Path(null, info.getRepository()).append(resource.getName()).toString();
- return path;
- }
- }
-
- /**
- * Returns the root.
- * @return ICVSRepositoryLocation
- */
- public ICVSRepositoryLocation getRoot() {
- return root;
- }
-
- /**
- * Sets the name.
- * @param name The name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Accept the tags for any remote path that represents a folder. However, for the time being,
- * the given version tags are added to the list of known tags for the
- * remote ancestor of the resource that is a direct child of the remote root.
- *
- * It is the reponsibility of the caller to ensure that the given remote path is valid.
- */
- public void addTags(String remotePath, CVSTag[] tags) {
- addDateTags(tags);
- addVersionAndBranchTags(remotePath, tags);
- }
-
- private void addDateTags(CVSTag[] tags){
- for(int i = 0; i < tags.length; i++){
- if(tags[i].getType() == CVSTag.DATE){
- dateTags.add(tags[i]);
- }
- }
- }
- private void addVersionAndBranchTags(String remotePath, CVSTag[] tags) {
- // Get the name to cache the version tags with
- String name = getCachePathFor(remotePath);
-
- // Make sure there is a table for the ancestor that holds the tags
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(name);
- if (entry == null) {
- entry = new TagCacheEntry();
- versionAndBranchTags.put(name, entry);
- } else {
- entry.accessed();
- }
-
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- if(tags[i].getType() != CVSTag.DATE){
- entry.tags.add(tags[i]);
- }
- }
- }
-
- /**
- * Add the given date tag to the list of date tags associated with the repository.
- * @param tag a date tag
- */
- public void addDateTag(CVSTag tag) {
- if (!dateTags.contains(tag)) {
- dateTags.add(tag);
- }
- }
- public void removeDateTag(CVSTag tag) {
- if (dateTags.contains(tag)) {
- dateTags.remove(tag);
- }
- }
- /**
- * Return the list of date tags assocaiated with the repository.
- * @return the list of date tags
- */
- public CVSTag[] getDateTags() {
- return (CVSTag[]) dateTags.toArray(new CVSTag[dateTags.size()]);
- }
-
- /**
- * Remove the given tags from the receiver
- * @param remotePath
- * @param tags
- */
- public void removeTags(String remotePath, CVSTag[] tags) {
- removeDateTags(tags);
- removeVersionAndBranchTags(remotePath, tags);
- }
-
- private void removeDateTags(CVSTag[] tags) {
- if(dateTags.isEmpty())return;
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- dateTags.remove(tags[i]);
- }
- }
-
- private void removeVersionAndBranchTags(String remotePath, CVSTag[] tags) {
- // Get the name to cache the version tags with
- String name = getCachePathFor(remotePath);
-
- // Make sure there is a table for the ancestor that holds the tags
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(name);
- if (entry == null) {
- return;
- }
-
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- entry.tags.remove(tags[i]);
- }
- entry.accessed();
- }
-
- /**
- * Returns the absolute paths of the auto refresh files relative to the
- * repository.
- *
- * @return String[]
- */
- public String[] getAutoRefreshFiles(String remotePath) {
- String name = getCachePathFor(remotePath);
- Set files = (Set)autoRefreshFiles.get(name);
- if (files == null || files.isEmpty()) {
- // convert the default relative file paths to full paths
- if (isDefinedModuleName(remotePath)) {
- return new String[0];
- }
- List result = new ArrayList();
- for (int i = 0; i < DEFAULT_AUTO_REFRESH_FILES.length; i++) {
- String relativePath = DEFAULT_AUTO_REFRESH_FILES[i];
- result.add(new Path(null, remotePath).append(relativePath).toString());
- }
- return (String[]) result.toArray(new String[result.size()]);
- } else {
- return (String[]) files.toArray(new String[files.size()]);
- }
- }
-
- /**
- * Sets the auto refresh files for the given remote path to the given
- * string values which are absolute file paths (relative to the receiver).
- *
- * @param autoRefreshFiles The autoRefreshFiles to set
- */
- public void setAutoRefreshFiles(String remotePath, String[] autoRefreshFiles) {
- Set newFiles = new HashSet(Arrays.asList(autoRefreshFiles));
- // Check to see if the auto-refresh files are the default files
- if (autoRefreshFiles.length == DEFAULT_AUTO_REFRESH_FILES.length) {
- boolean isDefault = true;
- for (int i = 0; i < DEFAULT_AUTO_REFRESH_FILES.length; i++) {
- String filePath = DEFAULT_AUTO_REFRESH_FILES[i];
- if (!newFiles.contains(new Path(null, remotePath).append(filePath).toString())) {
- isDefault = false;
- break;
- }
- }
- if (isDefault) {
- this.autoRefreshFiles.remove(getCachePathFor(remotePath));
- return;
- }
- }
- this.autoRefreshFiles.put(getCachePathFor(remotePath), newFiles);
- }
-
- /**
- * Fetches tags from auto-refresh files.
- */
- public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- CVSTag[] tags = null;
- if (!recurse && !folder.getFolderSyncInfo().isVirtualDirectory()) {
- // Only try the auto-refresh file(s) if we are not recursing into sub-folders
- tags = fetchTagsUsingAutoRefreshFiles(folder, Policy.subMonitorFor(monitor, 50));
- }
- if (tags == null || tags.length == 0) {
- // There we're no tags found on the auto-refresh files or we we're aksed to go deep
- // Try using the log command
- tags = fetchTagsUsingLog(folder, recurse, Policy.subMonitorFor(monitor, 50));
- }
- if (tags != null && tags.length > 0) {
- String remotePath = getRemotePathFor(folder);
- addTags(remotePath, tags);
- }
- monitor.done();
- return tags;
- }
-
- private CVSTag[] fetchTagsUsingLog(ICVSFolder folder, final boolean recurse, IProgressMonitor monitor) throws CVSException {
- LogEntryCache logEntries = new LogEntryCache();
- RemoteLogOperation operation = new RemoteLogOperation(null, new ICVSRemoteResource[] { asRemoteResource(folder) }, null, null, logEntries) {
- protected Command.LocalOption[] getLocalOptions(CVSTag tag1,CVSTag tag2) {
- Command.LocalOption[] options = new Command.LocalOption[] {};
- if (recurse)
- return options;
- Command.LocalOption[] newOptions = new Command.LocalOption[options.length + 1];
- System.arraycopy(options, 0, newOptions, 0, options.length);
- newOptions[options.length] = Command.DO_NOT_RECURSE;
- return newOptions;
- }
- };
- try {
- operation.run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore;
- }
- String[] keys = logEntries.getCachedFilePaths();
- Set tags = new HashSet();
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- ILogEntry[] entries = logEntries.getLogEntries(key);
- for (int j = 0; j < entries.length; j++) {
- ILogEntry entry = entries[j];
- tags.addAll(Arrays.asList(entry.getTags()));
- }
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- }
-
- private ICVSRemoteResource asRemoteResource(ICVSFolder folder) throws CVSException {
- if (folder instanceof ICVSRemoteResource) {
- return (ICVSRemoteResource)folder;
- }
- return CVSWorkspaceRoot.getRemoteResourceFor(folder);
- }
-
- /**
- * Fetches tags from auto-refresh files.
- */
- private CVSTag[] fetchTagsUsingAutoRefreshFiles(ICVSFolder folder, IProgressMonitor monitor) throws TeamException {
- String remotePath = getRemotePathFor(folder);
- String[] filesToRefresh = getAutoRefreshFiles(remotePath);
- try {
- monitor.beginTask(null, filesToRefresh.length * 10);
- List tags = new ArrayList();
- for (int i = 0; i < filesToRefresh.length; i++) {
- ICVSRemoteFile file = root.getRemoteFile(filesToRefresh[i], CVSTag.DEFAULT);
- try {
- tags.addAll(Arrays.asList(fetchTags(file, Policy.subMonitorFor(monitor, 5))));
- } catch (TeamException e) {
- IStatus status = e.getStatus();
- boolean doesNotExist = false;
- if (status.getCode() == CVSStatus.SERVER_ERROR && status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- if (children.length == 1 && children[0].getCode() == CVSStatus.DOES_NOT_EXIST) {
- // Don't throw an exception if the file does no exist
- doesNotExist = true;
- }
- }
- if (!doesNotExist) {
- throw e;
- }
- }
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Returns Branch and Version tags for the given files
- */
- private CVSTag[] fetchTags(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException {
- Set tagSet = new HashSet();
- ILogEntry[] entries = file.getLogEntries(monitor);
- for (int j = 0; j < entries.length; j++) {
- CVSTag[] tags = entries[j].getTags();
- for (int k = 0; k < tags.length; k++) {
- tagSet.add(tags[k]);
- }
- }
- return (CVSTag[])tagSet.toArray(new CVSTag[0]);
- }
-
- /*
- * Return the cache key (path) for the given folder path.
- * This has been changed to cache the tags directly
- * with the folder to better support non-root projects.
- * However, resources in the local workspace use the folder
- * the project is mapped to as the tag source (see TagSource)
- */
- private String getCachePathFor(String remotePath) {
- return remotePath;
- }
-
- /**
- * Write out the state of the receiver as XML on the given XMLWriter.
- *
- * @param writer
- * @throws IOException
- */
- public void writeState(XMLWriter writer) {
-
- HashMap attributes = new HashMap();
-
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.ID_ATTRIBUTE, root.getLocation(false));
- if (name != null) {
- attributes.put(RepositoriesViewContentHandler.NAME_ATTRIBUTE, name);
- }
-
- writer.startTag(RepositoriesViewContentHandler.REPOSITORY_TAG, attributes, true);
-
- //put date tag under repository
- if(!dateTags.isEmpty()){
- writer.startTag(RepositoriesViewContentHandler.DATE_TAGS_TAG, attributes, true);
- Iterator iter = dateTags.iterator();
- while(iter.hasNext()){
- CVSTag tag = (CVSTag)iter.next();
- writeATag(writer, attributes, tag, RepositoriesViewContentHandler.DATE_TAG_TAG);
- }
- writer.endTag(RepositoriesViewContentHandler.DATE_TAGS_TAG);
- }
-
- // Gather all the modules that have tags and/or auto-refresh files
- // for each module, write the moduel, tags and auto-refresh files.
- String[] paths = getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- attributes.clear();
- String name = path;
- if (isDefinedModuleName(path)) {
- name = getDefinedModuleName(path);
-
- attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.DEFINED_MODULE_TYPE);
- }
- attributes.put(RepositoriesViewContentHandler.PATH_ATTRIBUTE, name);
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(path);
- boolean writeOutTags = entry != null && !entry.isExpired();
- if (writeOutTags)
- attributes.put(RepositoriesViewContentHandler.LAST_ACCESS_TIME_ATTRIBUTE, Long.toString(entry.lastAccessTime));
- writer.startTag(RepositoriesViewContentHandler.MODULE_TAG, attributes, true);
- if (writeOutTags) {
- Iterator tagIt = entry.tags.iterator();
- while (tagIt.hasNext()) {
- CVSTag tag = (CVSTag)tagIt.next();
- writeATag(writer, attributes, tag, RepositoriesViewContentHandler.TAG_TAG);
- }
- }
- Set refreshSet = (Set)autoRefreshFiles.get(path);
- if (refreshSet != null) {
- Iterator filenameIt = refreshSet.iterator();
- while (filenameIt.hasNext()) {
- String filename = (String)filenameIt.next();
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.FULL_PATH_ATTRIBUTE, filename);
- writer.startAndEndTag(RepositoriesViewContentHandler.AUTO_REFRESH_FILE_TAG, attributes, true);
- }
- }
- writer.endTag(RepositoriesViewContentHandler.MODULE_TAG);
- }
- writer.endTag(RepositoriesViewContentHandler.REPOSITORY_TAG);
- }
-
- private void writeATag(XMLWriter writer, HashMap attributes, CVSTag tag, String s) {
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.NAME_ATTRIBUTE, tag.getName());
- attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.TAG_TYPES[tag.getType()]);
- writer.startAndEndTag(s, attributes, true);
- }
-
- /**
- * Method getKnownTags.
- * @param remotePath
- * @return CVSTag[]
- */
- public CVSTag[] getAllKnownTags(String remotePath) {
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(getCachePathFor(remotePath));
- if(entry != null){
- entry.accessed();
- CVSTag [] tags1 = (CVSTag[]) entry.tags.toArray(new CVSTag[entry.tags.size()]);
- CVSTag[] tags2 = getDateTags();
- int len = tags1.length + tags2.length;
- CVSTag[] tags = new CVSTag[len];
- for(int i = 0; i < len; i++){
- if(i < tags1.length){
- tags[i] = tags1[i];
- }else{
- tags[i] = tags2[i-tags1.length];
- }
- }
- return tags;
- }
- return getDateTags();
- }
-
- public String[] getKnownRemotePaths() {
- Set paths = new HashSet();
- paths.addAll(versionAndBranchTags.keySet());
- paths.addAll(autoRefreshFiles.keySet());
- return (String[]) paths.toArray(new String[paths.size()]);
- }
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (ICVSRepositoryLocation.class.equals(adapter)) return getRoot();
- return super.getAdapter(adapter);
- }
-
- /**
- * Method tagIsKnown.
- * @param remoteResource
- * @return boolean
- */
- public boolean tagIsKnown(ICVSRemoteResource remoteResource) {
- if (remoteResource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder) remoteResource;
- String path = getCachePathFor(folder.getRepositoryRelativePath());
- CVSTag[] tags = getAllKnownTags(path);
- CVSTag tag = folder.getTag();
- for (int i = 0; i < tags.length; i++) {
- CVSTag knownTag = tags[i];
- if (knownTag.equals(tag)) return true;
- }
- }
- return false;
- }
-
- /**
- * This method is invoked whenever the refresh button in the
- * RepositoriesView is pressed.
- */
- void clearCache() {
- synchronized(modulesCacheLock) {
- if (modulesCache != null)
- modulesCache = null;
- }
- }
-
- /**
- * Sets the root.
- * @param root The root to set
- */
- void setRepositoryLocation(ICVSRepositoryLocation root) {
- this.root = root;
- }
-
- /*
- * Set the last access time of the cache entry for the given path
- * as it was read from the persitent store.
- */
- /* package */ void setLastAccessedTime(String remotePath, long lastAccessTime) {
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(getCachePathFor(remotePath));
- if(entry != null){
- entry.lastAccessTime = lastAccessTime;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java
deleted file mode 100644
index 974ead939..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * Superclass of CVS participant action delegates that uses the classname as the key
- * to access the text from the resource bundle
- */
-public class CVSActionDelegateWrapper extends ActionDelegateWrapper {
-
- public CVSActionDelegateWrapper(CVSAction delegate, ISynchronizePageConfiguration configuration, String id) {
- super(delegate, configuration, id);
- Utils.initAction(this, getBundleKeyPrefix(), Policy.getActionBundle());
- }
-
- public CVSActionDelegateWrapper(CVSAction delegate, ISynchronizePageConfiguration configuration) {
- this(delegate, configuration, delegate.getId());
- }
-
- /**
- * Return the key to the action text in the resource bundle.
- * The default is the class name followed by a dot (.).
- * @return the bundle key prefix
- */
- protected String getBundleKeyPrefix() {
- String name = getDelegate().getClass().getName();
- int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
- if (lastDot == -1) {
- return name;
- }
- return name.substring(lastDot + 1) + "."; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
deleted file mode 100644
index 9991117ff..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.team.internal.ui.synchronize.IChangeSetProvider;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * Action group that is used by CVS Change Set Capabilities
- */
-public class CVSChangeSetActionGroup extends SynchronizePageActionGroup {
-
- private OpenChangeSetAction openCommitSet;
-
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- openCommitSet = new OpenChangeSetAction(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- ISynchronizeParticipant participant = getConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- if (((IChangeSetProvider)participant).getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- appendToGroup(
- menu,
- ISynchronizePageConfiguration.FILE_GROUP,
- openCommitSet);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java
deleted file mode 100644
index a3d7433cd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoSetChangeSetCollector;
-import org.eclipse.team.ui.synchronize.*;
-
-
-public class CVSChangeSetCapability extends ChangeSetCapability {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#supportsCheckedInChangeSets()
- */
- public boolean supportsCheckedInChangeSets() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#supportsActiveChangeSets()
- */
- public boolean supportsActiveChangeSets() {
- return getActiveChangeSetManager() != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#createCheckedInChangeSetCollector(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- public SyncInfoSetChangeSetCollector createSyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
- return new CVSChangeSetCollector(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#getActionGroup()
- */
- public SynchronizePageActionGroup getActionGroup() {
- return new CVSChangeSetActionGroup();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#enableChangeSetsByDefault()
- */
- public boolean enableChangeSetsByDefault() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
deleted file mode 100644
index c4133f283..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import com.ibm.icu.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.internal.core.subscribers.*;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoSetChangeSetCollector;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
-
-/**
- * Collector that fetches the log for incoming CVS change sets
- */
-public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector implements LogEntryCacheUpdateHandler.ILogsFetchedListener {
-
- /*
- * Constant used to add the collector to the configuration of a page so
- * it can be accessed by the CVS custom actions
- */
- public static final String CVS_CHECKED_IN_COLLECTOR = CVSUIPlugin.ID + ".CVSCheckedInCollector"; //$NON-NLS-1$
-
- /*
- * Constant used to store the log entry handler in the configuration so it can
- * be kept around over layout changes
- */
- private static final String LOG_ENTRY_HANDLER = CVSUIPlugin.ID + ".LogEntryHandler"; //$NON-NLS-1$
-
- private static final String DEFAULT_INCOMING_SET_NAME = CVSUIMessages.CVSChangeSetCollector_0;
-
- boolean disposed = false;
-
- private LogEntryCache logEntryCache;
-
- /* *****************************************************************************
- * Special sync info that has its kind already calculated.
- */
- public class CVSUpdatableSyncInfo extends CVSSyncInfo {
- public int kind;
- public CVSUpdatableSyncInfo(int kind, IResource local, IResourceVariant base, IResourceVariant remote, Subscriber s) {
- super(local, base, remote, s);
- this.kind = kind;
- }
-
- protected int calculateKind() throws TeamException {
- return kind;
- }
- }
-
- private class DefaultCheckedInChangeSet extends CheckedInChangeSet {
-
- private Date date = new Date();
-
- public DefaultCheckedInChangeSet(String name) {
- setName(name);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor()
- */
- public String getAuthor() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate()
- */
- public Date getDate() {
- return date;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
- */
- public String getComment() {
- return ""; //$NON-NLS-1$
- }
-
- }
-
- private class CVSCheckedInChangeSet extends CheckedInChangeSet {
-
- private final ILogEntry entry;
-
- public CVSCheckedInChangeSet(ILogEntry entry) {
- this.entry = entry;
- Date date = entry.getDate();
- String comment = Util.flattenText(entry.getComment());
- if (date == null) {
- setName("["+entry.getAuthor()+ "] " + comment); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- String dateString = DateFormat.getDateTimeInstance().format(date);
- setName("["+entry.getAuthor()+ "] (" + dateString +") " + comment); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor()
- */
- public String getAuthor() {
- return entry.getAuthor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate()
- */
- public Date getDate() {
- return entry.getDate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
- */
- public String getComment() {
- return entry.getComment();
- }
- }
-
- public CVSChangeSetCollector(ISynchronizePageConfiguration configuration) {
- super(configuration);
- configuration.setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, this);
- }
-
- public synchronized LogEntryCacheUpdateHandler getLogEntryHandler() {
- LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)getConfiguration().getProperty(LOG_ENTRY_HANDLER);
- if (handler == null) {
- handler = initializeLogEntryHandler(getConfiguration());
- }
- handler.setListener(this);
- return handler;
- }
-
- /*
- * Initialize the log entry handler and place it in the configuration
- */
- private LogEntryCacheUpdateHandler initializeLogEntryHandler(final ISynchronizePageConfiguration configuration) {
- final LogEntryCacheUpdateHandler logEntryHandler = new LogEntryCacheUpdateHandler(configuration);
- configuration.setProperty(LOG_ENTRY_HANDLER, logEntryHandler);
- // Use an action group to get notified when the configuration is disposed
- configuration.addActionContribution(new SynchronizePageActionGroup() {
- public void dispose() {
- super.dispose();
- LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)configuration.getProperty(LOG_ENTRY_HANDLER);
- if (handler != null) {
- handler.shutdown();
- configuration.setProperty(LOG_ENTRY_HANDLER, null);
- }
- }
- });
- // It is possible that the configuration has been disposed concurrently by another thread
- // TODO
- return logEntryHandler;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.SyncInfoSetChangeSetCollector#add(org.eclipse.team.core.synchronize.SyncInfo[])
- */
- protected void add(SyncInfo[] infos) {
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null)
- try {
- handler.fetch(infos);
- } catch (CVSException e) {
- getConfiguration().getSyncInfoSet().addError(new TeamStatus(IStatus.ERROR, CVSUIPlugin.ID, 0, e.getMessage(), e, null));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#reset(org.eclipse.team.core.synchronize.SyncInfoSet)
- */
- public void reset(SyncInfoSet seedSet) {
- // Notify that handler to stop any fetches in progress
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- handler.stopFetching();
- }
- super.reset(seedSet);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#dispose()
- */
- public void dispose() {
- // No longer listen for log entry changes
- // (The handler is disposed with the page)
- disposed = true;
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) handler.setListener(null);
- getConfiguration().setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, null);
- logEntryCache = null;
- super.dispose();
- }
-
- /**
- * Fetch the log histories for the remote changes and use this information
- * to add each resource to an appropriate commit set.
- */
- private void handleRemoteChanges(final SyncInfo[] infos, final LogEntryCache logEntries, final IProgressMonitor monitor) {
- performUpdate(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- addLogEntries(infos, logEntries, monitor);
- }
- }, true /* preserver expansion */, monitor);
- }
-
- /*
- * Add the following sync info elements to the viewer. It is assumed that these elements have associated
- * log entries cached in the log operation.
- */
- private void addLogEntries(SyncInfo[] commentInfos, LogEntryCache logs, IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, commentInfos.length * 10);
- if (logs != null) {
- for (int i = 0; i < commentInfos.length; i++) {
- addSyncInfoToCommentNode(commentInfos[i], logs);
- monitor.worked(10);
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * Create a node for the given sync info object. The logs should contain the log for this info.
- *
- * @param info the info for which to create a node in the model
- * @param log the cvs log for this node
- */
- private void addSyncInfoToCommentNode(SyncInfo info, LogEntryCache logs) {
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- ICVSRemoteResource remoteResource = handler.getRemoteResource(info);
- if(handler.getSubscriber() instanceof CVSCompareSubscriber && remoteResource != null) {
- addMultipleRevisions(info, logs, remoteResource);
- } else {
- addSingleRevision(info, logs, remoteResource);
- }
- }
- }
-
- /*
- * Add a single log entry to the model.
- *
- * @param info
- * @param logs
- * @param remoteResource
- */
- private void addSingleRevision(SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) {
- ILogEntry logEntry = logs.getLogEntry(remoteResource);
- if (remoteResource != null && !remoteResource.isFolder()) {
- // For incoming deletions grab the comment for the latest on the same branch
- // which is now in the attic.
- try {
- String remoteRevision = ((ICVSRemoteFile) remoteResource).getRevision();
- if (isDeletedRemotely(info)) {
- ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
- String revision = entry.getRevision();
- if (entry.isDeletion() && ResourceSyncInfo.isLaterRevision(revision, remoteRevision)) {
- logEntry = entry;
- }
- }
- }
- } catch (TeamException e) {
- // continue and skip deletion checks
- }
- }
- addRemoteChange(info, remoteResource, logEntry);
- }
-
- /*
- * Add multiple log entries to the model.
- *
- * @param info
- * @param logs
- * @param remoteResource
- */
- private void addMultipleRevisions(SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) {
- ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- if(logEntries == null || logEntries.length == 0) {
- // If for some reason we don't have a log entry, try the latest
- // remote.
- addRemoteChange(info, null, null);
- } else {
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
- addRemoteChange(info, remoteResource, entry);
- }
- }
- }
-
- private boolean isDeletedRemotely(SyncInfo info) {
- int kind = info.getKind();
- if(kind == (SyncInfo.INCOMING | SyncInfo.DELETION)) return true;
- if(SyncInfo.getDirection(kind) == SyncInfo.CONFLICTING && info.getRemote() == null) return true;
- return false;
- }
-
- /*
- * Add the remote change to an incoming commit set
- */
- private void addRemoteChange(SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) {
- if (disposed) return;
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if(handler != null && remoteResource != null && logEntry != null && handler.isRemoteChange(info)) {
- if(requiresCustomSyncInfo(info, remoteResource, logEntry)) {
- info = new CVSUpdatableSyncInfo(info.getKind(), info.getLocal(), info.getBase(), (RemoteResource)logEntry.getRemoteFile(), ((CVSSyncInfo)info).getSubscriber());
- try {
- info.init();
- } catch (TeamException e) {
- // this shouldn't happen, we've provided our own calculate kind
- }
- }
- // Only add the info if the base and remote differ
- IResourceVariant base = info.getBase();
- IResourceVariant remote = info.getRemote();
- if ((base == null && remote != null) || (remote == null && base != null) || (remote != null && base != null && !base.equals(remote))) {
- synchronized(this) {
- CheckedInChangeSet set = getChangeSetFor(logEntry);
- if (set == null) {
- set = createChangeSetFor(logEntry);
- add(set);
- }
- set.add(info);
- }
- }
- } else {
- // The info was not retrieved for the remote change for some reason.
- // Add the node to the root
- addToDefaultSet(DEFAULT_INCOMING_SET_NAME, info);
- }
- }
-
- private void addToDefaultSet(String name, SyncInfo info) {
- CheckedInChangeSet set;
- synchronized(this) {
- set = getChangeSetFor(name);
- if (set == null) {
- set = createDefaultChangeSet(name);
- add(set);
- }
- set.add(info);
- }
- }
-
- private CheckedInChangeSet createDefaultChangeSet(String name) {
- return new DefaultCheckedInChangeSet(name);
- }
-
- private CheckedInChangeSet createChangeSetFor(ILogEntry logEntry) {
- return new CVSCheckedInChangeSet(logEntry);
- }
-
- private CheckedInChangeSet getChangeSetFor(ILogEntry logEntry) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set instanceof CheckedInChangeSet &&
- set.getComment().equals(logEntry.getComment()) &&
- ((CheckedInChangeSet)set).getAuthor().equals(logEntry.getAuthor())) {
- return (CheckedInChangeSet)set;
- }
- }
- return null;
- }
-
- private CheckedInChangeSet getChangeSetFor(String name) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set.getName().equals(name)) {
- return (CheckedInChangeSet)set;
- }
- }
- return null;
- }
-
- private boolean requiresCustomSyncInfo(SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) {
- // Only interested in non-deletions
- if (logEntry.isDeletion() || !(info instanceof CVSSyncInfo)) return false;
- // Only require a custom sync info if the remote of the sync info
- // differs from the remote in the log entry
- IResourceVariant remote = info.getRemote();
- if (remote == null) return true;
- return !remote.equals(remoteResource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#waitUntilDone(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void waitUntilDone(IProgressMonitor monitor) {
- super.waitUntilDone(monitor);
- monitor.worked(1);
- // wait for the event handler to process changes.
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- while(handler.getEventHandlerJob().getState() != Job.NONE) {
- monitor.worked(1);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- }
- Policy.checkCanceled(monitor);
- }
- }
- monitor.worked(1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.LogEntryCacheUpdateHandler.ILogsFetchedListener#logEntriesFetched(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor) {
- if (disposed) return;
- // Hold on to the cache so we can use it while commit sets are visible
- this.logEntryCache = logEntryCache;
- handleRemoteChanges(set.getSyncInfos(), logEntryCache, monitor);
- }
-
- public ICVSRemoteFile getImmediatePredecessor(ICVSRemoteFile file) throws TeamException {
- if (logEntryCache != null)
- return logEntryCache.getImmediatePredecessor(file);
- return null;
- }
-
- protected void initializeSets() {
- // Nothing to do
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
deleted file mode 100644
index 8233b5c80..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
-import org.eclipse.team.internal.ui.synchronize.IChangeSetProvider;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * Superclass for all CVS particpants (workspace, merge and compare)
- */
-public class CVSParticipant extends SubscriberParticipant implements IChangeSetProvider {
-
- private CVSChangeSetCapability capability;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- // The decorator adds itself to the configuration
- ILabelDecorator labelDecorator = new CVSParticipantLabelDecorator(configuration);
- configuration.addLabelDecorator(labelDecorator);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#updateLabels(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- deriveBaseContentsFromLocal(element, Policy.subMonitorFor(monitor, 10));
- super.prepareCompareInput(element, config, Policy.subMonitorFor(monitor, 80));
- updateLabelsForCVS(element, config, Policy.subMonitorFor(monitor, 10));
- monitor.done();
- }
-
- /**
- * Helper method for updating compare editor labels
- */
- protected static void updateLabelsForCVS(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) {
- // Add the author to the remote or base
- if (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR)) {
- SyncInfo info = getSyncInfo(element);
- if (info != null) {
- final IResourceVariant remote = info.getRemote();
- final IResourceVariant base = info.getBase();
- String remoteAuthor = null;
- if (remote != null && !remote.isContainer()) {
- try {
- ILogEntry entry = ((ICVSRemoteFile)remote).getLogEntry(monitor);
- remoteAuthor = entry.getAuthor();
- config.setRightLabel(NLS.bind(CVSUIMessages.CVSParticipant_0, new String[] { remote.getContentIdentifier(), remoteAuthor }));
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- if (base != null && !base.isContainer()) {
- try {
- String baseAuthor;
- if (remoteAuthor != null && remote.getContentIdentifier().equals(base.getContentIdentifier())) {
- baseAuthor = remoteAuthor;
- } else {
- ILogEntry entry = ((ICVSRemoteFile)base).getLogEntry(monitor);
- baseAuthor = entry.getAuthor();
- }
- config.setAncestorLabel(NLS.bind(CVSUIMessages.CVSParticipant_1, new String[] { base.getContentIdentifier(), baseAuthor }));
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- }
- }
-
- protected static SyncInfo getSyncInfo(ISynchronizeModelElement element) {
- if (element instanceof IAdaptable) {
- return (SyncInfo)((IAdaptable)element).getAdapter(SyncInfo.class);
- }
- return null;
- }
-
- /**
- * If the local is not modified and the base matches the local then
- * cache the local contents as the contents of the base.
- * @param element
- * @throws CoreException
- * @throws TeamException
- */
- public static void deriveBaseContentsFromLocal(ISynchronizeModelElement element, IProgressMonitor monitor) throws TeamException {
- SyncInfo info = getSyncInfo(element);
- if (info == null)
- return;
-
- // We need a base that is a file and a local that is a file
- IResource local = info.getLocal();
- IResourceVariant base = info.getBase();
- if (base == null || base.isContainer() || local.getType() != IResource.FILE || !local.exists())
- return;
-
- // We can only use the local contents for incoming changes.
- // Outgoing or conflicting changes imply that the local has changed
- if ((info.getKind() & SyncInfo.DIRECTION_MASK) != SyncInfo.INCOMING)
- return;
-
- try {
- RemoteFile remoteFile = (RemoteFile)base;
- if (!remoteFile.isContentsCached())
- (remoteFile).setContents((IFile)local, monitor);
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
- // The file must have just been deleted
- return;
- }
- throw CVSException.wrapException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getPreferencePages()
- */
- public PreferencePage[] getPreferencePages() {
- return addCVSPreferencePages(super.getPreferencePages());
- }
-
- public static PreferencePage[] addCVSPreferencePages(PreferencePage[] inheritedPages) {
- PreferencePage[] pages = new PreferencePage[inheritedPages.length + 1];
- for (int i = 0; i < inheritedPages.length; i++) {
- pages[i] = inheritedPages[i];
- }
- pages[pages.length - 1] = new ComparePreferencePage();
- pages[pages.length - 1].setTitle(CVSUIMessages.CVSParticipant_2);
- return pages;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getChangeSetCapability()
- */
- public ChangeSetCapability getChangeSetCapability() {
- if (capability == null) {
- capability = createChangeSetCapability();
- }
- return capability;
- }
-
- /**
- * Create the change set capability for this particpant.
- * @return the created capability
- */
- protected CVSChangeSetCapability createChangeSetCapability() {
- return new CVSChangeSetCapability();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#isViewerContributionsSupported()
- */
- protected boolean isViewerContributionsSupported() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java
deleted file mode 100644
index fdf6ad5c9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
-
-/**
- * Superclass of CVS participant actions that uses the classname as the key
- * to access the text from the resource bundle
- */
-public abstract class CVSParticipantAction extends SynchronizeModelAction {
-
- protected CVSParticipantAction(ISynchronizePageConfiguration configuration) {
- super(null, configuration);
- Utils.initAction(this, getBundleKeyPrefix(), Policy.getActionBundle());
- }
-
- protected CVSParticipantAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(null, configuration, provider);
- Utils.initAction(this, bundleKey, Policy.getActionBundle());
- }
-
- /**
- * Return the key to the action text in the resource bundle.
- * The default is the class name followed by a dot (.).
- * @return the bundle key prefix
- */
- protected String getBundleKeyPrefix() {
- String name = getClass().getName();
- int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
- if (lastDot == -1) {
- return name;
- }
- return name.substring(lastDot + 1) + "."; //$NON-NLS-1$
- }
-
- protected boolean needsToSaveDirtyEditors() {
- int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- return option != ICVSUIConstants.OPTION_NEVER;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#confirmSaveOfDirtyEditor()
- */
- protected boolean confirmSaveOfDirtyEditor() {
- int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- return option == ICVSUIConstants.OPTION_PROMPT;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java
deleted file mode 100644
index 0a769cb20..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberMergeContext;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.mapping.ChangeSetModelProvider;
-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.*;
-import org.eclipse.team.internal.ccvs.ui.mappings.ModelCompareParticipant;
-import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;
-import org.eclipse.team.internal.core.subscribers.DiffChangeSet;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.mapping.SynchronizationStateTester;
-import org.eclipse.team.ui.synchronize.*;
-
-
-public class CVSParticipantLabelDecorator extends LabelProvider implements IPropertyChangeListener, ILabelDecorator {
- private ISynchronizePageConfiguration configuration;
- private SynchronizationStateTester tester = new SynchronizationStateTester() {
- public int getState(Object element, int stateMask, IProgressMonitor monitor) throws CoreException {
- // Disable state decoration
- return IDiff.NO_CHANGE;
- }
- };
-
- public CVSParticipantLabelDecorator(ISynchronizePageConfiguration configuration) {
- this.configuration = configuration;
- // Listen for decorator changed to refresh the viewer's labels.
- CVSUIPlugin.addPropertyChangeListener(this);
- TeamUI.addPropertyChangeListener(this);
- }
-
- public String decorateText(String input, Object elementOrPath) {
- if (!isEnabledFor(elementOrPath))
- return input;
- try {
- String text = input;
- IResource resource = getResource(elementOrPath);
- if (resource != null && resource.getType() != IResource.ROOT) {
- // Prepare the decoration but substitute revision and hide dirty indicator
- CVSDecoration decoration = getDecoration(resource);
- decoration.setRevision(getRevisionNumber(elementOrPath));
- decoration.compute();
- // Update label
- StringBuffer output = new StringBuffer(25);
- if (decoration.getPrefix() != null) {
- output.append(decoration.getPrefix());
- }
- output.append(text);
- if (decoration.getSuffix() != null) {
- output.append(decoration.getSuffix());
- }
- return output.toString();
- }
- return text;
- } catch (CoreException e) {
- return input;
- }
- }
-
- protected IResource getResource(Object element) {
- if (element instanceof ISynchronizeModelElement)
- return ((ISynchronizeModelElement) element).getResource();
- return Utils.getResource(internalGetElement(element));
- }
-
- protected CVSDecoration getDecoration(IResource resource) throws CoreException {
- return CVSLightweightDecorator.decorate(resource, tester);
- }
-
- public Image decorateImage(Image base, Object element) {
- return base;
- }
- public void propertyChange(PropertyChangeEvent event) {
- if (needsRefresh(event)) {
- Viewer viewer = configuration.getPage().getViewer();
- if(viewer instanceof StructuredViewer && !viewer.getControl().isDisposed()) {
- ((StructuredViewer)viewer).refresh(true);
- }
- }
- }
-
- protected boolean needsRefresh(PropertyChangeEvent event) {
- final String property= event.getProperty();
- return property.equals(CVSUIPlugin.P_DECORATORS_CHANGED) || property.equals(TeamUI.GLOBAL_FILE_TYPES_CHANGED);
- }
- public void dispose() {
- CVSUIPlugin.removePropertyChangeListener(this);
- TeamUI.removePropertyChangeListener(this);
- }
-
- protected String getRevisionNumber(Object elementOrPath) {
- IResource resource = getResource(elementOrPath);
- if (resource != null && resource.getType() == IResource.FILE) {
- IResourceVariant local;
- try {
- local = (IResourceVariant) CVSWorkspaceRoot.getRemoteResourceFor(resource);
- } catch (CVSException e) {
- local = null;
- }
- if(local == null) {
- local = getBase(elementOrPath);
- }
- String localRevision = getRevisionString(local);
- StringBuffer revisionString = new StringBuffer();
- IResourceVariant remote = getRemote(elementOrPath);
- String remoteRevision = getRevisionString(remote);
- if(localRevision != null) {
- revisionString.append(localRevision);
- }
- if(remoteRevision != null) {
- revisionString.append( (localRevision != null ? " - " : "") + remoteRevision); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return revisionString.toString();
- }
- return null;
- }
-
- private boolean isEnabledFor(Object elementOrPath) {
- return !isCompareWithChangeSets() || elementOrPath instanceof TreePath;
- }
-
- private boolean isCompareWithChangeSets() {
- String id = (String)configuration.getProperty(ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER);
- return configuration.getParticipant() instanceof ModelCompareParticipant && id.equals(ChangeSetModelProvider.ID);
- }
-
- private SyncInfo getSyncInfo(Object element) {
- if (element instanceof SyncInfoModelElement) {
- SyncInfoModelElement sime = (SyncInfoModelElement) element;
- return sime.getSyncInfo();
- }
- IResource resource = getResource(element);
- if (resource != null) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof ModelSynchronizeParticipant) {
- ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant) participant;
- ISynchronizationContext context = msp.getContext();
- if (context instanceof SubscriberMergeContext) {
- SubscriberMergeContext smc = (SubscriberMergeContext) context;
- Subscriber subscriber = smc.getSubscriber();
- try {
- return subscriber.getSyncInfo(resource);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- }
- return null;
- }
-
- private IResourceVariant getBase(Object element) {
- if (element instanceof TreePath) {
- TreePath tp = (TreePath) element;
- IDiff diff = getDiff(tp);
- IFileRevision revision = Utils.getBase(diff);
- return SyncInfoToDiffConverter.asResourceVariant(revision);
- }
- SyncInfo info = getSyncInfo(element);
- if (info != null)
- return info.getBase();
- return null;
- }
-
- private IResourceVariant getRemote(Object element) {
- if (element instanceof TreePath) {
- TreePath tp = (TreePath) element;
- IDiff diff = getDiff(tp);
- IFileRevision revision = Utils.getRemote(diff);
- return SyncInfoToDiffConverter.asResourceVariant(revision);
- }
- SyncInfo info = getSyncInfo(element);
- if (info != null)
- return info.getRemote();
- return null;
- }
-
- private IDiff getDiff(TreePath tp) {
- Object first = tp.getFirstSegment();
- Object last = tp.getLastSegment();
- IResource resource = Utils.getResource(last);
- if (first instanceof DiffChangeSet && resource != null) {
- DiffChangeSet dcs = (DiffChangeSet) first;
- return dcs.getDiffTree().getDiff(resource);
- }
- return null;
- }
-
- private String getRevisionString(IResourceVariant remoteFile) {
- if(remoteFile instanceof RemoteFile) {
- return ((RemoteFile)remoteFile).getRevision();
- }
- return null;
- }
-
- private Object internalGetElement(Object elementOrPath) {
- if (elementOrPath instanceof TreePath) {
- TreePath tp = (TreePath) elementOrPath;
- return tp.getLastSegment();
- }
- return elementOrPath;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
deleted file mode 100644
index b40e43a4e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.PruneFolderVisitor;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
-
- protected CVSSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- // Divide the sync info by project
- final Map projectSyncInfos = getProjectSyncInfoSetMap();
- monitor.beginTask(null, projectSyncInfos.size() * 100);
- for (Iterator iter = projectSyncInfos.keySet().iterator(); iter.hasNext(); ) {
- final IProject project = (IProject) iter.next();
- run(projectSyncInfos, project, monitor);
- }
- monitor.done();
- }
-
- /**
- * Run the operation for the sync infos from the given project. By default, a lock
- * is acquired on the project.
- * @param projectSyncInfos the project syncInfos
- * @param project the project
- * @param monitor a progress monitor
- * @throws InvocationTargetException
- */
- protected void run(final Map projectSyncInfos, final IProject project, IProgressMonitor monitor) throws InvocationTargetException {
- try {
- // Pass the scheduling rule to the synchronizer so that sync change events
- // and cache commits to disk are batched
- EclipseSynchronizer.getInstance().run(
- project,
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- CVSSubscriberOperation.this.runWithProjectRule(project, (SyncInfoSet)projectSyncInfos.get(project), monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
- }, Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /**
- * Run the operation on the sync info in the given set. The sync info will be all
- * from the same project. Also, a scheduling rule on the project will be
- * held when this method is invoked.
- * @param project the project that contaisn the sync info.
- * @param set the sync info set
- * @param monitor a progress monitor
- */
- protected abstract void runWithProjectRule(IProject project, SyncInfoSet set, IProgressMonitor monitor) throws TeamException;
-
- /*
- * Indicate that the resource is out of sync if the sync state is not IN_SYNC
- * or if the local doesn't exist but the remote does.
- */
- protected boolean isOutOfSync(SyncInfo resource) {
- if (resource == null) return false;
- return (!(resource.getKind() == 0) ||
- (! resource.getLocal().exists() && resource.getRemote() != null));
- }
-
- protected void makeInSync(SyncInfo[] folders, IProgressMonitor monitor) throws TeamException {
- // If a node has a parent that is an incoming folder creation, we have to
- // create that folder locally and set its sync info before we can get the
- // node itself. We must do this for all incoming folder creations (recursively)
- // in the case where there are multiple levels of incoming folder creations.
- monitor.beginTask(null, folders.length);
- for (int i = 0; i < folders.length; i++) {
- SyncInfo resource = folders[i];
- makeInSync(resource);
- monitor.worked(1);
- }
- monitor.done();
- }
-
- protected boolean makeInSync(SyncInfo info) throws TeamException {
- if (isOutOfSync(info)) {
- SyncInfo parent = getParent(info);
- if (parent == null) {
- if (info.getLocal().getType() == IResource.ROOT) {
- // ROOT should be null
- return true;
- } else {
- // No other ancestors should be null. Log the problem.
- CVSUIPlugin.log(IStatus.WARNING, NLS.bind(CVSUIMessages.CVSSubscriberAction_0, new String[] { info.getLocal().getFullPath().toString() }), null);
- return false;
- }
- } else {
- if (!makeInSync(parent)) {
- // The failed makeInSync will log any errors
- return false;
- }
- }
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo= (CVSSyncInfo) info;
- IStatus status = cvsInfo.makeInSync();
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- return true;
- }
- return false;
- } else {
- return true;
- }
- }
-
- protected void makeOutgoing(SyncInfo[] folders, IProgressMonitor monitor) throws TeamException {
- // If a node has a parent that is an incoming folder creation, we have to
- // create that folder locally and set its sync info before we can get the
- // node itself. We must do this for all incoming folder creations (recursively)
- // in the case where there are multiple levels of incoming folder creations.
- monitor.beginTask(null, 100 * folders.length);
- for (int i = 0; i < folders.length; i++) {
- SyncInfo info = folders[i];
- makeOutgoing(info, Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- }
-
- private void makeOutgoing(SyncInfo info, IProgressMonitor monitor) throws TeamException {
- if (info == null) return;
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo= (CVSSyncInfo) info;
- IStatus status = cvsInfo.makeOutgoing(monitor);
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- }
- }
- }
-
- /**
- * Log an error associated with an operation.
- * @param status
- */
- protected void logError(IStatus status) {
- CVSUIPlugin.log(status);
- }
-
- /**
- * Handle the exception by showing an error dialog to the user.
- * Sync actions seem to need to be sync-execed to work
- * @param t
- */
- protected void handle(Exception t) {
- CVSUIPlugin.openError(getShell(), getErrorTitle(), null, t, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
-
- /**
- * Return the error title that will appear in any error dialogs shown to the user
- * @return
- */
- protected String getErrorTitle() {
- return null;
- }
-
- protected boolean canRunAsJob() {
- return true;
- }
-
- protected void pruneEmptyParents(SyncInfo[] nodes) throws CVSException {
- // TODO: A more explicit tie in to the pruning mechanism would be prefereable.
- // i.e. I don't like referencing the option and visitor directly
- if (!CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) return;
- ICVSResource[] cvsResources = new ICVSResource[nodes.length];
- for (int i = 0; i < cvsResources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(nodes[i].getLocal());
- }
- new PruneFolderVisitor().visit(
- CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()),
- cvsResources);
- }
-
- public CVSSyncInfo getCVSSyncInfo(SyncInfo info) {
- if (info instanceof CVSSyncInfo) {
- return (CVSSyncInfo)info;
- }
- return null;
- }
-
- protected SyncInfo getParent(SyncInfo info) throws TeamException {
- return ((CVSSyncInfo)info).getSubscriber().getSyncInfo(info.getLocal().getParent());
- }
-
- protected IResource[] getIResourcesFrom(SyncInfo[] nodes) {
- List resources = new ArrayList(nodes.length);
- for (int i = 0; i < nodes.length; i++) {
- resources.add(nodes[i].getLocal());
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- /**
- * Prompt to overwrite those resources that could not be safely updated
- * Note: This method is designed to be overridden by test cases.
- *
- * @return whether to perform the overwrite
- */
- protected boolean promptForOverwrite(final SyncInfoSet syncSet) {
- final int[] result = new int[] {Window.CANCEL};
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- UpdateDialog dialog = new UpdateDialog(getShell(), syncSet);
- result[0] = dialog.open();
- }
- });
- return (result[0] == UpdateDialog.YES);
- }
-
- /**
- * Make the contents of the local resource match that of the remote
- * without modifying the sync info of the local resource.
- * If called on a new folder, the sync info will be copied.
- */
- protected void makeRemoteLocal(SyncInfo info, IProgressMonitor monitor) throws TeamException {
- IResourceVariant remote = info.getRemote();
- IResource local = info.getLocal();
- try {
- if(remote==null) {
- if (local.exists()) {
- local.delete(IResource.KEEP_HISTORY, monitor);
- }
- } else {
- if(remote.isContainer()) {
- ensureContainerExists(info);
- } else {
- monitor.beginTask(null, 200);
- try {
- IFile localFile = (IFile)local;
- if(local.exists()) {
- localFile.setContents(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
- } else {
- ensureContainerExists(getParent(info));
- localFile.create(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
- }
- } catch(CoreException e) {
- IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, CVSUIMessages.UpdateMergeActionProblems_merging_remote_resources_into_workspace_1,e, local);
- throw new CVSException(status);
- }
- }
-
- private boolean ensureContainerExists(SyncInfo info) throws TeamException {
- IResource local = info.getLocal();
- // make sure that the parent exists
- if (!local.exists()) {
- if (!ensureContainerExists(getParent(info))) {
- return false;
- }
- }
- // make sure that the folder sync info is set;
- if (isOutOfSync(info)) {
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo)info;
- IStatus status = cvsInfo.makeInSync();
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- }
- }
- // create the folder if it doesn't exist
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
- if (!cvsFolder.exists()) {
- cvsFolder.mkdir();
- }
- return true;
- }
-
- /*
- * Divide the sync info for the operation by project
- */
- private Map getProjectSyncInfoSetMap() {
- Map map = new HashMap();
- SyncInfoSet all = getSyncInfoSet();
- SyncInfo[] infos = all.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IProject project = info.getLocal().getProject();
- SyncInfoSet set = (SyncInfoSet)map.get(project);
- if (set == null) {
- set = new SyncInfoSet();
- map.put(project, set);
- }
- set.add(info);
- }
- return map;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
deleted file mode 100644
index 256ce17fa..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak (brockj@tpg.com.au) - Bug 77944 [Change Sets] Comment dialog: Use comment as title
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Dialog for creating and editing commit set
- * title and comment
- */
-public class CommitSetDialog extends TitleAreaDialog {
-
- public final static short NEW = 0;
- public final static short EDIT = 1;
-
- private static final int DEFAULT_WIDTH_IN_CHARS= 80;
-
- private final ActiveChangeSet set;
- private CommitCommentArea commitCommentArea;
- private Text nameText;
- private Button customTitleButton;
- private final String title;
- private final String description;
- private String comment;
- private short mode;
- protected String customTitle;
-
- public CommitSetDialog(Shell parentShell, ActiveChangeSet set, IResource[] files, short mode) {
- super(parentShell);
- this.set = set;
- this.mode = mode;
- this.title = mode == NEW ? CVSUIMessages.WorkspaceChangeSetCapability_2
- : CVSUIMessages.WorkspaceChangeSetCapability_7;
- this.description = mode == NEW ? CVSUIMessages.WorkspaceChangeSetCapability_3
- : CVSUIMessages.WorkspaceChangeSetCapability_8;
-
- if (files == null) {
- files = set.getResources();
- }
-
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.RESIZE | SWT.MAX);
- commitCommentArea = new CommitCommentArea();
- // Get a project from which the commit template can be obtained
- if (files.length > 0)
- commitCommentArea.setProject(files[0].getProject());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TitleAreaDialog#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Control contents = super.createContents(parent);
- setTitle(title);
- setMessage(description);
- return contents;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite parentComposite = (Composite) super.createDialogArea(parent);
-
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parentComposite, 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(parentComposite.getFont());
-
- if (hasCommitTemplate()) {
- if (set.hasComment()) {
- // Only set the comment if the set has a custom comment.
- // Otherwise, the template should be used
- comment = set.getComment();
- commitCommentArea.setProposedComment(comment);
- }
- } else {
- comment = set.getComment();
- commitCommentArea.setProposedComment(comment);
- }
-
- commitCommentArea.createArea(composite);
- commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == CommitCommentArea.OK_REQUESTED) {
- okPressed();
- } else if (event.getProperty() == CommitCommentArea.COMMENT_MODIFIED) {
- comment = (String)event.getNewValue();
- if (!customTitleButton.getSelection()) {
- nameText.setText(commitCommentArea.getFirstLineOfComment());
- }
- updateEnablements();
- }
- }
- });
-
- createOptionsArea(composite);
- createNameArea(composite);
-
- initializeValues();
- updateEnablements();
-
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#getInitialSize()
- */
- protected Point getInitialSize() {
- final Point size= super.getInitialSize();
- size.x= convertWidthInCharsToPixels(DEFAULT_WIDTH_IN_CHARS);
- size.y += convertHeightInCharsToPixels(8);
- return size;
- }
-
- private void createNameArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(parent.getFont());
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(CVSUIMessages.CommitSetDialog_0);
- label.setLayoutData(new GridData(GridData.BEGINNING));
-
- nameText = new Text(composite, SWT.BORDER);
- nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- nameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- customTitle = nameText.getText();
- updateEnablements();
- }
- });
- }
-
- private void initializeValues() {
- String initialText = set.getTitle();
- if (initialText == null) initialText = ""; //$NON-NLS-1$
- nameText.setText(initialText);
- nameText.setSelection(0, initialText.length());
-
- if (customTitleButton != null) {
- customTitleButton.setSelection(!commitCommentArea.getFirstLineOfComment().equals(initialText));
- }
- }
-
- private void createOptionsArea(Composite composite) {
- Composite radioArea = new Composite(composite, SWT.NONE);
- RowLayout radioAreaLayout = new RowLayout(SWT.VERTICAL);
- radioAreaLayout.marginLeft = 0;
- radioAreaLayout.marginRight = 0;
- radioAreaLayout.marginTop = 0;
- radioAreaLayout.marginBottom = 0;
- radioArea.setLayout(radioAreaLayout);
-
- customTitleButton = createCheckButton(radioArea, CVSUIMessages.CommitSetDialog_2);
- SelectionAdapter listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (customTitleButton.getSelection()) {
- nameText.setText(customTitle);
- } else {
- nameText.setText(commitCommentArea.getFirstLineOfComment());
- }
- updateEnablements();
- }
- };
- customTitleButton.addSelectionListener(listener);
-
- }
-
- private Button createCheckButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.CHECK);
- button.setText(label);
- return button;
- }
-
- private void updateEnablements() {
- setErrorMessage(null);
- String name;
-
- nameText.setEnabled(customTitleButton.getSelection());
-
- if (customTitleButton.getSelection()) {
- name = customTitle;
- } else {
- name = commitCommentArea.getFirstLineOfComment();
- }
-
- if (name.length() == 0) {
- setPageComplete(false);
- return;
- }
-
- // check if the new change set already exists
- if (mode == NEW
- && CVSUIPlugin.getPlugin().getChangeSetManager().getSet(name) != null) {
- setPageComplete(false);
- setErrorMessage(CVSUIMessages.WorkspaceChangeSetCapability_9);
- return;
- }
-
- // check if the edited change set already exists, do not display the
- // error message when new the name is the same as the old one
- if (mode == EDIT && !name.equals(set.getName())
- && CVSUIPlugin.getPlugin().getChangeSetManager().getSet(name) != null) {
- setPageComplete(false);
- setErrorMessage(CVSUIMessages.WorkspaceChangeSetCapability_9);
- return;
- }
-
-
- setPageComplete(true);
- }
-
- final protected void setPageComplete(boolean complete) {
- Button okButton = getButton(IDialogConstants.OK_ID);
- if(okButton != null ) {
- okButton.setEnabled(complete);
- }
- }
-
- private boolean hasCommitTemplate() {
- return commitCommentArea.hasCommitTemplate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- String title = null;
- if (customTitleButton.getSelection()) {
- title= customTitle;
- } else {
- title= commitCommentArea.getFirstLineOfComment();
- }
-
- set.setTitle(title);
- // Call getComment so the comment gets saved
- set.setComment(commitCommentArea.getComment(true));
-
- super.okPressed();
- }
-
-
- protected Label createWrappingLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalIndent = 0;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = 200;
- label.setLayoutData(data);
- return label;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected Control createButtonBar(Composite parent) {
- Control control = super.createButtonBar(parent);
- updateEnablements();
- return control;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(title);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IHelpContextIds.COMMIT_SET_DIALOG);
-
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
deleted file mode 100644
index 13f425e0d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.Arrays;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-
-public class CompareParticipant extends CVSParticipant implements IPropertyChangeListener {
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_1"; //$NON-NLS-1$
- public static final String NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_2"; //$NON-NLS-1$
-
- /**
- * Actions for the compare particpant's toolbar
- */
- public class CompareParticipantActionContribution extends SynchronizePageActionGroup {
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CompareRevertAction(configuration));
-
- if (!configuration.getSite().isModal()) {
- ShowAnnotationAction showAnnotationAction = new ShowAnnotationAction();
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(showAnnotationAction, configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- }
- }
- }
-
- private SyncInfoFilter contentComparison = new SyncInfoFilter() {
- private SyncInfoFilter contentCompare = new SyncInfoFilter.ContentComparisonSyncInfoFilter();
- public boolean select(SyncInfo info, IProgressMonitor monitor) {
- // Want to select infos whose contents do not match
- return !contentCompare.select(info, monitor);
- }
- };
-
- public CompareParticipant(CVSCompareSubscriber subscriber) {
- setSubscriber(subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.Subscriber)
- */
- protected void setSubscriber(Subscriber subscriber) {
- super.setSubscriber(subscriber);
- if (CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) {
- setSyncInfoFilter(contentComparison);
- }
- try {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(CVSCompareSubscriber.ID);
- setInitializationData(descriptor);
- CVSCompareSubscriber s = getCVSCompareSubscriber();
- setSecondaryId(s.getId().getLocalName());
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- CVSUIPlugin.getPlugin().getPluginPreferences().addPropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getName()
- */
- public String getName() {
- return NLS.bind(CVSUIMessages.CompareParticipant_0, new String[] { getSubscriber().getName(), Utils.convertSelection(getSubscriber().roots()) });
- }
-
- /*
- * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
- */
- public static CompareParticipant getMatchingParticipant(IResource[] resources, CVSTag tag) {
- ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference reference = refs[i];
- if (reference.getId().equals(CVSCompareSubscriber.ID)) {
- try {
- CompareParticipant p = (CompareParticipant) reference.getParticipant();
- if (p.matches(resources, tag)) {
- return p;
- }
- } catch (TeamException e) {
- continue;
- }
- }
- }
- return null;
- }
-
- /**
- * Return whether this compare subscriber matches persisly the
- * provided list of resources and the single tag.
- * @param resources the resources
- * @param tag the tag
- * @return whether this compare subscriber matches persisly the
- * provided list of resources and the single tag
- */
- protected boolean matches(IResource[] resources, CVSTag tag) {
- CVSTag existingTag = getCVSCompareSubscriber().getTag();
- // The tag can be null if the compare participant has a different tag for each root
- if (existingTag != null) {
- IResource[] roots = getResources();
- Arrays.sort(resources, Utils.resourceComparator);
- Arrays.sort(roots, Utils.resourceComparator);
- if (Arrays.equals(resources, roots) && existingTag.equals(tag)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return the subscriber as an instance of CVSCompareSubscriber.
- * @return the subscriber as an instance of CVSCompareSubscriber
- */
- public CVSCompareSubscriber getCVSCompareSubscriber() {
- return (CVSCompareSubscriber)getSubscriber();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.addActionContribution(new CompareParticipantActionContribution());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#dispose()
- */
- public void dispose() {
- super.dispose();
- CVSUIPlugin.getPlugin().getPluginPreferences().removePropertyChangeListener(this);
- getCVSCompareSubscriber().dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) {
- if (CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) {
- setSyncInfoFilter(contentComparison);
- } else {
- setSyncInfoFilter(new FastSyncInfoFilter());
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getLongTaskName()
- */
- protected String getLongTaskName() {
- return getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getShortTaskName()
- */
- protected String getShortTaskName() {
- return CVSUIMessages.Participant_comparing;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipant#createChangeSetCapability()
- */
- protected CVSChangeSetCapability createChangeSetCapability() {
- return new CVSChangeSetCapability() {
- public ActiveChangeSetManager getActiveChangeSetManager() {
- return CVSUIPlugin.getPlugin().getChangeSetManager();
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#enableActiveChangeSetsFor(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return super.enableActiveChangeSetsFor(configuration) ||
- configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY;
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
deleted file mode 100644
index 39ed35d6d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-/**
- * Action in compare editor that reverts the local contents to match the contents on the server.
- */
-public class CompareRevertAction extends CVSParticipantAction {
-
- public CompareRevertAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new CompareRevertOperation(configuration, elements);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java
deleted file mode 100644
index 7de9e198b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-
-public class CompareRevertOperation extends CVSSubscriberOperation {
- protected CompareRevertOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName()
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return NLS.bind(CVSUIMessages.CompareRevertAction_0, new String[] { new Integer(syncSet.size()).toString() });
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#run(org.eclipse.team.core.subscribers.MutableSyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runWithProjectRule(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- SyncInfo[] changed = syncSet.getSyncInfos();
- if (changed.length == 0) return;
-
- if(! promptForOverwrite(syncSet)) return;
-
- // The list of sync resources to be updated using "cvs update"
- List updateShallow = new ArrayList();
- // A list of sync resource folders which need to be created locally
- // (incoming addition or previously pruned)
- Set parentCreationElements = new HashSet();
-
- for (int i = 0; i < changed.length; i++) {
- SyncInfo changedNode = changed[i];
-
- // Make sure that parent folders exist
- SyncInfo parent = getParent(changedNode);
- if (parent != null && isOutOfSync(parent)) {
- // We need to ensure that parents that are either incoming folder additions
- // or previously pruned folders are recreated.
- parentCreationElements.add(parent);
- }
-
- IResource resource = changedNode.getLocal();
- if (resource.getType() == IResource.FILE) {
- if (changedNode.getLocal().exists()) {
- updateShallow.add(changedNode);
- } else if (changedNode.getRemote() != null) {
- updateShallow.add(changedNode);
- }
- } else {
- // Special handling for folders to support shallow operations on files
- // (i.e. folder operations are performed using the sync info already
- // contained in the sync info.
- if (isOutOfSync(changedNode)) {
- parentCreationElements.add(changedNode);
- }
- }
-
- }
- try {
- monitor.beginTask(null, 100);
-
- if (parentCreationElements.size() > 0) {
- makeInSync((SyncInfo[]) parentCreationElements.toArray(new SyncInfo[parentCreationElements.size()]), Policy.subMonitorFor(monitor, 25));
- }
- if (updateShallow.size() > 0) {
- runUpdate((SyncInfo[])updateShallow.toArray(new SyncInfo[updateShallow.size()]), Policy.subMonitorFor(monitor, 75));
- }
- } finally {
- monitor.done();
- }
- return;
- }
-
- private void runUpdate(SyncInfo[] infos, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100 * infos.length);
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- makeRemoteLocal(info, Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java
deleted file mode 100644
index 590184197..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class ConfirmMergedAction extends CVSParticipantAction {
-
- public ConfirmMergedAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new ConfirmMergedOperation(configuration, elements);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java
deleted file mode 100644
index 08dd7cdb1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This action marks the local resource as merged by updating the base
- * resource revision to match the remote resource revision
- */
-public class ConfirmMergedOperation extends CVSSubscriberOperation {
-
- public ConfirmMergedOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return NLS.bind(CVSUIMessages.SubscriberConfirmMergedAction_jobName, new String[] { new Integer(syncSet.size()).toString() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runWithProjectRule(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws CVSException {
- SyncInfo[] syncResources = syncSet.getSyncInfos();
- monitor.beginTask(null, 100 * syncResources.length);
- try {
- for (int i = 0; i < syncResources.length; i++) {
- SyncInfo info = syncResources[i];
- if (!makeOutgoing(info, Policy.subMonitorFor(monitor, 100))) {
- // Failure was logged in makeOutgoing
- }
- }
- } catch (TeamException e) {
- handle(e);
- } finally {
- monitor.done();
- }
- }
-
- private boolean makeOutgoing(SyncInfo info, IProgressMonitor monitor) throws CVSException, TeamException {
- monitor.beginTask(null, 100);
- try {
- CVSSyncInfo cvsInfo = getCVSSyncInfo(info);
- if (cvsInfo == null) {
- CVSUIPlugin.log(IStatus.ERROR, NLS.bind(CVSUIMessages.SubscriberConfirmMergedAction_0, new String[] { info.getLocal().getFullPath().toString() }), null);
- return false;
- }
- // Make sure the parent is managed
- ICVSFolder parent = CVSWorkspaceRoot.getCVSFolderFor(cvsInfo.getLocal().getParent());
- if (!parent.isCVSFolder()) {
- // the parents must be made outgoing before the child can
- SyncInfo parentInfo = cvsInfo.getSubscriber().getSyncInfo(parent.getIResource());
- if (!makeOutgoing(parentInfo, Policy.subMonitorFor(monitor, 20))) {
- return false;
- }
- }
- IStatus status = cvsInfo.makeOutgoing(Policy.subMonitorFor(monitor, 80));
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- return true;
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchAction.java
deleted file mode 100644
index e71d22552..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class CreatePatchAction extends CVSParticipantAction {
-
- protected CreatePatchAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING});
- }
-
- public void runOperation() {
- final SyncInfoSet set = getSyncInfoSet();
- GenerateDiffFileWizard.run(getConfiguration().getSite().getPart(), set.getResources(), false);
- }
-
- /*
- * Return the selected SyncInfo for which this action is enabled.
- *
- * @return the selected SyncInfo for which this action is enabled.
- */
- private SyncInfoSet getSyncInfoSet() {
- IDiffElement [] elements= getFilteredDiffElements();
- SyncInfoSet filtered = new SyncInfoSet();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement e = elements[i];
- if (e instanceof SyncInfoModelElement) {
- filtered.add(((SyncInfoModelElement)e).getSyncInfo());
- }
- }
- return filtered;
- }
-
- protected String getBundleKeyPrefix() {
- return "GenerateDiffFileAction."; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchWizardParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchWizardParticipant.java
deleted file mode 100644
index 03ee142ed..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchWizardParticipant.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
-import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeScope;
-
-public class CreatePatchWizardParticipant extends WorkspaceSynchronizeParticipant {
-
- final GenerateDiffFileWizard fWizard;
-
- public CreatePatchWizardParticipant(ISynchronizeScope scope, GenerateDiffFileWizard wizard) {
- super(scope);
- fWizard= wizard;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration( ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ISynchronizePageConfiguration.LAYOUT_GROUP});
- configuration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU);
- ((SynchronizePageConfiguration)configuration).setViewerStyle(SynchronizePageConfiguration.CHECKBOX);
- configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE);
- configuration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#doesSupportSynchronize()
- */
- public boolean doesSupportSynchronize() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
deleted file mode 100644
index ff7d93bb2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
+++ /dev/null
@@ -1,691 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.ref.SoftReference;
-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.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.mappings.ModelCompareParticipant;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.internal.core.BackgroundEventHandler;
-import org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * This class wraps a LogEntryCache in order to clear entries once they are no longer
- * in the subscriber.
- */
-public class LogEntryCacheUpdateHandler extends BackgroundEventHandler {
-
- private static final int REMOVAL = 1;
- private static final int CHANGE = 2;
- private static final int FETCH_REQUEST = 3;
- private static final int PAUSE = 4;
-
- /*
- * Lock used to ensure that fetches are queued when the job is
- * a non-system job.
- */
- private final Object queueLock = new Object();
-
- /*
- * Exception used to stop processing so the job can be restarted as a non-system job
- */
- private static final OperationCanceledException PAUSE_EXCEPTION = new OperationCanceledException();
-
- /*
- * Contants for configuring how long to wait for the job to be paused
- * when a fetch is required and the job needs to be converted to a non-system
- * job. If the wait time is elapsed, an exception is thrown.
- */
- private static final int WAIT_INCREMENT = 10;
- private static final int MAX_WAIT = 1000;
-
- /*
- * Set that keeps track of all resource for which we haved fetched log entries
- */
- private final SyncInfoTree collectedInfos = new SyncInfoTree();
-
- /*
- * The cache that hold the log entries while the job is running
- */
- //private LogEntryCache logEntriesCache;
-
- /*
- * SoftReference used to hold on to the log entry cache while
- * the job is not running so the cache can be cleared if memory is low.
- */
- private SoftReference cacheReference;
-
- /*
- * Collector that forewards subscriber changes so that
- * stale cache entries can be cleared.
- */
- private final LogEntryResourceCollector collector;
-
- /*
- * The subscriber generating the SyncInfo and log entries
- */
- private final Subscriber subscriber;
-
- /*
- * The accumulated list of updates that need to be dispatched
- * (i.e. the cache should be purged of out-of-date resources).
- * This list is only modified and accessed from the event processing
- * thread.
- */
- private final List updates = new ArrayList();
-
- /*
- * The accumulated list of fetches that have been requested
- */
- private final List fetches = new ArrayList();
- private final ISynchronizePageConfiguration configuration;
-
-
- /*
- * Interface for notifying a single client that the infos have been fetched
- */
- public interface ILogsFetchedListener {
-
- void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor);
-
- }
-
- /*
- * The listener or null if noone is listening
- */
- private ILogsFetchedListener listener;
-
- /*
- * Subscriber resource collector that forwards subscriber changes
- * through the handler so that stale cache entries can be cleared
- */
- private class LogEntryResourceCollector extends SubscriberResourceCollector {
-
- public LogEntryResourceCollector(Subscriber subscriber) {
- super(subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#remove(org.eclipse.core.resources.IResource)
- */
- protected void remove(IResource resource) {
- queueEvent(new ResourceEvent(resource, REMOVAL, IResource.DEPTH_INFINITE), false /* do not put in on the front of the queue*/);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#change(org.eclipse.core.resources.IResource, int)
- */
- protected void change(IResource resource, int depth) {
- queueEvent(new ResourceEvent(resource, CHANGE, depth), false /* do not put in on the front of the queue*/);
- }
-
- protected boolean hasMembers(IResource resource) {
- return collectedInfos.hasMembers(resource);
- }
- }
-
- /*
- * Custom event for queue a log entry fetch request
- */
- private class FetchRequest extends Event {
- private final SyncInfo[] infos;
- public FetchRequest(SyncInfo[] infos) {
- super(FETCH_REQUEST);
- this.infos = infos;
- }
- public SyncInfo[] getInfos() {
- return infos;
- }
- }
-
- public LogEntryCacheUpdateHandler(ISynchronizePageConfiguration configuration) {
- super(CVSUIMessages.LogEntryCacheUpdateHandler_1, CVSUIMessages.LogEntryCacheUpdateHandler_0); //
- this.configuration = configuration;
- this.subscriber = getSubscriber(configuration);
- cacheReference = new SoftReference(new LogEntryCache());
- collector = new LogEntryResourceCollector(subscriber);
- }
-
- private Subscriber getSubscriber(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof SubscriberParticipant) {
- SubscriberParticipant sp = (SubscriberParticipant) participant;
- return sp.getSubscriber();
- }
- if (participant instanceof ModelCompareParticipant) {
- ModelCompareParticipant mcp = (ModelCompareParticipant) participant;
- return mcp.getSubscriber();
- }
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- }
-
- public ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
-
- public Subscriber getSubscriber() {
- return subscriber;
- }
-
- /**
- * Set the listener that should receive notification when log entries
- * have been fetched and are avalable.
- * @param listener the listener or <code>null</code>
- */
- public void setListener(ILogsFetchedListener listener) {
- this.listener = listener;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#getJobFamiliy()
- */
- protected Object getJobFamiliy() {
- return ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#createEventHandlingJob()
- */
- protected void createEventHandlingJob() {
- super.createEventHandlingJob();
- Job job = getEventHandlerJob();
- job.setSystem(false);
- job.setUser(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#processEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
- Policy.checkCanceled(monitor);
- switch (event.getType()) {
- case REMOVAL:
- case CHANGE:
- updates.add(event);
- break;
- case FETCH_REQUEST:
- fetches.add(event);
- break;
- case PAUSE:
- throw PAUSE_EXCEPTION;
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#doDispatchEvents(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
- Policy.checkCanceled(monitor);
- boolean dispatched = false;
- monitor.beginTask(null, 50);
- dispatched |= updateCache(Policy.subMonitorFor(monitor, 20));
- dispatched |= processQueuedFetches(Policy.subMonitorFor(monitor, 80));
- monitor.done();
- return dispatched;
- }
-
- /*
- * Remove any stale or unneeded log entries from the cache.
- * Return whether there were any entries to purge.
- */
- private boolean updateCache(IProgressMonitor monitor) {
- if (updates.isEmpty()) return false;
- try {
- collectedInfos.beginInput();
- // Cycle through the update events
- for (Iterator iter = updates.iterator(); iter.hasNext();) {
- Event event = (Event) iter.next();
- Policy.checkCanceled(monitor);
- if (event.getType() == REMOVAL) {
- remove(event.getResource(), ((ResourceEvent)event).getDepth());
- } else if (event.getType() == CHANGE) {
- change(event.getResource(), ((ResourceEvent)event).getDepth());
- }
- // Use the iterator to remove so that updates will not be lost
- // if the job is cancelled and then restarted.
- iter.remove();
- }
- } finally {
- collectedInfos.endInput(monitor);
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#shutdown()
- */
- public void shutdown() {
- super.shutdown();
- collector.dispose();
- // Probably not necessary as GC would take care of it but we'll do it anyway
- if (cacheReference != null) {
- LogEntryCache cache = (LogEntryCache)cacheReference.get();
- if (cache != null) {
- cache.clearEntries();
- }
- }
- collectedInfos.clear();
-
- }
-
- private void remove(IResource resource, int depth) {
- collectedInfos.remove(resource, depth);
- }
-
- private void remove(SyncInfo info) {
- if (info != null) {
- collectedInfos.remove(info.getLocal());
- LogEntryCache cache = (LogEntryCache)cacheReference.get();
- if (cache != null) {
- ICVSRemoteResource remoteResource = getRemoteResource(info);
- if (remoteResource != null)
- cache.clearEntries(remoteResource);
- }
- }
- }
-
- public ICVSRemoteResource getRemoteResource(SyncInfo info) {
- try {
- ICVSRemoteResource remote = (ICVSRemoteResource) info.getRemote();
- ICVSRemoteResource local = CVSWorkspaceRoot.getRemoteResourceFor(info.getLocal());
- if(local == null) {
- local = (ICVSRemoteResource)info.getBase();
- }
-
- boolean useRemote = true;
- if (local != null && remote != null) {
- String remoteRevision = getRevisionString(remote);
- String localRevision = getRevisionString(local);
- useRemote = useRemote(localRevision, remoteRevision);
- } else if (remote == null) {
- useRemote = false;
- }
- if (useRemote) {
- return remote;
- } else if (local != null) {
- return local;
- }
- return null;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
- private boolean useRemote(String localRevision, String remoteRevision) {
- boolean useRemote;
- if (remoteRevision == null && localRevision == null) {
- useRemote = true;
- } else if (localRevision == null) {
- useRemote = true;
- } else if (remoteRevision == null) {
- useRemote = false;
- } else {
- useRemote = ResourceSyncInfo.isLaterRevision(remoteRevision, localRevision);
- }
- return useRemote;
- }
-
- private String getRevisionString(ICVSRemoteResource remoteFile) {
- if(remoteFile instanceof RemoteFile) {
- return ((RemoteFile)remoteFile).getRevision();
- }
- return null;
- }
-
- private void change(IResource resource, int depth) {
- // We only need to remove collected log entries that don't apply
- // any longer. They will be refetched when they are required.
- SyncInfo[] collected = collectedInfos.getSyncInfos(resource, depth);
- change(collected);
- }
-
- private void change(SyncInfo[] collected) {
- Subscriber subscriber = getSubscriber();
- for (int i = 0; i < collected.length; i++) {
- try {
- SyncInfo info = collected[i];
- SyncInfo newInfo = subscriber.getSyncInfo(info.getLocal());
- if (newInfo == null || !newInfo.equals(info)) {
- // The cached log entry no longer applies to the new sync info.
- // It will be refetched when required.
- remove(info);
- }
- } catch (TeamException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
- }
-
- /**
- * Queue a request to fetch log entries for the given SyncInfo nodes.
- * The event handler must be a non-system job when revision histories
- * are fetched.
- * @param infos the nodes whose log entries are to be fetched
- */
- public void fetch(SyncInfo[] infos) throws CVSException {
- synchronized(queueLock) {
- Job job = getEventHandlerJob();
- if (job.isSystem() && job.getState() != Job.NONE) {
- // queue an event to pause the processor
- super.queueEvent(new Event(PAUSE), true /* put on the front of the queue */);
- int count = 0;
- while (job.getState() != Job.NONE && count < MAX_WAIT) {
- count += WAIT_INCREMENT;
- try {
- Thread.sleep(WAIT_INCREMENT); // Wait a little while
- } catch (InterruptedException e) {
- // Ignore
- }
- }
- if (job.getState() != Job.NONE) {
- // The job never completed in the time aloted so throw an exception
- throw new CVSException(CVSUIMessages.LogEntryCacheUpdateHandler_2);
- }
- }
- // Queue the event even if the job didn't stop in the time aloted
- queueEvent(new FetchRequest(infos), false /* don't place at the end */);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#queueEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, boolean)
- */
- protected void queueEvent(Event event, boolean front) {
- // Override to snure that queues by this handler are serialized
- synchronized(queueLock) {
- Job job = getEventHandlerJob();
- if (job.getState() == Job.NONE) {
- job.setSystem(event.getType() != FETCH_REQUEST);
- }
- super.queueEvent(event, front);
- }
- }
-
- /*
- * Method invoked during event dispatch to fetch log entries
- */
- private boolean processQueuedFetches(IProgressMonitor monitor) {
- if (fetches.isEmpty()) return false;
- try {
- // Now perform the fetching
- Map projectMapping = getFetchesByProject();
- if (projectMapping.isEmpty()) return true;
- LogEntryCache logEntriesCache = (LogEntryCache)cacheReference.get();
- if (logEntriesCache == null) {
- logEntriesCache = new LogEntryCache();
- cacheReference = new SoftReference(logEntriesCache);
- }
- monitor.beginTask(CVSUIMessages.CVSChangeSetCollector_4, 100 * projectMapping.size());
- monitor.setTaskName(CVSUIMessages.CVSChangeSetCollector_4);
- for (Iterator iter = projectMapping.values().iterator(); iter.hasNext();) {
- SyncInfoSet set = (SyncInfoSet) iter.next();
- Policy.checkCanceled(monitor);
- fetchLogEntries(logEntriesCache, set, Policy.subMonitorFor(monitor, 90));
- fireFetchedNotification(logEntriesCache, set, Policy.subMonitorFor(monitor, 10));
- }
- } finally {
- // Clear the fetches even if we were cancelled.
- // Restarting will need to re-request all infos
- fetches.clear();
- monitor.done();
- }
- return true;
- }
-
- private void fireFetchedNotification(LogEntryCache logEntriesCache, SyncInfoSet set, IProgressMonitor monitor) {
- if (listener != null) {
- listener.logEntriesFetched(set, logEntriesCache, monitor);
- }
- }
-
- /*
- * Return a map of IProject to SyncInfoSet as that is how entries are fetched.
- * The set for each project includes all infos from the original set.
- * This is one so that the completion notification contains all infos
- * including those were a fetch was not required either because the
- * entry was already cached or the resource has no history.
- */
- private Map getFetchesByProject() {
- Map result = new HashMap();
- for (Iterator iter = fetches.iterator(); iter.hasNext();) {
- FetchRequest request = (FetchRequest) iter.next();
- SyncInfo[] infos = request.getInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IProject project = info.getLocal().getProject();
- SyncInfoSet infoSet = (SyncInfoSet)result.get(project);
- if (infoSet == null) {
- infoSet = new SyncInfoSet();
- result.put(project, infoSet);
- }
- infoSet.add(info);
- }
- }
- return result;
- }
-
- private boolean isFetchRequired(SyncInfo info) {
- // We only need to fetch if we don't have the log entry already
- // and the change is a remote change
- return info.getLocal().getType() == IResource.FILE && !isLogEntryCached(info) && isRemoteChange(info);
-
- }
-
- /*
- * Return whether the given SyncInfo is cached. If there is
- * an info for the resource that does not match the given info,
- * it is removed and false is returned.
- */
- private boolean isLogEntryCached(SyncInfo info) {
- SyncInfo collectedInfo = collectedInfos.getSyncInfo(info.getLocal());
- if (collectedInfo != null && !collectedInfo.equals(info)) {
- remove(collectedInfo);
- collectedInfo = null;
- }
- return collectedInfo != null;
- }
-
- /*
- * Return if this sync info should be considered as part of a remote change
- * meaning that it can be placed inside an incoming commit set (i.e. the
- * set is determined using the comments from the log entry of the file).
- */
- public boolean isRemoteChange(SyncInfo info) {
- int kind = info.getKind();
- if(info.getLocal().getType() != IResource.FILE) return false;
- if(info.getComparator().isThreeWay()) {
- return (kind & SyncInfo.DIRECTION_MASK) != SyncInfo.OUTGOING;
- }
- // For two-way, the change is only remote if it has a remote or has a base locally
- if (info.getRemote() != null) return true;
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)info.getLocal());
- try {
- return file.getSyncBytes() != null;
- } catch (CVSException e) {
- // Log the error and exclude the file from consideration
- CVSUIPlugin.log(e);
- return false;
- }
- }
-
- /*
- * Fetch the log entries for the info in the given set
- */
- private void fetchLogEntries(LogEntryCache logEntriesCache, SyncInfoSet set, IProgressMonitor monitor) {
- try {
- if (subscriber instanceof CVSCompareSubscriber) {
- CVSCompareSubscriber compareSubscriber = (CVSCompareSubscriber)subscriber;
- fetchLogEntries(logEntriesCache, compareSubscriber, set, monitor);
- } else {
- // Run the log command once with no tags
- fetchLogs(logEntriesCache, set, null, null, monitor);
- }
- } catch (CVSException e) {
- handleException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
-
- }
-
- private void fetchLogEntries(LogEntryCache logEntriesCache, CVSCompareSubscriber compareSubscriber, SyncInfoSet set, IProgressMonitor monitor) throws CVSException, InterruptedException {
- Map localTagMap = getLocalTagMap(set);
- monitor.beginTask(null, 100 * localTagMap.size());
- for (Iterator iter = localTagMap.keySet().iterator(); iter.hasNext();) {
- CVSTag localTag = (CVSTag) iter.next();
- fetchLogEntries(logEntriesCache, compareSubscriber, set, localTag, Policy.subMonitorFor(monitor, 100));
- }
- Policy.checkCanceled(monitor);
- monitor.done();
- }
-
- /*
- * Return the resources grouped by the tag found in the
- * workspace. The map is CVSTag->SyncInfoSet
- */
- private Map getLocalTagMap(SyncInfoSet set) {
- Map result = new HashMap();
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- SyncInfo info = (SyncInfo) iter.next();
- CVSTag tag = getLocalTag(info);
- SyncInfoSet tagSet = (SyncInfoSet)result.get(tag);
- if (tagSet == null) {
- tagSet = new SyncInfoSet();
- result.put(tag, tagSet);
- }
- tagSet.add(info);
- }
- return result;
- }
-
- private CVSTag getLocalTag(SyncInfo syncInfo) {
- try {
- IResource local = syncInfo.getLocal();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(local);
- CVSTag tag = null;
- if(cvsResource.isFolder()) {
- FolderSyncInfo info = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(info != null) {
- tag = info.getTag();
- }
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(local, tag);
- }
- } else {
- tag = Util.getAccurateFileTag(cvsResource);
- }
- if(tag == null) {
- tag = new CVSTag();
- }
- return tag;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return new CVSTag();
- }
- }
-
- private void fetchLogEntries(LogEntryCache logEntriesCache, CVSCompareSubscriber compareSubscriber, SyncInfoSet set, CVSTag localTag, IProgressMonitor monitor) throws CVSException, InterruptedException {
- if (compareSubscriber.isMultipleTagComparison()) {
- Map rootToInfoMap = getRootToInfoMap(compareSubscriber, set);
- monitor.beginTask(null, 100 * rootToInfoMap.size());
- for (Iterator iterator = rootToInfoMap.keySet().iterator(); iterator.hasNext();) {
- IResource root = (IResource) iterator.next();
- Policy.checkCanceled(monitor);
- fetchLogs(logEntriesCache, set, localTag, compareSubscriber.getTag(root), Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- } else {
- Policy.checkCanceled(monitor);
- fetchLogs(logEntriesCache, set, localTag, compareSubscriber.getTag(), monitor);
- }
- }
-
- private Map getRootToInfoMap(CVSCompareSubscriber compareSubscriber, SyncInfoSet set) {
- Map rootToInfosMap = new HashMap();
- IResource[] roots = compareSubscriber.roots();
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- SyncInfo info = (SyncInfo) iter.next();
- IPath localPath = info.getLocal().getFullPath();
- for (int j = 0; j < roots.length; j++) {
- IResource resource = roots[j];
- if (resource.getFullPath().isPrefixOf(localPath)) {
- SyncInfoSet infoList = (SyncInfoSet)rootToInfosMap.get(resource);
- if (infoList == null) {
- infoList = new SyncInfoSet();
- rootToInfosMap.put(resource, infoList);
- }
- infoList.add(info);
- break; // out of inner loop
- }
- }
-
- }
- return rootToInfosMap;
- }
-
- private void fetchLogs(LogEntryCache logEntriesCache, SyncInfoSet set, CVSTag localTag, CVSTag remoteTag, IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteResource[] remoteResources = getRemotesToFetch(set.getSyncInfos());
- if (remoteResources.length > 0) {
- RemoteLogOperation logOperation = new RemoteLogOperation(getConfiguration().getSite().getPart(), remoteResources, localTag, remoteTag, logEntriesCache);
- logOperation.execute(monitor);
- }
- collectedInfos.addAll(set);
- }
-
- private ICVSRemoteResource[] getRemotesToFetch(SyncInfo[] infos) {
- List remotes = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (isFetchRequired(info)) {
- ICVSRemoteResource remote = getRemoteResource(info);
- if(remote != null) {
- remotes.add(remote);
- }
- }
- }
- return (ICVSRemoteResource[]) remotes.toArray(new ICVSRemoteResource[remotes.size()]);
- }
-
- /**
- * Stop any current fetch in process.
- */
- public void stopFetching() {
- try {
- getEventHandlerJob().cancel();
- getEventHandlerJob().join();
- } catch (InterruptedException e) {
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
deleted file mode 100644
index b1d2fe0f9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
-
-public class MergeSynchronizeParticipant extends CVSParticipant {
-
- /**
- * The id of a workspace action group to which additions actions can
- * be added.
- */
- public static final String TOOLBAR_CONTRIBUTION_GROUP = "toolbar_group"; //$NON-NLS-1$
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_1"; //$NON-NLS-1$
- public static final String NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_2"; //$NON-NLS-1$
-
- private final static String CTX_ROOT = "root"; //$NON-NLS-1$
- private final static String CTX_ROOT_PATH = "root_resource"; //$NON-NLS-1$
- private final static String CTX_START_TAG = "start_tag"; //$NON-NLS-1$
- private final static String CTX_START_TAG_TYPE = "start_tag_type"; //$NON-NLS-1$
- private final static String CTX_END_TAG = "end_tag"; //$NON-NLS-1$
- private final static String CTX_END_TAG_TYPE = "end_tag_type"; //$NON-NLS-1$
-
- /**
- * Actions for the merge particpant's toolbar
- */
- public class MergeParticipantActionContribution extends SynchronizePageActionGroup {
- private MergeUpdateAction updateAction;
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
-
- updateAction = new MergeUpdateAction(
- configuration,
- getVisibleRootsSelectionProvider(),
- "WorkspaceToolbarUpdateAction."); //$NON-NLS-1$
- updateAction.setPromptBeforeUpdate(true);
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- TOOLBAR_CONTRIBUTION_GROUP,
- updateAction);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP,
- new MergeUpdateAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP,
- new ConfirmMergedAction(configuration));
-
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- }
-
- }
- }
-
- public MergeSynchronizeParticipant() {
- super();
- }
-
- public MergeSynchronizeParticipant(CVSMergeSubscriber subscriber) {
- setSubscriber(subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
- */
- public void setSubscriber(Subscriber subscriber) {
- super.setSubscriber(subscriber);
- try {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(CVSMergeSubscriber.ID);
- setInitializationData(descriptor);
- CVSMergeSubscriber s = (CVSMergeSubscriber)getSubscriber();
- setSecondaryId(s.getId().getLocalName());
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void init(String secondayId, IMemento memento) throws PartInitException {
- super.init(secondayId, memento);
- if(memento != null) {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(CVSMergeSubscriber.ID);
- String qualifier = descriptor.getId();
- String localname = secondayId;
- if(qualifier == null || localname == null) {
- throw new PartInitException(CVSUIMessages.MergeSynchronizeParticipant_8);
- }
- try {
- setSubscriber(read(new QualifiedName(qualifier, localname), memento));
- } catch (CVSException e) {
- throw new PartInitException(CVSUIMessages.MergeSynchronizeParticipant_9, e);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
- CVSMergeSubscriber s = (CVSMergeSubscriber)getSubscriber();
- write(s, memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.AbstractSynchronizeParticipant#dispose()
- */
- public void dispose() {
- super.dispose();
- if(TeamUI.getSynchronizeManager().get(getId(), getSecondaryId()) == null) {
- // If the participant isn't managed by the synchronize manager then we
- // must ensure that the state cached in the synchronizer is flushed.
- flushStateCache();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
- */
- public String getName() {
- return NLS.bind(CVSUIMessages.CompareParticipant_0, new String[] { ((CVSMergeSubscriber)getSubscriber()).getName(), Utils.convertSelection(getSubscriber().roots()) });
- }
-
- /*
- * Returns the start tag for this merge participant. The start tag is actually stored with the subscriber.
- */
- protected CVSTag getStartTag() {
- return ((CVSMergeSubscriber)getSubscriber()).getStartTag();
- }
-
- /*
- * Returns the end tag for this merge participant. The end tag is actually stored with the subscriber.
- */
- protected CVSTag getEndTag() {
- return ((CVSMergeSubscriber)getSubscriber()).getEndTag();
- }
-
- /*
- * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
- */
- public static MergeSynchronizeParticipant getMatchingParticipant(IResource[] resources, CVSTag startTag, CVSTag endTag) {
- ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference reference = refs[i];
- if (reference.getId().equals(CVSMergeSubscriber.ID)) {
- MergeSynchronizeParticipant p;
- try {
- p = (MergeSynchronizeParticipant) reference.getParticipant();
- } catch (TeamException e) {
- continue;
- }
- IResource[] roots = p.getResources();
- Arrays.sort(resources, Utils.resourceComparator);
- Arrays.sort(roots, Utils.resourceComparator);
- if (Arrays.equals(resources, roots) && p.getStartTag().equals(startTag) && p.getEndTag().equals(endTag)) {
- return p;
- }
- }
- }
- return null;
- }
-
- private void write(CVSMergeSubscriber s, IMemento memento) {
- // start and end tags
- CVSTag start = s.getStartTag();
- CVSTag end = s.getEndTag();
- memento.putString(CTX_START_TAG, start.getName());
- memento.putInteger(CTX_START_TAG_TYPE, start.getType());
- memento.putString(CTX_END_TAG, end.getName());
- memento.putInteger(CTX_END_TAG_TYPE, end.getType());
-
- // resource roots
- IResource[] roots = s.roots();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
- IMemento rootNode = memento.createChild(CTX_ROOT);
- rootNode.putString(CTX_ROOT_PATH, resource.getFullPath().toString());
- }
- }
-
- private CVSMergeSubscriber read(QualifiedName id, IMemento memento) throws CVSException {
- CVSTag start = new CVSTag(memento.getString(CTX_START_TAG), memento.getInteger(CTX_START_TAG_TYPE).intValue()); //
- CVSTag end = new CVSTag(memento.getString(CTX_END_TAG), memento.getInteger(CTX_END_TAG_TYPE).intValue()); //
-
- IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
- if(rootNodes == null || rootNodes.length == 0) {
- throw new CVSException(NLS.bind(CVSUIMessages.MergeSynchronizeParticipant_10, new String[] { id.toString() }));
- }
-
- List resources = new ArrayList();
- for (int i = 0; i < rootNodes.length; i++) {
- IMemento rootNode = rootNodes[i];
- IPath path = new Path(rootNode.getString(CTX_ROOT_PATH));
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
- if(resource != null) {
- resources.add(resource);
- } else {
- // log that a resource previously in the merge set is no longer in the workspace
- CVSProviderPlugin.log(IStatus.INFO, NLS.bind(CVSUIMessages.MergeSynchronizeParticipant_11, new String[] { path.toString() }), null);
- }
- }
- if(resources.isEmpty()) {
- throw new CVSException(NLS.bind(CVSUIMessages.MergeSynchronizeParticipant_12, new String[] { id.toString() }));
- }
- IResource[] roots = (IResource[]) resources.toArray(new IResource[resources.size()]);
- return new CVSMergeSubscriber(id, roots, start, end);
- }
-
- private void flushStateCache() {
- ((CVSMergeSubscriber)getSubscriber()).cancel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, TOOLBAR_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.setSupportedModes(ISynchronizePageConfiguration.INCOMING_MODE | ISynchronizePageConfiguration.CONFLICTING_MODE);
- configuration.setMode(ISynchronizePageConfiguration.INCOMING_MODE);
- configuration.addActionContribution(new MergeParticipantActionContribution());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getLongTaskName()
- */
- protected String getLongTaskName() {
- return getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getShortTaskName()
- */
- protected String getShortTaskName() {
- return CVSUIMessages.Participant_merging;
- }
-
- protected CVSChangeSetCapability createChangeSetCapability() {
- // See bug 84561 for a description of the problems with Merge Change Sets
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
deleted file mode 100644
index f03eb6376..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.OrSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-
-public class MergeUpdateAction extends CVSParticipantAction {
-
- public MergeUpdateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- public MergeUpdateAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(configuration, provider, bundleKey);
- }
-
- private boolean promptBeforeUpdate;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- // Update works for all incoming and conflicting nodes
- return new OrSyncInfoFilter(new FastSyncInfoFilter[] {
- new SyncInfoDirectionFilter(SyncInfo.INCOMING),
- new SyncInfoDirectionFilter(SyncInfo.CONFLICTING)
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new MergeUpdateOperation(configuration, elements, promptBeforeUpdate);
- }
-
- public void setPromptBeforeUpdate(boolean prompt) {
- promptBeforeUpdate = prompt;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java
deleted file mode 100644
index 3cb30ecb5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This action performs a "cvs update -j start -j end ..." to merge changes
- * into the local workspace.
- */
-public class MergeUpdateOperation extends SafeUpdateOperation {
-
- Subscriber currentSubcriber = null;
-
- protected MergeUpdateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean promptBeforeUpdate) {
- super(configuration, elements, promptBeforeUpdate);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return NLS.bind(CVSUIMessages.MergeUpdateAction_jobName, new String[] { new Integer(syncSet.size()).toString() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#getOverwriteLocalChanges()
- */
- protected boolean getOverwriteLocalChanges() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#updated(org.eclipse.core.resources.IResource[])
- */
- protected void updated(IResource[] resources) throws TeamException {
- // Mark all succesfully updated resources as merged
- if(resources.length > 0 && currentSubcriber != null) {
- ((CVSMergeSubscriber)currentSubcriber).merged(resources);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runUpdateDeletions(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runUpdateDeletions(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- // When merging, update deletions become outgoing deletions so just delete
- // the files locally without unmanaging (so the sync info is kept to
- // indicate an outgoing deletion
- try {
- monitor.beginTask(null, 100 * nodes.length);
- for (int i = 0; i < nodes.length; i++) {
- IResource resource = nodes[i].getLocal();
- if (resource.getType() == IResource.FILE) {
- ((IFile)resource).delete(false /* force */, true /* keep local history */, Policy.subMonitorFor(monitor, 100));
- }
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runSafeUpdate(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runSafeUpdate(IProject project, SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- if(nodes.length > 0) {
- setSubscriber(nodes[0]);
- CVSTag startTag = ((CVSMergeSubscriber)currentSubcriber).getStartTag();
- CVSTag endTag = ((CVSMergeSubscriber)currentSubcriber).getEndTag();
-
- // Incoming additions require different handling then incoming changes and deletions
- List additions = new ArrayList();
- List changes = new ArrayList();
- for (int i = 0; i < nodes.length; i++) {
- SyncInfo resource = nodes[i];
- int kind = resource.getKind();
- if ((kind & SyncInfo.CHANGE_MASK) == SyncInfo.ADDITION) {
- additions.add(resource);
- } else {
- changes.add(resource);
- }
- }
-
- try {
- monitor.beginTask(null, (additions.size() + changes.size()) * 100);
- if (!additions.isEmpty()) {
- safeUpdate(
- project,
- getIResourcesFrom((SyncInfo[]) additions.toArray(new SyncInfo[additions.size()])),
- new Command.LocalOption[] {
- Command.DO_NOT_RECURSE,
- Command.makeArgumentOption(Update.JOIN, endTag.getName())
- },
- Policy.subMonitorFor(monitor, additions.size() * 100));
- }
- if (!changes.isEmpty()) {
- safeUpdate(
- project,
- getIResourcesFrom((SyncInfo[]) changes.toArray(new SyncInfo[changes.size()])),
- new Command.LocalOption[] {
- Command.DO_NOT_RECURSE,
- Command.makeArgumentOption(Update.JOIN, startTag.getName()),
- Command.makeArgumentOption(Update.JOIN, endTag.getName())
- },
- Policy.subMonitorFor(monitor, changes.size() * 100));
- }
- } finally {
- monitor.done();
- }
- }
- }
-
- /**
- * @param nodes
- * @throws CVSException
- */
- private void setSubscriber(SyncInfo node) throws CVSException {
- // Assumption that all nodes are from the same subscriber.
- currentSubcriber = ((CVSSyncInfo)node).getSubscriber();
- if (!(currentSubcriber instanceof CVSMergeSubscriber)) {
- throw new CVSException(NLS.bind(CVSUIMessages.MergeUpdateAction_invalidSubscriber, new String[] { currentSubcriber.toString() }));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#overwriteUpdate(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void overwriteUpdate(SyncInfoSet set, IProgressMonitor monitor) throws TeamException {
- SyncInfo[] nodes = set.getSyncInfos();
- if (nodes.length == 0) return;
- setSubscriber(nodes[0]);
- monitor.beginTask(null, 1000 * nodes.length);
- try {
- for (int i = 0; i < nodes.length; i++) {
- makeRemoteLocal(nodes[i], Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
deleted file mode 100644
index cd52debaf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import com.ibm.icu.text.DateFormat;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.*;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation.CompareTreeBuilder;
-import org.eclipse.team.internal.core.subscribers.ChangeSet;
-import org.eclipse.team.internal.core.subscribers.CheckedInChangeSet;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode;
-import org.eclipse.team.ui.synchronize.*;
-
-class OpenChangeSetAction extends SynchronizeModelAction {
-
- protected OpenChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(CVSUIMessages.OpenCommitSetAction_20, configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return info.getLocal().getType() == IResource.FILE;
- }
- },
- new OrSyncInfoFilter(new FastSyncInfoFilter[] {
- new SyncInfoDirectionFilter(new int[] { SyncInfo.INCOMING, SyncInfo.CONFLICTING }),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return !info.getComparator().isThreeWay();
- }
- }
- })
- });
- }
-
- private ChangeSet getChangeSet(IStructuredSelection selection) {
- // First, check to see if a change set is selected directly
- if (selection.size() == 1) {
- Object o = selection.getFirstElement();
- if (o instanceof IAdaptable) {
- ChangeSet set = (ChangeSet)((IAdaptable)o).getAdapter(ChangeSet.class);
- if (set != null)
- return set;
- }
- }
- // Failing that, check to see if all the selected elements and their childen are in the same change set
- return getChangeSet(selection.toArray());
- }
-
- private ChangeSet getChangeSet(Object[] elements) {
- ChangeSet foundSet = null;
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
- ChangeSet set = getChangeSet((ISynchronizeModelElement)object);
- if (set == null) return null;
- if (foundSet == null) {
- foundSet = set;
- } else if (foundSet != set) {
- return null;
- }
- }
- return foundSet;
- }
-
- private ChangeSet getChangeSet(ISynchronizeModelElement element) {
- if (element == null) return null;
- if (element instanceof IAdaptable) {
- ChangeSet set = (ChangeSet)((IAdaptable)element).getAdapter(ChangeSet.class);
- if (set != null)
- return set;
- }
- return getChangeSet((ISynchronizeModelElement)element.getParent());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- boolean enabled = super.updateSelection(selection);
- if (enabled) {
- // The selection only contains appropriate files so
- // only enable if the selection is contained within a single change set
- ChangeSet set = getChangeSet(selection);
- return set != null;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new SynchronizeModelOperation(configuration, elements) {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- SyncInfoSet set = getSyncInfoSet();
- SyncInfo[] infos = set.getSyncInfos();
- if (infos.length > 0) {
- ICVSRepositoryLocation location = getLocation(infos[0]);
- if (location == null) {
- handle(new CVSException(CVSUIMessages.OpenCommitSetAction_21));
- return;
- }
- CompareTreeBuilder builder = new CompareTreeBuilder(location, null, null);
- if (buildTrees(builder, infos)) {
- try {
- builder.cacheContents(monitor);
- builder.openCompareEditor(getConfiguration().getSite().getPart().getSite().getPage(), getCompareTitle(), getCompareToolTip());
- } catch (CVSException e) {
- handle(e);
- return;
- }
- }
- }
- }
-
- private String getCompareToolTip() {
- IDiffElement[] elements = getSelectedDiffElements();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement element = elements[i];
- while (element != null) {
- if (element instanceof ChangeSetDiffNode) {
- return ((ChangeSetDiffNode)element).getName();
- }
- element = element.getParent();
- }
- }
- return null;
- }
-
- private String getCompareTitle() {
- IDiffElement[] elements = getSelectedDiffElements();
- ChangeSet set = getChangeSet(elements);
- if (set instanceof CheckedInChangeSet) {
- CheckedInChangeSet cics = (CheckedInChangeSet)set;
- String date = DateFormat.getDateTimeInstance().format(cics.getDate());
- return NLS.bind(CVSUIMessages.OpenChangeSetAction_0, new String[] {cics.getAuthor(), date});
- }
- return CVSUIMessages.OpenChangeSetAction_1;
- }
-
- private ICVSRepositoryLocation getLocation(SyncInfo info) {
- IResourceVariant remote = info.getRemote();
- if (remote == null) {
- remote = info.getBase();
- }
- if (remote != null) {
- return ((ICVSRemoteResource)remote).getRepository();
- }
- return null;
- }
-
- /*
- * Build the trees that will be compared
- */
- private boolean buildTrees(CompareTreeBuilder builder, SyncInfo[] infos) {
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IResourceVariant remote = info.getRemote();
- if (remote == null) {
- IResourceVariant predecessor = info.getBase();
- if (predecessor instanceof ICVSRemoteFile) {
- builder.addToTrees((ICVSRemoteFile)predecessor, null);
- }
- } else if (remote instanceof ICVSRemoteFile) {
- try {
- ICVSRemoteFile predecessor = getImmediatePredecessor(remote);
- builder.addToTrees(predecessor, (ICVSRemoteFile)remote);
- } catch (TeamException e) {
- handle(e);
- return false;
- }
- }
- }
- return true;
- }
- };
- }
-
- private ICVSRemoteFile getImmediatePredecessor(IResourceVariant remote) throws TeamException {
- CVSChangeSetCollector changeSetCollector = getChangeSetCollector();
- if (changeSetCollector != null) {
- return changeSetCollector.getImmediatePredecessor((ICVSRemoteFile)remote);
- }
- return null;
- }
-
- private CVSChangeSetCollector getChangeSetCollector() {
- return (CVSChangeSetCollector)getConfiguration().getProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
deleted file mode 100644
index e0d54e827..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class OverrideAndCommitAction extends CVSParticipantAction {
-
- public OverrideAndCommitAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceCommitOperation(configuration, elements, true /* override */);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
deleted file mode 100644
index 087c1490b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-/**
- * Runs an update command that will prompt the user for overwritting local
- * changes to files that have non-mergeable conflicts. All the prompting logic
- * is in the super class.
- */
-public class OverrideAndUpdateAction extends CVSParticipantAction {
-
- public OverrideAndUpdateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING});
- }
-
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new OverrideAndUpdateSubscriberOperation(configuration, elements);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java
deleted file mode 100644
index 477345e42..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.OverrideAndUpdateOperation;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class OverrideAndUpdateSubscriberOperation extends CVSSubscriberOperation {
- protected OverrideAndUpdateSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- public boolean shouldRun() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return(promptForOverwrite(syncSet));
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runWithProjectRule(IProject project, SyncInfoSet set, IProgressMonitor monitor) throws TeamException {
- try {
- SyncInfo[] conflicts = set.getNodes(getConflictingAdditionFilter());
- List conflictingResources = new ArrayList();
- for (int i = 0; i < conflicts.length; i++) {
- SyncInfo info = conflicts[i];
- conflictingResources.add(info.getLocal());
- }
- new OverrideAndUpdateOperation(getPart(), project, set.getResources(), (IResource[]) conflictingResources.toArray(new IResource[conflictingResources.size()]), null /* tag */, false /* recurse */).run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- Policy.cancelOperation();
- }
- }
- private FastSyncInfoFilter getConflictingAdditionFilter() {
- return new FastSyncInfoFilter.AndSyncInfoFilter(
- new FastSyncInfoFilter[] {
- new FastSyncInfoFilter.SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING}),
- new FastSyncInfoFilter.SyncInfoChangeTypeFilter(new int[] {SyncInfo.ADDITION})
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return NLS.bind(CVSUIMessages.UpdateAction_jobName, new String[] { new Integer(syncSet.size()).toString() });
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java
deleted file mode 100644
index f94b636af..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.AndSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoChangeTypeFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-/**
- * Resets the dirty state of files whose contents match their base.
- */
-public class RefreshDirtyStateAction extends CVSParticipantAction {
-
- public RefreshDirtyStateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- // Only interested in outgoing changes
- return new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- new SyncInfoDirectionFilter(new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING }),
- new SyncInfoChangeTypeFilter(SyncInfo.CHANGE)
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.ui.IWorkbenchPart, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(
- ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new RefreshDirtyStateOperation(configuration, elements);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
deleted file mode 100644
index a7ee2c5d9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * Resets the dirty state of files whose contents match their base.
- */
-public class RefreshDirtyStateOperation extends CVSSubscriberOperation {
-
- protected RefreshDirtyStateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runWithProjectRule(IProject project, SyncInfoSet set, IProgressMonitor monitor) throws TeamException {
- final SyncInfo[] infos = set.getSyncInfos();
- if (infos.length == 0) return;
- monitor.beginTask(null, 200);
- ensureBaseContentsCached(project, infos, Policy.subMonitorFor(monitor, 100));
- performCleanTimestamps(project, infos, monitor);
- monitor.done();
- }
-
- private void performCleanTimestamps(IProject project, final SyncInfo[] infos, IProgressMonitor monitor) throws CVSException {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- folder.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, infos.length * 100);
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IResource resource = info.getLocal();
- if (resource.getType() == IResource.FILE) {
- if (comparator.compareContents((IFile)resource, info.getBase(), Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
- }
- }
- monitor.done();
- }
- }, Policy.subMonitorFor(monitor, 100));
- }
-
- private void ensureBaseContentsCached(IProject project, SyncInfo[] infos, IProgressMonitor monitor) throws CVSException {
- List diffs = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IDiff node = getConverter().getDeltaFor(info);
- diffs.add(node);
- }
- ensureBaseContentsCached(project, (IDiff[]) diffs.toArray(new IDiff[diffs.size()]), monitor);
- }
-
- private SyncInfoToDiffConverter getConverter() {
- SyncInfoToDiffConverter converter = (SyncInfoToDiffConverter)CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().getAdapter(SyncInfoToDiffConverter.class);
- if (converter == null)
- return SyncInfoToDiffConverter.getDefault();
- return converter;
- }
-
- private void ensureBaseContentsCached(final IProject project, IDiff[] nodes, IProgressMonitor monitor) throws CVSException {
- try {
- ResourceDiffTree tree = new ResourceDiffTree();
- for (int i = 0; i < nodes.length; i++) {
- IDiff node = nodes[i];
- tree.add(node);
- }
- new CacheBaseContentsOperation(getPart(), new ResourceMapping[] { (ResourceMapping)project.getAdapter(ResourceMapping.class) },
- tree, true) {
- protected ResourceMappingContext getResourceMappingContext() {
- return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
- }
- protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
- return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
- }
- }.run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- protected String getErrorTitle() {
- return CVSUIMessages.RefreshDirtyStateOperation_0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- return CVSUIMessages.RefreshDirtyStateOperation_1;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
deleted file mode 100644
index c0c6ebd68..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.AndSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.OrSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOnlyMergableOperation;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This update action will update all mergable resources first and then prompt the
- * user to overwrite any resources that failed the safe update.
- *
- * Subclasses should determine how the update should handle conflicts by implementing
- * the getOverwriteLocalChanges() method.
- */
-public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
-
- private boolean promptBeforeUpdate = false;
-
- private SyncInfoSet skipped = new SyncInfoSet();
-
- protected SafeUpdateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean promptBeforeUpdate) {
- super(configuration, elements);
- this.promptBeforeUpdate = promptBeforeUpdate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- public boolean shouldRun() {
- return promptIfNeeded();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- skipped.clear();
- super.run(monitor);
- try {
- handleFailedUpdates(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#run(org.eclipse.team.ui.sync.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void runWithProjectRule(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- try {
- monitor.beginTask(null, 100);
-
- // Remove the cases that are known to fail (adding them to skipped list)
- removeKnownFailureCases(syncSet);
-
- // Run the update on the remaining nodes in the set
- // The update will fail for conflicts that turn out to be non-automergable
- safeUpdate(project, syncSet, Policy.subMonitorFor(monitor, 100));
-
- // Remove all failed conflicts from the original sync set
- syncSet.rejectNodes(new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return skipped.getSyncInfo(info.getLocal()) != null;
- }
- });
-
- // Signal for the ones that were updated
- updated(syncSet.getResources());
- } finally {
- monitor.done();
- }
- }
-
- /**
- * @param syncSet
- * @return
- */
- private SyncInfoSet removeKnownFailureCases(SyncInfoSet syncSet) {
- // First, remove any known failure cases
- FastSyncInfoFilter failFilter = getKnownFailureCases();
- SyncInfo[] willFail = syncSet.getNodes(failFilter);
- syncSet.rejectNodes(failFilter);
- for (int i = 0; i < willFail.length; i++) {
- SyncInfo info = willFail[i];
- skipped.add(info);
- }
- return syncSet;
- }
-
- private void handleFailedUpdates(IProgressMonitor monitor) throws TeamException {
- // Handle conflicting files that can't be merged, ask the user what should be done.
- if(! skipped.isEmpty()) {
- if(getOverwriteLocalChanges()) {
- // Ask the user if a replace should be performed on the remaining nodes
- if(promptForOverwrite(skipped)) {
- overwriteUpdate(skipped, monitor);
- if (!skipped.isEmpty()) {
- updated(skipped.getResources());
- }
- }
- } else {
- // Warn the user that some nodes could not be updated. This can happen if there are
- // files with conflicts that are not auto-mergeable.
- warnAboutFailedResources(skipped);
- }
- }
- }
-
- protected boolean getOverwriteLocalChanges(){
- return false;
- }
-
- /**
- * Perform a safe update on the resources in the provided set. Any included resources
- * that cannot be updated safely wil be added to the skippedFiles list.
- * @param syncSet the set containing the resources to be updated
- * @param monitor
- */
- protected void safeUpdate(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- SyncInfo[] changed = syncSet.getSyncInfos();
- if (changed.length == 0) return;
-
- // The list of sync resources to be updated using "cvs update"
- List updateShallow = new ArrayList();
- // A list of sync resource folders which need to be created locally
- // (incoming addition or previously pruned)
- Set parentCreationElements = new HashSet();
- // A list of sync resources that are incoming deletions.
- // We do these first to avoid case conflicts
- List updateDeletions = new ArrayList();
-
- for (int i = 0; i < changed.length; i++) {
- SyncInfo changedNode = changed[i];
-
- // Make sure that parent folders exist
- SyncInfo parent = getParent(changedNode);
- if (parent != null && isOutOfSync(parent)) {
- // We need to ensure that parents that are either incoming folder additions
- // or previously pruned folders are recreated.
- parentCreationElements.add(parent);
- }
-
- IResource resource = changedNode.getLocal();
- int kind = changedNode.getKind();
- boolean willBeAttempted = false;
- if (resource.getType() == IResource.FILE) {
- // Not all change types will require a "cvs update"
- // Some can be deleted locally without performing an update
- switch (kind & SyncInfo.DIRECTION_MASK) {
- case SyncInfo.INCOMING:
- switch (kind & SyncInfo.CHANGE_MASK) {
- case SyncInfo.DELETION:
- // Incoming deletions can just be deleted instead of updated
- updateDeletions.add(changedNode);
- willBeAttempted = true;
- break;
- default:
- // add the file to the list of files to be updated
- updateShallow.add(changedNode);
- willBeAttempted = true;
- break;
- }
- break;
- case SyncInfo.CONFLICTING:
- switch (kind & SyncInfo.CHANGE_MASK) {
- case SyncInfo.CHANGE:
- // add the file to the list of files to be updated
- updateShallow.add(changedNode);
- willBeAttempted = true;
- break;
- }
- break;
- }
- if (!willBeAttempted) {
- skipped.add(syncSet.getSyncInfo(resource));
- }
- } else {
- // Special handling for folders to support shallow operations on files
- // (i.e. folder operations are performed using the sync info already
- // contained in the sync info.
- if (isOutOfSync(changedNode)) {
- parentCreationElements.add(changedNode);
- }
- }
-
- }
- try {
- monitor.beginTask(null, 100);
-
- if (updateDeletions.size() > 0) {
- runUpdateDeletions((SyncInfo[])updateDeletions.toArray(new SyncInfo[updateDeletions.size()]), Policy.subMonitorFor(monitor, 25));
- }
- if (parentCreationElements.size() > 0) {
- makeInSync((SyncInfo[]) parentCreationElements.toArray(new SyncInfo[parentCreationElements.size()]), Policy.subMonitorFor(monitor, 25));
- }
- if (updateShallow.size() > 0) {
- runSafeUpdate(project, (SyncInfo[])updateShallow.toArray(new SyncInfo[updateShallow.size()]), Policy.subMonitorFor(monitor, 50));
- }
- } finally {
- monitor.done();
- }
- return;
- }
-
- /**
- * Perform an overwrite (unsafe) update on the resources in the provided set.
- * The passed sync set may containe resources from multiple projects and
- * it cannot be assumed that any scheduling rule is held when this method
- * is invoked.
- * @param syncSet the set containing the resources to be updated
- * @param monitor
- */
- protected abstract void overwriteUpdate(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException;
-
- /*
- * Return a filter which selects the cases that we know ahead of time
- * will fail on an update
- */
- protected FastSyncInfoFilter getKnownFailureCases() {
- return new OrSyncInfoFilter(new FastSyncInfoFilter[] {
- // Conflicting additions of files will fail
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.ADDITION),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return info.getLocal().getType() == IResource.FILE;
- }
- }
- }),
- // Conflicting changes of files will fail if the local is not managed
- // or is an addition
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- if (info.getLocal().getType() == IResource.FILE) {
- try {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)info.getLocal());
- byte[] syncBytes = cvsFile.getSyncBytes();
- return (syncBytes == null || ResourceSyncInfo.isAddition(syncBytes));
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- // Fall though and try to update
- }
- }
- return false;
- }
- }
- }),
- // Conflicting changes involving a deletion on one side will aways fail
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- IResourceVariant remote = info.getRemote();
- IResourceVariant base = info.getBase();
- if (info.getLocal().exists()) {
- // local != base and no remote will fail
- return (base != null && remote == null);
- } else {
- // no local and base != remote
- return (base != null && remote != null && !base.equals(remote));
- }
- }
- }
- }),
- // Conflicts where the file type is binary will work but are not merged
- // so they should be skipped
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- IResource local = info.getLocal();
- if (local.getType() == IResource.FILE) {
- try {
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)local);
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- return ResourceSyncInfo.isBinary(syncBytes);
- }
- } catch (CVSException e) {
- // There was an error obtaining or interpreting the sync bytes
- // Log it and skip the file
- CVSProviderPlugin.log(e);
- return true;
- }
- }
- return false;
- }
- }
- }),
- // Outgoing changes may not fail but they are skipped as well
- new SyncInfoDirectionFilter(SyncInfo.OUTGOING)
- });
- }
-
- /**
- * Warn user that some files could not be updated.
- * Note: This method is designed to be overridden by test cases.
- */
- protected void warnAboutFailedResources(final SyncInfoSet syncSet) {
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(getShell(),
- CVSUIMessages.SafeUpdateAction_warnFilesWithConflictsTitle,
- CVSUIMessages.SafeUpdateAction_warnFilesWithConflictsDescription);
- }
- });
- }
-
- /**
- * This method is invoked for all resources in the sync set that are incoming deletions.
- * It is done separately to allow deletions to be performed before additions that may
- * be the same name with different letter case.
- * @param nodes the SyncInfo nodes that are incoming deletions
- * @param monitor
- * @throws TeamException
- */
- protected abstract void runUpdateDeletions(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException;
-
- /**
- * This method is invoked for all resources in the sync set that are incoming changes
- * (but not deletions: @see runUpdateDeletions) or conflicting changes.
- * This method should only update those conflicting resources that are automergable.
- * @param project the project containing the nodes
- * @param nodes the incoming or conflicting SyncInfo nodes
- * @param monitor
- * @throws TeamException
- */
- protected abstract void runSafeUpdate(IProject project, SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException;
-
- protected void safeUpdate(IProject project, IResource[] resources, LocalOption[] localOptions, IProgressMonitor monitor) throws TeamException {
- try {
- UpdateOnlyMergableOperation operation = new UpdateOnlyMergableOperation(getPart(), project, resources, localOptions);
- operation.run(monitor);
- addSkippedFiles(operation.getSkippedFiles());
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- Policy.cancelOperation();
- }
- }
-
- /**
- * Notification of all resource that were updated (either safely or othrwise)
- */
- protected abstract void updated(IResource[] resources) throws TeamException;
-
- private void addSkippedFiles(IFile[] files) {
- SyncInfoSet set = getSyncInfoSet();
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
- skipped.add(set.getSyncInfo(file));
- }
- }
-
- protected String getErrorTitle() {
- return CVSUIMessages.UpdateAction_update;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return NLS.bind(CVSUIMessages.UpdateAction_jobName, new String[] { new Integer(syncSet.size()).toString() });
- }
-
- /**
- * Confirm with the user what we are going to be doing. By default the update action doesn't
- * prompt because the user has usually selected resources first. But in some cases, for example
- * when performing a toolbar action, a confirmation prompt is nice.
- * @param set the resources to be updated
- * @return <code>true</code> if the update operation can continue, and <code>false</code>
- * if the update has been cancelled by the user.
- */
- private boolean promptIfNeeded() {
- final SyncInfoSet set = getSyncInfoSet();
- final boolean[] result = new boolean[] {true};
- if(getPromptBeforeUpdate()) {
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- String sizeString = Integer.toString(set.size());
- String message = set.size() > 1 ? NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateSeveral, new String[] { sizeString }) : NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateOne, new String[] { sizeString }); //
- result[0] = MessageDialog.openQuestion(getShell(), NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateTitle, new String[] { sizeString }), message);
- }
- });
- }
- return result[0];
- }
-
- public boolean getPromptBeforeUpdate() {
- return promptBeforeUpdate;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
deleted file mode 100644
index 154b695d0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.ui.AdaptableResourceList;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * DetailsDialog that has a details area which shows the SyncInfos
- * in a SyncInfoSet.
- */
-public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
-
- private static final int WIDTH_HINT = 350;
- private final static int SELECTION_HEIGHT_HINT = 100;
-
- private CheckboxTableViewer listViewer;
-
- private SyncInfoSet syncSet;
- private Object[] selectedResources;
-
- public SyncInfoSetDetailsDialog(Shell parentShell, String dialogTitle, SyncInfoSet syncSet) {
- super(parentShell, dialogTitle);
- this.syncSet = syncSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- Composite composite = createComposite(parent);
-
- addResourcesArea(composite);
-
- // TODO: set F1 help
- //WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
-
- return composite;
- }
-
- /**
- * @param composite
- */
- private void addResourcesArea(Composite composite) {
- //createWrappingLabel(composite, detailsTitle);
- // add the selectable checkbox list
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SELECTION_HEIGHT_HINT;
- data.widthHint = WIDTH_HINT;
- listViewer.getTable().setLayoutData(data);
-
- // set the contents of the list
- listViewer.setLabelProvider(new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- if (element instanceof IResource)
- return ((IResource)element).getFullPath().toString();
- else
- return input;
- }
- });
- listViewer.setContentProvider(new WorkbenchContentProvider());
- setViewerInput();
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedResources = listViewer.getCheckedElements();
- }
- });
-
- addSelectionButtons(composite);
-
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
-
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
-
- Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_selectAll, false);
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- selectedResources = null;
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_deselectAll, false);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
- selectedResources = new Object[0];
-
- }
- };
- deselectButton.addSelectionListener(listener);
- }
-
- protected void setViewerInput() {
- if (listViewer == null || listViewer.getControl().isDisposed()) return;
- listViewer.setInput(new AdaptableResourceList(getAllResources()));
- if (selectedResources == null) {
- listViewer.setAllChecked(true);
- } else {
- listViewer.setCheckedElements(selectedResources);
- }
- }
-
- /**
- * Return a list of all the resources that are currently under consideration by the dialog
- */
- protected IResource[] getAllResources() {
- return syncSet.getResources();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- /**
- * @return
- */
- public SyncInfoSet getSyncSet() {
- return syncSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.OK_ID) {
- filterSyncSet();
- }
- super.buttonPressed(id);
- }
-
- protected void filterSyncSet() {
- // Keep only the checked resources
- if (selectedResources != null) {
- getSyncSet().selectNodes(new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- IResource local = info.getLocal();
- for (int i = 0; i < selectedResources.length; i++) {
- if (local.equals(selectedResources[i])) return true;
- }
- return false;
- }
- });
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ToolTipMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ToolTipMessageDialog.java
deleted file mode 100644
index 6d6cb017d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ToolTipMessageDialog.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-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/subscriber/UpdateDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
deleted file mode 100644
index bd264d4e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-
-/**
- * This dialog prompts for the type of update which should take place
- * (i.e. update of auto-mergable files or update of all ignore local
- * changes.
- */
-public class UpdateDialog extends SyncInfoSetDetailsDialog {
-
- public static final int YES = IDialogConstants.YES_ID;
-
- public UpdateDialog(Shell parentShell, SyncInfoSet syncSet) {
- super(parentShell, CVSUIMessages.UpdateDialog_overwriteTitle, syncSet); //
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
-
- // TODO: set F1 help
- //WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
-
- createWrappingLabel(composite, CVSUIMessages.UpdateDialog_overwriteMessage);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, YES, IDialogConstants.YES_LABEL, false);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
- super.createButtonsForButtonBar(parent);
- }
-
- protected boolean includeOkButton() {
- return false;
- }
-
- protected boolean includeCancelButton() {
- return false;
- }
-
- protected void buttonPressed(int id) {
- // hijack yes and no buttons to set the correct return
- // codes.
- if(id == YES || id == IDialogConstants.NO_ID) {
- setReturnCode(id);
- filterSyncSet();
- close();
- } else {
- super.buttonPressed(id);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java
deleted file mode 100644
index 966c3bb10..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-import org.eclipse.ui.PlatformUI;
-
-public class WorkspaceCommitAction extends CVSParticipantAction {
-
- public WorkspaceCommitAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- setId(ICVSUIConstants.CMD_COMMIT);
- setActionDefinitionId(ICVSUIConstants.CMD_COMMIT);
- }
-
- public WorkspaceCommitAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(configuration, provider, bundleKey);
- setId(ICVSUIConstants.CMD_COMMIT_ALL);
- setActionDefinitionId(ICVSUIConstants.CMD_COMMIT_ALL);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceCommitOperation(configuration, elements, false /* override */);
- }
-
- public void runOperation() {
- final SyncInfoSet set = getSyncInfoSet();
- final Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- try {
- // Include the subscriber operation as a job listener so that the busy feedback for the
- // commit will appear in the synchronize view
- CommitWizard.run(shell, set, getSubscriberOperation(getConfiguration(), getFilteredDiffElements()));
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /*
- * Return the selected SyncInfo for which this action is enabled.
- *
- * @return the selected SyncInfo for which this action is enabled.
- */
- private SyncInfoSet getSyncInfoSet() {
- IDiffElement [] elements= getFilteredDiffElements();
- SyncInfoSet filtered = new SyncInfoSet();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement e = elements[i];
- if (e instanceof SyncInfoModelElement) {
- filtered.add(((SyncInfoModelElement)e).getSyncInfo());
- }
- }
- return filtered;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
deleted file mode 100644
index d1504db09..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetComparator;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.core.subscribers.ChangeSet;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class WorkspaceCommitOperation extends CVSSubscriberOperation {
-
- private String comment;
- private SyncInfoSet syncSet;
- private boolean override;
-
- public WorkspaceCommitOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean override) {
- super(configuration, elements);
- this.override = override;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#getErrorTitle()
- */
- protected String getErrorTitle() {
- return CVSUIMessages.CommitAction_commitFailed;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return NLS.bind(CVSUIMessages.CommitAction_jobName, new String[] { new Integer(syncSet.size()).toString() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- public boolean shouldRun() {
- SyncInfoSet set = getSyncInfoSet();
- return !set.isEmpty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberOperation#getSyncInfoSet()
- */
- protected SyncInfoSet getSyncInfoSet() {
- if (syncSet == null) {
- syncSet = super.getSyncInfoSet();
- if (!promptForConflictHandling(syncSet)) {
- syncSet.clear();
- return syncSet;
- }
- try {
- if (!promptForUnaddedHandling(syncSet)) {
- syncSet.clear();
- return syncSet;
- }
- } catch (CVSException e) {
- Utils.handle(e);
- syncSet.clear();
- }
- }
- return syncSet;
- }
-
- protected boolean promptForConflictHandling(SyncInfoSet syncSet) {
- if (syncSet.hasConflicts() || syncSet.hasIncomingChanges()) {
- if (override) {
- // If overriding, prompt to ensure that is what the user wants
- switch (promptForConflicts(syncSet)) {
- case 0:
- // Yes, synchronize conflicts as well
- break;
- case 1:
- // No, stop here
- return false;
- case 2:
- default:
- // Cancel
- return false;
- }
- } else {
- // If there is a conflict in the syncSet, remove from sync set.
- syncSet.removeConflictingNodes();
- syncSet.removeIncomingNodes();
- }
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void runWithProjectRule(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
-
- final SyncInfo[] changed = syncSet.getSyncInfos();
- if (changed.length == 0) return;
-
- // A list of files to be committed
- final List commits = new ArrayList(); // of IResource
- // New resources that are not yet under CVS control and need a "cvs add"
- final List additions = new ArrayList(); // of IResource
- // A list of incoming or conflicting file changes to be made outgoing changes
- final List makeOutgoing = new ArrayList(); // of SyncInfo
- // A list of out-of-sync folders that must be made in-sync
- final List makeInSync = new ArrayList(); // of SyncInfo
-
- for (int i = 0; i < changed.length; i++) {
- SyncInfo changedNode = changed[i];
- int kind = changedNode.getKind();
- IResource resource = changedNode.getLocal();
-
- // Any parent folders should be made in-sync.
- // Steps will be taken after the commit to prune any empty folders
- SyncInfo parent = getParent(changedNode);
- if (parent != null) {
- if (isOutOfSync(parent)) {
- makeInSync.add(parent);
- }
- }
-
- if (resource.getType() == IResource.FILE) {
- // By default, all files are committed
- commits.add(resource);
- // Determine what other work needs to be done for the file
- switch (kind & SyncInfo.DIRECTION_MASK) {
- case SyncInfo.INCOMING:
- // Convert the incoming change to an outgoing change
- makeOutgoing.add(changedNode);
- break;
- case SyncInfo.OUTGOING:
- switch (kind & SyncInfo.CHANGE_MASK) {
- case SyncInfo.ADDITION:
- // Outgoing addition. 'add' it before committing.
- if (!isAdded(resource))
- additions.add(resource);
- break;
- case SyncInfo.DELETION:
- // Outgoing deletion is handled by move/delete
- // hook and EclipseSynchronizer
- break;
- case SyncInfo.CHANGE:
- // Outgoing change. Just commit it.
- break;
- }
- break;
- case SyncInfo.CONFLICTING:
- // Convert the conflicting change to an outgoing change
- makeOutgoing.add(changedNode);
- break;
- }
- } else {
- if (((kind & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING)
- && ((kind & SyncInfo.CHANGE_MASK) == SyncInfo.ADDITION)) {
- // Outgoing folder additions must be added
- additions.add(changedNode.getLocal());
- } else if (isOutOfSync(changedNode)) {
- // otherwise, make any out-of-sync folders in-sync using the remote info
- makeInSync.add(changedNode);
- }
- }
- }
- monitor.beginTask(null, 200);
-
- if (makeInSync.size() > 0) {
- makeInSync((SyncInfo[]) makeInSync.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, 25));
- }
-
- if (makeOutgoing.size() > 0) {
- makeOutgoing((SyncInfo[]) makeOutgoing.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, 25));
- }
-
- if (additions.size() != 0) {
- add(project, (IResource[])additions.toArray(new IResource[0]), Policy.subMonitorFor(monitor, 50));
- }
- commit(project, (IResource[])commits.toArray(new IResource[commits.size()]), Policy.subMonitorFor(monitor, 100));
- }
-
- private void commit(final IProject project, IResource[] commits, IProgressMonitor monitor) throws TeamException {
- try {
- CommitOperation commitOperation = new CommitOperation(getPart(), RepositoryProviderOperation.asResourceMappers(commits),
- new Command.LocalOption[0], comment) {
- protected ResourceMappingContext getResourceMappingContext() {
- return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
- }
- protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
- return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
- }
- };
- commitOperation
- .run(monitor);
- } catch (InvocationTargetException e) {
- throw TeamException.asTeamException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- private void add(final IProject project, IResource[] additions, IProgressMonitor monitor) throws TeamException {
- try {
- new AddOperation(getPart(), RepositoryProviderOperation.asResourceMappers(additions)) {
- protected ResourceMappingContext getResourceMappingContext() {
- return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
- }
- protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
- return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
- }
- }.run(monitor);
- } catch (InvocationTargetException e1) {
- throw TeamException.asTeamException(e1);
- } catch (InterruptedException e1) {
- throw new OperationCanceledException();
- }
- }
-
- /**
- * Prompts the user to determine how conflicting changes should be handled.
- * Note: This method is designed to be overridden by test cases.
- * @return 0 to sync conflicts, 1 to sync all non-conflicts, 2 to cancel
- */
- protected int promptForConflicts(SyncInfoSet syncSet) {
- String[] buttons = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL};
- String question = CVSUIMessages.CommitSyncAction_questionRelease;
- String title = CVSUIMessages.CommitSyncAction_titleRelease;
- String[] tips = new String[] {
- CVSUIMessages.CommitSyncAction_releaseAll,
- CVSUIMessages.CommitSyncAction_releasePart,
- CVSUIMessages.CommitSyncAction_cancelRelease
- };
- Shell shell = getShell();
- final ToolTipMessageDialog dialog = new ToolTipMessageDialog(shell, title, null, question, MessageDialog.QUESTION, buttons, tips, 0);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- return dialog.getReturnCode();
- }
-
- /**
- * Prompts the user for a release comment.
- * Note: This method is designed to be overridden by test cases.
- * @return the comment, or null to cancel
- */
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- String proposedComment = getProposedComment(resourcesToCommit);
- return manager.promptForComment(getShell(), resourcesToCommit, proposedComment);
- }
-
- private String getProposedComment(IResource[] resourcesToCommit) {
- StringBuffer comment = new StringBuffer();
- ChangeSet[] sets = CVSUIPlugin.getPlugin().getChangeSetManager().getSets();
- Arrays.sort(sets, new ChangeSetComparator());
- int numMatchedSets = 0;
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (containsOne(set, resourcesToCommit)) {
- if(numMatchedSets > 0) comment.append(System.getProperty("line.separator")); //$NON-NLS-1$
- comment.append(set.getComment());
- numMatchedSets++;
- }
- }
- return comment.toString();
- }
-
- private boolean containsOne(ChangeSet set, IResource[] resourcesToCommit) {
- for (int j = 0; j < resourcesToCommit.length; j++) {
- IResource resource = resourcesToCommit[j];
- if (set.contains(resource)) {
- return true;
- }
- }
- return false;
- }
-
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return manager.promptForResourcesToBeAdded(getShell(), unadded);
- }
-
- private boolean promptForUnaddedHandling(SyncInfoSet syncSet) throws CVSException {
- if (syncSet.isEmpty()) return false;
-
- // accumulate any resources that are not under version control
- IResource[] unadded = getUnaddedResources(syncSet);
-
- // prompt to get comment and any resources to be added to version control
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- IResource[] toBeAdded = promptForResourcesToBeAdded(manager, unadded);
- if (toBeAdded == null) return false; // User cancelled.
- comment = promptForComment(manager, syncSet.getResources());
- if (comment == null) return false; // User cancelled.
-
- // remove unshared resources that were not selected by the user
- if (unadded != null && unadded.length > 0) {
- List resourcesToRemove = new ArrayList(unadded.length);
- for (int i = 0; i < unadded.length; i++) {
- IResource unaddedResource = unadded[i];
- boolean included = false;
- for (int j = 0; j < toBeAdded.length; j++) {
- IResource resourceToAdd = toBeAdded[j];
- if (unaddedResource.equals(resourceToAdd)) {
- included = true;
- break;
- }
- }
- if (!included)
- resourcesToRemove.add(unaddedResource);
- }
- syncSet.removeAll((IResource[]) resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
- }
- return true;
- }
-
- private IResource[] getUnaddedResources(SyncInfoSet syncSet) throws CVSException {
- // TODO: Should only get outgoing additions (since conflicting additions
- // could be considered to be under version control already)
- IResource[] resources = syncSet.getResources();
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!isAdded(resource)) {
- result.add(resource);
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- private boolean isAdded(IResource resource) throws CVSException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isFolder()) {
- return ((ICVSFolder)cvsResource).isCVSFolder();
- } else {
- return cvsResource.isManaged();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
deleted file mode 100644
index 24866d2b6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids <sdavids@gmx.de> - bug 69926
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.*;
-import org.eclipse.team.internal.core.subscribers.*;
-import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.*;
-
-public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipant implements IChangeSetProvider {
-
- public static final String ID = "org.eclipse.team.cvs.ui.cvsworkspace-participant"; //$NON-NLS-1$
-
- /**
- * The id of a workspace action group to which additions actions can
- * be added.
- */
- public static final String TOOLBAR_CONTRIBUTION_GROUP = "toolbar_group_1"; //$NON-NLS-1$
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_1 = "context_group_1"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_2 = "context_group_2"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_3 = "context_group_3"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_4 = "context_group_4"; //$NON-NLS-1$
-
- private WorkspaceChangeSetCapability capability;
-
- /**
- * CVS workspace action contribution
- */
- public class WorkspaceActionContribution extends SynchronizePageActionGroup {
- private WorkspaceCommitAction commitToolbar;
- private WorkspaceUpdateAction updateToolbar;
-
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
-
- updateToolbar = new WorkspaceUpdateAction(
- configuration,
- getVisibleRootsSelectionProvider(),
- "WorkspaceToolbarUpdateAction."); //$NON-NLS-1$
- updateToolbar.setPromptBeforeUpdate(true);
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- TOOLBAR_CONTRIBUTION_GROUP,
- updateToolbar);
-
- commitToolbar = new WorkspaceCommitAction(
- configuration,
- getVisibleRootsSelectionProvider(),
- "WorkspaceToolbarCommitAction."); //$NON-NLS-1$
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- TOOLBAR_CONTRIBUTION_GROUP,
- commitToolbar);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1,
- new WorkspaceUpdateAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1,
- new WorkspaceCommitAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2,
- new OverrideAndUpdateAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2,
- new OverrideAndCommitAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2,
- new ConfirmMergedAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new IgnoreAction(), configuration));
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CreatePatchAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new BranchAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new SetKeywordSubstitutionAction(), configuration));
- }
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_4,
- new RefreshDirtyStateAction(configuration));
- }
- }
-
- public class WorkspaceChangeSetCapability extends CVSChangeSetCapability {
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#createChangeSet(org.eclipse.team.core.synchronize.SyncInfo[])
- */
- public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, IDiff[] infos) {
- ActiveChangeSet set = getActiveChangeSetManager().createSet(CVSUIMessages.WorkspaceChangeSetCapability_1, new IDiff[0]);
- CommitSetDialog dialog = new CommitSetDialog(configuration.getSite().getShell(), set, getResources(infos), CommitSetDialog.NEW);
- dialog.open();
- if (dialog.getReturnCode() != Window.OK) return null;
- set.add(infos);
- return set;
- }
-
- private IResource[] getResources(IDiff[] diffs) {
- Set result = new HashSet();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource != null)
- result.add(resource);
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#editChangeSet(org.eclipse.team.core.subscribers.ActiveChangeSet)
- */
- public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
- CommitSetDialog dialog = new CommitSetDialog(configuration.getSite().getShell(), set, set.getResources(), CommitSetDialog.EDIT);
- dialog.open();
- if (dialog.getReturnCode() != Window.OK) return;
- // Nothing to do here as the set was updated by the dialog
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#getActiveChangeSetManager()
- */
- public ActiveChangeSetManager getActiveChangeSetManager() {
- return CVSUIPlugin.getPlugin().getChangeSetManager();
- }
- }
-
- /**
- * No-arg constructor used for
- * creation of persisted participant after startup
- */
- public WorkspaceSynchronizeParticipant() {
- }
-
- public WorkspaceSynchronizeParticipant(ISynchronizeScope scope) {
- super(scope);
- setSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void init(String secondaryId, IMemento memento) throws PartInitException {
- super.init(secondaryId, memento);
- setSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- ILabelDecorator labelDecorator = getLabelDecorator(configuration);
- configuration.addLabelDecorator(labelDecorator);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, TOOLBAR_CONTRIBUTION_GROUP);
- configuration.addActionContribution(new WorkspaceActionContribution());
- configuration.setSupportedModes(ISynchronizePageConfiguration.ALL_MODES);
- configuration.setMode(ISynchronizePageConfiguration.BOTH_MODE);
-
- // Add context menu groups here to give the client displaying the
- // page a chance to remove the context menu
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_4);
- }
-
- protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) {
- return new CVSParticipantLabelDecorator(configuration);
- }
-
- protected ISynchronizeParticipantDescriptor getDescriptor() {
- return TeamUI.getSynchronizeManager().getParticipantDescriptor(ID);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#updateLabels(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- CVSParticipant.deriveBaseContentsFromLocal(element, Policy.subMonitorFor(monitor, 10));
- super.prepareCompareInput(element, config, Policy.subMonitorFor(monitor, 80));
- CVSParticipant.updateLabelsForCVS(element, config, Policy.subMonitorFor(monitor, 10));
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getPreferencePages()
- */
- public PreferencePage[] getPreferencePages() {
- return CVSParticipant.addCVSPreferencePages(super.getPreferencePages());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getChangeSetCapability()
- */
- public ChangeSetCapability getChangeSetCapability() {
- if (capability == null) {
- capability = new WorkspaceChangeSetCapability();
- }
- return capability;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#isViewerContributionsSupported()
- */
- protected boolean isViewerContributionsSupported() {
- return true;
- }
-
- public void refresh(IResource[] resources, IWorkbenchPartSite site) {
- refresh(resources, getShortTaskName(), getLongTaskName(resources), site);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
deleted file mode 100644
index a9570e17c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class WorkspaceUpdateAction extends CVSParticipantAction {
-
- private boolean promptBeforeUpdate;
-
- public WorkspaceUpdateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- setId(ICVSUIConstants.CMD_UPDATE);
- setActionDefinitionId(ICVSUIConstants.CMD_UPDATE);
- }
-
- public WorkspaceUpdateAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(configuration, provider, bundleKey);
- setId(ICVSUIConstants.CMD_UPDATE_ALL);
- setActionDefinitionId(ICVSUIConstants.CMD_UPDATE_ALL);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.INCOMING, SyncInfo.CONFLICTING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceUpdateOperation(configuration, elements, promptBeforeUpdate);
- }
-
- public void setPromptBeforeUpdate(boolean prompt) {
- promptBeforeUpdate = prompt;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java
deleted file mode 100644
index de56c3327..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This action performs an update for the CVSWorkspaceSubscriber.
- */
-public class WorkspaceUpdateOperation extends SafeUpdateOperation {
-
- protected WorkspaceUpdateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean promptBeforeUpdate) {
- super(configuration, elements, promptBeforeUpdate);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runUpdateDeletions(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runUpdateDeletions(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, nodes.length * 100);
- for (int i = 0; i < nodes.length; i++) {
- SyncInfo node = nodes[i];
- unmanage(node, Policy.subMonitorFor(monitor, 50));
- deleteAndKeepHistory(node.getLocal(), Policy.subMonitorFor(monitor, 50));
- }
- pruneEmptyParents(nodes);
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runSafeUpdate(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runSafeUpdate(IProject project, SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- safeUpdate(project, getIResourcesFrom(nodes), new LocalOption[] { Command.DO_NOT_RECURSE }, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#overwriteUpdate(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void overwriteUpdate(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- try {
- new ReplaceOperation(getPart(), syncSet.getResources(), null /* tag */, false /* recurse */)
- .run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- Policy.cancelOperation();
- }
-
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#updated(org.eclipse.core.resources.IResource[])
- */
- protected void updated(IResource[] resources) throws TeamException {
- // Do nothing
- }
-
- private void unmanage(SyncInfo element, IProgressMonitor monitor) throws CVSException {
- CVSWorkspaceRoot.getCVSResourceFor(element.getLocal()).unmanage(monitor);
- }
-
- private void deleteAndKeepHistory(IResource resource, IProgressMonitor monitor) throws CVSException {
- try {
- if (!resource.exists()) return;
- if (resource.getType() == IResource.FILE)
- ((IFile)resource).delete(false /* force */, true /* keep history */, monitor);
- else if (resource.getType() == IResource.FOLDER)
- ((IFolder)resource).delete(false /* force */, true /* keep history */, monitor);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
deleted file mode 100644
index 9f3b87b10..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-
-public class BranchPromptDialog extends DetailsDialog {
-
- private String branchTag = ""; //$NON-NLS-1$
- private String versionTag= ""; //$NON-NLS-1$
- private String versionName= ""; //$NON-NLS-1$
-
- private boolean allStickyResources;
- private boolean update;
-
- private Text versionText;
- private Text branchText;
-
- private static final int TAG_AREA_HEIGHT_HINT = 200;
-
- // widgets;
- private TagSource tagSource;
- private TagSelectionArea tagArea;
- private final IResource[] resources;
-
- public BranchPromptDialog(Shell parentShell, String title, IResource[] resources, boolean allResourcesSticky, String versionName) {
- super(parentShell, title);
- this.resources = resources;
- this.tagSource = TagSource.create(resources);
- this.allStickyResources = allResourcesSticky;
- this.versionName = versionName;
- }
-
- /**
- * @see DetailsDialog#createMainDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite composite) {
-
- applyDialogFont(composite);
- initializeDialogUnits(composite);
-
- final int areaWidth= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
-
- final Label description= SWTUtils.createLabel(composite, allStickyResources ? CVSUIMessages.BranchWizardPage_pageDescriptionVersion : CVSUIMessages.BranchWizardPage_pageDescription);
- description.setLayoutData(SWTUtils.createGridData(areaWidth, SWT.DEFAULT, true, false));
-
- final Label name= SWTUtils.createLabel(composite, CVSUIMessages.BranchWizardPage_branchName);
- name.setLayoutData(SWTUtils.createGridData(areaWidth, SWT.DEFAULT, true, false));
-
- branchText = CVSWizardPage.createTextField(composite);
- branchText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- branchTag = branchText.getText();
- updateEnablements();
- updateVersionName(branchTag);
- }
- });
- addBranchContentAssist();
-
- final Button check = SWTUtils.createCheckBox(composite, CVSUIMessages.BranchWizardPage_startWorking);
- check.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- update = check.getSelection();
- }
- });
- check.setSelection(true);
- update = true;
-
- final Label versionLabel1= SWTUtils.createLabel(composite, CVSUIMessages.BranchWizardPage_specifyVersion);
- versionLabel1.setLayoutData(SWTUtils.createGridData(areaWidth, SWT.DEFAULT, true, false));
-
- final Label versionLabel2= SWTUtils.createLabel(composite, CVSUIMessages.BranchWizardPage_versionName);
- versionLabel2.setLayoutData(SWTUtils.createGridData(areaWidth, SWT.DEFAULT, true, false));
-
- 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);
- }
-
- applyDialogFont(composite);
- branchText.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IHelpContextIds.BRANCH_DIALOG;
- }
- private void addBranchContentAssist() {
- TagSource projectTagSource = LocalProjectTagSource.create(getSeedProject());
- if (projectTagSource != null)
- TagContentAssistProcessor.createContentAssistant(branchText, projectTagSource, TagSelectionArea.INCLUDE_BRANCHES);
- }
-
- private IProject getSeedProject() {
- return resources[0].getProject();
- }
-
- /**
- * Updates version name
- */
- protected void updateVersionName(String branchName) {
- if(versionText!=null && !allStickyResources) {
- versionText.setText(CVSUIMessages.BranchWizardPage_versionPrefix + branchName);
- }
- }
-
- /**
- * @see DetailsDialog#createDropDownDialogArea(Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
-
- applyDialogFont(parent);
- final PixelConverter converter= new PixelConverter(parent);
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DIALOG));
- final GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = TAG_AREA_HEIGHT_HINT;
- composite.setLayoutData(gridData);
-
- tagArea = new TagSelectionArea(getShell(), tagSource, TagSelectionArea.INCLUDE_VERSIONS | TagSelectionArea.INCLUDE_BRANCHES, null);
- tagArea.setTagAreaLabel(CVSUIMessages.BranchWizardPage_existingVersionsAndBranches);
- tagArea.setIncludeFilterInputArea(false);
- tagArea.createArea(composite);
-
- return composite;
- }
-
- /**
- * Validates branch and version names
- */
- protected void updateEnablements() {
- String message = null;
-
- if (branchTag.length() == 0) {
- message = ""; //$NON-NLS-1$
- } else {
- IStatus status = CVSTag.validateTagName(branchTag);
- if (!status.isOK()) {
- message = NLS.bind(CVSUIMessages.BranchWizard_branchNameWarning, new String[] { status.getMessage() });
- } else {
- if(versionText!=null) {
- status = CVSTag.validateTagName(versionText.getText());
- if (!status.isOK()) {
- message = NLS.bind(CVSUIMessages.BranchWizard_versionNameWarning, new String[] { status.getMessage() });
- } else {
- if(versionTag.length() != 0 && versionTag.equals(branchTag)) {
- message = CVSUIMessages.BranchWizard_branchAndVersionMustBeDifferent;
- }
- }
- }
- }
- }
- setPageComplete(message == null);
- setErrorMessage(message);
- }
-
- /**
- * Returns the branch tag name
- */
- public String getBranchTagName() {
- return branchTag;
- }
-
- /**
- * Returns the version tag name
- */
- public String getVersionTagName() {
- return versionTag;
- }
-
- /**
- * Returns the state of the update checkbox
- */
- public boolean getUpdate() {
- return update;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
- */
- protected boolean isMainGrabVertical() {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java
deleted file mode 100644
index d375590ad..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.model.CVSResourceElement;
-import org.eclipse.ui.PlatformUI;
-
-public class CVSFileElement extends CVSResourceElement {
-
- private ICVSFile file;
-
- public CVSFileElement(ICVSFile file) {
- this.file = file;
- }
-
- /**
- * Initial implementation: return null;
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return new Object[0];
- }
- /**
- * Initial implementation: return null.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(file.getName());
- }
- /**
- * Initial implementation: return the file's name and version
- */
- public String getLabel(Object o) {
- try {
- ResourceSyncInfo info = file.getSyncInfo();
- if(info!=null) {
- return file.getName() + " " + info.getRevision(); //$NON-NLS-1$
- } else {
- return file.getName();
- }
- } catch (TeamException e) {
- handle(null, null, e);
- return null;
- }
- }
- /**
- * @see IWorkbenchAdapter#getParent(Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- public ICVSFile getCVSFile() {
- return file;
- }
- /**
- * @see CVSResourceElement#getCVSResource()
- */
- public ICVSResource getCVSResource() {
- return file;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java
deleted file mode 100644
index 446355047..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.model.CVSResourceElement;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-public class CVSFolderElement extends CVSResourceElement {
-
- private ICVSFolder folder;
- private boolean includeUnmanaged;
-
- public CVSFolderElement(ICVSFolder folder, boolean includeUnmanaged) {
- this.folder = folder;
- this.includeUnmanaged = includeUnmanaged;
- }
-
- /**
- * Returns CVSResourceElement instances
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- ICVSResource[] children = folder.fetchChildren(monitor);
- CVSResourceElement[] elements = new CVSResourceElement[children.length];
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
- if(resource.isFolder()) {
- elements[i] = new CVSFolderElement((ICVSFolder)resource, includeUnmanaged);
- } else {
- elements[i] = new CVSFileElement((ICVSFile)resource);
- }
- }
- return elements;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#isRemoteElement()
- */
- public boolean isRemoteElement() {
- return true;
- }
-
- /**
- * Overridden to append the version name to remote folders which
- * have version tags and are top-level folders.
- */
- public String getLabel(Object o) {
- return folder.getName();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-
- /**
- * @see IWorkbenchAdapter#getParent(Object)
- */
- public Object getParent(Object o) {
- return new CVSFolderElement(folder.getParent(), includeUnmanaged);
- }
-
- /**
- * @see CVSResourceElement#getCVSResource()
- */
- public ICVSResource getCVSResource() {
- return folder ;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
deleted file mode 100644
index 5767240a5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.util.StringMatcher;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Workbench model element that returns a filtered list of tags
- */
-public class FilteredTagList implements IWorkbenchAdapter, IAdaptable {
-
- private final TagSource tagSource;
- private final int[] types;
- private StringMatcher matcher;
-
- public FilteredTagList(TagSource tagSource, int[] types) {
- this.tagSource = tagSource;
- this.types = types;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- CVSTag[] tags = getTags();
- List filtered = new ArrayList();
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (select(tag)) {
- filtered.add(new TagElement(this, tag));
- }
- }
- return filtered.toArray(new Object[filtered.size()]);
- }
-
- private boolean select(CVSTag tag) {
- if (matcher == null) return true;
- return matcher.match(tag.getName());
- }
-
- private CVSTag[] getTags() {
- return tagSource.getTags(types);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- public void setPattern(String pattern) {
- if (!pattern.endsWith("*")) { //$NON-NLS-1$
- pattern += "*"; //$NON-NLS-1$
- }
- matcher = new StringMatcher(pattern, true, false);
- }
-
- public CVSTag[] getMatchingTags() {
- CVSTag[] tags = getTags();
- List filtered = new ArrayList();
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (select(tag)) {
- filtered.add(tag);
- }
- }
- return (CVSTag[])filtered.toArray(new CVSTag[filtered.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java
deleted file mode 100644
index a8007e688..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-
-/**
- * Tag source that gets its tags from the projects exist in the workspace
- */
-public class LocalProjectTagSource extends TagSource {
-
- public static TagSource create(IProject seedProject) {
- try {
- ICVSRemoteFolder seedFolder = ((ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(seedProject));
- ICVSRemoteFolder[] remoteFolders = getProjectRemoteFolders();
- if (remoteFolders.length == 1) {
- // There are no other projects to get tags from so return null
- return null;
- }
- return new LocalProjectTagSource(seedFolder, remoteFolders);
- } catch (CVSException e) {
- // Log and return null
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
- private ICVSRemoteFolder seedFolder;
- private ICVSRemoteFolder[] remoteFolders;
-
- private LocalProjectTagSource(ICVSRemoteFolder seedFolder, ICVSRemoteFolder[] remoteFolders) {
- this.seedFolder = seedFolder;
- this.remoteFolders = remoteFolders;
- }
-
- /*
- * Return the list of remote folders for the projects in the workspace mapped to the given repository
- */
- private static ICVSRemoteFolder[] getProjectRemoteFolders() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- List result = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- try {
- if (project.isAccessible() && RepositoryProvider.isShared(project)) {
- ICVSRemoteFolder remote = (ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(project);
- if (remote != null) {
- result.add(remote);
- }
- }
- } catch (CVSException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
- return (ICVSRemoteFolder[]) result.toArray(new ICVSRemoteFolder[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#refresh(boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- // This tag source should not be refreshed
- return new CVSTag[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- return seedFolder.getRepository();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return NLS.bind(CVSUIMessages.LocalProjectTagSource_0, new String[] { Integer.toString(remoteFolders.length) });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- // Does not commit tags
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return remoteFolders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- // Accumulate the tags for all folders
- Set allTags = new HashSet();
- for (int i = 0; i < remoteFolders.length; i++) {
- ICVSRemoteFolder folder = remoteFolders[i];
- CVSTag[] tags = SingleFolderTagSource.getTags(folder, type);
- allTags.addAll(Arrays.asList(tags));
- }
- // Exclude the tags for the seedFolder
- CVSTag[] tags = SingleFolderTagSource.getTags(seedFolder, type);
- allTags.removeAll(Arrays.asList(tags));
- return (CVSTag[]) allTags.toArray(new CVSTag[allTags.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
deleted file mode 100644
index 67f016b55..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-
-/**
- * A tag source for multiple folders.
- *
- * TODO: Temporarily a subclass of single folder until I
- * can figure out how to handle the multi-folder case.
- */
-public class MultiFolderTagSource extends SingleFolderTagSource {
-
- private final ICVSFolder[] folders;
-
- /* package */ MultiFolderTagSource(ICVSFolder[] folders) {
- super(folders[0]);
- this.folders = folders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.SingleFolderTagSource#getShortDescription()
- */
- public String getShortDescription() {
- return NLS.bind(CVSUIMessages.MultiFolderTagSource_0, new String[] { Integer.toString(folders.length) });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- Set tags= new HashSet();
- for (int i= 0; i < folders.length; i++) {
- tags.addAll(Arrays.asList(getTags(folders[i], type)));
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.SingleFolderTagSource#refresh(boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask("", folders.length); //$NON-NLS-1$
- Set result= new HashSet();
- for (int i= 0; i < folders.length; i++) {
- ICVSFolder folder= folders[i];
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().refreshDefinedTags(folder, bestEffort /* recurse */, true /* notify */, Policy.subMonitorFor(monitor, 1));
- result.addAll(Arrays.asList(tags));
- }
- monitor.done();
- fireChange();
- return (CVSTag[]) result.toArray(new CVSTag[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.SingleFolderTagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return folders;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java
deleted file mode 100644
index 6b7856060..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-
-/**
- * A tag source for a single ICVSFile
- */
-public class SingleFileTagSource extends TagSource {
-
- public static CVSTag[] fetchTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException {
- Set tagSet = new HashSet();
- ILogEntry[] entries = file.getLogEntries(monitor);
- for (int j = 0; j < entries.length; j++) {
- CVSTag[] tags = entries[j].getTags();
- for (int k = 0; k < tags.length; k++) {
- tagSet.add(tags[k]);
- }
- }
- return (CVSTag[])tagSet.toArray(new CVSTag[tagSet.size()]);
- }
-
- private ICVSFile file;
- private TagSource parentFolderTagSource;
-
- /* package */ /**
- *
- */
- public SingleFileTagSource(ICVSFile file) {
- this.file = file;
- parentFolderTagSource = TagSource.create(new ICVSResource[] { file.getParent() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- return parentFolderTagSource.getTags(type);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- CVSTag[] tags = fetchTagsFor(file, monitor);
- commit(tags, false, monitor);
- fireChange();
- return tags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- ICVSRepositoryLocation location = mgr.getRepositoryLocationFor(file);
- return location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return file.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- parentFolderTagSource.commit(tags, replace, monitor);
- fireChange();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return new ICVSResource[] { file };
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
deleted file mode 100644
index 74fd553b4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A tag source that returns the tags associated with a single remote folder
- */
-public class SingleFolderTagSource extends TagSource {
-
- public static CVSTag[] getTags(ICVSFolder folder, int type) {
- if (type == CVSTag.HEAD)
- return new CVSTag[] { CVSTag.DEFAULT } ;
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(folder, type);
- }
-
- private ICVSFolder folder;
-
- /* package */ SingleFolderTagSource(ICVSFolder folder) {
- this.folder = folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- return getTags(getFolder(), type);
- }
-
- /**
- * Return the folder the tags are obtained from
- * @return the folder the tags are obtained from
- */
- public ICVSFolder getFolder() {
- return folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().refreshDefinedTags(getFolder(), bestEffort /* recurse */, true /* notify */, monitor);
- fireChange();
- return tags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- ICVSRepositoryLocation location = mgr.getRepositoryLocationFor(getFolder());
- return location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return getFolder().getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(final CVSTag[] tags, final boolean replace, IProgressMonitor monitor) throws CVSException {
- try {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = getFolder();
- if (replace) {
- CVSTag[] oldTags = manager.getKnownTags(folder);
- manager.removeTags(folder, oldTags);
- }
- manager.addTags(folder, tags);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore
- }
- fireChange();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- final ICVSResource[][] resources = new ICVSResource[][] { null };
- try {
- getRunnableContext().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = folder.fetchChildren(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- return resources[0];
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(CVSException.wrapException(e));
- } catch (InterruptedException e) {
- // Ignore
- }
- return new ICVSResource[] { folder };
- }
-
- private IRunnableContext getRunnableContext() {
- return PlatformUI.getWorkbench().getProgressService();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
deleted file mode 100644
index b27a18986..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-
-public class TagAsVersionDialog extends DetailsDialog {
-
- private static final int TAG_AREA_HEIGHT_HINT = 200;
-
- private ITagOperation operation;
-
- private Text tagText;
- private Button moveTagButton;
-
- private String tagName = ""; //$NON-NLS-1$
- private boolean moveTag = false;
-
- private TagSource tagSource;
-
- private TagSelectionArea tagArea;
-
- public TagAsVersionDialog(Shell parentShell, String title, ITagOperation operation) {
- super(parentShell, title);
- this.tagSource = operation.getTagSource();
- this.operation = operation;
- }
-
- /**
- * @see DetailsDialog#createMainDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite parent) {
-
- final int width= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH + 50);
-
- final Label label = SWTUtils.createLabel(parent, CVSUIMessages.TagAction_enterTag);
- label.setLayoutData(SWTUtils.createGridData(width, SWT.DEFAULT, true, false));
-
- tagText = new Text(parent, SWT.SINGLE | SWT.BORDER);
- tagText.setLayoutData(SWTUtils.createHFillGridData());
- tagText.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- tagName = tagText.getText();
- updateEnablements();
- }
- }
- );
-
- moveTagButton= SWTUtils.createCheckBox(parent, CVSUIMessages.TagAction_moveTag);
- moveTagButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- moveTag = moveTagButton.getSelection();
- }
- });
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IHelpContextIds.TAG_AS_VERSION_DIALOG;
- }
-
- public boolean shouldMoveTag() {
- return moveTag;
- }
-
- /**
- * @see DetailsDialog#createDropDownDialogArea(Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
-
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DIALOG));
-
- final GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = TAG_AREA_HEIGHT_HINT;
- composite.setLayoutData(gridData);
-
- tagArea = new TagSelectionArea(getShell(), tagSource, TagSelectionArea.INCLUDE_VERSIONS, null);
- tagArea.setTagAreaLabel(CVSUIMessages.TagAction_existingVersions);
- tagArea.setIncludeFilterInputArea(false);
- tagArea.createArea(composite);
- tagArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) {
- CVSTag tag = tagArea.getSelection();
- if (tag != null) {
- tagText.setText(tag.getName());
- }
- } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- CVSTag tag = tagArea.getSelection();
- if (tag != null) {
- tagText.setText(tag.getName());
- okPressed();
- }
- }
- }
- });
- return composite;
- }
-
- /**
- * Validates tag name
- */
- protected void updateEnablements() {
- String message = null;
- if(tagName.length() == 0) {
- message = ""; //$NON-NLS-1$
- } else {
- IStatus status = CVSTag.validateTagName(tagName);
- if (!status.isOK()) {
- message = status.getMessage();
- }
- }
- setPageComplete(message == null);
- setErrorMessage(message);
- if (tagArea != null) {
- tagArea.setFilter(tagName);
- }
- }
-
- /**
- * Returns the tag name entered into this dialog
- */
- public String getTagName() {
- return tagName;
- }
-
- /**
- * @return
- */
- public ITagOperation getOperation() {
- operation.setTag(new CVSTag(tagName, CVSTag.VERSION));
- if (moveTag) {
- operation.moveTag();
- }
- return operation;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
- */
- protected boolean isMainGrabVertical() {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
deleted file mode 100644
index 9524bb979..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter.ProjectElementComparator;
-import org.eclipse.ui.PlatformUI;
-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 TrayDialog {
-
- // show the resource contained within the roots
- private TreeViewer cvsResourceTree;
-
- // shows the tags found on the selected resources
- private CheckboxTableViewer cvsTagTree;
-
- // shows the defined tags for the given root
- private TreeViewer cvsDefinedTagsTree;
-
- // remember the root element in the defined tags tree
- private TagSourceWorkbenchAdapter cvsDefinedTagsRootElement;
-
- // list of auto-refresh files
- private org.eclipse.swt.widgets.List autoRefreshFileList;
-
- // enable selecting auto-refresh files
- private boolean allowSettingAutoRefreshFiles = true;
-
- // preference keys
- private final String ALLOWREFRESH_WIDTH_KEY = "AllowRefreshWidth"; //$NON-NLS-1$
- private final String ALLOWREFRESH_HEIGHT_KEY = "AllowRefreshHeight"; //$NON-NLS-1$
- private final String NOREFRESH_WIDTH_KEY = "NoRefreshWidth"; //$NON-NLS-1$
- private final String NOREFRESH_HEIGHT_KEY = "NoRefreshHeight"; //$NON-NLS-1$
-
- // buttons
- private Button addSelectedTagsButton;
- private Button addSelectedFilesButton;
- private Button removeFileButton;
- private Button removeTagButton;
-
- // dialogs settings that are persistent between workbench sessions
- private IDialogSettings settings;
-
- private final TagSource tagSource;
-
- private final TagSourceWrapper wrappedTagSource;
-
- class FileComparator extends ViewerComparator {
- public int compare(Viewer viewer, Object e1, Object e2) {
- boolean oneIsFile = e1 instanceof CVSFileElement;
- boolean twoIsFile = e2 instanceof CVSFileElement;
- if (oneIsFile != twoIsFile) {
- return oneIsFile ? 1 : -1;
- }
- return super.compare(viewer, e1, e2);
- }
- }
-
- /*
- * Create a tag source that cahces the added and removed tags
- * so that the changes can be propogated to the repository
- * manager when OK is pressed
- */
- class TagSourceWrapper extends TagSource {
-
- private final TagSource tagSource;
- private final List branches = new ArrayList();
- private final List versions = new ArrayList();
- private final List dates = new ArrayList();
-
- public TagSourceWrapper(TagSource tagSource) {
- this.tagSource = tagSource;
- branches.addAll(Arrays.asList(tagSource.getTags(CVSTag.BRANCH)));
- versions.addAll(Arrays.asList(tagSource.getTags(CVSTag.VERSION)));
- dates.addAll(Arrays.asList(tagSource.getTags(CVSTag.DATE)));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- List list = getTagList(type);
- if (list != null)
- return (CVSTag[]) list.toArray(new CVSTag[list.size()]);
- return tagSource.getTags(type);
- }
-
- private List getTagList(int type) {
- switch (type) {
- case CVSTag.VERSION:
- return versions;
- case CVSTag.BRANCH:
- return branches;
- case CVSTag.DATE:
- return dates;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- // The wrapper is never refreshed
- return new CVSTag[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- return tagSource.getLocation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return tagSource.getShortDescription();
- }
-
- public void remove(CVSTag[] tags) {
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- List list = getTagList(tag.getType());
- if (list != null)
- list.remove(tag);
- }
- }
-
- public void add(CVSTag[] tags) {
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- List list = getTagList(tag.getType());
- if (list != null)
- list.add(tag);
- }
- }
-
- public void removeAll() {
- versions.clear();
- branches.clear();
- dates.clear();
- }
-
- /**
- * Remember the state that has been accumulated
- * @param monitor
- * @throws CVSException
- */
- public void commit(IProgressMonitor monitor) throws CVSException {
- tagSource.commit(getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE }), true /* replace */, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- // Not invoked
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return tagSource.getCVSResources();
- }
- }
-
- public TagConfigurationDialog(Shell shell, TagSource tagSource) {
- super(shell);
- this.tagSource = tagSource;
- wrappedTagSource = new TagSourceWrapper(tagSource);
- setShellStyle(SWT.CLOSE|SWT.RESIZE|SWT.APPLICATION_MODAL);
- allowSettingAutoRefreshFiles = getSingleFolder(tagSource, false) != null;
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("TagConfigurationDialog");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("TagConfigurationDialog");//$NON-NLS-1$
- }
- }
-
- /**
- * @see Window#configureShell(Shell)
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(NLS.bind(CVSUIMessages.TagConfigurationDialog_1, new String[] { tagSource.getShortDescription() }));
- }
-
- /**
- * @see Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite shell = new Composite(parent, SWT.NONE);
- GridData data = new GridData (GridData.FILL_BOTH);
- shell.setLayoutData(data);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- shell.setLayout (gridLayout);
-
- Composite comp = new Composite(shell, SWT.NULL);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- comp.setLayout(gridLayout);
- comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label cvsResourceTreeLabel = new Label(comp, SWT.NONE);
- cvsResourceTreeLabel.setText(CVSUIMessages.TagConfigurationDialog_5);
- data = new GridData();
- data.horizontalSpan = 1;
- cvsResourceTreeLabel.setLayoutData(data);
-
- Tree tree = new Tree(comp, SWT.BORDER | SWT.MULTI);
- cvsResourceTree = new TreeViewer (tree);
- cvsResourceTree.setContentProvider(new RemoteContentProvider());
- cvsResourceTree.setLabelProvider(new WorkbenchLabelProvider());
- data = new GridData (GridData.FILL_BOTH);
- data.heightHint = 150;
- data.horizontalSpan = 1;
- cvsResourceTree.getTree().setLayoutData(data);
- cvsResourceTree.setComparator(new FileComparator());
- cvsResourceTree.setInput(TagSourceResourceAdapter.getViewerInput(tagSource));
- cvsResourceTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateShownTags();
- updateEnablements();
- }
- });
-
- comp = new Composite(shell, SWT.NULL);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- comp.setLayout(gridLayout);
- comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label cvsTagTreeLabel = new Label(comp, SWT.NONE);
- cvsTagTreeLabel.setText(CVSUIMessages.TagConfigurationDialog_6);
- data = new GridData();
- data.horizontalSpan = 1;
- cvsTagTreeLabel.setLayoutData(data);
-
- final Table table = new Table(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 150;
- data.horizontalSpan = 1;
- table.setLayoutData(data);
- cvsTagTree = new CheckboxTableViewer(table);
- cvsTagTree.setContentProvider(new WorkbenchContentProvider());
- cvsTagTree.setLabelProvider(new WorkbenchLabelProvider());
- cvsTagTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
-
- Composite selectComp = new Composite(comp, SWT.NONE);
- GridLayout selectLayout = new GridLayout(2, true);
- selectLayout.marginHeight = selectLayout.marginWidth = 0;
- selectComp.setLayout(selectLayout);
- selectComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button selectAllButton = new Button(selectComp, SWT.PUSH);
- selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- selectAllButton.setText(CVSUIMessages.ReleaseCommentDialog_selectAll);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int nItems = table.getItemCount();
- for (int j=0; j<nItems; j++)
- table.getItem(j).setChecked(true);
- }
- });
- Button deselectAllButton = new Button(selectComp, SWT.PUSH);
- deselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- deselectAllButton.setText(CVSUIMessages.ReleaseCommentDialog_deselectAll);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int nItems = table.getItemCount();
- for (int j=0; j<nItems; j++)
- table.getItem(j).setChecked(false);
- }
- });
-
- cvsTagTree.setComparator(new ViewerComparator() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e1 instanceof TagElement) || !(e2 instanceof TagElement)) return super.compare(viewer, e1, e2);
- CVSTag tag1 = ((TagElement)e1).getTag();
- CVSTag tag2 = ((TagElement)e2).getTag();
- int type1 = tag1.getType();
- int type2 = tag2.getType();
- if (type1 != type2) {
- return type1 - type2;
- }
- // Sort in reverse order so larger numbered versions are at the top
- return -tag1.compareTo(tag2);
- }
- });
-
- Composite rememberedTags = new Composite(shell, SWT.NONE);
- data = new GridData (GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- rememberedTags.setLayoutData(data);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- rememberedTags.setLayout (gridLayout);
-
- Label rememberedTagsLabel = new Label (rememberedTags, SWT.NONE);
- rememberedTagsLabel.setText (CVSUIMessages.TagConfigurationDialog_7);
- data = new GridData ();
- data.horizontalSpan = 2;
- rememberedTagsLabel.setLayoutData (data);
-
- tree = new Tree(rememberedTags, SWT.BORDER | SWT.MULTI);
- cvsDefinedTagsTree = new TreeViewer (tree);
- cvsDefinedTagsTree.setContentProvider(new WorkbenchContentProvider());
- cvsDefinedTagsTree.setLabelProvider(new WorkbenchLabelProvider());
- data = new GridData (GridData.FILL_BOTH);
- data.heightHint = 100;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- cvsDefinedTagsTree.getTree().setLayoutData(data);
- cvsDefinedTagsRootElement = new TagSourceWorkbenchAdapter(wrappedTagSource, TagSourceWorkbenchAdapter.INCLUDE_BRANCHES | TagSourceWorkbenchAdapter.INCLUDE_VERSIONS |TagSourceWorkbenchAdapter.INCLUDE_DATES);
- cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement);
- cvsDefinedTagsTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
- cvsDefinedTagsTree.setComparator(new ProjectElementComparator());
-
- 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 (CVSUIMessages.TagConfigurationDialog_8);
- data = getStandardButtonData(addSelectedTagsButton);
- data.horizontalAlignment = GridData.FILL;
- addSelectedTagsButton.setLayoutData(data);
- addSelectedTagsButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- rememberCheckedTags();
- updateShownTags();
- updateEnablements();
- }
- });
- Button addDatesButton = new Button(buttonComposite, SWT.PUSH);
- addDatesButton.setText(CVSUIMessages.TagConfigurationDialog_0);
- data = getStandardButtonData(addDatesButton);
- data.horizontalAlignment = GridData.FILL;
- addDatesButton.setLayoutData(data);
- addDatesButton.addListener(SWT.Selection, new Listener(){
- public void handleEvent(Event event){
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), tagSource.getLocation());
- addDateTagsSelected(dateTag);
- updateShownTags();
- updateEnablements();
- }
- });
- removeTagButton = new Button (buttonComposite, SWT.PUSH);
- removeTagButton.setText (CVSUIMessages.TagConfigurationDialog_9);
- data = getStandardButtonData(removeTagButton);
- data.horizontalAlignment = GridData.FILL;
- removeTagButton.setLayoutData(data);
- removeTagButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- deleteSelected();
- updateShownTags();
- updateEnablements();
- }
- });
-
- Button removeAllTags = new Button (buttonComposite, SWT.PUSH);
- removeAllTags.setText (CVSUIMessages.TagConfigurationDialog_10);
- data = getStandardButtonData(removeAllTags);
- data.horizontalAlignment = GridData.FILL;
- removeAllTags.setLayoutData(data);
- removeAllTags.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- removeAllKnownTags();
- updateShownTags();
- updateEnablements();
- }
- });
-
- if(allowSettingAutoRefreshFiles) {
- Label explanation = new Label(rememberedTags, SWT.WRAP);
- explanation.setText(CVSUIMessages.TagConfigurationDialog_11);
- data = new GridData ();
- data.horizontalSpan = 2;
- //data.widthHint = 300;
- explanation.setLayoutData(data);
-
- autoRefreshFileList = new org.eclipse.swt.widgets.List(rememberedTags, SWT.BORDER | SWT.MULTI);
- data = new GridData ();
- data.heightHint = 45;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- autoRefreshFileList.setLayoutData(data);
- try {
- autoRefreshFileList.setItems(CVSUIPlugin.getPlugin().getRepositoryManager().getAutoRefreshFiles(getSingleFolder(tagSource, false)));
- } catch (CVSException e) {
- autoRefreshFileList.setItems(new String[0]);
- CVSUIPlugin.log(e);
- }
- autoRefreshFileList.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- updateEnablements();
- }
- });
-
- Composite buttonComposite2 = new Composite(rememberedTags, SWT.NONE);
- data = new GridData ();
- data.verticalAlignment = GridData.BEGINNING;
- buttonComposite2.setLayoutData(data);
- gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- buttonComposite2.setLayout (gridLayout);
-
- addSelectedFilesButton = new Button (buttonComposite2, SWT.PUSH);
- addSelectedFilesButton.setText (CVSUIMessages.TagConfigurationDialog_12);
- 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 (CVSUIMessages.TagConfigurationDialog_13);
- 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();
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
-
- updateEnablements();
- Dialog.applyDialogFont(parent);
- return shell;
- }
-
- private void updateShownTags() {
- final CVSFileElement[] filesSelection = getSelectedFiles();
- final Set tags = new HashSet();
- if(filesSelection.length!=0) {
- try {
- CVSUIPlugin.runWithProgress(getShell(), true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(CVSUIMessages.TagConfigurationDialog_22, filesSelection.length);
- try {
- for (int i = 0; i < filesSelection.length; i++) {
- ICVSFile file = filesSelection[i].getCVSFile();
- tags.addAll(Arrays.asList(getTagsFor(file, Policy.subMonitorFor(monitor, 1))));
- }
- } catch (TeamException e) {
- // ignore the exception
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- // operation cancelled
- } catch (InvocationTargetException e) {
- // can't happen since we're ignoring all possible exceptions
- }
- cvsTagTree.getTable().removeAll();
- for (Iterator it = tags.iterator(); it.hasNext();) {
- CVSTag tag = (CVSTag) it.next();
- List knownTags = new ArrayList();
- knownTags.addAll(Arrays.asList(wrappedTagSource.getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE })));
- if(!knownTags.contains(tag)) {
- TagElement tagElem = new TagElement(tag);
- cvsTagTree.add(tagElem);
- cvsTagTree.setChecked(tagElem, true);
- }
- }
- }
- }
-
- private CVSFileElement[] getSelectedFiles() {
- IStructuredSelection selection = (IStructuredSelection)cvsResourceTree.getSelection();
- if (!selection.isEmpty()) {
- final List filesSelection = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof CVSFileElement) {
- filesSelection.add(o);
- }
- }
- return (CVSFileElement[]) filesSelection.toArray(new CVSFileElement[filesSelection.size()]);
- }
- return new CVSFileElement[0];
- }
-
- private void addSelectionToAutoRefreshList() {
- IStructuredSelection selection = (IStructuredSelection)cvsResourceTree.getSelection();
- if (!selection.isEmpty()) {
- final List filesSelection = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof CVSFileElement) {
- filesSelection.add(o);
- }
- }
- if(!filesSelection.isEmpty()) {
- for (it = filesSelection.iterator(); it.hasNext();) {
- try {
- ICVSFile file = ((CVSFileElement)it.next()).getCVSFile();
- ICVSFolder fileParent = file.getParent();
- String filePath = new Path(null, fileParent.getFolderSyncInfo().getRepository())
- .append(file.getRelativePath(fileParent)).toString();
- if(autoRefreshFileList.indexOf(filePath)==-1) {
- autoRefreshFileList.add(filePath);
- }
- } catch(CVSException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- }
- }
- }
- }
- }
-
- private CVSTag[] getTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException {
- return SingleFileTagSource.fetchTagsFor(file, monitor);
- }
-
- private void rememberCheckedTags() {
- Object[] checked = cvsTagTree.getCheckedElements();
- List tagsToAdd = new ArrayList();
- for (int i = 0; i < checked.length; i++) {
- CVSTag tag = ((TagElement)checked[i]).getTag();
- tagsToAdd.add(tag);
- }
- if (!tagsToAdd.isEmpty()) {
- wrappedTagSource.add((CVSTag[]) tagsToAdd.toArray(new CVSTag[tagsToAdd.size()]));
- cvsDefinedTagsTree.refresh();
- }
- }
-
- private void deleteSelected() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
- List tagsToRemove = new ArrayList();
- if (!selection.isEmpty()) {
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof TagElement) {
- CVSTag tag = ((TagElement)o).getTag();
- tagsToRemove.add(tag);
- }
- }
- }
- if (!tagsToRemove.isEmpty()) {
- wrappedTagSource.remove((CVSTag[]) tagsToRemove.toArray(new CVSTag[tagsToRemove.size()]));
- cvsDefinedTagsTree.refresh();
- cvsDefinedTagsTree.getTree().setFocus();
- }
- }
- private void addDateTagsSelected(CVSTag tag){
- if(tag == null) return;
- List knownTags = new ArrayList();
- knownTags.addAll(Arrays.asList(wrappedTagSource.getTags(CVSTag.DATE)));
- if(!knownTags.contains( tag)){
- wrappedTagSource.add(new CVSTag[] { tag });
- cvsDefinedTagsTree.refresh();
- cvsDefinedTagsTree.getTree().setFocus();
- }
- }
- private boolean isTagSelectedInKnownTagTree() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
- if (!selection.isEmpty()) {
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof TagElement) {
- return true;
- }
- }
- }
- return false;
- }
-
- private void removeAllKnownTags() {
- wrappedTagSource.removeAll();
- cvsDefinedTagsTree.refresh();
- }
-
- private void updateEnablements() {
- // add checked tags
- Object[] checked = cvsTagTree.getCheckedElements();
- addSelectedTagsButton.setEnabled(checked.length!=0?true:false);
-
- // Remove known tags
- removeTagButton.setEnabled(isTagSelectedInKnownTagTree()?true:false);
-
- if(allowSettingAutoRefreshFiles) {
- // add selected files
- addSelectedFilesButton.setEnabled(getSelectedFiles().length!=0?true:false);
-
- // remove auto refresh files
- removeFileButton.setEnabled(autoRefreshFileList.getSelection().length!=0?true:false);
- }
- }
-
- /**
- * @see Dialog#okPressed()
- */
- protected void okPressed() {
- try {
- // save auto refresh file names
- if(allowSettingAutoRefreshFiles) {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.setAutoRefreshFiles(getSingleFolder(tagSource, false), autoRefreshFileList.getItems());
- }
-
- wrappedTagSource.commit(null);
-
- super.okPressed();
- } catch (CVSException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- }
- }
-
- protected ICVSFolder getSingleFolder(TagSource tagSource, boolean bestEffort) {
- if (!bestEffort && tagSource instanceof MultiFolderTagSource)
- return null;
- if (tagSource instanceof SingleFolderTagSource)
- return ((SingleFolderTagSource)tagSource).getFolder();
- return null;
- }
-
- /**
- * @see Window#getInitialSize()
- */
- protected Point getInitialSize() {
- int width, height;
- if(allowSettingAutoRefreshFiles) {
- try {
- height = settings.getInt(ALLOWREFRESH_HEIGHT_KEY);
- width = settings.getInt(ALLOWREFRESH_WIDTH_KEY);
- } catch(NumberFormatException e) {
- return super.getInitialSize();
- }
- } else {
- try {
- height = settings.getInt(NOREFRESH_HEIGHT_KEY);
- width = settings.getInt(NOREFRESH_WIDTH_KEY);
- } catch(NumberFormatException e) {
- return super.getInitialSize();
- }
- }
- return new Point(width, height);
- }
-
- /**
- * @see Dialog#cancelPressed()
- */
- protected void cancelPressed() {
- super.cancelPressed();
- }
-
- private GridData getStandardButtonData(Button button) {
- GridData data = new GridData();
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- //don't crop labels with large font
- //int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- //data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- return data;
- }
-
- /**
- * @see Window#close()
- */
- public boolean close() {
- // Close the tray so we only remember the size without the tray
- if (getTray() != null)
- closeTray();
- Rectangle bounds = getShell().getBounds();
- if(allowSettingAutoRefreshFiles) {
- settings.put(ALLOWREFRESH_HEIGHT_KEY, bounds.height);
- settings.put(ALLOWREFRESH_WIDTH_KEY, bounds.width);
- } else {
- settings.put(NOREFRESH_HEIGHT_KEY, bounds.height);
- settings.put(NOREFRESH_WIDTH_KEY, bounds.width);
- }
- return super.close();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
deleted file mode 100644
index af9f805af..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.contentassist.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.contentassist.*;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.ui.contentassist.ContentAssistHandler;
-
-/**
- * A content assist processor for tags for use with Text widgets.
- */
-public class TagContentAssistProcessor implements ISubjectControlContentAssistProcessor {
-
- private FilteredTagList tags;
- private Map images = new HashMap();
-
- public static void createContentAssistant(Text text, TagSource tagSource, int includeFlags) {
- final TagContentAssistProcessor tagContentAssistProcessor = new TagContentAssistProcessor(tagSource, includeFlags);
- text.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- tagContentAssistProcessor.dispose();
- }
- });
- ContentAssistHandler.createHandlerForText(text, createSubjectContentAssistant(tagContentAssistProcessor));
- }
-
- private static SubjectControlContentAssistant createSubjectContentAssistant(IContentAssistProcessor processor) {
- final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant();
-
- contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
-
- //ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore());
-
- contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- });
-
- return contentAssistant;
- }
-
- public TagContentAssistProcessor(TagSource tagSource, int includeFlags) {
- tags = new FilteredTagList(tagSource, TagSource.convertIncludeFlaqsToTagTypes(includeFlags));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.contentassist.IContentAssistSubjectControl, int)
- */
- public ICompletionProposal[] computeCompletionProposals(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
- Control c = contentAssistSubjectControl.getControl();
- int docLength = contentAssistSubjectControl.getDocument().getLength();
- if (c instanceof Text) {
- Text t = (Text)c;
- String filter = t.getText();
- tags.setPattern(filter);
- CVSTag[] matching = tags.getMatchingTags();
- if (matching.length > 0) {
- List proposals = new ArrayList();
- for (int i = 0; i < matching.length; i++) {
- CVSTag tag = matching[i];
- String name = tag.getName();
- ImageDescriptor desc = TagElement.getImageDescriptor(tag);
- Image image = null;
- if (desc != null) {
- image = (Image)images.get(desc);
- if (image == null) {
- image = desc.createImage();
- images.put(desc, image);
- }
- }
- CompletionProposal proposal = new CompletionProposal(name, 0, docLength, name.length(), image, name, null, null);
- proposals.add(proposal);
- }
- return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeContextInformation(org.eclipse.jface.contentassist.IContentAssistSubjectControl, int)
- */
- public IContextInformation[] computeContextInformation(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- Assert.isTrue(false, "ITextViewer not supported"); //$NON-NLS-1$
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- /**
- * Dispose of any images created by the assistant
- */
- public void dispose() {
- for (Iterator iter = images.values().iterator(); iter.hasNext();) {
- Image image = (Image) iter.next();
- image.dispose();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
deleted file mode 100644
index 47ca30f3f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.Date;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class TagElement implements IWorkbenchAdapter, IAdaptable {
- Object parent;
- CVSTag tag;
-
- public static ImageDescriptor getImageDescriptor(CVSTag tag) {
- if (tag.getType() == CVSTag.BRANCH || tag.equals(CVSTag.DEFAULT)) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_TAG);
- } else if (tag.getType() == CVSTag.DATE){
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATE);
- }else {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
- }
- }
-
- /**
- * @deprecated
- * @param tag
- */
- public TagElement(CVSTag tag) {
- this(null, tag);
- }
- public TagElement(Object parent, CVSTag tag) {
- this.parent = parent;
- this.tag = tag;
- }
- public Object[] getChildren(Object o) {
- return new Object[0];
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- return getImageDescriptor(tag);
- }
- public String getLabel(Object o) {
- if(tag.getType() == CVSTag.DATE){
- Date date = tag.asDate();
- if (date != null){
- return CVSTagElement.toDisplayString(date);
- }
- }
- return tag.getName();
- }
- public Object getParent(Object o) {
- return parent;
- }
- public CVSTag getTag() {
- return tag;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return tag.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof TagElement) {
- return tag.equals(((TagElement)obj).getTag());
- }
- return super.equals(obj);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
deleted file mode 100644
index f6eb88758..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * An area that displays the Refresh and Configure Tags buttons
- */
-public class TagRefreshButtonArea extends DialogArea {
-
- private TagSource tagSource;
- private final Shell shell;
- private Button refreshButton;
- private IRunnableContext context;
- private Label fMessageLabel;
- private final Listener addDateTagListener;
-
- public TagRefreshButtonArea(Shell shell, TagSource tagSource, Listener addDateTagListener) {
- this.addDateTagListener = addDateTagListener;
- Assert.isNotNull(shell);
- Assert.isNotNull(tagSource);
- this.shell = shell;
- this.tagSource = tagSource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
-
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
-
- final Composite buttonComp = new Composite(parent, SWT.NONE);
- buttonComp.setLayoutData(SWTUtils.createHFillGridData());//SWT.DEFAULT, SWT.DEFAULT, SWT.END, SWT.TOP, false, false));
- buttonComp.setLayout(SWTUtils.createGridLayout(4, converter, SWTUtils.MARGINS_NONE));
-
- fMessageLabel= SWTUtils.createLabel(buttonComp, null);
- refreshButton = new Button(buttonComp, SWT.PUSH);
- refreshButton.setText (CVSUIMessages.TagConfigurationDialog_20);
-
- final Button configureTagsButton = new Button(buttonComp, SWT.PUSH);
- configureTagsButton.setText (CVSUIMessages.TagConfigurationDialog_21);
-
- Button addDateTagButton = null;
- int buttonWidth;
- if (addDateTagListener != null) {
- addDateTagButton = new Button(buttonComp, SWT.PUSH);
- addDateTagButton.setText (CVSUIMessages.TagConfigurationDialog_AddDateTag);
- Dialog.applyDialogFont(buttonComp);
- buttonWidth= SWTUtils.calculateControlSize(converter, new Button [] { addDateTagButton, configureTagsButton, refreshButton });
- addDateTagButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
- addDateTagButton.addListener(SWT.Selection, addDateTagListener);
- } else {
- Dialog.applyDialogFont(buttonComp);
- buttonWidth= SWTUtils.calculateControlSize(converter, new Button [] { configureTagsButton, refreshButton });
- }
-
- refreshButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
- configureTagsButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
-
- refreshButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- refresh(false);
- }
- });
-
- configureTagsButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
- d.open();
- }
- });
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(refreshButton, IHelpContextIds.TAG_CONFIGURATION_REFRESHACTION);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(configureTagsButton, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
- Dialog.applyDialogFont(buttonComp);
- }
-
-
- public void refresh(final boolean background) {
- try {
- getRunnableContext().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- setBusy(true);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- fMessageLabel.setText(CVSUIMessages.TagRefreshButtonArea_6);
- }
- });
- monitor.beginTask(CVSUIMessages.TagRefreshButtonArea_5, 100);
- final CVSTag[] tags = tagSource.refresh(false, Policy.subMonitorFor(monitor, 70));
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- fMessageLabel.setText(background && tags.length == 0 ? CVSUIMessages.TagRefreshButtonArea_7 : ""); //$NON-NLS-1$
- }
- });
- if (!background && tags.length == 0 && promptForBestEffort()) {
- tagSource.refresh(true, Policy.subMonitorFor(monitor, 30));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- setBusy(false);
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- // operation cancelled
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(shell, CVSUIMessages.TagConfigurationDialog_14, null, e);
- }
- }
-
- private void setBusy(final boolean busy) {
- if (shell != null && !shell.isDisposed())
- shell.getDisplay().asyncExec(new Runnable() {
- public void run() {
- refreshButton.setEnabled(!busy);
- }
- });
- }
-
- private boolean promptForBestEffort() {
- final boolean[] prompt = new boolean[] { false };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(shell, CVSUIMessages.TagRefreshButtonArea_0, null,
- getNoTagsFoundMessage(),
- MessageDialog.INFORMATION,
- new String[] {
- CVSUIMessages.TagRefreshButtonArea_1,
- CVSUIMessages.TagRefreshButtonArea_2,
- CVSUIMessages.TagRefreshButtonArea_3
- }, 1);
- int code = dialog.open();
- if (code == 0) {
- prompt[0] = true;
- } else if (code == 1) {
- TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
- d.open();
- }
-
- }
- });
- return prompt[0];
- }
-
- private String getNoTagsFoundMessage() {
- return NLS.bind(CVSUIMessages.TagRefreshButtonArea_4, new String[] { tagSource.getShortDescription() });
- }
-
- public void setTagSource(TagSource tagSource) {
- Assert.isNotNull(tagSource);
- this.tagSource = tagSource;
- }
-
- public IRunnableContext getRunnableContext() {
- if (context == null)
- return PlatformUI.getWorkbench().getProgressService();
- return context;
- }
-
- public void setRunnableContext(IRunnableContext context) {
- this.context = context;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
deleted file mode 100644
index 94bbe082b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Workbench model element that contains a list of tags
- * of the same type (BRANCH, VERSION or DATE).
- */
-public class TagRootElement implements IWorkbenchAdapter, IAdaptable {
- private TagSource tagSource;
- private int typeOfTagRoot;
- private final Object parent;
-
- public TagRootElement(Object parent, TagSource tagSource, int typeOfTagRoot) {
- this.parent = parent;
- this.typeOfTagRoot = typeOfTagRoot;
- this.tagSource = tagSource;
- }
-
- public Object[] getChildren(Object o) {
- CVSTag[] childTags = tagSource.getTags(typeOfTagRoot);
- TagElement[] result = new TagElement[childTags.length];
- for (int i = 0; i < childTags.length; i++) {
- result[i] = new TagElement(this, childTags[i]);
- }
- return result;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- if(typeOfTagRoot==CVSTag.BRANCH) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY);
- } else if(typeOfTagRoot==CVSTag.DATE){
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
- }else {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY);
- }
- }
- public String getLabel(Object o) {
- if(typeOfTagRoot==CVSTag.BRANCH) {
- return CVSUIMessages.MergeWizardEndPage_branches;
- } else if(typeOfTagRoot==CVSTag.DATE){
- return CVSUIMessages.TagRootElement_0;
- }else {
- return CVSUIMessages.VersionsElement_versions;
- }
- }
- public Object getParent(Object o) {
- return parent;
- }
- /**
- * Gets the typeOfTagRoot.
- * @return Returns a int
- */
- public int getTypeOfTagRoot() {
- return typeOfTagRoot;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
deleted file mode 100644
index 7db11ca01..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
+++ /dev/null
@@ -1,658 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak <brockj@tpg.com.au> - Bug 182267 "Add Date..." button shouldn't be visible in merge wizard
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter.ProjectElementComparator;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * A dialog area that displays a list of tags for selection and supports
- * filtering of the displayed tags.
- */
-public class TagSelectionArea extends DialogArea {
-
- private static int COLUMN_TRIM = "carbon".equals(SWT.getPlatform()) ? 24 : 3; //$NON-NLS-1$
-
- private static int ICON_WIDTH = 40;
-
- /*
- * Please see bug 184660
- */
- private static final int SAFETY_MARGIN = 50;
-
- /*
- * Property constant which identifies the selected tag or
- * null if no tag is selected
- */
- public static final String SELECTED_TAG = "selectedTag"; //$NON-NLS-1$
-
- /*
- * Property constant which indicates that a tag has been selected in such
- * a way as to indicate that this is the desired tag (e.g double-click)
- */
- public static final String OPEN_SELECTED_TAG = "openSelectedTag"; //$NON-NLS-1$
-
- /*
- * Constants used to configure which tags are shown
- */
- public static final int INCLUDE_HEAD_TAG = TagSourceWorkbenchAdapter.INCLUDE_HEAD_TAG;
- public static final int INCLUDE_BASE_TAG = TagSourceWorkbenchAdapter.INCLUDE_BASE_TAG;
- public static final int INCLUDE_BRANCHES = TagSourceWorkbenchAdapter.INCLUDE_BRANCHES;
- public static final int INCLUDE_VERSIONS = TagSourceWorkbenchAdapter.INCLUDE_VERSIONS;
- public static final int INCLUDE_DATES = TagSourceWorkbenchAdapter.INCLUDE_DATES;
- public static final int INCLUDE_ALL_TAGS = TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS;
-
- private String tagAreaLabel;
- private final int includeFlags;
- private CVSTag selection;
- private String helpContext;
- private Text filterText;
- private TagSource tagSource;
- private final Shell shell;
- private TagRefreshButtonArea tagRefreshArea;
- private final TagSource.ITagSourceChangeListener listener = new TagSource.ITagSourceChangeListener() {
- public void tagsChanged(TagSource source) {
- Shell shell = getShell();
- if (!shell.isDisposed()) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
- }
- };
- private final DisposeListener disposeListener = new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (tagSource != null)
- tagSource.removeListener(listener);
- }
- };
-
- private PageBook switcher;
- private TreeViewer tagTree;
- private TableViewer tagTable;
- private boolean treeVisible = true;
- private boolean includeFilterInputArea = true;
- private String filterPattern = ""; //$NON-NLS-1$
-
- private IRunnableContext context;
-
- public TagSelectionArea(Shell shell, TagSource tagSource, int includeFlags, String helpContext) {
- this.shell = shell;
- this.includeFlags = includeFlags;
- this.helpContext = helpContext;
- this.tagSource = tagSource;
- setSelection(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- initializeDialogUnits(parent);
- Dialog.applyDialogFont(parent);
- final PixelConverter converter= new PixelConverter(parent);
-
- // Create a composite for the entire area
- Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayoutData(SWTUtils.createHVFillGridData());
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
-
- // Add F1 help
- if (helpContext != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContext);
- }
-
- // Create the tree area and refresh buttons with the possibility to add stuff in between
- createTagDisplayArea(composite);
- createCustomArea(composite);
- createRefreshButtons(composite);
-
- Dialog.applyDialogFont(parent);
- updateTagDisplay(true);
- }
-
- private void createTagDisplayArea(Composite parent) {
- Composite inner = createGrabbingComposite(parent, 1);
- if (isIncludeFilterInputArea()) {
- createFilterInput(inner);
- createWrappingLabel(inner, CVSUIMessages.TagSelectionArea_0, 1);
- } else {
- createWrappingLabel(inner, NLS.bind(CVSUIMessages.TagSelectionArea_1, new String[] { getTagAreaLabel() }), 1);
- }
- switcher = new PageBook(inner, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 0;
- gridData.widthHint = 0;
- switcher.setLayoutData(gridData);
- tagTree = createTree(switcher);
- tagTable = createTable(switcher);
- }
-
- private void createFilterInput(Composite inner) {
- createWrappingLabel(inner, NLS.bind(CVSUIMessages.TagSelectionArea_2, new String[] { getTagAreaLabel() }), 1);
- filterText = createText(inner, 1);
- filterText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setFilter(filterText.getText());
- }
- });
- filterText.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ARROW_DOWN && e.stateMask == 0) {
- tagTable.getControl().setFocus();
- }
- }
- public void keyReleased(KeyEvent e) {
- // Ignore
- }
- });
- }
-
- /**
- * Return the label that should be used for the tag area.
- * It should not have any trailing punctuations as the tag area
- * may position it differently depending on whether the filter
- * text input is included in the area.
- * @return the tag area label
- */
- public String getTagAreaLabel() {
- if (tagAreaLabel == null)
- tagAreaLabel = CVSUIMessages.TagSelectionArea_3;
- return tagAreaLabel;
- }
-
- /**
- * Set the label that should be used for the tag area.
- * It should not have any trailing punctuations as the tag area
- * may position it differently depending on whether the filter
- * text input is included in the area.
- * @param tagAreaLabel the tag area label
- */
- public void setTagAreaLabel(String tagAreaLabel) {
- this.tagAreaLabel = tagAreaLabel;
- }
-
- /**
- * Update the tag display to show the tags that match the
- * include flags and the filter entered by the user.
- */
- protected void updateTagDisplay(boolean firstTime) {
- String filter = getFilterString();
- if ((filter != null && filter.length() > 0) || isTableOnly()) {
- // Show the table and filter it accordingly
- try {
- switcher.setRedraw(false);
- treeVisible = false;
- switcher.showPage(tagTable.getControl());
- FilteredTagList list = (FilteredTagList)tagTable.getInput();
- list.setPattern(filter);
- tagTable.refresh();
- int maxWidth = getMaxWidth(list.getChildren(null));
- if (maxWidth > 0) {
- maxWidth = maxWidth + ICON_WIDTH + COLUMN_TRIM + SAFETY_MARGIN; /* space for the tag icon */
- tagTable.getTable().getColumn(0).setWidth(maxWidth);
- }
- if (filterText == null || filter == null || filter.length() == 0) {
- setSelection(selection);
- } else {
- // Only set the top selection if there is a filter from the filter text
- // of this area. This is done to avoid selection loops
- selectTopElement();
- }
- } finally {
- switcher.setRedraw(true);
- }
- } else {
- // Show the tree
- if (!isTreeVisible() || firstTime) {
- try {
- switcher.setRedraw(false);
- treeVisible = true;
- switcher.showPage(tagTree.getControl());
- tagTree.refresh();
- setSelection(selection);
- } finally {
- switcher.setRedraw(true);
- }
- }
- }
- }
-
- private int getMaxWidth(Object[] children) {
- PixelConverter converter = new PixelConverter(tagTable.getTable());
- int maxWidth = 0;
- for (int i = 0; i < children.length; i++) {
- Object object = children[i];
- if (object instanceof TagElement) {
- TagElement tag = (TagElement) object;
- int width = tag.getTag().getName().length();
- if (width > maxWidth) {
- maxWidth = width;
- }
- }
- }
- return converter.convertWidthInCharsToPixels(maxWidth);
- }
-
- /**
- * Return whether only a table should be used
- * @return whether only a table should be used
- */
- protected boolean isTableOnly() {
- return (includeFlags == INCLUDE_VERSIONS) || (includeFlags == INCLUDE_BRANCHES);
- }
-
- private String getFilterString() {
- return filterPattern;
- }
-
- /*
- * Select the top element in the tag table
- */
- private void selectTopElement() {
- if (tagTable.getTable().getItemCount() > 0) {
- TableItem item = tagTable.getTable().getItem(0);
- tagTable.getTable().setSelection(new TableItem[] { item });
- tagTable.setSelection(tagTable.getSelection());
- }
- }
-
- private FilteredTagList createFilteredInput() {
- return new FilteredTagList(tagSource, TagSource.convertIncludeFlaqsToTagTypes(includeFlags));
- }
-
- private Text createText(Composite parent, int horizontalSpan) {
- Text text = new Text(parent, SWT.SEARCH);
- GridData data = new GridData();
- data.horizontalSpan = horizontalSpan;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint= 0;
- text.setLayoutData(data);
- return text;
- }
-
- protected void createRefreshButtons(Composite parent) {
- tagSource.addListener(listener);
- parent.addDisposeListener(disposeListener);
- Listener listener = null;
- if ((includeFlags & TagSourceWorkbenchAdapter.INCLUDE_DATES) != 0) {
- listener = new Listener() {
- public void handleEvent(Event event) {
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), getLocation());
- addDateTag(dateTag);
- }
- };
- }
- tagRefreshArea = new TagRefreshButtonArea(shell, tagSource, listener);
- if (context != null)
- tagRefreshArea.setRunnableContext(context);
- tagRefreshArea.createArea(parent);
- }
-
- protected void createTreeMenu(TreeViewer tagTree) {
- if ((includeFlags & TagSourceWorkbenchAdapter.INCLUDE_DATES) != 0) {
- // Create the popup menu
- MenuManager menuMgr = new MenuManager();
- Tree tree = tagTree.getTree();
- Menu menu = menuMgr.createContextMenu(tree);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addMenuItemActions(manager);
- }
-
- });
- menuMgr.setRemoveAllWhenShown(true);
- tree.setMenu(menu);
- }
- }
-
- /**
- * Create aq custom area that is below the tag selection area but above the refresh busson group
- * @param parent
- */
- protected void createCustomArea(Composite parent) {
- // No default custom area
- }
-
- protected TreeViewer createTree(Composite parent) {
- Tree tree = new Tree(parent, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- tree.setLayoutData(data);
- TreeViewer result = new TreeViewer(tree);
- initialize(result);
- result.getControl().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- handleKeyPressed(event);
- }
- public void keyReleased(KeyEvent event) {
- handleKeyReleased(event);
- }
- });
- result.setInput(createUnfilteredInput());
- createTreeMenu(result);
- return result;
- }
-
- protected TableViewer createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(data);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100));
- table.setLayout(layout);
- new TableColumn(table, SWT.NONE);
- TableViewer viewer = new TableViewer(table);
- initialize(viewer);
- viewer.setInput(createFilteredInput());
- return viewer;
-
- }
-
- private void initialize(StructuredViewer viewer) {
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setComparator(new ProjectElementComparator());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChange();
- }
- });
- // select and close on double click
- // To do: use defaultselection instead of double click
- viewer.getControl().addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- CVSTag tag = internalGetSelectedTag();
- if (tag != null) {
- firePropertyChangeChange(OPEN_SELECTED_TAG, null, tag);
- }
- }
- });
- }
-
- private Object createUnfilteredInput() {
- return TagSourceWorkbenchAdapter.createInput(tagSource, includeFlags);
- }
-
- public void handleKeyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- deleteDateTag();
- }
- }
- private void deleteDateTag() {
- TagElement[] selectedDateTagElements = getSelectedDateTagElement();
- if (selectedDateTagElements.length == 0) return;
- for(int i = 0; i < selectedDateTagElements.length; i++){
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- CVSTag tag = selectedDateTagElements[i].getTag();
- if(tag.getType() == CVSTag.DATE){
- mgr.removeDateTag(getLocation(),tag);
- }
- }
- tagTree.refresh();
- handleSelectionChange();
- }
-
- /**
- * Returns the selected date tag elements
- */
- private TagElement[] getSelectedDateTagElement() {
- ArrayList dateTagElements = null;
- IStructuredSelection selection = (IStructuredSelection)tagTree.getSelection();
- if (selection!=null && !selection.isEmpty()) {
- dateTagElements = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = TeamAction.getAdapter(elements.next(), TagElement.class);
- if (next instanceof TagElement) {
- if(((TagElement)next).getTag().getType() == CVSTag.DATE){
- dateTagElements.add(next);
- }
- }
- }
- }
- if (dateTagElements != null && !dateTagElements.isEmpty()) {
- TagElement[] result = new TagElement[dateTagElements.size()];
- dateTagElements.toArray(result);
- return result;
- }
- return new TagElement[0];
- }
- private void addDateTag(CVSTag tag){
- if(tag == null) return;
- List dateTags = new ArrayList();
- ICVSRepositoryLocation location = getLocation();
- dateTags.addAll(Arrays.asList(CVSUIPlugin.getPlugin().getRepositoryManager().getDateTags(location)));
- if(!dateTags.contains( tag)){
- CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(location, tag);
- }
- try {
- tagTree.getControl().setRedraw(false);
- tagTree.refresh();
- setSelection(tag);
- } finally {
- tagTree.getControl().setRedraw(true);
- }
- handleSelectionChange();
- }
- private void addMenuItemActions(IMenuManager manager) {
- manager.add(new Action(CVSUIMessages.TagSelectionDialog_0) {
- public void run() {
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), getLocation());
- addDateTag(dateTag);
- }
- });
- if(getSelectedDateTagElement().length > 0){
- manager.add(new Action(CVSUIMessages.TagSelectionDialog_1) {
- public void run() {
- deleteDateTag();
- }
- });
- }
- }
-
- protected void handleKeyReleased(KeyEvent event) {
- }
-
- /**
- * handle a selection change event from the visible tag display
- * (which could be either the table or the tree).
- */
- protected void handleSelectionChange() {
- CVSTag newSelection = internalGetSelectedTag();
- if (selection != null && newSelection != null && selection.equals(newSelection)) {
- // the selection hasn't change so return
- return;
- }
- CVSTag oldSelection = selection;
- selection = newSelection;
- firePropertyChangeChange(SELECTED_TAG, oldSelection, selection);
- }
-
- private CVSTag internalGetSelectedTag() {
- IStructuredSelection selection;
- if (isTreeVisible()) {
- selection = (IStructuredSelection)tagTree.getSelection();
- } else {
- selection = (IStructuredSelection)tagTable.getSelection();
- }
- Object o = selection.getFirstElement();
- if (o instanceof TagElement)
- return ((TagElement)o).getTag();
- return null;
- }
-
- private boolean isTreeVisible() {
- return treeVisible;
- }
-
- private ICVSRepositoryLocation getLocation(){
- return tagSource.getLocation();
- }
- public CVSTag getSelection() {
- return selection;
- }
- public Shell getShell() {
- return shell;
- }
-
- /**
- * Set the focus to the filter text widget
- */
- public void setFocus() {
- if (filterText != null)
- filterText.setFocus();
- else if (switcher != null)
- switcher.setFocus();
-
- // Refresh in case tags were added since the last time the area had focus
- refresh();
- }
-
- /**
- * Select the given tag
- * @param selectedTag the tag to be selected
- */
- public void setSelection(CVSTag selectedTag) {
- if (isTreeVisible())
- if (tagTree != null && !tagTree.getControl().isDisposed()) {
- // TODO: Hack to instantiate the model before revealing the selection
- tagTree.expandToLevel(2);
- tagTree.collapseAll();
- // Reveal the selection
- tagTree.reveal(new TagElement(selectedTag));
- tagTree.setSelection(new StructuredSelection(new TagElement(selectedTag)));
- }
- else
- if (tagTable != null && !tagTable.getControl().isDisposed()) {
- tagTable.setSelection(new StructuredSelection(new TagElement(selectedTag)));
- }
- }
-
- /**
- * Refresh the state of the tag selection area
- */
- public void refresh() {
- if (isTreeVisible()) {
- if (tagTree != null && !tagTree.getControl().isDisposed()) {
- tagTree.refresh();
- }
- } else {
- if (tagTable != null && !tagTable.getControl().isDisposed()) {
- tagTable.refresh();
- }
- }
- }
-
- public void refreshTagList() {
- tagRefreshArea.refresh(true);
- }
-
- /**
- * Set the enablement state of the area
- * @param enabled the enablement state
- */
- public void setEnabled(boolean enabled) {
- if (filterText != null)
- filterText.setEnabled(enabled);
- tagTree.getControl().setEnabled(enabled);
- tagTable.getControl().setEnabled(enabled);
- }
-
- /**
- * Set the tag source from which the displayed tags are determined
- * @param tagSource the source of the tags being displayed
- */
- public void setTagSource(TagSource tagSource) {
- if (this.tagSource != null) {
- this.tagSource.removeListener(listener);
- }
- this.tagSource = tagSource;
- this.tagSource.addListener(listener);
- tagRefreshArea.setTagSource(this.tagSource);
- setTreeAndTableInput();
- }
-
- private void setTreeAndTableInput() {
- if (tagTree != null) {
- tagTree.setInput(createUnfilteredInput());
- }
- if (tagTable != null) {
- tagTable.setInput(createFilteredInput());
- }
-
- }
-
- /**
- * Set whether the input filter text is to be included in the tag selection area.
- * If excluded, clientscan still set the filter text directly using
- * <code>setFilter</code>.
- * @param include whether filter text input should be included
- */
- public void setIncludeFilterInputArea(boolean include) {
- includeFilterInputArea = include;
- }
-
- /**
- * Return whether the input filter text is to be included in the tag selection area.
- * If excluded, clientscan still set the filter text directly using
- * <code>setFilter</code>.
- * @return whether filter text input should be included
- */
- public boolean isIncludeFilterInputArea() {
- return includeFilterInputArea;
- }
-
- /**
- * Set the text used to filter the tag list.
- * @param filter the filter pattern
- */
- public void setFilter(String filter) {
- this.filterPattern = filter;
- updateTagDisplay(false);
- }
-
- public void setRunnableContext(IRunnableContext context) {
- this.context = context;
- if (tagRefreshArea != null)
- tagRefreshArea.setRunnableContext(context);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java
deleted file mode 100644
index c7ae412b8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-
-/**
- * Dialog to prompt the user to choose a tag for a selected resource
- */
-public class TagSelectionDialog extends TrayDialog implements IPropertyChangeListener {
-
- private TagSelectionArea tagSelectionArea;
- private Cursor appBusyCursor;
-
- public static final int INCLUDE_HEAD_TAG = TagSourceWorkbenchAdapter.INCLUDE_HEAD_TAG;
- public static final int INCLUDE_BASE_TAG = TagSourceWorkbenchAdapter.INCLUDE_BASE_TAG;
- public static final int INCLUDE_BRANCHES = TagSourceWorkbenchAdapter.INCLUDE_BRANCHES;
- public static final int INCLUDE_VERSIONS = TagSourceWorkbenchAdapter.INCLUDE_VERSIONS;
- public static final int INCLUDE_DATES = TagSourceWorkbenchAdapter.INCLUDE_DATES;
- public static final int INCLUDE_ALL_TAGS = TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS;
-
- private Button okButton;
-
- // dialog title, should indicate the action in which the tag selection
- // dialog is being shown
- private String title;
-
- private boolean recurse = true;
-
- // constants
- private static final int SIZING_DIALOG_WIDTH = 90;
- private static final int SIZING_DIALOG_HEIGHT = 25;
-
- private CVSTag selection;
-
- private TagSource tagSource;
-
- private String message;
-
- private int includeFlags;
-
- private String helpContext;
-
- private boolean showRecurse;
-
- public static CVSTag getTagToCompareWith(Shell shell, TagSource tagSource, int includeFlags) {
- TagSelectionDialog dialog = new TagSelectionDialog(shell, tagSource,
- CVSUIMessages.CompareWithTagAction_message,
- CVSUIMessages.TagSelectionDialog_Select_a_Tag_1,
- includeFlags,
- false, /* show recurse*/
- IHelpContextIds.COMPARE_TAG_SELECTION_DIALOG);
- dialog.setBlockOnOpen(true);
- int result = dialog.open();
- if (result == Window.CANCEL) {
- return null;
- }
- return dialog.getResult();
- }
-
- /**
- * Creates a new TagSelectionDialog.
- * @param resource The resource to select a version for.
- */
- public TagSelectionDialog(Shell parentShell, TagSource tagSource, String title, String message, int includeFlags, final boolean showRecurse, String helpContext) {
- super(parentShell);
-
- // Create a tag selection area with a custom recurse option
- this.tagSource = tagSource;
- this.message = message;
- this.includeFlags = includeFlags;
- this.helpContext = helpContext;
- this.showRecurse = showRecurse;
- this.title = title;
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#getInitialSize()
- */
- protected Point getInitialSize() {
- final Point size= super.getInitialSize();
- size.x= convertWidthInCharsToPixels(SIZING_DIALOG_WIDTH);
- size.y= convertHeightInCharsToPixels(SIZING_DIALOG_HEIGHT);
- return size;
- }
-
- /**
- * 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 parent the parent composite to contain the dialog area
- * @return the dialog area control
- */
- protected Control createDialogArea(Composite parent) {
-
- applyDialogFont(parent);
- initializeDialogUnits(parent);
-
- final Composite top = (Composite)super.createDialogArea(parent);
-
- // Delegate most of the dialog to the tag selection area
- tagSelectionArea = new TagSelectionArea(getShell(), tagSource, includeFlags, helpContext) {
- protected void createCustomArea(Composite parent) {
- if(showRecurse) {
- final Button recurseCheck = new Button(parent, SWT.CHECK);
- recurseCheck.setText(CVSUIMessages.TagSelectionDialog_recurseOption);
- recurseCheck.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- recurse = recurseCheck.getSelection();
- }
- });
- recurseCheck.setSelection(true);
- }
- }
- };
- if (message != null)
- tagSelectionArea.setTagAreaLabel(message);
- tagSelectionArea.addPropertyChangeListener(this);
- tagSelectionArea.createArea(top);
- tagSelectionArea.setRunnableContext(getRunnableContext());
-
- // Create a separator between the tag area and the button area
- final Label seperator = new Label(top, SWT.SEPARATOR | SWT.HORIZONTAL);
- final GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- seperator.setLayoutData(data);
-
- updateEnablement();
- applyDialogFont(parent);
-
- return top;
- }
-
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Returns the selected tag.
- */
- public CVSTag getResult() {
- return selection;
- }
-
- public boolean getRecursive() {
- return recurse;
- }
-
- /**
- * Initializes the dialog contents.
- */
- protected void initialize() {
- okButton.setEnabled(false);
- if (CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_AUTO_REFRESH_TAGS_IN_TAG_SELECTION_DIALOG))
- tagSelectionArea.refreshTagList();
- }
-
-
- /**
- * Updates the dialog enablement.
- */
- protected void updateEnablement() {
- if(okButton!=null) {
- okButton.setEnabled(selection != null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(TagSelectionArea.SELECTED_TAG)) {
- selection = (CVSTag)event.getNewValue();
- updateEnablement();
- } else if (property.equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- okPressed();
- }
- }
-
- /**
- * Creates a runnable context that allows refreshing the tags in the background.
- *
- * @since 3.1
- */
- private IRunnableContext getRunnableContext() {
- return new IRunnableContext() {
- public void run(boolean fork, boolean cancelable, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- final Job refreshJob = new Job(CVSUIMessages.TagSelectionDialog_7) {
- protected IStatus run(IProgressMonitor monitor) {
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- try {
- setBusy(true);
- runnable.run(monitor);
- } catch (InvocationTargetException e) {
- return new CVSStatus(IStatus.ERROR, CVSUIMessages.TagSelectionDialog_8, e);
- } catch (InterruptedException e) {
- return new CVSStatus(IStatus.ERROR, CVSUIMessages.TagSelectionDialog_8, e);
- } finally {
- setBusy(false);
- }
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- else
- return Status.OK_STATUS;
- }
- };
- refreshJob.setUser(false);
- refreshJob.setPriority(Job.DECORATE);
- getShell().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- refreshJob.cancel();
- }
- });
- refreshJob.schedule();
- }
- };
- }
-
- private void setBusy(final boolean busy) {
- final Shell shell = getShell();
- if (shell != null && !shell.isDisposed()) {
- shell.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!shell.isDisposed()) {
- Cursor cursor = null;
- if (busy) {
- if (appBusyCursor == null)
- appBusyCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_APPSTARTING);
- cursor = appBusyCursor;
- }
- shell.setCursor(cursor);
- }
- }
- });
- }
- }
-
- public boolean close() {
- if(appBusyCursor != null)
- appBusyCursor.dispose();
- return super.close();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java
deleted file mode 100644
index 5268b8ffc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * General tag selection page that allows the selection of a tag
- * for a particular remote folder
- */
-public class TagSelectionWizardPage extends CVSWizardPage {
-
- private CVSTag selectedTag;
-
- // Needed to dynamicaly create refresh buttons
- private Composite composite;
-
- private int includeFlags;
-
- // Fields for allowing the use of the tag from the local workspace
- boolean allowNoTag = false;
- private Button useResourceTagButton;
- private Button selectTagButton;
- private boolean useResourceTag = false;
- private String helpContextId;
- private TagSelectionArea tagArea;
- private TagSource tagSource;
-
- public TagSelectionWizardPage(String pageName, String title, ImageDescriptor titleImage, String description, TagSource tagSource, int includeFlags) {
- super(pageName, title, titleImage, description);
- this.tagSource = tagSource;
- this.includeFlags = includeFlags;
- }
-
- /**
- * Set the help context for the tag selection page.
- * This method must be invoked before <code>createControl</code>
- * @param helpContextId the help context id
- */
- public void setHelpContxtId(String helpContextId) {
- this.helpContextId = helpContextId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
-
- composite= new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DEFAULT));
- composite.setLayoutData(SWTUtils.createHVFillGridData());
- setControl(composite);
-
- // set F1 help
- if (helpContextId != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContextId);
-
- if (allowNoTag) {
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useResourceTag = useResourceTagButton.getSelection();
- updateEnablement();
- }
- };
- useResourceTag = true;
- useResourceTagButton = createRadioButton(composite, CVSUIMessages.TagSelectionWizardPage_0, 1);
- selectTagButton = createRadioButton(composite, CVSUIMessages.TagSelectionWizardPage_1, 1);
- useResourceTagButton.setSelection(useResourceTag);
- selectTagButton.setSelection(!useResourceTag);
- useResourceTagButton.addSelectionListener(listener);
- selectTagButton.addSelectionListener(listener);
- }
-
- createTagArea();
- updateEnablement();
- Dialog.applyDialogFont(parent);
- }
-
- private void createTagArea() {
- tagArea = new TagSelectionArea(getShell(), tagSource, includeFlags, null);
- tagArea.setRunnableContext(getContainer());
- tagArea.createArea(composite);
- tagArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) {
- selectedTag = tagArea.getSelection();
- updateEnablement();
- } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- if (selectedTag != null)
- gotoNextPage();
- }
-
- }
- });
- refreshTagArea();
- }
-
- private void refreshTagArea() {
- if (tagArea != null) {
- tagArea.refresh();
- tagArea.setSelection(selectedTag);
- }
- }
-
- protected void updateEnablement() {
- tagArea.setEnabled(!useResourceTag);
- setPageComplete(useResourceTag || selectedTag != null);
- }
-
- public CVSTag getSelectedTag() {
- if (useResourceTag)
- return null;
- return selectedTag;
- }
-
- protected void gotoNextPage() {
- TagSelectionWizardPage.this.getContainer().showPage(getNextPage());
- }
-
- public void setAllowNoTag(boolean b) {
- allowNoTag = b;
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && tagArea != null) {
- tagArea.setFocus();
- }
- }
-
- /**
- * Set the tag source used by this wizard page
- * @param source the tag source
- */
- public void setTagSource(TagSource source) {
- this.tagSource = source;
- tagArea.setTagSource(tagSource);
- setSelection(null);
- refreshTagArea();
- }
-
- /**
- * Set the selection of the page to the given tag
- * @param selectedTag
- */
- public void setSelection(CVSTag selectedTag) {
- if (selectedTag == null && (includeFlags & TagSelectionArea.INCLUDE_HEAD_TAG) > 0) {
- this.selectedTag = CVSTag.DEFAULT;
- } else {
- this.selectedTag = selectedTag;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
deleted file mode 100644
index f2a2c1adf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-
-/**
- * A tag source provides access to a set of tags.
- */
-public abstract class TagSource {
-
- /*
- * Special constant representing the BASE tag
- */
- public static final int BASE = -1;
-
- public static final TagSource EMPTY = new TagSource() {
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- // No-op
- }
- public ICVSRepositoryLocation getLocation() {
- // TODO Auto-generated method stub
- return null;
- }
- public String getShortDescription() {
- return "Empty"; //$NON-NLS-1$
- }
- public CVSTag[] getTags(int type) {
- return new CVSTag[0];
- }
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- return new CVSTag[0];
- }
- public ICVSResource[] getCVSResources() {
- return new ICVSResource[0];
- }
- };
-
- private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
-
- /**
- * Simple interface for providing notification when the tags
- * for this source have changed.
- */
- public interface ITagSourceChangeListener {
- void tagsChanged(TagSource source);
- }
-
- public static int[] convertIncludeFlaqsToTagTypes(int includeFlags) {
- List types = new ArrayList();
- if ((includeFlags & TagSelectionArea.INCLUDE_BRANCHES) > 0)
- types.add(new Integer(CVSTag.BRANCH));
- if ((includeFlags & TagSelectionArea.INCLUDE_VERSIONS) > 0)
- types.add(new Integer(CVSTag.VERSION));
- if ((includeFlags & (TagSelectionArea.INCLUDE_HEAD_TAG)) > 0)
- types.add(new Integer(CVSTag.HEAD));
- if ((includeFlags & (TagSelectionArea.INCLUDE_DATES)) > 0)
- types.add(new Integer(CVSTag.DATE));
- if ((includeFlags & (TagSelectionArea.INCLUDE_BASE_TAG)) > 0)
- types.add(new Integer(BASE));
- int[] result = new int[types.size()];
- for (int i = 0; i < result.length; i++) {
- result[i] = ((Integer)types.get(i)).intValue();
-
- }
- return result;
- }
-
- /**
- * Create a tag source for the given folders
- * @param folders one or more folders
- * @return a tag source for the supplied folders
- */
- public static TagSource create(ICVSFolder[] folders) {
- if (folders.length == 1) {
- return new SingleFolderTagSource(folders[0]);
- } else {
- return new MultiFolderTagSource(folders);
- }
- }
-
- /**
- * Create a tag source for a list of resources
- * @param resources one or more resources
- * @return a tag source
- */
- public static TagSource create(ICVSResource[] resources) {
- if (resources.length == 1 && !resources[0].isFolder())
- return new SingleFileTagSource((ICVSFile)resources[0]);
- return create(getFolders(resources));
- }
-
- private static ICVSFolder[] getFolders(ICVSResource[] resources) {
- HashSet result= new HashSet();
- for (int i= 0; i < resources.length; i++) {
- result.add(getFirstFolder(resources[i]));
- }
- return (ICVSFolder[]) result.toArray(new ICVSFolder[result.size()]);
- }
-
- /**
- * Create a tag source for a list of resources
- * @param resources one or more resources
- * @return a tag source
- */
- public static TagSource create(IResource[] resources) {
- return create(getCVSResources(getProjects(resources)));
- }
-
- /**
- * Create a tag source for the given mappers.
- * @param mappers the mappers
- * @return a tag source
- */
- public static TagSource create(ResourceMapping[] mappers) {
- return create(getCVSResources(getProjects(mappers)));
- }
-
- private static IResource[] getProjects(ResourceMapping[] mappers) {
- Set projects = new HashSet();
- for (int i = 0; i < mappers.length; i++) {
- ResourceMapping mapper = mappers[i];
- projects.addAll(Arrays.asList(mapper.getProjects()));
- }
- return (IResource[]) projects.toArray(new IResource[projects.size()]);
- }
-
- private static IResource[] getProjects(IResource[] resources) {
- Set result = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- result.add(resource.getProject());
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- /**
- * Return a tag source for a single remote folder
- * @param remote the remote folder
- * @return a tag source for that folder
- */
- public static TagSource create(ICVSRemoteFolder remote) {
- return new SingleFolderTagSource(remote);
- }
-
- private static ICVSResource[] getCVSResources(IResource[] resources) {
- List cvsResources = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- cvsResources.add(CVSWorkspaceRoot.getCVSResourceFor(resource));
- }
- return (ICVSResource[]) cvsResources.toArray(new ICVSResource[cvsResources.size()]);
- }
-
- private static ICVSFolder getFirstFolder(ICVSResource resource) {
- if (resource.isFolder()) {
- return (ICVSFolder)resource;
- } else {
- return resource.getParent();
- }
- }
-
- public CVSTag[] getTags(int type) {
- switch (type) {
- case BASE:
- return new CVSTag[] { CVSTag.BASE };
- case CVSTag.HEAD:
- return new CVSTag[] { CVSTag.DEFAULT };
- }
- return new CVSTag[0];
- }
-
- public CVSTag[] getTags(int[] types) {
- if (types.length == 0) {
- return new CVSTag[0];
- }
- if (types.length == 1) {
- return getTags(types[0]);
- }
- List result = new ArrayList();
- for (int i = 0; i < types.length; i++) {
- int type = types[i];
- CVSTag[] tags = getTags(type);
- result.addAll(Arrays.asList(tags));
- }
- return (CVSTag[]) result.toArray(new CVSTag[result.size()]);
- }
-
- /**
- * Refresh the tags by contacting the server if appropriate
- * @param monitor a progress monitor
- * @param bestEffort if best effort is true, then the whole folder contents may be searched
- * @return any discovered tags
- */
- public abstract CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException;
-
- public abstract ICVSRepositoryLocation getLocation();
-
- /**
- * Return a short description of the tag source for displaying in UI.
- * @return a short description of the tag source for displaying in UI.
- */
- public abstract String getShortDescription();
-
- /**
- * Commit a set of tag changes to the tag cache
- * @param tags the tags that should be cached
- * @param replace whether existing tags not in the list should be removed
- * @param monitor a progress monitor
- * @throws CVSException
- */
- public abstract void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException;
-
- public void addListener(ITagSourceChangeListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(ITagSourceChangeListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Notify all listeners that the tags from this source may have changed
- */
- public void fireChange() {
- Object[] list = listeners.getListeners();
- for (int i = 0; i < list.length; i++) {
- final ITagSourceChangeListener listener = (ITagSourceChangeListener)list[i];
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // logged by run
- }
- public void run() throws Exception {
- listener.tagsChanged(TagSource.this);
- }
- });
- }
- }
-
- public abstract ICVSResource[] getCVSResources();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
deleted file mode 100644
index 19fe129ea..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A workbench adapter that can be used to view the resources that make up
- * a tag source. It is used by the TagConfigurationDialog.
- */
-public class TagSourceResourceAdapter implements IAdaptable, IWorkbenchAdapter {
-
- public static Object getViewerInput(TagSource tagSource) {
- return new TagSourceResourceAdapter(tagSource);
- }
-
- TagSource tagSource;
-
- private TagSourceResourceAdapter(TagSource tagSource) {
- this.tagSource = tagSource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- ICVSResource[] children = tagSource.getCVSResources();
- if (children.length == 0) return new Object[0];
- List result = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
- if (resource.isFolder()) {
- result.add(new CVSFolderElement((ICVSFolder)resource, false));
- } else {
- result.add(new CVSFileElement((ICVSFile)resource));
- }
- }
- return result.toArray(new Object[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- // No imgae descriptor
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return tagSource.getShortDescription();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- // No parent
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
deleted file mode 100644
index ceb89a51b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A workbench adapter for a tag source that creates a model
- * for displaying the tags from a tag source in a tree or table
- * viewer. The workbench adapter is not a singleton since it needs
- * to be configured to display certain types of tags.
- */
-public class TagSourceWorkbenchAdapter implements IAdaptable, IWorkbenchAdapter {
-
- /**
- * Constants for configuring which types of tags should be displayed.
- */
- public static final int INCLUDE_HEAD_TAG = 1;
- public static final int INCLUDE_BASE_TAG = 2;
- public static final int INCLUDE_BRANCHES = 4;
- public static final int INCLUDE_VERSIONS = 8;
- public static final int INCLUDE_DATES = 16;
- public static final int INCLUDE_ALL_TAGS = INCLUDE_HEAD_TAG | INCLUDE_BASE_TAG | INCLUDE_BRANCHES | INCLUDE_VERSIONS | INCLUDE_DATES;
-
- TagRootElement branches;
- TagRootElement versions;
- TagRootElement dates;
- int includeFlags;
-
- public static class ProjectElementComparator extends ViewerComparator {
-
- /*
- * The order in the diaog should be HEAD, Branches, Versions, Dates, BASE
- */
- public int category(Object element) {
- if (element instanceof TagElement) {
- CVSTag tag = ((TagElement)element).getTag();
- if (tag == CVSTag.DEFAULT) return 1;
- if (tag == CVSTag.BASE) return 5;
- if (tag.getType() == CVSTag.BRANCH) return 2;
- if (tag.getType() == CVSTag.VERSION) return 3;
- if (tag.getType() == CVSTag.DATE) return 4;
- } else if (element instanceof TagRootElement) {
- if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.BRANCH) return 2;
- if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.VERSION) return 3;
- if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.DATE) return 4;
- }
- return 0;
- }
- public int compare(Viewer viewer, Object e1, Object e2) {
- int cat1 = category(e1);
- int cat2 = category(e2);
- if (cat1 != cat2) return cat1 - cat2;
- // Sort version tags in reverse order
- if (e1 instanceof TagElement){
- CVSTag tag1 = ((TagElement)e1).getTag();
- int type = tag1.getType();
- if(type == CVSTag.VERSION) {
- return -1 * super.compare(viewer, e1, e2);
- }else if(type == CVSTag.DATE){
- return -1*tag1.compareTo(((TagElement)e2).getTag());
- }
- }
- return super.compare(viewer, e1, e2);
- }
- }
-
-
- /**
- * Create a viewer input for the tag source
- * @param tagSource the tag source
- * @param includeFlags the types of tags to include
- * @return a tree viewer input
- */
- public static Object createInput(TagSource tagSource, int includeFlags) {
- if (includeFlags == INCLUDE_VERSIONS) {
- // Versions only is requested by the merge start page.
- // Only need to show version tags
- return new TagRootElement(null, tagSource, CVSTag.VERSION);
- }
- return new TagSourceWorkbenchAdapter(tagSource, includeFlags);
- }
-
- public TagSourceWorkbenchAdapter(TagSource tagSource, int includeFlags) {
- this.includeFlags = includeFlags;
- if (this.includeFlags == 0) this.includeFlags = INCLUDE_ALL_TAGS;
- if ((includeFlags & INCLUDE_BRANCHES) > 0) {
- branches = new TagRootElement(this, tagSource, CVSTag.BRANCH);
- }
- if ((includeFlags & INCLUDE_VERSIONS) > 0) {
- versions = new TagRootElement(this, tagSource, CVSTag.VERSION);
- }
- if ((includeFlags & INCLUDE_DATES) > 0) {
- dates = new TagRootElement(this, tagSource, CVSTag.DATE);
- }
- }
-
- public Object[] getChildren(Object o) {
- ArrayList children = new ArrayList(4);
- if ((includeFlags & INCLUDE_HEAD_TAG) > 0) {
- children.add(new TagElement(this, CVSTag.DEFAULT));
- }
- if ((includeFlags & INCLUDE_BASE_TAG) > 0) {
- children.add(new TagElement(this, CVSTag.BASE));
- }
- if ((includeFlags & INCLUDE_BRANCHES) > 0) {
- children.add(branches);
- }
- if ((includeFlags & INCLUDE_VERSIONS) > 0) {
- children.add(versions);
- }
- if ((includeFlags & INCLUDE_DATES) > 0) {
- children.add(dates);
- }
- return children.toArray(new Object[children.size()]);
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- public String getLabel(Object o) {
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java
deleted file mode 100644
index 231ef573e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IFileContentManager;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.AddOperation;
-import org.eclipse.ui.PlatformUI;
-
-public class AddWizard extends ResizableWizard {
-
- private final AddOperation op;
- private final IFile[] unknowns;
- private CommitWizardFileTypePage fFileTypePage;
-
- public static void run(Shell shell, final AddOperation op) throws InvocationTargetException, InterruptedException {
- // Prompt if there are files of unknown type being added
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- op.buildScope(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
-
- IFile[] unknowns = getUnaddedWithUnknownFileType(op.getTraversals());
- if (unknowns.length == 0) {
- op.run();
- } else {
- AddWizard wizard = new AddWizard(op, unknowns);
- ResizableWizard.open(shell, wizard);
- }
- }
-
- private static IFile[] getUnaddedWithUnknownFileType(final ResourceTraversal[] traversals) throws InvocationTargetException, InterruptedException {
- final List unadded = new ArrayList();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- final IFileContentManager manager= Team.getFileContentManager();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- final IResource resource = resources[j];
- try {
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- if (!file.isManaged()) {
- if (!file.isIgnored() || file.equals(resource)) {
- final String extension= ((IFile)resource).getFileExtension();
- if (manager.getType((IFile)resource) == Team.UNKNOWN) {
- if (extension != null && !manager.isKnownExtension(extension)) {
- unadded.add(resource);
- } else {
- final String name= file.getName();
- if (extension == null && name != null && !manager.isKnownFilename(name))
- unadded.add(resource);
- }
- }
- }
- }
- }
- return true;
- }
- }, traversal.getDepth(), false);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }
-
- });
- return (IFile[]) unadded.toArray(new IFile[unadded.size()]);
- }
-
- public AddWizard(AddOperation op, IFile[] unknowns) {
- super("AddWizard", CVSUIPlugin.getPlugin().getDialogSettings()); //$NON-NLS-1$
- this.op = op;
- this.unknowns = unknowns;
- setWindowTitle(CVSUIMessages.AddWizard_0);
- setDefaultPageImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION));
- }
-
- public void addPages() {
-
- final Collection names= new HashSet();
- final Collection extensions= new HashSet();
- getUnknownNamesAndExtension(unknowns, names, extensions);
-
- if (names.size() + extensions.size() > 0) {
- fFileTypePage= new CommitWizardFileTypePage(extensions, names);
- addPage(fFileTypePage);
- }
-
- super.addPages();
- }
-
- private static void getUnknownNamesAndExtension(IFile[] files, Collection names, Collection extensions) {
-
- final IFileContentManager manager= Team.getFileContentManager();
-
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
-
- final String extension= file.getFileExtension();
- if (extension != null && !manager.isKnownExtension(extension)) {
- extensions.add(extension);
- }
-
- final String name= file.getName();
- if (extension == null && name != null && !manager.isKnownFilename(name))
- names.add(name);
- }
- }
-
- public boolean performFinish() {
- final Map extensionsToSave= new HashMap();
- final Map extensionsNotToSave= new HashMap();
-
- fFileTypePage.getModesForExtensions(extensionsToSave, extensionsNotToSave);
- CommitWizardFileTypePage.saveExtensionMappings(extensionsToSave);
- op.addModesForExtensions(extensionsNotToSave);
-
- final Map namesToSave= new HashMap();
- final Map namesNotToSave= new HashMap();
-
- fFileTypePage.getModesForNames(namesToSave, namesNotToSave);
- CommitWizardFileTypePage.saveNameMappings(namesToSave);
- op.addModesForNames(namesNotToSave);
-
- try {
- op.run();
- } catch (InvocationTargetException e) {
- return false;
- } catch (InterruptedException e) {
- return false;
- }
-
- return super.performFinish();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java
deleted file mode 100644
index aa5c25b7a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-
-public class AlternativeLocationWizard extends NewLocationWizard {
-
- private ICVSRepositoryLocation location;
-
- public boolean performFinish() {
- final ICVSRepositoryLocation[] location = new ICVSRepositoryLocation[] { null };
- boolean useLocation = true;
- try {
- // Create a handle to a repository location
- location[0] = mainPage.getLocation();
- // Add the location quitely so we can validate
- location[0] = KnownRepositories.getInstance().addRepository(location[0], false /* don't tell anybody */);
-
- if (mainPage.getValidate()) {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location[0].validateConnection(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- // Cancelled by user. Fall through to dispose of location
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException)t;
- } else if (t instanceof Exception) {
- throw CVSException.wrapException((Exception)t);
- } else {
- throw CVSException.wrapException(e);
- }
- }
- }
- } catch (TeamException e) {
- if (location[0] == null) {
- // Exception creating the root, we cannot continue
- CVSUIPlugin.openError(getContainer().getShell(), CVSUIMessages.AlternativeLocationWizard_exception, null, e);
- return false;
- } else {
- // Exception validating. We can continue if the user wishes.
- IStatus error = e.getStatus();
- if (error.isMultiStatus() && error.getChildren().length == 1) {
- error = error.getChildren()[0];
- }
-
- if (error.isMultiStatus()) {
- CVSUIPlugin.openError(getContainer().getShell(), CVSUIMessages.AlternativeLocationWizard_validationFailedTitle, null, e);
- } else {
- useLocation = MessageDialog.openQuestion(getContainer().getShell(),
- CVSUIMessages.AlternativeLocationWizard_validationFailedTitle,
- NLS.bind(CVSUIMessages.AlternativeLocationWizard_validationFailedText, (new Object[] {error.getMessage()})));
- }
- }
- }
-
- if (useLocation) {
- KnownRepositories.getInstance().addRepository(location[0], true /* let the world know */);
- } else {
- KnownRepositories.getInstance().disposeRepository(location[0]);
- }
-
- this.location = useLocation ? location[0] : null;
- return useLocation;
- }
-
- public AlternativeLocationWizard(Properties initialProperties) {
- super(initialProperties);
- }
-
- /**
- * Creates the wizard pages
- */
- public void addPages() {
- super.addPages();
- }
-
- protected ConfigurationWizardMainPage createMainPage() {
- return new AlternativeConfigurationWizardMainPage("repositoryPage1", CVSUIMessages.AlternativeLocationWizard_heading, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION)); //$NON-NLS-1$
- }
-
- public ICVSRepositoryLocation getLocation() {
- return location;
- }
-
- /**
- * Wizard page for entering information about a CVS repository location used
- * while working with Alternative Repository dialog.
- *
- * <p>
- * Validation works slightly different. When user wants to create a
- * location, which already exists he/she will be informed that the location
- * can be obtained from a combo-box.
- * </p>
- *
- * TODO: enable to create existing location, instead of displaying an error
- * close the dialog and select the entry with that location in the combo box
- */
- private class AlternativeConfigurationWizardMainPage extends
- ConfigurationWizardMainPage {
-
- public AlternativeConfigurationWizardMainPage(String pageName,
- String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.internal.ccvs.ui.wizards.ConfigurationWizardMainPage#validateFields()
- */
- protected void validateFields() {
- super.validateFields();
- if (!isPageComplete()
- && getErrorMessage() != null
- && getErrorMessage().equals(
- CVSUIMessages.ConfigurationWizardMainPage_0)) {
- // add an information that the location already exists and can
- // be selected from a combo box
- setErrorMessage(CVSUIMessages.AlternativeConfigurationWizardMainPage_0);
- }
- }
- }
-
-}
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 e68201ceb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteProjectFolder;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * Common superclass for CVS wizard pages. Provides convenience methods
- * for widget creation.
- */
-public abstract class CVSWizardPage extends WizardPage {
-
- protected static final int LABEL_WIDTH_HINT = 400;
- protected static final int LABEL_INDENT_WIDTH = 32;
- protected static final int LIST_HEIGHT_HINT = 100;
- protected static final int SPACER_HEIGHT = 8;
-
- private ICVSWizard wizard;
-
- /**
- * CVSWizardPage constructor comment.
- * @param pageName the name of the page
- */
- public CVSWizardPage(String pageName) {
- super(pageName);
- }
-
- /**
- * CVSWizardPage constructor comment.
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public CVSWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
- /**
- * CVSWizardPage constructor comment.
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- * @param description the description of the page
- */
- public CVSWizardPage(String pageName, String title, ImageDescriptor titleImage, String description) {
- super(pageName, title, titleImage);
- setDescription(description);
- }
- /**
- * Creates a new checkbox instance and sets the default layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- protected Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
- /**
- * Creates composite control and sets the default layout data.
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @param grabExcess TODO
- *
- * @return the newly-created coposite
- */
- protected Composite createComposite(Composite parent, int numColumns, boolean grabExcess) {
- final Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(numColumns, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, grabExcess, grabExcess));
- return composite;
- }
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- public static Label createLabel(Composite parent, String text) {
- return createIndentedLabel(parent, text, 0);
- }
- /**
- * Utility method that creates a label instance indented by the specified
- * number of pixels and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @param indent the indent in pixels, or 0 for none
- * @return the new label
- */
- public static Label createIndentedLabel(Composite parent, String text, int indent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalIndent = indent;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Utility method that creates a label instance with word wrap and sets
- * the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @param indent the indent in pixels, or 0 for none
- * @param widthHint the nominal width of the label
- * @return the new label
- */
- protected Label createWrappingLabel(Composite parent, String text, int indent) {
- return createWrappingLabel(parent, text, indent, 1);
- }
-
- protected Label createWrappingLabel(Composite parent, String text, int indent, int horizontalSpan) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- data.horizontalIndent = indent;
- data.horizontalSpan = horizontalSpan;
- data.widthHint = LABEL_WIDTH_HINT;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Create a text field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- static public Text createTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- return layoutTextField(text);
- }
- /**
- * Create a password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- static public Text createPasswordField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
- return layoutTextField(text);
- }
- /**
- * Layout a text or password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- static public Text layoutTextField(Text text) {
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Utility method to create a radio button
- *
- * @param parent the parent of the radio button
- * @param label the label of the radio button
- * @param span the number of columns to span
- * @return the created radio button
- */
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
-
- protected TreeViewer createResourceSelectionTree(Composite composite, int types, int span) {
- TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.setUseHashlookup(true);
- tree.setContentProvider(getResourceProvider(types));
- tree.setLabelProvider(
- new DecoratingLabelProvider(
- new WorkbenchLabelProvider(),
- CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
- tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
-
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- data.heightHint = LIST_HEIGHT_HINT;
- data.horizontalSpan = span;
- tree.getControl().setLayoutData(data);
- return tree;
- }
-
- /**
- * Returns a content provider for <code>IResource</code>s that returns
- * only children of the given resource type.
- */
- protected ITreeContentProvider getResourceProvider(final int resourceType) {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof IContainer) {
- IResource[] members = null;
- try {
- members = ((IContainer)o).members();
- } catch (CoreException e) {
- //just return an empty set of children
- return new Object[0];
- }
-
- //filter out the desired resource types
- ArrayList results = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- //And the test bits with the resource types to see if they are what we want
- if ((members[i].getType() & resourceType) > 0) {
- results.add(members[i]);
- }
- }
- return results.toArray();
- } else {
- return super.getChildren(o);
- }
- }
- };
- }
-
- protected ICVSWizard getCVSWizard() {
- if (wizard != null) {
- return wizard;
- }
- IWizard wizard = getWizard();
- if (wizard instanceof ICVSWizard) {
- // This is the method that is invoked when the next button is pressed
- // Hence, assume that the page s about to be shown
- return ((ICVSWizard)wizard);
- }
- return null;
- }
-
- public void setCVSWizard(ICVSWizard wizard) {
- this.wizard = wizard;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
- */
- public IWizardPage getNextPage() {
- ICVSWizard w = getCVSWizard();
- if (w != null) {
- // This is the method that is invoked when the next button is pressed
- // Hence, assume that the page s about to be shown
- return w.getNextPage(this, true /* about to show */);
- }
- return super.getNextPage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- ICVSWizard w = getCVSWizard();
- if (w != null) {
- return isPageComplete() &&
- w.getNextPage(this, false /* about to show */) != null;
- }
- return super.canFlipToNextPage();
- }
-
- /**
- * Utility method to get a folder name based on preferences.
- * Returns the folder name or the project name retrieved from the project metafile
- * @param the CVS remote folder
- * @return a project name
- */
- static protected String getPreferredFolderName(ICVSRemoteFolder folder) {
- if (CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout() && folder instanceof RemoteProjectFolder ) {
- RemoteProjectFolder rpf = (RemoteProjectFolder) folder;
- if (rpf.hasProjectName()) {
- return rpf.getProjectName();
- }
- }
- return folder.getName();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
deleted file mode 100644
index 145f31f92..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-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.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Administrator
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CheckoutAsLocationSelectionPage extends CVSWizardPage {
-
- public static final String NAME = "CheckoutAsLocationSelectionPage"; //$NON-NLS-1$
-
- private Button browseButton;
- private Combo locationPathField;
- private Label locationLabel;
- private boolean useDefaults = true;
- private ICVSRemoteFolder[] remoteFolders;
- private String targetLocation;
- private IProject singleProject;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- // store id constants
- private static final String STORE_PREVIOUS_LOCATIONS =
- "CheckoutAsLocationSelectionPage.STORE_PREVIOUS_LOCATIONS";//$NON-NLS-1$
-
- /**
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public CheckoutAsLocationSelectionPage(ImageDescriptor titleImage, ICVSRemoteFolder[] remoteFolders) {
- super(NAME, CVSUIMessages.CheckoutAsLocationSelectionPage_title, titleImage, CVSUIMessages.CheckoutAsLocationSelectionPage_description); //
- this.remoteFolders = remoteFolders;
- }
-
- /**
- * @return
- */
- private boolean isSingleFolder() {
- return remoteFolders.length == 1;
- }
-
- /**
- * @param string
- */
- public void setProject(IProject project) {
- singleProject = project;
- setLocationForSelection(true);
- }
-
- /**
- * @param string
- */
- public void setProjectName(String string) {
- if (string == null || string.equals(".")) return; //$NON-NLS-1$
- if (singleProject != null && singleProject.getName().equals(string)) return;
- setProject(ResourcesPlugin.getWorkspace().getRoot().getProject(string));
- }
-
- private IProject getSingleProject() {
- if (singleProject == null) {
- setProjectName(getPreferredFolderName(remoteFolders[0]));
- }
- return singleProject;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= createComposite(parent, 1, false);
- setControl(composite);
- // required in order to use setButtonLayoutData
- initializeDialogUnits(composite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CHECKOUT_LOCATION_SELECTION_PAGE);
-
- final Button useDefaultsButton =
- new Button(composite, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(CVSUIMessages.CheckoutAsLocationSelectionPage_useDefaultLabel);
- useDefaultsButton.setSelection(this.useDefaults);
-
- createUserSpecifiedProjectLocationGroup(composite, !this.useDefaults);
- initializeValues();
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- setLocationForSelection(true);
- setErrorMessage(useDefaults ? null : checkValidLocation());
- }
- };
- useDefaultsButton.addSelectionListener(listener);
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Creates the project location specification controls.
- *
- * @return the parent of the widgets created
- * @param projectGroup the parent composite
- * @param enabled - sets the initial enabled state of the widgets
- */
- private Composite createUserSpecifiedProjectLocationGroup(Composite parent, boolean enabled) {
-
- // This group needs 3 columns
- Composite projectGroup = createComposite(parent, 3, false);
-
- // location label
- locationLabel = new Label(projectGroup, SWT.NONE);
- if (isSingleFolder()) {
- locationLabel.setText(CVSUIMessages.CheckoutAsLocationSelectionPage_locationLabel);
- } else {
- locationLabel.setText(CVSUIMessages.CheckoutAsLocationSelectionPage_parentDirectoryLabel);
- }
- locationLabel.setEnabled(enabled);
-
- // project location entry field
- locationPathField = new Combo(projectGroup, SWT.DROP_DOWN);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
-
- // browse button
- this.browseButton = new Button(projectGroup, SWT.PUSH);
- this.browseButton.setText(CVSUIMessages.CheckoutAsLocationSelectionPage_browseLabel);
- this.browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
- this.browseButton.setEnabled(enabled);
- setButtonLayoutData(this.browseButton);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- setLocationForSelection(true);
- locationPathField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setErrorMessage(checkValidLocation());
- }
- });
- return projectGroup;
- }
-
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- // Set remembered values
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] previouseLocations = settings.getArray(STORE_PREVIOUS_LOCATIONS);
- if (previouseLocations != null) {
- for (int i = 0; i < previouseLocations.length; i++) {
- if(isSingleFolder())
- locationPathField.add(new Path(previouseLocations[i]).append(getSingleProject().getName()).toOSString());
- else
- locationPathField.add(previouseLocations[i]);
- }
- }
- }
- }
-
- /**
- * Saves the widget values
- */
- private void saveWidgetValues() {
- // Update history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] previouseLocations = settings.getArray(STORE_PREVIOUS_LOCATIONS);
- if (previouseLocations == null) previouseLocations = new String[0];
- if(isSingleFolder())
- previouseLocations = addToHistory(previouseLocations, new Path(locationPathField.getText()).removeLastSegments(1).toOSString());
- else
- previouseLocations = addToHistory(previouseLocations, locationPathField.getText());
- settings.put(STORE_PREVIOUS_LOCATIONS, previouseLocations);
- }
- }
-
- /**
- * 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>CheckoutAsLocationSelectionPage.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;
- }
-
- /**
- * 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>CheckoutAsLocationSelectionPage.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);
- }
-
- /**
- * Check if the entry in the widget location is valid. If it is valid return null. Otherwise
- * return a string that indicates the problem.
- */
- private String checkValidLocation() {
-
- if (useDefaults) {
- targetLocation = null;
- return null;
- } else {
- targetLocation = locationPathField.getText();
- if (targetLocation.equals("")) {//$NON-NLS-1$
- return(CVSUIMessages.CheckoutAsLocationSelectionPage_locationEmpty);
- }
- else{
- IPath path = new Path("");//$NON-NLS-1$
- if (!path.isValidPath(targetLocation)) {
- return CVSUIMessages.CheckoutAsLocationSelectionPage_invalidLocation;
- }
- }
-
- if (isSingleFolder()) {
- IStatus locationStatus =
- ResourcesPlugin.getWorkspace().validateProjectLocation(
- getSingleProject(),
- new Path(targetLocation));
-
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
- } else {
- for (int i = 0; i < remoteFolders.length; i++) {
- String projectName = getPreferredFolderName(remoteFolders[i]);
- IStatus locationStatus = ResourcesPlugin.getWorkspace().validateProjectLocation(
- ResourcesPlugin.getWorkspace().getRoot().getProject(projectName),
- new Path(targetLocation).append(projectName));
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
- }
- }
-
- return null;
- }
- }
-
- /**
- * Set the location to the default location if we are set to useDefaults.
- */
- private void setLocationForSelection(boolean changed) {
- if (useDefaults) {
- IPath defaultPath = null;
- if (isSingleFolder()) {
- IProject singleProject = getSingleProject();
- if (singleProject != null) {
- try {
- defaultPath = singleProject.getDescription().getLocation();
- } catch (CoreException e) {
- // ignore
- }
- if (defaultPath == null) {
- defaultPath = Platform.getLocation().append(singleProject.getName());
- }
- }
- } else {
- defaultPath = Platform.getLocation();
- }
- if (defaultPath != null) {
- locationPathField.setText(defaultPath.toOSString());
- }
- targetLocation = null;
- } else if (changed) {
- IPath location = null;
- IProject project = getSingleProject();
- if (project != null) {
- try {
- location = project.getDescription().getLocation();
- } catch (CoreException e) {
- // ignore the exception
- }
- }
- if (location == null) {
- targetLocation = null;
- locationPathField.setText(""); //$NON-NLS-1$
- } else {
- if (isSingleFolder()) {
- targetLocation = location.toOSString();
- } else {
- targetLocation = location.removeLastSegments(1).toOSString();
- }
- locationPathField.setText(targetLocation);
- }
- }
- }
-
- /**
- * Open an appropriate directory browser
- */
- private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- if (isSingleFolder()) {
- dialog.setMessage(NLS.bind(CVSUIMessages.CheckoutAsLocationSelectionPage_messageForSingle, new String[] { getSingleProject().getName() }));
- } else {
- dialog.setMessage(NLS.bind(CVSUIMessages.CheckoutAsLocationSelectionPage_messageForMulti, new String[] { new Integer(remoteFolders.length).toString() }));
- }
-
- String dirName = locationPathField.getText();
- if (!dirName.equals("")) {//$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- if (isSingleFolder()) {
- locationPathField.setText(new Path(selectedDirectory).append(getSingleProject().getName()).toOSString());
- } else {
- locationPathField.setText(new Path(selectedDirectory).toOSString());
- }
- }
- targetLocation = locationPathField.getText();
- }
-
- /**
- * Return the custom location for a single project. In this case, the specified
- * location is used as the location of the project.
- *
- * @param project
- * @return
- */
- public String getTargetLocation() {
- if (isCustomLocationSpecified()) {
- saveWidgetValues();
- return targetLocation;
- }
- return null;
- }
-
- /**
- * @return
- */
- private boolean isCustomLocationSpecified() {
- return !useDefaults;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
deleted file mode 100644
index ea43f0258..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.wizards.WorkingSetsDialog;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This is the main page of the Check Out As wizard. It allows the user to specify
- * whether they want to check out the remote folder(s) as project(s) or into an
- * existing project. For single project checkout, the page will also allow the user to
- * choose whether to configure the new project (if it is missing a .project file).
- */
-public class CheckoutAsMainPage extends CVSWizardPage {
-
- private String newProjectName;
- private boolean allowProjectConfiguration;
- private Button intoProjectButton;
- private Button simpleProjectButton;
- private Button configuredProjectButton;
- private Text projectNameField;
- private ICVSRemoteFolder[] folders;
-
- private Button recurseCheck;
- private boolean recurse = true;
-
- private Button addToWorkingSet;
- private Button browseButton;
- Text workingSetField;
- private boolean haveBrowsed;
-
- public static final String NAME = "CheckoutAsMainPage"; //$NON-NLS-1$
-
- /**
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration) {
- super(NAME, CVSUIMessages.CheckoutAsMainPage_title, titleImage, CVSUIMessages.CheckoutAsMainPage_description); //
- this.folders = folders;
- this.allowProjectConfiguration = allowProjectConfiguration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- Composite composite = createComposite(parent, 1, false);
- setControl(composite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CHECKOUT_CONFIGURATION_PAGE);
-
- if (isSingleFolder()) {
- createSingleFolderArea(composite);
- } else {
- createMultipleFoldersArea(composite);
- }
-
- updateEnablements();
- Dialog.applyDialogFont(parent);
- }
-
- /*
- * Is the input to the wizard a single folder or multiple folders
- */
- private boolean isSingleFolder() {
- return folders.length == 1;
- }
-
- /*
- * For the single folder case, return the name of the folder
- */
- private String getFolderName() {
- String name = getPreferredFolderName(folders[0]);
- if (name .equals(".")) { //$NON-NLS-1$
- name = new Path(null, folders[0].getRepository().getRootDirectory()).lastSegment();
- }
- return name;
- }
-
- /*
- * Create the page contents for a single folder checkout
- */
- private void createSingleFolderArea(Composite composite) {
- createLabel(composite, NLS.bind(CVSUIMessages.CheckoutAsMainPage_singleFolder, new String[] { getFolderName() }));
- configuredProjectButton = createRadioButton(composite, CVSUIMessages.CheckoutAsMainPage_asConfiguredProject, 1);
- if (!allowProjectConfiguration) {
- configuredProjectButton.setEnabled(false);
- Label configuredLabel = createWrappingLabel(composite, CVSUIMessages.CheckoutAsMainPage_10, 5);
- configuredLabel.setEnabled(false);
- }
- createCheckoutAsProjectRadioArea(composite);
- createCheckoutIntoRadioArea(composite);
- if (allowProjectConfiguration) {
- configuredProjectButton.setSelection(true);
- } else {
- simpleProjectButton.setSelection(true);
- }
-
- new Label(composite, SWT.NONE);
-
- // Should sub-folders of the folder be checked out?
- recurseCheck = createCheckBox(composite, CVSUIMessages.CheckoutAsProjectSelectionPage_recurse);
- recurseCheck.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- recurse = recurseCheck.getSelection();
- }
- });
- recurseCheck.setSelection(recurse);
-
- addWorkingSetSection(composite, CVSUIMessages.CheckoutAsMainPage_WorkingSetSingle);
- }
-
- /*
- * Create the page contents for a multiple folder checkout
- */
- private void createMultipleFoldersArea(Composite composite) {
- createLabel(composite, NLS.bind(CVSUIMessages.CheckoutAsMainPage_multipleFolders, new String[] { new Integer(folders.length).toString() }));
- createCheckoutAsProjectRadioArea(composite);
- createCheckoutIntoRadioArea(composite);
- simpleProjectButton.setSelection(true);
- addWorkingSetSection(composite, CVSUIMessages.CheckoutAsMainPage_WorkingSetMultiple);
- }
-
- /**
- * @param composite
- */
- private void createCheckoutAsProjectRadioArea(Composite composite) {
- if (isSingleFolder()) {
- simpleProjectButton = createRadioButton(composite, CVSUIMessages.CheckoutAsMainPage_asSimpleProject, 1);
- createProjectNameGroup(composite);
- } else {
- simpleProjectButton = createRadioButton(composite, CVSUIMessages.CheckoutAsMainPage_asProjects, 1);
- }
- }
-
- /**
- * @param composite
- */
- private void createCheckoutIntoRadioArea(Composite composite) {
- intoProjectButton = createRadioButton(composite, CVSUIMessages.CheckoutAsMainPage_intoProject, 1);
- }
-
- /**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
- private void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup,SWT.NONE);
- projectLabel.setText(CVSUIMessages.CheckoutAsMainPage_projectNameLabel);
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- projectNameField.setLayoutData(data);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- newProjectName = getFolderName();
- projectNameField.setText(newProjectName);
- projectNameField.selectAll();
-
- // Set the listener to capture modify events
- projectNameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEnablements();
- }
- });
- }
-
- /**
- * Check if the entries in the widget are valid. If they are return null otherwise
- * return a string that indicates the problem.
- */
- void updateEnablements() {
-
- if (projectNameField != null) {
- projectNameField.setEnabled(simpleProjectButton.getSelection());
- if (projectNameField.isEnabled()) {
- newProjectName = this.projectNameField.getText();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus nameStatus = workspace.validateName(newProjectName, IResource.PROJECT);
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- setPageComplete(false);
- return;
- }
- }
- }
-
- workingSetField.setEnabled(addToWorkingSet.getSelection());
- browseButton.setEnabled(addToWorkingSet.getSelection());
- //If add to working set checkbox selected and the user has not selected
- //a working set, mark page incomplete
- if (addToWorkingSet.getSelection() && !haveBrowsed){
- setPageComplete(false);
- return;
- }
-
- if (!validateWorkingSetName()){
- setPageComplete(false);
- return;
- }
-
-
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- public String getProjectName() {
- if (isSingleFolder() && simpleProjectButton.getSelection()) return newProjectName;
- return null;
- }
-
- public boolean isPerformConfigure() {
- if (configuredProjectButton == null) return false;
- return configuredProjectButton.getSelection();
- }
-
- public boolean isPerformCheckoutInto() {
- return intoProjectButton.getSelection();
- }
-
- public boolean isPerformCheckoutAs() {
- return simpleProjectButton.getSelection();
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage#createRadioButton(org.eclipse.swt.widgets.Composite, java.lang.String, int)
- */
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button radio = super.createRadioButton(parent, label, span);
- radio.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- });
- return radio;
- }
-
- /**
- * Returns the recurse.
- * @return boolean
- */
- public boolean isRecurse() {
- return recurse;
- }
-
- /**
- * Returns the name of the chosen working set
- * @return String a string representing the working set or an empty string if no working set has been selected
- */
- public String getWorkingSetName(){
- return workingSetField.getText();
- }
-
- /**
- * Returns whether the checkout should add the project(s) to a working set
- * @return boolean true if it should add it to a working set, false otherwise
- */
- public boolean shouldAddToWorkingSet(){
- return addToWorkingSet.getSelection();
- }
-
- private void addWorkingSetSection(Composite composite, String label) {
-
- addToWorkingSet = createCheckBox(composite, label);
- addToWorkingSet.setSelection(false);
- addToWorkingSet.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- });
-
- Composite inner = new Composite(composite, SWT.NULL);
- inner.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- inner.setLayout(layout);
-
- workingSetField = createTextField(inner);
- workingSetField.setEditable(false);
- browseButton = new Button(inner, SWT.PUSH);
- browseButton.setText(CVSUIMessages.CheckoutAsMainPage_Browse);
- //keep track if the user has browsed for working sets; don't show any error message until then
- haveBrowsed = false;
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- //open workspace selection dialog
- final WorkingSetsDialog dialog = new WorkingSetsDialog(getShell());
- haveBrowsed = true;
- if (dialog.open() == Window.OK)
- workingSetField.setText(dialog.getSelectedWorkingSet());
-
- updateEnablements();
- }
- });
- updateEnablements();
-
- }
-
- private boolean validateWorkingSetName() {
- if (addToWorkingSet.getSelection()) {
- String workingSetName = workingSetField.getText();
- if (workingSetName.length() == 0) {
- setMessage(CVSUIMessages.CheckoutAsMainPage_EmptyWorkingSetErrorMessage, ERROR);
- return false;
- }
- }
- setMessage(null);
- return true;
- }
-
-
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
deleted file mode 100644
index 47d768289..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This page allows the user to select the target parent container for
- * the folders being checked out.
- */
-public class CheckoutAsProjectSelectionPage extends CVSWizardPage {
-
- public static final String NAME = "CheckoutAsProjectSelectionPage"; //$NON-NLS-1$
-
- private TreeViewer tree;
- private Text nameField;
- private Combo filterList;
-
- private IResource selection;
- private ICVSRemoteFolder[] remoteFolders;
- private String folderName;
- private int filter;
-
- /**
- * Constructor for CheckoutIntoProjectSelectionPage.
- * @param pageName
- * @param title
- * @param titleImage
- */
- public CheckoutAsProjectSelectionPage(ImageDescriptor titleImage, ICVSRemoteFolder[] remoteFolders) {
- super(NAME, CVSUIMessages.CheckoutAsProjectSelectionPage_title, titleImage, CVSUIMessages.CheckoutAsProjectSelectionPage_description); //
- this.remoteFolders = remoteFolders;
- }
-
- /**
- * @return
- */
- private boolean isSingleFolder() {
- return remoteFolders.length == 1;
- }
-
- /*
- * For the single folder case, return the name of the folder
- */
- private String getInputFolderName() {
- return getPreferredFolderName(remoteFolders[0]);
- }
-
- private String getRepository() throws CVSException {
- return remoteFolders[0].getFolderSyncInfo().getRoot();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= createComposite(parent, 2, false);
- setControl(composite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CHECKOUT_PROJECT_SELECTION_PAGE);
-
- if (isSingleFolder()) {
- createLabel(composite, CVSUIMessages.CheckoutAsProjectSelectionPage_name);
- nameField = createTextField(composite);
- nameField.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- folderName = nameField.getText();
- updateWidgetEnablements();
- }
- });
- }
-
- createWrappingLabel(composite, CVSUIMessages.CheckoutAsProjectSelectionPage_treeLabel, 0, 2);
-
- tree = createResourceSelectionTree(composite, IResource.PROJECT | IResource.FOLDER, 2 /* horizontal span */);
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleResourceSelection(event);
- }
- });
-
- Composite filterComposite = createComposite(composite, 2, false);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- filterComposite.setLayoutData(data);
- createLabel(filterComposite, CVSUIMessages.CheckoutAsProjectSelectionPage_showLabel);
- filterList = createCombo(filterComposite);
- filterList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleFilterSelection();
- }
- });
-
- createWrappingLabel(composite, "", 0, 2); //$NON-NLS-1$
-
- initializeValues();
- updateWidgetEnablements();
- tree.getControl().setFocus();
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Method initializeValues.
- */
- private void initializeValues() {
- if (isSingleFolder()) {
- nameField.setText(getInputFolderName());
- }
- tree.setInput(ResourcesPlugin.getWorkspace().getRoot());
- filter = 0;
- updateTreeContents(filter);
- filterList.add(CVSUIMessages.CheckoutAsProjectSelectionPage_showAll);
- filterList.add(CVSUIMessages.CheckoutAsProjectSelectionPage_showUnshared);
- filterList.add(CVSUIMessages.CheckoutAsProjectSelectionPage_showSameRepo);
- filterList.select(filter);
- }
-
- private void handleResourceSelection(SelectionChangedEvent event) {
- ISelection sel = event.getSelection();
- if (sel.isEmpty()) {
- this.selection = null;
- } else if (sel instanceof IStructuredSelection) {
- this.selection = (IResource)((IStructuredSelection)sel).getFirstElement();
- }
- updateWidgetEnablements();
- }
-
- /**
- * Method updateWidgetEnablement.
- */
- private void updateWidgetEnablements() {
- if (isSingleFolder() && !Path.EMPTY.isValidSegment(folderName)) {
- setPageComplete(false);
- setErrorMessage(NLS.bind(CVSUIMessages.CheckoutAsProjectSelectionPage_invalidFolderName, new String[] { folderName }));
- return;
- }
- boolean complete = selection != null && selection.getType() != IResource.FILE;
- setErrorMessage(null);
- setPageComplete(complete);
- }
-
- /**
- * Returns the selection.
- * @return IResource
- */
- public IResource getSelection() {
- return selection;
- }
-
- private void updateTreeContents(int selected) {
- try {
- if (selected == 0) {
- tree.setInput(new AdaptableResourceList(getProjects(getRepository(), true)));
- } else if (selected == 1) {
- tree.setInput(new AdaptableResourceList(getProjects(null, true)));
- } else if (selected == 2) {
- tree.setInput(new AdaptableResourceList(getProjects(getRepository(), false)));
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /**
- * Method getValidTargetProjects returns the set of projects that match the provided criteria.
- * @return IResource
- */
- private IProject[] getProjects(String root, boolean unshared) throws CVSException {
- List validTargets = new ArrayList();
- try {
- IResource[] projects = ResourcesPlugin.getWorkspace().getRoot().members();
- for (int i = 0; i < projects.length; i++) {
- IResource resource = projects[i];
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- if (project.isAccessible()) {
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (provider == null && unshared) {
- validTargets.add(project);
- } else if (provider != null && provider.getID().equals(CVSProviderPlugin.getTypeId())) {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(project);
- FolderSyncInfo info = cvsFolder.getFolderSyncInfo();
- if (root != null && info != null && root.equals(info.getRoot())) {
- validTargets.add(project);
- }
- }
- }
- }
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- return (IProject[]) validTargets.toArray(new IProject[validTargets.size()]);
- }
-
- public IContainer getLocalFolder() {
- if (Path.EMPTY.isValidSegment(folderName)) {
- return ((IContainer)getSelection()).getFolder(new Path(null, folderName));
- } else {
- return null;
- }
- }
-
- public IContainer getParentFolder() {
- return ((IContainer)getSelection());
- }
-
- private void handleFilterSelection() {
- filter = filterList.getSelectionIndex();
- updateTreeContents(filter);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
deleted file mode 100644
index 8bd84a6c4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.NewProjectAction;
-
-/**
- * @author Administrator
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CheckoutAsWizard extends Wizard {
-
- private ICVSRemoteFolder[] remoteFolders;
- private boolean allowProjectConfiguration;
-
- private CheckoutAsMainPage mainPage;
- private CheckoutAsProjectSelectionPage projectSelectionPage;
- private CheckoutAsLocationSelectionPage locationSelectionPage;
- private TagSelectionWizardPage tagSelectionPage;
- private IWorkbenchPart part;
-
- class NewProjectListener implements IResourceChangeListener {
- private IProject newProject = null;
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta root = event.getDelta();
- IResourceDelta[] projectDeltas = root.getAffectedChildren();
- for (int i = 0; i < projectDeltas.length; i++) {
- IResourceDelta delta = projectDeltas[i];
- IResource resource = delta.getResource();
- if (delta.getKind() == IResourceDelta.ADDED) {
- newProject = (IProject)resource;
- }
- }
- }
- /**
- * Gets the newProject.
- * @return Returns a IProject
- */
- public IProject getNewProject() {
- return newProject;
- }
- }
-
- /**
- * Return the settings used for all CheckoutAsWizard pages
- */
- public static IDialogSettings getCheckoutAsDialogSettings() {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("CheckoutAsWizard");//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection("CheckoutAsWizard");//$NON-NLS-1$
- }
- return section;
- }
-
- public CheckoutAsWizard(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, boolean allowProjectConfiguration) {
- this.part = part;
- this.remoteFolders = remoteFolders;
- setDialogSettings(getCheckoutAsDialogSettings());
- setWindowTitle(CVSUIMessages.CheckoutAsWizard_title);
- this.allowProjectConfiguration = allowProjectConfiguration;
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
-
- mainPage = new CheckoutAsMainPage(substImage, remoteFolders, allowProjectConfiguration);
- addPage(mainPage);
-
- projectSelectionPage = new CheckoutAsProjectSelectionPage(substImage, remoteFolders);
- addPage(projectSelectionPage);
-
- locationSelectionPage = new CheckoutAsLocationSelectionPage(substImage, remoteFolders);
- addPage(locationSelectionPage);
-
- tagSelectionPage = new TagSelectionWizardPage("tagPage", CVSUIMessages.CheckoutAsWizard_3, substImage, CVSUIMessages.CheckoutAsWizard_4, TagSource.create(remoteFolders), //$NON-NLS-1$
- TagSelectionArea.INCLUDE_HEAD_TAG |
- TagSelectionArea.INCLUDE_BRANCHES |
- TagSelectionArea.INCLUDE_VERSIONS |
- TagSelectionArea.INCLUDE_DATES
- );
- if (remoteFolders.length > 0) {
- try {
- CVSTag selectedTag = remoteFolders[0].getFolderSyncInfo().getTag();
- tagSelectionPage.setSelection(selectedTag);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- tagSelectionPage.setHelpContxtId(IHelpContextIds.CHECKOUT_TAG_SELETION_PAGE);
- addPage(tagSelectionPage);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- try {
- if (mainPage.isPerformConfigure()) {
- return performConfigureAndCheckout();
- } else if (mainPage.isPerformCheckoutAs()) {
- if (isSingleFolder()) {
- return performSingleCheckoutAs();
- } else {
- return performMultipleCheckoutAs();
- }
- } else if (mainPage.isPerformCheckoutInto()) {
- return performCheckoutInto();
- }
- } catch (InvocationTargetException e) {
- handle(e);
- // drop through
- } catch (InterruptedException e) {
- // drop through
- }
- return false;
- }
-
- /**
- * @return
- */
- private boolean isSingleFolder() {
- return remoteFolders.length == 1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#canFinish()
- */
- public boolean canFinish() {
- return (mainPage.isPageComplete()
- && (mainPage.isPerformConfigure()
- || (mainPage.isPerformCheckoutInto() && projectSelectionPage.isPageComplete())
- || (mainPage.isPerformCheckoutAs() && locationSelectionPage.isPageComplete())));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getNextPage(IWizardPage page) {
- if (page == mainPage) {
- if (mainPage.isPerformConfigure()) return tagSelectionPage;
- if (mainPage.isPerformCheckoutInto()) return projectSelectionPage;
- if (mainPage.isPerformCheckoutAs()) {
- if (isSingleFolder()) {
- locationSelectionPage.setProjectName(mainPage.getProjectName());
- } else {
- locationSelectionPage.setProject(null);
- }
- return locationSelectionPage;
- }
- }
- // The tag selection page is always shown as the last page
- if (page != tagSelectionPage) {
- return tagSelectionPage;
- }
- return null;
- }
-
- private void handle(Throwable e) {
- CVSUIPlugin.openError(getShell(), CVSUIMessages.CheckoutAsWizard_error, null, e);
- }
-
- /*
- * Configure a local project and checkout the selected remote folder into the project.
- * This only occurs for single folders.
- */
- private boolean performConfigureAndCheckout() throws InvocationTargetException, InterruptedException {
- IProject newProject = getNewProject();
- if (newProject == null) return false;
- // Run the checkout in the background
- ICVSRemoteFolder folder = getRemoteFolder();
- new CheckoutSingleProjectOperation(part, folder, newProject, null, true).run();
- return true;
- }
-
- /*
- * Return the single remote folder to be checked out
- */
- private ICVSRemoteFolder getRemoteFolder() {
- ICVSRemoteFolder folder = remoteFolders[0];
- CVSTag selectedTag = getSelectedTag();
- if (selectedTag != null) {
- folder = (ICVSRemoteFolder)folder.forTag(selectedTag);
- }
- return folder;
- }
-
- /*
- * Return the remote folders to be checked out
- */
- private ICVSRemoteFolder[] getRemoteFolders() {
- ICVSRemoteFolder[] folders = (ICVSRemoteFolder[]) remoteFolders.clone();
- CVSTag selectedTag = getSelectedTag();
- // see bug 160851
- if(selectedTag != null){
- for (int i = 0; i < remoteFolders.length; i++) {
- folders[i] = (ICVSRemoteFolder)folders[i].forTag(getSelectedTag());
- }
- }
- return folders;
- }
-
- /*
- * Return the remote folders to be checked out with
- * Folder description if available based on preferrences settings
- */
- private ICVSRemoteFolder[] getRemoteFoldersWithProjectDescriptions() throws InvocationTargetException, InterruptedException {
- ICVSRemoteFolder[] folders = getRemoteFolders();
- if (CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout()) {
- folders = ProjectMetaFileOperation.updateFoldersWithProjectName(part, folders);
- }
- return folders;
- }
-
- private CVSTag getSelectedTag() {
- return tagSelectionPage.getSelectedTag();
- }
-
- private boolean performSingleCheckoutAs() throws InvocationTargetException, InterruptedException {
- IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(mainPage.getProjectName());
- String targetLocation = locationSelectionPage.getTargetLocation();
- // Run the checkout in the background
- ICVSRemoteFolder folder = getRemoteFolder();
- final boolean recurse = mainPage.isRecurse();
- if (mainPage.shouldAddToWorkingSet()){
- new CheckoutSingleProjectOperation(part, folder, newProject, targetLocation, false, mainPage.getWorkingSetName()) {
- protected boolean isRecursive() {
- return recurse;
- }
- }.run();
- } else {
- new CheckoutSingleProjectOperation(part, folder, newProject, targetLocation, false) {
- protected boolean isRecursive() {
- return recurse;
- }
- }.run();
- }
- return true;
- }
-
- /**
- * Check out multiple folders to the workspace using a custom location if one is
- * specified.
- */
- private boolean performMultipleCheckoutAs() throws InvocationTargetException, InterruptedException {
- String targetLocation = locationSelectionPage.getTargetLocation();
- if (mainPage.shouldAddToWorkingSet()){
- //Run the checkout in the background
- new CheckoutMultipleProjectsOperation(part, getRemoteFoldersWithProjectDescriptions(), targetLocation, mainPage.getWorkingSetName()).run();
- } else {
- // Run the checkout in the background
- new CheckoutMultipleProjectsOperation(part, getRemoteFoldersWithProjectDescriptions(), targetLocation).run();
- }
- return true;
- }
-
- private boolean performCheckoutInto() throws InvocationTargetException, InterruptedException {
- CheckoutIntoOperation operation;
- boolean recursive = mainPage.isRecurse();
- if (isSingleFolder()) {
- ICVSRemoteFolder folder = getRemoteFolder();
- operation = new CheckoutIntoOperation(part, folder, projectSelectionPage.getLocalFolder(), recursive);
- } else {
- operation = new CheckoutIntoOperation(part, getRemoteFolders(), projectSelectionPage.getParentFolder(), recursive);
- }
- // Run the checkout in the background
- operation.run();
- return true;
- }
-
- /**
- * Get a new project that is configured by the new project wizard.
- * This is currently the only way to do this.
- */
- private IProject getNewProject() {
- NewProjectListener listener = new NewProjectListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
- (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run();
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- IProject project = listener.getNewProject();
- return project;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
deleted file mode 100644
index a129c8305..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Philippe Ombredanne - bug 84808
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.CheckoutMultipleProjectsOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.ProjectMetaFileOperation;
-import org.eclipse.ui.*;
-
-/**
- * Gathers all information necessary for a checkout from a repository.
- */
-public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
-
- private RepositorySelectionPage locationPage;
- private ConfigurationWizardMainPage createLocationPage;
- private ModuleSelectionPage modulePage;
- private CheckoutAsWizard wizard;
- private ICVSRepositoryLocation location;
- private boolean isNewLocation;
- private CVSWizardPage dummyPage;
-
- public CheckoutWizard() {
- setWindowTitle(CVSUIMessages.CheckoutWizard_0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
-
- ImageDescriptor substImage = getBannerImageDescriptor();
-
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- if (locations.length > 0) {
- locationPage = new RepositorySelectionPage("locationSelection", CVSUIMessages.CheckoutWizard_7, substImage); //$NON-NLS-1$
- locationPage.setDescription(CVSUIMessages.SharingWizard_importTitleDescription);
- locationPage.setExtendedDescription(CVSUIMessages.CheckoutWizard_8);
- addPage(locationPage);
- }
-
- createLocationPage = new ConfigurationWizardMainPage("createLocationPage", CVSUIMessages.SharingWizard_enterInformation, substImage); //$NON-NLS-1$
- createLocationPage.setDescription(CVSUIMessages.SharingWizard_enterInformationDescription);
- addPage(createLocationPage);
- createLocationPage.setDialogSettings(NewLocationWizard.getLocationDialogSettings());
-
- modulePage = new ModuleSelectionPage("moduleSelection", CVSUIMessages.CheckoutWizard_10, substImage); //$NON-NLS-1$
- modulePage.setDescription(CVSUIMessages.CheckoutWizard_11);
- modulePage.setHelpContxtId(IHelpContextIds.CHECKOUT_MODULE_SELECTION_PAGE);
- modulePage.setSupportsMultiSelection(true);
- addPage(modulePage);
-
- // Dummy page to allow lazy creation of CheckoutAsWizard
- dummyPage = new CVSWizardPage("dummyPage") { //$NON-NLS-1$
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1, false);
- setControl(composite);
- }
- };
- addPage(dummyPage);
- }
-
- protected ImageDescriptor getBannerImageDescriptor() {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- public boolean canFinish() {
- return (wizard == null && getSelectedModules().length > 0) ||
- (wizard != null && wizard.canFinish());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- if (wizard != null) {
- // The finish of the child wizard will get called directly.
- // We only get here if it completed successfully
- if (isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- return true;
- } else {
- try {
- new CheckoutMultipleProjectsOperation(getPart(), getSelectedModules(), null)
- .run();
- if (isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // Canceled. fall through.
- }
- return false;
- }
- }
-
- private IWorkbenchPart getPart() {
- // This wizard doesn't have a part
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performCancel()
- */
- public boolean performCancel() {
- if (location != null && isNewLocation) {
- KnownRepositories.getInstance().disposeRepository(location);
- location = null;
- }
- return wizard == null || wizard.performCancel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getNextPage(IWizardPage page) {
- // Assume the page is about to be shown when this method is
- // invoked
- return getNextPage(page, true /* about to show*/);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.wizards.ICVSWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage, boolean)
- */
- public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow) {
- if (page == locationPage) {
- if (locationPage.getLocation() == null) {
- return createLocationPage;
- } else {
- if (aboutToShow) {
- try {
- modulePage.setLocation(getLocation());
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- }
- if (page == createLocationPage) {
- if (aboutToShow) {
- try {
- ICVSRepositoryLocation l = getLocation();
- if (l != null) {
- modulePage.setLocation(l);
- }
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- if (page == modulePage) {
- ICVSRemoteFolder[] selectedModules = getSelectedModules();
- if (selectedModules.length == 0) return null;
- for (int i = 0; i < selectedModules.length; i++) {
- ICVSRemoteFolder folder = selectedModules[i];
- if (folder.isDefinedModule()) {
- // No further configuration is possible for defined modules
- return null;
- }
- }
- if (aboutToShow) {
- try {
- boolean hasMetafile = true;
- if (selectedModules.length == 1) {
- // Only allow configuration if one module is selected
- final ICVSRemoteFolder[] folders = new ICVSRemoteFolder[] {selectedModules[0]};
- final boolean withName = CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout();
-
- // attempt to retrieve the project description depending on preferences
- // this is a bit convoluted to batch the meta-file check and retrieval in one operation
- final ICVSRemoteFolder[] folderResult = new ICVSRemoteFolder [1];
- final boolean[] booleanResult = new boolean[] { true };
-
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- ProjectMetaFileOperation op = new ProjectMetaFileOperation(getPart(), new ICVSRemoteFolder[] {folders[0]}, withName);
- op.run(monitor);
- folderResult[0] = op.getUpdatedFolders()[0];
- booleanResult[0] = op.metaFileExists();
- }
- });
- hasMetafile = booleanResult[0];
- if (withName && hasMetafile)
- selectedModules[0] = folderResult[0];
- }
- resetSubwizard();
- wizard = new CheckoutAsWizard(getPart(), selectedModules, ! hasMetafile /* allow configuration */);
- wizard.addPages();
- return wizard.getStartingPage();
- } catch (InvocationTargetException e) {
- // Show the error and fall through to return null as the next page
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // Canceled by user. Fall through and return null
- }
- return null;
- } else {
- if (wizard == null) {
- return dummyPage;
- } else {
- return wizard.getStartingPage();
- }
- }
- }
- if (wizard != null) {
- return wizard.getNextPage(page);
- }
- return null;
- }
-
- private ICVSRemoteFolder[] getSelectedModules() {
- if (modulePage == null) return null;
- return modulePage.getSelectedModules();
- }
-
- /**
- * Return an ICVSRepositoryLocation
- */
- private ICVSRepositoryLocation getLocation() throws TeamException {
- // If the location page has a location, use it.
- if (locationPage != null) {
- ICVSRepositoryLocation newLocation = locationPage.getLocation();
- if (newLocation != null) {
- return recordLocation(newLocation);
- }
- }
-
- // Otherwise, get the location from the create location page
- final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[] { null };
- final CVSException[] exception = new CVSException[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- locations[0] = createLocationPage.getLocation();
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- return recordLocation(locations[0]);
- }
-
- private ICVSRepositoryLocation recordLocation(ICVSRepositoryLocation newLocation) {
- if (newLocation == null) return location;
- if (location == null || !newLocation.equals(location)) {
- if (location != null && isNewLocation) {
- // Dispose of the previous location
- KnownRepositories.getInstance().disposeRepository(location);
- }
- location = newLocation;
- isNewLocation = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation(false));
- if (isNewLocation) {
- // Add the location silently so we can work with it
- location = KnownRepositories.getInstance().addRepository(location, false /* silently */);
- }
- }
- return location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- /*
- * Reset the sub-wizard
- */
- /* package */ void resetSubwizard() {
- if (wizard != null) {
- wizard.dispose();
- wizard = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
deleted file mode 100644
index f4a694035..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
+++ /dev/null
@@ -1,502 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak <brockj@tpg.com.au> - Bug 161536 Warn user when committing resources with problem markers
- * Brock Janiczak <brockj@tpg.com.au> - Bug 177519 [Wizards] Adopt new IResource.findMaxProblemSeverity API
- * Brock Janiczak <brockj@tpg.com.au> - Bug 166333 [Wizards] Show diff in CVS commit dialog
- *
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-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 org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IFileContentManager;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.ui.synchronize.ResourceScope;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A wizard to commit the resources whose synchronization state is given in form
- * of a set of <code>SyncInfo</code>.
- */
-public class CommitWizard extends ResizableWizard {
-
- public static final String COMMIT_WIZARD_DIALOG_SETTINGS = "CommitWizard"; //$NON-NLS-1$
-
- /**
- * An operation to add and commit resources to a CVS repository.
- */
- public static class AddAndCommitOperation extends CVSOperation {
-
- private final IResource[] fAllResources;
- private final String fComment;
-
- private Map fModesForExtensionsForOneTime;
- private Map fModesForNamesForOneTime;
-
- private IResource[] fNewResources;
- private IJobChangeListener jobListener;
-
- public AddAndCommitOperation(IWorkbenchPart part, IResource[] allResources, IResource[] newResources, String comment) {
- super(part);
- fAllResources = allResources;
- fNewResources = newResources;
- fModesForExtensionsForOneTime = Collections.EMPTY_MAP;
- fModesForNamesForOneTime= Collections.EMPTY_MAP;
- fComment = comment;
- }
-
- public void setModesForExtensionsForOneTime(Map modes) {
- if (modes != null)
- fModesForExtensionsForOneTime= modes;
- }
-
- public void setModesForNamesForOneTime(Map modes) {
- if (modes != null)
- fModesForNamesForOneTime= modes;
- }
-
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(null, (fNewResources.length + fAllResources.length) * 100);
- if (fNewResources.length > 0) {
- final AddOperation op= new AddOperation(getPart(), RepositoryProviderOperation.asResourceMappers(fNewResources));
- op.addModesForExtensions(fModesForExtensionsForOneTime);
- op.addModesForNames(fModesForNamesForOneTime);
- op.run(Policy.subMonitorFor(monitor, fNewResources.length * 100));
- }
- if (fAllResources.length > 0) {
- CommitOperation commitOperation = new CommitOperation(getPart(), RepositoryProviderOperation.asResourceMappers(fAllResources), new Command.LocalOption[0], fComment) {
- public boolean consultModelsForMappings() {
- // Do not consult models from the commit wizard
- return false;
- }
- };
- commitOperation.run(Policy.subMonitorFor(monitor, fAllResources.length * 100));
- }
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected String getJobName() {
- return CVSUIMessages.CommitWizard_0;
- }
-
- protected String getTaskName() {
- return CVSUIMessages.CommitWizard_1;
- }
-
- /*
- * Set the job listener. It will only recieve scheduled and done
- * events as these are what are used by a sync model operation
- * to show busy state in the sync view.
- */
- protected void setJobChangeListener(IJobChangeListener jobListener) {
- this.jobListener = jobListener;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobChangeListener#done(org.eclipse.core.runtime.jobs.IJobChangeEvent)
- */
- public void done(IJobChangeEvent event) {
- super.done(event);
- if (jobListener != null)
- jobListener.done(event);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.IJobChangeListener#scheduled(org.eclipse.core.runtime.jobs.IJobChangeEvent)
- */
- public void scheduled(IJobChangeEvent event) {
- super.scheduled(event);
- if (jobListener != null)
- jobListener.scheduled(event);
- }
- }
-
- private final IResource[] fResources;
- private final SyncInfoSet fOutOfSyncInfos;
- private final SyncInfoSet fUnaddedInfos;
- private final CommitWizardParticipant fParticipant;
-
- private CommitWizardFileTypePage fFileTypePage;
- private CommitWizardCommitPage fCommitPage;
- private IJobChangeListener jobListener;
- private IWorkbenchPart part;
-
- public CommitWizard(SyncInfoSet infos) throws CVSException {
- this(infos.getResources());
- }
-
- public CommitWizard(final IResource [] resources) throws CVSException {
-
- super(COMMIT_WIZARD_DIALOG_SETTINGS, CVSUIPlugin.getPlugin().getDialogSettings());
-
- setNeedsProgressMonitor(true);
- setWindowTitle(CVSUIMessages.CommitWizard_2);
- setDefaultPageImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION));
-
- fResources= resources;
- fParticipant= new CommitWizardParticipant(new ResourceScope(fResources), this);
-
- SyncInfoSet infos = getAllOutOfSync();
- fOutOfSyncInfos= new SyncInfoSet(infos.getNodes(new FastSyncInfoFilter.SyncInfoDirectionFilter(new int [] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING })));
- fUnaddedInfos= getUnaddedInfos(fOutOfSyncInfos);
- }
-
- public CommitWizard(SyncInfoSet infos, IJobChangeListener jobListener) throws CVSException {
- this(infos);
- this.jobListener = jobListener;
- }
-
- private SyncInfoSet getAllOutOfSync() throws CVSException {
- final SubscriberSyncInfoCollector syncInfoCollector = fParticipant.getSubscriberSyncInfoCollector();
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(CVSUIMessages.CommitWizard_4, IProgressMonitor.UNKNOWN);
- syncInfoCollector.waitForCollector(monitor);
- monitor.done();
- }
- });
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- return fParticipant.getSyncInfoSet();
- }
-
- public boolean hasOutgoingChanges() {
- return fOutOfSyncInfos.size() > 0;
- }
-
- public int getHighestProblemSeverity() {
- IResource[] resources = fOutOfSyncInfos.getResources();
- int mostSeriousSeverity = -1;
-
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- try {
- int severity = resource.findMaxProblemSeverity(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
- if (severity > mostSeriousSeverity) {
- mostSeriousSeverity = severity;
- }
- } catch (CoreException e) {
- }
- }
-
- return mostSeriousSeverity;
- }
-
- public CommitWizardFileTypePage getFileTypePage() {
- return fFileTypePage;
- }
-
- public CommitWizardCommitPage getCommitPage() {
- return fCommitPage;
- }
-
- public CommitWizardParticipant getParticipant() {
- return fParticipant;
- }
-
- public boolean canFinish() {
- final IWizardPage current= getContainer().getCurrentPage();
- if (current == fFileTypePage && fCommitPage != null)
- return false;
- return super.canFinish();
- }
-
- public boolean performFinish() {
-
- final String comment= fCommitPage.getComment(getShell());
- if (comment == null)
- return false;
-
- final SyncInfoSet infos= fCommitPage.getInfosToCommit();
- if (infos.size() == 0)
- return true;
-
- final SyncInfoSet unadded;
- try {
- unadded = getUnaddedInfos(infos);
- } catch (CVSException e1) {
- return false;
- }
-
- final SyncInfoSet files;
- try {
- files = getFiles(infos);
- } catch (CVSException e1) {
- return false;
- }
-
- final AddAndCommitOperation operation= new AddAndCommitOperation(getPart(), files.getResources(), unadded.getResources(), comment);
- if (jobListener != null)
- operation.setJobChangeListener(jobListener);
-
- if (fFileTypePage != null) {
- final Map extensionsToSave= new HashMap();
- final Map extensionsNotToSave= new HashMap();
-
- fFileTypePage.getModesForExtensions(extensionsToSave, extensionsNotToSave);
- CommitWizardFileTypePage.saveExtensionMappings(extensionsToSave);
- operation.setModesForExtensionsForOneTime(extensionsNotToSave);
-
- final Map namesToSave= new HashMap();
- final Map namesNotToSave= new HashMap();
-
- fFileTypePage.getModesForNames(namesToSave, namesNotToSave);
- CommitWizardFileTypePage.saveNameMappings(namesToSave);
- operation.setModesForNamesForOneTime(namesNotToSave);
- }
-
- try {
- operation.run();
- } catch (InvocationTargetException e) {
- return false;
- } catch (InterruptedException e) {
- return false;
- }
-
- fCommitPage.finish();
- return super.performFinish();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.wizards.ResizableWizard#performCancel()
- */
- public boolean performCancel() {
- fCommitPage.finish();
- return super.performCancel();
- }
-
- public void addPages() {
-
- final Collection names= new HashSet();
- final Collection extensions= new HashSet();
- getUnknownNamesAndExtension(fUnaddedInfos, names, extensions);
-
- if (names.size() + extensions.size() > 0) {
- fFileTypePage= new CommitWizardFileTypePage(extensions, names);
- addPage(fFileTypePage);
- }
-
- fCommitPage= new CommitWizardCommitPage(fResources, this);
- addPage(fCommitPage);
-
- super.addPages();
- }
-
- public void dispose() {
- fParticipant.dispose();
- super.dispose();
- }
-
- public static void run(IWorkbenchPart part, Shell shell, IResource [] resources) throws CVSException {
- try {
- CommitWizard commitWizard = new CommitWizard(resources);
- commitWizard.setPart(part);
- run(shell, commitWizard);
- } catch (OperationCanceledException e) {
- // Ignore
- }
- }
-
- private void setPart(IWorkbenchPart part) {
- this.part = part;
- }
-
- public static void run(Shell shell, SyncInfoSet infos, IJobChangeListener jobListener) throws CVSException {
- try {
- run(shell, new CommitWizard(infos, jobListener));
- } catch (OperationCanceledException e) {
- // Ignore
- }
- }
-
- public static void run(IWorkbenchPart part, Shell shell, final ResourceTraversal[] traversals) throws CVSException {
- try {
- final IResource [][] resources = new IResource[][] { null };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = getDeepResourcesToCommit(traversals, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- run(part, shell, resources[0]);
- } catch (OperationCanceledException e) {
- // Ignore
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- private IWorkbenchPart getPart() {
- if (part != null)
- return part;
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart();
- }
-
- private static void run(Shell shell, CommitWizard wizard) {
- if (!wizard.hasOutgoingChanges()) {
- MessageDialog.openInformation(shell, CVSUIMessages.CommitWizard_6, CVSUIMessages.CommitWizard_7); //
- } else {
- int highestProblemSeverity = wizard.getHighestProblemSeverity();
- IPreferenceStore preferenceStore = CVSUIPlugin.getPlugin().getPreferenceStore();
- switch (highestProblemSeverity) {
- case IMarker.SEVERITY_WARNING:
- String allowCommitsWithWarnings = preferenceStore.getString(ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS);
- if (MessageDialogWithToggle.PROMPT.equals(allowCommitsWithWarnings) || MessageDialogWithToggle.NEVER.equals(allowCommitsWithWarnings)) {
- MessageDialogWithToggle warningDialog = MessageDialogWithToggle.openYesNoQuestion(shell, CVSUIMessages.CommitWizard_8, CVSUIMessages.CommitWizard_9, CVSUIMessages.CommitWizard_10, false, preferenceStore, ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS);
- if (IDialogConstants.YES_ID != warningDialog.getReturnCode()) {
- return;
- }
- }
- break;
- case IMarker.SEVERITY_ERROR:
- String allowCommitsWithErrors = preferenceStore.getString(ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS);
- if (MessageDialogWithToggle.PROMPT.equals(allowCommitsWithErrors) || MessageDialogWithToggle.NEVER.equals(allowCommitsWithErrors)) {
- MessageDialogWithToggle errorDialog = MessageDialogWithToggle.openYesNoQuestion(shell, CVSUIMessages.CommitWizard_11, CVSUIMessages.CommitWizard_12, CVSUIMessages.CommitWizard_13, false, preferenceStore, ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS);
- if (IDialogConstants.YES_ID != errorDialog.getReturnCode()) {
- return;
- }
- }
- break;
- }
- open(shell, wizard);
- }
- }
-
-
- private static void getUnknownNamesAndExtension(SyncInfoSet infos, Collection names, Collection extensions) {
-
- final IFileContentManager manager= Team.getFileContentManager();
-
- for (final Iterator iter = infos.iterator(); iter.hasNext();) {
-
- final SyncInfo info = (SyncInfo)iter.next();
-
- IResource local = info.getLocal();
- if (local instanceof IFile && manager.getType((IFile)local) == Team.UNKNOWN) {
- final String extension= local.getFileExtension();
- if (extension != null && !manager.isKnownExtension(extension)) {
- extensions.add(extension);
- }
-
- final String name= local.getName();
- if (extension == null && name != null && !manager.isKnownFilename(name))
- names.add(name);
- }
- }
- }
-
- private static SyncInfoSet getUnaddedInfos(SyncInfoSet infos) throws CVSException {
- final SyncInfoSet unadded= new SyncInfoSet();
- for (final Iterator iter = infos.iterator(); iter.hasNext();) {
- final SyncInfo info = (SyncInfo) iter.next();
- final IResource resource= info.getLocal();
- if (!isAdded(resource))
- unadded.add(info);
- }
- return unadded;
- }
-
- private static SyncInfoSet getFiles(SyncInfoSet infos) throws CVSException {
- final SyncInfoSet files= new SyncInfoSet();
- for (final Iterator iter = infos.iterator(); iter.hasNext();) {
- final SyncInfo info = (SyncInfo) iter.next();
- final IResource resource= info.getLocal();
- if (resource.getType() == IResource.FILE)
- files.add(info);
- }
- return files;
- }
-
- private static boolean isAdded(IResource resource) throws CVSException {
- final ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isFolder()) {
- return ((ICVSFolder)cvsResource).isCVSFolder();
- }
- return cvsResource.isManaged();
- }
-
- private static IResource[] getDeepResourcesToCommit(ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
- List roots = new ArrayList();
- for (int j = 0; j < traversals.length; j++) {
- ResourceTraversal traversal = traversals[j];
- IResource[] resources = traversal.getResources();
- if (traversal.getDepth() == IResource.DEPTH_INFINITE) {
- roots.addAll(Arrays.asList(resources));
- } else if (traversal.getDepth() == IResource.DEPTH_ZERO) {
- collectShallowFiles(resources, roots);
- } else if (traversal.getDepth() == IResource.DEPTH_ONE) {
- collectShallowFiles(resources, roots);
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- if (resource.getType() != IResource.FILE) {
- collectShallowFiles(members(resource), roots);
- }
- }
- }
- }
- return (IResource[]) roots.toArray(new IResource[roots.size()]);
- }
-
- private static IResource[] members(IResource resource) throws CoreException {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().members(resource);
- }
-
- private static void collectShallowFiles(IResource[] resources, List roots) {
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- if (resource.getType() == IResource.FILE)
- roots.add(resource);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
deleted file mode 100644
index 2452d0764..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak <brockj@tpg.com.au> - Bug 166333 [Wizards] Show diff in CVS commit dialog
- * Brock Janiczak <brockj@tpg.com.au> - Bug 190674 Conflicting resources message lost when typing in commit wizard
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.util.Arrays;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetComparator;
-import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
-import org.eclipse.team.internal.core.subscribers.ChangeSet;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
-import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * This wizard page shows a preview of the commit operation and allows entering
- * a commit comment.
- */
-public class CommitWizardCommitPage extends WizardPage implements IPropertyChangeListener {
-
- public static final String SHOW_COMPARE = "ShowCompare"; //$NON-NLS-1$
- private static final String H_WEIGHT_1 = "HWeight1"; //$NON-NLS-1$
- private static final String H_WEIGHT_2 = "HWeight2"; //$NON-NLS-1$
- private static final String V_WEIGHT_1 = "VWeight1"; //$NON-NLS-1$
- private static final String V_WEIGHT_2 = "VWeight2"; //$NON-NLS-1$
-
-
- private final CommitCommentArea fCommentArea;
-
- private ISynchronizePageConfiguration fConfiguration;
-
- protected final CommitWizard fWizard;
-
- private ParticipantPagePane fPagePane;
- private PageBook bottomChild;
-
- private boolean fHasConflicts;
-
- private boolean fIsEmpty;
-
- private CompareViewerSwitchingPane compareViewerPane;
- private SashForm horizontalSash;
- private SashForm verticalSash;
- private boolean showCompare;
-
- public CommitWizardCommitPage(IResource [] resources, CommitWizard wizard) {
-
- super(CVSUIMessages.CommitWizardCommitPage_0);
- setTitle(CVSUIMessages.CommitWizardCommitPage_0);
- setDescription(CVSUIMessages.CommitWizardCommitPage_2);
-
- fWizard= wizard;
- fCommentArea= new CommitCommentArea();
- fCommentArea.setProposedComment(getProposedComment(resources));
- if (resources.length > 0)
- fCommentArea.setProject(resources[0].getProject());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- Dialog.applyDialogFont(parent);
- final PixelConverter converter= new PixelConverter(parent);
-
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DEFAULT));
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.COMMIT_COMMENT_PAGE);
-
-
- horizontalSash = new SashForm(composite, SWT.HORIZONTAL);
- horizontalSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- verticalSash = new SashForm(horizontalSash, SWT.VERTICAL);
- verticalSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createCommentArea(verticalSash, converter);
-
- createChangesArea(verticalSash, converter);
-
- compareViewerPane = new CompareViewerSwitchingPane(horizontalSash, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(false);
- cc.setRightEditable(false);
-
- return CompareUI.findContentViewer(oldViewer, input, this, cc);
- }
- };
- compareViewerPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- IDialogSettings section = getDialogSettings().getSection(CommitWizard.COMMIT_WIZARD_DIALOG_SETTINGS);
- showCompare = section == null ? false : section.getBoolean(SHOW_COMPARE);
- int vWeight1 = 50;
- int vWeight2 = 50;
- if (section != null) {
- try {
- vWeight1 = section.getInt(V_WEIGHT_1);
- vWeight2 = section.getInt(V_WEIGHT_2);
- } catch (NumberFormatException e) {
- }
- }
-
- int hWeight1 = 35;
- int hWeight2 = 65;
- if (section != null) {
- try {
- hWeight1 = section.getInt(H_WEIGHT_1);
- hWeight2 = section.getInt(H_WEIGHT_2);
- } catch (NumberFormatException e) {
- }
- }
-
- if (!showCompare) {
- horizontalSash.setMaximizedControl(verticalSash);
- }
-
- verticalSash.setWeights(new int[] {vWeight1, vWeight2});
- horizontalSash.setWeights(new int[] {hWeight1, hWeight2});
-
- //fSashForm.setWeights(weights);
- Dialog.applyDialogFont(parent);
- setControl(composite);
-
- fCommentArea.setFocus();
-
- validatePage(false);
- }
-
- public void setCompareInput(final Object input) {
- compareViewerPane.setInput(input);
- }
-
- private void createCommentArea(Composite parent, PixelConverter converter) {
- Composite c = new Composite(parent, SWT.NONE);
- c.setLayout(GridLayoutFactory.fillDefaults().margins(0, 0).create());
-
- fCommentArea.createArea(c);
- GridData gd = SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true);
- fCommentArea.getComposite().setLayoutData(gd);
- fCommentArea.addPropertyChangeListener(this);
-
- createPlaceholder(c);
- }
-
- private void createChangesArea(Composite parent, PixelConverter converter) {
-
- CommitWizardParticipant participant= fWizard.getParticipant();
- int size = participant.getSyncInfoSet().size();
- if (size > getFileDisplayThreshold()) {
- // Create a page book to allow eventual inclusion of changes
- bottomChild = new PageBook(parent, SWT.NONE);
- bottomChild.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, false));
- // Create composite for showing the reason for not showing the changes and a button to show them
- Composite changeDesc = new Composite(bottomChild, SWT.NONE);
- changeDesc.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
- SWTUtils.createLabel(changeDesc, NLS.bind(CVSUIMessages.CommitWizardCommitPage_1, new String[] { Integer.toString(size), Integer.toString(getFileDisplayThreshold()) }));
- Button showChanges = new Button(changeDesc, SWT.PUSH);
- showChanges.setText(CVSUIMessages.CommitWizardCommitPage_5);
- showChanges.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showChangesPane();
- }
- });
- showChanges.setLayoutData(new GridData());
- bottomChild.showPage(changeDesc);
- } else {
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
- composite.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true));
-
- Control c = createChangesPage(composite, participant);
- c.setLayoutData(SWTUtils.createHVFillGridData());
- }
- }
-
- protected void showChangesPane() {
- Control c = createChangesPage(bottomChild, fWizard.getParticipant());
- bottomChild.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true));
- bottomChild.showPage(c);
- Dialog.applyDialogFont(getControl());
- ((Composite)getControl()).layout();
- }
-
- private Control createChangesPage(final Composite composite, CommitWizardParticipant participant) {
- fConfiguration= participant.createPageConfiguration();
- fPagePane= new ParticipantPagePane(getShell(), true /* modal */, fConfiguration, participant);
- Control control = fPagePane.createPartControl(composite);
- return control;
- }
-
- private int getFileDisplayThreshold() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_COMMIT_FILES_DISPLAY_THRESHOLD);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- */
- public void dispose() {
- super.dispose();
- // Disposing of the page pane will dispose of the page and the configuration
- if (fPagePane != null)
- fPagePane.dispose();
- }
-
- private void createPlaceholder(final Composite composite) {
- final Composite placeholder= new Composite(composite, SWT.NONE);
- placeholder.setLayoutData(new GridData(SWT.DEFAULT, convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_SPACING) /3));
- }
-
- public String getComment(Shell shell) {
- return fCommentArea.getCommentWithPrompt(shell);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
- */
- public boolean isPageComplete() {
- /* if empty comment is not allowed (see bug 114678) */
- final IPreferenceStore store = CVSUIPlugin.getPlugin()
- .getPreferenceStore();
- final String allowEmptyComment = store
- .getString(ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS);
- if (allowEmptyComment.equals(MessageDialogWithToggle.NEVER)) {
- /* but is empty */
- final String comment = fCommentArea.getComment(false);
- if (comment.equals("")) { //$NON-NLS-1$
- return false; // then the page is not complete
- }
- }
- return super.isPageComplete();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- expand();
- fCommentArea.setFocus();
- }
-
- protected void expand() {
- if (fConfiguration != null) {
- final Viewer viewer= fConfiguration.getPage().getViewer();
- if (viewer instanceof TreeViewer) {
- try {
- viewer.getControl().setRedraw(false);
- ((TreeViewer)viewer).expandAll();
- } finally {
- viewer.getControl().setRedraw(true);
- }
- }
- }
- }
-
- /*
- * Expand the sync elements and update the page enablement
- */
- protected void updateForModelChange() {
- Control control = getControl();
- if (control == null || control.isDisposed()) return;
- expand();
- updateEnablements();
- }
-
- public void updateEnablements() {
- if (fConfiguration != null) {
- fHasConflicts = false;
- fIsEmpty = false;
-
- SyncInfoSet set = fConfiguration.getSyncInfoSet();
- if (set.hasConflicts()) {
- fHasConflicts = true;
- }
- if (set.isEmpty()) {
- fIsEmpty = true;
- }
- }
-
- validatePage(false);
- }
-
- boolean validatePage(boolean setMessage) {
- if (fCommentArea != null && fCommentArea.getComment(false).length() == 0) {
- final IPreferenceStore store= CVSUIPlugin.getPlugin().getPreferenceStore();
- final String value= store.getString(ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS);
- if (MessageDialogWithToggle.NEVER.equals(value)) {
- setPageComplete(false);
- if (setMessage)
- setErrorMessage(CVSUIMessages.CommitWizardCommitPage_3);
- return false;
- }
- }
-
- if (fHasConflicts) {
- setErrorMessage(CVSUIMessages.CommitWizardCommitPage_4);
- setPageComplete(false);
- return false;
- }
- if (fIsEmpty) {
- // No need for a message as it should be obvious that there are no resources to commit
- setErrorMessage(null);
- setPageComplete(false);
- return false;
- }
-
- setPageComplete(true);
- setErrorMessage(null);
- return true;
- }
-
- public void setFocus() {
- fCommentArea.setFocus();
- validatePage(true);
- }
-
- protected IWizardContainer getContainer() {
- return super.getContainer();
- }
-
- public SyncInfoSet getInfosToCommit() {
-
- final SyncInfoSet infos= new SyncInfoSet();
- if (fConfiguration == null) {
- return fWizard.getParticipant().getSyncInfoSet();
- }
-
- final IDiffElement root = (ISynchronizeModelElement)fConfiguration.getProperty(SynchronizePageConfiguration.P_MODEL);
- final IDiffElement [] elements= Utils.getDiffNodes(new IDiffElement [] { root });
-
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof SyncInfoModelElement) {
- SyncInfo syncInfo = ((SyncInfoModelElement)elements[i]).getSyncInfo();
- int direction = syncInfo.getKind() & SyncInfo.DIRECTION_MASK;
- if (direction == SyncInfo.OUTGOING || direction == SyncInfo.CONFLICTING)
- infos.add(syncInfo);
- }
- }
- return infos;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
-
- if (event.getProperty().equals(CommitCommentArea.OK_REQUESTED)) {
- final IWizardContainer container= getContainer();
- if (container instanceof WizardDialog) {
- final WizardDialog dialog= (WizardDialog)container;
- if (getWizard().canFinish()) {
- try {
- getWizard().performFinish();
- } finally {
- dialog.close();
- }
- }
- }
- }
- if (event.getProperty().equals(CommitCommentArea.COMMENT_MODIFIED)) {
- validatePage(true);
- }
- }
-
- /*
- * Get a proposed comment by looking at the active change sets
- */
- private String getProposedComment(IResource[] resourcesToCommit) {
- StringBuffer comment = new StringBuffer();
- ChangeSet[] sets = CVSUIPlugin.getPlugin().getChangeSetManager().getSets();
- Arrays.sort(sets, new ChangeSetComparator());
- int numMatchedSets = 0;
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (isUserSet(set) && containsOne(set, resourcesToCommit)) {
- if(numMatchedSets > 0) comment.append(System.getProperty("line.separator")); //$NON-NLS-1$
- comment.append(set.getComment());
- numMatchedSets++;
- }
- }
- return comment.toString();
- }
-
- private boolean isUserSet(ChangeSet set) {
- if (set instanceof ActiveChangeSet) {
- ActiveChangeSet acs = (ActiveChangeSet) set;
- return acs.isUserCreated();
- }
- return false;
- }
-
- private boolean containsOne(ChangeSet set, IResource[] resourcesToCommit) {
- for (int j = 0; j < resourcesToCommit.length; j++) {
- IResource resource = resourcesToCommit[j];
- if (set.contains(resource)) {
- return true;
- }
- if (set instanceof ActiveChangeSet) {
- ActiveChangeSet acs = (ActiveChangeSet) set;
- if (acs.getDiffTree().members(resource).length > 0)
- return true;
- }
- }
- return false;
- }
-
- public void finish() {
- int[] hWeights = horizontalSash.getWeights();
- int[] vWeights = verticalSash.getWeights();
- IDialogSettings section = getDialogSettings().getSection(CommitWizard.COMMIT_WIZARD_DIALOG_SETTINGS);
- if (section == null)
- section= getDialogSettings().addNewSection(CommitWizard.COMMIT_WIZARD_DIALOG_SETTINGS);
- if (showCompare) {
- section.put(H_WEIGHT_1, hWeights[0]);
- section.put(H_WEIGHT_2, hWeights[1]);
- }
- section.put(V_WEIGHT_1, vWeights[0]);
- section.put(V_WEIGHT_2, vWeights[1]);
- section.put(SHOW_COMPARE, showCompare);
- }
-
- public void showComparePane(boolean showCompare) {
- this.showCompare = showCompare;
- if (showCompare) {
- horizontalSash.setMaximizedControl(null);
- } else {
- horizontalSash.setMaximizedControl(verticalSash);
- }
-
- }
-
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java
deleted file mode 100644
index 891b8e273..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-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.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.team.internal.ui.preferences.FileTypeTable;
-import org.eclipse.ui.PlatformUI;
-
-/**
- *
- */
-public class CommitWizardFileTypePage extends WizardPage {
-
- private final Collection fExtensions;
- private final Collection fNames;
-
- public CommitWizardFileTypePage(Collection unknownExtensions, Collection unknownNames) {
- super(CVSUIMessages.CommitWizardFileTypePage_0);
- setTitle(CVSUIMessages.CommitWizardFileTypePage_0);
- setDescription(CVSUIMessages.CommitWizardFileTypePage_2);
-
- fNames= new ArrayList();
- for (final Iterator iter = unknownNames.iterator(); iter.hasNext();) {
- final String name = (String) iter.next();
- fNames.add(new FileTypeTable.Name(name, false));
- }
-
- fExtensions= new ArrayList();
- for (final Iterator iter = unknownExtensions.iterator(); iter.hasNext();) {
- final String extension= (String)iter.next();
- fExtensions.add(new FileTypeTable.Extension(extension, false));
- }
- }
-
- public void createControl(Composite parent) {
-
- initializeDialogUnits(parent);
-
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.COMMIT_FILE_TYPES_PAGE);
-
- final Label label= new Label(composite, SWT.WRAP);
- label.setText(CVSUIMessages.CommitWizardFileTypePage_3);
- label.setLayoutData(SWTUtils.createHFillGridData());
- Dialog.applyDialogFont(composite);
-
- final List items= new ArrayList();
- items.addAll(fNames);
- items.addAll(fExtensions);
-
- new FileTypeTable(composite, items, true);
-
- setControl(composite);
-
- }
-
- public void getModesForExtensions(Map toSave, Map notToSave) {
- getModes(fExtensions, toSave, notToSave);
- }
-
- public void getModesForNames(Map toSave, Map notToSave) {
- getModes(fNames, toSave, notToSave);
- }
-
- private static void getModes(Collection items, Map toSave, Map notToSave) {
- for (final Iterator iter = items.iterator(); iter.hasNext();) {
- final FileTypeTable.Item item= (FileTypeTable.Item)iter.next();
- final Map destination= item.save ? toSave : notToSave;
- destination.put(item.name, new Integer(item.mode));
- }
- }
-
- public KSubstOption getOption(IFile file) throws CVSException {
- final String extension= file.getFileExtension();
- if (extension != null) {
- for (Iterator iter = fExtensions.iterator(); iter.hasNext();) {
- final FileTypeTable.Item element = (FileTypeTable.Item) iter.next();
- if (element.name.equals(extension)) {
- return element.mode == Team.TEXT ? KSubstOption.getDefaultTextMode() : Command.KSUBST_BINARY;
- }
- }
- } else {
- final String name= file.getName();
- for (Iterator iter = fNames.iterator(); iter.hasNext();) {
- FileTypeTable.Item item = (FileTypeTable.Item) iter.next();
- if (item.name.equals(name)) {
- return item.mode == Team.TEXT ? KSubstOption.getDefaultTextMode() : Command.KSUBST_BINARY;
- }
- }
- }
- final ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- ResourceSyncInfo fileInfo = cvsFile.getSyncInfo();
- return fileInfo != null ? fileInfo.getKeywordMode() : KSubstOption.fromFile(file);
- }
-
- public static void saveExtensionMappings(Map modesToPersist) {
-
- final String [] extensions= new String [modesToPersist.size()];
- final int [] modes= new int[modesToPersist.size()];
-
- int index= 0;
- for (Iterator iter= modesToPersist.keySet().iterator(); iter.hasNext();) {
- extensions[index]= (String) iter.next();
- modes[index]= ((Integer)modesToPersist.get(extensions[index])).intValue();
- ++index;
- }
- Team.getFileContentManager().addExtensionMappings(extensions, modes);
- }
-
- public static void saveNameMappings(Map modesToPersist) {
-
- final String [] names= new String [modesToPersist.size()];
- final int [] modes= new int[modesToPersist.size()];
-
- int index= 0;
- for (Iterator iter= modesToPersist.keySet().iterator(); iter.hasNext();) {
- names[index]= (String) iter.next();
- modes[index]= ((Integer)modesToPersist.get(names[index])).intValue();
- ++index;
- }
- Team.getFileContentManager().addNameMappings(names, modes);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
deleted file mode 100644
index 0509c1f3b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak <brockj@tpg.com.au> - Bug 166333 [Wizards] Show diff in CVS commit dialog
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-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.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantLabelDecorator;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * A participant that uses our decorator instead of the standard one.
- */
-public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant {
-
- /**
- * The actions to be displayed in the context menu.
- */
- private class ActionContribution extends SynchronizePageActionGroup {
- public void modelChanged(final ISynchronizeModelElement root) {
- super.modelChanged(root);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- final CommitWizardCommitPage page= fWizard.getCommitPage();
- if (page != null)
- page.updateForModelChange();
- }
- });
- }
- }
-
- /**
- * An extension of the standard label decorator which configures the keyword substitution
- * mode according to the settings on the file type wizard page.
- */
- private static class Decorator extends CVSParticipantLabelDecorator {
-
- private final CommitWizard fWizard;
-
- public Decorator(ISynchronizePageConfiguration configuration, CommitWizard wizard) {
- super(configuration);
- fWizard= wizard;
- }
-
- protected CVSDecoration getDecoration(IResource resource) throws CoreException {
- final CVSDecoration decoration= super.getDecoration(resource);
- final CommitWizardFileTypePage page= fWizard.getFileTypePage();
-
- if (page != null && resource instanceof IFile)
- decoration.setKeywordSubstitution(page.getOption((IFile)resource).getShortDisplayText());
- return decoration;
- }
- }
-
- protected static final String ACTION_GROUP = "org.eclipse.tam.cvs.ui.CommitActions"; //$NON-NLS-1$
-
- final CommitWizard fWizard;
- protected Action showComparePaneAction;
-
- public CommitWizardParticipant(ISynchronizeScope scope, CommitWizard wizard) {
- super(scope);
- fWizard= wizard;
- }
-
- protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) {
- return new Decorator(configuration, fWizard);
- }
-
- public ChangeSetCapability getChangeSetCapability() {
- return null; // we don't want that button
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration( final ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ACTION_GROUP, ISynchronizePageConfiguration.LAYOUT_GROUP});
- configuration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3);
- configuration.addActionContribution(new ActionContribution());
- configuration.setRunnableContext(fWizard.getContainer());
-
- // Wrap the container so that we can update the enablements after the runnable
- // (i.e. the container resets the state to what it was at the beginning of the
- // run even if the state of the page changed. Remove from View changes the state)
- configuration.setRunnableContext(new IRunnableContext() {
- public void run(boolean fork, boolean cancelable,
- IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- fWizard.getContainer().run(fork, cancelable, runnable);
- final CommitWizardCommitPage page= fWizard.getCommitPage();
- if (page != null)
- page.updateEnablements();
- }
- });
- configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE);
- configuration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE);
- configuration.addActionContribution(new SynchronizePageActionGroup() {
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- showComparePaneAction = new Action(null, Action.AS_CHECK_BOX) {
- public void run() {
- fWizard.getCommitPage().showComparePane(this.isChecked());
- }
- };
- Utils.initAction(showComparePaneAction, "ComnitWizardComparePaneToggle.", Policy.getActionBundle()); //$NON-NLS-1$
- showComparePaneAction.setChecked(isComparePaneVisible());
- appendToGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ACTION_GROUP, showComparePaneAction);
- }
- });
- configuration.setProperty(SynchronizePageConfiguration.P_OPEN_ACTION, new Action() {
- public void run() {
- ISelection selection = configuration.getSite().getSelectionProvider().getSelection();
- if(selection instanceof IStructuredSelection) {
- final Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof SyncInfoModelElement) {
- try {
- fWizard.getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ((SyncInfoModelElement)obj).cacheContents(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- fWizard.getContainer().getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- fWizard.getCommitPage().showComparePane(true);
- showComparePaneAction.setChecked(true);
- fWizard.getCommitPage().setCompareInput(obj);
- }
- });
- }
- });
- } catch (InvocationTargetException e) {
- } catch (InterruptedException e) {
- }
- }
- }
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#doesSupportSynchronize()
- */
- public boolean doesSupportSynchronize() {
- return false;
- }
-
- private boolean isComparePaneVisible() {
- IDialogSettings section = fWizard.getDialogSettings().getSection(CommitWizard.COMMIT_WIZARD_DIALOG_SETTINGS);
- return section == null ? false : section.getBoolean(CommitWizardCommitPage.SHOW_COMPARE);
- }
-}
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 b7a00b123..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-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.*;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This configuration page explains to the user that CVS/ directories already exists and
- * it will attach the selected project to the repository that is specified in the CVS/ files.
- *
- * This is useful for people who have checked out a project using command-line tools.
- */
-public class ConfigurationWizardAutoconnectPage extends CVSWizardPage {
- private boolean validate = true;
- private FolderSyncInfo info;
- ICVSRepositoryLocation location;
-
- public ConfigurationWizardAutoconnectPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- setControl(composite);
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_AUTOCONNECT_PAGE);
-
- Label description = new Label(composite, SWT.WRAP);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.widthHint = 350;
- description.setLayoutData(data);
- description.setText(CVSUIMessages.ConfigurationWizardAutoconnectPage_description);
-
- if (location == null) return;
-
- // Spacer
- createLabel(composite, ""); //$NON-NLS-1$
- createLabel(composite, ""); //$NON-NLS-1$
-
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_user);
- createLabel(composite, location.getUsername());
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_host);
- createLabel(composite, location.getHost());
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_port);
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_default);
- } else {
- createLabel(composite, "" + port); //$NON-NLS-1$
- }
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_connectionType);
- createLabel(composite, location.getMethod().getName());
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_repositoryPath);
- createLabel(composite, location.getRootDirectory());
- createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_module);
- 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(CVSUIMessages.ConfigurationWizardAutoconnectPage_validate);
- check.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- validate = check.getSelection();
- }
- });
- check.setSelection(true);
- Dialog.applyDialogFont(parent);
- }
-
- public FolderSyncInfo getFolderSyncInfo() {
- return info;
- }
- public boolean getValidate() {
- return validate;
- }
- public boolean setProject(IProject project) {
- try {
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- info = folder.getFolderSyncInfo();
- if (info == null) {
- // This should never happen
- CVSUIPlugin.openError(null, CVSUIMessages.ConfigurationWizardAutoconnectPage_noSyncInfo, CVSUIMessages.ConfigurationWizardAutoconnectPage_noCVSDirectory, null); //
- return false;
- }
- location = CVSRepositoryLocation.fromString(info.getRoot());
- return true;
- } catch (TeamException e) {
- CVSUIPlugin.openError(null, null, null, e);
- return false;
- }
- }
-
- /**
- * Gets the location.
- * @return Returns a ICVSRepositoryLocation
- */
- public ICVSRepositoryLocation getLocation() {
- return location;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
deleted file mode 100644
index 9da28b888..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak <brockj@tpg.com.au> - Bug 185708 Provide link to open SSH/SSH2/proxy preferences from Connection wizard
- * Brock Janiczak <brockj@tpg.com.au> - Bug 107025 [Wizards] expose the 'paste cvs connection' easter egg
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.fieldassist.*;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-
-/**
- * Wizard page for entering information about a CVS repository location.
- */
-public class ConfigurationWizardMainPage extends CVSWizardPage {
- private static final String ANONYMOUS_USER = "anonymous"; //$NON-NLS-1$
-
- private boolean showValidate;
- private boolean validate;
-
- // Widgets
-
- // Connection Method
- private Combo connectionMethodCombo;
- // User
- private Combo userCombo;
- // Password
- private Text passwordText;
- // Port
- private Text portText;
- private Button useDefaultPort;
- private Button useCustomPort;
- // Host
- private Combo hostCombo;
- // Repository Path
- private Combo repositoryPathCombo;
- // Validation
- private Button validateButton;
- // Caching password
- private Button allowCachingButton;
- private boolean allowCaching = false;
-
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- private Properties properties = null;
-
- // The previously created repository.
- // It is recorded when asked for and
- // nulled when the page is changed.
- private ICVSRepositoryLocation location;
-
- // The previously created repository.
- // It is recorded when fields are changed
- private ICVSRepositoryLocation oldLocation;
-
- // Dialog store id constants
- private static final String STORE_USERNAME_ID =
- "ConfigurationWizardMainPage.STORE_USERNAME_ID";//$NON-NLS-1$
- private static final String STORE_HOSTNAME_ID =
- "ConfigurationWizardMainPage.STORE_HOSTNAME_ID";//$NON-NLS-1$
- private static final String STORE_PATH_ID =
- "ConfigurationWizardMainPage.STORE_PATH_ID";//$NON-NLS-1$
- private static final String STORE_DONT_VALIDATE_ID =
- "ConfigurationWizardMainPage.STORE_DONT_VALIDATE_ID";//$NON-NLS-1$
-
- // In case the page was launched from a different wizard
- private IDialogSettings settings;
-
- /**
- * ConfigurationWizardMainPage constructor.
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public ConfigurationWizardMainPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
- /**
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- * @return the history with the new entry appended
- */
- private String[] addToHistory(String[] history, String newEntry) {
- ArrayList l = new ArrayList(Arrays.asList(history));
- addToHistory(l, newEntry);
- String[] r = new String[l.size()];
- l.toArray(r);
- return r;
- }
- protected IDialogSettings getDialogSettings() {
- return settings;
- }
- protected void setDialogSettings(IDialogSettings settings) {
- this.settings = settings;
- }
- /**
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- private void addToHistory(List history, String newEntry) {
- history.remove(newEntry);
- history.add(0,newEntry);
-
- // since only one new item was added, we can be over the limit
- // by at most one item
- if (history.size() > COMBO_HISTORY_LENGTH)
- history.remove(COMBO_HISTORY_LENGTH);
- }
- /**
- * Creates the UI part of the page.
- *
- * @param parent the parent of the created widgets
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_NEW_REPOSITORY_PAGE);
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (location != null) {
- oldLocation = location;
- location = null;
- }
- if (event.widget == hostCombo) {
- String hostText = hostCombo.getText();
- if (hostText.length() > 0 && hostText.charAt(0) == ':') {
- try {
- CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(hostText);
- connectionMethodCombo.setText(newLocation.getMethod().getName());
- repositoryPathCombo.setText(newLocation.getRootDirectory());
- int port = newLocation.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- useDefaultPort.setSelection(true);
- useCustomPort.setSelection(false);
- } else {
- useCustomPort.setSelection(true);
- useDefaultPort.setSelection(false);
- portText.setText(String.valueOf(port));
- }
-
- userCombo.setText(newLocation.getUsername());
- //passwordText.setText(newLocation.xxx);
- hostCombo.setText(newLocation.getHost());
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- updateWidgetEnablements();
- }
- };
-
- Group g = createGroup(composite, CVSUIMessages.ConfigurationWizardMainPage_Location_1);
-
- // Host name
- createLabel(g, CVSUIMessages.ConfigurationWizardMainPage_host);
- hostCombo = createEditableCombo(g);
- ControlDecoration decoration = new ControlDecoration(hostCombo, SWT.TOP | SWT.LEFT);
- FieldDecoration infoDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
- decoration.setImage(infoDecoration.getImage());
- decoration.setDescriptionText(CVSUIMessages.ConfigurationWizardMainPage_8);
- decoration.setShowOnlyOnFocus(true);
-
- ((GridLayout)g.getLayout()).horizontalSpacing = decoration.getMarginWidth() + infoDecoration.getImage().getBounds().width;
-
- hostCombo.addListener(SWT.Selection, listener);
- hostCombo.addListener(SWT.Modify, listener);
-
- // Repository Path
- createLabel(g, CVSUIMessages.ConfigurationWizardMainPage_repositoryPath);
- repositoryPathCombo = createEditableCombo(g);
- repositoryPathCombo.addListener(SWT.Selection, listener);
- repositoryPathCombo.addListener(SWT.Modify, listener);
-
- g = createGroup(composite, CVSUIMessages.ConfigurationWizardMainPage_Authentication_2);
-
- // User name
- createLabel(g, CVSUIMessages.ConfigurationWizardMainPage_userName);
- userCombo = createEditableCombo(g);
- userCombo.addListener(SWT.Selection, listener);
- userCombo.addListener(SWT.Modify, listener);
-
- // Password
- createLabel(g, CVSUIMessages.ConfigurationWizardMainPage_password);
- passwordText = createPasswordField(g);
- passwordText.addListener(SWT.Modify, listener);
-
- g = createGroup(composite, CVSUIMessages.ConfigurationWizardMainPage_Connection_3);
-
- // Connection type
- createLabel(g, CVSUIMessages.ConfigurationWizardMainPage_connection);
- connectionMethodCombo = createCombo(g);
- connectionMethodCombo.addListener(SWT.Selection, listener);
-
- // Port number
- // create a composite to ensure the radio buttons come in the correct order
- Composite portGroup = new Composite(g, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- portGroup.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- portGroup.setLayout(layout);
- useDefaultPort = createRadioButton(portGroup, CVSUIMessages.ConfigurationWizardMainPage_useDefaultPort, 2);
- useCustomPort = createRadioButton(portGroup, CVSUIMessages.ConfigurationWizardMainPage_usePort, 1);
- useCustomPort.addListener(SWT.Selection, listener);
- portText = createTextField(portGroup);
- portText.addListener(SWT.Modify, listener);
-
- // create a composite to ensure the validate button is in its own tab group
- if (showValidate) {
- Composite validateButtonTabGroup = new Composite(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 2;
- validateButtonTabGroup.setLayoutData(data);
- validateButtonTabGroup.setLayout(new FillLayout());
-
- validateButton = new Button(validateButtonTabGroup, SWT.CHECK);
- validateButton.setText(CVSUIMessages.ConfigurationWizardAutoconnectPage_validate);
- validateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- validate = validateButton.getSelection();
- }
- });
- }
-
- allowCachingButton = new Button(composite, SWT.CHECK);
- allowCachingButton.setText(CVSUIMessages.UserValidationDialog_6);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
-
- Composite warningComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(CVSUIMessages.UserValidationDialog_7);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- GC gc= new GC(composite);
- gc.setFont(parent.getFont());
- FontMetrics fontMetrics= gc.getFontMetrics();
- gc.dispose();
- data.heightHint= Dialog.convertHeightInCharsToPixels(fontMetrics, 3);
- warningText.setLayoutData(data);
-
- Link extPrefLink = new Link(composite, SWT.NONE);
- extPrefLink.setText(CVSUIMessages.ConfigurationWizardMainPage_7);
- extPrefLink.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(getShell(),
- "org.eclipse.team.cvs.ui.ExtMethodPreferencePage", //$NON-NLS-1$
- new String[] {
- "org.eclipse.team.cvs.ui.cvs", //$NON-NLS-1$
- "org.eclipse.team.cvs.ui.ExtMethodPreferencePage", //$NON-NLS-1$
- "org.eclipse.jsch.ui.SSHPreferences", //$NON-NLS-1$
- "org.eclipse.ui.net.NetPreferences"}, //$NON-NLS-1$
- null);
- prefDialog.open();
- }
-
- });
-
-
- initializeValues();
- updateWidgetEnablements();
- hostCombo.setFocus();
-
- setControl(composite);
- Dialog.applyDialogFont(parent);
- }
- /**
- * Utility method to create an editable combo box
- *
- * @param parent the parent of the combo box
- * @return the created combo
- */
- protected Combo createEditableCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.NULL);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
-
- protected Group createGroup(Composite parent, String text) {
- Group group = new Group(parent, SWT.NULL);
- group.setText(text);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- //data.widthHint = GROUP_WIDTH;
-
- group.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- group.setLayout(layout);
- return group;
- }
-
- /*
- * Create a Proeprties node that contains everything needed to create a repository location
- */
- private Properties createProperties() {
- Properties result = new Properties();
- result.setProperty("connection", connectionMethodCombo.getText()); //$NON-NLS-1$
- result.setProperty("user", userCombo.getText()); //$NON-NLS-1$
- result.setProperty("password", passwordText.getText()); //$NON-NLS-1$
- result.setProperty("host", hostCombo.getText()); //$NON-NLS-1$
- if (useCustomPort.getSelection()) {
- result.setProperty("port", portText.getText()); //$NON-NLS-1$
- }
- result.setProperty("root", repositoryPathCombo.getText()); //$NON-NLS-1$
- return result;
- }
-
- /**
- * Crate a new location with the information entered on the page.
- * The location will exists and can be sed for connecting but is not
- * registered for persistance. This method must be called from the UI
- * thread.
- * @return a location or <code>null</code>
- * @throws CVSException
- */
- public ICVSRepositoryLocation getLocation() throws CVSException {
- if (location == null) {
- if (!isPageComplete()) return null;
- location = CVSRepositoryLocation.fromProperties(createProperties());
- if (location.equals(oldLocation)) {
- location = oldLocation;
- }
- location.setAllowCaching(allowCaching);
- oldLocation = null;
- saveWidgetValues();
- }
- return location;
- }
-
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- // Set remembered values
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] hostNames = settings.getArray(STORE_HOSTNAME_ID);
- if (hostNames != null) {
- for (int i = 0; i < hostNames.length; i++) {
- hostCombo.add(hostNames[i]);
- }
- }
- String[] paths = settings.getArray(STORE_PATH_ID);
- if (paths != null) {
- for (int i = 0; i < paths.length; i++) {
- repositoryPathCombo.add(paths[i]);
- }
- }
- String[] userNames = settings.getArray(STORE_USERNAME_ID);
- if (userNames != null) {
- for (int i = 0; i < userNames.length; i++) {
- userCombo.add(userNames[i]);
- }
- }
- userCombo.add(ANONYMOUS_USER);
- if (showValidate) {
- validate = !settings.getBoolean(STORE_DONT_VALIDATE_ID);
- validateButton.setSelection(validate);
- }
- }
-
- // Initialize other values and widget states
- IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- connectionMethodCombo.add(methods[i].getName());
- }
-
- // pserver is a default connection method
- int defaultIndex = connectionMethodCombo.indexOf("pserver") != -1 ? connectionMethodCombo.indexOf("pserver") : 0; //$NON-NLS-1$ //$NON-NLS-2$
-
- connectionMethodCombo.select(defaultIndex);
- useDefaultPort.setSelection(true);
-
- if(properties != null) {
- String method = properties.getProperty("connection"); //$NON-NLS-1$
- if (method == null) {
- connectionMethodCombo.select(defaultIndex);
- } else {
- connectionMethodCombo.select(connectionMethodCombo.indexOf(method));
- }
-
- String user = properties.getProperty("user"); //$NON-NLS-1$
- if (user != null) {
- userCombo.setText(user);
- }
-
- String password = properties.getProperty("password"); //$NON-NLS-1$
- if (password != null) {
- passwordText.setText(password);
- }
-
- String host = properties.getProperty("host"); //$NON-NLS-1$
- if (host != null) {
- hostCombo.setText(host);
- }
-
- String port = properties.getProperty("port"); //$NON-NLS-1$
- if (port != null) {
- useCustomPort.setSelection(true);
- portText.setText(port);
- }
-
- String repositoryPath = properties.getProperty("root"); //$NON-NLS-1$
- if (repositoryPath != null) {
- repositoryPathCombo.setText(repositoryPath);
- }
- }
- }
- /**
- * Saves the widget values
- */
- private void saveWidgetValues() {
- // Update history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String userName = userCombo.getText();
- if (!userName.equals(ANONYMOUS_USER)) {
- String[] userNames = settings.getArray(STORE_USERNAME_ID);
- if (userNames == null) userNames = new String[0];
- userNames = addToHistory(userNames, userName);
- 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.
- */
- protected void validateFields() {
- String user = userCombo.getText();
- IStatus status = validateUserName(user);
- if (!isStatusOK(status)) {
- return;
- }
-
- String host = hostCombo.getText();
- status = validateHost(host);
- if (!isStatusOK(status)) {
- return;
- }
-
- if (portText.isEnabled()) {
- String port = portText.getText();
- status = validatePort(port);
- if (!isStatusOK(status)) {
- return;
- }
- }
-
- String pathString = repositoryPathCombo.getText();
- status = validatePath(pathString);
- if (!isStatusOK(status)) {
- return;
- }
-
- try {
- CVSRepositoryLocation l = CVSRepositoryLocation.fromProperties(createProperties());
- if (!l.equals(oldLocation) && KnownRepositories.getInstance().isKnownRepository(l.getLocation())) {
- setErrorMessage(CVSUIMessages.ConfigurationWizardMainPage_0);
- setPageComplete(false);
- return;
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- // Let it pass. Creation should fail
- }
-
- // Everything passed so we're good to go
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- private boolean isStatusOK(IStatus status) {
- if (!status.isOK()) {
- if (status.getCode() == REQUIRED_FIELD) {
- // Don't set the message for an empty field
- setErrorMessage(null);
- } else {
- setErrorMessage(status.getMessage());
- }
- setPageComplete(false);
- return false;
- }
- return true;
- }
-
- public boolean getValidate() {
- return validate;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- hostCombo.setFocus();
- }
- }
-
- public static final int REQUIRED_FIELD = 1;
- public static final int INVALID_FIELD_CONTENTS = 2;
- public static final IStatus validateUserName(String user) {
- if (user.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, CVSUIMessages.ConfigurationWizardMainPage_1, null);
- }
- if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_invalidUserName, null);
- }
- if (user.startsWith(" ") || user.endsWith(" ")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_6, null);
- }
- return Status.OK_STATUS;
- }
- public static final IStatus validateHost(String host) {
- if (host.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, CVSUIMessages.ConfigurationWizardMainPage_2, null);
- }
- if (host.indexOf(':') != -1) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_invalidHostName, null);
- }
- if (host.startsWith(" ") || host.endsWith(" ")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_5, null);
- }
- return Status.OK_STATUS;
- }
- public static final IStatus validatePort(String port) {
- if (port.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, CVSUIMessages.ConfigurationWizardMainPage_3, null);
- }
- try {
- Integer.parseInt(port);
- } catch (NumberFormatException e) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_invalidPort, null);
- }
- return Status.OK_STATUS;
- }
- public static final IStatus validatePath(String pathString) {
- if (pathString.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, CVSUIMessages.ConfigurationWizardMainPage_4, null);
- }
- IPath path = new Path(null, pathString);
- String[] segments = path.segments();
- for (int i = 0; i < segments.length; i++) {
- String string = segments[i];
- if (string.charAt(0) == ' ' || string.charAt(string.length() -1) == ' ') {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_invalidPathWithSpaces, null);
- }
- }
- // look for // and inform the user that we support use of C:\cvs\root instead of /c//cvs/root
- if (pathString.indexOf("//") != -1) { //$NON-NLS-1$
- if (pathString.indexOf("//") == 2) { //$NON-NLS-1$
- // The user is probably trying to specify a CVSNT path
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_useNTFormat, null);
- } else {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_invalidPathWithSlashes, null);
- }
- }
- if (pathString.endsWith("/")) { //$NON-NLS-1$
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- CVSUIMessages.ConfigurationWizardMainPage_invalidPathWithTrailingSlash, null);
- }
- return Status.OK_STATUS;
- }
-}
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 43dfc643a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
+++ /dev/null
@@ -1,1759 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Benjamin Muskalla (b.muskalla@gmx.net) - Bug 149672 [Patch] Create Patch wizard should remember previous settings
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IDiffVisitor;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Diff;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.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.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CreatePatchWizardParticipant;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.BaseWorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * A wizard for creating a patch file by running the CVS diff command.
- */
-public class GenerateDiffFileWizard extends Wizard {
-
- //The initial size of this wizard.
- private final static int INITIAL_WIDTH = 300;
- private final static int INITIAL_HEIGHT = 350;
-
- public static void run(IWorkbenchPart part, final IResource[] resources, boolean unifiedSelectionEnabled) {
- final String title = CVSUIMessages.GenerateCVSDiff_title;
- final GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(part,resources, unifiedSelectionEnabled);
- wizard.setWindowTitle(title);
- WizardDialog dialog = new WizardDialog(part.getSite().getShell(), wizard);
- dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT);
- dialog.open();
- }
-
- public static void run(IWorkbenchPart part, final IResource[] resources) {
- GenerateDiffFileWizard.run(part,resources,true);
- }
-
- /**
- * Page to select a patch file. Overriding validatePage was necessary to allow
- * entering a file name that already exists.
- */
- public class LocationPage extends WizardPage {
-
- /**
- * The possible locations to save a patch.
- */
- public final static int CLIPBOARD = 1;
- public final static int FILESYSTEM = 2;
- public final static int WORKSPACE = 3;
-
- /**
- * GUI controls for clipboard (cp), filesystem (fs) and workspace (ws).
- */
- private Button cpRadio;
-
- private Button fsRadio;
- protected Text fsPathText;
- private Button fsBrowseButton;
- private boolean fsBrowsed = false;
-
- private Button wsRadio;
- protected Text wsPathText;
- private Button wsBrowseButton;
- private boolean wsBrowsed = false;
-
- protected CreatePatchWizardParticipant fParticipant;
- private Button chgSelectAll;
- private Button chgDeselectAll;
-
- /**
- * State information of this page, updated by the listeners.
- */
- protected boolean canValidate;
- protected boolean pageValid;
- protected IContainer wsSelectedContainer;
- protected IPath[] foldersToCreate;
- protected int selectedLocation;
-
- /**
- * The default values store used to initialize the selections.
- */
- private final DefaultValuesStore store;
-
-
- class LocationPageContentProvider extends BaseWorkbenchContentProvider {
- //Never show closed projects
- boolean showClosedProjects=false;
-
- public Object[] getChildren(Object element) {
- if (element instanceof IWorkspace) {
- // check if closed projects should be shown
- IProject[] allProjects = ((IWorkspace) element).getRoot().getProjects();
- if (showClosedProjects)
- return allProjects;
-
- ArrayList accessibleProjects = new ArrayList();
- for (int i = 0; i < allProjects.length; i++) {
- if (allProjects[i].isOpen()) {
- accessibleProjects.add(allProjects[i]);
- }
- }
- return accessibleProjects.toArray();
- }
-
- return super.getChildren(element);
- }
- }
-
- class WorkspaceDialog extends TitleAreaDialog {
-
- protected TreeViewer wsTreeViewer;
- protected Text wsFilenameText;
- protected Image dlgTitleImage;
-
- public WorkspaceDialog(Shell shell) {
- super(shell);
- }
-
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- setTitle(CVSUIMessages.Select_a_folder_then_type_in_the_file_name__8);
- //create title image
- dlgTitleImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF).createImage();
- setTitleImage(dlgTitleImage);
-
- return control;
- }
-
- protected Control createDialogArea(Composite parent){
- Composite composite = (Composite) super.createDialogArea(parent);
-
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- composite.setLayout(layout);
- final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- composite.setLayoutData(data);
-
- getShell().setText(CVSUIMessages.GenerateDiffFileWizard_9);
-
- wsTreeViewer = new TreeViewer(composite, SWT.BORDER);
- final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint= 550;
- gd.heightHint= 250;
- wsTreeViewer.getTree().setLayoutData(gd);
-
- wsTreeViewer.setContentProvider(new LocationPageContentProvider());
- wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
- wsTreeViewer.setInput(ResourcesPlugin.getWorkspace());
-
- //Open to whatever is selected in the workspace field
- IPath existingWorkspacePath = new Path(wsPathText.getText());
- if (existingWorkspacePath != null){
- //Ensure that this workspace path is valid
- IResource selectedResource = ResourcesPlugin.getWorkspace().getRoot().findMember(existingWorkspacePath);
- if (selectedResource != null) {
- wsTreeViewer.expandToLevel(selectedResource, 0);
- wsTreeViewer.setSelection(new StructuredSelection(selectedResource));
- }
- }
-
- final Composite group = new Composite(composite, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- group.setLayout(layout);
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- final Label label = new Label(group, SWT.NONE);
- label.setLayoutData(new GridData());
- label.setText(CVSUIMessages.Fi_le_name__9);
-
- wsFilenameText = new Text(group,SWT.BORDER);
- wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- setupListeners();
-
- return parent;
- }
-
- protected void okPressed() {
- //make sure that a filename has been typed in
-
- String patchName = wsFilenameText.getText();
-
- if (patchName.equals("")){ //$NON-NLS-1$
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_2);
- return;
- }
-
- //make sure that the filename does not contain more than one segment
- if (!(ResourcesPlugin.getWorkspace().validateName(patchName, IResource.FILE)).isOK()){
- wsFilenameText.setText(""); //$NON-NLS-1$
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_File_multisegments);
- return;
- }
-
- //Make sure that a container has been selected
- if (wsSelectedContainer == null){
- getSelectedContainer();
- }
- Assert.isNotNull(wsSelectedContainer);
-
- IFile file = wsSelectedContainer.getFile(new Path(wsFilenameText.getText()));
- if (file != null)
- wsPathText.setText(file.getFullPath().toString());
-
- validatePage();
- super.okPressed();
- }
-
- private void getSelectedContainer() {
- Object obj = ((IStructuredSelection)wsTreeViewer.getSelection()).getFirstElement();
- if (obj instanceof IContainer)
- wsSelectedContainer = (IContainer) obj;
- else if (obj instanceof IFile){
- wsSelectedContainer = ((IFile) obj).getParent();
- }
- }
-
- protected void cancelPressed() {
- validatePage();
- super.cancelPressed();
- }
-
- public boolean close() {
- if (dlgTitleImage != null)
- dlgTitleImage.dispose();
- return super.close();
- }
-
- void setupListeners(){
- wsTreeViewer.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection s = (IStructuredSelection)event.getSelection();
- Object obj=s.getFirstElement();
- if (obj instanceof IContainer)
- wsSelectedContainer = (IContainer) obj;
- else if (obj instanceof IFile){
- IFile tempFile = (IFile) obj;
- wsSelectedContainer = tempFile.getParent();
- wsFilenameText.setText(tempFile.getName());
- }
- }
- });
-
- wsTreeViewer.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection s= event.getSelection();
- if (s instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection)s).getFirstElement();
- if (wsTreeViewer.getExpandedState(item))
- wsTreeViewer.collapseToLevel(item, 1);
- else
- wsTreeViewer.expandToLevel(item, 1);
- }
- }
- });
-
- wsFilenameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setErrorMessage(null);
- }
- });
- }
- }
-
- LocationPage(String pageName, String title, ImageDescriptor image, DefaultValuesStore store) {
- super(pageName, title, image);
- setPageComplete(false);
- this.store= store;
- this.canValidate=false;
- }
-
- /**
- * Allow the user to finish if a valid file has been entered.
- */
- protected boolean validatePage() {
-
- if (!canValidate)
- return false;
-
- switch (selectedLocation) {
- case WORKSPACE:
- pageValid= validateWorkspaceLocation();
- break;
- case FILESYSTEM:
- pageValid= validateFilesystemLocation();
- break;
- case CLIPBOARD:
- pageValid= true;
- break;
- }
-
- /**
- * Avoid draw flicker by clearing error message
- * if all is valid.
- */
- if (pageValid) {
- setMessage(null);
- setErrorMessage(null);
- }
- setPageComplete(pageValid);
- return pageValid;
- }
-
- /**
- * The following conditions must hold for the file system location
- * to be valid:
- * - the path must be valid and non-empty
- * - the path must be absolute
- * - the specified file must be of type file
- * - the parent must exist (new folders can be created via the browse button)
- */
- private boolean validateFilesystemLocation() {
- final String pathString= fsPathText.getText().trim();
- if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { //$NON-NLS-1$
- if (fsBrowsed)
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_0);
- return false;
- }
-
- final File file= new File(pathString);
- if (!file.isAbsolute()) {
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_0);
- return false;
- }
-
- if (file.isDirectory()) {
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_2);
- return false;
- }
-
- if (pathString.endsWith("/") || pathString.endsWith("\\")) { //$NON-NLS-1$//$NON-NLS-2$
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_3);
- return false;
- }
-
- final File parent= file.getParentFile();
- if (!(parent.exists() && parent.isDirectory())) {
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_3);
- return false;
- }
- return true;
- }
-
- /**
- * The following conditions must hold for the file system location to be valid:
- * - a parent must be selected in the workspace tree view
- * - the resource name must be valid
- */
- private boolean validateWorkspaceLocation() {
- //make sure that the field actually has a filename in it - making
- //sure that the user has had a chance to browse the workspace first
- if (wsPathText.getText().equals("")){ //$NON-NLS-1$
- if (selectedLocation ==WORKSPACE && wsBrowsed)
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_5);
- return false;
- }
-
- //Make sure that all the segments but the last one (i.e. project + all
- //folders) exist - file doesn't have to exist. It may have happened that
- //some folder refactoring has been done since this path was last saved.
- //
- //Assume that the path will always be in format project/{folders}*/file - this
- //is controlled by the workspace location dialog
-
-
- IPath pathToWorkspaceFile = new Path(wsPathText.getText());
- //Trim file name from path
- IPath containerPath = pathToWorkspaceFile.removeLastSegments(1);
-
- IResource container =ResourcesPlugin.getWorkspace().getRoot().findMember(containerPath);
- if (container == null) {
- if (selectedLocation == WORKSPACE)
- setErrorMessage(CVSUIMessages.GenerateDiffFileWizard_4);
- return false;
- }
-
- return true;
- }
-
- /**
- * Answers a full path to a file system file or <code>null</code> if the user
- * selected to save the patch in the clipboard.
- */
- public File getFile() {
- if (pageValid && selectedLocation == FILESYSTEM) {
- return new File(fsPathText.getText().trim());
- }
- if (pageValid && selectedLocation == WORKSPACE) {
- final String filename= wsPathText.getText().trim();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- final IFile file= root.getFile(new Path(filename));
- return file.getLocation().toFile();
- }
- return null;
- }
-
- /**
- * Answers the workspace string entered in the dialog or <code>null</code> if the user
- * selected to save the patch in the clipboard or file system.
- */
- public String getWorkspaceLocation() {
-
- if (pageValid && selectedLocation == WORKSPACE) {
- final String filename= wsPathText.getText().trim();
- return filename;
- }
- return null;
- }
-
- /**
- * Get the selected workspace resource if the patch is to be saved in the
- * workspace, or null otherwise.
- */
- public IResource getResource() {
- if (pageValid && selectedLocation == WORKSPACE) {
- IPath pathToWorkspaceFile = new Path(wsPathText.getText().trim());
- //Trim file name from path
- IPath containerPath = pathToWorkspaceFile.removeLastSegments(1);
- return ResourcesPlugin.getWorkspace().getRoot().findMember(containerPath);
- }
- return null;
- }
-
- /**
- * Allow the user to chose to save the patch to the workspace or outside
- * of the workspace.
- */
- public void createControl(Composite parent) {
-
- final Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- setControl(composite);
- initializeDialogUnits(composite);
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PATCH_SELECTION_PAGE);
-
- //Create a location group
- Group locationGroup = new Group(composite, SWT.None);
- GridLayout layout = new GridLayout();
- locationGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- locationGroup.setLayoutData(data);
- locationGroup.setText(CVSUIMessages.GenerateDiffFileWizard_9);
- //
- setupClipboardControls(locationGroup);
- setupFilesystemControls(locationGroup);
- setupWorkspaceControls(locationGroup);
-
- initializeDefaultValues();
-
- fParticipant = new CreatePatchWizardParticipant(new ResourceScope(((GenerateDiffFileWizard)this.getWizard()).resources), (GenerateDiffFileWizard) this.getWizard());
- try {
- getAllOutOfSync();
- } catch (CVSException e) {}
-
- final PixelConverter converter= new PixelConverter(parent);
- createChangesArea(composite, converter);
-
- createSelectionButtons(composite);
-
- Dialog.applyDialogFont(parent);
-
- /**
- * Ensure the page is in a valid state.
- */
- /*if (!validatePage()) {
- store.storeRadioSelection(CLIPBOARD);
- initializeDefaultValues();
- validatePage();
- }
- pageValid= true;*/
- validatePage();
-
- updateEnablements();
- setupListeners();
- }
-
-
- private void createSelectionButtons(Composite composite) {
- final Composite buttonGroup = new Composite(composite,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- buttonGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END
- | GridData.VERTICAL_ALIGN_CENTER);
- buttonGroup.setLayoutData(data);
-
- chgSelectAll = createSelectionButton(CVSUIMessages.GenerateDiffFileWizard_SelectAll, buttonGroup);
- chgDeselectAll = createSelectionButton(CVSUIMessages.GenerateDiffFileWizard_DeselectAll, buttonGroup);
- }
-
- private Button createSelectionButton(String buttonName, Composite buttonGroup) {
- Button button = new Button(buttonGroup,SWT.PUSH);
- button.setText(buttonName);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = Math.max(widthHint, minSize.x);
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Setup the controls for the workspace option.
- */
- private void setupWorkspaceControls(Composite composite) {
- GridLayout layout;
-
- wsRadio= new Button(composite, SWT.RADIO);
- wsRadio.setText(CVSUIMessages.Save_In_Workspace_7);
-
- final Composite nameGroup = new Composite(composite,SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- nameGroup.setLayoutData(data);
-
- wsPathText= new Text(nameGroup, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.verticalAlignment = GridData.CENTER;
- gd.grabExcessVerticalSpace = false;
- gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- wsPathText.setLayoutData(gd);
- wsPathText.setEditable(false);
-
- wsBrowseButton = new Button(nameGroup, SWT.NULL);
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- gd.widthHint = Math.max(widthHint, wsBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- wsBrowseButton.setLayoutData(gd);
- wsBrowseButton.setText(CVSUIMessages.Browse____4);
- }
-
- /**
- * Setup the controls for the file system option.
- */
- private void setupFilesystemControls(final Composite composite) {
- GridLayout layout;
- fsRadio= new Button(composite, SWT.RADIO);
-
- fsRadio.setText(CVSUIMessages.Save_In_File_System_3);
-
- final Composite nameGroup = new Composite(composite,SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- nameGroup.setLayoutData(data);
-
- fsPathText= new Text(nameGroup, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.verticalAlignment = GridData.CENTER;
- gd.grabExcessVerticalSpace = false;
- gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- fsPathText.setLayoutData(gd);
-
- fsBrowseButton = new Button(nameGroup, SWT.NULL);
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- gd.widthHint = Math.max(widthHint, fsBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- fsBrowseButton.setLayoutData(gd);
- fsBrowseButton.setText(CVSUIMessages.Browse____4);
- }
-
- /**
- * Setup the controls for the clipboard option.
- */
- private void setupClipboardControls(final Composite composite) {
- cpRadio= new Button(composite, SWT.RADIO);
- cpRadio.setText(CVSUIMessages.Save_To_Clipboard_2);
- }
-
- private ParticipantPagePane fPagePane;
- private PageBook bottomChild;
- private ISynchronizePageConfiguration fConfiguration;
-
- private void createChangesArea(Composite parent, PixelConverter converter) {
-
- int size = fParticipant.getSyncInfoSet().size();
- if (size > getFileDisplayThreshold()) {
- // Create a page book to allow eventual inclusion of changes
- bottomChild = new PageBook(parent, SWT.NONE);
- bottomChild.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, false));
- // Create composite for showing the reason for not showing the changes and a button to show them
- Composite changeDesc = new Composite(bottomChild, SWT.NONE);
- changeDesc.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
- SWTUtils.createLabel(changeDesc, NLS.bind(CVSUIMessages.CommitWizardCommitPage_1, new String[] { Integer.toString(size), Integer.toString(getFileDisplayThreshold()) }));
- Button showChanges = new Button(changeDesc, SWT.PUSH);
- showChanges.setText(CVSUIMessages.CommitWizardCommitPage_5);
- showChanges.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showChangesPane();
- }
- });
- showChanges.setLayoutData(new GridData());
- bottomChild.showPage(changeDesc);
- } else {
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
- composite.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true));
-
- createPlaceholder(composite);
-
- Control c = createChangesPage(composite, fParticipant);
- c.setLayoutData(SWTUtils.createHVFillGridData());
- }
- }
-
- protected void showChangesPane() {
- Control c = createChangesPage(bottomChild, fParticipant);
- bottomChild.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true));
- bottomChild.showPage(c);
- Dialog.applyDialogFont(getControl());
- ((Composite)getControl()).layout();
- }
-
- private Control createChangesPage(final Composite composite, WorkspaceSynchronizeParticipant participant) {
- fConfiguration= participant.createPageConfiguration();
- fPagePane= new ParticipantPagePane(getShell(), true /* modal */, fConfiguration, participant);
- Control control = fPagePane.createPartControl(composite);
- return control;
- }
-
- public void dispose() {
- if (fPagePane != null)
- fPagePane.dispose();
- super.dispose();
- }
-
- private int getFileDisplayThreshold() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_COMMIT_FILES_DISPLAY_THRESHOLD);
- }
-
- private void createPlaceholder(final Composite composite) {
- final Composite placeholder= new Composite(composite, SWT.NONE);
- placeholder.setLayoutData(new GridData(SWT.DEFAULT, convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_SPACING) /3));
- }
- /**
- * Initialize the controls with the saved default values which are
- * obtained from the DefaultValuesStore.
- */
- private void initializeDefaultValues() {
-
- selectedLocation= store.getLocationSelection();
-
- updateRadioButtons();
-
- /**
- * Text fields.
- */
- fsPathText.setText(store.getFilesystemPath());
- //We need to ensure that we have a valid workspace path - user
- //could have altered workspace since last time this was saved
- wsPathText.setText(store.getWorkspacePath());
- if(!validateWorkspaceLocation()) {
- wsPathText.setText(""); //$NON-NLS-1$
-
- //Don't open wizard with an error - instead change selection
- //to clipboard
- if (selectedLocation == WORKSPACE){
- //clear the error message caused by the workspace not having
- //any workspace path entered
- setErrorMessage(null);
- selectedLocation=CLIPBOARD;
- updateRadioButtons();
- }
- }
- }
-
- private void updateRadioButtons() {
- /**
- * Radio buttons
- */
- cpRadio.setSelection(selectedLocation == CLIPBOARD);
- fsRadio.setSelection(selectedLocation == FILESYSTEM);
- wsRadio.setSelection(selectedLocation == WORKSPACE);
- }
-
- /**
- * Setup all the listeners for the controls.
- */
- private void setupListeners() {
-
- cpRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= CLIPBOARD;
- validatePage();
- updateEnablements();
- }
- });
- fsRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= FILESYSTEM;
- validatePage();
- updateEnablements();
- }
- });
-
- wsRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= WORKSPACE;
- validatePage();
- updateEnablements();
- }
- });
-
- fsPathText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- });
-
- fsBrowseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- final FileDialog dialog = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE);
- if (pageValid) {
- final File file= new File(fsPathText.getText());
- dialog.setFilterPath(file.getParent());
- }
- dialog.setText(CVSUIMessages.Save_Patch_As_5);
- dialog.setFileName(CVSUIMessages.patch_txt_6);
- final String path = dialog.open();
- fsBrowsed = true;
- if (path != null) {
- fsPathText.setText(new Path(path).toOSString());
- }
- validatePage();
- }
- });
-
-
-
- wsBrowseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- final WorkspaceDialog dialog = new WorkspaceDialog(getShell());
- wsBrowsed = true;
- dialog.open();
- validatePage();
- }
- });
-
-
- chgSelectAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- initCheckedItems();
- //Only bother changing isPageComplete state if the current state
- //is not enabled
- if (!isPageComplete())
- setPageComplete((getSelectedResources()).length > 0);
- }
- });
-
- chgDeselectAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ISynchronizePage page = fConfiguration.getPage();
- if (page != null){
- Viewer viewer = page.getViewer();
- if (viewer instanceof CheckboxTreeViewer) {
- CheckboxTreeViewer treeViewer =(CheckboxTreeViewer)viewer;
- treeViewer.setCheckedElements(new Object[0]);
- }
- }
- //Only bother changing isPageComplete state if the current state
- //is enabled
- if (isPageComplete())
- setPageComplete((getSelectedResources()).length > 0);
- }
- });
-
- ISynchronizePage page = fConfiguration.getPage();
- if (page != null) {
- Viewer viewer = page.getViewer();
- if (viewer instanceof CheckboxTreeViewer) {
- ((CheckboxTreeViewer)viewer).addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- setPageComplete((resources = getSelectedResources()).length > 0);
- }
- });
- }
- }
- }
-
- protected void initCheckedItems() {
- ISynchronizePage page = fConfiguration.getPage();
- if (page != null) {
- Viewer viewer = page.getViewer();
- if (viewer instanceof CheckboxTreeViewer) {
- TreeItem[] items=((CheckboxTreeViewer)viewer).getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- ((CheckboxTreeViewer)viewer).setChecked(items[i].getData(), true);
- }
- }
- }
- }
-
- protected IResource[] getSelectedResources() {
- ISynchronizePage page = fConfiguration.getPage();
- if (page != null) {
- Viewer viewer = page.getViewer();
- if (viewer instanceof CheckboxTreeViewer) {
- Object[] elements = ((CheckboxTreeViewer)viewer).getCheckedElements();
- IResource[]selectedResources = Utils.getResources(elements);
- ArrayList result = new ArrayList();
- for (int i = 0; i < selectedResources.length; i++) {
- IResource resource = selectedResources[i];
- if (fConfiguration.getSyncInfoSet().getSyncInfo(resource) != null) {
- result.add(resource);
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
- }
- return new IResource[0];
- }
-
- /**
- * Enable and disable controls based on the selected radio button.
- */
- public void updateEnablements() {
- //clear any error message
- setErrorMessage(null);
- fsBrowseButton.setEnabled(selectedLocation == FILESYSTEM);
- fsPathText.setEnabled(selectedLocation == FILESYSTEM);
- if (selectedLocation == FILESYSTEM)
- fsBrowsed=false;
- wsPathText.setEnabled(selectedLocation == WORKSPACE);
- wsBrowseButton.setEnabled(selectedLocation == WORKSPACE);
- if (selectedLocation == WORKSPACE)
- wsBrowsed=false;
- }
-
- public int getSelectedLocation() {
- return selectedLocation;
- }
-
- private SyncInfoSet getAllOutOfSync() throws CVSException {
- final SubscriberSyncInfoCollector syncInfoCollector = fParticipant.getSubscriberSyncInfoCollector();
- //WaitForChangesJob waits for the syncInfoCollector to get all the changes
- //before checking off the tree items and validating the page
- class WaitForChangesJob extends Job{
- LocationPage fLocationPage;
-
- public WaitForChangesJob(LocationPage page) {
- super(""); //$NON-NLS-1$
- fLocationPage=page;
- }
- public IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(CVSUIMessages.CommitWizard_4, IProgressMonitor.UNKNOWN);
- syncInfoCollector.waitForCollector(monitor);
- Utils.syncExec(new Runnable() {
- public void run() {
- fLocationPage.initCheckedItems();
- fLocationPage.canValidate=true;
- fLocationPage.validatePage();
- }
- }, getControl());
- monitor.done();
- return Status.OK_STATUS;
- }
- }
- WaitForChangesJob job =new WaitForChangesJob(this);
- //Don't need the job in the UI, make it a system job
- job.setSystem(true);
- job.schedule();
- return fParticipant.getSyncInfoSet();
- }
-
- public boolean hasBinaryFiles() {
- try {
- final boolean[] found = new boolean[] { false };
- fParticipant.getSubscriber().accept(resources, IResource.DEPTH_INFINITE, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (isBinaryFile(diff))
- found[0] = true;
- return true;
- }
- });
- return found[0];
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- return false;
- }
-
- protected boolean isBinaryFile(IDiff diff) {
- IFile file = getFile(diff);
- if (file != null) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- try {
- byte[] bytes = cvsFile.getSyncBytes();
- if (bytes != null) {
- return ResourceSyncInfo.getKeywordMode(bytes).toMode().equals(
- Command.KSUBST_BINARY.toMode());
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- return (Team.getFileContentManager().getType(file) == Team.BINARY);
- }
- return false;
- }
-
- protected IFile getFile(IDiff diff) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- return file;
- }
- return null;
- }
-
- public void removeBinaryFiles() {
- try {
- final List nonBinaryFiles = new ArrayList();
- fParticipant.getSubscriber().accept(resources, IResource.DEPTH_INFINITE, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (!isBinaryFile(diff)) {
- IFile file = getFile(diff);
- if (file != null)
- nonBinaryFiles.add(file);
- }
- return true;
- }
- });
- resources = (IResource[]) nonBinaryFiles
- .toArray(new IResource[nonBinaryFiles.size()]);
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- }
-
- /**
- * Page to select the options for creating the patch.
- *
- * @param pageName the name of the page
- * @param title the title for this wizard page,
- * or <code>null</code> if none
- * @param titleImage the image descriptor for the title of this wizard page,
- * or <code>null</code> if none
- * @param store the value store where the page stores it's data
- */
- private class OptionsPage extends WizardPage {
-
- /**
- * The possible file format to save a patch.
- */
- public final static int FORMAT_UNIFIED = 1;
- public final static int FORMAT_CONTEXT = 2;
- public final static int FORMAT_STANDARD = 3;
-
- /**
- The possible root of the patch
- */
- public final static int ROOT_WORKSPACE = 1;
- public final static int ROOT_PROJECT = 2;
- public final static int ROOT_SELECTION = 3;
-
- private Button unifiedDiffOption;
- private Button unified_workspaceRelativeOption; //multi-patch format
- private Button unified_projectRelativeOption; //full project path
- private Button unified_selectionRelativeOption; //use path of whatever is selected
- private Button contextDiffOption;
- private Button regularDiffOption;
- private final RadioButtonGroup diffTypeRadioGroup = new RadioButtonGroup();
- private final RadioButtonGroup unifiedRadioGroup = new RadioButtonGroup();
-
- private boolean patchHasCommonRoot=true;
- protected IPath patchRoot=ResourcesPlugin.getWorkspace().getRoot().getFullPath();
-
- private final DefaultValuesStore store;
-
- /**
- * Constructor for PatchFileCreationOptionsPage.
- */
- protected OptionsPage(String pageName, String title, ImageDescriptor titleImage, DefaultValuesStore store) {
- super(pageName, title, titleImage);
- this.store = store;
- }
-
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- composite.setLayout(layout);
- composite.setLayoutData(new GridData());
- setControl(composite);
-
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PATCH_OPTIONS_PAGE);
-
- 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(CVSUIMessages.Diff_output_format_12);
-
-
- unifiedDiffOption = new Button(diffTypeGroup, SWT.RADIO);
- unifiedDiffOption.setText(CVSUIMessages.Unified__format_required_by_Compare_With_Patch_feature__13);
-
- contextDiffOption = new Button(diffTypeGroup, SWT.RADIO);
- contextDiffOption.setText(CVSUIMessages.Context_14);
- regularDiffOption = new Button(diffTypeGroup, SWT.RADIO);
- regularDiffOption.setText(CVSUIMessages.Standard_15);
-
- diffTypeRadioGroup.add(FORMAT_UNIFIED, unifiedDiffOption);
- diffTypeRadioGroup.add(FORMAT_CONTEXT, contextDiffOption);
- diffTypeRadioGroup.add(FORMAT_STANDARD, regularDiffOption);
-
- //Unified Format Options
- Group unifiedGroup = new Group(composite, SWT.None);
- layout = new GridLayout();
- unifiedGroup.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- unifiedGroup.setLayoutData(data);
- unifiedGroup.setText(CVSUIMessages.GenerateDiffFileWizard_10);
-
- unified_workspaceRelativeOption = new Button(unifiedGroup, SWT.RADIO);
- unified_workspaceRelativeOption.setText(CVSUIMessages.GenerateDiffFileWizard_6);
- unified_workspaceRelativeOption.setSelection(true);
-
- unified_projectRelativeOption = new Button(unifiedGroup, SWT.RADIO);
- unified_projectRelativeOption.setText(CVSUIMessages.GenerateDiffFileWizard_7);
-
- unified_selectionRelativeOption = new Button(unifiedGroup, SWT.RADIO);
- unified_selectionRelativeOption.setText(CVSUIMessages.GenerateDiffFileWizard_8);
-
- unifiedRadioGroup.add(ROOT_WORKSPACE, unified_workspaceRelativeOption);
- unifiedRadioGroup.add(ROOT_PROJECT, unified_projectRelativeOption);
- unifiedRadioGroup.add(ROOT_SELECTION, unified_selectionRelativeOption);
-
- Dialog.applyDialogFont(parent);
-
- initializeDefaultValues();
-
- //add listeners
- unifiedDiffOption.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setEnableUnifiedGroup(true);
- updateEnablements();
- diffTypeRadioGroup.setSelection(FORMAT_UNIFIED, false);
- }
- });
-
- contextDiffOption.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setEnableUnifiedGroup(false);
- updateEnablements();
- diffTypeRadioGroup.setSelection(FORMAT_CONTEXT, false);
- }
- });
-
- regularDiffOption.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setEnableUnifiedGroup(false);
- updateEnablements();
- diffTypeRadioGroup.setSelection(FORMAT_STANDARD, false);
- }
- });
-
- unified_workspaceRelativeOption
- .addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- unifiedRadioGroup.setSelection(ROOT_WORKSPACE, false);
- }
- });
-
- unified_projectRelativeOption
- .addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- unifiedRadioGroup.setSelection(ROOT_PROJECT, false);
- }
- });
-
- unified_selectionRelativeOption
- .addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- unifiedRadioGroup.setSelection(ROOT_SELECTION, false);
- }
- });
-
- calculatePatchRoot();
- updateEnablements();
-
- // update selection
- diffTypeRadioGroup.selectEnabledOnly();
- unifiedRadioGroup.selectEnabledOnly();
- }
-
- public int getFormatSelection() {
- return diffTypeRadioGroup.getSelected();
- }
-
- public int getRootSelection() {
- return unifiedRadioGroup.getSelected();
- }
-
- private void initializeDefaultValues() {
- // Radio buttons for format
- diffTypeRadioGroup.setSelection(store.getFormatSelection(), true);
- // Radio buttons for patch root
- unifiedRadioGroup.setSelection(store.getRootSelection(), true);
-
- if (store.getFormatSelection() != FORMAT_UNIFIED) {
- setEnableUnifiedGroup(false);
- }
- }
-
-
- protected void updateEnablements() {
- if (!patchHasCommonRoot){
- diffTypeRadioGroup.setEnablement(false, new int[] {
- FORMAT_CONTEXT, FORMAT_STANDARD }, FORMAT_UNIFIED);
- unifiedRadioGroup.setEnablement(false, new int[] {
- ROOT_PROJECT, ROOT_SELECTION }, ROOT_WORKSPACE);
- }
-
- // temporary until we figure out best way to fix synchronize view
- // selection
- if (!unifiedSelectionEnabled)
- unifiedRadioGroup.setEnablement(false, new int[] {ROOT_SELECTION});
- }
-
- private void calculatePatchRoot(){
- //check to see if this is a multi select patch, if so disable
- IResource[] tempResources = ((GenerateDiffFileWizard)this.getWizard()).resources;
-
- //Guard for quick cancellation to avoid ArrayOutOfBounds (see Bug# 117234)
- if (tempResources == null)
- return;
-
- if (tempResources.length > 1){
- //Check to see is the selected resources are contained by the same parent (climbing
- //parent by parent to the project root)
- //If so, then allow selection relative patches -> set the relative path to the common
- //parent [also allow project relative patches]
- //If parents are different projects, allow only multiproject selection
-
- patchHasCommonRoot=true;
- int segmentMatch=-1;
- IPath path = tempResources[0].getFullPath().removeLastSegments(1);
- for (int i = 1; i < tempResources.length; i++) {
- int segments=path.matchingFirstSegments(tempResources[i].getFullPath());
- //Keep track of the lowest number of matches that were found - the common
- //path will be this number
- if (segmentMatch == -1 ||
- segmentMatch>segments){
- segmentMatch=segments;
- }
- //However, if no segments for any one resource - break out of the loop
- if (segments == 0){
- patchHasCommonRoot=false;
- break;
- }
- }
- if (patchHasCommonRoot){
- IPath tempPath = path.uptoSegment(segmentMatch);
- /*IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- while (!root.exists(tempPath) &&
- !tempPath.isRoot()){
- tempPath = tempPath.removeLastSegments(1);
- }*/
- patchRoot=tempPath;
- }
- } else {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-
- //take the file name off the path and use that as the patch root
- //patchRoot = tempResources[0].getFullPath().removeLastSegments(1);
- IPath fullPath = tempResources[0].getFullPath();
- IResource resource = root.findMember(fullPath);
-
- //keep trimming the path until we find something that can be used as the
- //patch root
- while (resource == null &&
- !(resource instanceof IWorkspaceRoot)){
- fullPath=fullPath.removeLastSegments(1);
- resource=root.findMember(fullPath);
- }
- patchRoot = resource.getFullPath();
- if (resource.getType() == IResource.FILE)
- patchRoot =resource.getFullPath().removeLastSegments(1);
- }
- }
- /**
- * Return the list of Diff command options configured on this page.
- */
- public LocalOption[] getOptions() {
- List options = new ArrayList(5);
- /* if(includeNewFilesOptions.getSelection()) {
- options.add(Diff.INCLUDE_NEWFILES);
- }
- if(!recurseOption.getSelection()) {
- options.add(Command.DO_NOT_RECURSE);
- }*/
-
- //Add new files for now
- options.add(Diff.INCLUDE_NEWFILES);
-
- 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()]);
- }
- protected void setEnableUnifiedGroup(boolean enabled){
- unifiedRadioGroup.setEnablement(enabled, new int[] {
- ROOT_WORKSPACE, ROOT_PROJECT, ROOT_SELECTION });
-
- //temporary until we figure out best way to fix synchronize view selection
- if (!unifiedSelectionEnabled)
- unifiedRadioGroup.setEnablement(false, new int[] {ROOT_SELECTION});
- }
- }
-
- /**
- * Class to retrieve and store the default selected values.
- */
- private final class DefaultValuesStore {
-
- private static final String PREF_LAST_SELECTION= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.lastselection"; //$NON-NLS-1$
- private static final String PREF_LAST_FS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.filesystem.path"; //$NON-NLS-1$
- private static final String PREF_LAST_WS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.workspace.path"; //$NON-NLS-1$
- private static final String PREF_LAST_AO_FORMAT = "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.OptionsPage.diff.format"; //$NON-NLS-1$
- private static final String PREF_LAST_AO_ROOT = "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.OptionsPage.patch.root"; //$NON-NLS-1$
-
-
- private final IDialogSettings dialogSettings;
-
- public DefaultValuesStore() {
- dialogSettings= CVSUIPlugin.getPlugin().getDialogSettings();
- }
-
- public int getLocationSelection() {
- int value= LocationPage.CLIPBOARD;
- try {
- value= dialogSettings.getInt(PREF_LAST_SELECTION);
- } catch (NumberFormatException e) {
- }
-
- switch (value) {
- case LocationPage.FILESYSTEM:
- case LocationPage.WORKSPACE:
- case LocationPage.CLIPBOARD:
- return value;
- default:
- return LocationPage.CLIPBOARD;
- }
- }
-
- public String getFilesystemPath() {
- final String path= dialogSettings.get(PREF_LAST_FS_PATH);
- return path != null ? path : ""; //$NON-NLS-1$
- }
-
- public String getWorkspacePath() {
- final String path= dialogSettings.get(PREF_LAST_WS_PATH);
- return path != null ? path : ""; //$NON-NLS-1$
- }
-
-
- public int getFormatSelection() {
- int value = OptionsPage.FORMAT_UNIFIED;
- try {
- value = dialogSettings.getInt(PREF_LAST_AO_FORMAT);
- } catch (NumberFormatException e) {
- }
-
- switch (value) {
- case OptionsPage.FORMAT_UNIFIED:
- case OptionsPage.FORMAT_CONTEXT:
- case OptionsPage.FORMAT_STANDARD:
- return value;
- default:
- return OptionsPage.FORMAT_UNIFIED;
- }
- }
-
- public int getRootSelection() {
- int value = OptionsPage.ROOT_WORKSPACE;
- try {
- value = dialogSettings.getInt(PREF_LAST_AO_ROOT);
- } catch (NumberFormatException e) {
- }
-
- switch (value) {
- case OptionsPage.ROOT_WORKSPACE:
- case OptionsPage.ROOT_PROJECT:
- case OptionsPage.ROOT_SELECTION:
- return value;
- default:
- return OptionsPage.ROOT_WORKSPACE;
- }
- }
-
- public void storeLocationSelection(int defaultSelection) {
- dialogSettings.put(PREF_LAST_SELECTION, defaultSelection);
- }
-
- public void storeFilesystemPath(String path) {
- dialogSettings.put(PREF_LAST_FS_PATH, path);
- }
-
- public void storeWorkspacePath(String path) {
- dialogSettings.put(PREF_LAST_WS_PATH, path);
- }
-
- public void storeOutputFormat(int selection) {
- dialogSettings.put(PREF_LAST_AO_FORMAT, selection);
- }
-
- public void storePatchRoot(int selection) {
- dialogSettings.put(PREF_LAST_AO_ROOT, selection);
- }
- }
-
- private LocationPage locationPage;
- private OptionsPage optionsPage;
-
- protected IResource[] resources;
- private final DefaultValuesStore defaultValuesStore;
- private final IWorkbenchPart part;
-
- //temporary until we figure out best way to fix synchronize view selection
- protected boolean unifiedSelectionEnabled;
-
- public GenerateDiffFileWizard(IWorkbenchPart part, IResource[] resources, boolean unifiedSelectionEnabled) {
- super();
- this.part = part;
- this.resources = resources;
- setWindowTitle(CVSUIMessages.GenerateCVSDiff_title);
- initializeDefaultPageImageDescriptor();
- defaultValuesStore= new DefaultValuesStore();
- this.unifiedSelectionEnabled=unifiedSelectionEnabled;
- }
-
- public void addPages() {
- String pageTitle = CVSUIMessages.GenerateCVSDiff_pageTitle;
- String pageDescription = CVSUIMessages.GenerateCVSDiff_pageDescription;
- locationPage = new LocationPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF), defaultValuesStore);
- locationPage.setDescription(pageDescription);
- addPage(locationPage);
-
- pageTitle = CVSUIMessages.Advanced_options_19;
- pageDescription = CVSUIMessages.Configure_the_options_used_for_the_CVS_diff_command_20;
- optionsPage = new OptionsPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF), defaultValuesStore);
- optionsPage.setDescription(pageDescription);
- addPage(optionsPage);
- }
-
- /**
- * Declares the wizard banner iamge descriptor
- */
- protected void initializeDefaultPageImageDescriptor() {
- final String iconPath= "icons/full/"; //$NON-NLS-1$
- try {
- final URL installURL = CVSUIPlugin.getPlugin().getBundle().getEntry("/"); //$NON-NLS-1$
- final URL url = new URL(installURL, iconPath + "wizards/newconnect_wiz.gif"); //$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- } catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
- }
-
- /* (Non-javadoc)
- * Method declared on IWizard.
- */
- public boolean needsProgressMonitor() {
- return true;
- }
-
- /**
- * Completes processing of the wizard. If this method returns <code>
- * true</code>, the wizard will close; otherwise, it will stay active.
- */
- public boolean performFinish() {
-
- final int location= locationPage.getSelectedLocation();
-
- final File file= location != LocationPage.CLIPBOARD? locationPage.getFile() : null;
-
- if (!(file == null || validateFile(file))) {
- return false;
- }
-
- //Is this a multi-patch?
- boolean multiPatch=false;
- if (optionsPage.unifiedDiffOption.getSelection() && optionsPage.unified_workspaceRelativeOption.getSelection())
- multiPatch=true;
-
-
- //If not a multipatch, patch should use project relative or selection relative paths[default]?
- boolean useProjectRelativePaths=false;
- if (optionsPage.unifiedDiffOption.getSelection() &&
- optionsPage.unified_projectRelativeOption.getSelection())
- useProjectRelativePaths=true;
-
- // TODO: Check for binary files
- if (locationPage.hasBinaryFiles()) {
- int result = promptToIncludeBinary();
- if (result == 2)
- return false;
- if (result == 1)
- locationPage.removeBinaryFiles();
- }
-
- /**
- * Perform diff operation.
- */
- try {
- if (file != null) {
- generateDiffToFile(file,multiPatch,useProjectRelativePaths);
- } else {
- generateDiffToClipboard(multiPatch,useProjectRelativePaths);
- }
- } catch (TeamException e) {}
-
- /**
- * Refresh workspace if necessary and save default selection.
- */
- switch (location) {
-
- case LocationPage.WORKSPACE:
- final String workspaceResource= locationPage.getWorkspaceLocation();
- if (workspaceResource != null){
- defaultValuesStore.storeLocationSelection(LocationPage.WORKSPACE);
- defaultValuesStore.storeWorkspacePath(workspaceResource);
- /* try {
- workspaceResource.getParent().refreshLocal(IResource.DEPTH_ONE, null);
- } catch(CoreException e) {
- CVSUIPlugin.openError(getShell(), CVSUIMessages.GenerateCVSDiff_error, null, e);
- return false;
- } */
- } else {
- //Problem with workspace location, open with clipboard next time
- defaultValuesStore.storeLocationSelection(LocationPage.CLIPBOARD);
- }
- break;
-
- case LocationPage.FILESYSTEM:
- defaultValuesStore.storeFilesystemPath(file.getPath());
- defaultValuesStore.storeLocationSelection(LocationPage.FILESYSTEM);
- break;
-
- case LocationPage.CLIPBOARD:
- defaultValuesStore.storeLocationSelection(LocationPage.CLIPBOARD);
- break;
-
- default:
- return false;
- }
-
-
- /**
- * Save default selections of Options Page
- */
-
- defaultValuesStore.storeOutputFormat(optionsPage.getFormatSelection());
- defaultValuesStore.storePatchRoot(optionsPage.getRootSelection());
-
- return true;
- }
-
- private int promptToIncludeBinary() {
- MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.GenerateDiffFileWizard_11, null, // accept
- // the
- // default
- // window
- // icon
- CVSUIMessages.GenerateDiffFileWizard_12, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 1); // no is the default
- return dialog.open();
- }
-
- private void generateDiffToClipboard(boolean multiPatch, boolean useProjectRelativePaths) throws TeamException {
- DiffOperation diffop = new ClipboardDiffOperation(part,RepositoryProviderOperation.asResourceMappers(resources),optionsPage.getOptions(),multiPatch, useProjectRelativePaths, optionsPage.patchRoot);
- try {
- diffop.run();
- } catch (InvocationTargetException e) {}
- catch (InterruptedException e) {}
- }
-
- private void generateDiffToFile(File file, boolean multiPatch, boolean useProjectRelativePaths) throws TeamException {
- DiffOperation diffop = null;
- if (locationPage.selectedLocation == LocationPage.WORKSPACE){
- diffop = new WorkspaceFileDiffOperation(part,RepositoryProviderOperation.asResourceMappers(resources),optionsPage.getOptions(),file, multiPatch, useProjectRelativePaths, optionsPage.patchRoot);
- }
- else {
- diffop = new FileDiffOperation(part,RepositoryProviderOperation.asResourceMappers(resources),optionsPage.getOptions(),file, multiPatch, useProjectRelativePaths, optionsPage.patchRoot);
- }
-
- try {
- diffop.run();
- } catch (InvocationTargetException e) {}
- catch (InterruptedException e) {}
- }
-
- public boolean validateFile(File file) {
-
- if (file == null)
- return false;
-
- /**
- * Consider file valid if it doesn't exist for now.
- */
- if (!file.exists())
- return true;
-
- /**
- * The file exists.
- */
- if (!file.canWrite()) {
- final String title= CVSUIMessages.GenerateCVSDiff_1;
- final String msg= CVSUIMessages.GenerateCVSDiff_2;
- final MessageDialog dialog= new MessageDialog(getShell(), title, null, msg, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
- dialog.open();
- return false;
- }
-
- final String title = CVSUIMessages.GenerateCVSDiff_overwriteTitle;
- final String msg = CVSUIMessages.GenerateCVSDiff_overwriteMsg;
- final MessageDialog dialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- dialog.open();
- if (dialog.getReturnCode() != 0)
- return false;
-
- return true;
- }
-
- public LocationPage getLocationPage() {
- return locationPage;
- }
-
- /**
- * The class maintain proper selection of radio button within the group:
- * <ul>
- * <li>Only one button can be selected at the time.</li>
- * <li>Disabled button can't be selected unless all buttons in the group
- * are disabled.</li>
- * </ul>
- */
- /*private*/ class RadioButtonGroup {
-
- /**
- * List of buttons in the group. Both radio groups contain 3 elements.
- */
- private List buttons = new ArrayList(3);
-
- /**
- * Index of the selected button.
- */
- private int selected = 0;
-
- /**
- * Add a button to the group. While adding a new button the method
- * checks if there is only one button selected in the group.
- *
- * @param buttonCode
- * A button's code (eg. <code>ROOT_WORKSPACE</code>). To get
- * an index we need to subtract 1 from it.
- * @param button
- * A button to add.
- */
- public void add(int buttonCode, Button button) {
- if (button != null && (button.getStyle() & SWT.RADIO) != 0) {
- if (button.getSelection() && !buttons.isEmpty()) {
- deselectAll();
- selected = buttonCode - 1;
- }
- buttons.add(buttonCode - 1, button);
- }
- }
-
- /**
- * Returns selected button's code.
- *
- * @return Selected button's code.
- */
- public int getSelected() {
- return selected + 1;
- }
-
- /**
- * Set selection to the given button. When
- * <code>selectEnabledOnly</code> flag is true the returned value can
- * differ from the parameter when a button we want to set selection to
- * is disabled and there are other buttons which are enabled.
- *
- * @param buttonCode
- * A button's code (eg. <code>ROOT_WORKSPACE</code>). To get
- * an index we need to subtract 1 from it.
- * @return Code of the button to which selection was finally set.
- */
- public int setSelection(int buttonCode, boolean selectEnabledOnly) {
- deselectAll();
-
- ((Button) buttons.get(buttonCode - 1)).setSelection(true);
- selected = buttonCode - 1;
- if (selectEnabledOnly)
- selected = selectEnabledOnly() - 1;
- return getSelected();
- }
-
- /**
- * Make sure that only an enabled radio button is selected.
- *
- * @return A code of the selected button.
- */
- public int selectEnabledOnly() {
- deselectAll();
-
- Button selectedButton = (Button) buttons.get(selected);
- if (!selectedButton.isEnabled()) {
- // if the button is disabled, set selection to an enabled one
- for (Iterator iterator = buttons.iterator(); iterator.hasNext();) {
- Button b = (Button) iterator.next();
- if (b.isEnabled()) {
- b.setSelection(true);
- selected = buttons.indexOf(b);
- return selected + 1;
- }
- }
- // if none found, reset the initial selection
- selectedButton.setSelection(true);
- } else {
- // because selection has been cleared, set it again
- selectedButton.setSelection(true);
- }
- // return selected button's code so the value can be stored
- return getSelected();
- }
-
- /**
- * Enable or disable given buttons.
- *
- * @param enabled
- * Indicates whether to enable or disable the buttons.
- * @param buttonsToChange
- * Buttons to enable/disable.
- * @param defaultSelection
- * The button to select if the currently selected button
- * becomes disabled.
- */
- public void setEnablement(boolean enabled, int[] buttonsToChange,
- int defaultSelection) {
-
- // enable (or disable) given buttons
- for (int i = 0; i < buttonsToChange.length; i++) {
- ((Button) this.buttons.get(buttonsToChange[i] - 1))
- .setEnabled(enabled);
- }
- // check whether the selected button is enabled
- if (!((Button) this.buttons.get(selected)).isEnabled()) {
- if (defaultSelection != -1)
- // set the default selection and check if it's enabled
- setSelection(defaultSelection, true);
- else
- // no default selection is given, select any enabled button
- selectEnabledOnly();
- }
- }
-
- /**
- * Enable or disable given buttons with no default selection. The selection
- * will be set to an enabled button using the <code>selectEnabledOnly</code> method.
- *
- * @param enabled Indicates whether to enable or disable the buttons.
- * @param buttonsToChange Buttons to enable/disable.
- */
- public void setEnablement(boolean enabled, int[] buttonsToChange) {
- // -1 means that no default selection is given
- setEnablement(enabled, buttonsToChange, -1);
- }
-
- /**
- * Deselect all buttons in the group.
- */
- private void deselectAll() {
- // clear all selections
- for (Iterator iterator = buttons.iterator(); iterator.hasNext();)
- ((Button) iterator.next()).setSelection(false);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java
deleted file mode 100644
index 7f44eeb0f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 16-Mar-2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-
-/**
- * Extended wizard interface that differentiates retrieving
- * the next page for display vs. for determining it's state
- */
-public interface ICVSWizard extends IWizard {
-
- /**
- * Get the wizard page that follows the given page. If
- * aboutToShow is true then the page will be shown.
- * Otherwise, only its state will be queried.
- * @param page a wizard page
- * @param aboutToShow true iof the page returned will be shown
- * @return the next wizard page
- */
- public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow);
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ImportWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ImportWizard.java
deleted file mode 100644
index c73259b1f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ImportWizard.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-
-public class ImportWizard extends CheckoutWizard {
-
- protected ImageDescriptor getBannerImageDescriptor() {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_IMPORT);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java
deleted file mode 100644
index 865d075fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
deleted file mode 100644
index 13bdf0d9b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.WorkspaceTraversalAction;
-import org.eclipse.team.internal.ccvs.ui.mappings.ModelMergeOperation;
-import org.eclipse.team.internal.ccvs.ui.mappings.ModelMergeParticipant;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class MergeWizard extends Wizard {
- MergeWizardPage page;
- IResource[] resources;
- private final IWorkbenchPart part;
- private final ResourceMapping[] mappings;
-
- public MergeWizard(IWorkbenchPart part, IResource[] resources, ResourceMapping[] mappings) {
- this.part = part;
- this.resources = resources;
- this.mappings = mappings;
- }
-
- public void addPages() {
- setNeedsProgressMonitor(true);
- TagSource tagSource = TagSource.create(resources);
- setWindowTitle(CVSUIMessages.MergeWizard_title);
- ImageDescriptor mergeImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE);
- page = new MergeWizardPage("mergePage", CVSUIMessages.MergeWizard_0, mergeImage, CVSUIMessages.MergeWizard_1, tagSource); //$NON-NLS-1$
- addPage(page);
- }
-
- public boolean performFinish() {
-
- CVSTag startTag = page.getStartTag();
- CVSTag endTag = page.getEndTag();
-
- if (startTag == null || !page.isPreview()) {
- // Perform the update (merge) in the background
- UpdateOperation op = new UpdateOperation(getPart(), mappings, getLocalOptions(startTag, endTag), null);
- try {
- op.run();
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // Ignore
- }
- } else {
- if (isShowModelSync()) {
- ModelMergeParticipant participant = ModelMergeParticipant.getMatchingParticipant(mappings, startTag, endTag);
- if(participant == null) {
- CVSMergeSubscriber s = new CVSMergeSubscriber(getProjects(resources), startTag, endTag);
- try {
- new ModelMergeOperation(getPart(), mappings, s, page.isOnlyPreviewConflicts()).run();
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(IStatus.ERROR, "Internal error", e.getTargetException()); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Ignore
- }
- } else {
- participant.refresh(null, mappings);
- }
- } else {
- // First check if there is an existing matching participant, if so then re-use it
- try {
- resources = getAllResources(startTag, endTag);
- } catch (InvocationTargetException e) {
- // Log and continue with the original resources
- CVSUIPlugin.log(IStatus.ERROR, "An error occurred while detemrining if extra resources should be included in the merge", e.getTargetException()); //$NON-NLS-1$
- }
- MergeSynchronizeParticipant participant = MergeSynchronizeParticipant.getMatchingParticipant(resources, startTag, endTag);
- if(participant == null) {
- CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
- participant = new MergeSynchronizeParticipant(s);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- }
- participant.refresh(resources, null, null, null);
-
- }
- }
- return true;
- }
-
- private IResource[] getAllResources(CVSTag startTag, CVSTag endTag) throws InvocationTargetException {
- // Only do the extra work if the model is a logical model (i.e. not IResource)
- if (!WorkspaceTraversalAction.isLogicalModel(mappings))
- return resources;
- CVSMergeSubscriber s = new CVSMergeSubscriber(WorkspaceTraversalAction.getProjects(resources), startTag, endTag);
- IResource[] allResources = WorkspaceTraversalAction.getResourcesToCompare(mappings, s);
- s.cancel();
- return allResources;
- }
-
- public static boolean isShowModelSync() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC);
- }
-
- private IResource[] getProjects(IResource[] resources) {
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- projects.add(resource.getProject());
- }
- return (IResource[]) projects.toArray(new IResource[projects.size()]);
- }
-
- private Command.LocalOption[] getLocalOptions(CVSTag startTag, CVSTag endTag) {
- List options = new ArrayList();
- if (startTag != null) {
- options.add(Command.makeArgumentOption(Update.JOIN, startTag.getName()));
- }
- options.add(Command.makeArgumentOption(Update.JOIN, endTag.getName()));
- return (Command.LocalOption[]) options.toArray(new Command.LocalOption[options.size()]);
- }
-
- private IWorkbenchPart getPart() {
- return part;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
deleted file mode 100644
index d27fee6af..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.tags.TagContentAssistProcessor;
-import org.eclipse.team.internal.ccvs.ui.tags.TagRefreshButtonArea;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionArea;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.PlatformUI;
-
-public class MergeWizardPage extends CVSWizardPage {
-
- private Text endTagField;
- private Button endTagBrowseButton;
- private TagSource tagSource;
- private Text startTagField;
- private Button startTagBrowseButton;
- private TagRefreshButtonArea tagRefreshArea;
- private CVSTag startTag;
- private CVSTag endTag;
- private Button previewButton;
- private Button noPreviewButton;
- protected boolean preview = true;
- private Button onlyPreviewConflicts;
- private boolean isOnlyPreviewConflicts = false;
-
- public MergeWizardPage(String pageName, String title, ImageDescriptor titleImage, String description, TagSource tagSource) {
- super(pageName, title, titleImage, description);
- this.tagSource = tagSource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DEFAULT));
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.MERGE_WIZARD_PAGE);
-
- final Composite mainArea = new Composite(composite, SWT.NONE);
- mainArea.setLayoutData(SWTUtils.createHFillGridData());
- mainArea.setLayout(SWTUtils.createGridLayout(2, converter, SWTUtils.MARGINS_NONE));
-
- createEndTagArea(mainArea);
- createStartTagArea(mainArea);
- SWTUtils.equalizeControls(converter, new Button [] { endTagBrowseButton, startTagBrowseButton } );
-
- createPreviewOptionArea(composite, converter);
- createTagRefreshArea(composite);
-
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- private void createPreviewOptionArea(Composite parent, PixelConverter converter) {
-
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayoutData(SWTUtils.createHFillGridData());
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
-
- previewButton = SWTUtils.createRadioButton(composite, CVSUIMessages.MergeWizardPage_0);
- if (MergeWizard.isShowModelSync()) {
- onlyPreviewConflicts = SWTUtils.createCheckBox(composite, CVSUIMessages.MergeWizardPage_14);
- GridData data = SWTUtils.createHFillGridData(1);
- data.horizontalIndent = 10;
- onlyPreviewConflicts.setLayoutData(data);
- }
- noPreviewButton = SWTUtils.createRadioButton(composite, CVSUIMessages.MergeWizardPage_1);
- SelectionAdapter selectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- preview = previewButton.getSelection();
- updateEnablements();
- }
- };
- previewButton.setSelection(preview);
- noPreviewButton.setSelection(!preview);
- previewButton.addSelectionListener(selectionAdapter);
- noPreviewButton.addSelectionListener(selectionAdapter);
- if (onlyPreviewConflicts != null) {
- onlyPreviewConflicts.setEnabled(preview);
- onlyPreviewConflicts.setSelection(isOnlyPreviewConflicts);
- onlyPreviewConflicts.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- isOnlyPreviewConflicts = onlyPreviewConflicts.getSelection();
- }
- });
- }
- }
- private void createTagRefreshArea(Composite composite) {
- tagRefreshArea = new TagRefreshButtonArea(getShell(), getTagSource(), null);
- tagRefreshArea.setRunnableContext(getContainer());
- tagRefreshArea.createArea(composite);
- }
-
- private void createEndTagArea(Composite parent) {
- SWTUtils.createLabel(parent, CVSUIMessages.MergeWizardPage_2, 2);
-
- endTagField = SWTUtils.createText(parent);
- endTagField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEndTag(endTagField.getText());
- }
- });
- final int endTagIncludeFlags = TagSelectionArea.INCLUDE_VERSIONS | TagSelectionArea.INCLUDE_BRANCHES | TagSelectionArea.INCLUDE_HEAD_TAG;
- TagContentAssistProcessor.createContentAssistant(endTagField, tagSource, endTagIncludeFlags);
- endTagBrowseButton = createPushButton(parent, CVSUIMessages.MergeWizardPage_3);
-
- endTagBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
- CVSUIMessages.MergeWizardPage_4,
- CVSUIMessages.MergeWizardPage_5,
- endTagIncludeFlags,
- false, IHelpContextIds.MERGE_END_PAGE);
- if (dialog.open() == Window.OK) {
- CVSTag selectedTag = dialog.getResult();
- setEndTag(selectedTag);
- }
- }
- });
- }
-
- private void createStartTagArea(Composite parent) {
-
- SWTUtils.createLabel(parent, CVSUIMessages.MergeWizardPage_6, 2);
-
- startTagField = SWTUtils.createText(parent);
- startTagField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateStartTag(startTagField.getText());
- }
- });
- TagContentAssistProcessor.createContentAssistant(startTagField, tagSource, TagSelectionArea.INCLUDE_VERSIONS);
-
- startTagBrowseButton = createPushButton(parent, CVSUIMessages.MergeWizardPage_7);
- startTagBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
- CVSUIMessages.MergeWizardPage_8,
- CVSUIMessages.MergeWizardPage_9,
- TagSelectionDialog.INCLUDE_VERSIONS | TagSelectionDialog.INCLUDE_DATES,
- false, IHelpContextIds.MERGE_START_PAGE);
- if (dialog.open() == Window.OK) {
- CVSTag selectedTag = dialog.getResult();
- setStartTag(selectedTag);
- }
- }
- });
- }
-
- protected void updateEndTag(String text) {
- if (endTag == null || !endTag.getName().equals(text)) {
- CVSTag tag = getTagFor(text, false);
- setEndTag(tag);
- }
- updateEnablements();
- }
-
- protected void updateStartTag(String text) {
- if (startTag == null || !startTag.getName().equals(text)) {
- CVSTag tag = getTagFor(text, true);
- setStartTag(tag);
- }
- updateEnablements();
- }
-
- private CVSTag getTagFor(String text, boolean versionsOnly) {
- if (text.equals(CVSTag.DEFAULT.getName())) {
- if (versionsOnly) return null;
- return CVSTag.DEFAULT;
- }
- if (text.equals(CVSTag.BASE.getName())) {
- if (versionsOnly) return null;
- return CVSTag.BASE;
- }
- CVSTag[] tags;
- if (versionsOnly) {
- tags = tagSource.getTags(new int[] { CVSTag.VERSION, CVSTag.DATE });
- } else {
- tags = tagSource.getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE });
- }
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (tag.getName().equals(text)) {
- return tag;
- }
- }
- return null;
- }
-
- protected void setEndTag(CVSTag selectedTag) {
- if (selectedTag == null || endTag == null || !endTag.equals(selectedTag)) {
- endTag = selectedTag;
- if (endTagField != null) {
- String name = endTagField.getText();
- if (endTag != null)
- name = endTag.getName();
- if (!endTagField.getText().equals(name))
- endTagField.setText(name);
- if (startTag == null && endTag != null && endTag.getType() == CVSTag.BRANCH) {
- CVSTag tag = findCommonBaseTag(endTag);
- if (tag != null) {
- setStartTag(tag);
- }
- }
- }
- updateEnablements();
- }
- }
-
- protected void setStartTag(CVSTag selectedTag) {
- if (selectedTag == null || startTag != null || endTag == null || !endTag.equals(selectedTag)) {
- startTag = selectedTag;
- if (startTagField != null) {
- String name = startTagField.getText();
- if (startTag != null)
- name = startTag.getName();
- if (!startTagField.getText().equals(name))
- startTagField.setText(name);
- }
- updateEnablements();
- }
- }
-
- private CVSTag findCommonBaseTag(CVSTag tag) {
- CVSTag[] tags = tagSource.getTags(CVSTag.VERSION);
- for (int i = 0; i < tags.length; i++) {
- CVSTag potentialMatch = tags[i];
- if (potentialMatch.getName().indexOf(tag.getName()) != -1) {
- return potentialMatch;
- }
- }
- return null;
- }
-
- private void updateEnablements() {
- if (onlyPreviewConflicts != null)
- onlyPreviewConflicts.setEnabled(preview);
- if (endTag == null && endTagField.getText().length() > 0) {
- setErrorMessage(CVSUIMessages.MergeWizardPage_10);
- } else if (startTag == null && startTagField.getText().length() > 0) {
- setErrorMessage(CVSUIMessages.MergeWizardPage_11);
- } else if (endTag != null && startTag != null && startTag.equals(endTag)) {
- setErrorMessage(CVSUIMessages.MergeWizardPage_12);
- } else if (startTag == null && endTag != null && preview) {
- setErrorMessage(CVSUIMessages.MergeWizardPage_13);
- } else {
- setErrorMessage(null);
- }
- setPageComplete((startTag != null || !preview) && endTag != null && (startTag == null || !startTag.equals(endTag)));
- }
-
- protected TagSource getTagSource() {
- return tagSource;
- }
-
- private Button createPushButton(Composite parent, String label) {
- final Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- button.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
- return button;
- }
-
- public CVSTag getStartTag() {
- return startTag;
- }
-
- public CVSTag getEndTag() {
- return endTag;
- }
-
- public boolean isPreview() {
- return preview;
- }
-
- public boolean isOnlyPreviewConflicts() {
- return isOnlyPreviewConflicts;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
deleted file mode 100644
index 97847930b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-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.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-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.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.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-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 ModeWizard extends ResizableWizard {
-
- public static class ModeChange {
-
- private final IFile fFile;
- private final KSubstOption fMode;
-
- private KSubstOption fNewMode;
-
- public ModeChange(IFile file, KSubstOption mode) {
- fFile = file;
- fMode= mode;
- fNewMode= mode;
- }
-
- public IFile getFile() {
- return fFile;
- }
-
- public KSubstOption getMode() {
- return fMode;
- }
-
- public KSubstOption getNewMode() {
- return fNewMode;
- }
-
- public boolean hasChanged() {
- return !fMode.equals(fNewMode);
- }
-
- public void setNewMode(KSubstOption mode) {
- fNewMode= mode;
- }
-
- public int compareTo(Object o) {
- return fFile.getName().compareTo(((ModeChange)o).getFile().getName());
- }
- }
-
- protected List fChanges;
- final ModeWizardSelectionPage fPage;
-
- public static ModeWizard run(final Shell shell, final IResource [] resources) {
-
- final ModeWizard [] wizard= new ModeWizard[1];
-
- BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
- public void run() {
- wizard[0]= new ModeWizard(shell, resources);
- }
- });
-
- open(shell, wizard[0]);
- return wizard[0];
- }
-
- /**
- * 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
- */
-
- protected ModeWizard(Shell shell, final IResource[] resources) {
- super(CVSUIMessages.ModeWizard_0, CVSUIPlugin.getPlugin().getDialogSettings(), 700, 480);
- setWindowTitle(CVSUIMessages.ModeWizard_1);
-
- fChanges= getModeChanges(shell, resources);
- fPage= new ModeWizardSelectionPage(fChanges);
-// Workbench.getInstance().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
-
- }
-
- public void addPages() {
- addPage(fPage);
- }
-
- /* (Non-javadoc)
- * Method declared on IWizard.
- */
- public boolean needsProgressMonitor() {
- return true;
- }
-
- protected static List getModeChanges(Shell shell, IResource [] resources) {
-
- final ArrayList changes= new ArrayList();
- final HashSet visited= 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 (visited.contains(resource) || resource.getType() != IResource.FILE || !resource.exists())
- return true;
- visited.add(resource);
- IFile file = (IFile) resource;
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- if (!cvsFile.isManaged())
- return true;
- final ResourceSyncInfo info = cvsFile.getSyncInfo();
- final KSubstOption mode = info.getKeywordMode();
-
- changes.add(new ModeChange(file, mode));
-
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- // always return true and let the depth determine if children are visited
- return true;
- }
- }, IResource.DEPTH_INFINITE, false);
- } catch (CoreException e) {
- CVSUIPlugin.openError(shell, CVSUIMessages.ModeWizard_2, null, e);
- }
- }
- return changes;
- }
-
- public boolean performFinish() {
- try {
- final List messages = new ArrayList();
- final List changes= fPage.getChanges();
- if (changes.size() == 0)
- return true;
-
- final String comment = fPage.getComment(getShell());
- if (comment == null)
- return false;
-
- getContainer().run(false /*fork*/, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- final int totalWork= 10000;
- monitor.beginTask(CVSUIMessages.ModeWizard_3, totalWork);
-
- final Map changesPerProvider= getProviderMapping(changes);
-
- final int initialWork= totalWork / 10;
- monitor.worked(initialWork);
-
- final int workPerProvider = (totalWork - initialWork) / changesPerProvider.size();
-
- for (Iterator iter = changesPerProvider.entrySet().iterator(); iter.hasNext();) {
- final Map.Entry entry = (Map.Entry) iter.next();
- final CVSTeamProvider provider = (CVSTeamProvider)entry.getKey();
- final Map providerFiles = (Map) entry.getValue();
-
- final IStatus status = provider.setKeywordSubstitution(providerFiles, comment, Policy.subMonitorFor(monitor, workPerProvider));
- if (status.getCode() != IStatus.OK) {
- messages.add(status);
- }
- }
- // Broadcast a decorator change so all interested parties will update their labels.
- // This is done in particular because the syncview will not see this change
- // as a change in state for the resources involved
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- // Check for any status messages and display them
- if (!messages.isEmpty()) {
- boolean error = false;
- final MultiStatus combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, CVSUIMessages.ModeWizard_4, null);
- for (int i = 0; i < messages.size(); i++) {
- final 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;
- }
- final String title= error ? CVSUIMessages.ModeWizard_5 : CVSUIMessages.ModeWizard_6; //
- CVSUIPlugin.openError(getShell(), title, message, new CVSException(statusToDisplay));
- }
- return super.performFinish();
- } catch (InterruptedException e) {
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), CVSUIMessages.ModeWizard_4, null, e);
- return false;
- }
- }
-
- /**
- * Get a map
- * @param changes
- * @return
- */
- static Map getProviderMapping(Collection changes) {
-
- final Map table = new HashMap();
-
- for (Iterator iter = changes.iterator(); iter.hasNext();) {
- final ModeChange change= (ModeChange)iter.next();
-
- if (!change.hasChanged())
- continue;
-
- final IFile file = change.getFile();
- final RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject(), CVSProviderPlugin.getTypeId());
-
- if (!table.containsKey(provider)) {
- table.put(provider, new HashMap());
- }
- final Map providerMap = (Map)table.get(provider);
- providerMap.put(file, change.getNewMode());
- }
- return table;
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java
deleted file mode 100644
index 9a798f9e2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.text.Collator; // don't use ICU, pending resolution of issue
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Observable;
-import java.util.Observer;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Item;
-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.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.util.StringMatcher;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.wizards.ModeWizard.ModeChange;
-import org.eclipse.team.internal.ui.PixelConverter;
-import org.eclipse.team.internal.ui.SWTUtils;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-//TODO: Filtering the TableViewer is currently slow for large amounts of files. 3.1M5 will feature a framework to help with this, so wait until it is there.
-//TODO: Files should be added to the viewer asynchronously, currently bringing up the dialog takes a lot of time for large selections (e.g. jdt.ui)
-
-public class ModeWizardSelectionPage extends WizardPage {
-
- private final static class ModeChangeCellModifier implements ICellModifier {
-
- private final ModeChangeTable fTable;
-
- public ModeChangeCellModifier(ModeChangeTable table) {
- fTable= table;
- }
-
- public boolean canModify(Object element, String property) {
- return PROPERTY_MODE.equals(property);
- }
-
- public Object getValue(Object element, String property) {
- if (PROPERTY_MODE.equals(property)) {
- final KSubstOption mode= ((ModeChange)element).getNewMode();
- for (int i = 0; i < MODES.length; i++) {
- if (MODES[i].equals(mode)) {
- return new Integer(i);
- }
- }
- }
- return null;
- }
-
- public void modify(Object element, String property, Object value) {
- if (element instanceof Item)
- element= ((Item)element).getData();
- if (PROPERTY_MODE.equals(property)) {
- ((ModeChange)element).setNewMode(MODES[((Integer)value).intValue()]);
- fTable.modelChanged(true);
- }
- }
- }
-
- private final static class ModeChangeLabelProvider implements ITableLabelProvider {
-
- private final DecoratingLabelProvider fDecoratingLP;
- private final ModeChangeTable fTable;
-
- public ModeChangeLabelProvider(ModeChangeTable table) {
- fTable= table;
- fDecoratingLP= new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
- fDecoratingLP.addListener(fTable);
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == INDEX_FILE) {
- return fDecoratingLP.getImage(((ModeChange)element).getFile());
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- final ModeChange change= (ModeChange)element;
- switch (columnIndex) {
- case INDEX_FILE: return (change.hasChanged() ? "* " : "") + change.getFile().getName(); //$NON-NLS-1$ //$NON-NLS-2$
- case INDEX_MODE: return change.getNewMode().getLongDisplayText();
- case INDEX_PATH: return change.getFile().getFullPath().toOSString();
- }
- throw new IllegalArgumentException();
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void dispose() {
- fDecoratingLP.removeListener(fTable);
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- }
-
- private final static class TableComparator extends ViewerComparator implements SelectionListener {
-
- private final Collator fCollator;
- private final TableViewer fViewer;
- private final TableColumn fFile, fMode, fPath;
-
- private int fIndex;
- private boolean fAscending;
-
-
- public TableComparator(TableViewer viewer, TableColumn fileColumn, TableColumn modeColumn, TableColumn pathColumn) {
-// TODO: possible issue, TableSorter's Collator not shared with base class. Might cause problem switching to ICU collation.
- fCollator= Collator.getInstance();
- fViewer= viewer;
-
- fFile= fileColumn;
- fMode= modeColumn;
- fPath= pathColumn;
-
-// Set initial sorting to file column
- fIndex= INDEX_FILE;
- fViewer.getTable().setSortColumn(fFile);
- fViewer.getTable().setSortDirection(SWT.DOWN);
- fAscending= true;
-
- fileColumn.addSelectionListener(this);
- modeColumn.addSelectionListener(this);
- pathColumn.addSelectionListener(this);
- }
-
- public int compare(Viewer viewer, Object e1, Object e2) {
-
- final ModeChange mc1= (ModeChange)e1;
- final ModeChange mc2= (ModeChange)e2;
-
- final String s1, s2;
-
- switch (fIndex) {
-
- case INDEX_FILE:
- s1= mc1.getFile().getName();
- s2= mc2.getFile().getName();
- break;
-
- case INDEX_MODE:
- s1= mc1.getNewMode().getLongDisplayText();
- s2= mc2.getNewMode().getLongDisplayText();
- break;
-
- case INDEX_PATH:
- s1= mc1.getFile().getFullPath().toOSString();
- s2= mc2.getFile().getFullPath().toOSString();
- break;
-
- default:
- throw new IllegalArgumentException();
- }
-
- final int compare= fCollator.compare(s1, s2);
- return fAscending ? compare : -compare;
- }
-
- public void widgetSelected(SelectionEvent e) {
- final int index= columnToIndex(e.widget);
- if (index == fIndex) {
- fIndex= index;
- fAscending= !fAscending;
- fViewer.getTable().setSortDirection(fAscending ? SWT.DOWN : SWT.UP);
- } else {
- fIndex= index;
- TableColumn tableCol = null;
- switch(fIndex){
- case INDEX_FILE:
- tableCol = fFile;
- break;
-
- case INDEX_MODE:
- tableCol = fMode;
- break;
-
- case INDEX_PATH:
- tableCol = fPath;
- break;
- }
- fViewer.getTable().setSortColumn(tableCol);
- fViewer.getTable().setSortDirection(fAscending ? SWT.DOWN : SWT.UP);
- }
- fViewer.refresh();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // nop
- }
-
- private int columnToIndex(Object column) {
- if (column == fFile) return INDEX_FILE;
- if (column == fMode) return INDEX_MODE;
- if (column == fPath) return INDEX_PATH;
- throw new IllegalArgumentException();
- }
- }
-
- private static final class ModeChangeTable extends Observable implements ISelectionChangedListener, ILabelProviderListener {
-
- private final List fChanges;
- private final TableViewer fViewer;
- private final Filter fFilter;
- private int fNumberOfChanges;
-
- public ModeChangeTable(Composite composite, PixelConverter converter, List changes) {
-
- fChanges= changes;
- fNumberOfChanges= 0;
-
- /**
- * Create a table.
- */
- final Table table = new Table(composite, SWT.V_SCROLL | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLayoutData(SWTUtils.createHVFillGridData());
- table.setLinesVisible(false);
- table.setHeaderVisible(true);
-
- /**
- * The 'File' column
- */
- final TableColumn fileColumn = new TableColumn(table, SWT.NONE, INDEX_FILE);
- fileColumn.setWidth(converter.convertWidthInCharsToPixels(LARGE_COLUMN));
- fileColumn.setText(CVSUIMessages.ModeWizardSelectionPage_2);
- table.setSortColumn(fileColumn);
- table.setSortDirection(SWT.DOWN);
- /**
- * The 'Mode' column
- */
- final TableColumn newModeColumn = new TableColumn(table, SWT.NONE, INDEX_MODE);
- newModeColumn.setWidth(converter.convertWidthInCharsToPixels(COLUMN_MIN_WIDTH_IN_CHARS + 6));
- newModeColumn.setText(CVSUIMessages.ModeWizardSelectionPage_3);
-
- /**
- * The 'Path' column
- */
- final TableColumn pathColumn= new TableColumn(table, SWT.NONE, INDEX_PATH);
- pathColumn.setWidth(converter.convertWidthInCharsToPixels(50));
- pathColumn.setText(CVSUIMessages.ModeWizardSelectionPage_4);
-
-
- fViewer= new TableViewer(table);
- fViewer.setContentProvider(new ModeChangeContentProvider());
- fViewer.setLabelProvider(new ModeChangeLabelProvider(this));
- fViewer.getControl().setLayoutData(SWTUtils.createHVFillGridData());
-
- final CellEditor newModeEditor = new ComboBoxCellEditor(table, COMBO_TEXT, SWT.READ_ONLY);
-
- fViewer.setCellEditors(new CellEditor [] { null, newModeEditor, null });
- fViewer.setColumnProperties(new String [] { PROPERTY_FILE, PROPERTY_MODE, PROPERTY_CHANGED });
- fViewer.setCellModifier(new ModeChangeCellModifier(this));
-
- fViewer.addFilter(fFilter= new Filter());
-
- fViewer.setComparator(new TableComparator(fViewer, fileColumn, newModeColumn, pathColumn));
-
- fViewer.setInput(fChanges);
-
- //TODO: CVSLightweightDecorator.decorate() is lighter than normal decs.
- fViewer.addSelectionChangedListener(this);
-
- fileColumn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
-
- }
- });
-
- fViewer.refresh();
- }
-
- public TableViewer getViewer() {
- return fViewer;
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- setChanged();
- notifyObservers(fViewer.getSelection());
- }
-
- public void modelChanged(boolean updateLabels) {
- fViewer.refresh(updateLabels);
- fNumberOfChanges= 0;
- for (Iterator iter = fChanges.iterator(); iter.hasNext();) {
- ModeChange change = (ModeChange) iter.next();
- if (change.hasChanged())
- ++fNumberOfChanges;
- }
- setChanged();
- notifyObservers();
- }
-
- public Filter getFilter() {
- return fFilter;
- }
-
- public IStructuredSelection getSelection() {
- return (IStructuredSelection)fViewer.getSelection();
- }
-
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- fViewer.refresh();
- }
-
- public void selectAll() {
- fViewer.setSelection(new StructuredSelection(fChanges));
- fViewer.getControl().setFocus();
- }
-
- public void selectNone() {
- fViewer.setSelection(StructuredSelection.EMPTY);
- fViewer.getControl().setFocus();
- }
-
- public int getNumberOfChanges() {
- return fNumberOfChanges;
- }
- }
-
- private static final class ModeChangeContentProvider implements IStructuredContentProvider {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public Object[] getElements(Object inputElement) {
-// new FetchJob(fViewer, (List)inputElement, fPattern);
-// return new Object[0];
- return ((List)inputElement).toArray();
- }
-
- public void dispose() {
- }
- }
-
- private static final class ModeCombo extends SelectionAdapter implements Observer {
-
- private final Combo fCombo;
- private final ModeChangeTable fTable;
-
- public ModeCombo(ModeChangeTable table, Composite parent) {
- fTable= table;
- fCombo= new Combo(parent, SWT.READ_ONLY);
- fCombo.setLayoutData(SWTUtils.createHFillGridData());
- fCombo.setItems(COMBO_TEXT);
- fCombo.addSelectionListener(this);
- fTable.addObserver(this);
- }
-
- public void widgetSelected(SelectionEvent e) {
- final KSubstOption mode= MODES[fCombo.getSelectionIndex()];
- final IStructuredSelection selection= fTable.getSelection();
- for (final Iterator iter = selection.iterator(); iter.hasNext();) {
- final ModeChange change = (ModeChange) iter.next();
- change.setNewMode(mode);
- }
- fTable.modelChanged(true);
- }
-
- public void update(Observable o, Object arg) {
- final IStructuredSelection selection= (IStructuredSelection)fTable.getViewer().getSelection();
-
- if (selection.isEmpty()) {
- fCombo.deselectAll();
- fCombo.setEnabled(false);
- } else {
- fCombo.setEnabled(true);
- final KSubstOption option= ((ModeChange)selection.getFirstElement()).getNewMode();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- if (option != ((ModeChange)iter.next()).getNewMode()) {
- fCombo.deselectAll();
- return;
- }
- }
- fCombo.setText(option.getLongDisplayText());
- }
- }
- }
-
- private static final class Filter extends ViewerFilter {
-
- private boolean fFilterUnchanged;
- private StringMatcher fMatcher;
-
- public Filter() {
- fFilterUnchanged= false;
- fMatcher= new StringMatcher("*", true, false); //$NON-NLS-1$
- }
-
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- final ModeChange change= (ModeChange)element;
- if (fFilterUnchanged && !change.hasChanged())
- return false;
- if (!fMatcher.match(change.getFile().getName()))
- return false;
- return true;
- }
-
- public void setPattern(String pattern) {
- pattern= pattern.trim();
- if (!pattern.endsWith("*")) { //$NON-NLS-1$
- pattern += "*"; //$NON-NLS-1$
- }
- fMatcher= new StringMatcher(pattern, true, false);
- }
-
- public void filterUnchanged(boolean filter) {
- fFilterUnchanged= filter;
- }
- }
-
- private static final class ResetButton extends SelectionAdapter implements Observer {
-
- private final ModeChangeTable fTable;
- private final Button fButton;
-
- public ResetButton(ModeChangeTable table, Composite parent, PixelConverter converter) {
- final int buttonWidth= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- fTable= table;
- fButton= new Button(parent, SWT.NONE);
- fButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.CENTER, false, false));
- fButton.setText(CVSUIMessages.ModeWizardSelectionPage_8);
- fButton.setToolTipText(CVSUIMessages.ModeWizardSelectionPage_9);
- fButton.addSelectionListener(this);
- fTable.addObserver(this);
- }
-
- public void widgetSelected(SelectionEvent e) {
- fButton.setEnabled(false);
- final IStructuredSelection selection= fTable.getSelection();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- final ModeChange change = (ModeChange) iter.next();
- change.setNewMode(change.getMode());
- }
- fTable.modelChanged(true);
- }
-
- public void update(Observable o, Object arg) {
- final IStructuredSelection selection= fTable.getSelection();
- for (final Iterator iter = selection.iterator(); iter.hasNext();) {
- if (((ModeChange)iter.next()).hasChanged()) {
- fButton.setEnabled(true);
- return;
- }
- }
- fButton.setEnabled(false);
- }
- }
-
- private static final class GuessButton extends SelectionAdapter implements Observer {
-
- private final ModeChangeTable fTable;
- private final Button fButton;
-
- public GuessButton(ModeChangeTable table, Composite parent, PixelConverter converter) {
- fTable= table;
- final int buttonWidth= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- fButton= new Button(parent, SWT.NONE);
- fButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.CENTER, false, false));
- fButton.setText(CVSUIMessages.ModeWizardSelectionPage_10);
- fButton.setToolTipText(CVSUIMessages.ModeWizardSelectionPage_11);
- fButton.addSelectionListener(this);
- fTable.addObserver(this);
-
- }
-
- public void widgetSelected(SelectionEvent e) {
- final IStructuredSelection selection= fTable.getSelection();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- final ModeChange change = (ModeChange) iter.next();
- change.setNewMode(KSubstOption.fromFile(change.getFile()));
- }
- fTable.modelChanged(true);
- }
-
- public void update(Observable o, Object arg) {
- fButton.setEnabled(!fTable.getSelection().isEmpty());
- }
- }
-
- private static final class SelectAllButton extends SelectionAdapter {
-
- private final ModeWizardSelectionPage fPage;
- private final Button fButton;
-
- public SelectAllButton(ModeWizardSelectionPage page, Composite parent, PixelConverter converter) {
- fPage= page;
- final int buttonWidth= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- fButton= new Button(parent, SWT.NONE);
- fButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.CENTER, false, false));
- fButton.setText(CVSUIMessages.ModeWizardSelectionPage_12);
- fButton.addSelectionListener(this);
- }
-
- public void widgetSelected(SelectionEvent e) {
- fPage.getTable().selectAll();
- }
- }
-
- private static final class SelectNoneButton extends SelectionAdapter {
-
- private final ModeWizardSelectionPage fPage;
- private final Button fButton;
-
- public SelectNoneButton(ModeWizardSelectionPage page, Composite parent, PixelConverter converter) {
- fPage= page;
- final int buttonWidth= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- fButton= new Button(parent, SWT.NONE);
- fButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.CENTER, false, false));
- fButton.setText(CVSUIMessages.ModeWizardSelectionPage_13);
- fButton.addSelectionListener(this);
- }
-
- public void widgetSelected(SelectionEvent e) {
- fPage.getTable().selectNone();
- }
- }
-
- private static final class ShowChangesOnlyCheckbox extends SelectionAdapter {
-
- private final ModeWizardSelectionPage fPage;
- private final Button fCheck;
-
- public ShowChangesOnlyCheckbox(ModeWizardSelectionPage page, Composite parent) {
- fPage= page;
- fCheck= new Button(parent, SWT.CHECK);
- fCheck.setText(CVSUIMessages.ModeWizardSelectionPage_14);
- fCheck.setLayoutData(SWTUtils.createHFillGridData());
- fCheck.setSelection(false);
- fCheck.addSelectionListener(this);
- }
-
- public void widgetSelected(SelectionEvent e) {
- final ModeChangeTable table= fPage.getTable();
- table.getFilter().filterUnchanged(fCheck.getSelection());
- table.modelChanged(true);
- }
- }
-
- private static final class FilterTextBox extends SelectionAdapter implements ModifyListener {
- private final ModeWizardSelectionPage fPage;
- private final Text fTextField;
-
- public FilterTextBox(ModeWizardSelectionPage page, Composite parent, PixelConverter converter) {
- fPage= page;
- fTextField= new Text(parent, SWT.SINGLE | SWT.BORDER);
- fTextField.setLayoutData(SWTUtils.createHFillGridData());
-
- final int buttonWidth= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- final Button button= new Button(parent, SWT.PUSH);
- button.setText(CVSUIMessages.ModeWizardSelectionPage_15);
- button.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.CENTER, false, false));
- button.addSelectionListener(this);
-
- fTextField.addModifyListener(this);
- }
-
- public void widgetSelected(SelectionEvent e) {
- fTextField.setText(""); //$NON-NLS-1$
- fTextField.setFocus();
- }
-
- public void modifyText(ModifyEvent e) {
- final ModeChangeTable table= fPage.getTable();
- table.getFilter().setPattern(fTextField.getText());
- table.modelChanged(false);
- }
-
- public void setFocus() {
- fTextField.setFocus();
- }
- }
-
- private static final class ChangeCounterLabel implements Observer {
-
- private final Label fLabel;
- private final ModeChangeTable fTable;
-
- ChangeCounterLabel(Composite parent, ModeChangeTable table) {
- fTable= table;
- fTable.addObserver(this);
- fLabel= SWTUtils.createLabel(parent, null);
- fLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
- }
-
- public void update(Observable o, Object arg) {
- updateText(fTable.getNumberOfChanges());
- }
-
- /**
- * @param numberOfChanges
- */
- private void updateText(int numberOfChanges) {
- fLabel.setText(NLS.bind(CVSUIMessages.ModeWizardSelectionPage_17, new String[] { Integer.toString(numberOfChanges) }));
- }
-
- }
-
- private static final class SelectionCounterLabel implements Observer {
-
- private final Label fLabel;
- private final ModeChangeTable fTable;
-
- public SelectionCounterLabel(Composite parent, ModeChangeTable table) {
- fTable= table;
- fTable.addObserver(this);
- fLabel= new Label(parent, SWT.WRAP | SWT.RIGHT);
- fLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
- }
-
- public void update(Observable o, Object arg) {
- updateText(fTable.getSelection().size());
- }
-
- /**
- * @param numberOfChanges
- */
- private void updateText(int selected) {
- fLabel.setText(NLS.bind(CVSUIMessages.ModeWizardSelectionPage_25, new String[] { Integer.toString(selected) }));
- }
- }
-
- private final static int LARGE_COLUMN= 50;
-
- protected static final int INDEX_FILE= 0;
- protected static final int INDEX_MODE= 1;
- protected static final int INDEX_PATH= 2;
-
- protected static final String PROPERTY_FILE= "file"; //$NON-NLS-1$
- protected static final String PROPERTY_MODE= "mode"; //$NON-NLS-1$
- protected static final String PROPERTY_CHANGED= "changed"; //$NON-NLS-1$
-
- protected static final KSubstOption [] MODES;
- protected static final String [] COMBO_TEXT;
-
- static final int COLUMN_MIN_WIDTH_IN_CHARS;
-
- static {
- MODES= KSubstOption.getAllKSubstOptions();
- Arrays.sort(MODES, new Comparator() {
- public int compare(Object a, Object b) {
- String aKey = ((KSubstOption)a).getLongDisplayText();
- String bKey = ((KSubstOption) b).getLongDisplayText();
- return aKey.compareTo(bKey);
- }
- });
- COMBO_TEXT= new String[MODES.length];
- int maxLength= 0;
- for (int i = 0; i < MODES.length; i++) {
- COMBO_TEXT[i]= MODES[i].getLongDisplayText();
- if (COMBO_TEXT[i].length() > maxLength) maxLength= COMBO_TEXT[i].length();
- }
- COLUMN_MIN_WIDTH_IN_CHARS= maxLength;
- }
-
- private final List fChanges;
- protected ModeChangeTable fTable;
-
- private CommitCommentArea fCommentArea;
-
- public ModeWizardSelectionPage(List modeChanges) {
- super(CVSUIMessages.ModeWizardSelectionPage_18, CVSUIMessages.ModeWizardSelectionPage_19, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_KEYWORD)); //
- setDescription(CVSUIMessages.ModeWizardSelectionPage_20);
- fChanges= modeChanges;
- }
-
- public void createControl(final Composite parent) {
-
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
-
- final int horizontalSpace= converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- final int verticalSpace= converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
-
- /**
- * The main composite with the vertical sash
- */
- final Composite mainComposite= SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_DEFAULT);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(mainComposite, IHelpContextIds.KEYWORD_SUBSTITUTION_PAGE);
-
- final SashForm mainSash= new SashForm(mainComposite, SWT.VERTICAL);
- mainSash.setLayoutData(SWTUtils.createHVFillGridData());
-
- /**
- * The composite with the filter box, the table and the selection and filter controls.
- */
- final Composite topComposite= SWTUtils.createHVFillComposite(mainSash, SWTUtils.MARGINS_NONE);
- ((GridLayout)topComposite.getLayout()).marginBottom= verticalSpace;
-
- final Composite topGroup= SWTUtils.createHVFillGroup(topComposite, CVSUIMessages.ModeWizardSelectionPage_21, SWTUtils.MARGINS_DIALOG);
-
- final Composite filterComposite= SWTUtils.createHFillComposite(topGroup, SWTUtils.MARGINS_NONE, 2);
- final FilterTextBox filterBox= new FilterTextBox(ModeWizardSelectionPage.this, filterComposite, converter);
-
- fTable= new ModeChangeTable(topGroup, converter, fChanges);
-
- final Composite selectionComposite= SWTUtils.createHFillComposite(topGroup, SWTUtils.MARGINS_NONE, 2);
-
- new ChangeCounterLabel(selectionComposite, fTable);
- new SelectionCounterLabel(selectionComposite, fTable);
-
- new ShowChangesOnlyCheckbox(ModeWizardSelectionPage.this, selectionComposite);
-
- final Composite buttonComposite= SWTUtils.createHFillComposite(selectionComposite, SWTUtils.MARGINS_NONE, 2);
- buttonComposite.setLayoutData(new GridData());
- new SelectAllButton(ModeWizardSelectionPage.this, buttonComposite, converter);
- new SelectNoneButton(ModeWizardSelectionPage.this, buttonComposite, converter);
-
- /**
- * The bottom sash which separates the mode controls from the commit comment area
- */
- final SashForm bottomSash= new SashForm(mainSash, SWT.NONE);
- bottomSash.setLayoutData(SWTUtils.createHFillGridData());
-
- /**
- * The left composite with the mode controls.
- */
- final Composite leftComposite= SWTUtils.createHVFillComposite(bottomSash, SWTUtils.MARGINS_NONE, 1);
- ((GridLayout)leftComposite.getLayout()).marginRight= horizontalSpace;
- ((GridLayout)leftComposite.getLayout()).marginTop= verticalSpace;
-
- final Group leftGroup= SWTUtils.createHVFillGroup(leftComposite, CVSUIMessages.ModeWizardSelectionPage_22, SWTUtils.MARGINS_DIALOG, 3);
-
- new ModeCombo(fTable, leftGroup);
- new GuessButton(fTable, leftGroup, converter);
- new ResetButton(fTable, leftGroup, converter);
- SWTUtils.createPlaceholder(leftGroup, 1);
- final Label infoLabel= SWTUtils.createLabel(leftGroup, CVSUIMessages.ModeWizardSelectionPage_23, 3);
-
- fTable.addObserver(new Observer() {
- public void update(Observable o, Object arg) {
- final boolean enabled= !fTable.getSelection().isEmpty();
- leftGroup.setEnabled(enabled);
- infoLabel.setEnabled(enabled);
- }
- });
-
- /**
- * The right composite with the commit comment area.
- */
- final Composite rightComposite= SWTUtils.createHVFillComposite(bottomSash, SWTUtils.MARGINS_NONE);
- ((GridLayout)rightComposite.getLayout()).marginLeft= horizontalSpace;
- ((GridLayout)rightComposite.getLayout()).marginTop= verticalSpace;
-
- final Group rightGroup= SWTUtils.createHVFillGroup(rightComposite, CVSUIMessages.ModeWizardSelectionPage_24, SWTUtils.MARGINS_DIALOG);
- (fCommentArea= new CommitCommentArea()).createArea(rightGroup);
-
- /**
- * Set up the page
- */
- mainSash.setWeights(new int [] { 5, 2 });
- bottomSash.setWeights(new int [] { 3, 2 });
- fTable.modelChanged(true);
- fTable.selectAll();
- filterBox.setFocus();
- setControl(mainComposite);
- }
-
- protected ModeChangeTable getTable() {
- return fTable;
- }
-
- public List getChanges() {
- final List changes= new ArrayList();
- for (Iterator iter = fChanges.iterator(); iter.hasNext();) {
- final ModeChange change = (ModeChange) iter.next();
- if (change.hasChanged())
- changes.add(change);
- }
- return changes;
- }
-
- public String getComment(Shell shell) {
- return fCommentArea.getCommentWithPrompt(shell);
- }
-}
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 a93a766b4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryComparator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class ModuleSelectionPage extends CVSWizardPage {
- Button useProjectNameButton;
- Button useSpecifiedNameButton;
- private Button selectModuleButton;
- Text text;
- TreeViewer moduleList;
-
- String moduleName;
-
- // The project being associated with the remote module (or null)
- private IProject project;
- private ICVSRepositoryLocation location;
- private boolean badLocation = false;
- private String helpContextId;
- private boolean supportsMultiSelection;
-
- private boolean isFetchingModules = false;
- private Object fetchingModulesLock = new Object();
-
- public ModuleSelectionPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- public void setHelpContxtId(String helpContextId) {
- this.helpContextId = helpContextId;
- }
-
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
-
- if (helpContextId != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContextId);
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements(false);
- }
- };
-
- if (project != null) {
- useProjectNameButton = createRadioButton(composite, CVSUIMessages.ModuleSelectionPage_moduleIsProject, 2);
- useProjectNameButton.addListener(SWT.Selection, listener);
- }
- useSpecifiedNameButton = createRadioButton(composite, CVSUIMessages.ModuleSelectionPage_specifyModule, 1);
- useSpecifiedNameButton.addListener(SWT.Selection, listener);
-
- text = createTextField(composite);
- text.addListener(SWT.Modify, listener);
-
- selectModuleButton = createRadioButton(composite, CVSUIMessages.ModuleSelectionPage_2, 2);
- selectModuleButton.addListener(SWT.Selection, listener);
- moduleList = createModuleTree(composite, 2);
-
- // Set the initial enablement
- if (useProjectNameButton != null) {
- useProjectNameButton.setSelection(true);
- useSpecifiedNameButton.setSelection(false);
- } else {
- useSpecifiedNameButton.setSelection(true);
- }
- selectModuleButton.setSelection(false);
- updateEnablements(false);
- setControl(composite);
- Dialog.applyDialogFont(parent);
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- IWizard w = getWizard();
- if (w instanceof CheckoutWizard) {
- ((CheckoutWizard)w).resetSubwizard();
- }
- if (useProjectNameButton != null && useProjectNameButton.getSelection()) {
- useProjectNameButton.setFocus();
- } else if (useSpecifiedNameButton.getSelection()) {
- text.setFocus();
- } else {
- moduleList.getControl().setFocus();
- }
- }
- }
-
- protected void updateEnablements(boolean updateModulesList) {
- if (useProjectNameButton != null && useProjectNameButton.getSelection()) {
- text.setEnabled(false);
- moduleList.getControl().setEnabled(false);
- moduleName = null;
- setPageComplete(true);
- } else if (useSpecifiedNameButton.getSelection()) {
- text.setEnabled(true);
- moduleList.getControl().setEnabled(false);
- moduleName = text.getText();
- if (moduleName.length() == 0) {
- moduleName = null;
- setPageComplete(false);
- } else {
- setPageComplete(true);
- }
- } else if (!badLocation){
- text.setEnabled(false);
- moduleList.getControl().setEnabled(true);
- moduleName = null;
- if (moduleList.getInput() == null || updateModulesList) {
- boolean fetchModules = false;
- // The input is set after the page is shown to avoid
- // fetching if the user wants to specify the name manually
- try {
- // This can be called from different events in the event loop.
- // Ensure that we only fetch the input once
- synchronized (fetchingModulesLock) {
- if (!isFetchingModules) {
- // This the first thread in so fetch the modules
- fetchModules = true;
- isFetchingModules = true;
- }
- }
- if (fetchModules) {
- // Validate the location first since the module fecthing is
- // done in a deferred fashion
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- validateLocation(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- setModuleListInput();
- }
- } catch (InvocationTargetException e) {
- if (!badLocation) {
- badLocation = true;
- CVSUIPlugin.openError(getShell(), null, null, e);
- // This will null the module list input
- setModuleListInput();
- }
- } catch (InterruptedException e) {
- // Canceled by the user
- } finally {
- synchronized (fetchingModulesLock) {
- if (fetchModules) {
- isFetchingModules = false;
- }
- }
- }
- }
- setPageComplete(internalGetSelectedModules().length > 0);
- }
- }
-
- /* package */ ICVSRemoteFolder[] internalGetSelectedModules() {
- if (moduleList != null && moduleList.getControl().isEnabled()) {
- ISelection selection = moduleList.getSelection();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- ArrayList result = new ArrayList();
- for (Iterator iter = ss.iterator(); iter.hasNext();) {
- Object element = iter.next();
- if (element instanceof ICVSRemoteFolder) {
- result.add(element);
- }
-
- }
- return (ICVSRemoteFolder[]) result.toArray(new ICVSRemoteFolder[result.size()]);
- }
- } else {
- if (moduleName != null) {
- return internalCreateModuleHandle(moduleName);
- } else if (project != null) {
- return internalCreateModuleHandle(project.getName());
- }
- }
- return new ICVSRemoteFolder[0];
- }
-
- private ICVSRemoteFolder[] internalCreateModuleHandle(String name) {
- ICVSRepositoryLocation location = getLocation();
- if (location == null) return new ICVSRemoteFolder[0];
- String[] names = name.split(","); //$NON-NLS-1$
- int length = names.length;
- java.util.List folders = new ArrayList();
- for (int i = 0; i < length; i++) {
- // call trim() in case the user has added spaces after the commas
- String trimmedName = names[i].trim();
- if (trimmedName.length() > 0)
- folders.add(location.getRemoteFolder(trimmedName, CVSTag.DEFAULT));
- }
- return (ICVSRemoteFolder[]) folders.toArray(new ICVSRemoteFolder[folders.size()]);
- }
-
- /**
- * Return the selected existing remote folder. If this
- * method returns <code>null</code>, then <code>getModuleName()</code>
- * can be used to get the name entered manually by the use.
- * @return the selected existing remote module
- */
- public ICVSRemoteFolder getSelectedModule() {
- ICVSRemoteFolder[] selectedModules = getSelectedModules();
- if (selectedModules.length > 0) {
- return selectedModules[0];
- } else {
- return null;
- }
- }
-
- public ICVSRemoteFolder[] getSelectedModules() {
- final ICVSRemoteFolder[][] folder = new ICVSRemoteFolder[][] { null };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- folder[0] = internalGetSelectedModules();
- }
- });
- return folder[0];
- }
-
- private TreeViewer createModuleTree(Composite composite, int horizontalSpan) {
- Tree tree = new Tree(composite, (supportsMultiSelection ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
-
- // see bug 158380
- data.heightHint = Math.max(composite.getParent().getSize().y, 100);
-
- data.horizontalSpan = horizontalSpan;
- tree.setLayoutData(data);
- TreeViewer result = new TreeViewer(tree) {
- /*
- * Fix to allow filtering to be used without triggering fetching
- * of the contents of all children (see bug 62268)
- */
- public boolean isExpandable(Object element) {
- ITreeContentProvider cp = (ITreeContentProvider) getContentProvider();
- if(cp == null)
- return false;
-
- return cp.hasChildren(element);
- }
- };
- result.setContentProvider(new RemoteContentProvider());
- result.setLabelProvider(new WorkbenchLabelProvider());
- result.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- return !(element instanceof ICVSRemoteFile);
- }
- });
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements(false);
- ICVSRemoteFolder[] modules = internalGetSelectedModules();
- if (modules.length == 1) {
- // There is at 1 module selected
- ICVSRemoteFolder selectedModule = modules[0];
- String repositoryRelativePath = selectedModule.getRepositoryRelativePath();
- if (!repositoryRelativePath.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)) {
- text.setText(repositoryRelativePath);
- }
- } else {
- text.setText(""); //$NON-NLS-1$
- }
- }
- });
- result.getTree().addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- if (getSelectedModule() != null) {
- gotoNextPage();
- }
- }
- });
- result.setComparator(new RepositoryComparator());
- return result;
- }
-
- private void setModuleListInput() {
- ICVSRepositoryLocation location = getLocation();
- if (location == null || badLocation) return;
- moduleList.setInput(location.getRemoteFolder(ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, CVSTag.DEFAULT));
- }
-
- private ICVSRepositoryLocation getLocation() {
- return location;
- }
-
- public void setLocation(ICVSRepositoryLocation location) {
- boolean refresh = location != null && !location.equals(this.location);
- this.location = location;
- badLocation = false;
- if (moduleList != null) {
- updateEnablements(refresh);
- }
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
- public void setSupportsMultiSelection(boolean supportsMultiSelection) {
- this.supportsMultiSelection = supportsMultiSelection;
- }
-
- /* package */ void gotoNextPage() {
- getContainer().showPage(getNextPage());
- }
-
- /* package */ void validateLocation(IProgressMonitor monitor) throws CVSException {
- location.validateConnection(monitor);
- }
-}
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 ff7a2fbd6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.*;
-
-public class NewLocationWizard extends Wizard implements INewWizard {
-
- protected ConfigurationWizardMainPage mainPage;
- protected Properties properties = null;
- private boolean switchPerspectives = true;
-
- /**
- * Return the settings used for all location pages
- */
- public static IDialogSettings getLocationDialogSettings() {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("NewLocationWizard");//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection("NewLocationWizard");//$NON-NLS-1$
- }
- return section;
- }
-
- public NewLocationWizard() {
- IDialogSettings section = getLocationDialogSettings();
- setDialogSettings(section);
- setWindowTitle(CVSUIMessages.NewLocationWizard_title);
- setNeedsProgressMonitor(true);
- }
-
-
- public NewLocationWizard(Properties initialProperties) {
- this();
- this.properties = initialProperties;
- }
-
- /**
- * Creates the wizard pages
- */
- public void addPages() {
- mainPage = createMainPage();
- if (properties != null) {
- mainPage.setProperties(properties);
- }
- mainPage.setShowValidate(true);
- mainPage.setDescription(CVSUIMessages.NewLocationWizard_description);
- mainPage.setDialogSettings(getDialogSettings());
- addPage(mainPage);
- }
-
- protected ConfigurationWizardMainPage createMainPage() {
- return new ConfigurationWizardMainPage("repositoryPage1", CVSUIMessages.NewLocationWizard_heading, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION)); //$NON-NLS-1$
- }
-
- /*
- * @see IWizard#performFinish
- */
- public boolean performFinish() {
- final ICVSRepositoryLocation[] location = new ICVSRepositoryLocation[] { null };
- boolean keepLocation = false;
- try {
- // Create a handle to a repository location
- location[0] = mainPage.getLocation();
- // Add the location quitely so we can validate
- location[0] = KnownRepositories.getInstance().addRepository(location[0], false /* don't tell anybody */);
-
- if (mainPage.getValidate()) {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location[0].validateConnection(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- keepLocation = true;
- } catch (InterruptedException e) {
- // Cancelled by user. Fall through to dispose of location
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException)t;
- } else if (t instanceof Exception) {
- throw CVSException.wrapException((Exception)t);
- } else {
- throw CVSException.wrapException(e);
- }
- }
- } else {
- keepLocation = true;
- }
- } catch (TeamException e) {
- if (location[0] == null) {
- // Exception creating the root, we cannot continue
- CVSUIPlugin.openError(getContainer().getShell(), CVSUIMessages.NewLocationWizard_exception, null, e);
- return false;
- } else {
- // Exception validating. We can continue if the user wishes.
- IStatus error = e.getStatus();
- if (error.isMultiStatus() && error.getChildren().length == 1) {
- error = error.getChildren()[0];
- }
-
- if (error.isMultiStatus()) {
- CVSUIPlugin.openError(getContainer().getShell(), CVSUIMessages.NewLocationWizard_validationFailedTitle, null, e);
- } else {
- keepLocation = MessageDialog.openQuestion(getContainer().getShell(),
- CVSUIMessages.NewLocationWizard_validationFailedTitle,
- NLS.bind(CVSUIMessages.NewLocationWizard_validationFailedText, (new Object[] {error.getMessage()})));
- }
- }
- }
- if (keepLocation) {
- KnownRepositories.getInstance().addRepository(location[0], true /* let the world know */);
- if (switchPerspectives) {
- final IWorkbench workbench= PlatformUI.getWorkbench();
- final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
-
- final String defaultPerspectiveID= promptForPerspectiveSwitch();
-
- if (defaultPerspectiveID != null) {
- try {
- workbench.showPerspective(defaultPerspectiveID, window);
- } catch (WorkbenchException e) {
- Utils.handleError(window.getShell(), e, CVSUIMessages.ShowAnnotationOperation_0, e.getMessage());
- }
- }
- }
- } else {
- KnownRepositories.getInstance().disposeRepository(location[0]);
- }
- return keepLocation;
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // Nothing to do
- }
-
- public void setSwitchPerspectives(boolean switchPerspectives) {
- this.switchPerspectives = switchPerspectives;
- }
-
- private String promptForPerspectiveSwitch() {
- // check whether we should ask the user.
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_NEW_REPOSITORY_LOCATION);
- final String desiredID = CVSPerspective.ID;
-
- if (option.equals(MessageDialogWithToggle.ALWAYS))
- return desiredID; // no, always switch
-
- if (option.equals(MessageDialogWithToggle.NEVER))
- return null; // no, never switch
-
- // Check whether the desired perspective is already active.
- final IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
- final IPerspectiveDescriptor desired = registry.findPerspectiveWithId(desiredID);
- final IWorkbenchPage page = CVSUIPlugin.getActivePage();
-
- if (page != null) {
- final IPerspectiveDescriptor current = page.getPerspective();
- if (current != null && current.getId().equals(desiredID)) {
- return null; // it is active, so no prompt and no switch
- }
- }
-
- if (desired != null) {
-
- String message;;
- String desc = desired.getDescription();
- if (desc == null) {
- message = NLS.bind(CVSUIMessages.NewLocationWizard_2, new String[] { desired.getLabel() });
- } else {
- message = NLS.bind(CVSUIMessages.NewLocationWizard_3, new String[] { desired.getLabel(), desc });
- }
- // Ask the user whether to switch
- final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(
- Utils.getShell(null),
- CVSUIMessages.NewLocationWizard_1,
- message,
- CVSUIMessages.NewLocationWizard_4,
- false /* toggle state */,
- store,
- ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_NEW_REPOSITORY_LOCATION);
-
- final int result = m.getReturnCode();
- switch (result) {
- // yes
- case IDialogConstants.YES_ID:
- case IDialogConstants.OK_ID :
- return desiredID;
- // no
- case IDialogConstants.NO_ID :
- return null;
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/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 4f17ed21c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.TextProcessor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryComparator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.*;
-
-/**
- * First wizard page for importing a project into a CVS repository.
- * This page prompts the user to select an existing repo or create a new one.
- * If the user selected an existing repo, then getLocation() will return it.
- */
-public class RepositorySelectionPage extends CVSWizardPage {
-
- private class DecoratingRepoLabelProvider extends WorkbenchLabelProvider {
- protected String decorateText(String input, Object element) {
- //Used to process RTL locales only
- return TextProcessor.process(input, ":@/"); //$NON-NLS-1$
- }
- }
-
-
- private TableViewer table;
- private Button useExistingRepo;
- private Button useNewRepo;
-
- private ICVSRepositoryLocation result;
-
- String extendedDescription;
-
- /**
- * RepositorySelectionPage constructor.
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public RepositorySelectionPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
- protected TableViewer createTable(Composite parent, int span) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = span;
- data.widthHint = 200;
- table.setLayoutData(data);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100, true));
- table.setLayout(layout);
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
-
- return new TableViewer(table);
- }
- /**
- * Creates the UI part of the page.
- *
- * @param parent the parent of the created widgets
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1, false);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_SELECT_REPOSITORY_PAGE);
- if (extendedDescription == null) {
- extendedDescription = CVSUIMessages.RepositorySelectionPage_description;
- }
- createWrappingLabel(composite, extendedDescription, 0 /* indent */, 1 /* columns */);
-
- useNewRepo = createRadioButton(composite, CVSUIMessages.RepositorySelectionPage_useNew, 1);
-
- useExistingRepo = createRadioButton(composite, CVSUIMessages.RepositorySelectionPage_useExisting, 1);
- table = createTable(composite, 1);
- table.setContentProvider(new WorkbenchContentProvider());
- table.setLabelProvider(new DecoratingRepoLabelProvider()/*WorkbenchLabelProvider()*/);
- table.setComparator(new RepositoryComparator());
- table.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- getContainer().showPage(getNextPage());
- }
- });
-
- setControl(composite);
-
- initializeValues();
- Dialog.applyDialogFont(parent);
-
- table.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- result = (ICVSRepositoryLocation)((IStructuredSelection)table.getSelection()).getFirstElement();
- setPageComplete(true);
- }
- });
-
- 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);
- }
- });
- }
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- AdaptableList input = new AdaptableList(locations);
- table.setInput(input);
- if (locations.length == 0) {
- useNewRepo.setSelection(true);
- useExistingRepo.setSelection(false);
- table.getTable().setEnabled(false);
- } else {
- useNewRepo.setSelection(false);
- useExistingRepo.setSelection(true);
- table.getTable().setEnabled(true);
- result = locations[0];
- table.setSelection(new StructuredSelection(result));
- }
- setPageComplete(true);
- }
-
- public ICVSRepositoryLocation getLocation() {
- return result;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- useExistingRepo.setFocus();
- }
- }
-
- public void setExtendedDescription(String extendedDescription) {
- this.extendedDescription = extendedDescription;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ResizableWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ResizableWizard.java
deleted file mode 100644
index 324e97d18..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ResizableWizard.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Persists the size of the wizard dialog.
- */
-public class ResizableWizard extends Wizard {
-
- private final int DEFAULT_WIDTH;
- private final int DEFAULT_HEIGHT;
-
- private static final String BOUNDS_HEIGHT_KEY = "width"; //$NON-NLS-1$
- private static final String BOUNDS_WIDTH_KEY = "height"; //$NON-NLS-1$
-
- final String fSectionName;
-
- public ResizableWizard(String sectionName, IDialogSettings settings) {
- this(sectionName, settings, 300, 400);
- }
-
- protected ResizableWizard(String sectionName, IDialogSettings settings, int defaultWidth, int defaultHeight) {
- DEFAULT_WIDTH= defaultWidth;
- DEFAULT_HEIGHT= defaultHeight;
- fSectionName= sectionName;
- setDialogSettings(settings);
- }
-
- protected static int open(Shell shell, ResizableWizard wizard) {
- final WizardDialog dialog= new WizardDialog(shell, wizard);
- dialog.setMinimumPageSize(wizard.loadSize());
- return dialog.open();
- }
-
- public void saveSize() {
- final Rectangle bounds= getContainer().getCurrentPage().getControl().getParent().getClientArea();
- final IDialogSettings settings= getDialogSettings();
- if (settings == null)
- return;
-
- IDialogSettings section= settings.getSection(fSectionName);
- if (section == null)
- section= settings.addNewSection(fSectionName);
-
- section.put(BOUNDS_WIDTH_KEY, bounds.width);
- section.put(BOUNDS_HEIGHT_KEY, bounds.height);
- }
-
- public Point loadSize() {
- final Point size= new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
-
- final IDialogSettings settings= getDialogSettings();
- if (settings == null)
- return size;
-
- final IDialogSettings section= settings.getSection(fSectionName);
- if (section == null)
- return size;
-
- try {
- size.x= section.getInt(BOUNDS_WIDTH_KEY);
- size.y= section.getInt(BOUNDS_HEIGHT_KEY);
- } catch (NumberFormatException e) {
- }
- return size;
- }
-
-
- public boolean performFinish() {
- saveSize();
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
deleted file mode 100644
index b6772a1ae..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.compare.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * Select the files to restore
- */
-public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
- private TreeViewer fileTree;
- private CompareViewerPane fileSelectionPane;
- private CompareViewerPane revisionSelectionPane;
- private CheckboxTableViewer revisionsTable;
- private CompareViewerSwitchingPane fileContentPane;
-
- private HistoryTableProvider historyTableProvider;
- private AdaptableHierarchicalResourceList treeInput = new AdaptableHierarchicalResourceList(ResourcesPlugin.getWorkspace().getRoot(), new IResource[0]);
-
- private IContainer folder;
- private IFile selectedFile;
- private ILogEntry selectedRevision;
- private Map entriesCache = new HashMap();
- private Map filesToRestore = new HashMap();
-
- private static final int WIZARD_WIDTH = 550;
-
- class HistoryInput implements ITypedElement, IEncodedStreamContentAccessor, IModificationDate {
- IFile file;
- ILogEntry logEntry;
-
- HistoryInput(IFile file, ILogEntry logEntry) {
- this.file= file;
- this.logEntry = logEntry;
- }
- public InputStream getContents() throws CoreException {
- IStorage s = getStorageFromLogEntry(logEntry);
- if (s == null) return null;
- return new BufferedInputStream(s.getContents());
- }
- public String getName() {
- return file.getName();
- }
- public String getType() {
- return file.getFileExtension();
- }
- public Image getImage() {
- return CompareUI.getImage(file);
- }
- public long getModificationDate() {
- return logEntry.getDate().getTime();
- }
- public String getCharset() throws CoreException {
- IStorage s = getStorageFromLogEntry(logEntry);
- if (s instanceof IEncodedStorage) {
- return ((IEncodedStorage)s).getCharset();
- }
- return null;
- }
- }
-
- /**
- * Constructor for RestoreFromRepositoryFileSelectionPage.
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public RestoreFromRepositoryFileSelectionPage(
- String pageName,
- String title,
- ImageDescriptor titleImage,
- String description) {
- super(pageName, title, titleImage, description);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= createComposite(parent, 1, false);
- setControl(composite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.RESTORE_FROM_REPOSITORY_FILE_SELECTION_PAGE);
-
- // Top and bottom panes: top is the two selection panes, bottom is the file content viewer
- Splitter vsplitter= new Splitter(composite, SWT.VERTICAL);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
- // Set the width to be extra wide to accomodate the two selection lists
- data.widthHint = WIZARD_WIDTH;
- vsplitter.setLayoutData(data);
-
- // Top left and top right panes: the left for the files, the right for the log entries
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- // Top left: file selection pane
- fileSelectionPane = new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- fileSelectionPane.setLayoutData(data);
- fileTree = createFileSelectionTree(fileSelectionPane);
-
- // Top right: Revision selection pane
- revisionSelectionPane = new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- revisionSelectionPane.setLayoutData(data);
- historyTableProvider = new HistoryTableProvider();
- revisionsTable = createRevisionSelectionTable(revisionSelectionPane, historyTableProvider);
- revisionSelectionPane.setText(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_emptyRevisionPane);
-
- // Bottom: File content viewer
- fileContentPane = new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUI.findContentViewer(oldViewer, input, this, null);
- }
- };
-
- initializeValues();
- updateWidgetEnablements();
- Dialog.applyDialogFont(parent);
- }
-
- protected CheckboxTableViewer createRevisionSelectionTable(CompareViewerPane composite, HistoryTableProvider tableProvider) {
- CheckboxTableViewer table = tableProvider.createCheckBoxTable(composite);
- table.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- ILogEntry[] entries = getSelectedEntries();
- if (entries != null) return entries;
- return new Object[0];
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
- table.setInput(this);
- table.getTable().addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- // Handle check selection in the check state listener
- if (e.detail == SWT.CHECK) return;
- handleRevisionSelection(e.item);
- }
- }
- );
- table.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleRevisionChecked(event);
- }
- });
- composite.setContent(table.getControl());
- return table;
- }
-
- protected TreeViewer createFileSelectionTree(CompareViewerPane composite) {
- TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.setUseHashlookup(true);
- tree.setContentProvider(treeInput.getTreeContentProvider());
- tree.setLabelProvider(
- new DecoratingLabelProvider(
- new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- String text;
- if (element instanceof IFolder && element.equals(folder)) {
- text = super.decorateText(folder.getProjectRelativePath().toString(), element);
- } else {
- ILogEntry entry = (ILogEntry)filesToRestore.get(element);
- text = super.decorateText(input, element);
- if (entry != null) {
- text = NLS.bind(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_fileToRestore, new String[] { text, entry.getRevision() });
- }
- }
- return text;
- }
- },
- CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
- tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
- tree.setInput(treeInput);
-
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- tree.getTree().setLayoutData(data);
- tree.addPostSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleFileSelection(event);
- }
- });
- composite.setContent(tree.getControl());
- return tree;
- }
-
- /**
- * Method updateWidgetEnablements.
- */
- private void updateWidgetEnablements() {
-
- if (filesToRestore.isEmpty()) {
- setPageComplete(false);
- setErrorMessage(null);
- return;
- }
-
- for (Iterator iter = filesToRestore.keySet().iterator(); iter.hasNext();) {
- IFile file = (IFile) iter.next();
- if (file.exists()) {
- setPageComplete(false);
- setErrorMessage(NLS.bind(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_fileExists, new String[] { file.getName() }));
- return;
- }
-
- ILogEntry entry = (ILogEntry) filesToRestore.get(file);
- if (entry.isDeletion()) {
- setPageComplete(false);
- setErrorMessage(NLS.bind(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_revisionIsDeletion, new String[] { entry.getRevision(), file.getName() }));
- return;
- }
- }
- setPageComplete(true);
- setErrorMessage(null);
- }
-
- /**
- * Method initializeValues.
- */
- private void initializeValues() {
- refresh();
- }
-
- /**
- * Sets the folder.
- * @param folder The folder to set
- */
- public void setInput(IContainer folder, ICVSFile[] files) {
- if (folder.equals(this.folder)) return;
- this.folder = folder;
- setTreeInput(folder, files);
- initializeValues();
- updateWidgetEnablements();
- }
-
- /*
- * Set the resource tree input to the files that were deleted
- */
- private void setTreeInput(IContainer folder, ICVSFile[] cvsFiles) {
- reset();
- IResource[] files = new IResource[cvsFiles.length];
- for (int i = 0; i < cvsFiles.length; i++) {
- files[i] = cvsFiles[i].getIResource();
- }
- treeInput.setResources(files);
- // kludge to avoid auto-selection of first element
- // set the root to the folder's parent so the folder appears in the tree
- treeInput.setRoot(folder.getParent());
- refresh();
- }
-
- private void reset() {
- this.selectedFile = null;
- this.selectedRevision = null;
- treeInput.setResources(null);
- filesToRestore = new HashMap();
- if (fileContentPane != null && !fileContentPane.isDisposed()) {
- fileContentPane.setInput(null);
- }
- updateWidgetEnablements();
- }
-
- /**
- * Method refresh.
- */
- private void refresh() {
- if (folder == null) return;
-
- if (fileSelectionPane != null && !fileSelectionPane.isDisposed()) {
- fileSelectionPane.setText(NLS.bind(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_fileSelectionPaneTitle, new String[] { folder.getProject().getName() }));
- fileSelectionPane.setImage(CompareUI.getImage(folder.getProject()));
- }
-
- if (revisionSelectionPane != null && !revisionSelectionPane.isDisposed()) {
- if (selectedFile == null) {
- revisionSelectionPane.setText(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_emptyRevisionPane);
- revisionSelectionPane.setImage(null);
- }
- }
-
- // Empty the file content viewer
- if (fileContentPane != null && !fileContentPane.isDisposed()) {
- fileContentPane.setInput(null);
- }
-
- // refresh the tree
- if (fileTree != null) {
- // If the parent folder is in the tree, make sure it is expanded
- fileTree.setExpandedState(folder, true);
- fileTree.refresh();
- }
- if (revisionsTable != null)
- revisionsTable.refresh();
- }
-
- /*
- * Set the log entry table input to the fetched entries in response to a file selection
- */
- private void setLogEntryTableInput(ILogEntry[] entries) {
- this.selectedRevision = null;
- // Refresh the table so it picks up the selected entries through its content provider
- revisionsTable.refresh();
- // Check the previously checked entry if one exists
- ILogEntry selectedEntry = (ILogEntry)filesToRestore.get(selectedFile);
- if (selectedEntry != null) {
- revisionsTable.setChecked(selectedEntry, true);
- }
- // Disable entries that represent deletions since they can't be loaded
- for (int i = 0; i < entries.length; i++) {
- ILogEntry entry = entries[i];
- if (entry.isDeletion()) {
- revisionsTable.setGrayed(entry, true);
- }
- }
- // Set the titlebar text for the revisions table
- revisionSelectionPane.setText(NLS.bind(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_revisionSelectionPaneTitle, new String[] { selectedFile.getName() }));
- revisionSelectionPane.setImage(CompareUI.getImage(selectedFile));
- // Clear the file content pane
- fileContentPane.setInput(null);
- }
-
- private void handleFileSelection(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection == null || selection.isEmpty()) {
- clearSelection();
- } else {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- IResource resource = (IResource)structuredSelection.getFirstElement();
- if (resource instanceof IFile) {
- handleFileSelection((IFile) resource);
- } else {
- clearSelection();
- }
- }
- }
- }
-
- /**
- * Method handleFileSelection.
- * @param file
- */
- private void handleFileSelection(IFile file) {
- if (this.selectedFile == file) return;
- this.selectedFile = file;
- if (entriesCache.get(file) == null) {
- try {
-
- // First, we need to create a remote file handle so we can get the log entries
- ICVSFolder parent = CVSWorkspaceRoot.getCVSFolderFor(file.getParent());
- FolderSyncInfo info = parent.getFolderSyncInfo();
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
- final ICVSRemoteFile remoteFile = location.getRemoteFile(new Path(null, info.getRepository()).append(file.getName()).toString(), CVSTag.DEFAULT);
-
- // Then we need to fetch the log entries
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // fetch the entries
- ILogEntry[] entries = remoteFile.getLogEntries(monitor);
- // cache the entries with the selected file
- entriesCache.put(selectedFile, entries);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (CVSException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return;
- } catch (InvocationTargetException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return;
- } catch (InterruptedException e) {
- return;
- }
- }
-
- // Set the log table to display the entries for the selected file
- setLogEntryTableInput(getSelectedEntries());
- }
-
- private ILogEntry[] getSelectedEntries() {
- return (ILogEntry[])entriesCache.get(selectedFile);
- }
-
- private IStorage getStorageFromLogEntry(final ILogEntry logEntry) {
- final IStorage[] s = new IStorage[] { null };
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSRemoteFile remoteFile = logEntry.getRemoteFile();
- s[0] = ((IResourceVariant)remoteFile).getStorage(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return null;
- } catch (InterruptedException e) {
- return null;
- }
- return s[0];
- }
-
- private void handleRevisionChecked(CheckStateChangedEvent event) {
- if (event.getChecked()) {
- revisionsTable.setCheckedElements(new Object[] {event.getElement()});
- filesToRestore.put(selectedFile, event.getElement());
- }
- if (revisionsTable.getCheckedElements().length == 0) {
- filesToRestore.remove(selectedFile);
- }
- fileTree.refresh();
- updateWidgetEnablements();
- }
-
- /*
- * A revision in the revision table has been selected.
- * Populate the file contents pane with the selected log entry.
- */
- private void handleRevisionSelection(Widget w) {
- if (fileContentPane != null && !fileContentPane.isDisposed()) {
- Object o= w.getData();
- if (o instanceof ILogEntry) {
- ILogEntry selected = (ILogEntry) o;
- if (this.selectedRevision == selected) return;
- this.selectedRevision = selected;
- if (selected.isDeletion()) {
- fileContentPane.setInput(null);
- } else {
- fileContentPane.setInput(new HistoryInput(selectedFile, selected));
- fileContentPane.setText(getEditionLabel(selectedFile, selected));
- fileContentPane.setImage(CompareUI.getImage(selectedFile));
- }
- } else {
- fileContentPane.setInput(null);
- }
- }
- }
- /**
- * Method getEditionLabel.
- * @param selectedFile
- * @param selected
- * @return String
- */
- private String getEditionLabel(IFile selectedFile, ILogEntry selected) {
- return NLS.bind(CVSUIMessages.RestoreFromRepositoryFileSelectionPage_fileContentPaneTitle, (new Object[] { selectedFile.getName(), selected.getRevision(), selectedFile.getFullPath().makeRelative().removeLastSegments(1).toString() }));
- }
-
- public boolean restoreSelectedFiles() {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, 100 * filesToRestore.size());
- for (Iterator iter = filesToRestore.keySet().iterator();iter.hasNext();) {
- IFile file = (IFile) iter.next();
- ILogEntry entry = (ILogEntry)filesToRestore.get(file);
- ensureParentExists(file);
- file.create(entry.getRemoteFile().getContents(Policy.subMonitorFor(monitor, 50)), false, Policy.subMonitorFor(monitor, 50));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return false;
- } catch (InterruptedException e) {
- return false;
- }
- return true;
- }
-
- /**
- * Method ensureParentExists.
- * @param file
- */
- private void ensureParentExists(IResource resource) throws CoreException {
- IContainer parent = resource.getParent();
- if (!parent.exists() && parent.getType() == IResource.FOLDER) {
- ensureParentExists(parent);
- ((IFolder)parent).create(false, true, null);
- }
- }
-
- private void clearSelection() {
- this.selectedFile = null;
- this.selectedRevision = null;
- refresh();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java
deleted file mode 100644
index 70c4c5c96..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-
-/**
- * This wizard allows the user to show deleted resources in the history view
- */
-public class RestoreFromRepositoryWizard extends Wizard {
-
- private RestoreFromRepositoryFileSelectionPage fileSelectionPage;
- private IContainer parent;
- private ICVSFile[] files;
-
- /**
- * Constructor for RestoreFromRepositoryWizard.
- */
- public RestoreFromRepositoryWizard(IContainer parent, ICVSFile[] files) {
- this.parent = parent;
- this.files = files;
- setWindowTitle(CVSUIMessages.RestoreFromRepositoryWizard_fileSelectionPageTitle);
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- return fileSelectionPage.restoreSelectedFiles();
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
-
- fileSelectionPage = new RestoreFromRepositoryFileSelectionPage("FileSelectionPage", CVSUIMessages.RestoreFromRepositoryWizard_fileSelectionPageTitle, substImage, CVSUIMessages.RestoreFromRepositoryWizard_fileSelectionPageDescription); //$NON-NLS-1$
- fileSelectionPage.setInput(parent, files);
- addPage(fileSelectionPage);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
deleted file mode 100644
index 4d276e980..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ /dev/null
@@ -1,560 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-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.osgi.util.NLS;
-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.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.IConfigurationWizard;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * This wizard helps the user to import a new project in their workspace
- * into a CVS repository for the first time.
- */
-public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSWizard {
- // The project to configure
- private IProject project;
-
- // The autoconnect page is used if CVS/ directories already exist.
- private ConfigurationWizardAutoconnectPage autoconnectPage;
-
- // The import page is used if CVS/ directories do not exist.
- private RepositorySelectionPage locationPage;
-
- // The page that prompts the user for connection information.
- private ConfigurationWizardMainPage createLocationPage;
-
- // The page that prompts the user for module name.
- private ModuleSelectionPage modulePage;
-
- // The page that lets the user pick a branch to share against
- private TagSelectionWizardPage tagPage;
-
- // The page that allows the user to commit or update resources
- private SharingWizardSyncPage syncPage;
-
- // Keep track of location state so we know what to do at the end
- private ICVSRepositoryLocation location;
- private boolean isNewLocation;
-
- // Keep track of the folder that existed the last time we checked
- private ICVSRemoteFolder existingRemote;
-
- public SharingWizard() {
- IDialogSettings cvsSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = cvsSettings.getSection("SharingWizard");//$NON-NLS-1$
- if (section == null) {
- section = cvsSettings.addNewSection("SharingWizard");//$NON-NLS-1$
- }
- setDialogSettings(section);
- setNeedsProgressMonitor(true);
- setWindowTitle(CVSUIMessages.SharingWizard_title);
- }
-
- public void addPages() {
- ImageDescriptor sharingImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE);
- boolean autoconnect = false;
- if (doesCVSDirectoryExist()) {
- autoconnectPage = new ConfigurationWizardAutoconnectPage("autoconnectPage", CVSUIMessages.SharingWizard_autoConnectTitle, sharingImage); //$NON-NLS-1$
- if (autoconnectPage.setProject(project)) {
- autoconnectPage.setDescription(CVSUIMessages.SharingWizard_autoConnectTitleDescription);
- addPage(autoconnectPage);
- autoconnect = true;
- }
- }
- if (!autoconnect) {
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- if (locations.length > 0) {
- locationPage = new RepositorySelectionPage("importPage", CVSUIMessages.SharingWizard_importTitle, sharingImage); //$NON-NLS-1$
- locationPage.setDescription(CVSUIMessages.SharingWizard_importTitleDescription);
- addPage(locationPage);
- }
- createLocationPage = new ConfigurationWizardMainPage("createLocationPage", CVSUIMessages.SharingWizard_enterInformation, sharingImage); //$NON-NLS-1$
- createLocationPage.setDescription(CVSUIMessages.SharingWizard_enterInformationDescription);
- createLocationPage.setCVSWizard(this);
- createLocationPage.setDialogSettings(NewLocationWizard.getLocationDialogSettings());
- addPage(createLocationPage);
- modulePage = new ModuleSelectionPage("modulePage", CVSUIMessages.SharingWizard_enterModuleName, sharingImage); //$NON-NLS-1$
- modulePage.setDescription(CVSUIMessages.SharingWizard_enterModuleNameDescription);
- modulePage.setCVSWizard(this);
- modulePage.setProject(project);
- modulePage.setHelpContxtId(IHelpContextIds.SHARING_MODULE_PAGE);
- addPage(modulePage);
-
- addTagPage(sharingImage);
- addSyncPage(sharingImage);
- }
- }
-
- private void addTagPage(ImageDescriptor sharingImage) {
- tagPage = new TagSelectionWizardPage("tagPage", //$NON-NLS-1$
- CVSUIMessages.SharingWizard_selectTagTitle,
- sharingImage,
- CVSUIMessages.SharingWizard_selectTag,
- TagSource.EMPTY, // start with an empty tag source
- TagSourceWorkbenchAdapter.INCLUDE_HEAD_TAG | TagSourceWorkbenchAdapter.INCLUDE_BRANCHES);
- tagPage.setCVSWizard(this);
- tagPage.setHelpContxtId(IHelpContextIds.SHARING_TAG_SELETION_PAGE);
- addPage(tagPage);
- }
-
- private void addSyncPage(ImageDescriptor sharingImage) {
- syncPage = new SharingWizardSyncPage("syncPagePage", //$NON-NLS-1$
- CVSUIMessages.SharingWizard_23,
- sharingImage,
- CVSUIMessages.SharingWizard_24);
- syncPage.setProject(project);
- syncPage.setCVSWizard(this);
- addPage(syncPage);
- }
-
- public boolean canFinish() {
- IWizardPage page = getContainer().getCurrentPage();
- return (page == autoconnectPage || page == syncPage);
- }
-
- public IWizardPage getNextPage(IWizardPage page) {
- // Assume the page is about to be shown when this method is
- // invoked
- return getNextPage(page, true /* about to show*/);
- }
-
- public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow) {
- if (page == autoconnectPage) return null;
- if (page == locationPage) {
- if (locationPage.getLocation() == null) {
- return createLocationPage;
- } else {
- if (aboutToShow) {
- try {
- modulePage.setLocation(getLocation());
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- }
- if (page == createLocationPage) {
- if (aboutToShow) {
- try {
- modulePage.setLocation(getLocation());
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- try {
- if (page == modulePage) {
- if (aboutToShow) {
- ICVSRemoteFolder remoteFolder = getRemoteFolder();
- if (exists(remoteFolder)) {
- prepareTagPage(remoteFolder);
- return tagPage;
- } else {
- try {
- populateSyncPage(false /* remote exists */);
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- if (!RepositoryProvider.isShared(project)) {
- // Only stay on the current page if the sharing was a total failure
- return null;
- }
- }
- return syncPage;
- }
- } else {
- return syncPage;
- }
- }
- if (page == tagPage) {
- if (aboutToShow) {
- populateSyncPage(true /* remote exists */);
- }
- return syncPage;
- }
- } catch (InvocationTargetException e) {
- // Show the error and fall through to return null as the next page
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // The user cancelled. Falll through and return null as the next page.
- }
- return null;
- }
-
- /*
- * @see IWizard#performFinish
- */
- public boolean performFinish() {
- final boolean[] result = new boolean[] { true };
- if (isAutoconnect()) {
- try {
- getContainer().run(true /* fork */, true /* cancel */, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- result[0] = autoconnectCVSProject(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getContainer().getShell(), null, null, e);
- result[0] = false;
- }
- }
- // Add the location to the provider if it is new
- if (result[0] && isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
-
- final Shell parentShell= getShell().getParent().getShell();
- if (getContainer().getCurrentPage() == syncPage) {
- syncPage.saveSettings();
- if (syncPage.commitChanges()) {
- Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- try {
- CommitWizard.run(null, parentShell, new IResource[] { syncPage.getProject() });
- } catch (CVSException e) {
- //TODO:handle
- }
- }
- });
- }
- }
- return result[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#performCancel()
- */
- public boolean performCancel() {
- boolean disposeLocation = isNewLocation;
- ICVSRepositoryLocation location;
- try {
- location = getLocation();
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- return true;
- }
- if (location == null) return true;
- // If on the last page, offer to disconnect
- if (getContainer().getCurrentPage() == syncPage
- && RepositoryProvider.getProvider(project) != null) {
- // Prompt to see if we should undo out work
- if (promptToKeepMapping()) {
- // If we didn't disconnect, don't dispose the repo
- disposeLocation = false;
- // Add the location to the provider if it is new
- if (isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- } else {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- new DisconnectOperation(null, new IProject[] { project }, true)
- .run(monitor);
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(IStatus.ERROR, e.getMessage(), e.getTargetException());
- } catch (InterruptedException e) {
- // Ignore
- }
- }
- }
- // Dispose of the location if appropriate
- if (disposeLocation) {
- KnownRepositories.getInstance().disposeRepository(location);
- }
- return super.performCancel();
- }
-
- private boolean promptToKeepMapping() {
- return (MessageDialog.openQuestion(getShell(), CVSUIMessages.SharingWizard_26, NLS.bind(CVSUIMessages.SharingWizard_27, new String[] { project.getName() }))); //
- }
-
- private void reconcileProject(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- new ReconcileProjectOperation(getShell(), project, getRemoteFolder()).run(monitor);
- }
-
- /**
- * Return an ICVSRepositoryLocation
- */
- private ICVSRepositoryLocation getLocation() throws TeamException {
- // If there is an autoconnect page then it has the location
- if (autoconnectPage != null) {
- return recordLocation(autoconnectPage.getLocation());
- }
-
- // If the location page has a location, use it.
- if (locationPage != null) {
- ICVSRepositoryLocation newLocation = locationPage.getLocation();
- if (newLocation != null) {
- return recordLocation(newLocation);
- }
- }
-
- // Otherwise, get the location from the create location page
- final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[] { null };
- final CVSException[] exception = new CVSException[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- locations[0] = createLocationPage.getLocation();
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- return recordLocation(locations[0]);
- }
-
- private ICVSRepositoryLocation recordLocation(ICVSRepositoryLocation newLocation) {
- if (newLocation == null) return location;
- if (location == null || !newLocation.equals(location)) {
- if (location != null && isNewLocation) {
- // Dispose of the previous location
- KnownRepositories.getInstance().disposeRepository(location);
- }
- location = newLocation;
- isNewLocation = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation(false));
- if (isNewLocation) {
- // Add the location silently so we can work with it
- location = KnownRepositories.getInstance().addRepository(location, false /* silently */);
- }
- }
- return location;
- }
-
- /*
- * @see IConfigurationWizard#init(IWorkbench, IProject)
- */
- public void init(IWorkbench workbench, IProject project) {
- this.project = project;
- }
-
- private boolean doesCVSDirectoryExist() {
- // Determine if there is an existing CVS/ directory from which configuration
- // information can be retrieved.
- Shell shell = null;
- if (getContainer() != null) {
- shell = getContainer().getShell();
- }
- final boolean[] isCVSFolder = new boolean[] { false };
- try {
- CVSUIPlugin.runWithRefresh(shell, new IResource[] { project }, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- isCVSFolder[0] = info != null;
- } catch (final TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, null);
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(shell, null, null, e);
- } catch (InterruptedException e) {
- // Cancelled. Just fall through
- }
- return isCVSFolder[0];
- }
-
- /*
- * Shoudl the project be auto-connected
- */
- /* private*/ boolean isAutoconnect() {
- return autoconnectPage != null && doesCVSDirectoryExist();
- }
-
- /*
- * Auto-connect to the repository using CVS/ directories
- */
- /*private */ boolean autoconnectCVSProject(IProgressMonitor monitor) throws TeamException {
- try {
- monitor.beginTask(null, 100);
-
- FolderSyncInfo info = autoconnectPage.getFolderSyncInfo();
- if (info == null) {
- // Error!
- return false;
- }
-
- // Get the repository location (the get will add the locatin to the provider)
- ICVSRepositoryLocation location = getLocation();
-
- // Validate the connection if the user wants to
- boolean validate = autoconnectPage.getValidate();
- if (validate) {
- // Do the validation
- try {
- location.validateConnection(Policy.subMonitorFor(monitor, 50));
- } catch (final TeamException e) {
- // Exception validating. We can continue if the user wishes.
- final boolean[] keep = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- keep[0] = MessageDialog.openQuestion(getContainer().getShell(),
- CVSUIMessages.SharingWizard_validationFailedTitle,
- NLS.bind(CVSUIMessages.SharingWizard_validationFailedText, (new Object[] {e.getStatus().getMessage()})));
- }
- });
- if (!keep[0]) {
- return false;
- }
- // They want to keep the connection anyway. Fall through.
- }
- }
-
- // Set the sharing
- CVSWorkspaceRoot.setSharing(project, info, Policy.subMonitorFor(monitor, 50));
- return true;
- } finally {
- monitor.done();
- }
- }
-
- private boolean shareProject(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(null, 100);
- ICVSRepositoryLocation location = null;
- try {
- location = getLocation();
- location.validateConnection(Policy.subMonitorFor(monitor, 50));
- } catch (TeamException e) {
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC);
- if (isNewLocation && location != null) location.flushUserInfo();
- return false;
- }
-
- // Create the remote module for the project
- ShareProjectOperation op = new ShareProjectOperation(null, location, project, getRemoteFolder().getRepositoryRelativePath());
- op.setShell(getShell());
- op.run(Policy.subMonitorFor(monitor, 50));
- return true;
- }
-
- private CVSTag getTag() {
- if (tagPage == null || tagPage.getSelectedTag() == null) {
- return CVSTag.DEFAULT;
- }
- return tagPage.getSelectedTag();
- }
-
- private ICVSRemoteFolder getRemoteFolder() {
- ICVSRemoteFolder folder = modulePage.getSelectedModule();
- return (ICVSRemoteFolder)folder.forTag(getTag());
- }
-
- private boolean exists(ICVSRemoteFolder folder, IProgressMonitor monitor) throws TeamException {
- if (existingRemote != null && existingRemote.equals(folder)) return true;
- if (folder.exists(monitor)) {
- existingRemote = folder;
- return true;
- } else {
- existingRemote = null;
- return false;
- }
- }
-
- private boolean exists(final ICVSRemoteFolder folder) throws InvocationTargetException, InterruptedException {
- final boolean[] result = new boolean[] { false };
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- result[0] = exists(folder, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- return result[0];
- }
-
- private void populateSyncPage(final boolean exists) throws InvocationTargetException, InterruptedException {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- if (exists) {
- reconcileProject(Policy.subMonitorFor(monitor, 50));
- } else {
- shareProject(Policy.subMonitorFor(monitor, 50));
- }
- try {
- getParticipant().getContext().refresh(Utils.getResourceMappings(new IProject[] { project }), Policy.subMonitorFor(monitor, 50));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
- monitor.done();
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getPreviousPage(IWizardPage page) {
- if (page == syncPage) {
- // There's no going back from the sync page
- return null;
- }
- return super.getPreviousPage(page);
- }
-
- private void prepareTagPage(ICVSRemoteFolder remote) {
- tagPage.setTagSource(TagSource.create(remote));
- tagPage.setDescription(NLS.bind(CVSUIMessages.SharingWizard_25, new String[] { remote.getRepositoryRelativePath() }));
- }
-
- private ModelSynchronizeParticipant getParticipant() {
- return syncPage.getParticipant();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java
deleted file mode 100644
index ed6057e8a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSActionDelegateWrapper;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
-
-/**
- * Adviser used to add toolbar buttons to the last page of the sharing wizard.
- */
-public class SharingWizardPageActionGroup extends SynchronizePageActionGroup {
-
- public static final String ACTION_GROUP = "cvs_sharing_page_actions"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer)
- */
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ACTION_GROUP);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- ACTION_GROUP,
- new CVSActionDelegateWrapper(new IgnoreAction(), configuration, null /* no id to avoid conflict with context menu (bug 198319)*/){
- protected String getBundleKeyPrefix() {
- return "SharingWizardIgnore."; //$NON-NLS-1$
- }
- });
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
deleted file mode 100644
index 9963e3065..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.diff.*;
-import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.mappings.ModelSynchronizeWizard;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * Page that displays the compare input for sharing
- */
-public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeListener {
-
- // Constant keys used to store last size for this page
- private static final String PAGE_HEIGHT = "SyncPageHeight"; //$NON-NLS-1$
- private static final String PAGE_WIDTH = "SyncPageWidth"; //$NON-NLS-1$
-
- private ParticipantPageSaveablePart input;
- private ISynchronizePageConfiguration configuration;
- private IProject project;
-
- PageBook pageBook;
- private Control syncPage;
- private Control noChangesPage;
-
- private int width;
- private int height;
- private SharingWizardPageActionGroup sharingWizardPageActionGroup;
- private Button fCheckbox;
-
- public SharingWizardSyncPage(String pageName, String title, ImageDescriptor titleImage, String description) {
- super(pageName, title, titleImage, description);
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DEFAULT));
- setControl(composite);
-
- pageBook = new PageBook(composite, SWT.NONE);
- pageBook.setLayoutData(SWTUtils.createHVFillGridData());
-
- syncPage = createSyncPage(pageBook);
-
- noChangesPage = createNoChangesPage(pageBook);
- noChangesPage.setLayoutData(SWTUtils.createHVFillGridData());
-
- updatePage();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_SYNC_PAGE);
- Dialog.applyDialogFont(parent);
- }
-
- private IResourceDiffTree getDiffTree() {
- if (configuration == null)
- return null;
- return getParticipant().getContext().getDiffTree();
- }
-
- private Control createSyncPage(PageBook pageBook) {
- Composite composite = createComposite(pageBook, 1, false);
- input = createCompareInput();
- input.createPartControl(composite);
- getDiffTree().addDiffChangeListener(this);
-
- fCheckbox= new Button(composite, SWT.CHECK);
- fCheckbox.setLayoutData(SWTUtils.createHFillGridData());
- fCheckbox.setText(CVSUIMessages.SharingWizardSyncPage_12);
- fCheckbox.setSelection(true);
-
- return composite;
- }
-
- private Control createNoChangesPage(PageBook pageBook) {
- Composite composite = createComposite(pageBook, 1, false);
- createWrappingLabel(composite, NLS.bind(CVSUIMessages.SharingWizardSyncPage_3, new String[] { project.getName() }), 0);
- return composite;
- }
-
- /* private */ void showErrors(final IStatus[] status) {
- if (status.length == 0) return;
- getShell().getDisplay().syncExec(new Runnable() {
-
- public void run() {
- String title = CVSUIMessages.SharingWizardSyncPage_8;
- if (status.length == 1) {
- IStatus s = status[0];
- if (s.getException() instanceof CoreException) {
- s = ((CoreException)s.getException()).getStatus();
- }
- ErrorDialog.openError(getShell(), title, null, s);
- } else {
- MultiStatus multi = new MultiStatus(CVSUIPlugin.ID, 0, status, CVSUIMessages.SharingWizardSyncPage_9, null);
- ErrorDialog.openError(getShell(), title, null, multi);
- }
- }
- });
- }
-
- private ParticipantPageSaveablePart createCompareInput() {
- ISynchronizeParticipant participant = createParticipant();
- configuration = participant.createPageConfiguration();
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ISynchronizePageConfiguration.NAVIGATE_GROUP, SharingWizardPageActionGroup.ACTION_GROUP});
- sharingWizardPageActionGroup = new SharingWizardPageActionGroup();
- configuration.addActionContribution(sharingWizardPageActionGroup);
- configuration.setRunnableContext(getContainer());
-
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(false);
- cc.setRightEditable(false);
- ParticipantPageSaveablePart part = new ParticipantPageSaveablePart(getShell(), cc, configuration, participant);
- part.setShowContentPanes(false);
- return part;
- }
-
- private ISynchronizeParticipant createParticipant() {
- return ModelSynchronizeWizard.createWorkspaceParticipant(Utils.getResourceMappings(new IProject[] { project }), getShell());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- public void dispose() {
- if (input != null) {
- input.getParticipant().dispose();
- input.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#setPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public void setPreviousPage(IWizardPage page) {
- // There's no going back from this page
- super.setPreviousPage(null);
- }
-
- private void updatePage() {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (pageBook.isDisposed()) return;
- if (getDiffTree().isEmpty()) {
- pageBook.showPage(noChangesPage);
- } else {
- pageBook.showPage(syncPage);
- }
- }
- });
- }
-
- public ModelSynchronizeParticipant getParticipant() {
- return (ModelSynchronizeParticipant)configuration.getParticipant();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (syncPage.isVisible()) {
- initializeSize();
- getShell().setSize(Math.max(width, 300), Math.max(height, 300));
- if(input != null) {
- Viewer viewer = input.getPageConfiguration().getPage().getViewer();
- if(viewer instanceof AbstractTreeViewer && !viewer.getControl().isDisposed()) {
- ((AbstractTreeViewer)viewer).expandToLevel(2);
- }
- }
- }
- }
-
- private void initializeSize() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- try {
- width = settings.getInt(PAGE_WIDTH);
- height = settings.getInt(PAGE_HEIGHT);
- } catch (NumberFormatException e) {
- // Ignore and go on;
- }
- }
- if (width == 0) width = 640;
- if (height == 0) height = 480;
- }
-
- /**
- * Save the size of the page so it can be opened with the same size next time
- */
- public void saveSettings() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- Point size = getShell().getSize();
- settings.put(PAGE_WIDTH, size.x);
- settings.put(PAGE_HEIGHT, size.y);
- }
- }
-
- public boolean commitChanges() {
- return fCheckbox != null ? fCheckbox.getSelection() && hasOutgoingChanges() : false;
- }
-
- private boolean hasOutgoingChanges() {
- IResourceDiffTree tree = getDiffTree();
- return tree != null && tree.hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new FastDiffFilter() {
- public boolean select(IDiff diff) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- return twd.getDirection() == IThreeWayDiff.OUTGOING || twd.getDirection() == IThreeWayDiff.CONFLICTING;
- }
- return false;
- }
- });
- }
-
- /**
- * @return Returns the project.
- */
- public IProject getProject() {
- return project;
- }
-
- public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- showErrors(event.getErrors());
- updatePage();
- }
-
- public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
- // Ignore
- }
-}
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 040edc434..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class UpdateWizard extends ResizableWizard {
-
- private ResourceMapping[] mappers;
- private final IWorkbenchPart part;
- private TagSelectionWizardPage tagSelectionPage;
-
- public UpdateWizard(IWorkbenchPart part, ResourceMapping[] mappers) {
- super("UpdateWizard", CVSUIPlugin.getPlugin().getDialogSettings()); //$NON-NLS-1$
- this.part = part;
- this.mappers = mappers;
- setWindowTitle(CVSUIMessages.UpdateWizard_title);
- }
-
- public static void run(IWorkbenchPart part, ResourceMapping[] mappers) {
- final UpdateWizard wizard = new UpdateWizard(part, mappers);
- open(part.getSite().getShell(), wizard);
- }
-
- public void addPages() {
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
- tagSelectionPage = new TagSelectionWizardPage("tagPage", CVSUIMessages.UpdateWizard_0, substImage, CVSUIMessages.UpdateWizard_1, TagSource.create(mappers), TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS); //$NON-NLS-1$
- tagSelectionPage.setAllowNoTag(true);
- tagSelectionPage.setHelpContxtId(IHelpContextIds.UPDATE_TAG_SELETION_PAGE);
- CVSTag tag = getInitialSelection();
- if (tag != null) {
- tagSelectionPage.setSelection(tag);
- }
- addPage(tagSelectionPage);
- }
-
- /**
- * @return
- */
- private CVSTag getInitialSelection() {
- try {
- for (int i = 0; i < mappers.length; i++) {
- ResourceMapping mapper = mappers[i];
- IProject[] projects = mapper.getProjects();
- for (int k = 0; k < projects.length; k++) {
- IProject project = projects[k];
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null) {
- return info.getTag();
- }
- }
- }
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- return null;
- }
-
- /*
- * @see IWizard#performFinish()
- */
- public boolean performFinish() {
- try {
- new UpdateOperation(part, mappers, Command.NO_LOCAL_OPTIONS, tagSelectionPage.getSelectedTag()).run();
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- return false;
- } catch (InterruptedException e) {
- return false;
- }
-
- return super.performFinish();
- }
-}

Back to the top