Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ComparisonCriteria.java2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberManager.java69
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamDelta.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java79
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberFactory.java64
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContext.java138
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java100
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java220
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SubscriberManager.java296
-rw-r--r--bundles/org.eclipse.team.cvs.core/.project1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java78
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSubscriberFactory.java63
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java45
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSSubscriberNonblockingContext.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java126
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java162
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SynchronizeViewActionDelagate.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java53
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java46
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java12
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gifbin0 -> 174 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gifbin0 -> 170 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gifbin0 -> 97 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gifbin0 -> 164 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gifbin0 -> 167 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gifbin0 -> 101 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gifbin0 -> 101 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gifbin0 -> 66 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gifbin0 -> 97 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gifbin0 -> 99 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gifbin0 -> 138 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gifbin0 -> 133 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gifbin0 -> 97 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gifbin0 -> 162 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gifbin0 -> 131 bytes
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties2
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml48
-rw-r--r--bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd146
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java96
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.java118
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties49
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java148
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizePartnerDescriptor.java120
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java37
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseChangeFilterAction.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseSubscriberAction.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CopyAction.java209
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/PasteAction.java226
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java135
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerAction.java37
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActionGroup.java81
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java303
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerChangeFilters.java148
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java124
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java256
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java153
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerToolbarDropDownAction.java102
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ToggleViewAction.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java240
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java190
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java823
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/ViewStatusInformation.java76
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java398
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java305
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java125
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/TeamSynchronizingPerspective.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java148
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java74
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/INavigableControl.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java)18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java106
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java)46
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenWithActionGroup.java)39
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefactorActionGroup.java)76
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java)61
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java75
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java108
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java101
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerShowPreferencesAction.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java130
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TextToolbarManager.java39
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToolItemActionContributionItem.java851
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java148
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java82
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/LocalResourceTypedElement.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/LocalResourceTypedElement.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/RemoteResourceTypedElement.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java)11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoDiffNode.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/ISyncSetChangedListener.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/ISyncSetChangedListener.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SubscriberEventHandler.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java)4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SubscriberInput.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java)14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoStatistics.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoStatistics.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java)5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSet.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetChangedEvent.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInput.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java)4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInputFromSubscriber.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSubscriber.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInputFromSyncSet.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSyncSet.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/WorkingSetSyncSetInput.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/WorkingSetSyncSetInput.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolder.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolder.java)4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolderContentProvider.java)6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java)100
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTableContentProvider.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTableContentProvider.java)4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTreeContentProvider.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java)6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java)3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java)11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerSorter.java)5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerTableSorter.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerTableSorter.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeViewNode.java)32
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java)13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java78
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeViewNode.java82
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java39
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java271
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java90
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java120
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ITeamSubscriberParticipantNode.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java152
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java)131
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java568
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/DirectionFilterActionGroup.java177
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberAction.java)26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoFilter.java155
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoSet.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java)50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/package.html14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html67
-rw-r--r--tests/org.eclipse.team.tests.core/.project2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS Core Tests.launch17
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS UI Tests.launch (renamed from tests/org.eclipse.team.tests.cvs.core/launchConfigurations/All CVS Tests.launch)18
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllCoreTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java)28
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java17
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ConcurrencyTests.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java70
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java23
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/AllUITests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/AllUIUnitTests.java)8
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSOperationTest.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/CVSOperationTest.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CheckoutOperationTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/CheckoutOperationTests.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/CompareOperationTests.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/HeadlessCVSRunnableContext.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java135
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/AllTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ArgumentParser.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/BenchmarkTestSetup.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSUITestCase.java)22
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CaseEntry.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CommandTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java)16
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DelimitedValuesWriter.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DummyPromptCondition.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/DummyPromptCondition.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/EclipseUITestHarnessApplication.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EclipseUITestHarnessApplication.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/EmptyPerspective.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/FakeSelectionProvider.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/GroupEntry.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ICriteria.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ILogEntryVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntry.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntryContainer.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogFormatterUIMain.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestCase.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestResult.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestRunner.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/MergeRunsVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PerformanceTimer.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVDiffVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVSummaryVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffMain.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintSummaryMain.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextDiffVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextSummaryVisitor.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Result.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/RootEntry.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SequenceGenerator.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SyncTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java)17
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/TaskEntry.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Util.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Utils.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java)6
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Waiter.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java)2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/WorkflowTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java)51
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/AllTestsSynchronizeView.java48
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java92
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/test.xml9
249 files changed, 7192 insertions, 6132 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ComparisonCriteria.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ComparisonCriteria.java
index 25888277f..72a943bcd 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ComparisonCriteria.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ComparisonCriteria.java
@@ -17,7 +17,7 @@ import org.eclipse.team.core.TeamException;
* A ComparisonCriteria used by a <code>TeamSubscriber</code> to calculate the sync
* state of the workspace resources. Subscribers are free to use the criteria
* best suited for their environment. For example, an FTP subscriber could choose to use file
- * size or file size as compasison criterias.
+ * size or file timestamps as compasison criterias.
* <p>
* Aggregate criterias can be created for cases where a criteria is based on the result
* of another criteria.</p>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberManager.java
deleted file mode 100644
index dbeb48a17..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberManager.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.subscribers;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * The subscriber manager is responsible for managing the team subscribers.
- * It provides the ability to register and deregister subscribers and access
- * all currently registered subscribers. It also fires events when subscribers
- * are registered and deregistered.
- */
-public interface ISubscriberManager {
-
- /**
- * Register a subscriber with the subscriber manager. The id of the subscriber
- * (returned by <code>TeamSubscriber#getId()</code>) must be unique.
- * Registering a subscriber will result in all registered listeners being
- * notified of the addition in the same thread as the call to <code>registerSubscriber()</code>.
- *
- * @param subscriber the subscriber being registered
- */
- public void registerSubscriber(TeamSubscriber subscriber);
-
- /**
- * Remove a subscriber from the subscriber manager. Deregistering a subscriber
- * will result in all registered listeners being
- * notified of the addition in the same thread as the call to
- * <code>deregisterSubscriber()</code>.
- *
- * @param subscriber the subscriber being deregistered
- */
- public void deregisterSubscriber(TeamSubscriber subscriber);
-
- /**
- * Get the subscriber with the given id. Return <code>null</code>
- * if there is no registered subscriber with the given id.
- * @param id the unique id of the subscriber
- * @return the subscriber whose id matches the given one
- */
- public TeamSubscriber getSubscriber(QualifiedName id);
-
- /**
- * Return all registered subscribers.
- * @return all registered subscribers
- */
- public TeamSubscriber[] getSubscribers();
-
- /**
- * Add a change listener that will be invoked when a subscriber is registered
- * or deregistered.
- * @param listener the team resource change listener to be added
- */
- public void addTeamResourceChangeListener(ITeamResourceChangeListener listener);
-
- /**
- * Remove a previously added change listener
- * @param listener the team resource change listener to be removed
- */
- public void removeTeamResourceChangeListener(ITeamResourceChangeListener listener);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamDelta.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamDelta.java
index 308daf14f..580b214f7 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamDelta.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamDelta.java
@@ -47,18 +47,6 @@ public class TeamDelta {
*/
public static final int PROVIDER_DECONFIGURED = 0x4;
- /**
- * Delta kind constant (bit mask) indicating that a team provider has been de-configured on the resource.
- * @see IResourceDelta#getKind
- */
- public static final int SUBSCRIBER_CREATED = 0x8;
-
- /**
- * Delta kind constant (bit mask) indicating that a team provider has been de-configured on the resource.
- * @see IResourceDelta#getKind
- */
- public static final int SUBSCRIBER_DELETED = 0x10;
-
private TeamSubscriber subscriber;
private int flags;
private IResource resource;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
index 9c207864c..bc9398f9f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
@@ -14,11 +14,9 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.SubscriberManager;
/**
* A TeamSubscriber provides synchronization between local resources and a remote location
@@ -32,28 +30,6 @@ abstract public class TeamSubscriber {
private List listeners = new ArrayList(1);
/**
- * Return the subscriber manager which provides access and control of the
- * team subscribers.
- * @return the subscriber manager
- */
- public static ISubscriberManager getSubscriberManager() {
- return SubscriberManager.getInstance();
- }
-
- /**
- * Return the unique id that identified this subscriber.
- */
- abstract public QualifiedName getId();
-
- /**
- * Return the name of this subscription, in a format that is suitable for
- * display to an end user.
- *
- * @return String representing the name of this subscription.
- */
- abstract public String getName();
-
- /**
* Return the description of this subscription, in a format that is suitable for
* display to an end user. The description should contain enough details to
* understand the connection type of this subscriber.
@@ -218,18 +194,6 @@ abstract public class TeamSubscriber {
abstract public boolean isThreeWay();
/**
- * Returns if this subscription can be cancelled. This allows short-lived subscriptions to
- * be terminated at the users request. For example, this could be used to finish a merge
- * subscription once all changes have been merged.
- */
- abstract public boolean isCancellable();
-
- /**
- * Cancels this subscription.
- */
- abstract public void cancel();
-
- /**
* Adds a listener to this team subscriber.
* Has no effect if an identical listener is already registered.
* <p>
@@ -270,7 +234,19 @@ abstract public class TeamSubscriber {
synchronized(listeners) {
allListeners = (ITeamResourceChangeListener[]) listeners.toArray(new ITeamResourceChangeListener[listeners.size()]);
}
- ((SubscriberManager)getSubscriberManager()).fireTeamResourceChange(allListeners, deltas);
+ // Notify the listeners safely so all will receive notification
+ for (int i = 0; i < allListeners.length; i++) {
+ final ITeamResourceChangeListener listener = allListeners[i];
+ Platform.run(new ISafeRunnable() {
+ public void handleException(Throwable exception) {
+ // don't log the exception....it is already being logged in Platform#run
+ }
+ public void run() throws Exception {
+ listener.teamResourceChanged(deltas);
+
+ }
+ });
+ }
}
/**
@@ -293,31 +269,4 @@ abstract public class TeamSubscriber {
public SyncInfo[] getAllOutOfSync(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
return null;
}
-
- /**
- * Returns <code>true</code> if you can release changes to this subscriber and
- * <code>false</code> otherwise.
- */
- public boolean isReleaseSupported() {
- return true;
- }
-
- /**
- * Return true if the receiver is equal to object.
- * @return true if object is the same class as the receiver and has the same ID
- */
- public boolean equals(Object object) {
- if (object instanceof TeamSubscriber) {
- TeamSubscriber subscriber = (TeamSubscriber) object;
- return getId().equals(subscriber.getId());
- }
- return super.equals(object);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getId().hashCode();
}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberFactory.java
deleted file mode 100644
index ba14fbd97..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.subscribers;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.SaveContext;
-
-/**
- * A subscriber factory is responsible for saving and restoring subscribers. Implementations must
- * provide a public no-arg constructor.
- *
- * Example extension point for registering a subscriber factory:
- *
- * <extension point="org.eclipse.team.core.subscriber">
- * <subscriber class="org.eclipse.team.internal.webdav.DavSubscriberFactory"/>
- *</extension>
- *
- * @see org.eclipse.team.core.subscribers.TeamSubscriber
- */
-abstract public class TeamSubscriberFactory {
-
- /**
- * A subscriber factory id identifies the factory type and the type of it's subscribers. Subscribers
- * created via a specific factory should return a qualified name from TeamSubscriber#getID() that
- * matches the id of their factory.
- * <p>
- * For example, a WebDav subscriber factory would have "org.eclipse.team.webdav.subscriber" as
- * its id. Subsequent WebDav subscribers must construct their id based on this qualifier.
- *
- * @return the factory's id
- */
- abstract public String getID();
-
- /**
- * Called to save the state of the given subscriber. The saved state should contain enough
- * information so that a subcriber can be recreated from the returned <code>SaveContext</code>.
- * A subscriber that doesn't have information to the saved should return <code>null</code>.
- * <p>
- * This may be called during workspace snapshot or at shutdown.
- * </p>
- *
- * @return a save context containing the state of this subscriber
- * @throws TeamException if there was a problem creating the save context.
- */
- abstract public SaveContext saveSubscriber(TeamSubscriber subscriber) throws TeamException;
-
- /**
- * Called to restore a subscriber with <code>id</code> from a given <code>SaveContext</code>. This is
- * used to restore subscribers between workbench sessions.
- *
- * @return a subscriber instance
- * @throws TeamException if there was a problem restoring from the save context.
- */
- abstract public TeamSubscriber restoreSubscriber(QualifiedName id, SaveContext saveContext) throws TeamException;
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContext.java
deleted file mode 100644
index f8eadf6b5..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContext.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Something (as a mark of visible sign) left by a material thing formely present but now
- * lost or unknown.
- *
- * TODO: API doc if this class is to remain. Ideally it should replaced by a core mechanism which
- * allows persisting somewhat like IMemento.
- */
-public class SaveContext {
-
- private String name;
-
- private String value;
-
- private Map attributes;
-
- private List children = new ArrayList(2);
-
- public SaveContext() {}
-
- public String getAttribute(String name) {
- if(attributes == null) {
- return null;
- }
- return (String)attributes.get(name);
- }
-
- public void putInteger(String key, int n) {
- addAttribute(key, String.valueOf(n));
- }
-
- public void putFloat(String key, float n) {
- addAttribute(key, String.valueOf(n));
- }
-
- public void putString(String key, String n) {
- addAttribute(key, n);
- }
-
- public void putBoolean(String key, boolean n) {
- addAttribute(key, String.valueOf(n));
- }
-
- public int getInteger(String key) {
- String f = getAttribute(key);
- if(f != null) {
- return new Integer(f).intValue();
- }
- return 0;
- }
-
- public float getFloat(String key) {
- String f = getAttribute(key);
- if(f != null) {
- return new Float(f).floatValue();
- }
- return 0;
- }
-
- public String getString(String key) {
- return getAttribute(key);
- }
-
- public boolean getBoolean(String key) {
- String bool = getAttribute(key);
- if(bool != null) {
- return bool.equals("true") ? true : false; //$NON-NLS-1$
- }
- return true;
- }
-
- public String[] getAttributeNames() {
- if(attributes == null) {
- return new String[0];
- }
- return (String[])attributes.keySet().toArray(new String[attributes.keySet().size()]);
- }
-
- public SaveContext[] getChildren() {
- return (SaveContext[]) children.toArray(new SaveContext[children.size()]);
- }
-
- public String getName() {
- return name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setAttributes(Map map) {
- attributes = map;
- }
-
- public void setChildren(SaveContext[] items) {
- children = new ArrayList(Arrays.asList(items));
- }
-
- public void putChild(SaveContext child) {
- children.add(child);
- }
-
- public void setName(String string) {
- name = string;
- }
-
- public void setValue(String string) {
- value = string;
- }
-
- public void addAttribute(String key, String value) {
- if(attributes == null) {
- attributes = new HashMap();
- }
- attributes.put(key, value);
- }
-
- public String toString() {
- return getName() + " ->" + attributes.toString(); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
deleted file mode 100644
index 66f9785ec..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.util.Stack;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * SaveContextXMLContentHandler
- */
-public class SaveContextXMLContentHandler extends DefaultHandler {
-
- private StringBuffer buffer = new StringBuffer();
- private Stack contextStack = new Stack();
- private SaveContext last;
-
- public SaveContextXMLContentHandler() {
- }
-
- /**
- * @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 {
- SaveContext ctx = (SaveContext)contextStack.peek();
- String elementName = getElementName(namespaceURI, localName, qName);
- if (!elementName.equals(ctx.getName())) {
- // keep going
- } else {
- last = (SaveContext)contextStack.pop();
- if(! contextStack.isEmpty()) {
- SaveContext parent = (SaveContext)contextStack.peek();
- parent.putChild(ctx);
- }
- }
- }
-
- /**
- * @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 {
- SaveContext context = new SaveContext();
- String elementName = getElementName(namespaceURI, localName, qName);
- context.setName(elementName);
- for (int i = 0; i < atts.getLength(); i++) {
- String attrName = getAttributeName(atts, i);
- String attrValue = atts.getValue(i);
- context.putString(attrName, attrValue);
- }
- // empty buffer
- buffer = new StringBuffer();
- contextStack.push(context);
- }
-
- public SaveContext getSaveContext() {
- return last;
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for subscribers 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;
- }
- }
-
- /*
- * See getElementName() reasoning for why this method is needed.
- */
- private String getAttributeName(Attributes atts, int i) {
- String localName = atts.getLocalName(i);
- if (localName != null && localName.length() > 0) {
- return localName;
- } else {
- return atts.getQName(i);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
deleted file mode 100644
index 1e6edbda9..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.TeamException;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class SaveContextXMLWriter extends PrintWriter {
- protected int tab;
-
- /* constants */
- protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
-
- public SaveContextXMLWriter(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 enum = Collections.enumeration(parameters.keySet()); enum.hasMoreElements();) {
- sb.append(" "); //$NON-NLS-1$
- String key = (String) enum.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;
- }
- public void write(SaveContext item) {
-
- // start tag for this element
- String name = item.getName();
- String value = item.getValue();
- String[] attributeNames = item.getAttributeNames();
- HashMap attributes = new HashMap(attributeNames.length);
- for (int i = 0; i < attributeNames.length; i++) {
- String attrName = attributeNames[i];
- attributes.put(attrName, item.getAttribute(attrName));
- }
- startTag(name, attributes);
-
- // write out child elements
- SaveContext[] children = item.getChildren();
- if(children != null) {
- for (int i = 0; i < children.length; i++) {
- SaveContext child = children[i];
- write(child);
- }
- }
-
- // value
- if(value != null) {
- println(value);
- }
-
- // end tag for this element
- endTag(name);
- }
-
- static public void writeXMLPluginMetaFile(Plugin plugin, String filename, SaveContext element) throws TeamException {
- IPath pluginStateLocation = plugin.getStateLocation();
- File tempFile = pluginStateLocation.append(filename + ".tmp").toFile(); //$NON-NLS-1$
- File stateFile = pluginStateLocation.append(filename).toFile();
- try {
- SaveContextXMLWriter writer = new SaveContextXMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile)));
- try {
- writer.write(element);
- } finally {
- writer.close();
- }
- if (stateFile.exists()) {
- stateFile.delete();
- }
- boolean renamed = tempFile.renameTo(stateFile);
- if (!renamed) {
- throw new TeamException(new Status(Status.ERROR, TeamPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.rename", tempFile.getAbsolutePath()), null)); //$NON-NLS-1$
- }
- } catch (IOException e) {
- throw new TeamException(new Status(Status.ERROR, TeamPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.save",stateFile.getAbsolutePath()), e)); //$NON-NLS-1$
- }
- }
-
- static public SaveContext readXMLPluginMetaFile(Plugin plugin, String filename) throws TeamException {
- BufferedInputStream is = null;
- try {
- IPath pluginStateLocation = plugin.getStateLocation();
- File file = pluginStateLocation.append(filename).toFile(); //$NON-NLS-1$
- if (file.exists()) {
- is = new BufferedInputStream(new FileInputStream(file));
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- SaveContextXMLContentHandler handler = new SaveContextXMLContentHandler();
- parser.parse(new InputSource(is), handler);
- return handler.getSaveContext();
- }
- return null;
- } catch (SAXException ex) {
- throw new TeamException(Policy.bind("RepositoryManager.ioException"), ex); //$NON-NLS-1$
- } catch (IOException e) {
- throw new TeamException(Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
- } catch (ParserConfigurationException e) {
- throw new TeamException(Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
- } finally {
- if(is != null) {
- try {
- is.close();
- } catch (IOException e1) {
- throw new TeamException(Policy.bind("RepositoryManager.ioException"), e1); //$NON-NLS-1$
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SubscriberManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SubscriberManager.java
deleted file mode 100644
index 2a943b278..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SubscriberManager.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-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.ISaveContext;
-import org.eclipse.core.resources.ISaveParticipant;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ISubscriberManager;
-import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
-import org.eclipse.team.core.subscribers.TeamDelta;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.core.subscribers.TeamSubscriberFactory;
-
-/**
- * This class provides the private implementation of <code>ISubscriberManager</code>.
- */
-public class SubscriberManager implements ISubscriberManager, ISaveParticipant {
-
- private static String SUBSCRIBER_EXTENSION = "subscriber"; //$NON-NLS-1$
- final static private String SAVECTX_SUBSCRIBERS = "subscribers"; //$NON-NLS-1$
- final static private String SAVECTX_SUBSCRIBER = "subscriber"; //$NON-NLS-1$
- final static private String SAVECTX_QUALIFIER = "qualifier"; //$NON-NLS-1$
- final static private String SAVECTX_LOCALNAME = "localName"; //$NON-NLS-1$
-
- private Map subscribers = new HashMap();
- private List listeners = new ArrayList(1);
- private Map factories = new HashMap();
-
- static private ISubscriberManager instance;
-
- private static final Object GET_INSTANCE_LOCK = new Object();
-
- public static ISubscriberManager getInstance() {
- boolean startup = false;
- synchronized(GET_INSTANCE_LOCK) {
- if (instance == null) {
- // Initialize the variable before trigering startup.
- // This is done because the startup code can invoke
- // subscriber factories which, in turn will ask for the
- // subscriber manager.
- instance = new SubscriberManager();
- startup = true;
- }
- }
- if (startup) {
- // The startup of the manager must be done outside the lock as it
- // can invoke client code
- ((SubscriberManager)instance).startup();
- }
-
- return instance;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberManager#registerSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
- */
- public void registerSubscriber(TeamSubscriber subscriber) {
- boolean fireEvent = false;
- synchronized(subscribers) {
- if(! subscribers.containsKey(subscriber.getId())) {
- subscribers.put(subscriber.getId(), subscriber);
- fireEvent = true;
- }
- }
- if (fireEvent) {
- fireTeamResourceChange(new TeamDelta[] {
- new TeamDelta(subscriber, TeamDelta.SUBSCRIBER_CREATED, null)});
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberManager#deregisterSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
- */
- public void deregisterSubscriber(TeamSubscriber subscriber) {
- boolean fireEvent = false;
- synchronized(subscribers) {
- if (subscribers.remove(subscriber.getId()) != null) {
- // Only notify if the subscriber was registered in the first place
- fireEvent = true;
- }
- }
- if (fireEvent) {
- fireTeamResourceChange(new TeamDelta[] {
- new TeamDelta(subscriber, TeamDelta.SUBSCRIBER_DELETED, null)});
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberManager#getSubscriber(org.eclipse.core.runtime.QualifiedName)
- */
- public TeamSubscriber getSubscriber(QualifiedName id) {
- synchronized(subscribers) {
- TeamSubscriber s = (TeamSubscriber)subscribers.get(id);
- return s;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberManager#getSubscribers()
- */
- public TeamSubscriber[] getSubscribers() {
- synchronized(subscribers) {
- return (TeamSubscriber[])subscribers.values().toArray(
- new TeamSubscriber[subscribers.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberManager#addTeamResourceChangeListener(org.eclipse.team.core.subscribers.ITeamResourceChangeListener)
- */
- public void addTeamResourceChangeListener(ITeamResourceChangeListener listener) {
- synchronized(listener) {
- listeners.add(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberManager#removeTeamResourceChangeListener(org.eclipse.team.core.subscribers.ITeamResourceChangeListener)
- */
- public void removeTeamResourceChangeListener(ITeamResourceChangeListener listener) {
- synchronized(listener) {
- listeners.remove(listener);
- }
- }
-
- public void doneSaving(ISaveContext context) {
- }
-
- public void prepareToSave(ISaveContext context) throws CoreException {
- }
-
- public void rollback(ISaveContext context) {
- }
-
- public void saving(ISaveContext context) throws CoreException {
- // save subscribers during snapshot and at full save
- saveSubscribers();
- }
-
- public void startup() {
- try {
- ResourcesPlugin.getWorkspace().addSaveParticipant(TeamPlugin.getPlugin(), this);
- } catch (CoreException e) {
- TeamPlugin.log(e);
- }
- restoreSubscribers();
- }
-
- /*
- * Fires a team resource change event to all registered listeners
- * Only listeners registered at the time this method is called are notified.
- */
- protected void fireTeamResourceChange(TeamDelta[] deltas) {
- ITeamResourceChangeListener[] allListeners;
- // Copy the listener list so we're not calling client code while synchronized
- synchronized(listeners) {
- allListeners = (ITeamResourceChangeListener[]) listeners.toArray(new ITeamResourceChangeListener[listeners.size()]);
- }
- fireTeamResourceChange(allListeners, deltas);
- }
-
- public void fireTeamResourceChange(ITeamResourceChangeListener[] listeners, final TeamDelta[] deltas) {
- // Notify the listeners safely so all will receive notification
- for (int i = 0; i < listeners.length; i++) {
- final ITeamResourceChangeListener listener = listeners[i];
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // don't log the exception....it is already being logged in Platform#run
- }
- public void run() throws Exception {
- listener.teamResourceChanged(deltas);
-
- }
- });
- }
- }
-
- synchronized void restoreSubscribers() {
- try {
- SaveContext root = SaveContextXMLWriter.readXMLPluginMetaFile(TeamPlugin.getPlugin(), "subscribers"); //$NON-NLS-1$
- if(root != null && root.getName().equals(SAVECTX_SUBSCRIBERS)) {
- SaveContext[] contexts = root.getChildren();
- for (int i = 0; i < contexts.length; i++) {
- SaveContext context = contexts[i];
- if(context.getName().equals(SAVECTX_SUBSCRIBER)) {
- String qualifier = context.getAttribute(SAVECTX_QUALIFIER);
- String localName = context.getAttribute(SAVECTX_LOCALNAME);
- TeamSubscriberFactory factory = create(qualifier);
- if(factory == null) {
- TeamPlugin.log(new TeamException(Policy.bind("TeamProvider.10", qualifier.toString()))); //$NON-NLS-1$
- }
- SaveContext[] children = context.getChildren();
- if(children.length == 1) {
- TeamSubscriber s = factory.restoreSubscriber(new QualifiedName(qualifier, localName), children[0]);
- if(s != null) {
- registerSubscriber(s);
- }
- }
- }
- }
-
- }
- } catch (TeamException e) {
- TeamPlugin.log(e);
- }
- }
-
- synchronized void saveSubscribers() {
- SaveContext root = new SaveContext();
- root.setName(SAVECTX_SUBSCRIBERS);
- List children = new ArrayList();
- try {
- for (Iterator it = subscribers.values().iterator(); it.hasNext();) {
- TeamSubscriber subscriber = (TeamSubscriber) it.next();
- String qualifier = subscriber.getId().getQualifier();
- TeamSubscriberFactory factory = create(qualifier);
- if(factory == null) {
- TeamPlugin.log(new TeamException(Policy.bind("TeamProvider.11", qualifier))); //$NON-NLS-1$
- }
- SaveContext child = factory.saveSubscriber(subscriber);
- if(child != null) {
- SaveContext item = new SaveContext();
- item.putChild(child);
- item.setName(SAVECTX_SUBSCRIBER);
- Map attributes = new HashMap();
- attributes.put(SAVECTX_QUALIFIER, subscriber.getId().getQualifier());
- attributes.put(SAVECTX_LOCALNAME, subscriber.getId().getLocalName());
- item.setAttributes(attributes);
- children.add(item);
- }
- }
- root.setChildren((SaveContext[])children.toArray(new SaveContext[children.size()]));
- SaveContextXMLWriter.writeXMLPluginMetaFile(TeamPlugin.getPlugin(), "subscribers", root); //$NON-NLS-1$
- } catch (TeamException e) {
- TeamPlugin.log(e);
- }
- }
-
- private TeamSubscriberFactory create(String id) {
- TeamSubscriberFactory sFactory = (TeamSubscriberFactory)factories.get(id);
- if(sFactory != null) {
- return sFactory;
- }
-
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(SUBSCRIBER_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- try {
- //Its ok not to have a typeClass extension. In this case, a default instance will be created.
- if(configElements[j].getAttribute("class") != null) { //$NON-NLS-1$
- sFactory = (TeamSubscriberFactory) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- }
- factories.put(sFactory.getID(), sFactory);
- return sFactory;
- } catch (CoreException e) {
- TeamPlugin.log(e);
- } catch (ClassCastException e) {
- String className = configElements[j].getAttribute("class"); //$NON-NLS-1$
- TeamPlugin.log(IStatus.ERROR, Policy.bind("RepositoryProviderType.invalidClass", id.toString(), className), e); //$NON-NLS-1$
- }
- return null;
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.core/.project b/bundles/org.eclipse.team.cvs.core/.project
index a57858a9b..a52c8310a 100644
--- a/bundles/org.eclipse.team.cvs.core/.project
+++ b/bundles/org.eclipse.team.cvs.core/.project
@@ -3,6 +3,7 @@
<name>org.eclipse.team.cvs.core</name>
<comment></comment>
<projects>
+ <project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
<project>org.eclipse.core.runtime</project>
<project>org.eclipse.team.core</project>
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index 1684244a7..7039863ee 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -12,7 +12,6 @@ package org.eclipse.team.internal.ccvs.core;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
@@ -23,9 +22,7 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
@@ -35,11 +32,9 @@ import org.eclipse.team.core.subscribers.RemoteBytesSynchronizer;
import org.eclipse.team.core.subscribers.RemoteSynchronizer;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamDelta;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ccvs.core.syncinfo.MergedSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.RemoteTagSynchronizer;
-import org.eclipse.team.internal.core.SaveContext;
/**
* A CVSMergeSubscriber is responsible for maintaining the remote trees for a merge into
@@ -58,7 +53,8 @@ import org.eclipse.team.internal.core.SaveContext;
*/
public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResourceChangeListener, ITeamResourceChangeListener {
- public static final String UNIQUE_ID_PREFIX = "merge-"; //$NON-NLS-1$
+ public static final String QUALIFIED_NAME = "org.eclipse.team.cvs.ui.cvsmerge-participant"; //$NON-NLS-1$
+ private static final String UNIQUE_ID_PREFIX = "merge-"; //$NON-NLS-1$
private CVSTag start, end;
private List roots;
@@ -84,7 +80,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
private static QualifiedName getUniqueId() {
String uniqueId = Long.toString(System.currentTimeMillis());
- return new QualifiedName(CVSSubscriberFactory.ID, UNIQUE_ID_PREFIX + uniqueId);
+ return new QualifiedName(QUALIFIED_NAME, "CVS" + UNIQUE_ID_PREFIX + uniqueId); //$NON-NLS-1$
}
public CVSMergeSubscriber(IResource[] roots, CVSTag start, CVSTag end) {
@@ -144,20 +140,12 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public void cancel() {
super.cancel();
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- TeamSubscriber.getSubscriberManager().deregisterSubscriber(this);
remoteSynchronizer.dispose();
baseSynchronizer.dispose();
mergedSynchronizer.dispose();
}
/* (non-Javadoc)
- * @see org.eclipse.team.core.sync.TeamSubscriber#isCancellable()
- */
- public boolean isCancellable() {
- return true;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.core.sync.TeamSubscriber#roots()
*/
public IResource[] roots() {
@@ -184,65 +172,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public boolean isSupervised(IResource resource) throws TeamException {
return getBaseSynchronizer().hasRemote(resource) || getRemoteSynchronizer().hasRemote(resource);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.TeamSubscriber#saveState(org.eclipse.team.internal.core.SaveContext)
- */
- public SaveContext saveState() {
- // start and end tags
- SaveContext state = new SaveContext();
- state.setName("merge"); //$NON-NLS-1$
- state.putString("startTag", start.getName()); //$NON-NLS-1$
- state.putInteger("startTagType", start.getType()); //$NON-NLS-1$
- state.putString("endTag", end.getName()); //$NON-NLS-1$
- state.putInteger("endTagType", end.getType()); //$NON-NLS-1$
-
- // resources roots
- SaveContext[] ctxRoots = new SaveContext[roots.size()];
- int i = 0;
- for (Iterator it = roots.iterator(); it.hasNext(); i++) {
- IResource element = (IResource) it.next();
- ctxRoots[i] = new SaveContext();
- ctxRoots[i].setName("resource"); //$NON-NLS-1$
- ctxRoots[i].putString("fullpath", element.getFullPath().toString()); //$NON-NLS-1$
- }
- state.setChildren(ctxRoots);
- return state;
- }
-
- public static CVSMergeSubscriber restore(QualifiedName id, SaveContext saveContext) throws CVSException {
- String name = saveContext.getName();
- if(! name.equals("merge")) { //$NON-NLS-1$
- throw new CVSException(Policy.bind("CVSMergeSubscriber.13", name)); //$NON-NLS-1$
- }
-
- CVSTag start = new CVSTag(saveContext.getString("startTag"), saveContext.getInteger("startTagType")); //$NON-NLS-1$ //$NON-NLS-2$
- CVSTag end = new CVSTag(saveContext.getString("endTag"), saveContext.getInteger("endTagType")); //$NON-NLS-1$ //$NON-NLS-2$
-
- SaveContext[] ctxRoots = saveContext.getChildren();
- if(ctxRoots == null || ctxRoots.length == 0) {
- throw new CVSException(Policy.bind("CVSMergeSubscriber.19", id.toString())); //$NON-NLS-1$
- }
-
- List resources = new ArrayList();
- for (int i = 0; i < ctxRoots.length; i++) {
- SaveContext context = ctxRoots[i];
- IPath path = new Path(context.getString("fullpath")); //$NON-NLS-1$
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
- if(resource != null) {
- resources.add(resource);
- } else {
- // log that a resource previously in the merge set is no longer in the workspace
- CVSProviderPlugin.log(CVSStatus.INFO, Policy.bind("CVSMergeSubscriber.21", path.toString()), null); //$NON-NLS-1$
- }
- }
- if(resources.isEmpty()) {
- throw new CVSException(Policy.bind("CVSMergeSubscriber.22", id.toString())); //$NON-NLS-1$
- }
- IResource[] roots = (IResource[]) resources.toArray(new IResource[resources.size()]);
- return new CVSMergeSubscriber(id, roots, start, end);
- }
-
+
public CVSTag getStartTag() {
return start;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index 8e66c0c7c..3f7757863 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -38,7 +38,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.core.sync.RemoteContentsCache;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
@@ -80,7 +79,7 @@ public class CVSProviderPlugin extends Plugin {
// cvs plugin extension points and ids
public static final String ID = "org.eclipse.team.cvs.core"; //$NON-NLS-1$
- public static final QualifiedName CVS_WORKSPACE_SUBSCRIBER_ID = new QualifiedName(CVSSubscriberFactory.ID, "workspace-subscriber"); //$NON-NLS-1$
+ public static final QualifiedName CVS_WORKSPACE_SUBSCRIBER_ID = new QualifiedName("org.eclipse.team.cvs.ui.cvsworkspace-participant", "syncparticipant"); //$NON-NLS-1$
public static final String PT_AUTHENTICATOR = "authenticator"; //$NON-NLS-1$
public static final String PT_CONNECTIONMETHODS = "connectionmethods"; //$NON-NLS-1$
public static final String PT_FILE_MODIFICATION_VALIDATOR = "filemodificationvalidator"; //$NON-NLS-1$
@@ -136,7 +135,6 @@ public class CVSProviderPlugin extends Plugin {
CVS_WORKSPACE_SUBSCRIBER_ID,
Policy.bind("CVSProviderPlugin.20"), //$NON-NLS-1$
Policy.bind("CVSProviderPlugin.21")); //$NON-NLS-1$
- TeamSubscriber.getSubscriberManager().registerSubscriber(cvsWorkspaceSubscriber);
}
return cvsWorkspaceSubscriber;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSubscriberFactory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSubscriberFactory.java
deleted file mode 100644
index 36e66bd73..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSubscriberFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.core;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.core.subscribers.TeamSubscriberFactory;
-import org.eclipse.team.internal.core.SaveContext;
-
-/**
- * CVSSubscriberFactory
- */
-public class CVSSubscriberFactory extends TeamSubscriberFactory {
-
- final static public String ID = "org.eclipse.team.cvs.subscribers"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncTreeSubscriberFactory#getID()
- */
- public String getID() {
- return ID;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncTreeSubscriberFactory#createSubscriber(org.eclipse.core.runtime.QualifiedName, org.eclipse.team.internal.core.SaveContext)
- */
- public TeamSubscriber restoreSubscriber(QualifiedName id, SaveContext saveContext) throws TeamException {
- if(isMergeSubscriber(id)) {
- return CVSMergeSubscriber.restore(id, saveContext);
- }
- // CVS workspace subscribers are automatically recreated when the platform restarts.
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncTreeSubscriberFactory#saveSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
- */
- public SaveContext saveSubscriber(TeamSubscriber subscriber) throws TeamException {
- if(isMergeSubscriber(subscriber.getId())) {
- return ((CVSMergeSubscriber)subscriber).saveState();
- } else {
- return null;
- }
- }
-
- private boolean isMergeSubscriber(QualifiedName id) {
- String localName = id.getLocalName();
- if(localName.startsWith(CVSMergeSubscriber.UNIQUE_ID_PREFIX)) {
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index aa23fa7fb..b7c529907 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -321,7 +321,7 @@ CVSMergeSubscriber.22=Error restoring merge subscriber {0}: There are no existin
CVSProviderPlugin.20=CVS Workspace
CVSProviderPlugin.21=Synchronizes the CVS managed resources in your workspace with their associated remote location
CVSSyncTreeSubscriber.0={0} is not a valid comparison criteria for subscriber {1}
-CVSRevisionNumberCompareCriteria.1=Revision number comparison
+CVSRevisionNumberCompareCriteria.1=Comparing revision numbers
RemoteTagSynchronizer.0=Refreshing {0}
ReentrantLock.9=An error occurred writting CVS synchronization information to disk. Some information may be lost.
CRLFDetectInputStream.0=CVS file {0} either contains invalid line endings on the server (CR/LF instead of just LF) or is a binary file that is not marked as -kb.
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index defc08385..a50c0b388 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -23,6 +23,25 @@
<import plugin="org.eclipse.compare"/>
</requires>
+<!-- *************** Synchronize View Participant **************** -->
+<extension
+ point="org.eclipse.team.ui.synchronizeParticipants">
+ <participant
+ name="CVS Workspace"
+ icon="icons/full/cview16/rep_editors_view.gif"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant"
+ type="static"
+ id="org.eclipse.team.cvs.ui.cvsworkspace-participant">
+ </participant>
+ <participant
+ name="CVS Merge"
+ icon="icons/full/obj16/prjversions_rep.gif"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant"
+ type="dynamic"
+ id="org.eclipse.team.cvs.ui.cvsmerge-participant">
+ </participant>
+</extension>
+
<!-- *************** Authenticator **************** -->
<extension
point="org.eclipse.team.cvs.core.authenticator">
@@ -264,7 +283,7 @@
tooltip="%GenerateDiff.tooltip"
class="org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction"
menubarPath="team.main/group1"
- helpContextId="org.eclipse.team.cvs.ui.team_create_patch_action_context"
+ helpContextId="org.eclipse.team.cvs.ui.team_create__action_context"
id="org.eclipse.team.ccvs.ui.GenerateDiff">
</action>
<action
@@ -556,20 +575,32 @@
</action>
</objectContribution>
</extension>
-
-
-
+
<!-- ************* Subscriber Menus ************ -->
<extension
point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.team.ui.sync.ISynchronizeViewNode"
+ <viewerContribution
id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriberContributions"
- adaptable="true">
-
- <filter name="equals" value="org.eclipse.team.cvs.subscribers:workspace-subscriber" />
-
+ targetID="org.eclipse.team.cvs.ui.cvsworkspace-participant">
+ <action
+ label="%CVSWorkspaceSubscriber.commit.label"
+ menubarPath="SubscriberActionsGroup1"
+ tooltip="%CVSWorkspaceSubscriber.commit.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction"
+ overrideActionId="org.eclipse.team.ccvs.ui.commit"
+ helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_commit_action"
+ id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.commit">
+ </action>
+ <action
+ label="%CVSWorkspaceSubscriber.update.label"
+ menubarPath="SubscriberActionsGroup1"
+ tooltip="%CVSWorkspaceSubscriber.update.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceUpdateAction"
+ overrideActionId="org.eclipse.team.ccvs.ui.update"
+ helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_update_action"
+ id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.update">
+ </action>
<action
label="%CVSWorkspaceSubscriber.confirmMerged.label"
menubarPath="SubscriberActionsGroup2"
@@ -578,7 +609,6 @@
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_confirm_merged_action"
id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.confirmMerged">
</action>
-
<action
label="%CVSWorkspaceSubscriber.overcommit.label"
menubarPath="SubscriberActionsGroup2"
@@ -586,8 +616,7 @@
class="org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction"
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_overcommit_action"
id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.overcommit">
- </action>
-
+ </action>
<action
label="%CVSWorkspaceSubscriber.overupdate.label"
menubarPath="SubscriberActionsGroup2"
@@ -596,36 +625,52 @@
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_overupdate_action"
id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.overupdate">
</action>
-
- <action
- label="%CVSWorkspaceSubscriber.commit.label"
- menubarPath="SubscriberActionsGroup1"
- tooltip="%CVSWorkspaceSubscriber.commit.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction"
- overrideActionId="org.eclipse.team.ccvs.ui.commit"
- helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_commit_action"
- id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.commit">
- </action>
-
- <action
- label="%CVSWorkspaceSubscriber.update.label"
- menubarPath="SubscriberActionsGroup1"
- tooltip="%CVSWorkspaceSubscriber.update.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceUpdateAction"
- overrideActionId="org.eclipse.team.ccvs.ui.update"
- helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_update_action"
- id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.update">
- </action>
- </objectContribution>
+ <action
+ label="%ShowHistoryAction.label"
+ tooltip="%ShowHistoryAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction"
+ menubarPath="SubscriberActionsGroup3"
+ helpContextId="org.eclipse.team.cvs.ui.show_in_history_action_context"
+ id="org.eclipse.team.ccvs.ui.showHistory">
+ </action>
+ <action
+ label="%ShowAnnotationAction.label"
+ tooltip="%ShowAnnotationAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
+ menubarPath="SubscriberActionsGroup3"
+ helpContextId="org.eclipse.team.cvs.ui.get_annotate_action_context"
+ id="org.eclipse.team.ccvs.ui.showAnnotation">
+ </action>
+ <action
+ label="%BranchAction.label"
+ tooltip="%BranchAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
+ menubarPath="SubscriberActionsGroup3"
+ helpContextId="org.eclipse.team.cvs.ui.team_branch_action_context"
+ id="org.eclipse.team.ccvs.ui.branch">
+ </action>
+ <action
+ label="%GenerateDiff.label"
+ tooltip="%GenerateDiff.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction"
+ menubarPath="SubscriberActionsGroup3"
+ helpContextId="org.eclipse.team.cvs.ui.team_create_patch_action_context"
+ id="org.eclipse.team.ccvs.ui.GenerateDiff">
+ </action>
+ <action
+ label="%IgnoreAction.label"
+ tooltip="%IgnoreAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction"
+ menubarPath="SubscriberActionsGroup3"
+ helpContextId="org.eclipse.team.cvs.ui.team_ignore_action_context"
+ id="org.eclipse.team.ccvs.ui.ignore">
+ </action>
+ </viewerContribution>
- <objectContribution
- objectClass="org.eclipse.team.ui.sync.ISynchronizeViewNode"
- id="org.eclipse.team.ccvs.ui.CVSMergeSubscriberContributions"
- adaptable="true">
-
- <filter name="startsWith" value="org.eclipse.team.cvs.subscribers:merge-" />
-
- <action
+ <viewerContribution
+ id="org.eclipse.team.ccvs.ui.CVSMergeSubscriberContributions"
+ targetID="org.eclipse.team.cvs.ui.cvsmerge-participant">
+ <action
label="%CVSWorkspaceSubscriber.confirmMerged.label"
menubarPath="SubscriberActionsGroup1"
tooltip="%CVSWorkspaceSubscriber.confirmMerged.tooltip"
@@ -633,7 +678,6 @@
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_confirm_merged_action"
id="org.eclipse.team.ccvs.ui.CVSMergeSubscriber.confirmMerged">
</action>
-
<action
label="%CVSWorkspaceSubscriber.merge.label"
menubarPath="SubscriberActionsGroup1"
@@ -643,7 +687,7 @@
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_merge_action"
id="org.eclipse.team.ccvs.ui.CVSMergeSubscriber.merge">
</action>
- </objectContribution>
+ </viewerContribution>
</extension>
<!-- ************** Views ********************** -->
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
index 0a9420af5..ef27dbefb 100644
--- 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
@@ -22,6 +22,7 @@ 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.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
@@ -69,7 +70,6 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
private Text addedFlag;
private Button showDirty;
- private Button showSyncInfoInLabel;
class StringPair {
String s1;
@@ -178,11 +178,6 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
tabItem.setText(Policy.bind("CVSDecoratorPreferencesPage.generalTabFolder"));//$NON-NLS-1$
tabItem.setControl(createGeneralDecoratorPage(tabFolder));
- // synchronize decoration options
- tabItem = new TabItem(tabFolder, SWT.NONE);
- tabItem.setText(Policy.bind("CVSDecoratorPreferencesPage.synchronizeTabFolder"));//$NON-NLS-1$
- tabItem.setControl(createSynchronizeDecoratorPage(tabFolder));
-
initializeValues();
WorkbenchHelp.setHelp(tabFolder, IHelpContextIds.DECORATORS_PREFERENCE_PAGE);
Dialog.applyDialogFont(parent);
@@ -261,18 +256,6 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
return composite;
}
- private Control createSynchronizeDecoratorPage(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- createLabel(composite, Policy.bind("CVSDecoratorPreferencesPage.synchronizeDescription"), 1); //$NON-NLS-1$
- showSyncInfoInLabel = createCheckBox(composite, Policy.bind("CVSDecoratorPreferencesPage.showSyncInfoInLabel")); //$NON-NLS-1$
- return composite;
- }
-
private Label createLabel(Composite parent, String text, int span) {
Label label = new Label(parent, SWT.LEFT);
label.setText(text);
@@ -323,9 +306,6 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
imageShowNewResource.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
showDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
-
- showSyncInfoInLabel.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_SYNCINFO_AS_TEXT));
-
setValid(true);
}
@@ -356,10 +336,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
store.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, showDirty.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_SYNCINFO_AS_TEXT, showSyncInfoInLabel.getSelection());
-
- CVSLightweightDecorator.refresh();
-
+ CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
CVSUIPlugin.getPlugin().savePluginPreferences();
return true;
}
@@ -384,8 +361,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
imageShowHasRemote.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
imageShowNewResource.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
- showDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- showSyncInfoInLabel.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_SYNCINFO_AS_TEXT));
+ showDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
}
/**
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
index a600a5b41..27d1bcd6c 100644
--- 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
@@ -28,6 +28,8 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.jface.viewers.LabelProvider;
@@ -52,10 +54,11 @@ import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
import org.eclipse.team.internal.core.ExceptionCollector;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.team.ui.TeamUI;
public class CVSLightweightDecorator
extends LabelProvider
- implements ILightweightLabelDecorator, IResourceStateChangeListener {
+ implements ILightweightLabelDecorator, IResourceStateChangeListener, IPropertyChangeListener {
// Images cached for better performance
private static ImageDescriptor dirty;
@@ -85,6 +88,30 @@ public class CVSLightweightDecorator
}
}
+ public static class Decoration implements IDecoration {
+ public String prefix, suffix;
+ public ImageDescriptor overlay;
+
+ /**
+ * @see org.eclipse.jface.viewers.IDecoration#addPrefix(java.lang.String)
+ */
+ public void addPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+ /**
+ * @see org.eclipse.jface.viewers.IDecoration#addSuffix(java.lang.String)
+ */
+ public void addSuffix(String suffix) {
+ this.suffix = suffix;
+ }
+ /**
+ * @see org.eclipse.jface.viewers.IDecoration#addOverlay(org.eclipse.jface.resource.ImageDescriptor)
+ */
+ public void addOverlay(ImageDescriptor overlay) {
+ this.overlay = overlay;
+ }
+ }
+
static {
dirty = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DIRTY_OVR));
checkedIn = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR));
@@ -97,6 +124,8 @@ public class CVSLightweightDecorator
public CVSLightweightDecorator() {
ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
+ TeamUI.addPropertyChangeListener(this);
+ CVSUIPlugin.addPropertyChangeListener(this);
CVSProviderPlugin.broadcastDecoratorEnablementChanged(true /* enabled */);
exceptions = new ExceptionCollector(Policy.bind("CVSDecorator.exceptionMessage"), CVSUIPlugin.ID, IStatus.ERROR, CVSUIPlugin.getPlugin().getLog()); //$NON-NLS-1$
}
@@ -532,6 +561,8 @@ public class CVSLightweightDecorator
public void dispose() {
super.dispose();
CVSProviderPlugin.broadcastDecoratorEnablementChanged(false /* disabled */);
+ TeamUI.removePropertyChangeListener(this);
+ CVSUIPlugin.removePropertyChangeListener(this);
}
/**
@@ -540,4 +571,16 @@ public class CVSLightweightDecorator
private static void handleException(Exception e) {
exceptions.handleException(e);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ String prop = event.getProperty();
+ if(prop.equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
+ refresh();
+ } else if(prop.equals(CVSUIPlugin.P_DECORATORS_CHANGED)) {
+ refresh();
+ }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
index 5ff0f6320..00b563546 100644
--- 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
@@ -22,6 +22,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -374,7 +375,9 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref
// changing the default keyword substitution mode for text files may affect
// information displayed in the decorators
- if (! oldKSubst.equals(newKSubst)) CVSLightweightDecorator.refresh();
+ if (! oldKSubst.equals(newKSubst)) {
+ CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
+ }
CVSUIPlugin.getPlugin().savePluginPreferences();
return true;
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
index 5d6417a08..0ff2d8168 100644
--- 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
@@ -21,6 +21,7 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -387,8 +388,9 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
}
});
newLocation = null;
- if (changeReadOnly[0])
- CVSLightweightDecorator.refresh();
+ if (changeReadOnly[0]) {
+ CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
+ }
} catch (InvocationTargetException e) {
handle(e);
} catch (InterruptedException e) {
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
index 3d991d751..d5966def2 100644
--- 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
@@ -14,7 +14,10 @@ package org.eclipse.team.internal.ccvs.ui;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceStatus;
@@ -46,14 +49,17 @@ import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
+import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+
/**
* UI Plugin for CVS provider-specific workbench functionality.
*/
@@ -64,12 +70,14 @@ public class CVSUIPlugin extends AbstractUIPlugin {
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);
-
- // timeout in milliseconds before displaying a progress monitor dialog
- // (used for normally short-running interactive operations)
- private static final int TIMEOUT = 2000;
-
+ private static List propertyChangeListeners = new ArrayList(5);
+
/**
* The singleton plug-in instance
*/
@@ -84,15 +92,6 @@ public class CVSUIPlugin extends AbstractUIPlugin {
public static final String EDIT = "edit"; //$NON-NLS-1$
public static final String HIGHJACK = "highjack"; //$NON-NLS-1$
- // Property change listener
- IPropertyChangeListener listener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
- CVSLightweightDecorator.refresh();
- }
- }
- };
-
/**
* CVSUIPlugin constructor
*
@@ -102,7 +101,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
super(descriptor);
plugin = this;
}
-
+
/**
* Creates an image and places it in the image registry.
*/
@@ -129,6 +128,30 @@ public class CVSUIPlugin extends AbstractUIPlugin {
}
/**
+ * Register for changes made to Team properties.
+ */
+ public static void addPropertyChangeListener(IPropertyChangeListener listener) {
+ propertyChangeListeners.add(listener);
+ }
+
+ /**
+ * Deregister as a Team property changes.
+ */
+ public static void removePropertyChangeListener(IPropertyChangeListener listener) {
+ propertyChangeListeners.remove(listener);
+ }
+
+ /**
+ * Broadcast a Team property change.
+ */
+ public static void broadcastPropertyChange(PropertyChangeEvent event) {
+ for (Iterator it = propertyChangeListeners.iterator(); it.hasNext();) {
+ IPropertyChangeListener listener = (IPropertyChangeListener)it.next();
+ listener.propertyChange(event);
+ }
+ }
+
+ /**
* Extract or convert to a TeamException
*/
public static TeamException asTeamException(InvocationTargetException e) {
@@ -149,8 +172,8 @@ public class CVSUIPlugin extends AbstractUIPlugin {
* supplied operation will be run again.
*/
public static void runWithRefresh(Shell parent, IResource[] resources,
- IRunnableWithProgress runnable, IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
+ IRunnableWithProgress runnable, IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
boolean firstTime = true;
while(true) {
try {
@@ -223,7 +246,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
* @exception InterruptedException when the progress monitor is cancelled
*/
public static void runWithProgress(Shell parent, boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
Utils.runWithProgress(parent, cancelable, runnable);
}
@@ -240,7 +263,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
* @exception InterruptedException when the progress monitor is cancelled
*/
public static void runWithProgress(final Shell parent, final boolean cancelable,
- final IRunnableWithProgress runnable, int flags) throws InvocationTargetException, InterruptedException {
+ final IRunnableWithProgress runnable, int flags) throws InvocationTargetException, InterruptedException {
if ((flags & PERFORM_SYNC_EXEC) > 0) {
@@ -269,7 +292,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
display = parent.getDisplay();
}
display.syncExec(outerRunnable);
-
+
// handle any exception
if (exception[0] != null) {
Exception e = exception[0];
@@ -313,7 +336,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
}
return plugin;
}
-
+
/**
* Returns the repository manager
*
@@ -336,7 +359,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
*/
private void initializeImages() {
URL baseURL = getDescriptor().getInstallURL();
-
+
// objects
createImageDescriptor(ICVSUIConstants.IMG_REPOSITORY, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_REFRESH, baseURL);
@@ -347,6 +370,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION, baseURL);
+ createImageDescriptor(ICVSUIConstants.IMG_CVSLOGO, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_TAG, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_MODULE, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_CLEAR, baseURL);
@@ -385,7 +409,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
public static void log(IStatus status) {
getPlugin().getLog().log(status);
}
-
+
public static void log(CoreException e) {
log(e.getStatus().getSeverity(), Policy.bind("simpleInternal"), e); //$NON-NLS-1$
}
@@ -396,7 +420,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
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;
@@ -515,7 +539,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
flags = flags | PERFORM_SYNC_EXEC;
}
}
-
+
// Create a runnable that will display the error status
final Shell shell = providedShell;
Runnable outerRunnable = new Runnable() {
@@ -533,7 +557,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
}
}
};
-
+
// Execute the above runnable as determined by the parameters
if (shell == null || (flags & PERFORM_SYNC_EXEC) > 0) {
Display display;
@@ -550,8 +574,8 @@ public class CVSUIPlugin extends AbstractUIPlugin {
outerRunnable.run();
}
}
-
-
+
+
/**
* Initializes the preferences for this plugin if necessary.
*/
@@ -598,8 +622,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
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_SHOW_SYNCINFO_AS_TEXT, false);
+ store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);
@@ -625,14 +648,14 @@ public class CVSUIPlugin extends AbstractUIPlugin {
CVSProviderPlugin.getPlugin().setConfirmMoveTagEnabled(store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG));
CVSProviderPlugin.getPlugin().setDebugProtocol(CVSProviderPlugin.getPlugin().isDebugProtocol() || store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
}
-
+
/**
* @see Plugin#startup()
*/
public void startup() throws CoreException {
super.startup();
Policy.localize("org.eclipse.team.internal.ccvs.ui.messages"); //$NON-NLS-1$
-
+
CVSAdapterFactory factory = new CVSAdapterFactory();
Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFile.class);
Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFolder.class);
@@ -642,12 +665,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
initializeImages();
initializePreferences();
- // if the global ignores list is changed then update decorators.
- TeamUI.addPropertyChangeListener(listener);
-
Console.startup();
- // Commented out until we have fully ported the CVS console to the new API
- //ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {new CVSOutputConsole()});
}
public static IWorkingSet getWorkingSet(IResource[] resources, String name) {
@@ -666,15 +684,25 @@ public class CVSUIPlugin extends AbstractUIPlugin {
*/
public void shutdown() throws CoreException {
super.shutdown();
- TeamUI.removePropertyChangeListener(listener);
try {
if (repositoryManager != null)
repositoryManager.shutdown();
} catch (TeamException e) {
throw new CoreException(e.getStatus());
}
-
+
Console.shutdown();
}
-}
+ /**
+ * @return Returns the cvsWorkspaceSynchronizeViewPage.
+ */
+ public WorkspaceSynchronizeParticipant getCvsWorkspaceSynchronizeParticipant() {
+ ISynchronizeParticipant[] instances = TeamUI.getSynchronizeManager().find(WorkspaceSynchronizeParticipant.ID);
+ if(instances.length == 1) {
+ return (WorkspaceSynchronizeParticipant)instances[0];
+ } else {
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
index 52d68217c..1718bb376 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
@@ -86,7 +86,7 @@ import org.eclipse.team.internal.ccvs.ui.actions.MoveRemoteTagAction;
import org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction;
import org.eclipse.team.internal.ui.jobs.JobBusyCursor;
import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
-import org.eclipse.team.internal.ui.sync.compare.SyncInfoCompareInput;
+import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoCompareInput;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IEditorInput;
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
index dea0cd3db..f6c4d5a58 100644
--- 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
@@ -53,6 +53,7 @@ public interface ICVSUIConstants {
// wizards
public final String IMG_NEWLOCATION = "wizards/newlocation_wiz.gif"; //$NON-NLS-1$
+ public final String IMG_CVSLOGO = "wizards/newconnect_wiz.gif"; //$NON-NLS-1$
// preferences
public final String PREF_SHOW_COMMENTS = "pref_show_comments"; //$NON-NLS-1$
@@ -97,8 +98,6 @@ public interface ICVSUIConstants {
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_SHOW_SYNCINFO_AS_TEXT = "pref_show_syncinfo_as_text"; //$NON-NLS-1$
// watch/edit preferences
public final String PREF_CHECKOUT_READ_ONLY = "pref_checkout_read_only"; //$NON-NLS-1$
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
index 711f518ae..a3cee4bad 100644
--- 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
@@ -122,4 +122,8 @@ public class Policy {
return monitor;
return new InfiniteSubProgressMonitor(monitor, ticks);
}
+
+ public static ResourceBundle getBundle() {
+ return bundle;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index 6ba03eeee..4a7e054ce 100644
--- 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
@@ -48,7 +48,7 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.team.ui.sync.ISynchronizeViewNode;
+import org.eclipse.team.internal.ui.synchronize.views.SynchronizeViewNode;
import org.eclipse.ui.PlatformUI;
/**
@@ -299,10 +299,6 @@ abstract public class CVSAction extends TeamAction {
Iterator elements = ((IStructuredSelection) selection).iterator();
while (elements.hasNext()) {
Object next = elements.next();
- if(next instanceof ISynchronizeViewNode) {
- resources.add(((ISynchronizeViewNode)next).getSyncInfo().getRemote());
- continue;
- }
if (next instanceof ICVSResource) {
resources.add(next);
continue;
@@ -481,4 +477,24 @@ abstract public class CVSAction extends TeamAction {
return CVSUIPlugin.getPlugin().getRepositoryManager();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources()
+ */
+ protected IResource[] getSelectedResources() {
+ if(selection.isEmpty()) return new IResource[0];
+ Iterator it = selection.iterator();
+ List resources = new ArrayList();
+ while(it.hasNext()) {
+ Object element = it.next();
+ if(element instanceof SynchronizeViewNode) {
+ resources.add(((SynchronizeViewNode)element).getResource());
+ } else {
+ Object adapter = getAdapter(element, IResource.class);
+ if (adapter instanceof IResource) {
+ resources.add(adapter);
+}
+ }
+ }
+ return (IResource[]) resources.toArray(new IResource[resources.size()]);
+ }
}
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
index a456be8b7..230a3638e 100644
--- 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
@@ -42,12 +42,11 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
-public class ShowAnnotationAction extends CVSAction {
-
-/**
- * Action to open a CVS Annotate View
- */
+public class ShowAnnotationAction extends WorkspaceAction {
+ /**
+ * Action to open a CVS Annotate View
+ */
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
// Get the selected resource.
final ICVSResource cvsResource = getSingleSelectedCVSResource();
@@ -58,43 +57,43 @@ public class ShowAnnotationAction extends CVSAction {
final AnnotateListener listener = new AnnotateListener();
if (cvsResource == null) {
- return;
+ return;
}
// Get the selected revision
final String revision;
try {
ResourceSyncInfo info = cvsResource.getSyncInfo();
- if(info == null) {
- handle(new CVSException(Policy.bind("ShowAnnotationAction.noSyncInfo", cvsResource.getName())));
+ if (info == null) {
+ handle(new CVSException(Policy.bind("ShowAnnotationAction.noSyncInfo", cvsResource.getName()))); //$NON-NLS-1$
return;
}
revision = cvsResource.getSyncInfo().getRevision();
} catch (CVSException e) {
throw new InvocationTargetException(e);
}
-
+
// Run the CVS Annotate action with a progress monitor
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
fetchAnnotation(listener, cvsResource, revision, monitor);
- }
+ }
}, true, PROGRESS_DIALOG);
-
if (listener.hasError()) {
throw new InvocationTargetException(new CVSException(Policy.bind("ShowAnnotationAction.1", listener.getError()))); //$NON-NLS-1$
}
-
+
// Open the view
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
try {
PlatformUI.getWorkbench().showPerspective("org.eclipse.team.cvs.ui.cvsPerspective", window); //$NON-NLS-1$
} catch (WorkbenchException e1) {
- // If this does not work we will just open the view in the curren perspective.
+ // If this does not work we will just open the view in the
+ // curren perspective.
}
}
-
+
try {
AnnotateView view = AnnotateView.openInActivePerspective();
view.showAnnotations(cvsResource, listener.getCvsAnnotateBlocks(), listener.getContents());
@@ -105,6 +104,7 @@ public class ShowAnnotationAction extends CVSAction {
/**
* Send the CVS annotate command
+ *
* @param listener
* @param cvsResource
* @param revision
@@ -112,14 +112,17 @@ public class ShowAnnotationAction extends CVSAction {
* @throws InvocationTargetException
*/
private void fetchAnnotation(final AnnotateListener listener, final ICVSResource cvsResource, final String revision, IProgressMonitor monitor) throws InvocationTargetException {
-
+
try {
monitor = Policy.monitorFor(monitor);
monitor.beginTask(null, 100);
ICVSFolder folder = cvsResource.getParent();
final FolderSyncInfo info = folder.getFolderSyncInfo();
ICVSRepositoryLocation location = CVSProviderPlugin.getPlugin().getRepository(info.getRoot());
- Session session = new Session(location, folder, true /* output to console */);
+ Session session = new Session(location, folder, true /*
+ * output to
+ * console
+ */);
session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
try {
Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
@@ -127,16 +130,12 @@ public class ShowAnnotationAction extends CVSAction {
CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
final Command.LocalOption[] localOption;
if (revision == null) {
- localOption = Command.NO_LOCAL_OPTIONS;
+ localOption = Command.NO_LOCAL_OPTIONS;
} else {
- localOption = new Command.LocalOption[1];
+ localOption = new Command.LocalOption[1];
localOption[0] = Annotate.makeRevisionOption(revision);
}
- IStatus status = Command.ANNOTATE.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- localOption, new ICVSResource[] { cvsResource }, listener,
- Policy.subMonitorFor(monitor, 90));
+ IStatus status = Command.ANNOTATE.execute(session, Command.NO_GLOBAL_OPTIONS, localOption, new ICVSResource[]{cvsResource}, listener, Policy.subMonitorFor(monitor, 90));
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}
@@ -156,13 +155,14 @@ public class ShowAnnotationAction extends CVSAction {
* Ony enabled for single resource selection
*/
protected boolean isEnabled() throws TeamException {
- return (selection.size() == 1);
+ ICVSResource resource = getSingleSelectedCVSResource();
+ return (resource != null && ! resource.isFolder());
}
/**
- * 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
+ * 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
*/
@@ -172,22 +172,22 @@ public class ShowAnnotationAction extends CVSAction {
if (cvsResources.length == 1) {
return cvsResources[0];
}
-
+
// Selected from a History Viewer
- Object[] logEntries = getSelectedResources(LogEntry.class);
+ Object[] logEntries = getSelectedResources(LogEntry.class);
if (logEntries.length == 1) {
LogEntry aLogEntry = (LogEntry) logEntries[0];
ICVSRemoteFile cvsRemoteFile = aLogEntry.getRemoteFile();
return cvsRemoteFile;
}
-
+
// Selected from a Resource Navigator
- IResource[] resources = getSelectedResources();
- if (resources.length == 1) {
- IContainer parent = resources[0].getParent();
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
- return CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
- }
+ IResource[] resources = getSelectedResources();
+ if (resources.length == 1) {
+ IContainer parent = resources[0].getParent();
+ ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
+ return CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
+ }
return null;
}
-}
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index 47ca97b68..4d33d08b8 100644
--- 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
@@ -15,17 +15,16 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSWorkspaceSubscriber;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
import org.eclipse.team.internal.ui.sync.SyncCompareInput;
import org.eclipse.team.internal.ui.sync.SyncView;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.ui.IWorkingSet;
/**
@@ -39,12 +38,12 @@ public class SyncAction extends WorkspaceAction {
if (resources == null || resources.length == 0) return;
IWorkingSet workingSet = CVSUIPlugin.getWorkingSet(resources, Policy.bind("SyncAction.workingSetName")); //$NON-NLS-1$
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(null);
+ ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(null);
if(view != null) {
- CVSWorkspaceSubscriber cvsWorkspaceSubscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- view.setWorkingSet(workingSet);
- view.selectSubscriber(cvsWorkspaceSubscriber);
- view.refreshWithRemote(cvsWorkspaceSubscriber, resources);
+ WorkspaceSynchronizeParticipant cvsPage = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
+ view.display(cvsPage);
+ cvsPage.setWorkingSet(workingSet);
+ cvsPage.refreshWithRemote(resources);
} else {
CVSUIPlugin.openError(getShell(), Policy.bind("error"), Policy.bind("Error.unableToShowSyncView"), null); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
index 582ae672e..44f6b4e9f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
@@ -15,14 +15,16 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -63,13 +65,14 @@ public class MergeWizard extends Wizard {
CVSTag endTag = endPage.getTag();
CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
- TeamSubscriber.getSubscriberManager().registerSubscriber(s);
+ MergeSynchronizeParticipant participant = new MergeSynchronizeParticipant(s);
+ ISynchronizeManager manager = TeamUI.getSynchronizeManager();
+ manager.addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(null);
+ ISynchronizeView view = manager.showSynchronizeViewInActivePage(null);
if(view != null) {
- view.setWorkingSet(null); /* show all resources in the merge */
- view.selectSubscriber(s);
- view.refreshWithRemote(s, resources);
+ view.display(participant);
+ participant.refreshWithRemote(s.roots());
} else {
CVSUIPlugin.openError(getShell(), Policy.bind("error"), Policy.bind("Error.unableToShowSyncView"), null); //$NON-NLS-1$ //$NON-NLS-2$
return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
index f2534ba10..f0d4c430d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
@@ -116,6 +116,7 @@ public class MergeWizardStartPage extends CVSWizardPage {
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
table.refresh();
+ setPageComplete(! table.getSelection().isEmpty());
}
});
}
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
index cde9e01f0..71a36267d 100644
--- 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
@@ -1031,3 +1031,18 @@ RemoteRevisionQuickDiffProvider.readingFile=Error reading remote file
RemoteRevisionQuickDiffProvider.closingFile=Error closing remote file
RemoteRevisionQuickDiffProvider.fetchingFile=CVS QuickDiff: fetching remote contents for ''{0}''
RemoteCompareOperation.0=Comparing tags {0} and {1} of {2}
+action.SynchronizeViewCommit.label=Commit
+action.SynchronizeViewCommit.tooltip=Commit All Outgoing Changes
+action.SynchronizeViewCommit.description=Commit All Outgoing Changes
+action.SynchronizeViewCommit.image=checkin_action.gif
+
+action.SynchronizeViewUpdate.label=Update
+action.SynchronizeViewUpdate.tooltip=Update All Incoming Changes
+action.SynchronizeViewUpdate.description=Update All Incoming Changes
+action.SynchronizeViewUpdate.image=checkout_action.gif
+
+MergeSynchronizeParticipant.8=Missing id initializing cvs merge participant
+MergeSynchronizeParticipant.9=Unable to initialize cvs merge subscriber
+MergeSynchronizeParticipant.10=Missing root nodes in cvs merge subscriber memento: {0}
+MergeSynchronizeParticipant.11=Root resource in cvs merge subscriber is no longer in workspace, ignoring: {0}
+MergeSynchronizeParticipant.12=Missing root resources for cvs merge subscriber: {0}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSSubscriberNonblockingContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSSubscriberNonblockingContext.java
index f0cd4b5bb..c880bcd84 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSSubscriberNonblockingContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSSubscriberNonblockingContext.java
@@ -12,7 +12,7 @@ package org.eclipse.team.internal.ccvs.ui.operations;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
-import org.eclipse.team.ui.sync.SubscriberAction;
+import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
/**
* This context uses the JobStatusHandler from SubscriberAction to ensure
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java
index 7da493bf5..f462e40c8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java
@@ -26,7 +26,6 @@ import org.eclipse.core.runtime.jobs.MultiRule;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -42,8 +41,9 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.CVSBlockingRunnableContext;
import org.eclipse.team.internal.ccvs.ui.operations.CVSSubscriberNonblockingContext;
import org.eclipse.team.internal.ccvs.ui.operations.ICVSRunnableContext;
-import org.eclipse.team.ui.sync.SubscriberAction;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
public abstract class CVSSubscriberAction extends SubscriberAction {
@@ -265,10 +265,9 @@ public abstract class CVSSubscriberAction extends SubscriberAction {
*/
protected boolean promptForOverwrite(final SyncInfoSet syncSet) {
final int[] result = new int[] {Dialog.CANCEL};
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
+ TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
public void run() {
- UpdateDialog dialog = new UpdateDialog(shell, syncSet);
+ UpdateDialog dialog = new UpdateDialog(getShell(), syncSet);
result[0] = dialog.open();
}
});
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
new file mode 100644
index 000000000..e2ace743a
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import java.util.*;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ui.synchronize.sets.*;
+import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.IActionDelegate;
+
+public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implements ISyncSetChangedListener {
+
+ private List delegates = new ArrayList(2);
+
+ protected class CVSActionDelegate extends Action {
+ private IActionDelegate delegate;
+
+ public CVSActionDelegate(IActionDelegate delegate) {
+ this.delegate = delegate;
+ addDelegate(this);
+ }
+
+ public void run() {
+ IStructuredContentProvider cp = (IStructuredContentProvider) getViewer().getContentProvider();
+ StructuredSelection selection = new StructuredSelection(cp.getElements(getInput()));
+ if (!selection.isEmpty()) {
+ delegate.selectionChanged(this, selection);
+ delegate.run(this);
+ }
+ }
+
+ public IActionDelegate getDelegate() {
+ return delegate;
+ }
+ }
+
+ public CVSSynchronizeViewPage(TeamSubscriberParticipant page, ISynchronizeView view, SubscriberInput input) {
+ super(page, view, input);
+ getInput().getFilteredSyncSet().addSyncSetChangedListener(this);
+ CVSUIPlugin.addPropertyChangeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.team.ui.sync.AbstractSynchronizeParticipant#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ getInput().getFilteredSyncSet().removeSyncSetChangedListener(this);
+ CVSUIPlugin.removePropertyChangeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent)
+ */
+ public void syncSetChanged(SyncSetChangedEvent event) {
+ StructuredViewer viewer = getViewer();
+ if (viewer != null) {
+ IStructuredContentProvider cp = (IStructuredContentProvider) viewer.getContentProvider();
+ StructuredSelection selection = new StructuredSelection(cp.getElements(getInput()));
+ for (Iterator it = delegates.iterator(); it.hasNext(); ) {
+ CVSActionDelegate delegate = (CVSActionDelegate) it.next();
+ delegate.getDelegate().selectionChanged(delegate, selection);
+ }
+ }
+ }
+
+ private void addDelegate(CVSActionDelegate delagate) {
+ delegates.add(delagate);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new TeamSubscriberParticipantLabelProvider() {
+ protected String decorateText(String input, Object resource) {
+ if (resource instanceof IResource) {
+ CVSLightweightDecorator.Decoration decoration = new CVSLightweightDecorator.Decoration();
+ CVSLightweightDecorator.decorateTextLabel((IResource) resource, decoration, false, true);
+ StringBuffer output = new StringBuffer(25);
+ if(decoration.prefix != null) {
+ output.append(decoration.prefix);
+ }
+ output.append(input);
+ if(decoration.suffix != null) {
+ output.append(decoration.suffix);
+ }
+ return output.toString();
+ } else {
+ return input;
+ }
+ }
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+ String prop = event.getProperty();
+ if(prop.equals(CVSUIPlugin.P_DECORATORS_CHANGED)) {
+ getViewer().refresh(true /* update labels */);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java
new file mode 100644
index 000000000..7bfcabe28
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizePage.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.ui.Utilities;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.actions.DirectionFilterActionGroup;
+import org.eclipse.team.ui.synchronize.actions.RemoveSynchronizeParticipantAction;
+import org.eclipse.ui.IActionBars;
+
+
+public class MergeSynchronizePage extends CVSSynchronizeViewPage {
+
+ private RemoveSynchronizeParticipantAction removeAction;
+ private DirectionFilterActionGroup modes;
+ private Action updateAdapter;
+
+ public MergeSynchronizePage(TeamSubscriberParticipant participant, ISynchronizeView view, SubscriberInput input) {
+ super(participant, view, input);
+ removeAction = new RemoveSynchronizeParticipantAction(getParticipant());
+ modes = new DirectionFilterActionGroup(getParticipant(), TeamSubscriberParticipant.INCOMING_MODE | TeamSubscriberParticipant.CONFLICTING_MODE);
+ updateAdapter = new CVSActionDelegate(new MergeUpdateAction());
+
+ Utilities.initAction(updateAdapter, "action.SynchronizeViewUpdate.", Policy.getBundle()); //$NON-NLS-1$
+ getParticipant().setMode(TeamSubscriberParticipant.INCOMING_MODE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
+ */
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ if(actionBars != null) {
+ IToolBarManager toolbar = actionBars.getToolBarManager();
+ toolbar.add(new Separator());
+ modes.fillToolBar(toolbar);
+ toolbar.add(new Separator());
+ toolbar.add(updateAdapter);
+ toolbar.add(removeAction);
+ }
+ }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..410e4586c
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.core.subscribers.TeamSubscriber;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.IPageBookViewPage;
+
+public class MergeSynchronizeParticipant extends TeamSubscriberParticipant {
+
+ private final static String CTX_QUALIFIER = "qualifier"; //$NON-NLS-1$
+ private final static String CTX_LOCALNAME = "localname"; //$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 MergeSynchronizeParticipant() {
+ super();
+ }
+
+ public MergeSynchronizeParticipant(CVSMergeSubscriber subscriber) {
+ super();
+ setSubscriber(subscriber);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.TeamSubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
+ */
+ protected void setSubscriber(TeamSubscriber subscriber) {
+ super.setSubscriber(subscriber);
+ String id = CVSMergeSubscriber.QUALIFIED_NAME;
+ try {
+ ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(id);
+ setInitializationData(descriptor);
+ } catch (CoreException e) {
+ CVSUIPlugin.log(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipant#init(org.eclipse.team.ui.sync.ISynchronizeView, org.eclipse.team.core.ISaveContext)
+ */
+ public void restoreState(IMemento context) throws PartInitException {
+ String qualifier = context.getString(CTX_QUALIFIER);
+ String localname = context.getString(CTX_LOCALNAME);
+ if(qualifier == null || localname == null) {
+ throw new PartInitException(Policy.bind("MergeSynchronizeParticipant.8")); //$NON-NLS-1$
+ }
+ try {
+ setSubscriber(read(new QualifiedName(qualifier, localname), context));
+ } catch (CVSException e) {
+ throw new PartInitException(Policy.bind("MergeSynchronizeParticipant.9"), e); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipant#saveState(org.eclipse.team.core.ISaveContext)
+ */
+ public void saveState(IMemento context) {
+ SubscriberInput input = getInput();
+ CVSMergeSubscriber s = (CVSMergeSubscriber)input.getSubscriber();
+ QualifiedName sId = s.getId();
+ context.putString(CTX_QUALIFIER, sId.getQualifier());
+ context.putString(CTX_LOCALNAME, sId.getLocalName());
+ write(s, context);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.AbstractSynchronizeParticipant#dispose()
+ */
+ protected void dispose() {
+ super.dispose();
+ ((CVSMergeSubscriber)getInput().getSubscriber()).cancel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createPage(org.eclipse.team.ui.synchronize.ISynchronizeView)
+ */
+ public IPageBookViewPage createPage(ISynchronizeView view) {
+ return new MergeSynchronizePage(this, view, getInput());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
+ */
+ public String getName() {
+ return ((CVSMergeSubscriber)getInput().getSubscriber()).getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#saveState(org.eclipse.team.internal.core.SaveContext)
+ */
+ private void write(CVSMergeSubscriber s, IMemento memento) {
+ // start and end tags
+ CVSTag start = s.getStartTag();
+ CVSTag end = s.getEndTag();
+ memento.putString(CTX_START_TAG, start.getName());
+ memento.putInteger(CTX_START_TAG_TYPE, start.getType());
+ memento.putString(CTX_END_TAG, end.getName());
+ memento.putInteger(CTX_END_TAG_TYPE, end.getType());
+
+ // resource roots
+ IResource[] roots = s.roots();
+ for (int i = 0; i < roots.length; i++) {
+ IResource resource = roots[i];
+ IMemento rootNode = memento.createChild(CTX_ROOT);
+ rootNode.putString(CTX_ROOT_PATH, resource.getFullPath().toString());
+ }
+ }
+
+ private CVSMergeSubscriber read(QualifiedName id, IMemento memento) throws CVSException {
+ CVSTag start = new CVSTag(memento.getString(CTX_START_TAG), memento.getInteger(CTX_START_TAG_TYPE).intValue()); //$NON-NLS-1$ //$NON-NLS-2$
+ CVSTag end = new CVSTag(memento.getString(CTX_END_TAG), memento.getInteger(CTX_END_TAG_TYPE).intValue()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
+ if(rootNodes == null || rootNodes.length == 0) {
+ throw new CVSException(Policy.bind("MergeSynchronizeParticipant.10",id.toString())); //$NON-NLS-1$
+ }
+
+ List resources = new ArrayList();
+ for (int i = 0; i < rootNodes.length; i++) {
+ IMemento rootNode = rootNodes[i];
+ IPath path = new Path(rootNode.getString(CTX_ROOT_PATH)); //$NON-NLS-1$
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
+ if(resource != null) {
+ resources.add(resource);
+ } else {
+ // log that a resource previously in the merge set is no longer in the workspace
+ CVSProviderPlugin.log(CVSStatus.INFO, Policy.bind("MergeSynchronizeParticipant.11", resource.getFullPath().toString()), null); //$NON-NLS-1$
+ }
+ }
+ if(resources.isEmpty()) {
+ throw new CVSException(Policy.bind("MergeSynchronizeParticipant.12", id.toString())); //$NON-NLS-1$
+ }
+ IResource[] roots = (IResource[]) resources.toArray(new IResource[resources.size()]);
+ return new CVSMergeSubscriber(id, roots, start, end);
+ }
+} \ No newline at end of file
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
index c63610498..dac34ad37 100644
--- 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
@@ -31,10 +31,10 @@ import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.sync.OrSyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.OrSyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
/**
* This action performs a "cvs update -j start -j end ..." to merge changes
@@ -99,7 +99,7 @@ public class MergeUpdateAction extends SafeUpdateAction {
// Assumption that all nodes are from the same subscriber.
currentSubcriber = nodes[0].getSubscriber();
if (!(currentSubcriber instanceof CVSMergeSubscriber)) {
- throw new CVSException(Policy.bind("MergeUpdateAction.invalidSubscriber", currentSubcriber.getId().toString())); //$NON-NLS-1$
+ throw new CVSException(Policy.bind("MergeUpdateAction.invalidSubscriber", currentSubcriber.toString())); //$NON-NLS-1$
}
CVSTag startTag = ((CVSMergeSubscriber)currentSubcriber).getStartTag();
CVSTag endTag = ((CVSMergeSubscriber)currentSubcriber).getEndTag();
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
index aa7002f89..915a207fd 100644
--- 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
@@ -11,9 +11,9 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
public class OverrideAndCommitAction extends SubscriberCommitAction {
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
index 456f4d87b..ee498f1a5 100644
--- 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
@@ -18,9 +18,9 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
/**
* Runs an update command that will prompt the user for overwritting local
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
index bde0b4cc9..e885ca707 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
@@ -22,7 +22,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.sync.IRemoteResource;
@@ -30,11 +29,12 @@ 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.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.UpdateOnlyMergableOperation;
-import org.eclipse.team.ui.sync.AndSyncInfoFilter;
-import org.eclipse.team.ui.sync.OrSyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.AndSyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.OrSyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
/**
* This update action will update all mergable resources first and then prompt the
@@ -261,8 +261,7 @@ public abstract class SafeUpdateAction extends CVSSubscriberAction {
*/
protected void warnAboutFailedResources(final SyncInfoSet syncSet) {
final int[] result = new int[] {Dialog.CANCEL};
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
+ TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(shell,
Policy.bind("SafeUpdateAction.warnFilesWithConflictsTitle"), //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
index ac6484938..2216abdf3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
@@ -31,9 +31,9 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.sync.ToolTipMessageDialog;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
public class SubscriberCommitAction extends CVSSubscriberAction {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java
index c8e06623a..06d0a0516 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberConfirmMergedAction.java
@@ -19,9 +19,9 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
/**
* This action marks the local resource as merged by updating the base
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
index 1230ec59c..f3fddaadf 100644
--- 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
@@ -28,8 +28,8 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ccvs.ui.AdaptableResourceList;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SynchronizeViewActionDelagate.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SynchronizeViewActionDelagate.java
new file mode 100644
index 000000000..21d241ebb
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SynchronizeViewActionDelagate.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.team.internal.ui.synchronize.sets.ISyncSetChangedListener;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSetChangedEvent;
+import org.eclipse.ui.actions.ActionDelegate;
+
+public abstract class SynchronizeViewActionDelagate extends Action implements ISyncSetChangedListener {
+
+ private SubscriberInput input;
+ private ActionDelegate delegate;
+
+ public SynchronizeViewActionDelagate(SubscriberInput input, ActionDelegate delegate) {
+ super();
+ this.delegate = delegate;
+ this.input = input;
+ input.getFilteredSyncSet().addSyncSetChangedListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent)
+ */
+ public void syncSetChanged(SyncSetChangedEvent event) {
+ setEnabled(isEnabled());
+ }
+}
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
index 6b1445c85..b9926de6e 100644
--- 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
@@ -15,7 +15,7 @@ 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.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.Policy;
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java
new file mode 100644
index 000000000..30730a77f
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizePage.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.ui.Utilities;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.actions.DirectionFilterActionGroup;
+import org.eclipse.ui.IActionBars;
+
+public class WorkspaceSynchronizePage extends CVSSynchronizeViewPage {
+
+ private DirectionFilterActionGroup modes;
+
+ private Action commitToolbar;
+ private Action updateToolbar;
+
+ public WorkspaceSynchronizePage(TeamSubscriberParticipant page, ISynchronizeView view, SubscriberInput input) {
+ super(page, view, input);
+ modes = new DirectionFilterActionGroup(getParticipant(), TeamSubscriberParticipant.ALL_MODES);
+
+ commitToolbar = new CVSActionDelegate(new SubscriberCommitAction());
+ updateToolbar = new CVSActionDelegate(new WorkspaceUpdateAction());
+
+ Utilities.initAction(commitToolbar, "action.SynchronizeViewCommit.", Policy.getBundle()); //$NON-NLS-1$
+ Utilities.initAction(updateToolbar, "action.SynchronizeViewUpdate.", Policy.getBundle()); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
+ */
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ IToolBarManager toolbar = actionBars.getToolBarManager();
+ modes.fillToolBar(toolbar);
+ toolbar.add(new Separator());
+ toolbar.add(updateToolbar);
+ toolbar.add(commitToolbar);
+ }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..1d1dbc1ed
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.team.core.subscribers.TeamSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.IPageBookViewPage;
+
+public class WorkspaceSynchronizeParticipant extends TeamSubscriberParticipant {
+
+ public final static String ID = "org.eclipse.team.cvs.ui.cvsworkspace-participant"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipant#init(org.eclipse.team.ui.sync.ISynchronizeView, org.eclipse.team.core.ISaveContext)
+ */
+ public void restoreState(IMemento memento) throws PartInitException {
+ TeamSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
+ setSubscriber(subscriber);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipant#saveState(org.eclipse.team.core.ISaveContext)
+ */
+ public void saveState(IMemento memento) {
+ // no state to save
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createPage(org.eclipse.team.ui.synchronize.ISynchronizeView)
+ */
+ public IPageBookViewPage createPage(ISynchronizeView view) {
+ return new WorkspaceSynchronizePage(this, view, getInput());
+ }
+} \ No newline at end of file
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
index 3f7891a28..a6b604f8d 100644
--- 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
@@ -25,9 +25,9 @@ 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.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.team.ui.sync.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter.SyncInfoDirectionFilter;
/**
* This action performs an update for the CVSWorkspaceSubscriber.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index 20b0255b7..9c9f941f2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -43,10 +43,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.ILocalSyncElement;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.core.sync.RemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
@@ -306,14 +304,6 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
CVSLightweightDecorator.decorateTextLabel(resource, decoration, false /*don't show dirty*/, false /*don't show revisions*/);
label = decoration.prefix + label + decoration.suffix;
}
-
- if (CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_SYNCINFO_AS_TEXT)) {
- int syncKind = node.getKind();
- if (syncKind != ILocalSyncElement.IN_SYNC) {
- String syncKindString = RemoteSyncElement.kindToString(syncKind);
- label = Policy.bind("CVSCatchupReleaseViewer.labelWithSyncKind", label, syncKindString); //$NON-NLS-1$
- }
- }
return label;
}
});
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
index 29527dbe4..e7cf7e0c9 100644
--- 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
@@ -51,7 +51,8 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
import org.eclipse.team.ui.IConfigurationWizard;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
@@ -298,12 +299,13 @@ public class SharingWizard extends Wizard implements IConfigurationWizard {
throw new InvocationTargetException(e);
}
}
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(null);
+ ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(null);
if(view != null) {
+ TeamSubscriberParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
IWorkingSet workingSet = CVSUIPlugin.getWorkingSet(new IResource[] {project}, Policy.bind("SyncAction.workingSetName")); //$NON-NLS-1$)
- view.setWorkingSet(workingSet);
- view.selectSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- view.setMode(ISynchronizeView.OUTGOING_MODE);
+ participant.setWorkingSet(workingSet);
+ participant.setMode(TeamSubscriberParticipant.OUTGOING_MODE);
+ view.display(participant);
} else {
CVSUIPlugin.openError(getContainer().getShell(), Policy.bind("error"), Policy.bind("Error.unableToShowSyncView"), null); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif
new file mode 100644
index 000000000..b95e26a1b
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif
new file mode 100644
index 000000000..706dc020e
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif
new file mode 100644
index 000000000..12a9167c5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif
new file mode 100644
index 000000000..8411bc227
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif
new file mode 100644
index 000000000..f302d8c88
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif
new file mode 100644
index 000000000..e84103f40
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif
new file mode 100644
index 000000000..4e9a3eb98
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif
new file mode 100644
index 000000000..7e0ad4aed
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif
new file mode 100644
index 000000000..3dcccb3c7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif
new file mode 100644
index 000000000..a0f800693
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif
new file mode 100644
index 000000000..feb14bf53
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif
new file mode 100644
index 000000000..4fdde615d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif
new file mode 100644
index 000000000..310510ee5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif
new file mode 100644
index 000000000..4410b22ee
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif
new file mode 100644
index 000000000..2fddc3ea1
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
index 6027e2820..56c08c388 100644
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ b/bundles/org.eclipse.team.ui/plugin.properties
@@ -14,7 +14,7 @@ pluginName=Team Support UI
Team=Team
configurationWizards=Configuration Wizards
targetWizards=Target Site Addition Wizards
-subscriberMenus=Team Subscriber Menu Contributions
+synchronizeParticipants=Synchronize View Participants
TeamPreferencePage.name=Team
TextPreferencePage.name=File Content
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index 0b1982837..42db50369 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -22,6 +22,7 @@
<extension-point id="configurationWizards" name="%configurationWizards" schema="schema/configurationWizards.exsd"/>
<extension-point id="subscriberMenus" name="%subscriberMenus"/>
+ <extension-point id="synchronizeParticipants" name="%synchronizeParticipants" schema="schema/synchronizeParticipants.exsd"/>
<!-- **************** PREFERENCES ******************* -->
<extension
@@ -127,7 +128,7 @@
icon="icons/full/cview16/synch_synch.gif"
fastViewWidthRatio="0.25"
category="org.eclipse.team.ui"
- class="org.eclipse.team.internal.ui.sync.views.SynchronizeView"
+ class="org.eclipse.team.internal.ui.synchronize.SynchronizeView"
id="org.eclipse.team.sync.views.SynchronizeView">
</view>
</extension>
@@ -137,7 +138,7 @@
<perspective
name="%Synchronizing.perspective"
icon="icons/full/cview16/synch_synch.gif"
- class="org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective"
+ class="org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective"
id="org.eclipse.team.ui.TeamSynchronizingPerspective">
</perspective>
</extension>
@@ -148,10 +149,6 @@
<perspectiveShortcut
id="org.eclipse.team.ui.TeamSynchronizingPerspective">
</perspectiveShortcut>
- <view id="org.eclipse.team.sync.views.SyncViewer"
- relative="org.eclipse.ui.views.ResourceNavigator"
- visible="false"
- relationship="stack"/>
</perspectiveExtension>
</extension>
<!-- ****************** Import Wizards ********************* -->
@@ -190,15 +187,6 @@
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
- targetID="org.eclipse.ui.resourcePerspective">
- <view
- relative="org.eclipse.ui.views.ResourceNavigator"
- visible="false"
- relationship="stack"
- id="org.eclipse.team.ui.sync.SyncView">
- </view>
- </perspectiveExtension>
- <perspectiveExtension
targetID="org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective">
<showInPart
id="org.eclipse.ui.views.ResourceNavigator">
@@ -213,36 +201,6 @@
description="%Command.category.description"
id="org.eclipse.team.ui.commands.category">
</category>
- <command
- name="%Command.incomingFilter.name"
- description="%Command.incomingFilter.description"
- category="org.eclipse.team.ui.commands.category"
- id="org.eclipse.team.ui.syncview.incomingFilter">
- </command>
- <command
- name="%Command.outgoingFilter.name"
- description="%Command.outgoingFilter.description"
- category="org.eclipse.team.ui.commands.category"
- id="org.eclipse.team.ui.syncview.outgoingFilter">
- </command>
- <command
- name="%Command.bothFilter.name"
- description="%Command.bothFilter.description"
- category="org.eclipse.team.ui.commands.category"
- id="org.eclipse.team.ui.syncview.bothFilter">
- </command>
- <command
- name="%Command.conflictsFilter.name"
- description="%Command.conflictsFilter.description"
- category="org.eclipse.team.ui.commands.category"
- id="org.eclipse.team.ui.syncview.conflictsFilter">
- </command>
- <command
- name="%Command.syncAll.name"
- description="%Command.syncAll.description"
- category="org.eclipse.team.ui.commands.category"
- id="org.eclipse.team.ui.syncview.syncAll">
- </command>
</extension>
<!-- ***************** Action sets ********************** -->
<extension
diff --git a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
new file mode 100644
index 000000000..c834e81d1
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
@@ -0,0 +1,146 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.team.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.team.ui" id="synchronizeParticipants" name="Synchronize View Participants"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to register a synchronize participant with the Synchronize View. A synchronize participant provides a logical connection between local resources and a remote location that is used to share those resources. The Synchronize View displays synchronize participants.
+&lt;p&gt;
+Providers may provide an extension for this extension point, and an implementation of &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeParticipant&lt;/samp&gt;.
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="participant"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ A fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ An optional identifier of the extension instance.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ An optional name for this extension instance.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="participant">
+ <complexType>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+ An icon that will be used when showing this participant in lists and menus.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ A unique name that will be used to identify this type of participant.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ A fully qualified name of the class the implements &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeParticipant&lt;/samp&gt;. A common practice is to subclass &lt;samp&gt;org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant&lt;/samp&gt; in order to inherit some of the default functionality. In addition, it is recommended to subclass &lt;samp&gt;org.eclipse.team.ui.synchronize.TeamSubscriberParticipant&lt;/samp&gt; to benefit from a full featured participant based on the &lt;samp&gt;org.eclipse.team.core.TeamSubscriber&lt;/samp&gt; implementation.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>
+ A value identifying the type of participant. Possible values are &lt;samp&gt;static&lt;/samp&gt; if the participant is to be created automatically by the Team plugin or &lt;samp&gt;dynamic&lt;/samp&gt; if the participant will be created and registered with the Synchronize Manager at some other time.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ The name of the participant. This will be shown in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;extension
+point=&quot;org.eclipse.team.ui.synchronizeParticipants&quot;&gt;
+&lt;participant
+name=&quot;CVS Workspace&quot;
+icon=&quot;icons/full/cview16/server.gif&quot; class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant&quot;
+type=&quot;static&quot;
+id=&quot;org.eclipse.team.cvs.ui.cvsworkspace-participant&quot;&gt;
+&lt;/participant&gt;
+&lt;participant
+name=&quot;CVS Merge&quot;
+icon=&quot;icons/full/obj16/prjversions_rep.gif&quot;
+class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant&quot;
+type=&quot;dynamic&quot;
+id=&quot;org.eclipse.team.cvs.ui.cvsmerge-participant&quot;&gt;
+&lt;/participant&gt;
+&lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that implements &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeView&lt;/samp&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2003 IBM Corporation and others.
+All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
index b5b8c3457..1f4bf8e28 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
@@ -26,4 +26,6 @@ public interface IPreferenceIds {
public static final String SYNCVIEW_VIEW_TYPE = PREFIX + "view_type"; //$NON-NLS-1$
public static final String SYNCVIEW_VIEW_TABLESORT = PREFIX + "table_column_sort"; //$NON-NLS-1$
public static final String SYNCVIEW_VIEW_TABLESORT_REVERSED = PREFIX + "table_column_sort_reversed"; //$NON-NLS-1$
+
+ public static final String SYNCVIEW_VIEW_SYNCINFO_IN_LABEL = PREFIX + "view_syncinfo_in_label"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
index 4c2b884a6..36611f963 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
@@ -30,7 +30,7 @@ import org.eclipse.team.internal.core.NullSubProgressMonitor;
public class Policy {
// The resource bundle to get strings from
protected static ResourceBundle bundle = null;
-
+
/**
* Creates a NLS catalog for the given locale.
*
@@ -72,7 +72,7 @@ public class Policy {
* @param id the id to look up
* @param binding1 the first string to bind to the result
* @param binding2 the second string to bind to the result
- * @param binding3 the third string to bind to the result
+ * @param binding3 the third string to bind to the result
* @return the bound string
*/
public static String bind(String id, String binding1, String binding2,String binding3) {
@@ -86,6 +86,23 @@ public class Policy {
* @param key the id to look up
* @return the string with the given key
*/
+ public static String bind(String key, ResourceBundle b) {
+ try {
+ return b.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ } catch (NullPointerException e) {
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle. We don't want to crash because of a missing String.
+ * Returns the key if not found.
+ *
+ * @param key the id to look up
+ * @return the string with the given key
+ */
public static String bind(String key) {
try {
return bundle.getString(key);
@@ -176,4 +193,8 @@ public class Policy {
return "..." + stringPath.substring(index); //$NON-NLS-1$
}
}
+
+ public static ResourceBundle getBundle() {
+ return bundle;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
index 0453708f2..a1f58e583 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
@@ -11,6 +11,7 @@
package org.eclipse.team.internal.ui;
+import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -24,19 +25,25 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberInputJob;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
-import org.eclipse.team.internal.ui.sync.views.SyncViewerTableSorter;
+import org.eclipse.team.internal.ui.synchronize.views.SyncViewerTableSorter;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeManager;
+import org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective;
import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.sync.ISynchronizeView;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -56,10 +63,6 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
// plugin id
public static final String PLUGIN_ID = "org.eclipse.team.ui"; //$NON-NLS-1$
- // extension points
- public static final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$
- public static final String PT_DECORATORS = "decorators"; //$NON-NLS-1$
-
private static List propertyChangeListeners = new ArrayList(5);
private Hashtable imageDescriptors = new Hashtable(20);
@@ -158,12 +161,13 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
IPreferenceStore store = getPreferenceStore();
store.setDefault(IPreferenceIds.SYNCVIEW_BACKGROUND_SYNC, true);
store.setDefault(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC, false);
+ store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, false);
store.setDefault(IPreferenceIds.SYNCVIEW_DELAY, 60 /* minutes */);
store.setDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS, true);
store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT, SyncViewerTableSorter.COL_NAME);
store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED, false);
- store.setDefault(IPreferenceIds.SYNCVIEW_SELECTED_MODE, ISynchronizeView.BOTH_MODE);
- store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, "org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective"); //$NON-NLS-1$
+ store.setDefault(IPreferenceIds.SYNCVIEW_SELECTED_MODE, TeamSubscriberParticipant.BOTH_MODE);
+ store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, TeamSynchronizingPerspective.ID);
}
/**
@@ -210,6 +214,7 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
// start once the platform has started and stabilized
refreshJob.schedule(20000 /* 20 seconds */);
}
+ ((SynchronizeManager)TeamUI.getSynchronizeManager()).initialize();
}
/* (non-Javadoc)
@@ -395,6 +400,29 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
}
}
+ /**
+ * 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;
+ }
+
+ public static void run(IRunnableWithProgress runnable) {
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable);
+ } catch (InvocationTargetException e) {
+ Utils.handleError(getStandardDisplay().getActiveShell(), e, null, null);
+ } catch (InterruptedException e2) {
+ // Nothing to be done
+ }
+ }
+
public void propertyChange(PropertyChangeEvent event) {
// update the background sync delay
if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_DELAY)) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 969d5f081..6ee1ccf75 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -1,35 +1,27 @@
-/*
- * Created on Jun 26, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.team.internal.ui;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
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.ui.IKeyBindingService;
+import org.eclipse.team.ui.Utilities;
-/**
- * @author Jean-Michel Lemieux
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
public class Utils {
/**
@@ -181,67 +173,7 @@ public class Utils {
}
}
- public static void registerAction(IKeyBindingService kbs, IAction a, String id) {
- if (kbs != null) {
- a.setActionDefinitionId(id);
- kbs.registerAction(a);
- }
- }
-
- /**
- * Initialize the given Action from a ResourceBundle.
- */
public static void initAction(IAction a, String prefix) {
-
- String labelKey= "label"; //$NON-NLS-1$
- String tooltipKey= "tooltip"; //$NON-NLS-1$
- String imageKey= "image"; //$NON-NLS-1$
- String descriptionKey= "description"; //$NON-NLS-1$
-
- if (prefix != null && prefix.length() > 0) {
- labelKey= prefix + labelKey;
- tooltipKey= prefix + tooltipKey;
- imageKey= prefix + imageKey;
- descriptionKey= prefix + descriptionKey;
- }
-
- String s = Policy.bind(labelKey);
- if(s != null)
- a.setText(s);
- s = Policy.bind(tooltipKey);
- if(s != null)
- a.setToolTipText(s);
- s = Policy.bind(descriptionKey);
- if(s != null)
- a.setDescription(s);
-
- String relPath= Policy.bind(imageKey);
- if (relPath != null && ! relPath.equals(imageKey) && relPath.trim().length() > 0) {
-
- String cPath;
- String dPath;
- String ePath;
-
- if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
- String path= relPath.substring(1);
- cPath= 'c' + path;
- dPath= 'd' + path;
- ePath= 'e' + path;
- } else {
- cPath= "clcl16/" + relPath; //$NON-NLS-1$
- dPath= "dlcl16/" + relPath; //$NON-NLS-1$
- ePath= "elcl16/" + relPath; //$NON-NLS-1$
- }
-
- ImageDescriptor id= TeamUIPlugin.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87)
- if (id != null)
- a.setDisabledImageDescriptor(id);
- id= TeamUIPlugin.getImageDescriptor(cPath);
- if (id != null)
- a.setHoverImageDescriptor(id);
- id= TeamUIPlugin.getImageDescriptor(ePath);
- if (id != null)
- a.setImageDescriptor(id);
- }
+ Utilities.initAction(a, prefix, Policy.bundle);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index 4af0dfbd5..af26e305c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -37,6 +37,7 @@ import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -55,7 +56,7 @@ import org.eclipse.ui.actions.ActionDelegate;
* Team providers may also instantiate or subclass any of the
* subclasses of TeamAction provided in this package.
*/
-public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate {
+public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate, IViewActionDelegate {
// The current selection
protected IStructuredSelection selection;
@@ -349,5 +350,11 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
return null;
}
}
-
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ public void init(IViewPart view) {
+ targetPart = view;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.java
index 6b75d583a..72733971f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.java
@@ -10,76 +10,106 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.jobs;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
-import org.eclipse.team.core.subscribers.TeamDelta;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
/**
- * Job to refresh a subscriber with its remote state.
+ * Job that refreshes a registered list of subscriber inputs. Each input
+ * will have it's associated subscriber refreshed.
*
* There can be several refresh jobs created but they will be serialized.
*/
-public class RefreshSubscriberInputJob extends RefreshSubscriberJob implements ITeamResourceChangeListener {
-
- /**
- * The subscribers and roots to refresh. If these are changed when the job
- * is running the job is cancelled.
- */
- private SubscriberInput input;
+public class RefreshSubscriberInputJob extends RefreshSubscriberJob {
+ private List inputs = new ArrayList(3);
public RefreshSubscriberInputJob(String name) {
super(name, null, null);
}
- public void teamResourceChanged(TeamDelta[] deltas) {
- for (int i = 0; i < deltas.length; i++) {
- TeamDelta delta = deltas[i];
- if(delta.getFlags() == TeamDelta.SUBSCRIBER_DELETED) {
- // cancel current refresh just to make sure that the subscriber being deleted can
- // be properly shutdown
- cancel();
- setSubscriberInput(null);
- }
- }
+ public synchronized void addSubscriberInput(SubscriberInput input) {
+ stop();
+ inputs.add(input);
+ start();
+ }
+
+ public synchronized void removeSubscriberInput(SubscriberInput input) {
+ stop();
+ inputs.remove(input);
+ start();
}
- public void setSubscriberInput(SubscriberInput input) {
+ private void stop() {
int state = getState();
if(state == Job.RUNNING) {
cancel();
- }
- this.input = input;
-
- if(state == Job.NONE && input != null) {
- if(shouldReschedule()) {
- schedule(getScheduleDelay());
+ try {
+ join();
+ } catch (InterruptedException e) {
+ // continue
}
}
}
-
- protected IResource[] getResources() {
- if(input != null) {
- return input.workingSetRoots();
+
+ /**
+ * This is run by the job scheduler. A list of subscribers will be refreshed, errors will not stop the job
+ * and it will continue to refresh the other subscribers.
+ */
+ public IStatus runInWorkspace(IProgressMonitor monitor) {
+ // Synchronized to ensure only one refresh job is running at a particular time
+ synchronized (getFamily()) {
+ MultiStatus status = new MultiStatus(TeamUIPlugin.ID, TeamException.UNABLE, Policy.bind("RefreshSubscriberJob.0"), null); //$NON-NLS-1$
+
+ // if there are no inputs to refresh, just return
+ if(inputs.isEmpty()) {
+ return Status.OK_STATUS;
+ }
+
+ try {
+ // Only allow one refresh job at a time
+ // NOTE: It would be cleaner if this was done by a scheduling
+ // rule but at the time of writting, it is not possible due to
+ // the scheduling rule containment rules.
+ lastTimeRun = System.currentTimeMillis();
+ if(monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ for (Iterator it = inputs.iterator(); it.hasNext();) {
+ SubscriberInput input = (SubscriberInput) it.next();
+ monitor.setTaskName(Policy.bind(Policy.bind("RefreshSubscriberInputJob.1"), input.getParticipant().getName(), new Integer(input.workingSetRoots().length).toString())); //$NON-NLS-1$
+ TeamSubscriber subscriber = input.getSubscriber();
+ subscriber.refresh(input.workingSetRoots(), IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100));
+ }
+ } catch(TeamException e) {
+ status.merge(e.getStatus());
+ }
+ } catch(OperationCanceledException e2) {
+ return Status.CANCEL_STATUS;
+ } finally {
+ monitor.done();
+ }
+ return status.isOK() ? Status.OK_STATUS : (IStatus) status;
}
- return null;
}
- protected TeamSubscriber getSubscriber() {
- if(input != null) {
- return input.getSubscriber();
- }
- return null;
- }
/* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob#getTaskName(org.eclipse.team.core.subscribers.TeamSubscriber, org.eclipse.core.resources.IResource[])
+ * @see org.eclipse.core.runtime.jobs.Job#shouldRun()
*/
- protected String getTaskName(TeamSubscriber subscriber, IResource[] roots) {
- // Return a meaningfull task nam since the job name will be generic
- return Policy.bind("RefreshSubscriberJob.1", String.valueOf(roots.length), subscriber.getName()); //$NON-NLS-1$
+ public boolean shouldRun() {
+ return ! inputs.isEmpty();
}
-
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
index 3b25c04f2..509a29e83 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
@@ -39,7 +39,7 @@ public class RefreshSubscriberJob extends WorkspaceJob {
* Uniquely identifies this type of job. This is used for cancellation.
*/
private final static Object FAMILY_ID = new Object();
-
+
/**
* If true this job will be restarted when it completes
*/
@@ -49,7 +49,7 @@ public class RefreshSubscriberJob extends WorkspaceJob {
* If true a rescheduled refresh job should be retarted when cancelled
*/
/* internal use only */ boolean restartOnCancel = true;
-
+
/**
* The schedule delay used when rescheduling a completed job
*/
@@ -58,7 +58,7 @@ public class RefreshSubscriberJob extends WorkspaceJob {
/**
* Time the job was run last in milliseconds.
*/
- private long lastTimeRun = 0;
+ protected long lastTimeRun = 0;
/**
* The subscribers and roots to refresh. If these are changed when the job
@@ -87,15 +87,15 @@ public class RefreshSubscriberJob extends WorkspaceJob {
}
});
}
-
+
public boolean shouldRun() {
return getSubscriber() != null;
}
-
+
public boolean belongsTo(Object family) {
return family == getFamily();
}
-
+
public static Object getFamily() {
return FAMILY_ID;
}
@@ -115,8 +115,8 @@ public class RefreshSubscriberJob extends WorkspaceJob {
if(subscriber == null || roots == null) {
return Status.OK_STATUS;
}
-
- monitor.beginTask(getTaskName(subscriber, roots), 100);
+
+ monitor.beginTask(null, 100);
try {
// Only allow one refresh job at a time
// NOTE: It would be cleaner if this was done by a scheduling
@@ -127,7 +127,6 @@ public class RefreshSubscriberJob extends WorkspaceJob {
return Status.CANCEL_STATUS;
}
try {
- monitor.setTaskName(subscriber.getName());
subscriber.refresh(roots, IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100));
} catch(TeamException e) {
status.merge(e.getStatus());
@@ -140,16 +139,11 @@ public class RefreshSubscriberJob extends WorkspaceJob {
return status.isOK() ? Status.OK_STATUS : (IStatus) status;
}
}
-
- protected String getTaskName(TeamSubscriber subscriber, IResource[] roots) {
- // Don't return a task name as the job name contains the subscriber and resource count
- return null;
- }
-
+
protected IResource[] getResources() {
return resources;
}
-
+
protected TeamSubscriber getSubscriber() {
return subscriber;
}
@@ -157,15 +151,31 @@ public class RefreshSubscriberJob extends WorkspaceJob {
protected long getScheduleDelay() {
return scheduleDelay;
}
-
+
+ protected void start() {
+ if(getState() == Job.NONE) {
+ if(shouldReschedule()) {
+ schedule(getScheduleDelay());
+ }
+ }
+ }
+
/**
* Specify the interval in seconds at which this job is scheduled.
* @param seconds delay specified in seconds
*/
public void setRefreshInterval(long seconds) {
+ boolean restart = false;
+ if(getState() == Job.SLEEPING) {
+ restart = true;
+ cancel();
+ }
scheduleDelay = seconds * 1000;
+ if(restart) {
+ start();
+ }
}
-
+
/**
* Returns the interval of this job in seconds.
* @return
@@ -173,7 +183,7 @@ public class RefreshSubscriberJob extends WorkspaceJob {
public long getRefreshInterval() {
return scheduleDelay / 1000;
}
-
+
public void setRestartOnCancel(boolean restartOnCancel) {
this.restartOnCancel = restartOnCancel;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index e2787b1d2..59d954c2b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -136,8 +136,8 @@ SynchronizationViewPreference.defaultPerspectiveNone=None
SynchronizationViewPreference.defaultPerspectiveDescription=This setting controls which perspective to activate when resources are synchronized.\nTo indicate that a perspective switch should not occur select ''None''.
SynchronizationViewPreference.defaultPerspectiveLabel=Perspective:
-ScheduledSyncViewRefresh.taskName=Team auto-refresh active repository
-SyncViewRefresh.taskName=Team refresh {0} folders for {1}
+ScheduledSyncViewRefresh.taskName=Refreshing synchronize view partners with remote
+SyncViewRefresh.taskName=Refreshing ''{0}'' with remote
ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2=&Select the projects to include in the Team Project Set:
ExportProjectSetMainPage.Project_Set_File_Name__3=Select the export destination:
@@ -333,6 +333,12 @@ action.toggleViewFlat.image=flatLayout.gif
action.toggleViewHierarchical.label=Hierarchical
action.toggleViewHierarchical.image=hierarchicalLayout.gif
+action.workingSets.label=Working Sets
+action.workingSets.none=Working Sets
+action.workingSets.tooltip=Working Sets
+action.workingSets.description=Working Sets
+action.workingSets.image=workingsets.gif
+
action.collapseAll.label=Collapse All
action.collapseAll.tooltip=Collapse All
action.collapseAll.description=Collapse All
@@ -348,30 +354,35 @@ action.refreshWithRemote.tooltip=Refresh with remote
action.refreshWithRemote.description=Refresh with remote
action.refreshWithRemote.image=refresh.gif
-action.directionFilterIncoming.label=Incoming Mode
+action.directionFilterIncoming.label=Incoming
action.directionFilterIncoming.tooltip=Incoming Mode
action.directionFilterIncoming.description=Incoming Mode (shows incoming changes and conflicts)
action.directionFilterIncoming.image=catchup_rls.gif
-action.directionFilterOutgoing.label=Outgoing Mode
+action.directionFilterOutgoing.label=Outgoing
action.directionFilterOutgoing.tooltip=Outgoing Mode
action.directionFilterOutgoing.description=Outgoing Mode (shows outgoing changes and conflicts)
action.directionFilterOutgoing.image=release_rls.gif
-action.directionFilterConflicts.label=Conflicts Mode
+action.directionFilterConflicts.label=Conflicts
action.directionFilterConflicts.tooltip=Conflicts Mode
action.directionFilterConflicts.description=Conflicts Mode (shows conflicts)
action.directionFilterConflicts.image=conflict_synch.gif
-action.directionFilterBoth.label=Incoming/Outgoing mode
+action.directionFilterBoth.label=Both
action.directionFilterBoth.tooltip=Incoming/Outgoing mode
action.directionFilterBoth.description=Incoming/Outgoing mode (shows outgoing changes, incoming changes, and conflicts)
action.directionFilterBoth.image=catchuprelease_rls.gif
-action.refreshSubscriber.label=Refresh with Remote
-action.refreshSubscriber.tooltip=Refresh the current synchronization target with Remote
-action.refreshSubscriber.description=Refresh the current synchronization target with Remote
-action.refreshSubscriber.image=refresh_remote.gif
+action.refreshSubscriber.label=Registered Synchronize Partners
+action.refreshSubscriber.tooltip=Registered Synchronize Partners
+action.refreshSubscriber.description=Registered Synchronize Partners
+action.refreshSubscriber.image=contents.gif
+
+action.comparisonCriteria.label=Compare
+action.comparisonCriteria.tooltip=Select the comparison method
+action.comparisonCriteria.description=Select the comparison method
+action.comparisonCriteria.image=showsync_rn.gif
action.navigateNext.label=Go to Next Difference
action.navigateNext.tooltip=Go to Next Difference
@@ -383,6 +394,11 @@ action.navigatePrevious.tooltip=Go to Previous Difference
action.navigatePrevious.description=Go to Next Difference
action.navigatePrevious.image=prev_nav.gif
+action.removePage.label=Remove
+action.removePage.tooltip=Remove
+action.removePage.description=Remove
+action.removePage.image=rem_co.gif
+
action.expandAll.label=Expand All
action.openInCompareEditor.label=Open In Compare Editor
action.cancelSubscriber.label=Cancel
@@ -421,6 +437,7 @@ SyncViewerPreferencePage.13=Enable a background task to refresh with remote reso
SyncViewerPreferencePage.14=How often should the background refresh run? (in minutes)
SyncViewerPreferencePage.15=Perspective Switching
+RefreshSubscriberInputJob.1=Synchronizing ''{0}'' with remote: {1} resources
RefreshSubscriberJob.1=Team refresh {0} folders for {1}
RefreshSubscriberJob.0=An error occured while synchronizing with remote contents.
@@ -432,3 +449,15 @@ PasteAction.title=&Paste
PasteAction.toolTip=Paste
RefactorActionGroup.0=Edi&t
SubscriberEventHandler.2=Calculating state for {0}.
+SynchronizeManager.7=Error notifying of added/removal of synchronize participants
+SynchronizeManager.8=Error initializing participants
+SynchronizeManager.9=Synchronize participant with id {0} is not in the registry
+SynchronizeManager.10=Error saving synchronize participants
+SynchronizeView.1=Synchronize View
+SynchronizeView.2=Synchronize View -
+SyncViewerPreferencePage.19=Show all synchronization information in a resource\'s text label
+TeamSubscriberParticipantPage.7=Resource
+TeamSubscriberParticipantPage.8=In Folder
+TeamSubscriberSyncPage.labelWithSyncKind={0} {1}
+AbstractSynchronizeParticipant.4=Cannot initialize participant. Wrong descriptor type
+
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
index cf0adac5f..379bf23ce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
@@ -47,8 +47,8 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
private BooleanFieldEditor bkgScheduledRefresh = null;
private IntegerFieldEditor2 scheduledDelay = null;
private BooleanFieldEditor compressFolders = null;
- private BooleanFieldEditor useBothMode = null;
-
+ private BooleanFieldEditor showSyncInLabels = null;
+
private Group refreshGroup;
private static class PerspectiveDescriptorComparator implements Comparator {
@@ -157,6 +157,8 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
compressFolders = new BooleanFieldEditor(SYNCVIEW_COMPRESS_FOLDERS, Policy.bind("SyncViewerPreferencePage.9"), SWT.NONE, displayGroup); //$NON-NLS-1$
addField(compressFolders);
+ showSyncInLabels = new BooleanFieldEditor(SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, Policy.bind("SyncViewerPreferencePage.19"), SWT.NONE, displayGroup); //$NON-NLS-1$
+ addField(showSyncInLabels);
refreshGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.11")); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
new file mode 100644
index 000000000..59ce6034c
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.registry;
+
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IPluginRegistry;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.internal.misc.Sorter;
+
+public abstract class RegistryReader {
+ protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
+ protected static Hashtable extensionPoints = new Hashtable();
+ /**
+ * The constructor.
+ */
+ protected RegistryReader() {
+ }
+ /**
+ * This method extracts description as a subelement of the given element.
+ *
+ * @return description string if defined, or empty string if not.
+ */
+ protected String getDescription(IConfigurationElement config) {
+ IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION);
+ if (children.length >= 1) {
+ return children[0].getValue();
+ }
+ return ""; //$NON-NLS-1$
+ }
+ /**
+ * Logs the error in the workbench log using the provided text and the
+ * information in the configuration element.
+ */
+ protected void logError(IConfigurationElement element, String text) {
+ IExtension extension = element.getDeclaringExtension();
+ IPluginDescriptor descriptor = extension.getDeclaringPluginDescriptor();
+ StringBuffer buf = new StringBuffer();
+ buf.append("Plugin " + descriptor.getUniqueIdentifier() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
+ buf.append("\n" + text); //$NON-NLS-1$
+ WorkbenchPlugin.log(buf.toString());
+ }
+ /**
+ * Logs a very common registry error when a required attribute is missing.
+ */
+ protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
+ logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Logs a very common registry error when a required child is missing.
+ */
+ protected void logMissingElement(IConfigurationElement element, String elementName) {
+ logError(element, "Required sub element '" + elementName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Logs a registry error when the configuration element is unknown.
+ */
+ protected void logUnknownElement(IConfigurationElement element) {
+ logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$
+ }
+ /**
+ * Apply a reproducable order to the list of extensions provided, such that
+ * the order will not change as extensions are added or removed.
+ */
+ protected IExtension[] orderExtensions(IExtension[] extensions) {
+ // By default, the order is based on plugin id sorted
+ // in ascending order. The order for a plugin providing
+ // more than one extension for an extension point is
+ // dependent in the order listed in the XML file.
+ Sorter sorter = new Sorter() {
+ public boolean compare(Object extension1, Object extension2) {
+ String s1 = ((IExtension) extension1).getDeclaringPluginDescriptor().getUniqueIdentifier();
+ String s2 = ((IExtension) extension2).getDeclaringPluginDescriptor().getUniqueIdentifier();
+ //Return true if elementTwo is 'greater than' elementOne
+ return s2.compareToIgnoreCase(s1) > 0;
+ }
+ };
+
+ Object[] sorted = sorter.sort(extensions);
+ IExtension[] sortedExtension = new IExtension[sorted.length];
+ System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
+ return sortedExtension;
+ }
+ /**
+ * Implement this method to read element's attributes. If children should
+ * also be read, then implementor is responsible for calling <code>readElementChildren</code>.
+ * Implementor is also responsible for logging missing attributes.
+ *
+ * @return true if element was recognized, false if not.
+ */
+ protected abstract boolean readElement(IConfigurationElement element);
+ /**
+ * Read the element's children. This is called by the subclass' readElement
+ * method when it wants to read the children of the element.
+ */
+ protected void readElementChildren(IConfigurationElement element) {
+ readElements(element.getChildren());
+ }
+ /**
+ * Read each element one at a time by calling the subclass implementation
+ * of <code>readElement</code>.
+ *
+ * Logs an error if the element was not recognized.
+ */
+ protected void readElements(IConfigurationElement[] elements) {
+ for (int i = 0; i < elements.length; i++) {
+ if (!readElement(elements[i]))
+ logUnknownElement(elements[i]);
+ }
+ }
+ /**
+ * Read one extension by looping through its configuration elements.
+ */
+ protected void readExtension(IExtension extension) {
+ readElements(extension.getConfigurationElements());
+ }
+ /**
+ * Start the registry reading process using the supplied plugin ID and
+ * extension point.
+ */
+ public void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
+ String pointId = pluginId + "-" + extensionPoint; //$NON-NLS-1$
+ IExtension[] extensions = (IExtension[]) extensionPoints.get(pointId);
+ if (extensions == null) {
+ IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
+ if (point == null)
+ return;
+ extensions = point.getExtensions();
+ extensionPoints.put(pointId, extensions);
+ }
+ for (int i = 0; i < extensions.length; i++)
+ readExtension(extensions[i]);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
new file mode 100644
index 000000000..a722b3468
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.registry;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+
+public class SynchronizeParticipantDescriptor implements ISynchronizeParticipantDescriptor {
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_NAME = "name"; //$NON-NLS-1$
+ public static final String ATT_ICON = "icon"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+ private static final String ATT_TYPE = "type"; //$NON-NLS-1$
+ private static final String TYPE_STATIC = "static"; //$NON-NLS-1$
+
+ private String label;
+ private String className;
+ private String type;
+ private String id;
+ private ImageDescriptor imageDescriptor;
+ private String description;
+
+ private IConfigurationElement configElement;
+
+ /**
+ * Create a new ViewDescriptor for an extension.
+ */
+ public SynchronizeParticipantDescriptor(IConfigurationElement e, String desc) throws CoreException {
+ configElement = e;
+ description = desc;
+ loadFromExtension();
+ }
+ /**
+ * Return an instance of the declared view.
+ */
+ public IViewPart createView() throws CoreException {
+ Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
+ return (IViewPart) obj;
+ }
+
+ public IConfigurationElement getConfigurationElement() {
+ return configElement;
+ }
+
+ /**
+ * Returns this view's description. This is the value of its <code>"description"</code>
+ * attribute.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ if (imageDescriptor != null)
+ return imageDescriptor;
+ String iconName = configElement.getAttribute(ATT_ICON);
+ if (iconName == null)
+ return null;
+ imageDescriptor = WorkbenchImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName);
+ return imageDescriptor;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public boolean isStatic() {
+ if(type == null) return true;
+ return type.equals(TYPE_STATIC);
+ }
+
+ /**
+ * load a view descriptor from the registry.
+ */
+ private void loadFromExtension() throws CoreException {
+ String identifier = configElement.getAttribute(ATT_ID);
+ label = configElement.getAttribute(ATT_NAME);
+ className = configElement.getAttribute(ATT_CLASS);
+ type = configElement.getAttribute(ATT_TYPE);
+
+ // Sanity check.
+ if ((label == null) || (className == null) || (identifier == null)) {
+ throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + id, //$NON-NLS-1$
+ null));
+ }
+
+ id = identifier;
+ }
+
+ /**
+ * Returns a string representation of this descriptor. For debugging
+ * purposes only.
+ */
+ public String toString() {
+ return "Synchronize Participant(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java
new file mode 100644
index 000000000..73ab80fe3
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+
+public class SynchronizeParticipantRegistry extends RegistryReader {
+
+ private static final String TAG_SYNCPARTICIPANT = "participant"; //$NON-NLS-1$
+ private Map participants = new HashMap();
+
+ public SynchronizeParticipantRegistry() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ protected boolean readElement(IConfigurationElement element) {
+ if (element.getName().equals(TAG_SYNCPARTICIPANT)) {
+ String descText = getDescription(element);
+ SynchronizeParticipantDescriptor desc;
+ try {
+ desc = new SynchronizeParticipantDescriptor(element, descText);
+ participants.put(desc.getId(), desc);
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public SynchronizeParticipantDescriptor[] getSynchronizeParticipants() {
+ return (SynchronizeParticipantDescriptor[])participants.values().toArray(new SynchronizeParticipantDescriptor[participants.size()]);
+ }
+
+ public SynchronizeParticipantDescriptor find(String id) {
+ return (SynchronizeParticipantDescriptor)participants.get(id);
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizePartnerDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizePartnerDescriptor.java
new file mode 100644
index 000000000..5d456d5a2
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizePartnerDescriptor.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.registry;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+
+public class SynchronizePartnerDescriptor {
+ private QualifiedName id;
+ private ImageDescriptor imageDescriptor;
+ public static final String ATT_QUALIFIED_NAME = "qualified_name"; //$NON-NLS-1$
+ public static final String ATT_LOCAL_NAME = "local_name"; //$NON-NLS-1$
+ public static final String ATT_NAME = "name"; //$NON-NLS-1$
+ public static final String ATT_ICON = "icon"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+ private static final String ATT_TYPE = "type"; //$NON-NLS-1$
+
+ private static final String TYPE_STATIC = "static";
+
+ private String label;
+ private String className;
+ private String type;
+ private IConfigurationElement configElement;
+ private String description;
+
+ /**
+ * Create a new ViewDescriptor for an extension.
+ */
+ public SynchronizePartnerDescriptor(IConfigurationElement e, String desc) throws CoreException {
+ configElement = e;
+ description = desc;
+ loadFromExtension();
+ }
+ /**
+ * Return an instance of the declared view.
+ */
+ public IViewPart createView() throws CoreException {
+ Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
+ return (IViewPart) obj;
+ }
+
+ public IConfigurationElement getConfigurationElement() {
+ return configElement;
+ }
+
+ /**
+ * Returns this view's description. This is the value of its <code>"description"</code>
+ * attribute.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ public QualifiedName getId() {
+ return id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ if (imageDescriptor != null)
+ return imageDescriptor;
+ String iconName = configElement.getAttribute(ATT_ICON);
+ if (iconName == null)
+ return null;
+ imageDescriptor = WorkbenchImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName);
+ return imageDescriptor;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public boolean isStatic() {
+ if(type == null) return true;
+ return type.equals(TYPE_STATIC);
+ }
+
+ /**
+ * load a view descriptor from the registry.
+ */
+ private void loadFromExtension() throws CoreException {
+ String qualified_name = configElement.getAttribute(ATT_QUALIFIED_NAME);
+ String local_name = configElement.getAttribute(ATT_LOCAL_NAME);
+ label = configElement.getAttribute(ATT_NAME);
+ className = configElement.getAttribute(ATT_CLASS);
+ type = configElement.getAttribute(ATT_TYPE);
+
+ // Sanity check.
+ if ((label == null) || (className == null) || (local_name == null)) {
+ throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + id, //$NON-NLS-1$
+ null));
+ }
+
+ id = new QualifiedName(qualified_name, local_name);
+ }
+
+ /**
+ * Returns a string representation of this descriptor. For debugging
+ * purposes only.
+ */
+ public String toString() {
+ return "Synchronize Participant(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java
deleted file mode 100644
index 63b7102ea..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-
-class CancelSubscription extends Action {
- private TeamSubscriber subscriber;
- private SynchronizeView view;
-
- public CancelSubscription(SynchronizeView view, TeamSubscriber s) {
- this.subscriber = s;
- this.view = view;
- Utils.initAction(this, "action.cancelSubscriber."); //$NON-NLS-1$
- // don't enable until necessary
- setEnabled(false);
- }
-
- public void run() {
- view.removeSubscriber(subscriber);
- }
-
- public void setSubscriber(TeamSubscriber subscriber) {
- this.subscriber = subscriber;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseChangeFilterAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseChangeFilterAction.java
deleted file mode 100644
index 36fdd1916..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseChangeFilterAction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Created on Jul 11, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ui.Utils;
-
-
-class ChooseChangeFilterAction extends SyncViewerToolbarDropDownAction {
- private final SyncViewerActions actions;
- private SyncViewerChangeFilters filters;
- public void run() {
- Action[] enabled = filters.getActiveFilters();
- Action[] actions = filters.getFilters();
- if(actions.length != enabled.length) {
- filters.setAllEnabled();
- this.actions.refreshFilters();
- }
- }
- public ChooseChangeFilterAction(SyncViewerActions actions, SyncViewerChangeFilters filters) {
- super(filters);
- this.actions = actions;
- this.filters = filters;
- Utils.initAction(this, "action.changeFilters."); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseSubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseSubscriberAction.java
deleted file mode 100644
index c0d88b58d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseSubscriberAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IKeyBindingService;
-
-class ChooseSubscriberAction extends SyncViewerToolbarDropDownAction {
- private final SyncViewerActions actions;
-
- public void run() {
- RefreshAction refresh = new RefreshAction(actions, true /* refresh all */);
- refresh.run();
- }
-
- public ChooseSubscriberAction(SyncViewerActions actions, SyncViewerActionGroup[] actionGroup) {
- super(actionGroup);
- this.actions = actions;
- Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
- IKeyBindingService kbs = actions.getSyncView().getSite().getKeyBindingService();
- Utils.registerAction(kbs, this, "org.eclipse.team.ui.syncview.syncAll"); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CopyAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CopyAction.java
deleted file mode 100644
index 5646fe56f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CopyAction.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.part.ResourceTransfer;
-
-/**
- * This action is a copy of the copy action in org.eclipse.ui.views.navigator
- * (which is not visible)
- */
-public class CopyAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = TeamUIPlugin.ID + ".CopyAction"; //$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- /**
- * System clipboard
- */
- private Clipboard clipboard;
-
- /**
- * Associated paste action. May be <code>null</code>
- */
- private PasteAction pasteAction;
-
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- * @param clipboard a platform clipboard
- */
- public CopyAction(Shell shell, Clipboard clipboard) {
- super(Policy.bind("CopyAction.title")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- Assert.isNotNull(clipboard);
- this.shell = shell;
- this.clipboard = clipboard;
- setToolTipText(Policy.bind("CopyAction.toolTip")); //$NON-NLS-1$
- setId(CopyAction.ID);
- //WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.COPY_ACTION);
- }
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- * @param clipboard a platform clipboard
- * @param pasteAction a paste action
- *
- * @since 2.0
- */
- public CopyAction(Shell shell, Clipboard clipboard, PasteAction pasteAction) {
- this(shell, clipboard);
- this.pasteAction = pasteAction;
- }
- /**
- * The <code>CopyAction</code> implementation of this method defined
- * on <code>IAction</code> copies the selected resources to the
- * clipboard.
- */
- public void run(){
- List selectedResources = getSelectedResources();
- IResource[] resources = (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]);
-
- // Get the file names and a string representation
- final int length = resources.length;
- int actualLength = 0;
- String[] fileNames = new String[length];
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < length; i++) {
- IPath location = resources[i].getLocation();
- // location may be null. See bug 29491.
- if (location != null)
- fileNames[actualLength++] = location.toOSString();
- if (i > 0)
- buf.append("\n"); //$NON-NLS-1$
- buf.append(resources[i].getName());
- }
- // was one or more of the locations null?
- if (actualLength < length) {
- String[] tempFileNames = fileNames;
- fileNames = new String[actualLength];
- for (int i = 0; i < actualLength; i++)
- fileNames[i] = tempFileNames[i];
- }
- setClipboard(resources, fileNames, buf.toString());
-
- // update the enablement of the paste action
- // workaround since the clipboard does not suppot callbacks
- if (pasteAction != null && pasteAction.getStructuredSelection() != null)
- pasteAction.selectionChanged(pasteAction.getStructuredSelection());
- }
- /**
- * Set the clipboard contents. Prompt to retry if clipboard is busy.
- *
- * @param resources the resources to copy to the clipboard
- * @param fileNames file names of the resources to copy to the clipboard
- * @param names string representation of all names
- */
- private void setClipboard(IResource[] resources, String[] fileNames, String names) {
- try {
- // set the clipboard contents
- if (fileNames.length > 0) {
- clipboard.setContents(
- new Object[]{
- resources,
- fileNames,
- names},
- new Transfer[]{
- ResourceTransfer.getInstance(),
- FileTransfer.getInstance(),
- TextTransfer.getInstance()});
- } else {
- clipboard.setContents(
- new Object[]{
- resources,
- names},
- new Transfer[]{
- ResourceTransfer.getInstance(),
- TextTransfer.getInstance()});
- }
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(shell, Policy.bind("CopyAction.errorTitle"), Policy.bind("CopyAction.errorMessage"))) //$NON-NLS-1$ //$NON-NLS-2$
- setClipboard(resources, fileNames, names);
- }
- }
- /**
- * The <code>CopyAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables this action if
- * one or more resources of compatible types are selected.
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection))
- return false;
-
- if (getSelectedNonResources().size() > 0)
- return false;
-
- List selectedResources = getSelectedResources();
- if (selectedResources.size() == 0)
- return false;
-
- boolean projSelected = selectionIsOfType(IResource.PROJECT);
- boolean fileFoldersSelected = selectionIsOfType(IResource.FILE | IResource.FOLDER);
- if (!projSelected && !fileFoldersSelected)
- return false;
-
- // selection must be homogeneous
- if (projSelected && fileFoldersSelected)
- return false;
-
- // must have a common parent
- IContainer firstParent = ((IResource) selectedResources.get(0)).getParent();
- if (firstParent == null)
- return false;
-
- Iterator resourcesEnum = selectedResources.iterator();
- while (resourcesEnum.hasNext()) {
- IResource currentResource = (IResource) resourcesEnum.next();
- // resource must exist
- if (!currentResource.exists())
- return false;
- // ensure common parent
- if (!currentResource.getParent().equals(firstParent))
- return false;
- // resource location must exist
- if (currentResource.getLocation() == null)
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java
deleted file mode 100644
index 7505ecfd1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.actions.ActionContext;
-
-
-class ExpandAllAction extends Action {
- private final SyncViewerActions actions;
- public ExpandAllAction(SyncViewerActions actions) {
- this.actions = actions;
- Utils.initAction(this, "action.expandAll."); //$NON-NLS-1$
- }
- public void run() {
- expandSelection();
- }
- public void update() {
- setEnabled(getTreeViewer() != null && hasSelection());
- }
- protected void expandSelection() {
- AbstractTreeViewer treeViewer = getTreeViewer();
- if (treeViewer != null) {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- treeViewer.expandToLevel(next, AbstractTreeViewer.ALL_LEVELS);
- }
- }
- }
- }
- private AbstractTreeViewer getTreeViewer() {
- Viewer viewer = actions.getSyncView().getViewer();
- if (viewer instanceof AbstractTreeViewer) {
- return (AbstractTreeViewer)viewer;
- }
- return null;
- }
- private ISelection getSelection() {
- ActionContext context = actions.getContext();
- if (context == null) return null;
- return actions.getContext().getSelection();
- }
- private boolean hasSelection() {
- ISelection selection = getSelection();
- return (selection != null && !selection.isEmpty());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java
deleted file mode 100644
index ff6d22750..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ICompareNavigator;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.views.INavigableControl;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionContext;
-
-/**
- * Action to navigate the changes shown in the Synchronize View. This
- * will coordinate change browsing between the view and the compare
- * editors.
- *
- * @since 3.0
- */
-class NavigateAction extends Action {
- private final SyncViewerActions actions;
- private final SynchronizeView synchronizeView;
- private final int direction;
-
- public NavigateAction(SyncViewerActions actions, int direction) {
- this.actions = actions;
- this.synchronizeView = actions.getSyncView();
- this.direction = direction;
-
- IKeyBindingService kbs = synchronizeView.getSite().getKeyBindingService();
- if(direction == INavigableControl.NEXT) {
- Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$
- synchronizeView.getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.NEXT, this);
- } else {
- Utils.initAction(this, "action.navigatePrevious."); //$NON-NLS-1$
- synchronizeView.getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, this);
- }
- }
-
- public void run() {
- navigate();
- }
-
- private ISelection getSelection() {
- ActionContext context = actions.getContext();
- if (context == null) return null;
- return actions.getContext().getSelection();
- }
-
- private void navigate() {
- Viewer viewer = synchronizeView.getViewer();
-
- if(viewer instanceof INavigableControl) {
- SyncInfo info = getSyncInfoFromSelection();
-
- if(info == null) {
- if(((INavigableControl)viewer).gotoDifference(direction)) {
- return;
- } else {
- info = getSyncInfoFromSelection();
- if(info == null) return;
- }
- }
-
- if(info.getLocal().getType() != IResource.FILE) {
- if(! ((INavigableControl)viewer).gotoDifference(direction)) {
- info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(synchronizeView, info, true /* keep focus */);
- }
- return;
- }
-
- IEditorPart editor = OpenInCompareAction.findOpenCompareEditor(synchronizeView.getSite(), info.getLocal());
- boolean atEnd = false;
- CompareEditorInput input;
- ICompareNavigator navigator;
-
- if(editor != null) {
- // if an existing editor is open on the current selection, use it
- input = (CompareEditorInput)editor.getEditorInput();
- navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class);
- if(navigator != null) {
- if(navigator.selectChange(direction == INavigableControl.NEXT)) {
- if(! ((INavigableControl)viewer).gotoDifference(direction)) {
- info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(synchronizeView, info, true /* keep focus */);
- }
- }
- }
- } else {
- // otherwise, select the next change and open a compare editor which will automatically
- // show the first change.
- OpenInCompareAction.openCompareEditor(synchronizeView, info, true /* keep focus */);
- }
- }
- return;
- }
-
- private SyncInfo getSyncInfoFromSelection() {
- IStructuredSelection selection = ((IStructuredSelection)getSelection());
- if(selection == null) return null;
- Object obj = selection.getFirstElement();
- SyncInfo info = OpenInCompareAction.getSyncInfo(obj);
- return info;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/PasteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/PasteAction.java
deleted file mode 100644
index 11d865121..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/PasteAction.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.util.List;
-
-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.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.actions.CopyFilesAndFoldersOperation;
-import org.eclipse.ui.actions.CopyProjectOperation;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.part.ResourceTransfer;
-
-/**
- * This action is a copy of the paste action in org.eclipse.ui.views.navigator
- * (which is not visible)
- */
-public class PasteAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = TeamUIPlugin.ID + ".PasteAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- /**
- * System clipboard
- */
- private Clipboard clipboard;
-
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
- public PasteAction(Shell shell, Clipboard clipboard) {
- super(Policy.bind("PasteAction.title")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- Assert.isNotNull(clipboard);
- this.shell = shell;
- this.clipboard = clipboard;
- setToolTipText(Policy.bind("PasteAction.toolTip")); //$NON-NLS-1$
- setId(PasteAction.ID);
- // WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.PASTE_ACTION);
- }
- /**
- * Returns the actual target of the paste action. Returns null
- * if no valid target is selected.
- *
- * @return the actual target of the paste action
- */
- private IResource getTarget() {
- List selectedResources = getSelectedResources();
-
- for (int i = 0; i < selectedResources.size(); i++) {
- IResource resource = (IResource)selectedResources.get(i);
-
- if (resource instanceof IProject && !((IProject)resource).isOpen())
- return null;
- if (resource.getType() == IResource.FILE)
- resource = resource.getParent();
- if (resource != null)
- return resource;
- }
- return null;
- }
- /**
- * Returns whether any of the given resources are linked resources.
- *
- * @param resources resource to check for linked type. may be null
- * @return true=one or more resources are linked. false=none of the
- * resources are linked
- */
- private boolean isLinked(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].isLinked())
- return true;
- }
- return false;
- }
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- // try a resource transfer
- ResourceTransfer resTransfer = ResourceTransfer.getInstance();
- IResource[] resourceData = (IResource[])clipboard.getContents(resTransfer);
-
- if (resourceData != null && resourceData.length > 0) {
- if (resourceData[0].getType() == IResource.PROJECT) {
- // enablement checks for all projects
- for (int i = 0; i < resourceData.length; i++) {
- CopyProjectOperation operation = new CopyProjectOperation(this.shell);
- operation.copyProject((IProject) resourceData[i]);
- }
- } else {
- // enablement should ensure that we always have access to a container
- IContainer container = getContainer();
-
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(this.shell);
- operation.copyResources(resourceData, container);
- }
- return;
- }
-
- // try a file transfer
- FileTransfer fileTransfer = FileTransfer.getInstance();
- String[] fileData = (String[])clipboard.getContents(fileTransfer);
-
- if (fileData != null) {
- // enablement should ensure that we always have access to a container
- IContainer container = getContainer();
-
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(this.shell);
- operation.copyFiles(fileData, container);
- }
- }
- /**
- * Returns the container to hold the pasted resources.
- */
- private IContainer getContainer() {
- List selection = getSelectedResources();
- if (selection.get(0) instanceof IFile)
- return ((IFile)selection.get(0)).getParent();
- else
- return (IContainer)selection.get(0);
- }
- /**
- * The <code>PasteAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables this action if
- * a resource compatible with what is on the clipboard is selected.
- *
- * -Clipboard must have IResource or java.io.File
- * -Projects can always be pasted if they are open
- * -Workspace folder may not be copied into itself
- * -Files and folders may be pasted to a single selected folder in open
- * project or multiple selected files in the same folder
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection))
- return false;
-
- // clipboard must have resources or files
- ResourceTransfer resTransfer = ResourceTransfer.getInstance();
- IResource[] resourceData = (IResource[])clipboard.getContents(resTransfer);
- boolean isProjectRes = resourceData != null
- && resourceData.length > 0
- && resourceData[0].getType() == IResource.PROJECT;
-
- if (isProjectRes) {
- for (int i = 0; i < resourceData.length; i++) {
- // make sure all resource data are open projects
- // can paste open projects regardless of selection
- if (resourceData[i].getType() != IResource.PROJECT || ((IProject) resourceData[i]).isOpen() == false)
- return false;
- }
- return true;
- }
-
- if (getSelectedNonResources().size() > 0)
- return false;
-
- IResource targetResource = getTarget();
- // targetResource is null if no valid target is selected (e.g., open project)
- // or selection is empty
- if (targetResource == null)
- return false;
-
- // can paste files and folders to a single selection (file, folder,
- // open project) or multiple file selection with the same parent
- List selectedResources = getSelectedResources();
- if (selectedResources.size() > 1) {
- for (int i = 0; i < selectedResources.size(); i++) {
- IResource resource = (IResource)selectedResources.get(i);
- if (resource.getType() != IResource.FILE)
- return false;
- if (!targetResource.equals(resource.getParent()))
- return false;
- }
- }
- if (resourceData != null) {
- // linked resources can only be pasted into projects
- if (isLinked(resourceData) && targetResource.getType() != IResource.PROJECT)
- return false;
-
- if (targetResource.getType() == IResource.FOLDER) {
- // don't try to copy folder to self
- for (int i = 0; i < resourceData.length; i++) {
- if (targetResource.equals(resourceData[i]))
- return false;
- }
- }
- return true;
- }
- TransferData[] transfers = clipboard.getAvailableTypes();
- FileTransfer fileTransfer = FileTransfer.getInstance();
- for (int i = 0; i < transfers.length; i++) {
- if (fileTransfer.isSupportedType(transfers[i]))
- return true;
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java
deleted file mode 100644
index 6178f75d2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IPropertyListener;
-
-class SelectAllAction extends Action implements IPropertyListener {
- private final SynchronizeView viewer;
-
- public SelectAllAction(SynchronizeView viewer) {
- this.viewer = viewer;
- viewer.addPropertyListener(this);
- }
-
- public void run() {
- viewer.selectAll();
- }
-
- public void propertyChanged(Object source, int propId) {
- if(propId == SynchronizeView.PROP_VIEWTYPE) {
- setEnabled(viewer.getCurrentViewType() == SynchronizeView.TABLE_VIEW);
- viewer.getViewSite().getActionBars().updateActionBars();
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java
deleted file mode 100644
index 37686d89b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.ISynchronizeView;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-
-public class SyncAllAction implements IWorkbenchWindowPulldownDelegate2 {
-
- private IWorkbenchWindow window;
- private Menu createdMenu;
-
- class SubscriberAction extends Action {
- TeamSubscriber subscriber;
- SubscriberAction(TeamSubscriber s) {
- this.subscriber = s;
- setText(s.getName());
- }
- public void run() {
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(window.getActivePage());
- if(view != null) {
- view.refreshWithRemote(subscriber);
- }
- }
- }
-
- public void run(IAction action) {
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(window.getActivePage());
- if(view != null) {
- view.refreshWithRemote();
- }
- }
-
- public void dispose() {
- if(getCreatedMenu() != null) {
- getCreatedMenu().dispose();
- }
- }
-
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- private void createAction(Menu parent, IAction action, int count) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- if (count != -1) {
- label.append('&');
- label.append(count);
- label.append(' ');
- }
- label.append(action.getText());
- action.setText(label.toString());
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- public Menu getMenu(Menu parent) {
- dispose();
- setCreatedMenu(new Menu(parent));
- fillMenu();
- initMenu();
- return getCreatedMenu();
- }
-
- private Menu getCreatedMenu() {
- return createdMenu;
- }
-
- private void setCreatedMenu(Menu menu) {
- createdMenu = menu;
- }
-
- private void fillMenu() {
- TeamSubscriber[] subscribers = TeamSubscriber.getSubscriberManager().getSubscribers();
- for (int i = 0; i < subscribers.length; i++) {
- TeamSubscriber subscriber = subscribers[i];
- createAction(getCreatedMenu(), new SubscriberAction(subscriber), i + 1);
- }
- if(subscribers.length > 0 ) {
- new Separator().fill(getCreatedMenu(), -1);
- }
- createAction(getCreatedMenu(), new SyncViewerShowPreferencesAction(window.getShell()), -1);
- }
-
- /**
- * Creates the menu for the action
- */
- private void initMenu() {
- // Add listener to repopulate the menu each time
- // it is shown to reflect changes in selection or active perspective
- getCreatedMenu().addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu m = (Menu)e.widget;
- MenuItem[] items = m.getItems();
- for (int i=0; i < items.length; i++) {
- items[i].dispose();
- }
- fillMenu();
- }
- });
- }
-
- public Menu getMenu(Control parent) {
- dispose();
- setCreatedMenu(new Menu(parent));
- fillMenu();
- initMenu();
- return getCreatedMenu();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerAction.java
deleted file mode 100644
index 89f897ced..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewPart;
-
-/**
- * This class acts as the superclass for all actions in the SynchronizeView
- */
-public abstract class SyncViewerAction extends Action {
-
- private IViewPart viewPart;
- private ISelection selection;
-
- /**
- * @param text
- */
- public SyncViewerAction(IViewPart viewPart, String label) {
- super(label);
- this.viewPart = viewPart;
- }
-
- public Shell getShell() {
- return viewPart.getSite().getShell();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActionGroup.java
deleted file mode 100644
index 3bbbf08d4..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActionGroup.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * This class acts as the superclass fo all action groups that appear in the SynchronizeView
- */
-public abstract class SyncViewerActionGroup extends ActionGroup {
-
- private SynchronizeView syncView;
-
- protected SyncViewerActionGroup(SynchronizeView syncView) {
- this.syncView = syncView;
- }
-
- /**
- * Return the SynchronizeView for this action group
- * @return
- */
- public SynchronizeView getSyncView() {
- return syncView;
- }
-
- /**
- * Save the state of the action group into the given IMemento
- * @param memento
- */
- public void save(IMemento memento) {
- }
-
- /**
- * Restore the state of the action group from the IMemento
- * @param memento
- */
- public void restore(IMemento memento) {
- }
-
- public void setContext(ActionContext context) {
- super.setContext(context);
- initializeActions();
- }
-
- public void addContext(ActionContext context) {
- }
-
- public void removeContext(ActionContext context) {
- }
-
- protected void initializeActions() {
- }
-
- protected SubscriberInput getSubscriberContext() {
- ActionContext input = getContext();
- if(input != null) {
- return (SubscriberInput)input.getInput();
- }
- return null;
- }
-
- /**
- * Method invoked from a SyncViewerToolbarDropDownAction
- *
- * @param menu
- */
- public void fillMenu(SyncViewerToolbarDropDownAction action) {
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
deleted file mode 100644
index ea26cac59..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.INavigableControl;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.WorkingSetFilterActionGroup;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * This class managers the actions associated with the SynchronizeView class.
- */
-public class SyncViewerActions extends SyncViewerActionGroup {
-
- // action groups for view filtering
- private SyncViewerDirectionFilters directionsFilters;
- private SyncViewerChangeFilters changeFilters;
- private SyncViewerComparisonCriteria comparisonCriteria;
- private SyncViewerSubscriberListActions subscriberInputs;
-
- private WorkingSetFilterActionGroup workingSetGroup;
- private OpenWithActionGroup openWithActionGroup;
-
- private SyncViewerToolbarDropDownAction chooseSubscriberAction;
- private SyncViewerToolbarDropDownAction chooseChangeFilterAction;
-
- private RefactorActionGroup refactoringActions;
-
- // other view actions
- private Action collapseAll;
- private Action refreshSelectionAction;
- private Action refreshViewContents;
-
- private Action toggleLayoutFlatAction;
- private Action toggleLayoutHierarchicalAction;
- private ExpandAllAction expandAll;
- private SelectAllAction selectAllAction;
- private NavigateAction gotoNext;
- private NavigateAction gotoPrevious;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
- */
- public void updateActionBars() {
- super.updateActionBars();
- changeFilters.updateActionBars();
- directionsFilters.updateActionBars();
- comparisonCriteria.updateActionBars();
- subscriberInputs.updateActionBars();
- refactoringActions.updateActionBars();
- expandAll.update();
- }
-
- public SyncViewerActions(SynchronizeView viewer) {
- super(viewer);
- createActions();
- }
-
- private void createActions() {
- // initialize action groups
- SynchronizeView syncView = getSyncView();
- directionsFilters = new SyncViewerDirectionFilters(syncView, this);
- changeFilters = new SyncViewerChangeFilters(syncView, this);
-
- // initialize the dropdown for choosing a subscriber
- subscriberInputs = new SyncViewerSubscriberListActions(syncView);
- comparisonCriteria = new SyncViewerComparisonCriteria(syncView);
- chooseSubscriberAction = new ChooseSubscriberAction(this, new SyncViewerActionGroup[] {subscriberInputs, comparisonCriteria});
-
- // initialize the dropdown for choosing a change type filter
- chooseChangeFilterAction = new ChooseChangeFilterAction(this, changeFilters);
-
- // initialize other actions
- refreshSelectionAction = new RefreshAction(this, false);
- refreshSelectionAction.setEnabled(false);
-
- selectAllAction = new SelectAllAction(getSyncView());
- getSyncView().getViewSite().getActionBars().setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, selectAllAction);
-
- expandAll = new ExpandAllAction(this);
-
- gotoNext = new NavigateAction(this, INavigableControl.NEXT);
- gotoPrevious = new NavigateAction(this, INavigableControl.PREVIOUS);
-
- toggleLayoutFlatAction = new ToggleViewAction(getSyncView(), SynchronizeView.TABLE_VIEW);
- toggleLayoutHierarchicalAction = new ToggleViewAction(getSyncView(), SynchronizeView.TREE_VIEW);
-
- collapseAll = new Action() {
- public void run() {
- getSyncView().collapseAll();
- }
- };
- Utils.initAction(collapseAll, "action.collapseAll."); //$NON-NLS-1$
-
- refreshViewContents = new Action() {
- public void run() {
- SubscriberInput input = getSyncView().getInput();
- if(input != null) {
- try {
- input.reset();
- } catch (TeamException e) {
- Utils.handle(e);
- }
- }
- }
- };
- Utils.initAction(refreshViewContents, "action.refreshViewContents."); //$NON-NLS-1$
-
- IPropertyChangeListener workingSetUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
-
- if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET.equals(property)) {
- Object newValue = event.getNewValue();
-
- if (newValue instanceof IWorkingSet) {
- getSyncView().workingSetChanged((IWorkingSet) newValue);
- }
- else
- if (newValue == null) {
- getSyncView().workingSetChanged(null);
- }
- }
- }
- };
- workingSetGroup = new WorkingSetFilterActionGroup(syncView.getSite().getShell(), workingSetUpdater);
- openWithActionGroup = new OpenWithActionGroup(getSyncView());
- refactoringActions = new RefactorActionGroup(getSyncView());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- super.fillActionBars(actionBars);
-
- // Setup toolbars
- IToolBarManager manager = actionBars.getToolBarManager();
- manager.add(chooseSubscriberAction);
- manager.add(new Separator());
- directionsFilters.fillActionBars(actionBars);
- manager.add(new Separator());
- manager.add(collapseAll);
- manager.add(gotoNext);
- manager.add(gotoPrevious);
-
- // Setup drop down menu
- IMenuManager dropDownMenu = actionBars.getMenuManager();
- workingSetGroup.fillActionBars(actionBars);
- dropDownMenu.add(refreshViewContents);
- dropDownMenu.add(new Separator());
-
- MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$
- layoutMenu.add(toggleLayoutFlatAction);
- layoutMenu.add(toggleLayoutHierarchicalAction);
- dropDownMenu.add(layoutMenu);
- dropDownMenu.add(new Separator());
- dropDownMenu.add(new SyncViewerShowPreferencesAction(getSyncView().getSite().getShell()));
- refactoringActions.fillActionBars(actionBars);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager manager) {
- super.fillContextMenu(manager);
- openWithActionGroup.fillContextMenu(manager);
- manager.add(new Separator());
- manager.add(expandAll);
- manager.add(new Separator());
- refactoringActions.fillContextMenu(manager);
- manager.add(new Separator());
- manager.add(refreshSelectionAction);
- manager.add(new Separator("SubscriberActionsGroup1")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup2")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup3")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup4")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup5")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup6")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup7")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup8")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup9")); //$NON-NLS-1$
- // Other plug-ins can contribute there actions here
- manager.add(new Separator("Additions")); //$NON-NLS-1$
- }
-
- public void refreshFilters() {
- final SubscriberInput input = getSubscriberContext();
- if(input != null) {
- getSyncView().updateInputFilter(directionsFilters.getDirectionFilter(), changeFilters.getChangeFilters());
- }
- }
-
- public void open() {
- openWithActionGroup.openInCompareEditor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.actions.SyncViewerActionGroup#restore(org.eclipse.ui.IMemento)
- */
- public void restore(IMemento memento) {
- if(memento == null) return;
- super.restore(memento);
- changeFilters.restore(memento);
- directionsFilters.restore(memento);
- comparisonCriteria.restore(memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.actions.SyncViewerActionGroup#save(org.eclipse.ui.IMemento)
- */
- public void save(IMemento memento) {
- if(memento == null) return;
- super.save(memento);
- changeFilters.save(memento);
- directionsFilters.save(memento);
- comparisonCriteria.save(memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#initializeActions()
- */
- protected void initializeActions() {
- SubscriberInput input = getSubscriberContext();
- refreshSelectionAction.setEnabled(input != null);
- chooseSubscriberAction.setEnabled(input != null);
- chooseChangeFilterAction.setEnabled(input != null);
- collapseAll.setEnabled(input != null);
- toggleLayoutFlatAction.setEnabled(input != null);
- toggleLayoutHierarchicalAction.setEnabled(input != null);
- // refresh the selected filter
- refreshFilters();
- }
-
- /* (non-Javadoc)
- * @see ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
- */
- public void setContext(ActionContext context) {
- changeFilters.setContext(context);
- directionsFilters.setContext(context);
- comparisonCriteria.setContext(context);
- subscriberInputs.setContext(context);
- openWithActionGroup.setContext(context);
-
- // causes initializeActions to be called. Must be called after
- // setting the context for contained groups.
- super.setContext(context);
- }
-
- /* (non-Javadoc)
- * @see ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
- */
- public void addContext(ActionContext context) {
- subscriberInputs.addContext(context);
- }
-
- public void removeContext(ActionContext context) {
- subscriberInputs.removeContext(context);
- }
-
- /**
- * This method sets the working set through the workingSetGroup
- * which will result in a call to changeWorkingSet().
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- if (workingSet != null) {
- PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(workingSet);
- }
- workingSetGroup.setWorkingSet(workingSet);
- }
-
- /**
- * Sets the current mode shown in the sync view.
- * @param mode the mode id
- */
- public void setMode(int mode) {
- directionsFilters.setCurrentMode(mode);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerChangeFilters.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerChangeFilters.java
deleted file mode 100644
index 9feee20b2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerChangeFilters.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-
-/**
- * This class provides a set of actions that support sync set filtering by
- * change type. Changing the change type only requires setting a new
- * filter on the sync set.
- */
-public class SyncViewerChangeFilters extends SyncViewerActionGroup {
-
- // array of actions for filtering by change type (additions, deletions and changes)
- private ChangeFilterAction[] actions;
- private SyncViewerActions actionGroup;
-
- /**
- * Action for filtering by change type.
- */
- class ChangeFilterAction extends Action {
- // The SyncInfo change constant associated with the change type
- private int changeFilter;
- public ChangeFilterAction(String prefix, int changeFilter) {
- this.changeFilter = changeFilter;
- Utils.initAction(this, prefix);
- }
- public void run() {
- refreshFilters();
- }
- public int getChangeFilter() {
- return changeFilter;
- }
- }
-
- protected SyncViewerChangeFilters(SynchronizeView viewer, SyncViewerActions actionGroup) {
- super(viewer);
- this.actionGroup = actionGroup;
- createActions();
- }
-
- private void createActions() {
- ChangeFilterAction additions = new ChangeFilterAction("action.changeFilterShowAdditions.", SyncInfo.ADDITION); //$NON-NLS-1$
- additions.setChecked(true);
- ChangeFilterAction deletions = new ChangeFilterAction("action.changeFilterShowDeletions.", SyncInfo.DELETION); //$NON-NLS-1$
- deletions.setChecked(true);
- ChangeFilterAction changes = new ChangeFilterAction("action.changeFilterShowChanges.", SyncInfo.CHANGE); //$NON-NLS-1$
- changes.setChecked(true);
- actions = new ChangeFilterAction[] { additions, deletions, changes };
- }
-
- /**
- * Get the current set of active change filters
- */
- public int[] getChangeFilters() {
- // Determine how many change types are checked
- int count = 0;
- for (int i = 0; i < actions.length; i++) {
- ChangeFilterAction action = actions[i];
- if (action.isChecked()) {
- count++;
- }
- }
- // Create an array of checked change types
- int[] changeFilters = new int[count];
- count = 0;
- for (int i = 0; i < actions.length; i++) {
- ChangeFilterAction action = actions[i];
- if (action.isChecked()) {
- changeFilters[count++] = action.getChangeFilter();
- }
- }
- return changeFilters;
- }
-
- public void fillMenu(SyncViewerToolbarDropDownAction action) {
- super.fillMenu(action);
- for (int i = 0; i < actions.length; i++) {
- action.add(actions[i]);
- }
- }
-
- /**
- * Return all the actions for filtering by change type
- * @return
- */
- public Action[] getFilters() {
- return actions;
- }
-
- /**
- * Return all the active change types
- * @return
- */
- public Action[] getActiveFilters() {
- List result = new ArrayList();
- for (int i = 0; i < actions.length; i++) {
- Action action = actions[i];
- if (action.isChecked()) {
- result.add(action);
- }
- }
- return (Action[]) result.toArray(new Action[result.size()]);
- }
-
- /**
- * Change the active change types to those in the provided array
- * @param results
- */
- public void setActiveFilters(Object[] results) {
- for (int i = 0; i < actions.length; i++) {
- Action action = actions[i];
- boolean active = false;
- for (int j = 0; j < results.length; j++) {
- Object object = results[j];
- if (object == action) {
- active = true;
- break;
- }
- }
- action.setChecked(active);
- }
- }
-
- public void setAllEnabled() {
- for (int i = 0; i < actions.length; i++) {
- actions[i].setChecked(true);
- }
- }
-
- public void refreshFilters() {
- actionGroup.refreshFilters();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
deleted file mode 100644
index 20d63b96a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ComparisonCriteria;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-
-/**
- * This action group allows the user to choose one or more comparison critera
- * to be applied to a comparison
- */
-public class SyncViewerComparisonCriteria extends SyncViewerActionGroup {
-
- private static final String MEMENTO_KEY = "SelectedComparisonCriteria"; //$NON-NLS-1$
-
- private ComparisonCriteria[] criteria;
- private ComparisonCriteriaAction[] actions;
-
- /**
- * Action for filtering by change type.
- */
- class ComparisonCriteriaAction extends Action {
- private ComparisonCriteria criteria;
- public ComparisonCriteriaAction(ComparisonCriteria criteria) {
- super(criteria.getName(), Action.AS_RADIO_BUTTON);
- this.criteria = criteria;
- }
- public void run() {
- SyncViewerComparisonCriteria.this.activate(this);
- }
- public ComparisonCriteria getComparisonCriteria() {
- return criteria;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#fillMenu(org.eclipse.team.internal.ui.sync.actions.SyncViewerToolbarDropDownAction)
- */
- public void fillMenu(SyncViewerToolbarDropDownAction dropDown) {
- super.fillMenu(dropDown);
- if(getSubscriberContext() != null) {
- for (int i = 0; i < actions.length; i++) {
- ComparisonCriteriaAction action = actions[i];
- dropDown.add(action);
- }
- }
- }
-
- public SyncViewerComparisonCriteria(SynchronizeView syncView) {
- super(syncView);
- setContext(null);
- }
-
- /**
- * @param action
- */
- public void activate(final ComparisonCriteriaAction activatedAction) {
- for (int i = 0; i < actions.length; i++) {
- ComparisonCriteriaAction action = actions[i];
- action.setChecked(activatedAction == action);
- }
- final SynchronizeView view = getSyncView();
- view.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // when the comparison criteria changes, recalculate the entire sync set based on
- // the new input.
- SubscriberInput input = getSubscriberContext();
- input.getSubscriber().setCurrentComparisonCriteria(activatedAction.getComparisonCriteria().getId());
- input.reset();
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- }
-
- public void initializeActions() {
- SubscriberInput input = getSubscriberContext();
- if(input != null) {
- this.criteria = input.getSubscriber().getComparisonCriterias();
- this.actions = new ComparisonCriteriaAction[criteria.length];
- for (int i = 0; i < criteria.length; i++) {
- ComparisonCriteria c = criteria[i];
- actions[i] = new ComparisonCriteriaAction(c);
- actions[i].setChecked(c == getSyncView().getInput().getSubscriber().getCurrentComparisonCriteria());
- }
- } else {
- // there aren't any comparison criterias to show!
- this.actions = null;
- this.criteria = null;
-
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- super.fillContextMenu(menu);
- if(getSubscriberContext() != null) {
- for (int i = 0; i < actions.length; i++) {
- ComparisonCriteriaAction action = actions[i];
- menu.add(action);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java
deleted file mode 100644
index 4d5750e52..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.team.ui.sync.ISynchronizeView;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.actions.ActionContext;
-
-/**
- * This ActionGroup provides filtering of a sync set by change direction.
- * The actions are presented to the user as toolbar buttons where only one
- * button is active at a time
- */
-public class SyncViewerDirectionFilters extends SyncViewerActionGroup {
-
- private static final String MEMENTO_KEY = "SyncViewerDirectionFilters"; //$NON-NLS-1$
-
- // An array of the selection actions for the modes (indexed by mode constant)
- private List actions = new ArrayList(3);
- private SyncViewerActions refreshGroup;
-
- private DirectionFilterAction incomingMode;
- private DirectionFilterAction outgoingMode;
- private DirectionFilterAction bothMode;
- private DirectionFilterAction conflictsMode;
-
- private final static int[] DEFAULT_FILTER = new int[] {SyncInfo.INCOMING, SyncInfo.OUTGOING, SyncInfo.CONFLICTING};
-
- /**
- * Action for toggling the sync mode.
- */
- class DirectionFilterAction extends Action {
- // The sync mode that this action enables
- private int[] syncMode;
- private boolean toggled;
- private int modeId;
- public DirectionFilterAction(String prefix,String commandId, int[] mode, int modeId) {
- super("", AS_RADIO_BUTTON); //$NON-NLS-1$
- this.syncMode = mode;
- this.modeId = modeId;
- Utils.initAction(this, prefix);
- Action a = new Action() {
- public void run() {
- DirectionFilterAction.this.run();
- }
- };
- IKeyBindingService kbs = refreshGroup.getSyncView().getSite().getKeyBindingService();
- Utils.registerAction(kbs, a, commandId); //$NON-NLS-1$
- }
- public void run() {
- // checkMode() is called because programatic checking of radio buttons doesn't
- // consider radio buttons, hence breaks the radio-button behavior. As a workaround
- // we have to manually check/uncheck the set instead.
- checkMode(getModeId());
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_SELECTED_MODE, modeId);
- updateFilter(this);
- }
- public int[] getFilter() {
- return syncMode;
- }
- public int getModeId() {
- return modeId;
- }
- }
-
- protected SyncViewerDirectionFilters(SynchronizeView viewer, SyncViewerActions refreshGroup) {
- super(viewer);
- this.refreshGroup = refreshGroup;
- createActions();
- }
-
- /**
- * Sets up the sync modes and the actions for switching between them.
- */
- private void createActions() {
- // Create the actions
- incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", new int[] {SyncInfo.INCOMING, SyncInfo.CONFLICTING}, ISynchronizeView.INCOMING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(incomingMode);
-
- outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING}, ISynchronizeView.OUTGOING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(outgoingMode);
-
- bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING}, ISynchronizeView.BOTH_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(bothMode);
-
- conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", new int[] {SyncInfo.CONFLICTING}, ISynchronizeView.CONFLICTING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(conflictsMode);
-
- updateEnablement(null);
- }
-
- public int[] getDirectionFilter() {
- int[] filters = new int[actions.size()];
- int i = 0;
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction)it.next();
- if(action.isChecked()) {
- return action.getFilter();
- }
- }
- // should never happen because buttons are radio
- Assert.isTrue(true);
- return new int[0];
- }
-
- boolean isSet(int[] filters, int[] afilter) {
- for (int i = 0; i < filters.length; i++) {
- for (int j = 0; i < afilter.length; i++) {
- if(filters[i] == afilter[j]) return true;
- }
- }
- return false;
- }
-
- void updateFilter(DirectionFilterAction action) {
- getRefreshGroup().refreshFilters();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- super.fillActionBars(actionBars);
- IToolBarManager toolBar = actionBars.getToolBarManager();
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction) it.next();
- toolBar.add(action);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.actions.SyncViewerActionGroup#restore(org.eclipse.ui.IMemento)
- */
- public void restore(IMemento memento) {
- super.restore(memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.actions.SyncViewerActionGroup#save(org.eclipse.ui.IMemento)
- */
- public void save(IMemento memento) {
- super.save(memento);
- }
-
- public SyncViewerActions getRefreshGroup() {
- return refreshGroup;
- }
-
- /*
- * Only enable actions if a context is available. In addition disable the outgoing filter if
- * the subscriber doesn't support releasing changes to it.
- */
- private void updateEnablement(SubscriberInput input) {
- if(input == null) {
- incomingMode.setEnabled(false);
- outgoingMode.setEnabled(false);
- conflictsMode.setEnabled(false);
- bothMode.setEnabled(false);
- } else {
- TeamSubscriber s = input.getSubscriber();
- incomingMode.setEnabled(true);
- conflictsMode.setEnabled(true);
- bothMode.setEnabled(true);
- if( ! s.isReleaseSupported()) {
- outgoingMode.setEnabled(false);
- } else {
- outgoingMode.setEnabled(true);
- }
- int defaultMode = TeamUIPlugin.getPlugin().getPreferenceStore().getInt(IPreferenceIds.SYNCVIEW_SELECTED_MODE);
- bothMode.setChecked(false);
- incomingMode.setChecked(false);
- outgoingMode.setChecked(false);
- conflictsMode.setChecked(false);
- switch(defaultMode) {
- case ISynchronizeView.INCOMING_MODE: incomingMode.setChecked(true); break;
- case ISynchronizeView.CONFLICTING_MODE: conflictsMode.setChecked(true); break;
- case ISynchronizeView.BOTH_MODE: bothMode.setChecked(true); break;
- case ISynchronizeView.OUTGOING_MODE:
- // handle the case where the outgoing mode is disabled.
- if(outgoingMode.isEnabled()) {
- outgoingMode.setChecked(true);
- } else {
- incomingMode.setChecked(true);
- }
- break;
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#initializeActions()
- */
- protected void initializeActions() {
- SubscriberInput input = getSubscriberContext();
- if(input != null) {
- updateEnablement(input);
- } else {
- updateEnablement(null);
- }
- super.initializeActions();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#removeContext(org.eclipse.ui.actions.ActionContext)
- */
- public void removeContext(ActionContext context) {
- SubscriberInput input = getSubscriberContext();
- if(input != null) {
- updateEnablement(null);
- }
- }
-
- public void setCurrentMode(int mode) {
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction)it.next();
- if(action.getModeId() == mode) {
- action.run();
- }
- }
- }
-
- private void checkMode(int mode) {
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction)it.next();
- if(action.getModeId() == mode) {
- action.setChecked(true);
- } else {
- action.setChecked(false);
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java
deleted file mode 100644
index 827b977a0..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.actions.ActionContext;
-
-/**
- * SyncViewerSubscriberListActions
- */
-public class SyncViewerSubscriberListActions extends SyncViewerActionGroup {
-
- // {QualifiedName:subscriber id -> SubscriberInput}
- private Map actions = new HashMap();
- private SubscriberInput activeInput = null;
- private CancelSubscription cancelAction;
-
- /**
- * Action for filtering by change type.
- */
- class SwitchSubscriberAction extends Action {
- private SubscriberInput input;
- public SwitchSubscriberAction(SubscriberInput input) {
- super(input.getSubscriber().getName(), Action.AS_RADIO_BUTTON);
- this.input = input;
- }
- public void run() {
- // Uncheck and let the activate check once the activate succeeds
- setChecked(false);
- SyncViewerSubscriberListActions.this.activate(this);
- }
- public SubscriberInput getSubscriberInput() {
- return input;
- }
- }
-
- public SyncViewerSubscriberListActions(SynchronizeView syncView) {
- super(syncView);
- setContext(null);
- }
-
- public void activate(SwitchSubscriberAction activatedAction) {
- if(activeInput == null || ! activatedAction.getSubscriberInput().getSubscriber().getId().equals(activeInput.getSubscriber().getId())) {
- getSyncView().initializeSubscriberInput(activatedAction.getSubscriberInput());
- // The action check state will be updated when the view invokes
- // setContext which then invokes initializeActions
- } else {
- activatedAction.setChecked(true);
- }
- }
-
- /*
- * Called when a context is enabled for the view.
- * (non-Javadoc)
- * @see SyncViewerActionGroup#initializeActions()
- */
- public void initializeActions() {
- SubscriberInput input = getSubscriberContext();
- if (input != null) {
- for (Iterator it = actions.values().iterator(); it.hasNext();) {
- SwitchSubscriberAction action =
- (SwitchSubscriberAction) it.next();
- boolean checked = action.getSubscriberInput().getSubscriber().getId().equals(
- input.getSubscriber().getId());
- action.setChecked(checked);
- if(checked) {
- activeInput = input;
- }
- }
- cancelAction.setEnabled(input.getSubscriber().isCancellable());
- cancelAction.setSubscriber(input.getSubscriber());
- } else {
- if(cancelAction != null)
- cancelAction.setEnabled(false);
- }
- }
-
- /*
- * Checking of the currently active subscriber input is done when the context is set
- * in the initializeActions method.
- * (non-Javadoc)
- * @see fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- super.fillContextMenu(menu);
- if (! actions.isEmpty()) {
- for (Iterator it = actions.values().iterator(); it.hasNext();) {
- SwitchSubscriberAction action = (SwitchSubscriberAction) it.next();
- menu.add(action);
- }
- if(cancelAction != null) {
- menu.add(new Separator());
- menu.add(cancelAction);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#addContext(org.eclipse.ui.actions.ActionContext)
- */
- public void addContext(ActionContext context) {
- boolean enableFirstContext = actions.isEmpty();
- SubscriberInput input = (SubscriberInput)context.getInput();
- SwitchSubscriberAction action = new SwitchSubscriberAction(input);
- actions.put(input.getSubscriber().getId(), action);
- if(cancelAction == null) {
- cancelAction = new CancelSubscription(getSyncView(), input.getSubscriber());
- }
- if(enableFirstContext) {
- activate(action);
- }
- }
-
- /*
- * Method to add menu items to a toolbar drop down action
- */
- public void fillMenu(SyncViewerToolbarDropDownAction dropDown) {
- super.fillMenu(dropDown);
- if (! actions.isEmpty()) {
- for (Iterator it = actions.values().iterator(); it.hasNext();) {
- SwitchSubscriberAction action = (SwitchSubscriberAction) it.next();
- dropDown.add(action);
- }
- if(cancelAction != null) {
- dropDown.add(new Separator());
- dropDown.add(cancelAction);
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#removeContext(org.eclipse.ui.actions.ActionContext)
- */
- public void removeContext(ActionContext context) {
- SubscriberInput input = (SubscriberInput)context.getInput();
- actions.remove(input.getSubscriber().getId());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerToolbarDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerToolbarDropDownAction.java
deleted file mode 100644
index 5416f42c8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerToolbarDropDownAction.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * This class allows SyncViewerActionGroups to be place in a toolbar as
- * drop down menus
- */
-public class SyncViewerToolbarDropDownAction extends Action implements IMenuCreator {
-
- SyncViewerActionGroup[] actionGroup;
- private Menu fMenu;
-
- public SyncViewerToolbarDropDownAction(SyncViewerActionGroup actionGroup) {
- this.actionGroup = new SyncViewerActionGroup[] {actionGroup};
- setMenuCreator(this);
- }
-
- public SyncViewerToolbarDropDownAction(SyncViewerActionGroup[] actionGroups) {
- this.actionGroup = actionGroups;
- setMenuCreator(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- // TODO: The menu is recreated each time. Another possibility would be to
- // cache the menu and reset it at the appropriate time
- if (fMenu != null)
- fMenu.dispose();
-
- fMenu= new Menu(parent);
- fillMenu();
- return fMenu;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- private void fillMenu() {
- for (int i = 0; i < actionGroup.length; i++) {
- if(i != 0 && i < (actionGroup.length) && getMenu().getItemCount() > 0) {
- new Separator().fill(getMenu(), -1);
- }
- actionGroup[i].fillMenu(this);
- }
- }
-
- public void add(Action action) {
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(getMenu(), -1);
- }
-
- public void add(ContributionItem item) {
- item.fill(getMenu(), -1);
- }
-
- public Menu getMenu() {
- return fMenu;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- super.run();
- }
-
- public SyncViewerActionGroup[] getActionGroups() {
- return actionGroup;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ToggleViewAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ToggleViewAction.java
deleted file mode 100644
index 3387e8ae2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ToggleViewAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.SWT;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IPropertyListener;
-
-class ToggleViewAction extends Action implements IPropertyListener {
- private SynchronizeView viewer;
- private int layout;
-
- public ToggleViewAction(SynchronizeView viewer, int layout) {
- super(null, SWT.RADIO);
- this.viewer = viewer;
- this.layout = layout;
- if(layout == SynchronizeView.TABLE_VIEW) {
- Utils.initAction(this, "action.toggleViewFlat."); //$NON-NLS-1$
- } else {
- Utils.initAction(this, "action.toggleViewHierarchical."); //$NON-NLS-1$
- }
- viewer.addPropertyListener(this);
- }
-
- public void run() {
- viewer.switchViewerType(layout);
- }
-
- public void propertyChanged(Object source, int propId) {
- if(propId == SynchronizeView.PROP_VIEWTYPE) {
- setChecked(viewer.getCurrentViewType() == layout);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java
deleted file mode 100644
index ca42c58b2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * A progress bar with a red/green indication for success or failure.
- */
-public class StatisticsCounterBar extends Canvas {
- private static final int DEFAULT_WIDTH = 160;
- private static final int DEFAULT_HEIGHT = 20;
-
- private int outgoingCount = 0;
- private int incomingCount = 0;
- private int conflicCount = 0;
-
- private int totalCount = 0;
-
- private int fColorBarWidth = 0;
-
- private Color outgoingColor;
- private Color incomingColor;
- private Color conflictColor;
-
- private int activeMode = SyncInfo.IN_SYNC;
-
- private final Cursor counterBarCursor = new Cursor(getDisplay(), SWT.CURSOR_HAND);
-
- public StatisticsCounterBar(Composite parent, int cSpan) {
- super(parent, SWT.NONE);
-
- addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- redraw();
- }
- });
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- paint(e);
- }
- });
-
- addMouseMoveListener(
- new MouseMoveListener() {
- private Cursor fLastCursor;
- public void mouseMove(MouseEvent e) {
- Cursor cursor= null;
- int mode = handlemouseInCounterBar(e.x, e.y);
- if (mode != SyncInfo.IN_SYNC)
- cursor= counterBarCursor;
- if (fLastCursor != cursor) {
- setCursor(cursor);
- fLastCursor= cursor;
- }
- }
- }
- );
-
- addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- int mode = handlemouseInCounterBar(e.x, e.y);
- if(mode != activeMode) {
- activeMode = mode;
- redraw();
- }
- }
- }
- );
-
- Display display= parent.getDisplay();
- conflictColor = new Color(display, 204, 51, 51);
- incomingColor = new Color(display, 51, 102, 204);
- outgoingColor = new Color(display, 102, 102, 102);
-
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = cSpan;
- setLayoutData(data);
- }
-
- protected int handlemouseInCounterBar(int x, int y) {
- int nextX = 1;
- int sizeX = 0;
- if(conflicCount > 0) {
- sizeX = scale(conflicCount);
- if(x >= nextX && x <= sizeX) return SyncInfo.CONFLICTING;
- nextX = (sizeX - 1);
- }
- if(incomingCount > 0) {
- sizeX = scale(incomingCount) + nextX;
- if(x >= nextX && x <= sizeX) return SyncInfo.INCOMING;
- nextX = (sizeX - 1);
- }
- if(outgoingCount > 0) {
- sizeX = scale(outgoingCount) + nextX;
- if(x >= nextX && x <= sizeX) return SyncInfo.OUTGOING;
- }
- return SyncInfo.IN_SYNC;
- }
-
- public void reset() {
- conflicCount = 0;
- incomingCount = 0;
- outgoingCount = 0;
- fColorBarWidth = 0;
- redraw();
- }
-
- private void paintStep(int startX, int endX, int direction) {
- GC gc = new GC(this);
- setStatusColor(gc, direction);
- Rectangle rect= getClientArea();
- startX= Math.max(1, startX);
- gc.fillRectangle(startX, 1, endX, rect.height-2);
- gc.dispose();
- }
-
- public void dispose() {
- super.dispose();
- conflictColor.dispose();
- outgoingColor.dispose();
- incomingColor.dispose();
- }
-
- private void setStatusColor(GC gc, int direction) {
- switch(direction) {
- case SyncInfo.OUTGOING:
- gc.setBackground(outgoingColor); break;
- case SyncInfo.INCOMING:
- gc.setBackground(incomingColor); break;
- case SyncInfo.CONFLICTING:
- gc.setBackground(conflictColor); break;
- }
- }
-
- private int scale(int value) {
- if (totalCount > 0) {
- Rectangle r= getClientArea();
- if (r.width != 0)
- return Math.max(0, value*(r.width-2)/totalCount);
- }
- return value;
- }
-
- private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
- gc.setForeground(topleft);
- gc.drawLine(x, y, x+w-1, y);
- gc.drawLine(x, y, x, y+h-1);
-
- gc.setForeground(bottomright);
- gc.drawLine(x+w, y, x+w, y+h);
- gc.drawLine(x, y+h, x+w, y+h);
- }
-
- private void paint(PaintEvent event) {
- GC gc = event.gc;
- Display disp= getDisplay();
-
- Rectangle rect= getClientArea();
- gc.fillRectangle(rect);
- drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1,
- disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW),
- disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
-
- int nextX = 1;
- int sizeX = 0;
- if(conflicCount > 0) {
- sizeX = scale(conflicCount);
- paintStep(nextX, sizeX, SyncInfo.CONFLICTING);
- if(activeMode == SyncInfo.CONFLICTING) {
- drawBorder(gc, rect, nextX, sizeX);
- }
- nextX = (sizeX - 1);
- }
- if(incomingCount > 0) {
- sizeX = scale(incomingCount) + nextX;
- paintStep(nextX, sizeX, SyncInfo.INCOMING);
- if(activeMode == SyncInfo.INCOMING) {
- drawBorder(gc, rect, nextX, sizeX);
- }
- nextX = (sizeX - 1);
- }
- if(outgoingCount > 0) {
- sizeX = scale(outgoingCount) + nextX;
- paintStep(nextX, sizeX, SyncInfo.OUTGOING);
- if(activeMode == SyncInfo.OUTGOING) {
- drawBorder(gc, rect, nextX, sizeX);
- }
- }
- }
-
- private void drawBorder(GC gc, Rectangle rect, int nextX, int sizeX) {
- int lineWidth = 3;
- gc.setLineWidth(lineWidth);
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW));
- gc.drawRectangle(nextX, 0, (sizeX - lineWidth) + 1, rect.height - lineWidth);
- }
-
- public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- Point size= new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
- if (wHint != SWT.DEFAULT) size.x= wHint;
- if (hHint != SWT.DEFAULT) size.y= hHint;
- return size;
- }
-
- public void update(int conflicts, int outgoing, int incoming) {
- totalCount = conflicts + outgoing + incoming;
- conflicCount = conflicts;
- incomingCount = incoming;
- outgoingCount = outgoing;
- redraw();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
deleted file mode 100644
index f41603787..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*************.******************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.sync.sets.SyncInfoStatistics;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * Composite that displays statistics relating to Synchronization information. This panel displays the number of changes
- * for the three change directions. The labels have smart resize behavior and when more space is available the labels
- * are more verbose, whereas when the space is no longer available the labels are made less verbose.
- *
- * @since 3.0
- */
-public class StatisticsPanel extends Composite {
-
- private class DirectionLabel {
- public Image image;
- public String descriptionText;
- public Label descriptionLabel;
- public Label valueLabel;
- DirectionLabel(Composite parent, String description, String initialValue, Image image) {
- Label label= new Label(parent, SWT.NONE);
- if (image != null) {
- this.image = image;
- image.setBackground(label.getBackground());
- label.setImage(image);
- }
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- this.descriptionText = description;
- descriptionLabel= new Label(parent, SWT.NONE);
- descriptionLabel.setText(description);
- descriptionLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- valueLabel= new Label(parent, SWT.NONE);
- valueLabel.setText(initialValue);
-
- valueLabel.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- valueLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
- }
-
- void updateTooltips() {
- if(stats != null) {
- IWorkingSet ws = stats.getSubscriberInput().getWorkingSet();
- if(ws != null) {
- valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", descriptionText, ws.getName())); //$NON-NLS-1$
- valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", descriptionText, ws.getName())); //$NON-NLS-1$
- } else {
- valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersTooltip", descriptionText)); //$NON-NLS-1$
- valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersTooltip", descriptionText)); //$NON-NLS-1$
- }
- }
- }
- }
-
- private DirectionLabel outgoingDirectionLabel;
- private DirectionLabel incomingDirectionLabel;
- private DirectionLabel conflictingDirectionLabel;
-
- private ViewStatusInformation stats;
-
- public StatisticsPanel(Composite parent) {
- super(parent, SWT.WRAP);
-
- GridLayout gridLayout= new GridLayout();
- gridLayout.numColumns= 9;
- gridLayout.makeColumnsEqualWidth= false;
- gridLayout.marginWidth= 3;
- gridLayout.marginHeight= 0;
- setLayout(gridLayout);
-
- conflictingDirectionLabel = new DirectionLabel(this, Policy.bind("StatisticsPanel.conflicting"), "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage()); //$NON-NLS-1$ //$NON-NLS-2$
- incomingDirectionLabel = new DirectionLabel(this, Policy.bind("StatisticsPanel.incoming"), "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage()); //$NON-NLS-1$ //$NON-NLS-2$
- outgoingDirectionLabel = new DirectionLabel(this, Policy.bind("StatisticsPanel.outgoing"), "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage()); //$NON-NLS-1$ //$NON-NLS-2$
-
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- disposeIcons();
- }
- });
-
- addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- fixLabelsOnResize();
- }
- });
- setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- updateStats();
- fixLabelsOnResize();
- }
-
- protected void disposeIcons() {
- outgoingDirectionLabel.image.dispose();
- incomingDirectionLabel.image.dispose();
- conflictingDirectionLabel.image.dispose();
- }
-
- private void fixLabelsOnResize() {
- // setup all labels for initial calculation
- outgoingDirectionLabel.descriptionLabel.setText(outgoingDirectionLabel.descriptionText);
- incomingDirectionLabel.descriptionLabel.setText(incomingDirectionLabel.descriptionText);
- conflictingDirectionLabel.descriptionLabel.setText(conflictingDirectionLabel.descriptionText);
- layout(true);
-
- Point preferredSize = outgoingDirectionLabel.valueLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Rectangle currentSize = outgoingDirectionLabel.valueLabel.getBounds();
- if(currentSize.width < preferredSize.y && outgoingDirectionLabel.descriptionLabel.getText().length() != 0) {
- outgoingDirectionLabel.descriptionLabel.setText(""); //$NON-NLS-1$
- incomingDirectionLabel.descriptionLabel.setText(""); //$NON-NLS-1$
- conflictingDirectionLabel.descriptionLabel.setText(""); //$NON-NLS-1$
- } else if(outgoingDirectionLabel.descriptionLabel.getText().length() == 0){
- outgoingDirectionLabel.descriptionLabel.setText(outgoingDirectionLabel.descriptionText);
- incomingDirectionLabel.descriptionLabel.setText(incomingDirectionLabel.descriptionText);
- conflictingDirectionLabel.descriptionLabel.setText(conflictingDirectionLabel.descriptionText);
- }
- layout(true);
- redraw();
- }
-
- public void update(ViewStatusInformation stats) {
- this.stats = stats;
- updateStats();
- }
-
- private void updateStats() {
- if(stats != null && ! isDisposed()) {
-
- SyncInfoStatistics workspaceSetStats = stats.getSubscriberInput().getSubscriberSyncSet().getStatistics();
- SyncInfoStatistics workingSetSetStats = stats.getSubscriberInput().getWorkingSetSyncSet().getStatistics();
-
- int workspaceConflicting = (int)workspaceSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- int workspaceOutgoing = (int)workspaceSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- int workspaceIncoming = (int)workspaceSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
- int workingSetConflicting = (int)workingSetSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- int workingSetOutgoing = (int)workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- int workingSetIncoming = (int)workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
-
- if(stats.getSubscriberInput().getWorkingSet() != null) {
- conflictingDirectionLabel.valueLabel.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
- incomingDirectionLabel.valueLabel.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
- outgoingDirectionLabel.valueLabel.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
- } else {
- conflictingDirectionLabel.valueLabel.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$
- incomingDirectionLabel.valueLabel.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$
- outgoingDirectionLabel.valueLabel.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$
- }
- updateTooltips();
- redraw();
- }
- }
-
- void updateTooltips() {
- conflictingDirectionLabel.updateTooltips();
- incomingDirectionLabel.updateTooltips();
- outgoingDirectionLabel.updateTooltips();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Widget#dispose()
- */
- public void dispose() {
- super.dispose();
- disposeIcons();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
deleted file mode 100644
index 515089df8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
+++ /dev/null
@@ -1,823 +0,0 @@
-/*************.******************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
-import org.eclipse.team.core.subscribers.TeamDelta;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.jobs.JobBusyCursor;
-import org.eclipse.team.internal.ui.jobs.RefreshSubscriberInputJob;
-import org.eclipse.team.internal.ui.sync.actions.RefreshAction;
-import org.eclipse.team.internal.ui.sync.actions.SyncViewerActions;
-import org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent;
-import org.eclipse.team.ui.sync.AndSyncInfoFilter;
-import org.eclipse.team.ui.sync.ISynchronizeView;
-import org.eclipse.team.ui.sync.PseudoConflictFilter;
-import org.eclipse.team.ui.sync.SubscriberAction;
-import org.eclipse.team.ui.sync.SyncInfoChangeTypeFilter;
-import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * The Team Synchronization view.
- */
-public class SynchronizeView extends ViewPart implements ITeamResourceChangeListener, ISyncSetChangedListener, ISynchronizeView {
-
- // The property id for <code>getCurrentViewType</code>.
- public static final int PROP_VIEWTYPE = 1;
-
- /**
- * View type constant (value 0) indicating that the synchronize view will be shown
- * as a tree.
- */
- public static final int TREE_VIEW = 0;
-
- /**
- * View type constant (value 1) indicating that the synchronize view will be shown
- * as a table.
- */
- public static final int TABLE_VIEW = 1;
-
- //This view's id. The same value as in the plugin.xml.
- public static final String VIEW_ID = "org.eclipse.team.sync.views.SynchronizeView"; //$NON-NLS-1$
-
- // The viewer that is shown in the view. Currently this can be either a table or tree viewer.
- private StructuredViewer viewer;
-
- // Parent composite of this view. It is remembered so that we can dispose of its children when
- // the viewer type is switched.
- private Composite composite = null;
- private StatisticsPanel statsPanel;
- private IMemento memento;
-
- // Viewer type constants
- private int currentViewType;
-
- // Cache for each subscriber registered with the view
- private Map subscriberInputs = new HashMap(1);
-
- // Remembering the current input and the previous.
- private SubscriberInput input = null;
-
- // A set of common actions. They are hooked to the active SubscriberInput and must
- // be reset when the input changes.
- private SyncViewerActions actions;
-
- private JobBusyCursor busyCursor;
-
- /**
- * Constructs a new SynchronizeView.
- */
- public SynchronizeView() {
- currentViewType = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TYPE);
- if (currentViewType != TREE_VIEW) {
- currentViewType = TABLE_VIEW;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- GridLayout gridLayout= new GridLayout();
- gridLayout.makeColumnsEqualWidth= false;
- gridLayout.marginWidth= 0;
- gridLayout.marginHeight = 0;
- parent.setLayout(gridLayout);
-
- // Create the busy cursor with no control to start with (createViewer will set it)
- busyCursor = new JobBusyCursor(null /* control */, SubscriberAction.SUBSCRIBER_JOB_TYPE);
-
- createViewer(parent);
- this.composite = parent;
-
- initializeActions();
- contributeToActionBars();
-
- // Register for addition/removal of subscribers
- TeamSubscriber.getSubscriberManager().addTeamResourceChangeListener(this);
- TeamSubscriber[] subscribers = TeamSubscriber.getSubscriberManager().getSubscribers();
- for (int i = 0; i < subscribers.length; i++) {
- TeamSubscriber subscriber = subscribers[i];
- addSubscriber(subscriber);
- }
-
- updateStatusPanel();
- updateTooltip();
-
- actions.setContext(null);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- this.memento = memento;
-
- RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
- if(getStore().getBoolean(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC) && refreshJob.getState() == Job.NONE) {
- refreshJob.setReschedule(true);
- // start once the UI has started and stabilized
- refreshJob.schedule(20000 /* 20 seconds */);
- }
- }
- /*
- * This method is synchronized to ensure that all internal state is not corrupted
- */
- public synchronized void initializeSubscriberInput(final SubscriberInput input) {
- Assert.isNotNull(input);
-
- // listen to sync set changes in order to update state relating to the
- // size of the sync sets and update the title
- disconnectSubscriberInput();
- this.input = input;
- input.registerListeners(this);
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- // create the viewer is it doesn't exist yet.
- if(viewer == null) {
- switchViewerType(currentViewType);
- }
- ActionContext context = new ActionContext(null);
- context.setInput(input);
- actions.setContext(context);
- viewer.setInput(input);
-
- RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
- refreshJob.setSubscriberInput(input);
- updateStatusPanel();
- setTitle(Policy.bind("LiveSyncView.titleSubscriber", input.getSubscriber().getName())); //$NON-NLS-1$
- }
- });
- }
-
- private void disconnectSubscriberInput() {
- if(input != null) {
- input.deregisterListeners(this);
- input = null;
- }
- }
- /**
- * Toggles between label/tree/table viewers.
- */
- public void switchViewerType(int viewerType) {
- if(viewer == null || viewerType != currentViewType) {
- if (composite == null || composite.isDisposed()) return;
- IStructuredSelection oldSelection = null;
- if(viewer != null) {
- oldSelection = (IStructuredSelection)viewer.getSelection();
- }
- currentViewType = viewerType;
- getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TYPE, currentViewType);
- disposeChildren(composite);
- createViewer(composite);
- composite.layout();
- if(oldSelection == null || oldSelection.size() == 0) {
- //gotoDifference(INavigableControl.NEXT);
- } else {
- viewer.setSelection(oldSelection, true);
- }
- fireSafePropertyChange(PROP_VIEWTYPE);
- updateStatusPanel();
- }
- }
-
- /**
- * Adds the listeners to the viewer.
- */
- protected void initializeListeners() {
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- handleOpen(event);
- }
- });
- }
-
- protected void initializeActions() {
- actions = new SyncViewerActions(this);
- actions.restore(memento);
- }
- protected void hookContextMenu() {
- if(viewer != null) {
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- actions.fillContextMenu(manager);
- }
- });
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
- }
- }
- protected void contributeToActionBars() {
- IActionBars bars = getViewSite().getActionBars();
- actions.fillActionBars(bars);
- }
-
- protected void createViewer(Composite parent) {
- if(input == null) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(Policy.bind("SynchronizeView.noSubscribersMessage")); //$NON-NLS-1$
- } else {
- statsPanel = new StatisticsPanel(parent);
- switch(currentViewType) {
- case TREE_VIEW:
- createTreeViewerPartControl(parent);
- break;
- case TABLE_VIEW:
- createTableViewerPartControl(parent);
- break;
- }
- viewer.setInput(input);
- viewer.getControl().setFocus();
- hookContextMenu();
- initializeListeners();
- busyCursor.setControl(viewer.getControl());
- }
- }
-
- protected void createTreeViewerPartControl(Composite parent) {
- GridData data = new GridData(GridData.FILL_BOTH);
- viewer = new SyncTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setLabelProvider(SyncViewerLabelProvider.getDecoratingLabelProvider());
- viewer.setSorter(new SyncViewerSorter(ResourceSorter.NAME));
- ((TreeViewer)viewer).getTree().setLayoutData(data);
- }
-
- protected void createTableViewerPartControl(Composite parent) {
- // Create the table
- 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);
-
- // Set the table layout
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- // Create the viewer
- TableViewer tableViewer = new SyncTableViewer(table);
-
- // Create the table columns
- createColumns(table, layout, tableViewer);
-
- // Set the table contents
- viewer = tableViewer;
- viewer.setContentProvider(new SyncSetTableContentProvider());
- viewer.setLabelProvider(new SyncViewerLabelProvider());
-
- viewer.setSorter(new SyncViewerTableSorter());
- }
-
- /**
- * Creates the columns for the sync viewer table.
- */
- protected void createColumns(Table table, TableLayout layout, TableViewer viewer) {
- SelectionListener headerListener = SyncViewerTableSorter.getColumnListener(viewer);
- // revision
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText("Resource"); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(30, true));
-
- // tags
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText("In Folder"); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(50, true));
- }
-
- protected void disposeChildren(Composite parent) {
- // Null out the control of the busy cursor while we are switching viewers
- busyCursor.setControl(null);
- Control[] children = parent.getChildren();
- for (int i = 0; i < children.length; i++) {
- Control control = children[i];
- control.dispose();
- }
- }
-
- /**
- * Handles a selection changed event from the viewer. Updates the status line and the action
- * bars, and links to editor (if option enabled).
- *
- * @param event the selection event
- */
- protected void handleSelectionChanged(SelectionChangedEvent event) {
- final IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- updateStatusLine(sel);
- updateActionBars(sel);
- }
-
- protected void handleOpen(OpenEvent event) {
- actions.open();
- }
- /**
- * Handles a double-click event from the viewer.
- * Expands or collapses a folder when double-clicked.
- *
- * @param event the double-click event
- * @since 2.0
- */
- protected void handleDoubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
-
- // Double-clicking should expand/collapse containers
- if (viewer instanceof TreeViewer) {
- TreeViewer tree = (TreeViewer)viewer;
- if (tree.isExpandable(element)) {
- tree.setExpandedState(element, !tree.getExpandedState(element));
- }
- }
-
- }
-
- public void activateSubscriber(TeamSubscriber subscriber) {
- SubscriberInput newInput = (SubscriberInput)subscriberInputs.get(subscriber.getId());
- if (newInput == null) {
- addSubscriber(subscriber);
- };
- if(! newInput.getSubscriber().getId().equals(getInput().getSubscriber().getId())) {
- initializeSubscriberInput(newInput);
- }
- }
-
- protected void updateStatusPanel() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- SubscriberInput input = getInput();
- if(input != null && statsPanel != null) {
- statsPanel.update(new ViewStatusInformation(input));
- }
- }
- });
- }
-
- protected void updateTooltip() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- SubscriberInput input = getInput();
- if(input != null) {
- if(input.getWorkingSet() != null) {
- String tooltip = Policy.bind("LiveSyncView.titleTooltip", input.getWorkingSet().getName()); //$NON-NLS-1$
- setTitleToolTip(tooltip);
- } else {
- setTitleToolTip(""); //$NON-NLS-1$
- }
- }
- }
- });
- }
- /**
- * Passing the focus request to the viewer's control.
- */
- public void setFocus() {
- if (viewer == null) return;
- viewer.getControl().setFocus();
- }
-
- public StructuredViewer getViewer() {
- return viewer;
- }
-
- private static void handle(Shell shell, Exception exception, String title, String message) {
- Utils.handleError(shell, exception, title, message);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- super.dispose();
-
- // cancel and wait
- RefreshSubscriberInputJob job = TeamUIPlugin.getPlugin().getRefreshJob();
- job.setRestartOnCancel(false);
- job.cancel();
- try {
- job.join();
- } catch (InterruptedException e) {
- // continue with shutdown
- }
- job.setSubscriberInput(null);
-
- // Cleanup the subscriber inputs
- TeamSubscriber.getSubscriberManager().removeTeamResourceChangeListener(this);
- for (Iterator it = subscriberInputs.values().iterator(); it.hasNext();) {
- SubscriberInput input = (SubscriberInput) it.next();
- input.dispose();
- }
-
- busyCursor.dispose();
- }
-
- public void run(IRunnableWithProgress runnable) {
- try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable);
- } catch (InvocationTargetException e) {
- handle(getSite().getShell(), e, null, null);
- } catch (InterruptedException e) {
- // Nothing to be done
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
- actions.save(memento);
- }
-
- public int getViewerType() {
- return currentViewType;
- }
-
- /*
- * Return the current input for the view.
- */
- public SubscriberInput getInput() {
- return input;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.sync.TeamDelta[])
- */
- public void teamResourceChanged(TeamDelta[] deltas) {
- for (int i = 0; i < deltas.length; i++) {
- TeamDelta delta = deltas[i];
- if(delta.getFlags() == TeamDelta.SUBSCRIBER_CREATED) {
- TeamSubscriber s = delta.getSubscriber();
- addSubscriber(s);
- }
- }
- }
-
- /*
- * Add the subscriber to the view. This method does not activate
- * the subscriber.
- */
- synchronized private void addSubscriber(final TeamSubscriber s) {
- SubscriberInput si = new SubscriberInput(s);
- subscriberInputs.put(s.getId(), si);
- ActionContext context = new ActionContext(null);
- context.setInput(si);
- actions.addContext(context);
- }
-
- synchronized public void removeSubscriber(TeamSubscriber s) {
- // notify that context is changing
- SubscriberInput si = (SubscriberInput)subscriberInputs.get(s.getId());
- ActionContext context = new ActionContext(null);
- context.setInput(si);
- actions.removeContext(context);
-
- // dispose of the input
- si.dispose();
-
- // forget about this input
- subscriberInputs.remove(s.getId());
-
- // de-register the subscriber with the platform
- s.cancel();
-
- if (si == input) {
- if (subscriberInputs.isEmpty()) {
- disconnectSubscriberInput();
- if(viewer != null) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if(viewer == null) return;
- ActionContext context = new ActionContext(null);
- context.setInput(null);
- actions.setContext(context);
- viewer.setInput(null);
- setTitle(Policy.bind("LiveSyncView.titleSubscriber")); //$NON-NLS-1$
- }
- });
- }
- } else {
- initializeSubscriberInput((SubscriberInput)subscriberInputs.values().iterator().next());
- }
- }
- }
-
- public void collapseAll() {
- if (viewer == null || !(viewer instanceof AbstractTreeViewer)) return;
- viewer.getControl().setRedraw(false);
- ((AbstractTreeViewer)viewer).collapseToLevel(viewer.getInput(), TreeViewer.ALL_LEVELS);
- viewer.getControl().setRedraw(true);
- }
-
- public ISelection getSelection() {
- return getViewer().getSelection();
- }
-
- /**
- * This method enables "Show In" support for this view
- *
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class key) {
- if (key == IShowInSource.class) {
- return new IShowInSource() {
- public ShowInContext getShowInContext() {
- StructuredViewer v = getViewer();
- if (v == null) return null;
- return new ShowInContext(null, v.getSelection());
- }
- };
- }
- return super.getAdapter(key);
- }
-
- /**
- * Updates the action bar actions.
- *
- * @param selection the current selection
- * @since 2.0
- */
- protected void updateActionBars(IStructuredSelection selection) {
- if (actions != null) {
- ActionContext actionContext = actions.getContext();
- if(actionContext != null) {
- actionContext.setSelection(selection);
- actions.updateActionBars();
- }
- }
- }
-
- /**
- * Updates the message shown in the status line.
- *
- * @param selection the current selection
- */
- protected void updateStatusLine(IStructuredSelection selection) {
- String msg = getStatusLineMessage(selection);
- getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
- }
-
- /**
- * Returns the message to show in the status line.
- *
- * @param selection the current selection
- * @return the status line message
- * @since 2.0
- */
- protected String getStatusLineMessage(IStructuredSelection selection) {
- if (selection.size() == 1) {
- IResource resource = getResource(selection.getFirstElement());
- if (resource == null) {
- return Policy.bind("SynchronizeView.12"); //$NON-NLS-1$
- } else {
- return resource.getFullPath().makeRelative().toString();
- }
- }
- if (selection.size() > 1) {
- return selection.size() + Policy.bind("SynchronizeView.13"); //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @param object
- * @return
- */
- private IResource getResource(Object object) {
- return (IResource)TeamAction.getAdapter(object, IResource.class);
- }
-
- /**
- * Makes this view visible in the active page.
- */
- public static SynchronizeView showInActivePage(IWorkbenchPage activePage, boolean allowSwitchingPerspectives) {
- IWorkbench workbench= TeamUIPlugin.getPlugin().getWorkbench();
- IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
-
- if(allowSwitchingPerspectives && ! TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE).equals(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE_NONE)) {
- try {
- String pId = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE);
- activePage = workbench.showPerspective(pId, window);
- } catch (WorkbenchException e) {
- Utils.handleError(window.getShell(), e, Policy.bind("SynchronizeView.14"), e.getMessage()); //$NON-NLS-1$
- }
- }
- try {
- if (activePage == null) {
- activePage = TeamUIPlugin.getActivePage();
- if (activePage == null) return null;
- }
- return (SynchronizeView)activePage.showView(VIEW_ID);
- } catch (PartInitException pe) {
- Utils.handleError(window.getShell(), pe, Policy.bind("SynchronizeView.16"), pe.getMessage()); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Update the title when either the subscriber or filter sync set changes.
- */
- public void syncSetChanged(SyncSetChangedEvent event) {
- updateStatusPanel();
- }
-
- private void fireSafePropertyChange(final int property) {
- if(! composite.isDisposed()) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- firePropertyChange(property);
- }
- });
- }
- }
-
- public void selectSubscriber(TeamSubscriber subscriber) {
- activateSubscriber(subscriber);
- }
-
- /**
- * Refreshes the resources from the specified subscriber. The working set or filters applied
- * to the sync view do not affect the sync.
- */
- public void refreshWithRemote(TeamSubscriber subscriber, IResource[] resources) {
- QualifiedName id = subscriber.getId();
- if(subscriberInputs.containsKey(id)) {
- if(input != null && ! input.getSubscriber().getId().equals(id)) {
- initializeSubscriberInput((SubscriberInput)subscriberInputs.get(id));
- }
- RefreshAction.run(this, resources, subscriber);
- }
- }
-
- /**
- * Refreshes the resources in the current input for the given subscriber.
- */
- public void refreshWithRemote(TeamSubscriber subscriber) {
- QualifiedName id = subscriber.getId();
- if(input != null && subscriberInputs.containsKey(id)) {
- if(! input.getSubscriber().getId().equals(id)) {
- initializeSubscriberInput((SubscriberInput)subscriberInputs.get(id));
- }
- RefreshAction.run(this, input.workingSetRoots(), subscriber);
- }
- }
-
- /**
- * Refreshes the resources in the current input for the given subscriber.
- */
- public void refreshWithRemote() {
- if(input != null) {
- RefreshAction.run(this, input.workingSetRoots(), input.getSubscriber());
- }
- }
-
- public int getCurrentViewType() {
- return currentViewType;
- }
-
- public void selectAll() {
- if (getViewerType() == TABLE_VIEW) {
- TableViewer table = (TableViewer)getViewer();
- table.getTable().selectAll();
- } else {
- // Select All in a tree doesn't really work well
- }
- }
-
- private IPreferenceStore getStore() {
- return TeamUIPlugin.getPlugin().getPreferenceStore();
- }
-
- public SyncSetContentProvider getContentProvider() {
- return (SyncSetContentProvider)getViewer().getContentProvider();
- }
-
- public void setWorkingSet(IWorkingSet workingSet) {
- actions.setWorkingSet(workingSet);
- }
-
- public void workingSetChanged(IWorkingSet set) {
- input.setWorkingSet(set);
- updateTooltip();
- }
- /**
- * Updates the filter applied to the active subscriber input and ensures that selection and expansions
- * is preserved when the filtered contents are shown.
- * @param filter
- */
- public void updateInputFilter(int[] directions, int[] changeTypes) {
- try {
- if(viewer instanceof INavigableControl) {
- ((INavigableControl)viewer).preserveState(1);
- }
- input.setFilter(
- new AndSyncInfoFilter(
- new SyncInfoFilter[] {
- new SyncInfoDirectionFilter(directions),
- new SyncInfoChangeTypeFilter(changeTypes),
- new PseudoConflictFilter()
- }), new NullProgressMonitor());
- if(viewer instanceof INavigableControl) {
- ((INavigableControl)viewer).restoreState(1);
- }
- } catch (TeamException e) {
- Utils.handleError(getSite().getShell(), e, Policy.bind("SynchronizeView.16"), e.getMessage()); //$NON-NLS-1$
- }
- }
-
- /**
- * Allows clients to change the active sync mode.
- */
- public void setMode(int mode) {
- actions.setMode(mode);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/ViewStatusInformation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/ViewStatusInformation.java
deleted file mode 100644
index 02e6603c6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/ViewStatusInformation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
-
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.ui.IWorkingSet;
-
-class ViewStatusInformation {
-
- private String subscriberName;
- private String workingSetName;
- private long numShowing = 0;
- private long numInWorkingSet = 0;
- private long numInWorkspace = 0;
- private SubscriberInput input;
-
- ViewStatusInformation(SubscriberInput input) {
- this.subscriberName = input.getSubscriber().getName();
- this.input = input;
- IWorkingSet set = input.getWorkingSet();
- if(set != null) {
- this.workingSetName = set.getName();
- } else {
- this.workingSetName = ""; //$NON-NLS-1$
- }
- this.numShowing = input.getFilteredSyncSet().size();
- this.numInWorkingSet = input.getWorkingSetSyncSet().size();
- this.numInWorkspace = input.getSubscriberSyncSet().size();
- }
-
- public long getNumInWorkingSet() {
- return numInWorkingSet;
- }
-
- public long getNumInWorkspace() {
- return numInWorkspace;
- }
-
- public long getNumShowing() {
- return numShowing;
- }
-
- public String getSubscriberName() {
- return subscriberName;
- }
-
- public String getWorkingSetName() {
- return workingSetName;
- }
-
- public SubscriberInput getSubscriberInput() {
- return input;
- }
-
- public boolean equals(Object other) {
- if(other == this) return true;
- if(other instanceof ViewStatusInformation) {
- ViewStatusInformation otherStatus = (ViewStatusInformation)other;
- return
- subscriberName.equals(otherStatus.subscriberName) &&
- workingSetName.equals(otherStatus.workingSetName) &&
- numShowing == otherStatus.numShowing &&
- numInWorkingSet == otherStatus.numInWorkingSet &&
- numInWorkspace == otherStatus.numInWorkspace;
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
new file mode 100644
index 000000000..cbf4cb7ca
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
@@ -0,0 +1,398 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+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.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
+import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry;
+import org.eclipse.team.ui.ITeamUIConstants;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
+
+/**
+ * Manages the registered synchronize participants. It handles notification
+ * of participant lifecycles, creation of <code>static</code> participants,
+ * and the re-creation of persisted participants.
+ *
+ * @see ISynchronizeView
+ * @see ISynchronizeParticipant
+ * @since 3.0
+ */
+public class SynchronizeManager implements ISynchronizeManager {
+ /**
+ * Synchronize participants listeners
+ */
+ private ListenerList fListeners = null;
+
+ /**
+ * List of registered synchronize view pages
+ * {String id -> List participant instances}}
+ */
+ private Map synchronizeParticipants = new HashMap(10);
+ private SynchronizeParticipantRegistry participantRegistry = new SynchronizeParticipantRegistry();
+
+ // change notification constants
+ private final static int ADDED = 1;
+ private final static int REMOVED = 2;
+
+ // save context constants
+ private final static String CTX_PARTICIPANTS = "syncparticipants"; //$NON-NLS-1$
+ private final static String CTX_PARTICIPANT = "participant"; //$NON-NLS-1$
+ private final static String CTX_ID = "id"; //$NON-NLS-1$
+ private final static String CTX_PARTICIPANT_DATA = "data"; //$NON-NLS-1$
+ private final static String FILENAME = "syncParticipants.xml"; //$NON-NLS-1$
+
+ /**
+ * Notifies a participant listeners of additions or removals
+ */
+ class SynchronizeViewPageNotifier implements ISafeRunnable {
+
+ private ISynchronizeParticipantListener fListener;
+ private int fType;
+ private ISynchronizeParticipant[] fChanged;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
+ */
+ public void handleException(Throwable exception) {
+ TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.7"), exception); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.ISafeRunnable#run()
+ */
+ public void run() throws Exception {
+ switch (fType) {
+ case ADDED:
+ fListener.participantsAdded(fChanged);
+ break;
+ case REMOVED:
+ fListener.participantsRemoved(fChanged);
+ break;
+ }
+ }
+
+ /**
+ * Notifies the given listener of the adds/removes
+ *
+ * @param participants the participants that changed
+ * @param update the type of change
+ */
+ public void notify(ISynchronizeParticipant[] participants, int update) {
+ if (fListeners == null) {
+ return;
+ }
+ fChanged = participants;
+ fType = update;
+ Object[] copiedListeners= fListeners.getListeners();
+ for (int i= 0; i < copiedListeners.length; i++) {
+ fListener = (ISynchronizeParticipantListener)copiedListeners[i];
+ Platform.run(this);
+ }
+ fChanged = null;
+ fListener = null;
+ }
+ }
+
+ public SynchronizeManager() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener)
+ */
+ public void addSynchronizeParticipantListener(ISynchronizeParticipantListener listener) {
+ if (fListeners == null) {
+ fListeners = new ListenerList(5);
+ }
+ fListeners.add(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener)
+ */
+ public void removeSynchronizeParticipantListener(ISynchronizeParticipantListener listener) {
+ if (fListeners != null) {
+ fListeners.remove(listener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
+ */
+ public synchronized void addSynchronizeParticipants(ISynchronizeParticipant[] participants) {
+ List added = new ArrayList(participants.length);
+ for (int i = 0; i < participants.length; i++) {
+ ISynchronizeParticipant participant = participants[i];
+ addParticipant(participant);
+ added.add(participant);
+ }
+ if (!added.isEmpty()) {
+ saveState();
+ fireUpdate((ISynchronizeParticipant[])added.toArray(new ISynchronizeParticipant[added.size()]), ADDED);
+ }
+ }
+
+ private synchronized void addParticipant(ISynchronizeParticipant participant) {
+ String id = participant.getId();
+ List instances = (List)synchronizeParticipants.get(id);
+ if(instances == null) {
+ instances = new ArrayList(2);
+ synchronizeParticipants.put(id, instances);
+ }
+ if(! instances.contains(participant)) {
+ instances.add(participant);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
+ */
+ public synchronized void removeSynchronizeParticipants(ISynchronizeParticipant[] participants) {
+ List removed = new ArrayList(participants.length);
+ for (int i = 0; i < participants.length; i++) {
+ ISynchronizeParticipant participant = participants[i];
+ if (removeParticipant(participant)) {
+ removed.add(participant);
+ }
+ }
+ if (!removed.isEmpty()) {
+ saveState();
+ fireUpdate((ISynchronizeParticipant[])removed.toArray(new ISynchronizeParticipant[removed.size()]), REMOVED);
+ }
+ }
+
+ private synchronized boolean removeParticipant(ISynchronizeParticipant participant) {
+ boolean removed = false;
+ String id = participant.getId();
+ List instances = (List)synchronizeParticipants.get(id);
+ if(instances != null) {
+ removed = instances.remove(participant);
+ if(instances.isEmpty()) {
+ synchronizeParticipants.remove(id);
+ }
+ }
+ return removed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#getSynchronizeParticipants()
+ */
+ public synchronized ISynchronizeParticipant[] getSynchronizeParticipants() {
+ List participants = new ArrayList();
+ for (Iterator it = synchronizeParticipants.values().iterator(); it.hasNext();) {
+ List instances = (List) it.next();
+ participants.addAll(instances);
+ }
+ return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeManager#find(java.lang.String)
+ */
+ public ISynchronizeParticipant[] find(String id) {
+ List participants = (List)synchronizeParticipants.get(id);
+ if(participants == null) {
+ return null;
+ }
+ return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
+ }
+
+ /**
+ * Fires notification.
+ *
+ * @param participants participants added/removed
+ * @param type ADD or REMOVE
+ */
+ private void fireUpdate(ISynchronizeParticipant[] participants, int type) {
+ new SynchronizeViewPageNotifier().notify(participants, type);
+ }
+
+ /**
+ * Called to display the synchronize view in the given page. If the given
+ * page is <code>null</code> the synchronize view is shown in the default
+ * active workbench window.
+ */
+ public ISynchronizeView showSynchronizeViewInActivePage(IWorkbenchPage activePage) {
+ IWorkbench workbench= TeamUIPlugin.getPlugin().getWorkbench();
+ IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
+
+ if(! TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE).equals(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE_NONE)) {
+ try {
+ String pId = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE);
+ activePage = workbench.showPerspective(pId, window);
+ } catch (WorkbenchException e) {
+ Utils.handleError(window.getShell(), e, Policy.bind("SynchronizeView.14"), e.getMessage()); //$NON-NLS-1$
+ }
+ }
+ try {
+ if (activePage == null) {
+ activePage = TeamUIPlugin.getActivePage();
+ if (activePage == null) return null;
+ }
+ return (ISynchronizeView)activePage.showView(ISynchronizeView.VIEW_ID);
+ } catch (PartInitException pe) {
+ Utils.handleError(window.getShell(), pe, Policy.bind("SynchronizeView.16"), pe.getMessage()); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ /**
+ * Creates the participant registry and restore any saved participants. Will also instantiate
+ * any static participants.
+ */
+ public void initialize() {
+ try {
+ // Initialize the participant registry - reads all participant extension descriptions.
+ participantRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_SYNCPARTICIPANTS);
+
+ // Instantiate and register any dynamic participants saved from a previous session.
+ restoreSavedParticipants();
+
+ // Instantiate and register any static participant that has not already been created.
+ initializeStaticParticipants();
+ } catch (CoreException e) {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.8"), e)); //$NON-NLS-1$
+ }
+ }
+
+ private void initializeStaticParticipants() throws CoreException {
+ SynchronizeParticipantDescriptor[] desc = participantRegistry.getSynchronizeParticipants();
+ List participants = new ArrayList();
+ for (int i = 0; i < desc.length; i++) {
+ SynchronizeParticipantDescriptor descriptor = desc[i];
+ if(descriptor.isStatic() && ! synchronizeParticipants.containsKey(descriptor.getId())) {
+ participants.add(createParticipant(null, descriptor));
+ }
+ }
+ if(! participants.isEmpty()) {
+ addSynchronizeParticipants((ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]));
+ }
+ }
+
+ /**
+ * Restores participants that have been saved between sessions.
+ */
+ private void restoreSavedParticipants() throws TeamException, CoreException {
+ File file = getStateFile();
+ Reader reader;
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ } catch (FileNotFoundException e) {
+ return;
+ }
+ List participants = new ArrayList();
+ IMemento memento = XMLMemento.createReadRoot(reader);
+ IMemento[] participantNodes = memento.getChildren(CTX_PARTICIPANT);
+ for (int i = 0; i < participantNodes.length; i++) {
+ IMemento memento2 = participantNodes[i];
+ String id = memento2.getString(CTX_ID);
+ SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
+ if(desc != null) {
+ IConfigurationElement cfgElement = desc.getConfigurationElement();
+ participants.add(createParticipant(memento2.getChild(CTX_PARTICIPANT_DATA), desc));
+ } else {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
+ }
+ }
+ if(! participants.isEmpty()) {
+ addSynchronizeParticipants((ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]));
+ }
+ }
+
+ /**
+ * Creates a participant instance with the given id from the participant description
+ */
+ private ISynchronizeParticipant createParticipant(IMemento memento, SynchronizeParticipantDescriptor desc) throws CoreException {
+ ISynchronizeParticipant participant = (ISynchronizeParticipant)TeamUIPlugin.createExtension(desc.getConfigurationElement(), SynchronizeParticipantDescriptor.ATT_CLASS);
+ participant.setInitializationData(desc.getConfigurationElement(), null, null);
+ participant.restoreState(memento);
+ return participant;
+ }
+
+ /**
+ * Saves a file containing the list of participant ids that are registered with this
+ * manager. Each participant is also given the chance to save it's state.
+ */
+ private void saveState() {
+ XMLMemento xmlMemento = XMLMemento.createWriteRoot(CTX_PARTICIPANTS);
+ List children = new ArrayList();
+ for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext();) {
+ String id = (String) it.next();
+ List participants = (List)synchronizeParticipants.get(id);
+ for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
+ ISynchronizeParticipant participant = (ISynchronizeParticipant) it2.next();
+ IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
+ participantNode.putString(CTX_ID, participant.getId());
+ participant.saveState(participantNode.createChild(CTX_PARTICIPANT_DATA));
+ }
+ }
+ try {
+ Writer writer = new BufferedWriter(new FileWriter(getStateFile()));
+ try {
+ xmlMemento.save(writer);
+ } finally {
+ writer.close();
+ }
+ } catch (IOException e) {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.10"), e)); //$NON-NLS-1$
+ }
+ }
+
+ private File getStateFile() {
+ IPath pluginStateLocation = TeamUIPlugin.getPlugin().getStateLocation();
+ return pluginStateLocation.append(FILENAME).toFile(); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#getParticipantDescriptor(java.lang.String)
+ */
+ public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) {
+ return participantRegistry.find(id);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
new file mode 100644
index 000000000..c5c2933cf
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.synchronize.actions.SynchronizePageDropDownAction;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.part.IPageBookViewPage;
+import org.eclipse.ui.part.MessagePage;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.PageBookView;
+
+/**
+ * Implements a Synchronize View that contains multiple synchronize participants.
+ */
+public class SynchronizeView extends PageBookView implements ISynchronizeView, ISynchronizeParticipantListener, IPropertyChangeListener {
+
+ /**
+ * The participant being displayed, or <code>null</code> if none
+ */
+ private ISynchronizeParticipant activeParticipant = null;
+
+ /**
+ * Map of participants to dummy participant parts (used to close pages)
+ */
+ private Map fPageToPart;
+
+ /**
+ * Map of parts to participants
+ */
+ private Map fPartToPage;
+
+ private SynchronizePageDropDownAction fPageDropDown;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ Object source = event.getSource();
+ if (source instanceof ISynchronizeParticipant && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) {
+ if (source.equals(getParticipant())) {
+ updateTitle();
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partClosed(IWorkbenchPart part) {
+ super.partClosed(part);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeView#getParticipant()
+ */
+ public ISynchronizeParticipant getParticipant() {
+ return activeParticipant;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec)
+ */
+ protected void showPageRec(PageRec pageRec) {
+ super.showPageRec(pageRec);
+ activeParticipant = (ISynchronizeParticipant)fPartToPage.get(pageRec.part);
+ updateTitle();
+ }
+
+ /*
+ * Updates the view title based on the active participant
+ */
+ protected void updateTitle() {
+ ISynchronizeParticipant page = getParticipant();
+ if (page == null) {
+ setTitle(Policy.bind("SynchronizeView.1")); //$NON-NLS-1$
+ } else {
+ setTitle(Policy.bind("SynchronizeView.2") + page.getName()); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
+ */
+ protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
+ IPage page = pageRecord.page;
+ page.dispose();
+ pageRecord.dispose();
+
+ ISynchronizeParticipant participant = (ISynchronizeParticipant)fPartToPage.get(part);
+ participant.removePropertyChangeListener(this);
+
+ // empty cross-reference cache
+ fPartToPage.remove(part);
+ fPageToPart.remove(participant);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
+ */
+ protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
+ SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)dummyPart;
+ ISynchronizeParticipant participant = part.getConsole();
+ IPageBookViewPage page = participant.createPage(this);
+ initPage(page);
+ page.createControl(getPageBook());
+ participant.addPropertyChangeListener(this);
+ PageRec rec = new PageRec(dummyPart, page);
+ return rec;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
+ */
+ protected boolean isImportant(IWorkbenchPart part) {
+ return part instanceof SynchronizeViewWorkbenchPart;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
+ */
+ protected IPage createDefaultPage(PageBook book) {
+ MessagePage page = new MessagePage();
+ page.createControl(getPageBook());
+ initPage(page);
+ return page;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
+ */
+ public void participantsAdded(final ISynchronizeParticipant[] participants) {
+ if (isAvailable()) {
+ Runnable r = new Runnable() {
+ public void run() {
+ for (int i = 0; i < participants.length; i++) {
+ if (isAvailable()) {
+ ISynchronizeParticipant participant = participants[i];
+ SynchronizeViewWorkbenchPart part = new SynchronizeViewWorkbenchPart(participant, getSite());
+ fPageToPart.put(participant, part);
+ fPartToPage.put(part, participant);
+ partActivated(part);
+ }
+ }
+ }
+ };
+ asyncExec(r);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
+ */
+ public void participantsRemoved(final ISynchronizeParticipant[] consoles) {
+ if (isAvailable()) {
+ Runnable r = new Runnable() {
+ public void run() {
+ for (int i = 0; i < consoles.length; i++) {
+ if (isAvailable()) {
+ ISynchronizeParticipant console = consoles[i];
+ SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fPageToPart.get(console);
+ if (part != null) {
+ partClosed(part);
+ }
+ if (getParticipant() == null) {
+ ISynchronizeParticipant[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ if (available.length > 0) {
+ display(available[available.length - 1]);
+ }
+ }
+ }
+ }
+ }
+ };
+ asyncExec(r);
+ }
+ }
+
+ /**
+ * Constructs a synchronize view
+ */
+ public SynchronizeView() {
+ super();
+ fPageToPart = new HashMap();
+ fPartToPage = new HashMap();
+ }
+
+ /**
+ * Create the default actions for the view. These will be shown regardless of the
+ * participant being displayed.
+ */
+ protected void createActions() {
+ fPageDropDown = new SynchronizePageDropDownAction(this);
+ }
+
+ /**
+ * Add the actions to the toolbar
+ *
+ * @param mgr toolbar manager
+ */
+ protected void configureToolBar(IToolBarManager mgr) {
+ mgr.add(fPageDropDown);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.ISynchronizeView#display(org.eclipse.team.ui.synchronize.ISynchronizeParticipant)
+ */
+ public void display(ISynchronizeParticipant participant) {
+ SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fPageToPart.get(participant);
+ if (part != null) {
+ partActivated(part);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
+ */
+ protected IWorkbenchPart getBootstrapPart() {
+ return null;
+ }
+
+ /**
+ * Registers the given runnable with the display
+ * associated with this view's control, if any.
+ *
+ * @see org.eclipse.swt.widgets.Display#asyncExec(java.lang.Runnable)
+ */
+ public void asyncExec(Runnable r) {
+ if (isAvailable()) {
+ getPageBook().getDisplay().asyncExec(r);
+ }
+ }
+
+ /**
+ * Creates this view's underlying viewer and actions.
+ * Hooks a pop-up menu to the underlying viewer's control,
+ * as well as a key listener. When the delete key is pressed,
+ * the <code>REMOVE_ACTION</code> is invoked. Hooks help to
+ * this view. Subclasses must implement the following methods
+ * which are called in the following order when a view is
+ * created:<ul>
+ * <li><code>createViewer(Composite)</code> - the context
+ * menu is hooked to the viewer's control.</li>
+ * <li><code>createActions()</code></li>
+ * <li><code>configureToolBar(IToolBarManager)</code></li>
+ * <li><code>getHelpContextId()</code></li>
+ * </ul>
+ * @see IWorkbenchPart#createPartControl(Composite)
+ */
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ createActions();
+ IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
+ configureToolBar(tbm);
+ updateForExistingParticipants();
+ getViewSite().getActionBars().updateActionBars();
+ }
+
+ /**
+ * Initialize for existing consoles
+ */
+ private void updateForExistingParticipants() {
+ ISynchronizeManager manager = TeamUI.getSynchronizeManager();
+ // create pages for consoles
+ ISynchronizeParticipant[] consoles = manager.getSynchronizeParticipants();
+ participantsAdded(consoles);
+ // add as a listener
+ manager.addSynchronizeParticipantListener(this);
+ }
+
+ private boolean isAvailable() {
+ return getPageBook() != null && !getPageBook().isDisposed();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
new file mode 100644
index 000000000..aa70b136c
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+
+/**
+ * Fake part to use as keys in page book for synchronize participants
+ */
+public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
+
+ private ISynchronizeParticipant participant = null;
+ private IWorkbenchPartSite site = null;
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ return (obj instanceof SynchronizeViewWorkbenchPart) &&
+ participant.equals(((SynchronizeViewWorkbenchPart)obj).participant);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return participant.hashCode();
+ }
+
+ /**
+ * Constructs a part for the given participant that binds to the given
+ * site
+ */
+ public SynchronizeViewWorkbenchPart(ISynchronizeParticipant participant, IWorkbenchPartSite site) {
+ this.participant = participant;
+ this.site = site;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
+ */
+ public void addPropertyListener(IPropertyListener listener) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite parent) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#dispose()
+ */
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#getSite()
+ */
+ public IWorkbenchPartSite getSite() {
+ return site;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#getTitle()
+ */
+ public String getTitle() {
+ return ""; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#getTitleImage()
+ */
+ public Image getTitleImage() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
+ */
+ public String getTitleToolTip() {
+ return ""; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
+ */
+ public void removePropertyListener(IPropertyListener listener) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ /**
+ * Returns the participant associated with this part.
+ *
+ * @return participant associated with this part
+ */
+ protected ISynchronizeParticipant getConsole() {
+ return participant;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/TeamSynchronizingPerspective.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java
index 356b7ff28..37516716c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/TeamSynchronizingPerspective.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java
new file mode 100644
index 000000000..1d6e8f7b4
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.internal.IHelpContextIds;
+import org.eclipse.ui.internal.WorkbenchMessages;
+
+/**
+ * Clears the selected working set in the working set action group.
+ *
+ * @since 2.1
+ */
+public class ClearWorkingSetAction extends Action {
+ private WorkingSetFilterActionGroup actionGroup;
+
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param actionGroup the action group this action is created in
+ */
+ public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) {
+ super(WorkbenchMessages.getString("ClearWorkingSetAction.text")); //$NON-NLS-1$
+ Assert.isNotNull(actionGroup);
+ setToolTipText(WorkbenchMessages.getString("ClearWorkingSetAction.toolTip")); //$NON-NLS-1$
+ setEnabled(actionGroup.getWorkingSet() != null);
+ WorkbenchHelp.setHelp(this, IHelpContextIds.CLEAR_WORKING_SET_ACTION);
+ this.actionGroup = actionGroup;
+ }
+ /**
+ * Overrides method from Action
+ *
+ * @see org.eclipse.jface.Action#run
+ */
+ public void run() {
+ actionGroup.setWorkingSet(null);
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java
new file mode 100644
index 000000000..c56de08d7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ComparisonCriteriaActionGroup.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ComparisonCriteria;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+
+/**
+ * This action group allows the user to choose one or more comparison critera
+ * to be applied to a comparison
+ */
+public class ComparisonCriteriaActionGroup extends Action implements IMenuCreator {
+
+ private ComparisonCriteria[] criteria;
+ private ComparisonCriteriaAction[] actions;
+ private SubscriberInput input;
+ private Menu fMenu;
+
+ /**
+ * Action for filtering by change type.
+ */
+ class ComparisonCriteriaAction extends Action {
+ private ComparisonCriteria criteria;
+ public ComparisonCriteriaAction(ComparisonCriteria criteria) {
+ super(criteria.getName(), Action.AS_RADIO_BUTTON);
+ this.criteria = criteria;
+ }
+ public void run() {
+ ComparisonCriteriaActionGroup.this.activate(this);
+ }
+ public ComparisonCriteria getComparisonCriteria() {
+ return criteria;
+ }
+ }
+
+ public ComparisonCriteriaActionGroup(SubscriberInput input) {
+ this.input = input;
+ setMenuCreator(this);
+ Utils.initAction(this, "action.comparisonCriteria."); //$NON-NLS-1$
+ initializeActions();
+ }
+
+ public void activate(final ComparisonCriteriaAction activatedAction) {
+ for (int i = 0; i < actions.length; i++) {
+ ComparisonCriteriaAction action = actions[i];
+ action.setChecked(activatedAction == action);
+ }
+ TeamUIPlugin.run(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ // when the comparison criteria changes, recalculate the entire sync set based on
+ // the new input.
+ input.getSubscriber().setCurrentComparisonCriteria(activatedAction.getComparisonCriteria().getId());
+ input.reset();
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ }
+
+ public void initializeActions() {
+ this.criteria = input.getSubscriber().getComparisonCriterias();
+ this.actions = new ComparisonCriteriaAction[criteria.length];
+ for (int i = 0; i < criteria.length; i++) {
+ ComparisonCriteria c = criteria[i];
+ actions[i] = new ComparisonCriteriaAction(c);
+ actions[i].setChecked(c == input.getSubscriber().getCurrentComparisonCriteria());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ public void update() {
+ ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ setEnabled(pages.length >= 1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ fMenu= new Menu(parent);
+ ComparisonCriteria currentComparisonCriteria = input.getSubscriber().getCurrentComparisonCriteria();
+ for (int i = 0; i < actions.length; i++) {
+ ComparisonCriteriaAction action = actions[i];
+ action.setChecked(action.getComparisonCriteria() == currentComparisonCriteria);
+ addActionToMenu(fMenu, action);
+ }
+ return fMenu;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ // do nothing - this is a menu
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ protected void addMenuSeparator() {
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java
new file mode 100644
index 000000000..00220766a
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.internal.IHelpContextIds;
+import org.eclipse.ui.internal.WorkbenchMessages;
+
+/**
+ * Displays an IWorkingSetEditWizard for editing a working set.
+ *
+ * @since 2.1
+ */
+public class EditWorkingSetAction extends Action {
+ private Shell shell;
+ private WorkingSetFilterActionGroup actionGroup;
+
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param actionGroup the action group this action is created in
+ */
+ public EditWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
+ super(WorkbenchMessages.getString("EditWorkingSetAction.text")); //$NON-NLS-1$
+ Assert.isNotNull(actionGroup);
+ setToolTipText(WorkbenchMessages.getString("EditWorkingSetAction.toolTip")); //$NON-NLS-1$
+
+ this.shell = shell;
+ this.actionGroup = actionGroup;
+ WorkbenchHelp.setHelp(this, IHelpContextIds.EDIT_WORKING_SET_ACTION);
+ }
+ /**
+ * Overrides method from Action
+ *
+ * @see org.eclipse.jface.Action#run
+ */
+ public void run() {
+ IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkingSet workingSet = actionGroup.getWorkingSet();
+
+ if (workingSet == null) {
+ setEnabled(false);
+ return;
+ }
+ IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(workingSet);
+ if (wizard == null) {
+ String title = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.title"); //$NON-NLS-1$
+ String message = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.message"); //$NON-NLS-1$
+ MessageDialog.openError(shell, title, message);
+ return;
+ }
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ if (dialog.open() == WizardDialog.OK)
+ actionGroup.setWorkingSet(wizard.getSelection());
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/INavigableControl.java
index 1c5506c74..14e19b114 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/INavigableControl.java
@@ -8,12 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.actions;
public interface INavigableControl {
/**
- * Direction to naviate
+ * Direction to navigate
*/
final public static int NEXT = 1;
final public static int PREVIOUS = 2;
@@ -22,18 +22,4 @@ public interface INavigableControl {
* Returns true if at end or beginning.
*/
boolean gotoDifference(int direction);
-
- /**
- * Preserve the selection for the given direction
- * filter.
- * @param the direction to preserve
- */
- void preserveState(int direction);
-
- /**
- * Restore the selection and expansion for the
- * given direction.
- * @param direction the direction to restore
- */
- void restoreState(int direction);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
new file mode 100644
index 000000000..062c9232e
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.ICompareNavigator;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IKeyBindingService;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+/**
+ * Action to navigate the changes shown in the Synchronize View. This
+ * will coordinate change browsing between the view and the compare
+ * editors.
+ *
+ * @since 3.0
+ */
+public class NavigateAction extends Action {
+ private final int direction;
+ private TeamSubscriberParticipantPage page;
+
+ public NavigateAction(IViewPart part, TeamSubscriberParticipantPage page, int direction) {
+ this.page = page;
+ this.direction = direction;
+
+ IKeyBindingService kbs = part.getSite().getKeyBindingService();
+ if(direction == INavigableControl.NEXT) {
+ Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$
+ page.getSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.NEXT, this);
+ } else {
+ Utils.initAction(this, "action.navigatePrevious."); //$NON-NLS-1$
+ page.getSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, this);
+ }
+ }
+
+ public void run() {
+ navigate();
+ }
+
+ private void navigate() {
+ SyncInfo info = getSyncInfoFromSelection();
+ INavigableControl navigable = (INavigableControl)page.getViewer();
+ if(info == null) {
+ if(navigable.gotoDifference(direction)) {
+ return;
+ } else {
+ info = getSyncInfoFromSelection();
+ if(info == null) return;
+ }
+ }
+
+ if(info.getLocal().getType() != IResource.FILE) {
+ if(! navigable.gotoDifference(direction)) {
+ info = getSyncInfoFromSelection();
+ OpenInCompareAction.openCompareEditor(page, info, true /* keep focus */);
+ }
+ return;
+ }
+
+ IEditorPart editor = OpenInCompareAction.findOpenCompareEditor(page.getSynchronizeView().getSite(), info.getLocal());
+ boolean atEnd = false;
+ CompareEditorInput input;
+ ICompareNavigator navigator;
+
+ if(editor != null) {
+ // if an existing editor is open on the current selection, use it
+ input = (CompareEditorInput)editor.getEditorInput();
+ navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class);
+ if(navigator != null) {
+ if(navigator.selectChange(direction == INavigableControl.NEXT)) {
+ if(! navigable.gotoDifference(direction)) {
+ info = getSyncInfoFromSelection();
+ OpenInCompareAction.openCompareEditor(page, info, true /* keep focus */);
+ }
+ }
+ }
+ } else {
+ // otherwise, select the next change and open a compare editor which will automatically
+ // show the first change.
+ OpenInCompareAction.openCompareEditor(page, info, true /* keep focus */);
+ }
+ }
+
+ private SyncInfo getSyncInfoFromSelection() {
+ IStructuredSelection selection = (IStructuredSelection)page.getSynchronizeView().getSite().getPage().getSelection();
+ if(selection == null) return null;
+ Object obj = selection.getFirstElement();
+ SyncInfo info = OpenInCompareAction.getSyncInfo(obj);
+ return info;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
new file mode 100644
index 000000000..f5f90cc77
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.actions.OpenFileAction;
+
+public class OpenFileInSystemEditorAction extends OpenFileAction {
+
+ public OpenFileInSystemEditorAction(IWorkbenchPage page) {
+ super(page);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedResources()
+ */
+ protected List getSelectedResources() {
+ List resources = new ArrayList();
+ IStructuredSelection selection = getStructuredSelection();
+ for (Iterator e = selection.iterator(); e.hasNext();) {
+ Object next = e.next();
+ IResource resource = SyncSetContentProvider.getResource(next);
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ return resources;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedNonResources()
+ */
+ protected List getSelectedNonResources() {
+ return Collections.EMPTY_LIST;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index bff48b9f0..8ec603520 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
@@ -24,10 +24,12 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.sync.compare.SyncInfoCompareInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
+import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoCompareInput;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
@@ -43,37 +45,39 @@ import org.eclipse.ui.IWorkbenchPartSite;
*/
public class OpenInCompareAction extends Action {
- private SynchronizeView viewer;
+ private TeamSubscriberParticipantPage part;
- public OpenInCompareAction(SynchronizeView viewer) {
- this.viewer = viewer;
+ public OpenInCompareAction(TeamSubscriberParticipantPage part) {
+ this.part = part;
Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$
}
public void run() {
- ISelection selection = viewer.getViewer().getSelection();
+ ISelection selection = part.getSite().getPage().getSelection();
Object obj = ((IStructuredSelection)selection).getFirstElement();
- SyncInfo info = getSyncInfo(obj);
- openCompareEditor(viewer, info, true /* keep focus */);
+ SyncInfo info = getSyncInfo(obj);
+ if(info != null) {
+ openCompareEditor(part, info, true /* keep focus */);
+ }
}
- public static SyncInfoCompareInput openCompareEditor(SynchronizeView viewer, SyncInfo info, boolean keepFocus) {
- SyncInfoCompareInput input = getCompareInput(info);
+ public static SyncInfoCompareInput openCompareEditor(TeamSubscriberParticipantPage page, SyncInfo info, boolean keepFocus) {
+ SyncInfoCompareInput input = getCompareInput(page.getParticipant(), info);
if(input != null) {
- IWorkbenchPage page = viewer.getSite().getPage();
- IEditorPart editor = findReusableCompareEditor(page);
+ IWorkbenchPage wpage = page.getSite().getPage();
+ IEditorPart editor = findReusableCompareEditor(wpage);
if(editor != null) {
IEditorInput otherInput = editor.getEditorInput();
if(otherInput instanceof SyncInfoCompareInput && otherInput.equals(input)) {
// simply provide focus to editor
- page.activate(editor);
+ wpage.activate(editor);
} else {
// if editor is currently not open on that input either re-use existing
- if (!prefetchFileContents(viewer, info)) return null;
+ if (!prefetchFileContents(info)) return null;
if(editor != null && editor instanceof IReusableEditor) {
CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
- page.activate(editor);
+ wpage.activate(editor);
}
}
} else {
@@ -81,7 +85,7 @@ public class OpenInCompareAction extends Action {
}
if(keepFocus) {
- SynchronizeView.showInActivePage(viewer.getSite().getPage(), false /* don't switch perspectives */);
+ wpage.activate(page.getSynchronizeView());
}
return input;
}
@@ -93,12 +97,12 @@ public class OpenInCompareAction extends Action {
* so that the compare editor doesn't have to perform file transfers. This will
* make the transfer cancellable.
*/
- private static boolean prefetchFileContents(SynchronizeView viewer, SyncInfo info) {
+ private static boolean prefetchFileContents(SyncInfo info) {
final IRemoteResource remote = info.getRemote();
final IRemoteResource base = info.getBase();
if (remote != null || base != null) {
final boolean[] ok = new boolean[] { true };
- viewer.run(new IRunnableWithProgress() {
+ TeamUIPlugin.run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
monitor.beginTask(null, (remote == null ? 0 : 100) + (base == null ? 0 : 100));
@@ -125,9 +129,9 @@ public class OpenInCompareAction extends Action {
/**
* Returns a SyncInfoCompareInput instance for the current selection.
*/
- private static SyncInfoCompareInput getCompareInput(SyncInfo info) {
+ private static SyncInfoCompareInput getCompareInput(ISynchronizeParticipant participant, SyncInfo info) {
if (info != null && info.getLocal() instanceof IFile) {
- return SyncInfoCompareInput.createInput(info);
+ return SyncInfoCompareInput.createInput(participant, info);
}
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
index 3feeb9b5b..0720baf62 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
@@ -8,45 +8,44 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.OpenFileAction;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.OpenWithMenu;
import org.eclipse.ui.views.navigator.ResourceNavigatorMessages;
/**
- * This is the action group for the open actions.
+ * This is the action group for the open actions. It contains open
+ * actions for
*/
-public class OpenWithActionGroup extends SyncViewerActionGroup {
+public class OpenWithActionGroup extends ActionGroup {
- private OpenFileAction openFileAction;
+ private OpenFileInSystemEditorAction openFileAction;
private OpenInCompareAction openInCompareAction;
+ private TeamSubscriberParticipantPage page;
+ private IViewPart part;
- public OpenWithActionGroup(SynchronizeView viewer) {
- super(viewer);
+ public OpenWithActionGroup(TeamSubscriberParticipantPage page) {
+ this.page = page;
+ this.part = page.getSynchronizeView();
makeActions();
}
protected void makeActions() {
- openFileAction = new OpenFileAction(getSyncView().getSite().getPage());
- openInCompareAction = new OpenInCompareAction(getSyncView());
+ openFileAction = new OpenFileInSystemEditorAction(part.getSite().getPage());
+ openInCompareAction = new OpenInCompareAction(page);
}
public void fillContextMenu(IMenuManager menu) {
- ActionContext context = getContext();
- IStructuredSelection selection = null;
- if (context != null) {
- selection = (IStructuredSelection) context.getSelection();
- }
- fillOpenWithMenu(menu, selection);
+ fillOpenWithMenu(menu, (IStructuredSelection)part.getSite().getPage().getSelection());
}
/**
@@ -77,7 +76,7 @@ public class OpenWithActionGroup extends SyncViewerActionGroup {
MenuManager submenu =
new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.openWith")); //$NON-NLS-1$
- submenu.add(new OpenWithMenu(getSyncView().getSite().getPage(), (IFile) resource));
+ submenu.add(new OpenWithMenu(part.getSite().getPage(), (IFile) resource));
menu.add(submenu);
}
@@ -93,7 +92,7 @@ public class OpenWithActionGroup extends SyncViewerActionGroup {
}
private IResource getResource(Object obj) {
- return (IResource)TeamAction.getAdapter(obj, IResource.class);
+ return SyncSetContentProvider.getResource(obj);
}
public void openInCompareEditor() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
index c39157b4b..13930ea8c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefactorActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
@@ -8,24 +8,28 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.DeleteResourceAction;
import org.eclipse.ui.actions.MoveResourceAction;
import org.eclipse.ui.actions.RenameResourceAction;
@@ -36,30 +40,19 @@ import org.eclipse.ui.actions.TextActionHandler;
* the org.eclipse.ui.workbench plugin. We couldn't reuse that class
* because of a hard dependency on the navigator.
*/
-public class RefactorActionGroup extends SyncViewerActionGroup {
+public class RefactorActionGroup extends ActionGroup {
- private Clipboard clipboard;
-
- private CopyAction copyAction;
private DeleteResourceAction deleteAction;
- private PasteAction pasteAction;
private MoveResourceAction moveAction;
private RenameResourceAction renameAction;
private TextActionHandler textActionHandler;
+ private IWorkbenchPart part;
- protected RefactorActionGroup(SynchronizeView syncView) {
- super(syncView);
+ public RefactorActionGroup(IWorkbenchPart part) {
+ this.part = part;
makeActions();
}
- public void dispose() {
- if (clipboard != null) {
- clipboard.dispose();
- clipboard = null;
- }
- super.dispose();
- }
-
public void fillContextMenu(IMenuManager parentMenu) {
IStructuredSelection selection = getSelection();
@@ -70,48 +63,44 @@ public class RefactorActionGroup extends SyncViewerActionGroup {
IResource.PROJECT | IResource.FOLDER | IResource.FILE);
MenuManager menu = new MenuManager(Policy.bind("RefactorActionGroup.0")); //$NON-NLS-1$
- copyAction.selectionChanged(selection);
- menu.add(copyAction);
- pasteAction.selectionChanged(selection);
- menu.add(pasteAction);
-
+ IStructuredSelection convertedSelection = convertSelection(selection);
+
if (anyResourceSelected) {
- deleteAction.selectionChanged(selection);
+ deleteAction.selectionChanged(convertedSelection);
menu.add(deleteAction);
- moveAction.selectionChanged(selection);
+ moveAction.selectionChanged(convertedSelection);
menu.add(moveAction);
- renameAction.selectionChanged(selection);
+ renameAction.selectionChanged(convertedSelection);
menu.add(renameAction);
}
parentMenu.add(menu);
}
+ private IStructuredSelection convertSelection(IStructuredSelection selection) {
+ List resources = new ArrayList();
+ Iterator it = selection.iterator();
+ while(it.hasNext()) {
+ IResource resource = SyncSetContentProvider.getResource(it.next());
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ return new StructuredSelection(resources);
+ }
+
public void fillActionBars(IActionBars actionBars) {
textActionHandler = new TextActionHandler(actionBars); // hooks handlers
- textActionHandler.setCopyAction(copyAction);
- textActionHandler.setPasteAction(pasteAction);
textActionHandler.setDeleteAction(deleteAction);
renameAction.setTextActionHandler(textActionHandler);
}
protected void makeActions() {
// Get the key binding service for registering actions with commands.
- final IWorkbenchPartSite site = getSyncView().getSite();
+ final IWorkbenchPartSite site = part.getSite();
final IKeyBindingService keyBindingService = site.getKeyBindingService();
Shell shell = site.getShell();
- clipboard = new Clipboard(shell.getDisplay());
-
- pasteAction = new PasteAction(shell, clipboard);
ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
- pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- pasteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER));
-
- copyAction = new CopyAction(shell, clipboard, pasteAction);
- copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
- copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- copyAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
moveAction = new MoveResourceAction(shell);
renameAction = new RenameResourceAction(shell);
@@ -130,15 +119,13 @@ public class RefactorActionGroup extends SyncViewerActionGroup {
public void updateActionBars() {
IStructuredSelection selection = getSelection();
- copyAction.selectionChanged(selection);
- pasteAction.selectionChanged(selection);
deleteAction.selectionChanged(selection);
moveAction.selectionChanged(selection);
renameAction.selectionChanged(selection);
}
private IStructuredSelection getSelection() {
- return (IStructuredSelection)getSyncView().getSelection();
+ return (IStructuredSelection)part.getSite().getPage().getSelection();
}
private boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) {
@@ -152,6 +139,9 @@ public class RefactorActionGroup extends SyncViewerActionGroup {
IAdaptable adaptable = (IAdaptable)next;
resource = (IResource)adaptable.getAdapter(IResource.class);
}
+ if(resource == null) {
+ resource = SyncSetContentProvider.getResource(next);
+ }
if (resource == null || (resource.getType() & resourceMask) == 0) {
return false;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java
index ee1455f31..9f7dfb26b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java
@@ -8,9 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
+import java.util.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -18,66 +19,72 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.team.ui.sync.SubscriberAction;
-import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
+import org.eclipse.ui.IWorkbenchPage;
public class RefreshAction extends Action {
- private final SyncViewerActions actions;
private boolean refreshAll;
+ private IWorkbenchPage page;
+ private TeamSubscriberParticipant participant;
- public RefreshAction(SyncViewerActions actions, boolean refreshAll) {
+ public RefreshAction(IWorkbenchPage page, TeamSubscriberParticipant participant, boolean refreshAll) {
+ this.participant = participant;
+ this.page = page;
this.refreshAll = refreshAll;
- this.actions = actions;
Utils.initAction(this, "action.refreshWithRemote."); //$NON-NLS-1$
}
public void run() {
- final SynchronizeView view = actions.getSyncView();
- ActionContext context = actions.getContext();
- if(context != null) {
- getResources(context.getSelection());
- SubscriberInput input = (SubscriberInput)context.getInput();
- IResource[] resources = getResources(context.getSelection());
+ ISelection selection = page.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ IResource[] resources = getResources((IStructuredSelection)selection);
+ SubscriberInput input = participant.getInput();
if (refreshAll || resources.length == 0) {
// If no resources are selected, refresh all the subscriber roots
resources = input.workingSetRoots();
}
- run(view, resources, input.getSubscriber());
+ run(resources, participant);
}
}
- private IResource[] getResources(ISelection selection) {
+ private IResource[] getResources(IStructuredSelection selection) {
if(selection == null) {
return new IResource[0];
}
- return (IResource[])TeamAction.getSelectedAdaptables(selection, IResource.class);
+ List resources = new ArrayList();
+ Iterator it = selection.iterator();
+ while(it.hasNext()) {
+ IResource resource = SyncSetContentProvider.getResource(it.next());
+ if(resource != null) {
+ resources.add(resource);
+ }
+ }
+ return (IResource[]) resources.toArray(new IResource[resources.size()]);
}
- public static void run(SynchronizeView viewer, IResource[] resources, TeamSubscriber subscriber) {
+ public static void run(IResource[] resources, TeamSubscriberParticipant participant) {
// Cancel the scheduled background refresh or any other refresh that is happening.
// The scheduled background refresh will restart automatically.
Platform.getJobManager().cancel(RefreshSubscriberJob.getFamily());
if(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_BACKGROUND_SYNC)) {
- RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", new Integer(resources.length).toString(), subscriber.getName()), resources, subscriber); //$NON-NLS-1$
+ RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", participant.getName()), resources, participant.getInput().getSubscriber()); //$NON-NLS-1$
JobStatusHandler.schedule(job, SubscriberAction.SUBSCRIBER_JOB_TYPE);
} else {
- runBlocking(viewer, subscriber, resources);
+ runBlocking(participant.getInput().getSubscriber(), resources);
}
}
- private static void runBlocking(SynchronizeView viewer, final TeamSubscriber s, final IResource[] resources) {
- viewer.run(new IRunnableWithProgress() {
+ private static void runBlocking(final TeamSubscriber s, final IResource[] resources) {
+ TeamUIPlugin.run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
monitor.beginTask(null, 100);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java
new file mode 100644
index 000000000..8a5d104fe
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.*;
+import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.internal.IHelpContextIds;
+import org.eclipse.ui.internal.WorkbenchMessages;
+
+/**
+ * Displays an IWorkingSetSelectionDialog and sets the selected
+ * working set in the action group.
+ *
+ * @since 2.1
+ */
+public class SelectWorkingSetAction extends Action {
+ private Shell shell;
+ private WorkingSetFilterActionGroup actionGroup;
+
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param actionGroup the action group this action is created in
+ * @param shell shell to use for opening working set selection dialog.
+ */
+ public SelectWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
+ super(WorkbenchMessages.getString("SelectWorkingSetAction.text")); //$NON-NLS-1$
+ Assert.isNotNull(actionGroup);
+ setToolTipText(WorkbenchMessages.getString("SelectWorkingSetAction.toolTip")); //$NON-NLS-1$
+
+ this.shell = shell;
+ this.actionGroup = actionGroup;
+ WorkbenchHelp.setHelp(this, IHelpContextIds.SELECT_WORKING_SET_ACTION);
+ }
+ /**
+ * Overrides method from Action
+ *
+ * @see org.eclipse.jface.Action#run
+ */
+ public void run() {
+ IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(shell, false);
+ IWorkingSet workingSet = actionGroup.getWorkingSet();
+
+ if (workingSet != null)
+ dialog.setSelection(new IWorkingSet[]{workingSet});
+
+ if (dialog.open() == Window.OK) {
+ IWorkingSet[] result = dialog.getSelection();
+ if (result != null && result.length > 0) {
+ actionGroup.setWorkingSet(result[0]);
+ manager.addRecentWorkingSet(result[0]);
+ }
+ else {
+ actionGroup.setWorkingSet(null);
+ }
+ }
+ else
+ actionGroup.setWorkingSet(workingSet);
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
new file mode 100644
index 000000000..e0d21abd6
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+
+public class ShowSynchronizeParticipantAction extends Action {
+
+ private ISynchronizeParticipant fPage;
+ private ISynchronizeView fView;
+
+ public void run() {
+ if (!fPage.equals(fView.getParticipant())) {
+ fView.display(fPage);
+ }
+ }
+
+ /**
+ * Constructs an action to display the given synchronize participant in the
+ * synchronize view.
+ *
+ * @param view the synchronize view in which the given page is contained
+ * @param participant the participant to show
+ */
+ public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipant participant) {
+ super(participant.getName(), Action.AS_RADIO_BUTTON);
+ fPage = participant;
+ fView = view;
+ setImageDescriptor(participant.getImageDescriptor());
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
new file mode 100644
index 000000000..1fe202a2b
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.StatusLineLayoutData;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+
+public class StatusLineCLabelContribution extends ContributionItem {
+
+ public final static int DEFAULT_CHAR_WIDTH = 40;
+
+ private int charWidth;
+ private CLabel label;
+ private Image image;
+ private String text = ""; //$NON-NLS-1$
+ private int widthHint = -1;
+
+ public StatusLineCLabelContribution(String id) {
+ this(id, DEFAULT_CHAR_WIDTH);
+ }
+
+ public StatusLineCLabelContribution(String id, int charWidth) {
+ super(id);
+ this.charWidth = charWidth;
+ setVisible(false); // no text to start with
+ }
+
+ public void fill(Composite parent) {
+ label = new CLabel(parent, SWT.SHADOW_IN);
+ StatusLineLayoutData statusLineLayoutData = new StatusLineLayoutData();
+
+ if (widthHint < 0) {
+ GC gc = new GC(parent);
+ gc.setFont(parent.getFont());
+ widthHint = gc.getFontMetrics().getAverageCharWidth() * charWidth;
+ gc.dispose();
+ }
+
+ statusLineLayoutData.widthHint = widthHint;
+ label.setLayoutData(statusLineLayoutData);
+ label.setText(text);
+ label.setImage(image);
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ if (text == null)
+ throw new NullPointerException();
+
+ this.text = text;
+
+ if (label != null && !label.isDisposed())
+ label.setText(this.text);
+
+ if (this.text.length() == 0) {
+ if (isVisible()) {
+ setVisible(false);
+ IContributionManager contributionManager = getParent();
+
+ if (contributionManager != null)
+ contributionManager.update(true);
+ }
+ } else {
+ if (!isVisible()) {
+ setVisible(true);
+ IContributionManager contributionManager = getParent();
+
+ if (contributionManager != null)
+ contributionManager.update(true);
+ }
+ }
+ }
+
+ public void setImage(Image image) {
+ if (image == null)
+ throw new NullPointerException();
+
+ this.image = image;
+
+ if (label != null && !label.isDisposed())
+ label.setImage(this.image);
+
+ if (!isVisible()) {
+ setVisible(true);
+ IContributionManager contributionManager = getParent();
+
+ if (contributionManager != null)
+ contributionManager.update(true);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
new file mode 100644
index 000000000..636f7c2a2
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.synchronize.sets.ISyncSetChangedListener;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncInfoStatistics;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSetChangedEvent;
+import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionGroup;
+
+public class StatusLineContributionGroup extends ActionGroup implements ISyncSetChangedListener {
+
+ private static final String INCOMING_ID = "org.eclipse.team.iu.statusline.incoming"; //$NON-NLS-1$
+ private static final String OUTGOING_ID = "org.eclipse.team.iu.statusline.outgoing"; //$NON-NLS-1$
+ private static final String CONFLICTING_ID = "org.eclipse.team.iu.statusline.conflicting"; //$NON-NLS-1$
+
+ private StatusLineCLabelContribution incoming;
+ private StatusLineCLabelContribution outgoing;
+ private StatusLineCLabelContribution conflicting;
+ private SubscriberInput input;
+
+ public StatusLineContributionGroup(SubscriberInput input) {
+ super();
+ this.incoming = createStatusLineContribution(INCOMING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage()); //$NON-NLS-1$
+ this.outgoing = createStatusLineContribution(OUTGOING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage()); //$NON-NLS-1$
+ this.conflicting = createStatusLineContribution(CONFLICTING_ID, "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage()); //$NON-NLS-1$
+ this.input = input;
+ input.registerListeners(this);
+ }
+
+ private StatusLineCLabelContribution createStatusLineContribution(String id, String label, Image image) {
+ StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15);
+ item.setText(Policy.bind("StatisticsPanel.outgoing")); //$NON-NLS-1$
+ if(image != null) {
+ item.setImage(image);
+ TeamUIPlugin.disposeOnShutdown(image);
+ }
+ return item;
+ }
+
+ public void dispose() {
+ input.deregisterListeners(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent)
+ */
+ public void syncSetChanged(SyncSetChangedEvent event) {
+ if(input != null) {
+ SyncInfoStatistics workspaceSetStats = input.getSubscriberSyncSet().getStatistics();
+ SyncInfoStatistics workingSetSetStats = input.getWorkingSetSyncSet().getStatistics();
+
+ final int workspaceConflicting = (int)workspaceSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
+ final int workspaceOutgoing = (int)workspaceSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
+ final int workspaceIncoming = (int)workspaceSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
+ final int workingSetConflicting = (int)workingSetSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
+ final int workingSetOutgoing = (int)workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
+ final int workingSetIncoming = (int)workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
+
+ TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if(input.getWorkingSet() != null) {
+ conflicting.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
+ incoming.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
+ outgoing.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
+ } else {
+ conflicting.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$
+ incoming.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$
+ outgoing.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$
+ }
+ }
+ });
+
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ IStatusLineManager mgr = actionBars.getStatusLineManager();
+ mgr.add(incoming);
+ mgr.add(outgoing);
+ mgr.add(conflicting);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
index b7aa99a9c..ca6abf4a0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerShowPreferencesAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.actions;
+package org.eclipse.team.internal.ui.synchronize.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
new file mode 100644
index 000000000..6878b4741
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.ui.texteditor.IUpdate;
+
+public class SynchronizePageDropDownAction extends Action implements IMenuCreator, ISynchronizeParticipantListener, IUpdate {
+
+ private ISynchronizeView fView;
+ private Menu fMenu;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ public void update() {
+ ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ setEnabled(pages.length >= 1);
+ }
+
+ public SynchronizePageDropDownAction(ISynchronizeView view) {
+ fView= view;
+ Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
+ setMenuCreator(this);
+ TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
+ update();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fView= null;
+ TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ fMenu= new Menu(parent);
+ ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ ISynchronizeParticipant current = fView.getParticipant();
+ for (int i = 0; i < pages.length; i++) {
+ ISynchronizeParticipant page = pages[i];
+ Action action = new ShowSynchronizeParticipantAction(fView, page);
+ action.setChecked(page.equals(current));
+ addActionToMenu(fMenu, action);
+ }
+ return fMenu;
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ protected void addMenuSeparator() {
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ // do nothing - this is a menu
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
+ */
+ public void participantsAdded(ISynchronizeParticipant[] consoles) {
+ Display display = TeamUIPlugin.getStandardDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ update();
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
+ */
+ public void participantsRemoved(ISynchronizeParticipant[] consoles) {
+ Display display = TeamUIPlugin.getStandardDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ update();
+ }
+ });
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TextToolbarManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TextToolbarManager.java
new file mode 100644
index 000000000..fc70e84fc
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TextToolbarManager.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
+
+/**
+ * Experimental toolbar that supports toolitem action contributions that support
+ * showing a text label.
+ */
+public class TextToolbarManager extends ToolBarManager {
+
+ public TextToolbarManager(int style) {
+ super(style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IContributionManager#add(org.eclipse.jface.action.IAction)
+ */
+ public void add(IAction action) {
+ super.add(new ToolItemActionContributionItem(action));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IContributionManager#add(org.eclipse.jface.action.IAction)
+ */
+ public void add(IAction action, int preferedSize) {
+ super.add(new ToolItemActionContributionItem(action, preferedSize));
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java
new file mode 100644
index 000000000..e7a13b425
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+
+public class ToggleViewLayoutAction extends Action implements IPropertyChangeListener {
+ private int layout;
+ private TeamSubscriberParticipant participant;
+
+ public ToggleViewLayoutAction(TeamSubscriberParticipant participant, int layout) {
+ super(null, SWT.RADIO);
+ this.participant = participant;
+ this.layout = layout;
+ if(layout == TeamSubscriberParticipant.TABLE_LAYOUT) {
+ Utils.initAction(this, "action.toggleViewFlat."); //$NON-NLS-1$
+ } else {
+ Utils.initAction(this, "action.toggleViewHierarchical."); //$NON-NLS-1$
+ }
+ setChecked(participant.getLayout() == layout);
+ participant.addPropertyChangeListener(this);
+ }
+
+ public void run() {
+ participant.setLayout(layout);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getProperty().equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_LAYOUT)) {
+ Integer newLayout = (Integer)event.getNewValue();
+ setChecked(newLayout.intValue() == layout);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToolItemActionContributionItem.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToolItemActionContributionItem.java
new file mode 100644
index 000000000..5c1193b4d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToolItemActionContributionItem.java
@@ -0,0 +1,851 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.util.*;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.*;
+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.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Experimental support for toolitem action contributions that support
+ * showing a text label.
+ */
+public class ToolItemActionContributionItem extends ContributionItem {
+
+ private static boolean USE_COLOR_ICONS = true;
+
+ private static ImageCache globalImageCache;
+
+ /**
+ * The action.
+ */
+ private IAction action;
+
+ /**
+ * The widget created for this item; <code>null</code>
+ * before creation and after disposal.
+ */
+ private Widget widget = null;
+
+ /**
+ * Remembers the parent widget.
+ */
+ private Widget parentWidget = null;
+
+ private int preferedSize = -1;
+
+ /**
+ * Listener for action property change notifications.
+ */
+ private final IPropertyChangeListener propertyListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ actionPropertyChange(event);
+ }
+ };
+
+ /**
+ * Listener for SWT button widget events.
+ */
+ private Listener buttonListener;
+
+ /**
+ * Listener for SWT tool item widget events.
+ */
+ private Listener toolItemListener;
+
+ /**
+ * Listener for SWT menu item widget events.
+ */
+ private Listener menuItemListener;
+
+ private static class ImageCache {
+ /** Map from ImageDescriptor to Entry */
+ private Map entries = new HashMap(11);
+ private Image missingImage;
+
+ private class Entry {
+ Image image;
+ Image grayImage;
+
+ void dispose() {
+ if (image != null) {
+ image.dispose();
+ image = null;
+ }
+ if (grayImage != null) {
+ grayImage.dispose();
+ grayImage = null;
+ }
+ }
+ }
+
+ Entry getEntry(ImageDescriptor desc) {
+ Entry entry = (Entry) entries.get(desc);
+ if (entry == null) {
+ entry = new Entry();
+ entries.put(desc, entry);
+ }
+ return entry;
+ }
+
+ Image getImage(ImageDescriptor desc) {
+ if (desc == null) {
+ return null;
+ }
+ Entry entry = getEntry(desc);
+ if (entry.image == null) {
+ entry.image = desc.createImage();
+ }
+ return entry.image;
+ }
+
+ Image getGrayImage(ImageDescriptor desc) {
+ if (desc == null) {
+ return null;
+ }
+ Entry entry = getEntry(desc);
+ if (entry.grayImage == null) {
+ Image image = getImage(desc);
+ if (image != null) {
+ entry.grayImage = new Image(null, image, SWT.IMAGE_GRAY);
+ }
+ }
+ return entry.grayImage;
+ }
+
+ Image getMissingImage() {
+ if (missingImage == null) {
+ missingImage = getImage(ImageDescriptor.getMissingImageDescriptor());
+ }
+ return missingImage;
+ }
+
+ void dispose() {
+ for (Iterator i = entries.values().iterator(); i.hasNext();) {
+ Entry entry = (Entry) i.next();
+ entry.dispose();
+ }
+ entries.clear();
+ }
+ }
+
+public boolean isVisible() {
+ IAction action = getAction();
+
+ if (action != null) {
+ String commandId = action.getActionDefinitionId();
+ CommandResolver.ICallback callback = CommandResolver.getInstance().getCommandResolver();
+
+ if (callback != null)
+ return callback.inContext(commandId);
+ }
+
+ return true;
+}
+
+/**
+ * Returns whether color icons should be used in toolbars.
+ *
+ * @return <code>true</code> if color icons should be used in toolbars,
+ * <code>false</code> otherwise
+ */
+public static boolean getUseColorIconsInToolbars() {
+ return USE_COLOR_ICONS;
+}
+
+/**
+ * Sets whether color icons should be used in toolbars.
+ *
+ * @param useColorIcons <code>true</code> if color icons should be used in toolbars,
+ * <code>false</code> otherwise
+ */
+public static void setUseColorIconsInToolbars(boolean useColorIcons) {
+ USE_COLOR_ICONS = useColorIcons;
+}
+
+/**
+ * Creates a new contribution item from the given action.
+ * The id of the action is used as the id of the item.
+ *
+ * @param action the action
+ */
+public ToolItemActionContributionItem(IAction action) {
+ super(action.getId());
+ this.action = action;
+}
+
+/**
+ * @param action2
+ * @param preferedSize
+ */
+public ToolItemActionContributionItem(IAction action, int preferedSize) {
+ this(action);
+ this.preferedSize = preferedSize;
+}
+
+/**
+ * Handles a property change event on the action (forwarded by nested listener).
+ */
+private void actionPropertyChange(final PropertyChangeEvent e) {
+ // This code should be removed. Avoid using free asyncExec
+
+ if (isVisible() && widget != null) {
+ Display display = widget.getDisplay();
+ if (display.getThread() == Thread.currentThread()) {
+ update(e.getProperty());
+ }
+ else {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ update(e.getProperty());
+ }
+ });
+ }
+
+ }
+}
+/**
+ * Checks whether the given menu item belongs to a context menu
+ * (the one that pops up if the user presses the right mouse button).
+ */
+private static boolean belongsToContextMenu(MenuItem item) {
+ Menu menu = item.getParent();
+ if (menu == null)
+ return false;
+ while (menu.getParentMenu() != null)
+ menu = menu.getParentMenu();
+ return (menu.getStyle() & SWT.BAR) == 0;
+}
+/**
+ * Compares this action contribution item with another object.
+ * Two action contribution items are equal if they refer to the identical Action.
+ */
+public boolean equals(Object o) {
+ if (!(o instanceof ToolItemActionContributionItem)) {
+ return false;
+ }
+ return action.equals(((ToolItemActionContributionItem) o).action);
+}
+/**
+ * The <code>ActionContributionItem</code> implementation of this
+ * <code>IContributionItem</code> method creates an SWT <code>Button</code> for
+ * the action using the action's style. If the action's checked property has
+ * been set, the button is created and primed to the value of the checked
+ * property.
+ */
+public void fill(Composite parent) {
+ if (widget == null && parent != null) {
+ int flags = SWT.PUSH;
+ if (action != null) {
+ if (action.getStyle() == IAction.AS_CHECK_BOX)
+ flags = SWT.TOGGLE;
+ if (action.getStyle() == IAction.AS_RADIO_BUTTON)
+ flags = SWT.RADIO;
+ }
+
+ Button b = new Button(parent, flags);
+ b.setData(this);
+ b.addListener(SWT.Dispose, getButtonListener());
+ // Don't hook a dispose listener on the parent
+ b.addListener(SWT.Selection, getButtonListener());
+ if (action.getHelpListener() != null)
+ b.addHelpListener(action.getHelpListener());
+ widget = b;
+ parentWidget = parent;
+
+ update(null);
+
+ action.addPropertyChangeListener(propertyListener);
+ }
+}
+/**
+ * The <code>ActionContributionItem</code> implementation of this
+ * <code>IContributionItem</code> method creates an SWT <code>MenuItem</code>
+ * for the action using the action's style. If the action's checked property has
+ * been set, a button is created and primed to the value of the checked
+ * property. If the action's menu creator property has been set, a cascading
+ * submenu is created.
+ */
+public void fill(Menu parent, int index) {
+ if (widget == null && parent != null) {
+ Menu subMenu= null;
+ int flags = SWT.PUSH;
+ if (action != null) {
+ int style = action.getStyle();
+ if (style == IAction.AS_CHECK_BOX)
+ flags= SWT.CHECK;
+ else if (style == IAction.AS_RADIO_BUTTON)
+ flags = SWT.RADIO;
+ else if (style == IAction.AS_DROP_DOWN_MENU) {
+ IMenuCreator mc = action.getMenuCreator();
+ if (mc != null) {
+ subMenu = mc.getMenu(parent);
+ flags = SWT.CASCADE;
+ }
+ }
+ }
+
+ MenuItem mi = null;
+ if (index >= 0)
+ mi = new MenuItem(parent, flags, index);
+ else
+ mi = new MenuItem(parent, flags);
+ widget = mi;
+ parentWidget = parent;
+
+ mi.setData(this);
+ mi.addListener(SWT.Dispose, getMenuItemListener());
+ mi.addListener(SWT.Selection, getMenuItemListener());
+ if (action.getHelpListener() != null)
+ mi.addHelpListener(action.getHelpListener());
+
+ if (subMenu != null)
+ mi.setMenu(subMenu);
+
+ update(null);
+
+ action.addPropertyChangeListener(propertyListener);
+ }
+}
+/**
+ * The <code>ActionContributionItem</code> implementation of this ,
+ * <code>IContributionItem</code> method creates an SWT <code>ToolItem</code>
+ * for the action using the action's style. If the action's checked property has
+ * been set, a button is created and primed to the value of the checked
+ * property. If the action's menu creator property has been set, a drop-down
+ * tool item is created.
+ */
+public void fill(ToolBar parent, int index) {
+ if (widget == null && parent != null) {
+ int flags = SWT.PUSH;
+ if (action != null) {
+ int style = action.getStyle();
+ if (style == IAction.AS_CHECK_BOX)
+ flags = SWT.CHECK;
+ else if (style == IAction.AS_RADIO_BUTTON)
+ flags = SWT.RADIO;
+ else if (style == IAction.AS_DROP_DOWN_MENU)
+ flags = SWT.DROP_DOWN;
+ }
+
+ ToolItem ti = null;
+ if (index >= 0)
+ ti = new ToolItem(parent, flags, index);
+ else
+ ti = new ToolItem(parent, flags);
+ ti.setData(this);
+ ti.addListener(SWT.Selection, getToolItemListener());
+ ti.addListener(SWT.Dispose, getToolItemListener());
+
+ if(preferedSize != -1) {
+ ti.setWidth(preferedSize);
+ }
+
+ widget = ti;
+ parentWidget = parent;
+
+ update(null);
+
+ action.addPropertyChangeListener(propertyListener);
+ }
+}
+/**
+ * Returns the action associated with this contribution item.
+ *
+ * @return the action
+ */
+public IAction getAction() {
+ return action;
+}
+/**
+ * Returns the image cache.
+ * The cache is global, and is shared by all action contribution items.
+ * This has the disadvantage that once an image is allocated, it is never freed until the display
+ * is disposed. However, it has the advantage that the same image in different contribution managers
+ * is only ever created once.
+ */
+private ImageCache getImageCache() {
+ ImageCache cache = globalImageCache;
+ if (cache == null) {
+ globalImageCache = cache = new ImageCache();
+ Display display = Display.getDefault();
+ if (display != null) {
+ display.disposeExec(new Runnable() {
+ public void run() {
+ if (globalImageCache != null) {
+ globalImageCache.dispose();
+ globalImageCache = null;
+ }
+ }
+ });
+ }
+ }
+ return cache;
+}
+/**
+ * Returns the listener for SWT button widget events.
+ *
+ * @return a listener for button events
+ */
+private Listener getButtonListener() {
+ if (buttonListener == null) {
+ buttonListener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ handleWidgetDispose(event);
+ break;
+ case SWT.Selection:
+ Widget ew = event.widget;
+ if (ew != null) {
+ handleWidgetSelection(event, ((Button)ew).getSelection());
+ }
+ break;
+ }
+ }
+ };
+ }
+ return buttonListener;
+}
+/**
+ * Returns the listener for SWT tool item widget events.
+ *
+ * @return a listener for tool item events
+ */
+private Listener getToolItemListener() {
+ if (toolItemListener == null) {
+ toolItemListener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ handleWidgetDispose(event);
+ break;
+ case SWT.Selection:
+ Widget ew = event.widget;
+ if (ew != null) {
+ handleWidgetSelection(event, ((ToolItem)ew).getSelection());
+ }
+ break;
+ }
+ }
+ };
+ }
+ return toolItemListener;
+}
+/**
+ * Returns the listener for SWT menu item widget events.
+ *
+ * @return a listener for menu item events
+ */
+private Listener getMenuItemListener() {
+ if (menuItemListener == null) {
+ menuItemListener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ handleWidgetDispose(event);
+ break;
+ case SWT.Selection:
+ Widget ew = event.widget;
+ if (ew != null) {
+ handleWidgetSelection(event, ((MenuItem)ew).getSelection());
+ }
+ break;
+ }
+ }
+ };
+ }
+ return menuItemListener;
+}
+/**
+ * Handles a widget dispose event for the widget corresponding to this item.
+ */
+private void handleWidgetDispose(Event e) {
+ if (e.widget == widget) {
+ // the item is being disposed
+ if (action.getStyle() == IAction.AS_DROP_DOWN_MENU) {
+ IMenuCreator mc = action.getMenuCreator();
+ if (mc != null) {
+ mc.dispose();
+ }
+ }
+ action.removePropertyChangeListener(propertyListener);
+ widget = null;
+ }
+}
+/**
+ * Handles a widget selection event.
+ */
+private void handleWidgetSelection(Event e, boolean selection) {
+
+ Widget item= e.widget;
+ if (item != null) {
+ int style = item.getStyle();
+
+ if ((style & (SWT.TOGGLE | SWT.CHECK)) != 0) {
+ if (action.getStyle() == IAction.AS_CHECK_BOX) {
+ action.setChecked(selection);
+ }
+ } else if ((style & SWT.RADIO) != 0) {
+ if (action.getStyle() == IAction.AS_RADIO_BUTTON) {
+ action.setChecked(selection);
+ }
+ } else if ((style & SWT.DROP_DOWN) != 0) {
+ if (e.detail == 4) { // on drop-down button
+ if (action.getStyle() == IAction.AS_DROP_DOWN_MENU) {
+ IMenuCreator mc = action.getMenuCreator();
+ ToolItem ti = (ToolItem) item;
+ // we create the menu as a sub-menu of "dummy" so that we can use
+ // it in a cascading menu too.
+ // If created on a SWT control we would get an SWT error...
+ //Menu dummy= new Menu(ti.getParent());
+ //Menu m= mc.getMenu(dummy);
+ //dummy.dispose();
+ if (mc != null) {
+ Menu m= mc.getMenu(ti.getParent());
+ if (m != null) {
+ // position the menu below the drop down item
+ Rectangle b = ti.getBounds();
+ Point p = ti.getParent().toDisplay(new Point(b.x, b.y+b.height));
+ m.setLocation(p.x, p.y); // waiting for SWT 0.42
+ m.setVisible(true);
+ return; // we don't fire the action
+ }
+ }
+ }
+ }
+ }
+
+ // Ensure action is enabled first.
+ // See 1GAN3M6: ITPUI:WINNT - Any IAction in the workbench can be executed while disabled.
+ if (action.isEnabled()) {
+ boolean trace = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface/trace/actions")); //$NON-NLS-1$ //$NON-NLS-2$
+ long ms = System.currentTimeMillis();
+ if(trace)
+ System.out.println("Running action: " + action.getText()); //$NON-NLS-1$
+ action.runWithEvent(e);
+ if(trace)
+ System.out.println((System.currentTimeMillis() - ms) + " ms to run action: " + action.getText()); //$NON-NLS-1$
+ }
+ }
+}
+/* (non-Javadoc)
+ * Method declared on Object.
+ */
+public int hashCode() {
+ return action.hashCode();
+}
+/* (non-Javadoc)
+ * Method declared on IContributionItem.
+ */
+public boolean isEnabled() {
+ return action != null && action.isEnabled();
+}
+/**
+ * The action item implementation of this <code>IContributionItem</code>
+ * method returns <code>true</code> for menu items and <code>false</code>
+ * for everything else.
+ */
+public boolean isDynamic() {
+ if(widget instanceof MenuItem) {
+ //Optimization. Only recreate the item is the check or radio style has changed.
+ boolean itemIsCheck = (widget.getStyle() & SWT.CHECK) != 0;
+ boolean actionIsCheck = getAction() != null && getAction().getStyle() == IAction.AS_CHECK_BOX;
+ boolean itemIsRadio = (widget.getStyle() & SWT.RADIO) != 0;
+ boolean actionIsRadio = getAction() != null && getAction().getStyle() == IAction.AS_RADIO_BUTTON;
+ return (itemIsCheck != actionIsCheck) || (itemIsRadio != actionIsRadio);
+ }
+ return false;
+}
+/**
+ * Returns <code>true</code> if this item is allowed to enable,
+ * <code>false</code> otherwise.
+ *
+ * @return if this item is allowed to be enabled
+ * @since 2.0
+ */
+protected boolean isEnabledAllowed() {
+ if (getParent() == null)
+ return true;
+ Boolean value = getParent().getOverrides().getEnabled(this);
+ return (value == null) ? true : value.booleanValue();
+}
+
+/**
+ * The action item implementation of this <code>IContributionItem</code>
+ * method calls <code>update(null)</code>.
+ */
+public final void update() {
+ update(null);
+}
+/**
+ * Synchronizes the UI with the given property.
+ *
+ * @param propertyName the name of the property, or <code>null</code> meaning all applicable
+ * properties
+ */
+public void update(String propertyName) {
+ if (widget != null) {
+ // determine what to do
+ boolean textChanged = propertyName == null || propertyName.equals(Action.TEXT);
+ boolean imageChanged = propertyName == null || propertyName.equals(Action.IMAGE);
+ boolean tooltipTextChanged = propertyName == null || propertyName.equals(Action.TOOL_TIP_TEXT);
+ boolean enableStateChanged = propertyName == null || propertyName.equals(Action.ENABLED) ||
+ propertyName.equals(IContributionManagerOverrides.P_ENABLED);
+ boolean checkChanged =
+ (action.getStyle() == IAction.AS_CHECK_BOX || action.getStyle() == IAction.AS_RADIO_BUTTON)
+ && (propertyName == null || propertyName.equals(Action.CHECKED));
+
+ if (widget instanceof ToolItem) {
+ ToolItem ti = (ToolItem) widget;
+ if(textChanged)
+ ti.setText(action.getText());
+
+ if (imageChanged)
+ updateImages(true);
+
+ if (tooltipTextChanged)
+ ti.setToolTipText(action.getToolTipText());
+
+ if (enableStateChanged) {
+ boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed();
+
+ if (ti.getEnabled() != shouldBeEnabled)
+ ti.setEnabled(shouldBeEnabled);
+ }
+ if (checkChanged) {
+ boolean bv = action.isChecked();
+
+ if (ti.getSelection() != bv)
+ ti.setSelection(bv);
+ }
+ return;
+ }
+
+ if (widget instanceof MenuItem) {
+ MenuItem mi = (MenuItem) widget;
+
+ if (textChanged) {
+ Integer accelerator = null;
+ String acceleratorText = null;
+ IAction action = getAction();
+ String text = null;
+
+ if (action != null) {
+ CommandResolver.ICallback callback = CommandResolver.getInstance().getCommandResolver();
+
+ if (callback != null) {
+ String commandId = action.getActionDefinitionId();
+
+ if (commandId == null)
+ commandId = callback.guessCommandIdFromActionId(action.getId());
+
+ if (commandId != null) {
+ accelerator = callback.getAccelerator(commandId);
+ acceleratorText = callback.getAcceleratorText(commandId);
+ }
+ /*
+ else
+ System.out.println("command is null for action: " + action + ", " + action.getId() + ", " + action.getText());
+ */
+ }
+ }
+
+ IContributionManagerOverrides overrides = null;
+
+ if (getParent() != null)
+ overrides = getParent().getOverrides();
+
+ if (overrides != null) {
+ text = getParent().getOverrides().getText(this);
+
+ if (acceleratorText == null)
+ acceleratorText = overrides.getAcceleratorText(this); // TODO remove
+
+ if (accelerator == null)
+ accelerator = overrides.getAccelerator(this); // TODO remove
+ }
+
+ if (accelerator == null)
+ accelerator = new Integer(action.getAccelerator());
+
+ if (accelerator != null)
+ mi.setAccelerator(accelerator.intValue());
+
+ if (text == null)
+ text = action.getText();
+
+ if (text == null)
+ text = ""; //$NON-NLS-1$
+ else
+ text = Action.removeAcceleratorText(text);
+
+ if (acceleratorText == null)
+ mi.setText(text);
+ else
+ mi.setText(text + '\t' + acceleratorText);
+ }
+
+ if (imageChanged)
+ updateImages(false);
+
+ if (enableStateChanged) {
+ boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed();
+
+ if (mi.getEnabled() != shouldBeEnabled)
+ mi.setEnabled(shouldBeEnabled);
+ }
+
+ if (checkChanged) {
+ boolean bv = action.isChecked();
+
+ if (mi.getSelection() != bv)
+ mi.setSelection(bv);
+ }
+
+ return;
+ }
+
+ if (widget instanceof Button) {
+ Button button = (Button) widget;
+
+ if (imageChanged && updateImages(false))
+ textChanged = false; // don't update text if it has an image
+
+ if (textChanged) {
+ String text = action.getText();
+
+ if (text != null)
+ button.setText(text);
+ }
+
+ if (tooltipTextChanged)
+ button.setToolTipText(action.getToolTipText());
+
+ if (enableStateChanged) {
+ boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed();
+
+ if (button.getEnabled() != shouldBeEnabled)
+ button.setEnabled(shouldBeEnabled);
+ }
+
+ if (checkChanged) {
+ boolean bv = action.isChecked();
+
+ if (button.getSelection() != bv)
+ button.setSelection(bv);
+ }
+ return;
+ }
+ }
+}
+/**
+ * Updates the images for this action.
+ *
+ * @param forceImage <code>true</code> if some form of image is compulsory,
+ * and <code>false</code> if it is acceptable for this item to have no image
+ * @return <code>true</code> if there are images for this action, <code>false</code> if not
+ */
+private boolean updateImages(boolean forceImage) {
+
+ ImageCache cache = getImageCache();
+
+ if (widget instanceof ToolItem) {
+ if (USE_COLOR_ICONS) {
+ Image image = cache.getImage(action.getHoverImageDescriptor());
+ if (image == null) {
+ image = cache.getImage(action.getImageDescriptor());
+ }
+ Image disabledImage = cache.getImage(action.getDisabledImageDescriptor());
+
+ // Make sure there is a valid image.
+ if (image == null && forceImage) {
+ image = cache.getMissingImage();
+ }
+
+ // performance: more efficient in SWT to set disabled and hot image before regular image
+ if (disabledImage != null) {
+ // Set the disabled image if we were able to create one.
+ // Assumes that SWT.ToolItem will use platform's default
+ // behavior to show item when it is disabled and a disabled
+ // image has not been set.
+ ((ToolItem) widget).setDisabledImage(disabledImage);
+ }
+ ((ToolItem) widget).setImage(image);
+
+ return image != null;
+ }
+ else {
+ Image image = cache.getImage(action.getImageDescriptor());
+ Image hoverImage = cache.getImage(action.getHoverImageDescriptor());
+ Image disabledImage = cache.getImage(action.getDisabledImageDescriptor());
+
+ // If there is no regular image, but there is a hover image,
+ // convert the hover image to gray and use it as the regular image.
+ if (image == null && hoverImage != null) {
+ image = cache.getGrayImage(action.getHoverImageDescriptor());
+ }
+ else {
+ // If there is no hover image, use the regular image as the hover image,
+ // and convert the regular image to gray
+ if (hoverImage == null && image != null) {
+ hoverImage = image;
+ image = cache.getGrayImage(action.getImageDescriptor());
+ }
+ }
+
+ // Make sure there is a valid image.
+ if (hoverImage == null && image == null && forceImage) {
+ image = cache.getMissingImage();
+ }
+
+ // performance: more efficient in SWT to set disabled and hot image before regular image
+ if (disabledImage != null) {
+ // Set the disabled image if we were able to create one.
+ // Assumes that SWT.ToolItem will use platform's default
+ // behavior to show item when it is disabled and a disabled
+ // image has not been set.
+ ((ToolItem) widget).setDisabledImage(disabledImage);
+ }
+ ((ToolItem) widget).setHotImage(hoverImage);
+ ((ToolItem) widget).setImage(image);
+
+ return image != null;
+ }
+ }
+ else if (widget instanceof Item || widget instanceof Button) {
+ // Use hover image if there is one, otherwise use regular image.
+ Image image = cache.getImage(action.getHoverImageDescriptor());
+ if (image == null) {
+ image = cache.getImage(action.getImageDescriptor());
+ }
+ // Make sure there is a valid image.
+ if (image == null && forceImage) {
+ image = cache.getMissingImage();
+ }
+ if (widget instanceof Item) {
+ ((Item) widget).setImage(image);
+ }
+ else if (widget instanceof Button) {
+ ((Button) widget).setImage(image);
+ }
+ return image != null;
+ }
+ return false;
+}
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
new file mode 100644
index 000000000..fe878b8d7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.internal.WorkingSetComparator;
+
+/**
+ * Adds working set filter actions (set / clear / edit)
+ *
+ * @since 2.1
+ */
+public class WorkingSetFilterActionGroup extends ActionGroup {
+ public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$
+
+ private IWorkingSet workingSet = null;
+
+ private ClearWorkingSetAction clearWorkingSetAction;
+ private SelectWorkingSetAction selectWorkingSetAction;
+ private EditWorkingSetAction editWorkingSetAction;
+
+ private IPropertyChangeListener workingSetUpdater;
+
+ private int mruMenuCount;
+ private IMenuManager menuManager;
+ private IMenuListener menuListener;
+
+ /**
+ * Creates a new instance of the receiver
+ *
+ * @param shell shell to open dialogs and wizards on
+ * @param workingSetUpdater property change listener notified when a
+ * working set is set
+ */
+ public WorkingSetFilterActionGroup(Shell shell, IPropertyChangeListener workingSetUpdater, ISynchronizeView view, ISynchronizeParticipant page) {
+ Assert.isNotNull(shell);
+
+ this.workingSetUpdater = workingSetUpdater;
+ clearWorkingSetAction = new ClearWorkingSetAction(this);
+ selectWorkingSetAction = new SelectWorkingSetAction(this, shell);
+ editWorkingSetAction = new EditWorkingSetAction(this, shell);
+ }
+ /**
+ * Adds actions for the most recently used working sets to the
+ * specified menu manager.
+ *
+ * @param menuManager menu manager to add actions to
+ */
+ private void addMruWorkingSetActions(IMenuManager menuManager) {
+ IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
+ List sortedWorkingSets = Arrays.asList(workingSets);
+ Collections.sort(sortedWorkingSets, new WorkingSetComparator());
+
+ Iterator iter = sortedWorkingSets.iterator();
+ mruMenuCount = 0;
+ while (iter.hasNext()) {
+ IWorkingSet workingSet = (IWorkingSet)iter.next();
+ if (workingSet != null) {
+ IContributionItem item = new WorkingSetMenuContributionItem(++mruMenuCount, this, workingSet);
+ menuManager.add(item);
+ }
+ }
+ }
+ /**
+ * Removes the menu listener
+ *
+ * @see ActionGroup#dispose()
+ */
+ public void dispose() {
+ if (menuManager != null)
+ menuManager.removeMenuListener(menuListener);
+ super.dispose();
+ }
+ /**
+ * Adds working set actions to the specified action bar.
+ *
+ * @param actionBars action bar to add working set actions to.
+ * @see ActionGroup#fillActionBars(IActionBars)
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ menuManager = actionBars.getMenuManager();
+ menuManager.add(selectWorkingSetAction);
+ menuManager.add(clearWorkingSetAction);
+ menuManager.add(editWorkingSetAction);
+ menuManager.add(new Separator());
+ addMruWorkingSetActions(menuManager);
+ menuManager.add(new Separator());
+ };
+ /**
+ * Returns the working set which is currently selected.
+ *
+ * @return the working set which is currently selected.
+ */
+ public IWorkingSet getWorkingSet() {
+ return workingSet;
+ }
+ /**
+ * Sets the current working set.
+ *
+ * @param newWorkingSet the new working set
+ */
+ public void setWorkingSet(IWorkingSet newWorkingSet) {
+ IWorkingSet oldWorkingSet = workingSet;
+
+ workingSet = newWorkingSet;
+ // Update action
+ clearWorkingSetAction.setEnabled(newWorkingSet != null);
+ editWorkingSetAction.setEnabled(newWorkingSet != null);
+
+ if(workingSet != null)
+ PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(newWorkingSet);
+ // Update viewer
+ if (workingSetUpdater != null) {
+ workingSetUpdater.propertyChange(
+ new PropertyChangeEvent(
+ this,
+ WorkingSetFilterActionGroup.CHANGE_WORKING_SET,
+ oldWorkingSet,
+ newWorkingSet));
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java
new file mode 100644
index 000000000..3de9afcc9
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.actions;
+
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Menu contribution item which shows a working set.
+ *
+ * @since 2.1
+ */
+public class WorkingSetMenuContributionItem extends ContributionItem {
+ private int id;
+ private IWorkingSet workingSet;
+ private WorkingSetFilterActionGroup actionGroup;
+
+ /**
+ * Returns the id of this menu contribution item
+ *
+ * @param id numerical id
+ * @return String string id
+ */
+ public static String getId(int id) {
+ return WorkingSetMenuContributionItem.class.getName() + "." + id; //$NON-NLS-1$
+ }
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param id sequential id of the new instance
+ * @param actionGroup the action group this contribution item is created in
+ */
+ public WorkingSetMenuContributionItem(int id, WorkingSetFilterActionGroup actionGroup, IWorkingSet workingSet) {
+ super(getId(id));
+ Assert.isNotNull(actionGroup);
+ Assert.isNotNull(workingSet);
+ this.id = id;
+ this.actionGroup = actionGroup;
+ this.workingSet = workingSet;
+ }
+ /**
+ * Adds a menu item for the working set.
+ * Overrides method from ContributionItem.
+ *
+ * @see org.eclipse.jface.action.ContributionItem#fill(Menu,int)
+ */
+ public void fill(Menu menu, int index) {
+ MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
+ mi.setText("&" + id + " " + workingSet.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ mi.setSelection(workingSet.equals(actionGroup.getWorkingSet()));
+ mi.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
+ actionGroup.setWorkingSet(workingSet);
+ manager.addRecentWorkingSet(workingSet);
+ }
+ });
+ }
+ /**
+ * Overridden to always return true and force dynamic menu building.
+ */
+ public boolean isDynamic() {
+ return true;
+ }
+}
+
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/LocalResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/LocalResourceTypedElement.java
index 4cc20e5c4..f62246052 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/LocalResourceTypedElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/LocalResourceTypedElement.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.compare;
+package org.eclipse.team.internal.ui.synchronize.compare;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/RemoteResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
index dccf97321..fb55e15e7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/RemoteResourceTypedElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.compare;
+package org.eclipse.team.internal.ui.synchronize.compare;
import java.io.InputStream;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java
index 8729344a2..928ca46d4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.compare;
+package org.eclipse.team.internal.ui.synchronize.compare;
import java.lang.reflect.InvocationTargetException;
@@ -29,15 +29,18 @@ import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
public class SyncInfoCompareInput extends CompareEditorInput {
private SyncInfo sync;
private SyncInfoDiffNode node;
private static Image titleImage;
+ private static ISynchronizeParticipant participant;
- public static SyncInfoCompareInput createInput(SyncInfo sync) {
+ public static SyncInfoCompareInput createInput(ISynchronizeParticipant participant, SyncInfo sync) {
+ SyncInfoCompareInput.participant = participant;
// Create the local ITypedElement
ITypedElement localTypedElement = SyncInfoDiffNode.createTypeElement(sync.getLocal(), sync.getKind());
@@ -109,7 +112,7 @@ public class SyncInfoCompareInput extends CompareEditorInput {
* @see org.eclipse.compare.CompareEditorInput#getTitle()
*/
public String getTitle() {
- return Policy.bind("SyncInfoCompareInput.title", sync.getSubscriber().getName(), node.getName()); //$NON-NLS-1$
+ return Policy.bind("SyncInfoCompareInput.title", participant.getName(), node.getName()); //$NON-NLS-1$
}
protected void updateLabels() {
@@ -156,7 +159,7 @@ public class SyncInfoCompareInput extends CompareEditorInput {
* @see org.eclipse.ui.IEditorInput#getToolTipText()
*/
public String getToolTipText() {
- return Policy.bind("SyncInfoCompareInput.tooltip", sync.getSubscriber().getName(), node.getName()); //$NON-NLS-1$
+ return Policy.bind("SyncInfoCompareInput.tooltip", participant.getName(), node.getName()); //$NON-NLS-1$
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java
index 71e7f13e3..a7f83d7f7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoDiffNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.compare;
+package org.eclipse.team.internal.ui.synchronize.compare;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.DiffNode;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/ISyncSetChangedListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/ISyncSetChangedListener.java
index db1ef795a..8e4737d26 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/ISyncSetChangedListener.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/ISyncSetChangedListener.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
/**
* This interface is used to receive SyncSetChangedEvents from a sync set.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SubscriberEventHandler.java
index badc3430d..2e327d3fd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SubscriberEventHandler.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import java.util.ArrayList;
import java.util.Arrays;
@@ -21,7 +21,7 @@ import org.eclipse.team.core.subscribers.BackgroundEventHandler;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
-import org.eclipse.team.ui.sync.SubscriberAction;
+import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
/**
* This handler collects changes and removals to resources and calculates their
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SubscriberInput.java
index 93845f5c9..b0ce3f737 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SubscriberInput.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -26,7 +26,8 @@ import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
import org.eclipse.ui.IWorkingSet;
/**
@@ -57,8 +58,11 @@ public class SubscriberInput implements IPropertyChangeListener, ITeamResourceCh
* in the workbench.
*/
private SubscriberEventHandler eventHandler;
+
+ private TeamSubscriberParticipant participant;
- public SubscriberInput(TeamSubscriber subscriber) {
+ public SubscriberInput(TeamSubscriberParticipant participant, TeamSubscriber subscriber) {
+ this.participant = participant;
Assert.isNotNull(subscriber);
subscriberSyncSet = new SyncSetInputFromSubscriber(subscriber);
workingRootsSet = new WorkingSetSyncSetInput(subscriberSyncSet.getSyncSet());
@@ -74,6 +78,10 @@ public class SubscriberInput implements IPropertyChangeListener, ITeamResourceCh
return subscriberSyncSet.getSubscriber();
}
+ public TeamSubscriberParticipant getParticipant() {
+ return participant;
+ }
+
public SyncSet getFilteredSyncSet() {
return filteredSyncSet.getSyncSet();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoStatistics.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoStatistics.java
index 5e08f13ea..6027fba3d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoStatistics.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoStatistics.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java
index 47fcd91a7..12d9a48c5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncInfoWorkingSetFilter.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import java.util.ArrayList;
import java.util.Arrays;
@@ -22,7 +22,7 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
import org.eclipse.ui.IWorkingSet;
/**
@@ -124,5 +124,4 @@ public class SyncInfoWorkingSetFilter extends SyncInfoFilter {
public void setWorkingSet(IWorkingSet workingSet) {
this.workingSet = workingSet;
}
-
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSet.java
index e65080b1f..bfd18b552 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSet.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetChangedEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java
index f145a58fa..9968d9a3c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetChangedEvent.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import java.util.HashSet;
import java.util.Iterator;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInput.java
index 6bade21b9..71138ac28 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInput.java
@@ -8,13 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.ui.sync.SyncInfoFilter;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoFilter;
/**
* This is the superclass for all SyncSet input providers
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSubscriber.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInputFromSubscriber.java
index d1bab0727..6832fa24c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSubscriber.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInputFromSubscriber.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSyncSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInputFromSyncSet.java
index fc733927b..b5c9536b3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSyncSet.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetInputFromSyncSet.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/WorkingSetSyncSetInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/WorkingSetSyncSetInput.java
index 5fdde5c4c..34c42965c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/WorkingSetSyncSetInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/WorkingSetSyncSetInput.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.sets;
+package org.eclipse.team.internal.ui.synchronize.sets;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolder.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolder.java
index ab4e3e802..56a5e2d5f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolder.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolder.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import java.util.ArrayList;
import java.util.Arrays;
@@ -16,7 +16,7 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
/**
* A compressed folder appears under a project and contains out-of-sync resources
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolderContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
index f9a40e8c0..92724f462 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolderContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import java.util.ArrayList;
import java.util.HashSet;
@@ -21,8 +21,8 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSetChangedEvent;
/**
* The contents provider compressed in-sync folder paths
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java
index 0d1c9ad09..fe664b304 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetContentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import java.util.ArrayList;
import java.util.List;
@@ -20,17 +20,16 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.sets.SyncSet;
-import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent;
+import org.eclipse.team.internal.ui.synchronize.sets.ISyncSetChangedListener;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSetChangedEvent;
/**
* This class provides the contents for a StructuredViewer using a SyncSet as the model
*/
public abstract class SyncSetContentProvider implements IStructuredContentProvider, ISyncSetChangedListener {
-
+
protected Viewer viewer;
protected SyncSet getSyncSet() {
@@ -52,7 +51,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer v, Object oldInput, Object newInput) {
-
+
this.viewer = v;
SubscriberInput oldSubscriberInput = null;
SubscriberInput newSubscriberInput = null;
@@ -72,7 +71,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@@ -87,7 +86,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
input.getFilteredSyncSet().removeSyncSetChangedListener(this);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.team.ccvs.syncviews.views.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent)
*/
@@ -102,7 +101,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
});
}
}
-
+
/**
* Update the viewer with the sync-set changes, aditions and removals
* in the given event. This method is invoked from within the UI thread.
@@ -120,7 +119,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
}
viewer.getControl().setRedraw(true);
}
-
+
/**
* Update the viewer for the sync set changes in the provided event.
* This method is invoked by <code>handleSyncSetChanges</code>.
@@ -137,7 +136,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
updateParentLabels(local);
}
}
-
+
/**
* Update the viewer for the sync set removals in the provided event.
* This method is invoked by <code>handleSyncSetChanges</code>.
@@ -153,7 +152,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
updateParentLabels(resource);
}
}
-
+
/**
* Update the viewer for the sync set additions in the provided event.
* This method is invoked by <code>handleSyncSetChanges</code>.
@@ -169,40 +168,12 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
updateParentLabels(resource);
}
}
-
+
public StructuredViewer getViewer() {
return (StructuredViewer)viewer;
}
/**
- * Return the IResource for the given model object that was returned by
- * SyncSet#members(IResource). Return <code>null</code> if the given
- * object does not have a corresponding IResource.
- *
- * @param element
- * @return
- */
- public IResource getResource(Object obj) {
- return (IResource)TeamAction.getAdapter(obj, IResource.class);
- }
-
- /**
- * Return the sync kind for the given model object that was returned by
- * SyncSet#members(IResource). If syncSet is null, then the
- * sync kind for SyncContainers will always be 0.
- *
- * @param element
- * @return
- */
- public int getSyncKind(SyncSet syncSet, Object element) {
- SyncInfo info = getSyncInfo(element);
- if (info != null) {
- return info.getKind();
- }
- return 0;
- }
-
- /**
* Return the children of the given container who are either out-of-sync or contain
* out-of-sync resources.
*/
@@ -224,17 +195,50 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
* @param element
* @return
*/
- public SyncInfo getSyncInfo(Object element) {
+ public static SyncInfo getSyncInfo(Object element) {
if (element instanceof SyncInfo) {
return ((SyncInfo) element);
} else if (element instanceof SynchronizeViewNode) {
SynchronizeViewNode syncResource = (SynchronizeViewNode)element;
return syncResource.getSyncInfo();
}
+ throw new NullPointerException();
+ }
+
+ /**
+ * Return the IResource for the given model object that was returned by
+ * SyncSet#members(IResource). Return <code>null</code> if the given
+ * object does not have a corresponding IResource.
+ *
+ * @param element
+ * @return
+ */
+ public static IResource getResource(Object obj) {
+ if (obj instanceof SyncInfo) {
+ return ((SyncInfo) obj).getLocal();
+ } else if (obj instanceof SynchronizeViewNode) {
+ return ((SynchronizeViewNode)obj).getResource();
+ }
return null;
}
/**
+ * Return the sync kind for the given model object that was returned by
+ * SyncSet#members(IResource). If syncSet is null, then the
+ * sync kind for SyncContainers will always be 0.
+ *
+ * @param element
+ * @return
+ */
+ public static int getSyncKind(Object element) {
+ SyncInfo info = getSyncInfo(element);
+ if (info != null) {
+ return info.getKind();
+ }
+ return SyncInfo.IN_SYNC;
+ }
+
+ /**
* Get the model object (SyncSet, SyncInfo or SyncContainer) that is the
* parent of the given model object.
*
@@ -248,7 +252,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
IContainer parent = resource.getParent();
return getModelObject(parent);
}
-
+
/**
* Return the model object for the given IResource.
* @param resource
@@ -282,8 +286,8 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
parent = parent.getParent();
}
getViewer().update(
- (SynchronizeViewNode[])parents.toArray(new SynchronizeViewNode[parents.size()]),
- null
- );
+ (SynchronizeViewNode[])parents.toArray(new SynchronizeViewNode[parents.size()]),
+ null
+ );
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTableContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTableContentProvider.java
index 7f743d7e5..456ba1dce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTableContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTableContentProvider.java
@@ -8,12 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.sync.sets.*;
+import org.eclipse.team.internal.ui.synchronize.sets.*;
/**
* This class provides the contents for a TableViewer using a SyncSet as the model
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTreeContentProvider.java
index e7b94e6c3..45750a41e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTreeContentProvider.java
@@ -8,15 +8,15 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSetChangedEvent;
/**
* This class provides the contents for a AbstractTreeViewer using a SyncSet as the model
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java
index 19b06b1ea..08baea02e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java
@@ -8,11 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.team.internal.ui.synchronize.actions.INavigableControl;
public class SyncTableViewer extends TableViewer implements INavigableControl {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java
index e6bc3a2a0..00d829e73 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTreeViewer.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import java.util.ArrayList;
@@ -16,13 +16,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -30,6 +24,7 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.synchronize.actions.INavigableControl;
/**
* Subclass of TreeViewer which handles decorator events properly. We should not need to create
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java
index e54e71149..4a517183a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerSorter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerSorter.java
@@ -8,11 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.ui.views.navigator.ResourceSorter;
/**
@@ -50,6 +49,6 @@ public class SyncViewerSorter extends ResourceSorter {
}
protected IResource getResource(Object obj) {
- return (IResource)TeamAction.getAdapter(obj, IResource.class);
+ return SyncSetContentProvider.getResource(obj);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerTableSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerTableSorter.java
index 37ae0e705..291daa611 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerTableSorter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerTableSorter.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.preference.IPreferenceStore;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeViewNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java
index 5269efc77..50e10ed5d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeViewNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SynchronizeViewNode.java
@@ -8,16 +8,15 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.internal.ui.synchronize.views;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.sets.SyncSet;
-import org.eclipse.team.ui.sync.*;
-import org.eclipse.ui.IActionFilter;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
+import org.eclipse.team.ui.synchronize.ITeamSubscriberParticipantNode;
/**
* A SynchronizeViewNode instance appears in the Synchronize View. Actions contributed to
@@ -26,7 +25,7 @@ import org.eclipse.ui.IActionFilter;
* <p>
* @see org.eclipse.team.ui.sync.ISynchronizeViewNode
*/
-public class SynchronizeViewNode implements IAdaptable, IActionFilter, ISynchronizeViewNode {
+public class SynchronizeViewNode implements IAdaptable, ITeamSubscriberParticipantNode {
private IResource resource;
private SubscriberInput input;
@@ -60,9 +59,7 @@ public class SynchronizeViewNode implements IAdaptable, IActionFilter, ISynchron
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
- if (adapter == IResource.class) {
- return getResource();
- } else if (adapter == SyncInfo.class) {
+ if (adapter == SyncInfo.class) {
return getSyncInfo();
}
return null;
@@ -116,21 +113,4 @@ public class SynchronizeViewNode implements IAdaptable, IActionFilter, ISynchron
public String toString() {
return "SynchronizeViewNode for " + getResource().getFullPath().toString(); //$NON-NLS-1$
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
- */
- public boolean testAttribute(Object target, String name, String value) {
- if (!(target instanceof SynchronizeViewNode)) {
- return false;
- }
- TeamSubscriber subscriber = ((SynchronizeViewNode) target).getTeamSubscriber();
- String id = subscriber.getId().toString();
- if (name.equals("startsWith")) { //$NON-NLS-1$
- return id.startsWith(value);
- } else if(name.equals("equals")) { //$NON-NLS-1$
- return id.equals(value);
- }
- return false;
- }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
index b284fcd9b..407c0fc0a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
@@ -24,6 +24,7 @@ import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.IConfigurationWizard;
import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.team.ui.ITeamUIConstants;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.internal.model.AdaptableList;
@@ -51,7 +52,7 @@ public class ConfigureProjectWizard extends Wizard implements IConfigurationWiza
}
protected String getExtensionPoint() {
- return TeamUIPlugin.PT_CONFIGURATION;
+ return ITeamUIConstants.PT_CONFIGURATION;
}
protected String getWizardWindowTitle() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
index 6c7929772..a582618b5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
@@ -8,11 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.sync;
+package org.eclipse.team.ui;
-public abstract class CompoundSyncInfoFilter extends SyncInfoFilter {
- protected SyncInfoFilter[] filters;
- public CompoundSyncInfoFilter(SyncInfoFilter[] filters) {
- this.filters = filters;
- }
+public interface ITeamUIConstants {
+
+ // extension points
+ public static final String PT_SYNCPARTICIPANTS = "synchronizeParticipants"; //$NON-NLS-1$
+ public static final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$
+ public static final String PT_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
index ce9888b57..a5e546133 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
@@ -12,25 +12,27 @@ package org.eclipse.team.ui;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.team.ui.sync.ISynchronizeView;
-import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
/**
* TeamUI contains public API for generic UI-based Team functionality
*/
public class TeamUI {
+
+ // manages synchronize pages
+ private static ISynchronizeManager synchronizeManager;
+
// property change types
public static String GLOBAL_IGNORES_CHANGED = "global_ignores_changed"; //$NON-NLS-1$
-
- /**
- * Makes the synchronize view visible in the active page and returns a handle
- * to the view.
- */
- public static ISynchronizeView showSyncViewInActivePage(IWorkbenchPage activePage) {
- return SynchronizeView.showInActivePage(activePage, true /* allow perspective switch */);
- }
+ public static ISynchronizeManager getSynchronizeManager() {
+ if (synchronizeManager == null) {
+ synchronizeManager = new SynchronizeManager();
+ }
+ return synchronizeManager;
+ }
+
/**
* Register for changes made to Team properties.
*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java
new file mode 100644
index 000000000..3217c326c
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+
+public class Utilities {
+
+ /**
+ * Initialize the given Action from a ResourceBundle.
+ */
+ public static void initAction(IAction a, String prefix, ResourceBundle bundle) {
+
+ String labelKey= "label"; //$NON-NLS-1$
+ String tooltipKey= "tooltip"; //$NON-NLS-1$
+ String imageKey= "image"; //$NON-NLS-1$
+ String descriptionKey= "description"; //$NON-NLS-1$
+
+ if (prefix != null && prefix.length() > 0) {
+ labelKey= prefix + labelKey;
+ tooltipKey= prefix + tooltipKey;
+ imageKey= prefix + imageKey;
+ descriptionKey= prefix + descriptionKey;
+ }
+
+ String s = Policy.bind(labelKey, bundle);
+ if(s != null)
+ a.setText(s);
+ s = Policy.bind(tooltipKey, bundle);
+ if(s != null)
+ a.setToolTipText(s);
+ s = Policy.bind(descriptionKey, bundle);
+ if(s != null)
+ a.setDescription(s);
+
+ String relPath= Policy.bind(imageKey, bundle);
+ if (relPath != null && ! relPath.equals(imageKey) && relPath.trim().length() > 0) {
+
+ String cPath;
+ String dPath;
+ String ePath;
+
+ if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
+ String path= relPath.substring(1);
+ cPath= 'c' + path;
+ dPath= 'd' + path;
+ ePath= 'e' + path;
+ } else {
+ cPath= "clcl16/" + relPath; //$NON-NLS-1$
+ dPath= "dlcl16/" + relPath; //$NON-NLS-1$
+ ePath= "elcl16/" + relPath; //$NON-NLS-1$
+ }
+
+ ImageDescriptor id= TeamImages.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87)
+ if (id != null)
+ a.setDisabledImageDescriptor(id);
+ id= TeamUIPlugin.getImageDescriptor(cPath);
+ if (id != null)
+ a.setHoverImageDescriptor(id);
+ id= TeamUIPlugin.getImageDescriptor(ePath);
+ if (id != null)
+ a.setImageDescriptor(id);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
index 110a89283..8a222f458 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
@@ -6,11 +6,16 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Application programming interface for associating a repository provider with a project.
-<h2>
-Package Specification</h2>
-This package specifies the API for providing a configuration wizard that will
-associate and configure a particular repository provider with a project in the
-local workspace.
+Provides basic support for managing Team providers.
+<h2>Package Specification</h2>
+<p>This package specifies the API for integrating Team support plug-ins into
+the workbench. This support includes:</p>
+<ul>
+<li>A set of common images for enabling a common Team look in the workbench.
+<li>A configuration wizard extension for allowing Team providers to associate their
+provider with a project in the workspace.
+<li>A synchronization infrastructure to allow Team providers to extend or participate
+in the Synchronize View.
+</ul>
</body>
</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java
deleted file mode 100644
index c815dc6f1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Selects SyncInfo which match all child filters
- */
-public class AndSyncInfoFilter extends CompoundSyncInfoFilter {
- public AndSyncInfoFilter(SyncInfoFilter[] filters) {
- super(filters);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- SyncInfoFilter filter = filters[i];
- if (!filter.select(info)) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java
deleted file mode 100644
index af4f9296e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Selects SyncInfo that are automergable
- */
-public class AutomergableFilter extends SyncInfoFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- return (info.getKind() & SyncInfo.AUTOMERGE_CONFLICT) != 0;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java
deleted file mode 100644
index 93368a08f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.ui.IWorkingSet;
-
-public interface ISynchronizeView {
- public final static int INCOMING_MODE = 1;
- public final static int OUTGOING_MODE = 2;
- public final static int BOTH_MODE = 3;
- public final static int CONFLICTING_MODE = 4;
-
- /**
- * Called to set the current selection in the sync viewer for the given subscriber. The viewType
- * parameter determines in which configuration of the view the selection should be made in. If
- * there are no resources passed in the given subscriber is activate.
- *
- * @param resources the resources to select
- * @param viewType the view configuration in which to select the resources
- */
- public void selectSubscriber(TeamSubscriber subscriber);
-
- /**
- * Refreshes the resources from the specified subscriber. The working set or filters applied
- * to the synchronize view are ignored.
- */
- public void refreshWithRemote(TeamSubscriber subscriber, IResource[] resources);
-
- /**
- * Refreshes the resources in the current input for the given subscriber.
- */
- public void refreshWithRemote(TeamSubscriber subscriber);
-
- /**
- * Refreshes the active subscriber.
- */
- public void refreshWithRemote();
-
- /**
- * Returns the current view configuration.
- */
- public int getCurrentViewType();
-
- /**
- * Sets the working set used by the view to the given working set
- */
- public void setWorkingSet(IWorkingSet workingSet);
-
- /**
- * Sets the current mode shown in the sync view. Valid modes are:
- * INCOMING_MODE, OUTGOING_MODE, BOTH_MODE,
- * CONFLICTING_MODE
- */
- public void setMode(int mode);
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeViewNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeViewNode.java
deleted file mode 100644
index 4fce1ec9c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeViewNode.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-
-/**
- * An <code>ISynchronizeViewNode</code> is used in the <code>ISynchronizeView</code>
- * to display the kind of change detected as the result of a two-way or three-way
- * synchronize.
- * <p>
- * Clients can contribute objectContribution actions to the Synchronize View that are
- * scoped by <code>TeamSubscriber</code> ids.
- * <br>
- * Example objectContribution:
- *
- * <extension
- * point="org.eclipse.ui.popupMenus">
- * <objectContribution
- * objectClass="org.eclipse.team.ui.sync.ISynchronizeViewNode"
- * id="yourObjectContributionID"
- * adaptable="true">
- *
- * <filter name="equals" value="org.eclipse.team.cvs.subscribers:workspace-subscriber" />
- * <action
- * label="Your Action Label"
- * menubarPath="SubscriberActions"
- * class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction"
- * overrideActionId="org.eclipse.team.ccvs.ui.commit"
- * id="yourActionID">
- * </action>
- * </objectContribution>
- * </extension>
- *
- * The above example makes use of the standard UI mechanisms for contributing ObjectContribution
- * Actions in Eclipse. See the UI documentation for additional elements that can be declared.
- * The interesting elements for scoping the contribution to a TeamSubscriber type are:
- *
- * <filter> element in the object contribution. This will remove all the actions and their
- * overridesActionIds unless the filter is matched. The name can be "equals"
- * or "startsWith" and the value is the ID of the subscriber.
- *
- * menuparPath is either SubscriberActions to place actions in their own group above other
- * objectContributions or Additions to place the actions at the bottom of the menu with other
- * objectContributions
- *
- * overrideActionId is optional but if present, is the ID of an existing objectContribution that
- * this action should replace.
- *
- * </p>
- * @see org.eclipse.team.ui.sync.ISynchronizeView
- * @see org.eclipse.team.core.subscribers.TeamSubscriber
- * @since 3.0
- */
-public interface ISynchronizeViewNode {
- /**
- * Answer the receiver's Subscriber
- * @return the node's TeamSubscriber
- */
- public abstract TeamSubscriber getTeamSubscriber();
- /**
- * Returns the SyncInfo for this node. Note that the SynchronizeView only creates nodes
- * for resources that are out-of-sync.
- * @return SyncInfo the sync info for this node
- */
- public abstract SyncInfo getSyncInfo();
- /**
- * Return an array that contains all children (including the receiver) that have SyncInfos
- * that are out-of-sync. Returns an empty array if this node does not have children.
- * @return SyncInfo[] all out-of-sync child resources.
- */
- public abstract SyncInfo[] getChildSyncInfos();
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java
deleted file mode 100644
index b6424afea..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * Selects SyncInfo that match any of the child filters.
- */
-public class OrSyncInfoFilter extends CompoundSyncInfoFilter {
- public OrSyncInfoFilter(SyncInfoFilter[] filters) {
- super(filters);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- SyncInfoFilter filter = filters[i];
- if (filter.select(info)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java
deleted file mode 100644
index a8a9068c1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-
-/**
- * This filter selects only those SyncInfo that are not Pseudo-conflicts
- */
-public class PseudoConflictFilter extends SyncInfoFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SyncInfoFilter#select(org.eclipse.team.core.subscribers.SyncInfo)
- */
- public boolean select(SyncInfo info) {
- return info.getKind() != 0 && (info.getKind() & SyncInfo.PSEUDO_CONFLICT) == 0;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java
deleted file mode 100644
index de133060d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.sync;
-
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.c