diff options
author | cvs2svn | 2003-08-20 16:20:30 +0000 |
---|---|---|
committer | cvs2svn | 2003-08-20 16:20:30 +0000 |
commit | 600b503d45cde972b8660803da29686a223dc9aa (patch) | |
tree | d748dfd2a0544d27821fb2fc2e8068cbbaab86af /bundles/org.eclipse.team.ui/src/org/eclipse/team | |
parent | f06692cf778294c9d0974afe5d78e51cf11134af (diff) | |
download | eclipse.platform.team-600b503d45cde972b8660803da29686a223dc9aa.tar.gz eclipse.platform.team-600b503d45cde972b8660803da29686a223dc9aa.tar.xz eclipse.platform.team-600b503d45cde972b8660803da29686a223dc9aa.zip |
This commit was manufactured by cvs2svn to create branch
'branch_CVSQuickDiffProvider'.
Sprout from master 2003-08-20 16:20:28 UTC Michael Valenta <mvalenta> '41440: CVS Session and Connection classes must be made thread safe'
Delete:
bundles/org.eclipse.compare/.classpath
bundles/org.eclipse.compare/.cvsignore
bundles/org.eclipse.compare/.project
bundles/org.eclipse.compare/about.html
bundles/org.eclipse.compare/build.properties
bundles/org.eclipse.compare/buildnotes_compare.html
bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/package.html
bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html
bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gif
bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gif
bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif
bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif
bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif
bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif
bundles/org.eclipse.compare/icons/full/cview16/compare_view.gif
bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gif
bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif
bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif
bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif
bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif
bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif
bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gif
bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gif
bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif
bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif
bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gif
bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif
bundles/org.eclipse.compare/icons/full/eview16/compare_view.gif
bundles/org.eclipse.compare/icons/full/obj16/day_obj.gif
bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif
bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif
bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif
bundles/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif
bundles/org.eclipse.compare/plugin.properties
bundles/org.eclipse.compare/plugin.xml
bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath
bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore
bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project
bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html
bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/package.html
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif
bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd
bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd
bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd
bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd
bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml
bundles/org.eclipse.compare/schema/contentMergeViewers.exsd
bundles/org.eclipse.compare/schema/contentViewers.exsd
bundles/org.eclipse.compare/schema/structureCreators.exsd
bundles/org.eclipse.compare/schema/structureMergeViewers.exsd
bundles/org.eclipse.compare/scripts/exportplugin.xml
bundles/org.eclipse.team.core/.classpath
bundles/org.eclipse.team.core/.cvsignore
bundles/org.eclipse.team.core/.options
bundles/org.eclipse.team.core/.project
bundles/org.eclipse.team.core/about.html
bundles/org.eclipse.team.core/build.properties
bundles/org.eclipse.team.core/buildnotes_team.html
bundles/org.eclipse.team.core/plugin.properties
bundles/org.eclipse.team.core/plugin.xml
bundles/org.eclipse.team.core/schema/fileTypes.exsd
bundles/org.eclipse.team.core/schema/ignore.exsd
bundles/org.eclipse.team.core/schema/projectSets.exsd
bundles/org.eclipse.team.core/schema/repository.exsd
bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ComparisonCriteria.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ITeamResourceChangeListener.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamDelta.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamProvider.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberFactory.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/ILocalSyncElement.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteResource.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteSyncElement.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/LocalSyncElement.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java
bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContext.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java
bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties
bundles/org.eclipse.team.cvs.core/.classpath
bundles/org.eclipse.team.cvs.core/.cvsignore
bundles/org.eclipse.team.cvs.core/.options
bundles/org.eclipse.team.cvs.core/.project
bundles/org.eclipse.team.cvs.core/about.html
bundles/org.eclipse.team.cvs.core/build.properties
bundles/org.eclipse.team.cvs.core/buildnotes_cvs.html
bundles/org.eclipse.team.cvs.core/doc/hglegal.htm
bundles/org.eclipse.team.cvs.core/doc/ngibmcpy.gif
bundles/org.eclipse.team.cvs.core/doc/org_eclipse_team_cvs_core.html
bundles/org.eclipse.team.cvs.core/plugin.properties
bundles/org.eclipse.team.cvs.core/plugin.xml
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSAnnotateBlock.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSException.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSyncInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSubscriberFactory.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/DateUtil.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/EditorsInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSDecoratorEnablementListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFileModificationValidator.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResourceVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRunnable.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IConnectionMethod.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ILogEntry.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IResourceStateChangeListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IServerConnection.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserAuthenticator.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/Policy.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractMessageCommand.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AddStructureVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Admin.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CheckedInHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CommandOutputListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CopyHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/DiffStructureVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Editors.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ExpandModules.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Import.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Log.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/MTHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ModTimeHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ModifiedFileSender.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ModuleExpansionHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPCommand.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NewEntryHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NotifiedHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Remove.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoveEntryHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StaticHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Status.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StickyHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Tag.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TagFileSender.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/UpdateMergableOnly.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/UpdatedHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ValidRequests.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ValidRequestsHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AdminKSubstListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ICommandOutputListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IConsoleListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IStatusListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IUpdateMessageListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogEntry.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleDefinitionsListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleExpansion.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/StatusListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/TagListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSAuthenticationException.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSCommunicationException.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/ExtConnection.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/ExtConnectionMethod.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/PServerConnection.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/PServerConnectionMethod.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/UserInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileModificationManager.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTree.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SyncInfoCache.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaseSynchronizer.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaserevInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MutableFolderSyncInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MutableResourceSyncInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/OptimizedRemoteSynchronizer.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteResourceFactory.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteSynchronizer.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSyncInfo.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSynchronizer.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AddDeleteMoveListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Assert.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AssertionFailedException.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileNameMatcher.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionContentHandler.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ReplaceWithBaseVisitor.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/StringMatcher.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
bundles/org.eclipse.team.cvs.ssh/.classpath
bundles/org.eclipse.team.cvs.ssh/.cvsignore
bundles/org.eclipse.team.cvs.ssh/.options
bundles/org.eclipse.team.cvs.ssh/.project
bundles/org.eclipse.team.cvs.ssh/about.html
bundles/org.eclipse.team.cvs.ssh/build.properties
bundles/org.eclipse.team.cvs.ssh/plugin.properties
bundles/org.eclipse.team.cvs.ssh/plugin.xml
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java
bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties
bundles/org.eclipse.team.ui/.classpath
bundles/org.eclipse.team.ui/.cvsignore
bundles/org.eclipse.team.ui/.project
bundles/org.eclipse.team.ui/about.html
bundles/org.eclipse.team.ui/build.properties
bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif
bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif
bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif
bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif
bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif
bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif
bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif
bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif
bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif
bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif
bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif
bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif
bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif
bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif
bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif
bundles/org.eclipse.team.ui/plugin.properties
bundles/org.eclipse.team.ui/plugin.xml
bundles/org.eclipse.team.ui/schema/configurationWizards.exsd
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseChangeFilterAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseSubscriberAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenWithActionGroup.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActionGroup.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerChangeFilters.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerShowPreferencesAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerToolbarDropDownAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ToggleViewAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/LocalResourceTypedElement.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/RemoteResourceTypedElement.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInputFinder.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoDiffNode.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/ISyncSetChangedListener.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoStatistics.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetChangedEvent.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSubscriber.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSyncSet.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/WorkingSetSyncSetInput.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolder.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolderContentProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTableContentProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerSorter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerTableSorter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeViewNode.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/TeamSynchronizingPerspective.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/ViewStatusInformation.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeViewNode.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberAction.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java
bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java
examples/org.eclipse.compare.examples.xml/.classpath
examples/org.eclipse.compare.examples.xml/.cvsignore
examples/org.eclipse.compare.examples.xml/.project
examples/org.eclipse.compare.examples.xml/IdMaps/ant_test.xml
examples/org.eclipse.compare.examples.xml/IdMaps/idmap.dtd
examples/org.eclipse.compare.examples.xml/about.html
examples/org.eclipse.compare.examples.xml/build.properties
examples/org.eclipse.compare.examples.xml/doc-html/CreateNewIDMapButton.gif
examples/org.eclipse.compare.examples.xml/doc-html/EditCopy.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMapContextMenu.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMap_GeneralMatching.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMap_MyPlugin.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMap_NewIDMapScheme.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMap_NewMapping_ContextMenu.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMap_NewMapping_PreferencePage.gif
examples/org.eclipse.compare.examples.xml/doc-html/IDMap_SelectMyPlugin.gif
examples/org.eclipse.compare.examples.xml/doc-html/Ordered_MyANT.gif
examples/org.eclipse.compare.examples.xml/doc-html/Ordered_NewIDMapScheme.gif
examples/org.eclipse.compare.examples.xml/doc-html/Ordered_NewOrderedEntry_ContextMenu.gif
examples/org.eclipse.compare.examples.xml/doc-html/Ordered_NewOrderedEntry_PreferencePage.gif
examples/org.eclipse.compare.examples.xml/doc-html/Ordered_UnorderedScheme.gif
examples/org.eclipse.compare.examples.xml/doc-html/PreferencePage.gif
examples/org.eclipse.compare.examples.xml/doc-html/addidmap.gif
examples/org.eclipse.compare.examples.xml/doc-html/hglegal.htm
examples/org.eclipse.compare.examples.xml/doc-html/idMapping.html
examples/org.eclipse.compare.examples.xml/doc-html/ngibmcpy.gif
examples/org.eclipse.compare.examples.xml/doc-html/smartmode_co.gif
examples/org.eclipse.compare.examples.xml/doc-html/tutorial_and_examples.html
examples/org.eclipse.compare.examples.xml/doc-html/ui_xmlcompare_ex.html
examples/org.eclipse.compare.examples.xml/icons/full/obj16/addidmap.gif
examples/org.eclipse.compare.examples.xml/icons/full/obj16/attribute_obj.gif
examples/org.eclipse.compare.examples.xml/icons/full/obj16/element_obj.gif
examples/org.eclipse.compare.examples.xml/icons/full/obj16/element_ordered_obj.gif
examples/org.eclipse.compare.examples.xml/icons/full/obj16/smartmode_co.gif
examples/org.eclipse.compare.examples.xml/icons/full/obj16/text_obj.gif
examples/org.eclipse.compare.examples.xml/plugin.properties
examples/org.eclipse.compare.examples.xml/plugin.xml
examples/org.eclipse.compare.examples.xml/schema/idMapping.exsd
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AbstractMatching.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AttributesImpl.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ChooseMatcherDropDownAction.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/CreateNewIdMapAction.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/GeneralMatching.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/HungarianMethod.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/IdMap.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/Mapping.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/SWTUtil.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/SelectMatcherAction.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLChildren.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareMessages.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLNode.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureViewer.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureViewerCreator.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusDialog.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusInfo.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusUtil.java
examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/xmlcompare.properties
examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/AllXMLCompareTests.java
examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestGeneralMatching.java
examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestMinCostBipartiteMatching.java
examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java
examples/org.eclipse.compare.examples/.cvsignore
examples/org.eclipse.compare.examples/.project
examples/org.eclipse.compare.examples/about.html
examples/org.eclipse.compare.examples/build.properties
examples/org.eclipse.compare.examples/doc-html/hglegal.htm
examples/org.eclipse.compare.examples/doc-html/ngibmcpy.gif
examples/org.eclipse.compare.examples/doc-html/ui_structurecreator_ex.html
examples/org.eclipse.compare.examples/plugin.properties
examples/org.eclipse.compare.examples/plugin.xml
examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/CompareExampleMessages.properties
examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/KeyValuePairStructureCreator.java
examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/TextMergeViewerCreator.java
examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java
examples/org.eclipse.team.examples.filesystem/.classpath
examples/org.eclipse.team.examples.filesystem/.cvsignore
examples/org.eclipse.team.examples.filesystem/.project
examples/org.eclipse.team.examples.filesystem/about.html
examples/org.eclipse.team.examples.filesystem/build.properties
examples/org.eclipse.team.examples.filesystem/doc-html/hglegal.htm
examples/org.eclipse.team.examples.filesystem/doc-html/ngibmcpy.gif
examples/org.eclipse.team.examples.filesystem/doc-html/team_filesystem_ex.html
examples/org.eclipse.team.examples.filesystem/icons/full/wizards/fsicon_wiz.gif
examples/org.eclipse.team.examples.filesystem/icons/full/wizban/newconnect_wizban.gif
examples/org.eclipse.team.examples.filesystem/plugin.properties
examples/org.eclipse.team.examples.filesystem/plugin.xml
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemRemoteResource.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/Policy.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/StreamUtil.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/messages.properties
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemPropertiesPage.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/GetAction.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java
examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java
tests/org.eclipse.compare.tests/.classpath
tests/org.eclipse.compare.tests/.cvsignore
tests/org.eclipse.compare.tests/.project
tests/org.eclipse.compare.tests/JUnit Tests/org/eclipse/compare/tests/AllTests.java
tests/org.eclipse.compare.tests/JUnit Tests/org/eclipse/compare/tests/DocLineComparatorTest.java
tests/org.eclipse.compare.tests/about.html
tests/org.eclipse.compare.tests/build.properties
tests/org.eclipse.compare.tests/plugin.properties
tests/org.eclipse.compare.tests/plugin.xml
tests/org.eclipse.compare.tests/test.xml
tests/org.eclipse.team.tests.core/.classpath
tests/org.eclipse.team.tests.core/.cvsignore
tests/org.eclipse.team.tests.core/.project
tests/org.eclipse.team.tests.core/about.html
tests/org.eclipse.team.tests.core/build-tests.xml
tests/org.eclipse.team.tests.core/build.properties
tests/org.eclipse.team.tests.core/ftp.properties
tests/org.eclipse.team.tests.core/plugin.xml
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTargetTests.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RemoteResourceTests.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTypeBic.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetTestSetup.java
tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
tests/org.eclipse.team.tests.core/test.xml
tests/org.eclipse.team.tests.core/webdav.properties
tests/org.eclipse.team.tests.cvs.core/.classpath
tests/org.eclipse.team.tests.cvs.core/.cvsignore
tests/org.eclipse.team.tests.cvs.core/.project
tests/org.eclipse.team.tests.cvs.core/about.html
tests/org.eclipse.team.tests.cvs.core/benchmark/cvsui_benchmark.bat
tests/org.eclipse.team.tests.cvs.core/benchmark/readme.txt
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_02_26.integration.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_03_19.integration.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_24.milestone5.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_25.integration.commandline.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_10.release2_0.commandline.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_11.release2_0.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20021127.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20030129.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/RC1.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/teamui_benchmark.bat
tests/org.eclipse.team.tests.cvs.core/benchmark/vcm1.0/2002_02_26.integration.all.xml
tests/org.eclipse.team.tests.cvs.core/benchmark/vcmui_benchmark.bat
tests/org.eclipse.team.tests.cvs.core/build-tests.xml
tests/org.eclipse.team.tests.cvs.core/build.properties
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS One Test.launch
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS Provider Tests.launch
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS Sync View Tests.launch
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS Tests.launch
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/Test using Ant application.launch
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/benchmark/Benchmark Test.launch
tests/org.eclipse.team.tests.cvs.core/launchConfigurations/benchmark/PrintDiffMain.launch
tests/org.eclipse.team.tests.cvs.core/plugin.xml
tests/org.eclipse.team.tests.cvs.core/readme.html
tests/org.eclipse.team.tests.cvs.core/repository.properties
tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip
tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip
tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkTiny.zip
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/macros/macro1
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project1/f1/file-in-p1.txt
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project2/file-p2.txt
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/sub/file-sub.txt
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/common/common.txt
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/linux/linux.txt
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/pc/pc.txt
tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt
tests/org.eclipse.team.tests.cvs.core/self-host.xml
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSClientException.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/ICVSClient.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/JUnitTestCase.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/TestConnection.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/TestConnectionMethod.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/AllTestsCompatibility.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/CompatibleTestSetup.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ConflictTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ModuleTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/AllTestsCVSResources.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/BatchedTestSetup.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncBytesTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/AllTestsProvider.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/LinkResourcesTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/WatchEditTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSUITestCase.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/DummyPromptCondition.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EclipseUITestHarnessApplication.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/AllTestsSynchronizeView.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/CheckoutOperationTests.java
tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java
tests/org.eclipse.team.tests.cvs.core/test.xml
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team')
142 files changed, 0 insertions, 21568 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java deleted file mode 100644 index 5ed5e1da6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -public interface IHelpContextIds { - public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$ - - // Preference Pages - public static final String TEAM_PREFERENCE_PAGE = PREFIX + "team_preference_page_context"; //$NON-NLS-1$ - public static final String IGNORE_PREFERENCE_PAGE = PREFIX + "ignore_preference_page_context"; //$NON-NLS-1$ - public static final String FILE_TYPE_PREFERENCE_PAGE = PREFIX + "file_type_preference_page_context"; //$NON-NLS-1$ - - // Wizard Pages - public static final String SHARE_PROJECT_PAGE = PREFIX + "share_project_page_context"; //$NON-NLS-1$ - public static final String IMPORT_PROJECT_SET_PAGE = PREFIX + "import_project_set_page_context"; //$NON-NLS-1$ - public static final String EXPORT_PROJECT_SET_PAGE = PREFIX + "export_project_set_page_context"; //$NON-NLS-1$ - public static final String TARGET_NEW_SITE_PAGE = PREFIX + "target_new_site_page_context"; //$NON-NLS-1$ - public static final String TARGET_MAPPING_SELECTION_PAGE = PREFIX + "target_mapping_selection_page_context"; //$NON-NLS-1$ - - // Catchup Release Viewers - public static final String TARGET_CATCHUP_RELEASE_VIEWER = PREFIX + "target_catchup_release_viewer_context"; //$NON-NLS-1$ - - // Target Actions - public static final String SYNC_GET_ACTION = PREFIX + "sync_get_action_context"; //$NON-NLS-1$ - public static final String SYNC_PUT_ACTION = PREFIX + "sync_put_action_context"; //$NON-NLS-1$ - - // Views - public static final String SITE_EXPLORER_VIEW = PREFIX + "site_explorer_view_context"; //$NON-NLS-1$ - public static final String SYNC_VIEW = PREFIX + "sync_view_context"; //$NON-NLS-1$ - - // Site Explorer View Actions - public static final String ADD_SITE_ACTION = PREFIX + "add_site_action_context"; //$NON-NLS-1$ - public static final String NEW_FOLDER_ACTION = PREFIX + "new_folder_action_context"; //$NON-NLS-1$ - - // Sync View Actions - public static final String OPEN_ACTION = PREFIX + "open_action_context"; //$NON-NLS-1$ - public static final String EXPANDALL_ACTION = PREFIX + "expandall_action_context"; //$NON-NLS-1$ - public static final String REMOVE_ACTION = PREFIX + "remove_action_context"; //$NON-NLS-1$ - public static final String NAVIGATOR_SHOW_ACTION = PREFIX + "navigator_show_action_context"; //$NON-NLS-1$ -} 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 deleted file mode 100644 index b5b8c3457..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java +++ /dev/null @@ -1,29 +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; - -public interface IPreferenceIds { - public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$ - - // Sync Viewer - public static final String SYNCVIEW_BACKGROUND_SYNC = PREFIX + "background_sync"; //$NON-NLS-1$ - public static final String SYNCVIEW_SCHEDULED_SYNC = PREFIX + "scheduled_sync"; //$NON-NLS-1$ - public static final String SYNCVIEW_DELAY = PREFIX + "scheduled_sync_delay"; //$NON-NLS-1$ - public static final String SYNCVIEW_COMPRESS_FOLDERS = PREFIX + "compress_folders"; //$NON-NLS-1$ - public static final String SYNCVIEW_SELECTED_MODE = PREFIX + "syncview_selected_mode"; //$NON-NLS-1$ - - public static final String SYNCVIEW_DEFAULT_PERSPECTIVE = PREFIX + "syncview_default_perspective"; //$NON-NLS-1$ - public static final String SYNCVIEW_DEFAULT_PERSPECTIVE_NONE = PREFIX + "sync_view_perspective_none"; //$NON-NLS-1$ - - 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$ -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java deleted file mode 100644 index c07f3f45c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java +++ /dev/null @@ -1,84 +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; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class NatureToPropertyAction extends TeamAction { - - /** - * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return true; - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(IAction) - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - final Shell shell = getShell(); - IProject[] projects = getSelectedProjects(); - List statii = new ArrayList(); - for (int i = 0; i < projects.length; i++) { - IFile file = projects[i].getFile(".project"); //$NON-NLS-1$ - IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, shell); - if (status.getCode() == IStatus.OK) { - RepositoryProvider.convertNatureToProperty(projects[i], true); - } else { - statii.add(status); - RepositoryProvider.convertNatureToProperty(projects[i], false); - } - } - if (!statii.isEmpty()) { - final IStatus[] statusArray = (IStatus[])statii.toArray(new IStatus[statii.size()]); - shell.getDisplay().syncExec(new Runnable() { - public void run() { - if (statusArray.length == 1) { - ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), statusArray[0]); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), new MultiStatus(TeamUIPlugin.ID, 0, statusArray, Policy.bind("NatureToPropertyAction.multiMessage"), null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - }); - for (int i = 0; i < statusArray.length; i++) { - TeamUIPlugin.log(statusArray[i]); - } - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("NatureToPropertyAction.label"), PROGRESS_DIALOG); //$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 deleted file mode 100644 index 4c2b884a6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java +++ /dev/null @@ -1,179 +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; - - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.NullSubProgressMonitor; - -/** - * Policy implements NLS convenience methods for the plugin and - * makes progress monitor policy decisions - */ -public class Policy { - // The resource bundle to get strings from - protected static ResourceBundle bundle = null; - - /** - * Creates a NLS catalog for the given locale. - * - * @param bundleName the name of the bundle - */ - public static void localize(String bundleName) { - bundle = ResourceBundle.getBundle(bundleName); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string. - * - * @param id the id to look up - * @param binding the string to bind to the result - * @return the bound string - */ - public static String bind(String id, String binding) { - return bind(id, new String[] { binding }); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - * - * @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 - * @return the bound string - */ - public static String bind(String id, String binding1, String binding2) { - return bind(id, new String[] { binding1, binding2 }); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - * - * @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 - * @return the bound string - */ - public static String bind(String id, String binding1, String binding2,String binding3) { - return bind(id, new String[] { binding1, binding2, binding3 }); - } - - /** - * 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); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Gets a string from the resource bundle and binds it with the given arguments. If the key is - * not found, return the key. - * - * @param key the id to look up - * @param args the strings to bind to the result - * @return the bound string - */ - public static String bind(String key, Object[] args) { - try { - return MessageFormat.format(bind(key), args); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Checks if the progress monitor is canceled. - * - * @param monitor the onitor to check for cancellation - * @throws OperationCanceledException if the monitor is canceled - */ - public static void checkCanceled(IProgressMonitor monitor) { - if (monitor.isCanceled()) { - throw new OperationCanceledException(); - } - } - /** - * Returns a monitor for the given monitor - * - * @param monitor the monitor to return a monitor for - * @return a monitor for the given monitor - */ - public static IProgressMonitor monitorFor(IProgressMonitor monitor) { - if (monitor == null) { - return new NullProgressMonitor(); - } - return monitor; - } - - public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new SubProgressMonitor(monitor, ticks); - } - - public static IProgressMonitor subInfiniteMonitorFor(IProgressMonitor monitor, int ticks) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new InfiniteSubProgressMonitor(monitor, ticks); - } - - public static IProgressMonitor subNullMonitorFor(IProgressMonitor monitor) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new NullSubProgressMonitor(monitor); - } - - public static String toTruncatedPath(IPath path, int split) { - // Search backwards until split separators are found - int count = 0; - String stringPath = path.toString(); - int index = stringPath.length(); - while (count++ < split && index != -1) { - index = stringPath.lastIndexOf(IPath.SEPARATOR, index - 1); - } - if (index == -1) { - return stringPath; - } else { - return "..." + stringPath.substring(index); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java deleted file mode 100644 index f3f05277f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -public class ProjectSetContentHandler extends DefaultHandler { - boolean inPsf = false; - boolean inProvider = false; - boolean inProject = false; - Map map; - String id; - List references; - boolean isVersionOne = false; - - /** - * @see ContentHandler#startElement(String, String, String, Attributes) - */ - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - if (localName.equals("psf")) { //$NON-NLS-1$ - map = new HashMap(); - inPsf = true; - String version = atts.getValue("version"); //$NON-NLS-1$ - isVersionOne = version.equals("1.0"); //$NON-NLS-1$ - return; - } - if (isVersionOne) return; - if (localName.equals("provider")) { //$NON-NLS-1$ - if (!inPsf) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4")); //$NON-NLS-1$ - inProvider = true; - id = atts.getValue("id"); //$NON-NLS-1$ - references = new ArrayList(); - return; - } - if (localName.equals("project")) { //$NON-NLS-1$ - if (!inProvider) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7")); //$NON-NLS-1$ - inProject = true; - String reference = atts.getValue("reference"); //$NON-NLS-1$ - references.add(reference); - return; - } - } - - /** - * @see ContentHandler#endElement(String, String, String) - */ - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - if (localName.equals("psf")) { //$NON-NLS-1$ - inPsf = false; - return; - } - if (isVersionOne) return; - if (localName.equals("provider")) { //$NON-NLS-1$ - map.put(id, references); - references = null; - inProvider = false; - return; - } - if (localName.equals("project")) { //$NON-NLS-1$ - inProject = false; - return; - } - } - - public Map getReferences() { - return map; - } - - public boolean isVersionOne() { - return isVersionOne; - } -} 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 deleted file mode 100644 index 9f18abc07..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java +++ /dev/null @@ -1,393 +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; - - -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.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -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.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.team.internal.ui.jobs.RefreshSubscriberInputJob; -import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob; -import org.eclipse.team.internal.ui.sync.actions.SyncViewerDirectionFilters; -import org.eclipse.team.internal.ui.sync.views.SyncViewerTableSorter; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * TeamUIPlugin is the plugin for generic, non-provider specific, - * team UI functionality in the workbench. - */ -public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeListener { - - private static TeamUIPlugin instance; - - public static final String ID = "org.eclipse.team.ui"; //$NON-NLS-1$ - public static final String PT_SUBSCRIBER_MENUS = "subscriberMenus"; //$NON-NLS-1$ - - // 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_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$ - public static final String PT_DECORATORS = "decorators"; //$NON-NLS-1$ - - private static List propertyChangeListeners = new ArrayList(5); - - private static Hashtable imageDescriptors = new Hashtable(20); - private static List disposeOnShutdownImages= new ArrayList(); - - private RefreshSubscriberInputJob refreshJob; - - /** - * Returns the job that refreshes the active subscribers in the background. - */ - public RefreshSubscriberInputJob getRefreshJob() { - return refreshJob; - } - - /** - * Creates a new TeamUIPlugin. - * - * @param descriptor the plugin descriptor - */ - public TeamUIPlugin(IPluginDescriptor descriptor) { - super(descriptor); - instance = this; - initializeImages(); - initializePreferences(); - } - /** - * Creates an extension. If the extension plugin has not - * been loaded a busy cursor will be activated during the duration of - * the load. - * - * @param element the config element defining the extension - * @param classAttribute the name of the attribute carrying the class - * @return the extension object - */ - public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException { - // If plugin has been loaded create extension. - // Otherwise, show busy cursor then create extension. - IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor(); - if (plugin.isPluginActivated()) { - return element.createExecutableExtension(classAttribute); - } else { - final Object [] ret = new Object[1]; - final CoreException [] exc = new CoreException[1]; - BusyIndicator.showWhile(null, new Runnable() { - public void run() { - try { - ret[0] = element.createExecutableExtension(classAttribute); - } catch (CoreException e) { - exc[0] = e; - } - } - }); - if (exc[0] != null) - throw exc[0]; - else - return ret[0]; - } - } - - /** - * Convenience method to get the currently active workbench page. Note that - * the active page may not be the one that the usr perceives as active in - * some situations so this method of obtaining the activae page should only - * be used if no other method is available. - * - * @return the active workbench page - */ - public static IWorkbenchPage getActivePage() { - IWorkbenchWindow window = getPlugin().getWorkbench().getActiveWorkbenchWindow(); - if (window == null) return null; - return window.getActivePage(); - } - - /** - * Return the default instance of the receiver. This represents the runtime plugin. - * - * @return the singleton plugin instance - */ - public static TeamUIPlugin getPlugin() { - return instance; - } - /** - * Initializes the preferences for this plugin if necessary. - */ - protected void initializePreferences() { - IPreferenceStore store = getPreferenceStore(); - store.setDefault(IPreferenceIds.SYNCVIEW_BACKGROUND_SYNC, true); - store.setDefault(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC, 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, SyncViewerDirectionFilters.BOTH_MODE); - store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, "org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective"); //$NON-NLS-1$ - } - - /** - * Convenience method for logging statuses to the plugin log - * - * @param status the status to log - */ - public static void log(IStatus status) { - getPlugin().getLog().log(status); - } - - /** - * Convenience method for logging a TeamException in such a way that the - * stacktrace is logged as well. - * @param e - */ - public static void log(CoreException e) { - IStatus status = e.getStatus(); - log (status.getSeverity(), status.getMessage(), e); - } - - /** - * Log the given exception along with the provided message and severity indicator - */ - public static void log(int severity, String message, Throwable e) { - log(new Status(severity, ID, 0, message, e)); - } - - /** - * @see Plugin#startup() - */ - public void startup() throws CoreException { - Policy.localize("org.eclipse.team.internal.ui.messages"); //$NON-NLS-1$ - initializePreferences(); - - getPreferenceStore().addPropertyChangeListener(this); - - // startup auto-refresh job if necessary - refreshJob = new RefreshSubscriberInputJob(Policy.bind("ScheduledSyncViewRefresh.taskName")); //$NON-NLS-1$ - refreshJob.setRefreshInterval(getPreferenceStore().getInt(IPreferenceIds.SYNCVIEW_DELAY) * 60); - if(getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC)) { - refreshJob.setRestartOnCancel(true); - refreshJob.setReschedule(true); - // start once the platform has started and stabilized - refreshJob.schedule(20000 /* 20 seconds */); - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#shutdown() - */ - public void shutdown() throws CoreException { - disposeImages(); - } - - /** - * 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); - } - } - - /** - * Registers the given image for being disposed when this plug-in is shutdown. - * - * @param image the image to register for disposal - */ - public static void disposeOnShutdown(Image image) { - if (image != null) - disposeOnShutdownImages.add(image); - } - - /** - * Creates an image and places it in the image registry. - * - * @param id the identifier for the image - * @param baseURL the base URL for the image - */ - protected static void createImageDescriptor(String id, URL baseURL) { - URL url = null; - try { - url = new URL(baseURL, ISharedImages.ICON_PATH + id); - } catch (MalformedURLException e) { - } - ImageDescriptor desc = ImageDescriptor.createFromURL(url); - imageDescriptors.put(id, desc); - } - /** - * Returns the image descriptor for the given image ID. - * Returns null if there is no such image. - * - * @param id the identifier for the image to retrieve - * @return the image associated with the given ID - */ - public static ImageDescriptor getImageDescriptor(String id) { - if(! imageDescriptors.containsKey(id)) { - URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL(); - createImageDescriptor(id, baseURL); - } - return (ImageDescriptor)imageDescriptors.get(id); - } - /** - * Convenience method to get an image descriptor for an extension - * - * @param extension the extension declaring the image - * @param subdirectoryAndFilename the path to the image - * @return the image - */ - public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) { - IPluginDescriptor pluginDescriptor = extension.getDeclaringPluginDescriptor(); - URL path = pluginDescriptor.getInstallURL(); - URL fullPathString = null; - try { - fullPathString = new URL(path,subdirectoryAndFilename); - return ImageDescriptor.createFromURL(fullPathString); - } catch (MalformedURLException e) { - } - return null; - } - /** - * Initializes the table of images used in this plugin. - */ - private void initializeImages() { - URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL(); - - // View decoration overlays - createImageDescriptor(ISharedImages.IMG_DIRTY_OVR, baseURL); - createImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR, baseURL); - createImageDescriptor(ISharedImages.IMG_CHECKEDOUT_OVR, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_VIEW, baseURL); - - // Collapse all - createImageDescriptor(ISharedImages.IMG_COLLAPSE_ALL, baseURL); - createImageDescriptor(ISharedImages.IMG_COLLAPSE_ALL_ENABLED, baseURL); - - // Target Management Icons - createImageDescriptor(ISharedImages.IMG_SITE_ELEMENT, baseURL); - - // Sync View Icons - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING, baseURL); - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING, baseURL); - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING, baseURL); - createImageDescriptor(ISharedImages.IMG_REFRESH, baseURL); - createImageDescriptor(ISharedImages.IMG_CHANGE_FILTER, baseURL); - createImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE, baseURL); - createImageDescriptor(ISharedImages.IMG_CONTENTS, baseURL); - - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_REFRESH_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_CONTENTS_DISABLED, baseURL); - - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_REFRESH_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_CONTENTS_ENABLED, baseURL); - - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_RELEASE, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE, baseURL); - - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_RELEASE_DISABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE_DISABLED, baseURL); - - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_RELEASE_ENABLED, baseURL); - createImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE_ENABLED, baseURL); - - createImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE, baseURL); - - // Wizard banners - createImageDescriptor(ISharedImages.IMG_PROJECTSET_IMPORT_BANNER, baseURL); - createImageDescriptor(ISharedImages.IMG_PROJECTSET_EXPORT_BANNER, baseURL); - - // Live Sync View icons - createImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER, baseURL); - } - - /** - * Dispose of images - */ - public static void disposeImages() { - if (disposeOnShutdownImages != null) { - Iterator i= disposeOnShutdownImages.iterator(); - while (i.hasNext()) { - Image img= (Image) i.next(); - if (!img.isDisposed()) - img.dispose(); - } - imageDescriptors= null; - } - } - - public void propertyChange(PropertyChangeEvent event) { - // update the background sync delay - if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_DELAY)) { - RefreshSubscriberJob refreshJob = getRefreshJob(); - refreshJob.setRefreshInterval(getPreferenceStore().getInt(IPreferenceIds.SYNCVIEW_DELAY) * 60); - } - - // enable / disable the background sync job - if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC)) { - RefreshSubscriberJob refreshJob = getRefreshJob(); - refreshJob.setRefreshInterval(getPreferenceStore().getInt(IPreferenceIds.SYNCVIEW_DELAY) * 60); - boolean value = getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC); - if(value) { - refreshJob.setRestartOnCancel(true); - refreshJob.setReschedule(true); - refreshJob.schedule(); - } else { - refreshJob.setRestartOnCancel(false /* don't restart the job */); - refreshJob.setReschedule(false); - refreshJob.cancel(); - } - } - } -} 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 deleted file mode 100644 index 969d5f081..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Created on Jun 26, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -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.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.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; - -/** - * @author Jean-Michel Lemieux - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class Utils { - - /** - * Shows the given errors to the user. - * - * @param Exception the exception containing the error - * @param title the title of the error dialog - * @param message the message for the error dialog - * @param shell the shell to open the error dialog in - */ - public static void handleError(Shell shell, Exception exception, String title, String message) { - IStatus status = null; - boolean log = false; - boolean dialog = false; - Throwable t = exception; - if (exception instanceof TeamException) { - status = ((TeamException)exception).getStatus(); - log = false; - dialog = true; - } else if (exception instanceof InvocationTargetException) { - t = ((InvocationTargetException)exception).getTargetException(); - if (t instanceof TeamException) { - status = ((TeamException)t).getStatus(); - log = false; - dialog = true; - } else if (t instanceof CoreException) { - status = ((CoreException)t).getStatus(); - log = true; - dialog = true; - } else if (t instanceof InterruptedException) { - return; - } else { - status = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("TeamAction.internal"), t); //$NON-NLS-1$ - log = true; - dialog = true; - } - } - if (status == null) return; - if (!status.isOK()) { - IStatus toShow = status; - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - if (children.length == 1) { - toShow = children[0]; - } - } - if (title == null) { - title = status.getMessage(); - } - if (message == null) { - message = status.getMessage(); - } - if (dialog && shell != null) { - ErrorDialog.openError(shell, title, message, toShow); - } - if (log || shell == null) { - TeamUIPlugin.log(toShow.getSeverity(), message, t); - } - } - } - public static void runWithProgress(Shell parent, boolean cancelable, - final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { - boolean createdShell = false; - try { - if (parent == null || parent.isDisposed()) { - Display display = Display.getCurrent(); - if (display == null) { - // cannot provide progress (not in UI thread) - runnable.run(new NullProgressMonitor()); - return; - } - // get the active shell or a suitable top-level shell - parent = display.getActiveShell(); - if (parent == null) { - parent = new Shell(display); - createdShell = true; - } - } - // pop up progress dialog after a short delay - final Exception[] holder = new Exception[1]; - BusyIndicator.showWhile(parent.getDisplay(), new Runnable() { - public void run() { - try { - runnable.run(new NullProgressMonitor()); - } catch (InvocationTargetException e) { - holder[0] = e; - } catch (InterruptedException e) { - holder[0] = e; - } - } - }); - if (holder[0] != null) { - if (holder[0] instanceof InvocationTargetException) { - throw (InvocationTargetException) holder[0]; - } else { - throw (InterruptedException) holder[0]; - } - } - //new TimeoutProgressMonitorDialog(parent, TIMEOUT).run(true /*fork*/, cancelable, runnable); - } finally { - if (createdShell) parent.dispose(); - } - } - /** - * Creates a progress monitor and runs the specified runnable. - * - * @param parent the parent Shell for the dialog - * @param cancelable if true, the dialog will support cancelation - * @param runnable the runnable - * - * @exception InvocationTargetException when an exception is thrown from the runnable - * @exception InterruptedException when the progress monitor is cancelled - */ - public static void runWithProgressDialog(Shell parent, boolean cancelable, - final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { - - new ProgressMonitorDialog(parent).run(cancelable, cancelable, runnable); - } - /* - * This method is only for use by the Target Management feature (see bug - * 16509). - * - * @param t - */ - public static void handle(Throwable t) { - IStatus error = null; - if (t instanceof InvocationTargetException) { - t = ((InvocationTargetException)t).getTargetException(); - } - if (t instanceof CoreException) { - error = ((CoreException)t).getStatus(); - } else if (t instanceof TeamException) { - error = ((TeamException)t).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal"), t); //$NON-NLS-1$ - } - - Shell shell = new Shell(Display.getDefault()); - - if (error.getSeverity() == IStatus.INFO) { - MessageDialog.openInformation(shell, Policy.bind("information"), error.getMessage()); //$NON-NLS-1$ - } else { - ErrorDialog.openError(shell, Policy.bind("exception"), null, error); //$NON-NLS-1$ - } - shell.dispose(); - // Let's log non-team exceptions - if (!(t instanceof TeamException)) { - TeamUIPlugin.log(error.getSeverity(), error.getMessage(), t); - } - } - - 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); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java deleted file mode 100644 index a1a1fcdad..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java +++ /dev/null @@ -1,59 +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.actions; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard; - -/** - * Action for configuring a project. Configuring involves associating - * the project with a Team provider and performing any provider-specific - * configuration that is necessary. - */ -public class ConfigureProjectAction extends TeamAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IProject project = getSelectedProjects()[0]; - ConfigureProjectWizard wizard = new ConfigureProjectWizard(); - wizard.init(null, project); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.open(); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("ConfigureProjectAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (!selectedProjects[0].isAccessible()) return false; - if (RepositoryProvider.getProvider(selectedProjects[0]) == null) return true; - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java deleted file mode 100644 index d30b66b22..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java +++ /dev/null @@ -1,52 +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.actions; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for deconfiguring a project. Deconfiguring involves removing - * associated provider for the project. - */ -public class DeconfigureProjectAction extends TeamAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - // should we use the id for the provider type and remove from the nature. Or would - // this operation be provider specific? - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("DeconfigureProjectAction.deconfigureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (RepositoryProvider.getProvider(selectedProjects[0]) != null) return false; - return true; - } -} 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 deleted file mode 100644 index fa2ae3539..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java +++ /dev/null @@ -1,374 +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.actions; - - -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.TeamPlugin; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * The abstract superclass of all Team actions. This class contains some convenience - * methods for getting selected objects and mapping selected objects to their - * providers. - * - * Team providers may subclass this class when creating their actions. - * 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 { - // The current selection - protected IStructuredSelection selection; - - // The shell, required for the progress dialog - protected Shell shell; - - // Constants for determining the type of progress. Subclasses may - // pass one of these values to the run method. - public final static int PROGRESS_DIALOG = 1; - public final static int PROGRESS_BUSYCURSOR = 2; - - private IWorkbenchPart targetPart; - - /** - * Creates an array of the given class type containing all the - * objects in the selection that adapt to the given class. - * - * @param selection - * @param c - * @return - */ - public static Object[] getSelectedAdaptables(ISelection selection, Class c) { - ArrayList result = null; - if (!selection.isEmpty()) { - result = new ArrayList(); - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object adapter = getAdapter(elements.next(), c); - if (c.isInstance(adapter)) { - result.add(adapter); - } - } - } - if (result != null && !result.isEmpty()) { - return (Object[])result.toArray((Object[])Array.newInstance(c, result.size())); - } - return (Object[])Array.newInstance(c, 0); - } - - /** - * Find the object associated with the given object when it is adapted to - * the provided class. Null is returned if the given object does not adapt - * to the given class - * - * @param selection - * @param c - * @return Object - */ - public static Object getAdapter(Object adaptable, Class c) { - if (c.isInstance(adaptable)) { - return adaptable; - } - if (adaptable instanceof IAdaptable) { - IAdaptable a = (IAdaptable) adaptable; - Object adapter = a.getAdapter(c); - if (c.isInstance(adapter)) { - return adapter; - } - } - return null; - } - - /** - * Returns the selected projects. - * - * @return the selected projects - */ - protected IProject[] getSelectedProjects() { - IResource[] selectedResources = getSelectedResources(); - if (selectedResources.length == 0) return new IProject[0]; - ArrayList projects = new ArrayList(); - for (int i = 0; i < selectedResources.length; i++) { - IResource resource = selectedResources[i]; - if (resource.getType() == IResource.PROJECT) { - projects.add(resource); - } - } - return (IProject[]) projects.toArray(new IProject[projects.size()]); - } - - /** - * Returns an array of the given class type c that contains all - * instances of c that are either contained in the selection or - * are adapted from objects contained in the selection. - * - * @param c - * @return - */ - protected Object[] getSelectedResources(Class c) { - return getSelectedAdaptables(selection, c); - } - - /** - * Returns the selected resources. - * - * @return the selected resources - */ - protected IResource[] getSelectedResources() { - return (IResource[])getSelectedResources(IResource.class); - } - - /** - * Convenience method for getting the current shell. - * - * @return the shell - */ - protected Shell getShell() { - if (shell != null) { - return shell; - } else { - IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); - if (workbench == null) return null; - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window == null) return null; - return window.getShell(); - } - } - /** - * Convenience method for running an operation with progress and - * error feedback. - * - * @param runnable the runnable which executes the operation - * @param problemMessage the message to display in the case of errors - * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG - */ - final protected void run(final IRunnableWithProgress runnable, final String problemMessage, int progressKind) { - final Exception[] exceptions = new Exception[] {null}; - switch (progressKind) { - case PROGRESS_BUSYCURSOR : - BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { - public void run() { - try { - runnable.run(new NullProgressMonitor()); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } catch (InterruptedException e) { - exceptions[0] = null; - } - } - }); - break; - default : - case PROGRESS_DIALOG : - try { - new ProgressMonitorDialog(getShell()).run(true, true, runnable); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } catch (InterruptedException e) { - exceptions[0] = null; - } - break; - } - if (exceptions[0] != null) { - handle(exceptions[0], null, problemMessage); - } - } - - /* - * Method declared on IActionDelegate. - */ - public void selectionChanged(IAction action, ISelection selection) { - if (selection instanceof IStructuredSelection) { - this.selection = (IStructuredSelection) selection; - if (action != null) { - setActionEnablement(action); - } - } - } - - /** - * Method invoked from <code>selectionChanged(IAction, ISelection)</code> - * to set the enablement status of the action. The instance variable - * <code>selection</code> will contain the latest selection so the methods - * <code>getSelectedResources()</code> and <code>getSelectedProjects()</code> - * will provide the proper objects. - * - * This method can be overridden by subclasses but should not be invoked by them. - */ - protected void setActionEnablement(IAction action) { - try { - action.setEnabled(isEnabled()); - } catch (TeamException e) { - if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) { - // Enable the action to allow the user to discover the problem - action.setEnabled(true); - } else { - action.setEnabled(false); - // We should not open a dialog when determining menu enablements so log it instead - TeamPlugin.log(e); - } - } - } - - /* - * Method declared on IObjectActionDelegate. - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - this.shell = targetPart.getSite().getShell(); - this.targetPart = targetPart; - } - /** - * Shows the given errors to the user. - * - * @param status the status containing the error - * @param title the title of the error dialog - * @param message the message for the error dialog - * @param shell the shell to open the error dialog in - */ - protected void handle(Exception exception, String title, String message) { - Utils.handleError(getShell(), exception, title, message); - } - - /** - * Concrete action enablement code. - * Subclasses must implement. - * - * @return whether the action is enabled - * @throws TeamException if an error occurs during enablement detection - */ - abstract protected boolean isEnabled() throws TeamException; - - /** - * Convenience method that maps the selected resources to their providers. - * The returned Hashtable has keys which are ITeamProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their selected resources - */ - protected Hashtable getProviderMapping() { - return getProviderMapping(getSelectedResources()); - } - /** - * Convenience method that maps the given resources to their providers. - * The returned Hashtable has keys which are ITeamProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getProviderMapping(IResource[] resources) { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } - - /** - * Convenience method that maps the selected resources to their target providers. - * The returned Hashtable has keys which are TargetProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their selected resources - */ - protected Hashtable getTargetProviderMapping() throws TeamException { - return getTargetProviderMapping(getSelectedResources()); - } - /** - * Convenience method that maps the given resources to their target providers. - * The returned Hashtable has keys which are TargetProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - TargetProvider provider = TargetManager.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } - - /** - * @return IWorkbenchPart - */ - protected IWorkbenchPart getTargetPart() { - return targetPart; - } - - /** - * Return the path that was active when the menu item was selected. - * @return IWorkbenchPage - */ - protected IWorkbenchPage getTargetPage() { - if (getTargetPart() == null) return TeamUIPlugin.getActivePage(); - return getTargetPart().getSite().getPage(); - } - - /** - * Show the view with the given ID in the perspective from which the action - * was executed. Returns null if the view is not registered. - * - * @param viewId - * @return IViewPart - */ - protected IViewPart showView(String viewId) { - try { - return getTargetPage().showView(viewId); - } catch (PartInitException pe) { - return null; - } - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java deleted file mode 100644 index d5fe9f945..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java +++ /dev/null @@ -1,293 +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.dialogs; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * A simple superclass for detail button dialogs. - */ -abstract public class DetailsDialog extends Dialog { - /** - * The Details button. - */ - private Button detailsButton; - - /** - * The Ok button. - */ - private Button okButton; - - /** - * The title of the dialog. - */ - private String title; - - /** - * The error message - */ - private Label errorMessageLabel; - - /** - * The SWT list control that displays the error details. - */ - private Composite detailsComposite; - - /** - * Indicates whether the error details viewer is currently created. - */ - private boolean detailsCreated = false; - - /** - * The key for the image to be displayed (one of the image constants on Dialog) - */ - private String imageKey = null; - - /** - * Creates a details pane dialog. - * Note that the dialog will have no visual representation (no widgets) - * until it is told to open. - * - * @param parentShell the shell under which to create this dialog - * @param dialogTitle the title to use for this dialog - * @param message the message to show in this dialog - * @param status the error to show to the user - * @param displayMask the mask to use to filter the displaying of child items, - * as per <code>IStatus.matches</code> - * @see org.eclipse.core.runtime.IStatus#matches - */ - public DetailsDialog(Shell parentShell, String dialogTitle) { - super(parentShell); - this.title = dialogTitle; - setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); - } - - /* (non-Javadoc) - * Method declared on Dialog. - * Handles the pressing of the Ok or Details button in this dialog. - * If the Ok button was pressed then close this dialog. If the Details - * button was pressed then toggle the displaying of the error details area. - * Note that the Details button will only be visible if the error being - * displayed specifies child details. - */ - protected void buttonPressed(int id) { - if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed? - toggleDetailsArea(); - } else { - super.buttonPressed(id); - } - } - - /* (non-Javadoc) - * Method declared in Window. - */ - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(title); - } - - /* (non-Javadoc) - * Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) { - // create OK and Details buttons - if(includeOkButton()) { - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - } - if (includeCancelButton()) { - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false); - updateEnablements(); - } - - /* (non-Javadoc) - * Method declared on Dialog. - * Creates and returns the contents of the upper part - * of the dialog (above the button bar). - */ - final protected Control createDialogArea(Composite parent) { - // create composite - Composite composite = (Composite)super.createDialogArea(parent); - - // create image - Image image = JFaceResources.getImageRegistry().get(getImageKey()); - if (image != null) { - // create a composite to split the dialog area in two - Composite top = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - layout.numColumns = 2; - top.setLayout(layout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - top.setFont(parent.getFont()); - - // add the image to the left of the composite - Label label = new Label(top, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData(new GridData( - GridData.HORIZONTAL_ALIGN_CENTER | - GridData.VERTICAL_ALIGN_CENTER)); - - // add a composite to the right to contain the custom components - Composite right = new Composite(top, SWT.NONE); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - right.setLayout(layout); - right.setLayoutData(new GridData(GridData.FILL_BOTH)); - right.setFont(parent.getFont()); - createMainDialogArea(right); - } else { - createMainDialogArea(composite); - } - - errorMessageLabel = new Label(composite, SWT.NONE); - errorMessageLabel.setLayoutData(new GridData( - GridData.GRAB_HORIZONTAL | - GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageLabel.setFont(parent.getFont()); - errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); - - return composite; - } - - /** - * Creates the dialog's top composite - * - * @param parent the parent composite - */ - abstract protected void createMainDialogArea(Composite parent); - - /** - * Create this dialog's drop-down list component. - * - * @param parent the parent composite - * @return the drop-down list component - */ - abstract protected Composite createDropDownDialogArea(Composite parent); - - /** - * Toggles the unfolding of the details area. This is triggered by - * the user pressing the details button. - */ - private void toggleDetailsArea() { - Point windowSize = getShell().getSize(); - Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - if (detailsCreated) { - detailsComposite.dispose(); - detailsCreated = false; - detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); - } else { - detailsComposite = createDropDownDialogArea((Composite)getContents()); - detailsCreated = true; - detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); - } - - Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); - } - - final protected void setErrorMessage(String error) { - if(errorMessageLabel != null) { - if(error == null || error.length() == 0) { - errorMessageLabel.setText(""); //$NON-NLS-1$ - } else { - errorMessageLabel.setText(error); - } - errorMessageLabel.update(); - } - } - - final protected void setPageComplete(boolean complete) { - if(okButton != null ) { - okButton.setEnabled(complete); - } - } - - abstract protected void updateEnablements(); - - protected boolean includeCancelButton() { - return true; - } - - protected boolean includeOkButton() { - return true; - } - - /** - * Returns the imageKey. - * @return String - */ - protected String getImageKey() { - return imageKey; - } - - - /** - * Sets the imageKey. - * @param imageKey The imageKey to set - */ - protected void setImageKey(String imageKey) { - this.imageKey = imageKey; - } - - protected static final int LABEL_WIDTH_HINT = 400; - protected Label createWrappingLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT | SWT.WRAP); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - data.horizontalIndent = 0; - data.grabExcessHorizontalSpace = true; - data.widthHint = LABEL_WIDTH_HINT; - label.setLayoutData(data); - return label; - } - - protected Composite createComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - return composite; - } - - protected boolean isDetailsVisible() { - return detailsCreated; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java deleted file mode 100644 index b1db66d2a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java +++ /dev/null @@ -1,115 +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.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * Display a message with a details that can contain a list of projects - */ -public class DetailsDialogWithProjects extends DetailsDialog { - - private String message; - private String detailsTitle; - private IProject[] projects; - - private Button actionButton; - private org.eclipse.swt.widgets.List detailsList; - - private boolean includeCancelButton; - - /** - * Constructor for DetailsDialogWithProjects. - * @param parentShell - * @param dialogTitle - */ - public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton, String imageKey) { - super(parentShell, dialogTitle); - setImageKey(imageKey); - this.message = dialogMessage; - this.detailsTitle = detailsTitle; - this.projects = projects; - this.includeCancelButton = includeCancelButton; - } - - /** - * @see DetailsDialog#createMainDialogArea(Composite) - */ - protected void createMainDialogArea(Composite composite) { - Label label = new Label(composite, SWT.WRAP); - label.setText(message); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(composite.getFont()); - updateEnablements(); - } - - /** - * @see DetailsDialog#createDropDownDialogArea(Composite) - */ - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - if (detailsTitle != null) { - detailsList.add(detailsTitle); - } - - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - detailsList.add(projects[i].getName()); //$NON-NLS-1$ - } - return composite; - } - - /** - * @see DetailsDialog#updateEnablements() - */ - protected void updateEnablements() { - setPageComplete(true); - } - - /** - * @see DetailsDialog#includeCancelButton() - */ - protected boolean includeCancelButton() { - return includeCancelButton; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java deleted file mode 100644 index d6639ab1b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java +++ /dev/null @@ -1,203 +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.dialogs; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * This class provides facilities to allow common widget groupings to be shared - * by mulitple dialogs or wizards. - */ -public abstract class DialogArea { - - protected static final int LABEL_WIDTH_HINT = 400; - - protected Dialog parentDialog; - protected FontMetrics fontMetrics; - protected IDialogSettings settings; - - protected List listeners; - - public DialogArea(Dialog parentDialog, IDialogSettings settings) { - this.listeners = new ArrayList(); - this.parentDialog = parentDialog; - this.settings = settings; - } - - /** - * Listener for property change events. The only event of interest is for - * property SELECTED_WORKING_SET which contains the selected working set or - * <code>null</code> if none is selected. - * - * @param listener - */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { - if (!listeners.contains(listener)) - listeners.add(listener); - } - /** - * Remove the provided listener from the receiver. - * - * @param listener - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - listeners.remove(listener); - } - - protected void firePropertyChangeChange(String property, Object oldValue, Object newValue) { - PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue); - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - IPropertyChangeListener listener = (IPropertyChangeListener) iter.next(); - listener.propertyChange(event); - } - } - - /** - * Code copied from <code>org.eclipse.jface.dialogs.Dialog</code> to obtain - * a FontMetrics. - * - * @param control a control from which to obtain the current font - * - * @see org.eclipse.jface.dialogs.Dialog - */ - protected void initializeDialogUnits(Control control) { - // Compute and store a font metric - GC gc = new GC(control); - gc.setFont(control.getFont()); - fontMetrics = gc.getFontMetrics(); - gc.dispose(); - } - - public abstract Control createArea(Composite parent); - - /** - * Returns the shell. - * @return Shell - */ - protected Shell getShell() { - return parentDialog.getShell(); - } - - protected Button createCheckbox(Composite parent, String label, int span) { - Button button = new Button(parent, SWT.CHECK | SWT.LEFT); - button.setText(label); - button.setFont(parent.getFont()); - GridData data = new GridData(); - data.horizontalSpan = span; - button.setLayoutData(data); - return button; - } - - protected Button createButton(Composite parent, String label, int style) { - Button button = new Button(parent, SWT.PUSH); - button.setText(label); - // we need to explicitly set the font to the parent's font for dialogs - button.setFont(parent.getFont()); - GridData data = new GridData(style); - data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_HEIGHT); - int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - button.setLayoutData(data);; - return button; - } - - protected Button createRadioButton(Composite parent, String label, int span) { - Button button = new Button(parent, SWT.RADIO); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = span; - button.setLayoutData(data); - return button; - } - protected Label createWrappingLabel(Composite parent, String text, int horizontalSpan) { - Label label = new Label(parent, SWT.LEFT | SWT.WRAP); - label.setText(text); - label.setFont(parent.getFont()); - GridData data = new GridData(); - data.horizontalSpan = horizontalSpan; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.widthHint = LABEL_WIDTH_HINT; - label.setLayoutData(data); - return label; - } - - /** - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - Font font = parent.getFont(); - composite.setFont(parent.getFont()); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - - /** - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createGrabbingComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - Font font = parent.getFont(); - composite.setFont(parent.getFont()); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = true; - composite.setLayoutData(data); - return composite; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java deleted file mode 100644 index 79f9b6c81..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.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.dialogs; - -import org.eclipse.core.resources.IResource; - -/** - * Input to a confirm prompt - * - * @see PromptingDialog - */ -public interface IPromptCondition { - /** - * Answers <code>true</code> if a prompt is required for this resource and - * false otherwise. - */ - public boolean needsPrompt(IResource resource); - - /** - * Answers the message to include in the prompt. - */ - public String promptMessage(IResource resource); -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java deleted file mode 100644 index 9ea7871ba..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java +++ /dev/null @@ -1,418 +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.dialogs; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.preference.IPersistentPreferenceStore; -import org.eclipse.jface.preference.IPreferencePageContainer; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.jface.resource.JFaceColors; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -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.Button; -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.Layout; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; - -public class PreferencePageContainerDialog extends Dialog implements IPreferencePageContainer { - - PreferencePage page; - - private class PageLayout extends Layout { - public void layout(Composite composite, boolean force) { - Rectangle rect = composite.getClientArea(); - Control [] children = composite.getChildren(); - for (int i= 0; i < children.length; i++) { - children[i].setSize(rect.width, rect.height); - } - } - public Point computeSize(Composite composite, int wHint, int hHint, boolean force) { - if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) - return new Point(wHint, hHint); - int x= fMinimumPageSize.x; - int y= fMinimumPageSize.y; - - Control[] children= composite.getChildren(); - for (int i= 0; i < children.length; i++) { - Point size= children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force); - x= Math.max(x, size.x); - y= Math.max(y, size.y); - } - if (wHint != SWT.DEFAULT) x = wHint; - if (hHint != SWT.DEFAULT) y = hHint; - return new Point(x, y); - } - } - - private Composite fTitleArea; - private Label fTitleImage; - private CLabel fMessageLabel; - - private String fMessage; - private Color fNormalMsgAreaBackground; - private Image fErrorMsgImage; - - private Button fOkButton; - - /** - * Must declare our own images as the JFaceResource images will not be created unless - * a property/preference dialog has been shown - */ - protected static final String PREF_DLG_TITLE_IMG = "preference_page_container_image";//$NON-NLS-1$ - protected static final String PREF_DLG_IMG_TITLE_ERROR = "preference_page_container_title_error_image";//$NON-NLS-1$ - static { - ImageRegistry reg = TeamUIPlugin.getPlugin().getImageRegistry(); - reg.put(PREF_DLG_TITLE_IMG, ImageDescriptor.createFromFile(PreferenceDialog.class, "images/pref_dialog_title.gif"));//$NON-NLS-1$ - reg.put(PREF_DLG_IMG_TITLE_ERROR, ImageDescriptor.createFromFile(Dialog.class, "images/message_error.gif"));//$NON-NLS-1$ - } - - /** - * The Composite in which a page is shown. - */ - private Composite fPageContainer; - - /** - * The minimum page size; 200 by 200 by default. - * - * @see #setMinimumPageSize(Point) - */ - private Point fMinimumPageSize = new Point(200,200); - - public PreferencePageContainerDialog(Shell shell, PreferencePage page) { - super(shell); - this.page = page; - } - - /** - * @see Dialog#okPressed() - */ - protected void okPressed() { - final List changedProperties = new ArrayList(5); - getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - changedProperties.add(event.getProperty()); - } - }); - - page.performOk(); - - handleSave(); - - super.okPressed(); - } - - /** - * Sets the title for this dialog. - * @param title the title. - */ - public void setTitle(String title) { - Shell shell= getShell(); - if ((shell != null) && !shell.isDisposed()) { - shell.setText(title); - } - } - - /** - * @see Dialog#createDialogArea(Composite) - */ - protected Control createDialogArea(Composite parent) { - Font font = parent.getFont(); - - Composite composite = (Composite)super.createDialogArea(parent); - ((GridLayout) composite.getLayout()).numColumns = 1; - composite.setFont(font); - - // Build the title area and separator line - Composite titleComposite = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = 0; - titleComposite.setLayout(layout); - titleComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - titleComposite.setFont(font); - - createTitleArea(titleComposite); - - Label titleBarSeparator = new Label(titleComposite, SWT.HORIZONTAL | SWT.SEPARATOR); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - titleBarSeparator.setLayoutData(gd); - - // Build the Page container - fPageContainer = createPageContainer(composite); - fPageContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - - page.setContainer(this); - page.createControl(fPageContainer); - setTitle(page.getTitle()); - - // Build the separator line - Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - separator.setLayoutData(gd); - - applyDialogFont(composite); - return composite; - } - - /** - * Creates the dialog's title area. - * - * @param parent the SWT parent for the title area composite - * @return the created title area composite - */ - private Composite createTitleArea(Composite parent) { - Font font = parent.getFont(); - - // Create the title area which will contain - // a title, message, and image. - fTitleArea = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = 0; - layout.numColumns = 2; - - // Get the colors for the title area - Display display = parent.getDisplay(); - Color bg = JFaceColors.getBannerBackground(display); - Color fg = JFaceColors.getBannerForeground(display); - - GridData layoutData = new GridData(GridData.FILL_BOTH); - fTitleArea.setLayout(layout); - fTitleArea.setLayoutData(layoutData); - fTitleArea.setFont(font); - fTitleArea.setBackground(bg); - - // Message label - fMessageLabel = new CLabel(fTitleArea, SWT.LEFT); - fMessageLabel.setBackground(bg); - fMessageLabel.setForeground(fg); - fMessageLabel.setText(" ");//$NON-NLS-1$ - fMessageLabel.setFont(JFaceResources.getBannerFont()); - - final IPropertyChangeListener fontListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - if(JFaceResources.BANNER_FONT.equals(event.getProperty()) || - JFaceResources.DIALOG_FONT.equals(event.getProperty())) { - updateMessage(); - } - } - }; - - fMessageLabel.addDisposeListener(new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - JFaceResources.getFontRegistry().removeListener(fontListener); - } - }); - - JFaceResources.getFontRegistry().addListener(fontListener); - - GridData gd = new GridData(GridData.FILL_BOTH); - fMessageLabel.setLayoutData(gd); - - // Title image - fTitleImage = new Label(fTitleArea, SWT.LEFT); - fTitleImage.setBackground(bg); - fTitleImage.setImage(TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_TITLE_IMG)); - gd = new GridData(); - gd.horizontalAlignment = GridData.END; - fTitleImage.setLayoutData(gd); - - return fTitleArea; - } - - /** - * Creates the inner page container. - */ - private Composite createPageContainer(Composite parent) { - Composite result = new Composite(parent, SWT.NULL); - result.setLayout(new PageLayout()); - result.setFont(parent.getFont()); - return result; - } - - /** - * Sets the minimum page size. - * - * @param size the page size encoded as - * <code>new Point(width,height)</code> - * @see #setMinimumPageSize(int,int) - */ - public void setMinimumPageSize(Point size) { - fMinimumPageSize.x = size.x; - fMinimumPageSize.y = size.y; - } - - /** - * Display the given error message. The currently displayed message - * is saved and will be redisplayed when the error message is set - * to <code>null</code>. - * - * @param errorMessage the errorMessage to display or <code>null</code> - */ - public void setErrorMessage(String errorMessage) { - if (errorMessage == null) { - if (fMessageLabel.getImage() != null) { - // we were previously showing an error - fMessageLabel.setBackground(fNormalMsgAreaBackground); - fMessageLabel.setImage(null); - fTitleImage.setImage(TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_TITLE_IMG)); - fTitleArea.layout(true); - } - - // show the message - setMessage(fMessage); - - } else { - fMessageLabel.setText(errorMessage); - if (fMessageLabel.getImage() == null) { - // we were not previously showing an error - - // lazy initialize the error background color and image - if (fErrorMsgImage == null) { - fErrorMsgImage = TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_IMG_TITLE_ERROR); - } - - // show the error - fNormalMsgAreaBackground = fMessageLabel.getBackground(); - fMessageLabel.setBackground(JFaceColors.getErrorBackground(fMessageLabel.getDisplay())); - fMessageLabel.setImage(fErrorMsgImage); - fTitleImage.setImage(null); - fTitleArea.layout(true); - } - } - } - /** - * Set the message text. If the message line currently displays an error, - * the message is stored and will be shown after a call to clearErrorMessage - */ - public void setMessage(String newMessage) { - fMessage = newMessage; - if (fMessage == null) { - fMessage = "";//$NON-NLS-1$ - } - if (fMessageLabel.getImage() == null) { - // we are not showing an error - fMessageLabel.setText(fMessage); - } - } - - /** - * @see IPreferencePageContainer#updateMessage() - */ - public void updateMessage() { - String pageMessage = page.getMessage(); - String pageErrorMessage = page.getErrorMessage(); - - // Adjust the font - if (pageMessage == null && pageErrorMessage == null) - fMessageLabel.setFont(JFaceResources.getBannerFont()); - else - fMessageLabel.setFont(JFaceResources.getDialogFont()); - - // Set the message and error message - if (pageMessage == null) { - setMessage(page.getTitle()); - } else { - setMessage(pageMessage); - } - setErrorMessage(pageErrorMessage); - } - - /** - * @see IPreferencePageContainer#getPreferenceStore() - */ - public IPreferenceStore getPreferenceStore() { - return page.getPreferenceStore(); - } - - /** - * @see IPreferencePageContainer#updateButtons() - */ - public void updateButtons() { - if (fOkButton != null) { - fOkButton.setEnabled(page.isValid()); - } - } - - /** - * @see IPreferencePageContainer#updateTitle() - */ - public void updateTitle() { - setTitle(page.getTitle()); - } - - /** - * @see Dialog#createButtonsForButtonBar(Composite) - */ - protected void createButtonsForButtonBar(Composite parent) { - fOkButton= createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - - /** - * Save the values specified in the pages. - * <p> - * The default implementation of this framework method saves all - * pages of type <code>PreferencePage</code> (if their store needs saving - * and is a <code>PreferenceStore</code>). - * </p> - * <p> - * Subclasses may override. - * </p> - */ - protected void handleSave() { - if (page instanceof PreferencePage) { - // Save now in case tbe workbench does not shutdown cleanly - IPreferenceStore store = - ((PreferencePage) page).getPreferenceStore(); - if (store != null - && store.needsSaving() - && store instanceof IPersistentPreferenceStore) { - try { - ((IPersistentPreferenceStore) store).save(); - } catch (IOException e) { - Utils.handle(e); - } - } - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java deleted file mode 100644 index 1f40ecd2b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java +++ /dev/null @@ -1,126 +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.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * A confirmation dialog helper that will either show a 'yes/no/yes to all/cancel' - * dialog to confirm an action performed on several resources or if only one - * resource is specified 'ok/cancel' will be shown. - */ -public class PromptingDialog { - private IResource[] resources; - private Shell shell; - private String[] buttons; - private boolean confirmOverwrite = true; - private IPromptCondition condition; - private String title; - private boolean hasMultipleResources; - private boolean allOrNothing; - - /** - * Prompt for the given resources using the specific condition. The prompt dialog will - * have the title specified. - */ - public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) { - this(shell, resources, condition, title, false /* all or nothing */); - } - - public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title, boolean allOrNothing) { - this.condition = condition; - this.resources = resources; - this.title = title; - this.shell = shell; - this.hasMultipleResources = resources.length > 1; - this.allOrNothing = allOrNothing; - if (hasMultipleResources) { - if (allOrNothing) { - buttons = new String[] { - IDialogConstants.YES_LABEL, - IDialogConstants.YES_TO_ALL_LABEL, - IDialogConstants.CANCEL_LABEL}; - } else { - buttons = new String[] { - IDialogConstants.YES_LABEL, - IDialogConstants.YES_TO_ALL_LABEL, - IDialogConstants.NO_LABEL, - IDialogConstants.CANCEL_LABEL}; - } - } else { - buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}; - } - } - /** - * Call to calculate and show prompt. If no resources satisfy the prompt condition - * a dialog won't be shown. The resources for which the user confirmed the action - * are returned. - */ - public IResource[] promptForMultiple() throws InterruptedException { - List targetResources = new ArrayList(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (condition.needsPrompt(resource) && confirmOverwrite) { - if (confirmOverwrite(condition.promptMessage(resource))) { - targetResources.add(resource); - } - } else { - targetResources.add(resource); - } - } - return (IResource[]) targetResources.toArray(new IResource[targetResources.size()]); - } - - /** - * Opens the confirmation dialog based on the prompt condition settings. - */ - private boolean confirmOverwrite(String msg) throws InterruptedException { - if (!confirmOverwrite) { - return true; - } - final MessageDialog dialog = - new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0); - - // run in syncExec because callback is from an operation, - // which is probably not running in the UI thread. - shell.getDisplay().syncExec( - new Runnable() { - public void run() { - dialog.open(); - } - }); - if (hasMultipleResources) { - switch (dialog.getReturnCode()) { - case 0://Yes - return true; - case 1://Yes to all - confirmOverwrite = false; - return true; - case 2://No (or CANCEL for all-or-nothing) - if (allOrNothing) { - throw new InterruptedException(); - } - return false; - case 3://Cancel - default: - throw new InterruptedException(); - } - } else { - return dialog.getReturnCode() == 0; - } - } -} 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 deleted file mode 100644 index b7e73ddbb..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberInputJob.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.jobs; - -import org.eclipse.core.resources.IResource; -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.subscribers.TeamSubscriber; -import org.eclipse.team.internal.ui.sync.sets.SubscriberInput; - -/** - * Job to refresh a subscriber with its remote state. - * - * 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 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 void setSubscriberInput(SubscriberInput input) { - int state = getState(); - if(state == Job.RUNNING) { - cancel(); - } - this.input = input; - - if(state == Job.NONE && input != null) { - if(shouldReschedule()) { - schedule(getScheduleDelay()); - } - } - } - - protected IResource[] getResources() { - if(input != null) { - return input.workingSetRoots(); - } - return null; - } - - protected TeamSubscriber getSubscriber() { - if(input != null) { - return input.getSubscriber(); - } - return null; - } -}
\ 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 deleted file mode 100644 index f6c57c3aa..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java +++ /dev/null @@ -1,199 +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.jobs; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.WorkspaceJob; -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.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.subscribers.TeamSubscriber; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; - -/** - * Job to refresh a subscriber with its remote state. - * - * There can be several refresh jobs created but they will be serialized. - */ -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 - */ - private boolean reschedule = false; - - /** - * If true a rescheduled refresh job should be retarted when cancelled - */ - private boolean restartOnCancel = true; - - /** - * The schedule delay used when rescheduling a completed job - */ - private static long scheduleDelay = 20000; //5 /* minutes */ * (60 * 1000); - - /** - * Time the job was run last in milliseconds. - */ - private long lastTimeRun = 0; - - /** - * The subscribers and roots to refresh. If these are changed when the job - * is running the job is cancelled. - */ - private IResource[] resources; - private TeamSubscriber subscriber; - - private class BatchSimilarSchedulingRule implements ISchedulingRule { - public String id; - public BatchSimilarSchedulingRule(String id) { - this.id = id; - } - public boolean isConflicting(ISchedulingRule rule) { - if(rule instanceof BatchSimilarSchedulingRule) { - return ((BatchSimilarSchedulingRule)rule).id.equals(id); - } - return false; - } - public boolean contains(ISchedulingRule rule) { - return isConflicting(rule); - } - } - - public RefreshSubscriberJob(String name, IResource[] resources, TeamSubscriber subscriber) { - super(name); - - this.resources = resources; - this.subscriber = subscriber; - - setPriority(Job.DECORATE); - setRule(new BatchSimilarSchedulingRule("org.eclipse.team.core.refreshsubscribers")); //$NON-NLS-1$ - - addJobChangeListener(new JobChangeAdapter() { - public void done(IJobChangeEvent event) { - if(shouldReschedule()) { - if(event.getResult().getSeverity() == IStatus.CANCEL && ! restartOnCancel) { - return; - } - RefreshSubscriberJob.this.schedule(scheduleDelay); - restartOnCancel = true; - } - } - }); - } - - public boolean shouldRun() { - return getSubscriber() != null && getResources() != null; - } - - public boolean belongsTo(Object family) { - return family == getFamily(); - } - - public static Object getFamily() { - return FAMILY_ID; - } - - /** - * 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) { - MultiStatus status = new MultiStatus(TeamPlugin.ID, TeamException.UNABLE, Policy.bind("Team.errorRefreshingSubscribers"), null); //$NON-NLS-1$ - TeamSubscriber subscriber = getSubscriber(); - IResource[] roots = getResources(); - - // if there are no resources to refresh, just return - if(subscriber == null || roots == null) { - return Status.OK_STATUS; - } - - monitor.beginTask(Policy.bind("RefreshSubscriber.runTitle", subscriber.getName()), 100); //$NON-NLS-1$ - try { - lastTimeRun = System.currentTimeMillis(); - TeamSubscriber[] subscribers = new TeamSubscriber[] {subscriber}; - for (int i = 0; i < subscribers.length; i++) { - TeamSubscriber s = subscribers[i]; - if(monitor.isCanceled()) { - return Status.CANCEL_STATUS; - } - try { - monitor.setTaskName(s.getName()); - s.refresh(roots, 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; - } - - protected IResource[] getResources() { - return resources; - } - - protected TeamSubscriber getSubscriber() { - return subscriber; - } - - protected long getScheduleDelay() { - return scheduleDelay; - } - - /** - * Specify the interval in seconds at which this job is scheduled. - * @param seconds delay specified in seconds - */ - public void setRefreshInterval(long seconds) { - scheduleDelay = seconds * 1000; - } - - /** - * Returns the interval of this job in seconds. - * @return - */ - public long getRefreshInterval() { - return scheduleDelay / 1000; - } - - public void setRestartOnCancel(boolean restartOnCancel) { - this.restartOnCancel = restartOnCancel; - } - - public void setReschedule(boolean reschedule) { - this.reschedule = reschedule; - } - - public boolean shouldReschedule() { - return reschedule; - } - - public long getLastTimeRun() { - return lastTimeRun; - } -}
\ No newline at end of file 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 deleted file mode 100644 index b3ff70f6c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties +++ /dev/null @@ -1,400 +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 -############################################################################### -############################################### -# Message catalog for org.eclipse.team.ui -############################################### - -AuthenticatedTargetSitePropertiesPage.Server=Server hostname: -AuthenticatedTargetSitePropertiesPage.User=&User: -AuthenticatedTargetSitePropertiesPage.Password=&Password: -AuthenticatedTargetSitePropertiesPage.Error=Error Occurred - -ProjectTargetMappingPropertiesPage.Error=A Bad Thing (tm) happened. -ProjectTargetMappingPropertiesPage.URL=Target site URL: -ProjectTargetMappingPropertiesPage.FolderName=Deployment path: -ProjectTargetMappingPropertiesPage.ChangeBtn=&Change these settings... - -CatchupReleaseViewer.open=&Show Content Comparison -CatchupReleaseViewer.expand=&Expand All -CatchupReleaseViewer.ignoreWhiteSpace=&Ignore White Space -CatchupReleaseViewer.refreshAction=&Refresh With Remote -CatchupReleaseViewer.showIncomingAction=Toggle showing of incoming Changes -CatchupReleaseViewer.showInNavigator=Show in &Navigator -CatchupReleaseViewer.showOnlyConflictsAction=Toggle showing of conflicting -CatchupReleaseViewer.showOutgoingAction=Toggle showing of outgoing Changes -CatchupReleaseViewer.removeFromView=Remove &From View -CatchupReleaseViewer.copyAllRightToLeft=Copy &All Changes From Right To Left -CatchupReleaseViewer.Compare_File_Contents_1=Compare File Contents -CatchupReleaseViewer.Copying_right_contents_into_workspace_2=Copying right contents into workspace -CatchupReleaseViewer.MakingLocalLikeRemote=Processing {0} - -ConfigureProjectAction.configureProject=Configure Project -ConfigureProjectWizard.configureProject=Share Project -ConfigureProjectWizard.description=Select the repository plug-in that will be used to share the selected project. -ConfigureProjectWizard.title=Share Project -ConfigureProjectWizardMainPage.selectRepository=Select a repository type: -ConfigureProjectWizardMainPage.selectTarget=Select a site type: - -ConfigurationWizard.exceptionCreatingWizard=Exception creating wizard. - -DeconfigureProjectAction.deconfigureProject=Deconfigure Project - -IgnorePreferencePage.description=Use this page to specify a list of resource name patterns to exclude from version control. -IgnorePreferencePage.add=&Add... -IgnorePreferencePage.enterPatternLong=Please enter a pattern: -IgnorePreferencePage.enterPatternShort=Enter Ignore Pattern -IgnorePreferencePage.ignorePatterns=&Ignore Patterns: -IgnorePreferencePage.patternExistsLong=The entered pattern already exists. -IgnorePreferencePage.patternExistsShort=Pattern Already Exists -IgnorePreferencePage.remove=&Remove - -MergeResource.commonFile=Common file: {0} -MergeResource.noCommonFile=No common file -MergeResource.noRepositoryFile=No remote file -MergeResource.repositoryFile=Remote file: {0} -MergeResource.workspaceFile=Workspace file: {0} - -nothingToSynchronize=Nothing to Synchronize -simpleInternal=Internal error -exception=An exception occurred - -SyncCompareInput.nothingText=Workspace resources are the same as remote. -SyncCompareInput.refresh=Error During Refresh with Remote -SyncCompareInput.synchronize=Synchronize -SyncCompareInput.taskTitle=Synchronizing with Remote... - -SyncSet.conflicts={0} conflicts, -SyncSet.incomings={0} incoming change(s), -SyncSet.noConflicts=No conflicts, -SyncSet.noIncomings=no incoming changes, -SyncSet.noOutgoings=no outgoing changes. -SyncSet.outgoings={0} outgoing change(s). - -SyncView.freeModeAction=Incoming/Outgoing Mode -SyncView.freeModeTitle=Synchronize - Incoming/Outgoing Mode -SyncView.freeModeToolTip=Incoming/Outgoing Mode -SyncView.incomingModeAction=Incoming Mode -SyncView.incomingModeTitle=Synchronize - Incoming Mode -SyncView.incomingModeToolTip=Incoming Mode -SyncView.outgoingModeAction=Outgoing Mode -SyncView.outgoingModeTitle=Synchronize - Outgoing Mode -SyncView.outgoingModeToolTip=Outgoing Mode -SyncView.same=Workspace resources are the same as remote. -SyncView.text=Synchronize resources with their remote to display them here. -SyncView.unableSynchronize=Unable to Synchronize -SyncView.saveTitle=Save Resource -SyncView.saveMessage=Resource has been modified. Save changes? -SyncView.errorSaving=Error while saving modified resources -SyncView.cantSaveError=Can't save changes: {0} -SyncView.dirtyIndicatorInTitle=*{0} - -LiveSyncView.title=Synchronize -LiveSyncView.titleTooltip={0}\nWorking Set: {1}\n -LiveSyncView.titleChangeNumbers=mode matched {0} of {1} changes: {2} hidden by working set -LiveSyncView.titleChangeNumbersNoWorkingSet=mode matched {0} of {1} changes -LiveSyncView.titleWithSubscriber={0} ({1}) - {2} - -SubscriberEventHandler.jobName=Updating synchronization state -SubscriberEventHandler.errors=Errors have occured while calculating the synchronization state. The Synchronize View may be out-of-date. Refresh the view or fix the errors and re-run the Synchronize command. - -SyncInfoCompareInput.localLabel=Local File -SyncInfoCompareInput.remoteLabel=Remote File -SyncInfoCompareInput.baseLabel=Common Ancestor -SyncInfoCompareInput.remoteLabelExists=Remote File ({0} {1} {2}) -SyncInfoCompareInput.baseLabelExists=Common Ancestor ({0} {1} {2}) -SyncInfoCompareInput.title={0}: {1} -SyncInfoCompareInput.tooltip=Comparing resources from {0}: {1} - -TeamAction.internal=Internal error occurred. -TeamFile.saveChanges=Unable to save changes to file: {0} -TeamFile.modified={0}* - -TextPreferencePage.add=&Add... -TextPreferencePage.binary=Binary -TextPreferencePage.change=&Change -TextPreferencePage.contents=Contents -TextPreferencePage.description=&File extensions with known content: -TextPreferencePage.enterExtensionLong=Please enter a file extension: -TextPreferencePage.enterExtensionShort=Enter File Extension -TextPreferencePage.extension=Extension -TextPreferencePage.extensionExistsLong=The entered extension already exists. -TextPreferencePage.extensionExistsShort=Extension Already Exists -TextPreferencePage.remove=&Remove -TextPreferencePage.text=ASCII - -TextPreferencePage.columnExtension=extension -TextPreferencePage.columnContents=contents - -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 refresh with all repositories -SyncViewRefresh.taskName=Team refresh {0} folders with repositories - -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: -ExportProjectSetMainPage.Browse_4=B&rowse... -ExportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder - -ImportProjectSetMainPage.Project_Set_File_Name__2=F&ile name: -ImportProjectSetMainPage.Browse_3=B&rowse... -ImportProjectSetMainPage.The_specified_file_does_not_exist_4=The specified file does not exist -ImportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder -ImportProjectSetMainPage.workingSetNameEmpty=The working set name must not be empty -ImportProjectSetMainPage.workingSetNameExists=The specified working set already exists -ImportProjectSetMainPage.createWorkingSetLabel=&Create a working set containing the imported projects -ImportProjectSetMainPage.workingSetLabel=&Working Set Name: - -ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4=Element provider must be contained in element psf -ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7=Element project must be contained in element provider - -ProjectSetExportWizard.Project_Set_1=Team Project Set -ProjectSetExportWizard.Export_a_Project_Set_3=Export a Team Project Set -ProjectSetExportWizard.Question_4=Question -ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5=Target directory does not exist. Would you like to create it? -ProjectSetExportWizard.Export_Problems_6=Export Problems -ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7=An error occurred creating the target directory -ProjectSetExportWizard.Question_8=Question -ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9=Target already exists. Would you like to overwrite it? -ProjectSetImportWizard.Project_Set_1=Team Project Set -ProjectSetImportWizard.Import_a_Project_Set_3=Import a Team Project Set -ProjectSetImportWizard.workingSetExistsTitle=Working Set Exists -ProjectSetImportWizard.workingSetExistsMessage=Working set ''{0}'' already exists. Overwrite? - -ExportProjectSetMainPage.Project_Set_Files_3=Team Project Set Files (*.psf) -ExportProjectSetMainPage.default=projectSet.psf -ImportProjectSetMainPage.allFiles=All Files (*.*) -ImportProjectSetMainPage.Project_Set_Files_2=Team Project Set Files (*.psf) -ExportProjectSetMainPage.&File_name__1=&File name: -TeamPreferencePage.General_settings_for_Team_support_1=General settings for Team support -TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2=&Use Incoming/Outgoing mode when synchronizing - -TargetSiteExportWizard.Target_Site=Target Site -TargetSiteExportWizard.Export_a_Target_Site=Export a target site -TargetSiteExportWizard.Creation_Question=Should I? -TargetSiteExportWizard.Create_dir=Would you like to create the directory, since it does not currently exist? -TargetSiteExportWizard.Export_Problems=Bad things happened! -TargetSiteExportWizard.Directory_creation_error=I was unable to create a new directory. Make sure you have write permissions in the appropriate area of the filesystem. -TargetSiteExportWizard.Overwrite_Question=Do you really want to? -TargetSiteExportWizard.Overwrite_file=Would you like to overwrite the file you have selected? - -ExportTargetSiteMainPage.Select_Sites=Select the sites to export -ExportTargetSiteMainPage.folder_specified=You cannot export to a directory! -ExportTargetSiteMainPage.Target_Site_Filename=Target site Filename -ExportTargetSiteMainPage.File_name=File name -ExportTargetSiteMainPage.Browse=Browse -ExportTargetSiteMainPage.Target_Site_Files=Target site files -ExportTargetSiteMainPage.default=targetSite.tsf - -ImportTargetSiteMainPage.nonexistent_file=No such file exists on your filesystem! -ImportTargetSiteMainPage.folder_specified=That is a directory, not a file! -ImportTargetSiteMainPage.File_name=File name -ImportTargetSiteMainPage.Browse=Browse -ImportTargetSiteMainPage.Target_Site_Files=Target site files - -NatureToPropertyAction.label=Convert Nature -NatureToPropertyAction.message=Could not remove the nature from one or more of the selected projects. -NatureToPropertyAction.multiMessage=Could not write .project file - -TargetSiteImportWizard.Target_Site=Target Site -TargetSiteImportWizard.Import_Target_Site=Import a Target site - -############################################### -# Target Management Messages -############################################### - -TargetSiteCreationWizard.windowTitleProject=Target a Site -TargetSiteCreationWizard.windowTitleNoProject=New Site -TargetSiteCreationWizard.label=Create a site connection -TargetSiteCreationWizard.description=Select the type of site you want to target. - -TargetSiteCreationWizard.mappingPageTitle=Specify the location on the site -TargetSiteCreationWizard.siteSelectionPage=Select or create a site - -SiteSelectionPage.description=Select an existing site or create a new site where you want to upload your resources to. -SiteSelectionPage.label=Select an existing site or create a new one: -SiteSelectionPage.useExisting=&Use Existing Site -SiteSelectionPage.createNew=&Create a new Site -SiteSelectionPage.disconnectTarget=&Disconnect from Site - -GetAsProject.thisResourceExists=The resource ''{0}'' already exists in the workspace. Overwrite? -GetAsProject.thisExternalFileExists=The folder ''{0}'' exists in the local file system. Overwrite? -GetAsProject.confirmOverwrite=Confirm Overwrite -GetAsProject.taskName1=Downloading ''{0}'' -GetAsProject.taskNameN=Downloading {0} folders -GetAsProject.errorCreatingProject=Error creating project: {0} -GetAsProject.errorGettingResources=Error getting resources - -GetAs.checkoutFailed=Problems encountered receiving the remote folder -GetAs.enterProjectTitle=Downloading ''{0}'' As... -GetAs.taskname=Downloading ''{0}'' as ''{1}'' - -Error=Error - -CreateNewFolderAction.errorCreatingFolder=Error creating the remote folder. -CreateNewFolderAction.title=New Remote Folder -CreateNewFolderAction.message=Enter the name for the new remote folder: -CreateNewFolderAction.newFolderName=New Folder - -GetAction.title=Download -GetAction.working=Downloading from ''{0}''... - -PutAction.title=Upload -PutAction.working=Uploading to ''{0}''... - -SiteExplorerView.addSiteAction=Target &Site -SiteExplorerView.addSiteActionTooltip=Add a Site -SiteExplorerView.newFolderAction=Fo&lder... -SiteExplorerView.newMenu=&New -SiteExplorerView.Name_1=Name -SiteExplorerView.Size_2=Size -SiteExplorerView.Modified_3=Modified -SiteExplorerView.URL_4=URL -SiteExplorerView.mappedProjects={0} is mapped to {1} -SiteExplorerView.projectsAlreadyMapped=The selected sites are being used by projects in your workspace. You must disconnect the projects from the Sites before discarding them. -SiteExplorerView.unmapProjectsAndDisconnect=Disconnect projects from these sites then discard the sites -SiteExplorerView.unmapDialogTitle=Warning - -CreateNewFolderAction.creatingFolder=Creating Folder -CreateNewFolderAction.suggestedNameProgress=Retrieving existing folder names... -CreateNewFolderAction.suggestedNameConcat={0}_{1} - -SiteExplorerView.promptForDeletingSites=Are you sure you want to discard {0} site(s)? -SiteExplorerView.promptForDeletingSitesTitle=Confirm Discarding Sites - -SiteExplorerViewLabelProvider.fileSize={0} KB - -MappingSelectionPage.description=Specify the location on the site where you want to target your resources. -MappingSelectionPage.label=Select the site or a folder: -MappingSelectionPage.newFolderLabel=&Create Folder... -MappingSelectionPage.mappingTitle=Select the location on the site - -ConfigureTargetWizardQuestion_2=Question -ConfigureTargetWizardError_6=Error -ConfigureTargetWizardError_mapping_the_project_with_this_site_7=Error mapping the project with this site -ConfigureTargetWizardURL_doesn__t_exist_on_the_server_8=URL doesn\'t exist on the server -ConfigureTargetWizardValidating_connection_to_Site..._9=Validating connection to Site... -ConfigureTargetWizardConnection_Error_10=Connection Error -ConfigureTargetWizard.alreadyMapped=''{0}'' is already targeted to ''{1}''. Are you sure you want to change this? -ConfigureTargetWizard.errorOccurred=An error occurred connecting to ''{0}''.\n\nCode: {1}\nMessage: {2}\n\nDo you still want to keep this target? -ConfigureTargetWizard.errorUnmappingProject=An error occurred trying to disconnect this project. - -GetAction.Exception_getting_provider_2=Exception getting provider -GetAction.confirmFileOverwrite=You have local changes which you are about to overwrite. Do you wish to continue? -GetAction.confirmFileOverwriteTitle=Confirm Overwrite - -TargetSyncAction.errorEncountered=An error occurred performing the action - -GetSyncAction.Getting..._1=Downloading... -PutAction.Exception_getting_provider_2=Exception getting provider -PutSyncAction.Putting..._1=Uploading... - -TargetCatchupReleaseViewer.Get_1=&Download -TargetCatchupReleaseViewer.Put_2=&Upload - -SiteSelectionPage.siteLabelCurrentWithMapping={0} (currently as {1}) -SiteSelectionPage.siteLabelCurrent={0} (current) - -UploadAction.Exception_getting_provider=Exception getting provider -UploadAction.working=Uploading to ''{0}''... -UploadAction.noDirtyTitle=No Dirty Resources Found -UploadAction.noDirtyMessage=There were no dirty resources found to upload. -UploadAction.confirmDeletionTitle=Confirm Deletion -UploadAction.confirmFileDeletionMessage=File ''{0}'' has been deleted locally. Do you want to delete it remotely? -UploadAction.problemMessage=Problems occurred uploading. - -SynchronizeView.noSubscribersMessage=Synchronize resources with their remote to display them here. Some Team plugins may also show resources here automatically when their plugin is activated. - -SyncViewerDirectionFilters.incomingTitle=Incoming -SyncViewerDirectionFilters.incomingToolTip=Toggle showing of incoming changes -SyncViewerDirectionFilters.outgoingTitle=Outgoing -SyncViewerDirectionFilters.outgoingToolTip=Toggle showing of outgoing changes -SyncViewerDirectionFilters.conflictingTitle=Conflicting -SyncViewerDirectionFilters.conflictingToolTip=Toggle showing of conflicting changes - -SyncViewPreferencePage.lastRefreshRun=The last background refresh was run at: {0} -SyncViewPreferencePage.lastRefreshRunNever=Never - -############################################### -# Sync view actions -############################################### - -action.toggleView.label=Toggle layout between a tree and table -action.toggleView.tooltip=Toggle layout between a tree and table -action.toggleView.descrioption=Toggle layout between a tree and table -action.toggleView.image=toggle_layout.gif - -action.collapseAll.label=Collapse All -action.collapseAll.tooltip=Collapse All -action.collapseAll.description=Collapse All -action.collapseAll.image=collapseall.gif - -action.changeFilters.label=Select change filters -action.changeFilters.tooltip=Select change filters -action.changeFilters.description=Select which change filters to apply in Synchronize view -action.changeFilters.image=filter_change.gif - -action.refreshWithRemote.label=Refresh with remote -action.refreshWithRemote.tooltip=Refresh with remote -action.refreshWithRemote.description=Refresh with remote -action.refreshWithRemote.image=refresh.gif - -action.directionFilterIncoming.label=Incoming Mode -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.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.tooltip=Conflicts Mode -action.directionFilterConflicts.description=Conflicts Mode (shows conflicts) -action.directionFilterConflicts.image=conflict_synch.gif - -action.directionFilterBoth.label=Incoming/Outgoing mode -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.expandAll.label=Expand All -action.openInCompareEditor.label=Open In Compare Editor -action.cancelSubscriber.label=Cancel -action.selectNextChange.label=Select Next Change -action.selectPreviousChange.label=Select Previous Change -action.syncViewPreferences.label=Preferences... -action.refreshViewContents.label=Refresh View Contents -action.changeFilterShowAdditions.label=Show Additions -action.changeFilterShowDeletions.label=Show Deletions -action.changeFilterShowChanges.label=Show Changes - -SynchronizeView.12=One item selected -SynchronizeView.13=\ items selected -SynchronizeView.14=Error opening perspective -SynchronizeView.16=Error opening view -SyncViewerPreferencePage.6=Synchronize view preferences -SyncViewerPreferencePage.7=Team Synchronize View settings: -SyncViewerPreferencePage.8=Display -SyncViewerPreferencePage.9=Compress in-sync folder paths when using the tree view -SyncViewerPreferencePage.10=Use incoming/outgoing mode when synchronizing -SyncViewerPreferencePage.11=Refreshing with Remote -SyncViewerPreferencePage.12=Refresh with the remote resources in the background -SyncViewerPreferencePage.13=Enable a background task to refresh with remote resources -SyncViewerPreferencePage.14=How often should the background refresh run? (in minutes) -SyncViewerPreferencePage.15=Perspective Switching diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java deleted file mode 100644 index a64177bcc..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java +++ /dev/null @@ -1,185 +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.preferences; - -import org.eclipse.jface.preference.FieldEditor; -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.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * A field editor for a combo box that allows the drop-down selection of one of a list of items. - * - * XXX: Note this is a copy from org.eclipse.debug.internal.ui.preferences - * This class can be removed once bug 24928 is fixed. - * - * @since 2.1 - */ -public class ComboFieldEditor extends FieldEditor { - - /** - * The <code>Combo</code> widget. - */ - private Combo fCombo; - - /** - * The value (not the name) of the currently selected item in the Combo widget. - */ - private String fValue; - - /** - * The names (labels) and underlying values to populate the combo widget. These should be - * arranged as: { {name1, value1}, {name2, value2}, ...} - */ - private String[][] fEntryNamesAndValues; - - public ComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent) { - init(name, labelText); - Assert.isTrue(checkArray(entryNamesAndValues)); - fEntryNamesAndValues= entryNamesAndValues; - createControl(parent); - } - - /** - * Checks whether given <code>String[][]</code> is of "type" - * <code>String[][2]</code>. - * - * @return <code>true</code> if it is ok, and <code>false</code> otherwise - */ - private boolean checkArray(String[][] table) { - if (table == null) { - return false; - } - for (int i= 0; i < table.length; i++) { - String[] array= table[i]; - if (array == null || array.length != 2) { - return false; - } - } - return true; - } - - /* - * @see FieldEditor#adjustForNumColumns(int) - */ - protected void adjustForNumColumns(int numColumns) { - Control control= getLabelControl(); - if (control != null) { - ((GridData)control.getLayoutData()).horizontalSpan= numColumns; - } - ((GridData)fCombo.getLayoutData()).horizontalSpan= numColumns; - } - - /* - * @see FieldEditor#doFillIntoGrid(Composite, int) - */ - protected void doFillIntoGrid(Composite parent, int numColumns) { - Control control= getLabelControl(parent); - GridData gd= new GridData(); - gd.horizontalSpan= numColumns; - control.setLayoutData(gd); - control= getComboBoxControl(parent); - gd= new GridData(); - gd.horizontalSpan= numColumns; - control.setLayoutData(gd); - } - - /* - * @see FieldEditor#doLoad() - */ - protected void doLoad() { - updateComboForValue(getPreferenceStore().getString(getPreferenceName())); - } - - /* - * @see FieldEditor#doLoadDefault() - */ - protected void doLoadDefault() { - updateComboForValue(getPreferenceStore().getDefaultString(getPreferenceName())); - } - - /* - * @see FieldEditor#doStore() - */ - protected void doStore() { - if (fValue == null) { - getPreferenceStore().setToDefault(getPreferenceName()); - return; - } - - getPreferenceStore().setValue(getPreferenceName(), fValue); - } - - /* - * @see FieldEditor#getNumberOfControls() - */ - public int getNumberOfControls() { - return 1; - } - - /** - * Lazily create and return the Combo control. - */ - public Combo getComboBoxControl(Composite parent) { - if (fCombo == null) { - fCombo= new Combo(parent, SWT.READ_ONLY); - for (int i= 0; i < fEntryNamesAndValues.length; i++) { - fCombo.add(fEntryNamesAndValues[i][0], i); - } - fCombo.setFont(parent.getFont()); - fCombo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - String oldValue= fValue; - String name= fCombo.getText(); - fValue= getValueForName(name); - setPresentsDefaultValue(false); - fireValueChanged(VALUE, oldValue, fValue); - } - }); - } - return fCombo; - } - - /** - * Given the name (label) of an entry, return the corresponding value. - */ - protected String getValueForName(String name) { - for (int i= 0; i < fEntryNamesAndValues.length; i++) { - String[] entry= fEntryNamesAndValues[i]; - if (name.equals(entry[0])) { - return entry[1]; - } - } - return fEntryNamesAndValues[0][0]; - } - - /** - * Set the name in the combo widget to match the specified value. - */ - protected void updateComboForValue(String value) { - fValue= value; - for (int i= 0; i < fEntryNamesAndValues.length; i++) { - if (value.equals(fEntryNamesAndValues[i][1])) { - fCombo.setText(fEntryNamesAndValues[i][0]); - return; - } - } - if (fEntryNamesAndValues.length > 0) { - fValue= fEntryNamesAndValues[0][1]; - fCombo.setText(fEntryNamesAndValues[0][0]); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java deleted file mode 100644 index 924527d9b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java +++ /dev/null @@ -1,194 +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.preferences; - - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.team.core.IIgnoreInfo; -import org.eclipse.team.core.Team; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; -public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private Table ignoreTable; - private Button addButton; - private Button removeButton; - public void init(IWorkbench workbench) { - setDescription(Policy.bind("IgnorePreferencePage.description")); //$NON-NLS-1$ - } - - /** - * Creates preference page controls on demand. - * - * @param parent the parent for the preference page - */ - protected Control createContents(Composite ancestor) { - - Composite parent = new Composite(ancestor, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.numColumns = 2; - parent.setLayout(layout); - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - parent.setLayoutData(data); - - // set F1 help - WorkbenchHelp.setHelp(parent, IHelpContextIds.IGNORE_PREFERENCE_PAGE); - - Label l1 = new Label(parent, SWT.NULL); - l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); //$NON-NLS-1$ - data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - l1.setLayoutData(data); - - ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - //gd.widthHint = convertWidthInCharsToPixels(30); - gd.heightHint = 300; - ignoreTable.setLayoutData(gd); - ignoreTable.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - handleSelection(); - } - }); - - Composite buttons = new Composite(parent, SWT.NULL); - buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - buttons.setLayout(layout); - - addButton = new Button(buttons, SWT.PUSH); - addButton.setText(Policy.bind("IgnorePreferencePage.add")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - addButton.setLayoutData(data); - addButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - addIgnore(); - } - }); - - - removeButton = new Button(buttons, SWT.PUSH); - removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - removeButton.setLayoutData(data); - removeButton.setEnabled(false); - removeButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - removeIgnore(); - } - }); - fillTable(Team.getAllIgnores()); - Dialog.applyDialogFont(ancestor); - return parent; - } - /** - * Do anything necessary because the OK button has been pressed. - * - * @return whether it is okay to close the preference page - */ - public boolean performOk() { - int count = ignoreTable.getItemCount(); - String[] patterns = new String[count]; - boolean[] enabled = new boolean[count]; - TableItem[] items = ignoreTable.getItems(); - for (int i = 0; i < count; i++) { - patterns[i] = items[i].getText(); - enabled[i] = items[i].getChecked(); - } - Team.setAllIgnores(patterns, enabled); - TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, TeamUI.GLOBAL_IGNORES_CHANGED, null, null)); - return true; - } - - protected void performDefaults() { - super.performDefaults(); - ignoreTable.removeAll(); - IIgnoreInfo[] ignore = Team.getDefaultIgnores(); - fillTable(ignore); - } - - /** - * @param ignore - */ - private void fillTable(IIgnoreInfo[] ignore) { - for (int i = 0; i < ignore.length; i++) { - IIgnoreInfo info = ignore[i]; - TableItem item = new TableItem(ignoreTable, SWT.NONE); - item.setText(info.getPattern()); - item.setChecked(info.getEnabled()); - } - } - - private void addIgnore() { - InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$ - dialog.open(); - if (dialog.getReturnCode() != InputDialog.OK) return; - String pattern = dialog.getValue(); - if (pattern.equals("")) return; //$NON-NLS-1$ - // Check if the item already exists - TableItem[] items = ignoreTable.getItems(); - for (int i = 0; i < items.length; i++) { - if (items[i].getText().equals(pattern)) { - MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } - TableItem item = new TableItem(ignoreTable, SWT.NONE); - item.setText(pattern); - item.setChecked(true); - } - - private void removeIgnore() { - int[] selection = ignoreTable.getSelectionIndices(); - ignoreTable.remove(selection); - } - private void handleSelection() { - if (ignoreTable.getSelectionCount() > 0) { - removeButton.setEnabled(true); - } else { - removeButton.setEnabled(false); - } - } -} 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 deleted file mode 100644 index ba221ce57..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java +++ /dev/null @@ -1,301 +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.preferences; - -import java.text.Collator; -import java.text.DateFormat; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.ui.IPreferenceIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IPerspectiveDescriptor; -import org.eclipse.ui.IPerspectiveRegistry; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -/** - * This area provides the widgets for providing the CVS commit comment - */ -public class SyncViewerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IPreferenceIds { - - private BooleanFieldEditor bkgRefresh = null; - private BooleanFieldEditor bkgScheduledRefresh = null; - private IntegerFieldEditor2 scheduledDelay = null; - private BooleanFieldEditor compressFolders = null; - private BooleanFieldEditor useBothMode = null; - - private Group refreshGroup; - - private static class PerspectiveDescriptorComparator implements Comparator { - /* - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) { - if (o1 instanceof IPerspectiveDescriptor && o2 instanceof IPerspectiveDescriptor) { - String id1= ((IPerspectiveDescriptor)o1).getLabel(); - String id2= ((IPerspectiveDescriptor)o2).getLabel(); - return Collator.getInstance().compare(id1, id2); - } - return 0; - } - } - - class IntegerFieldEditor2 extends IntegerFieldEditor { - /* (non-Javadoc) - * @see org.eclipse.jface.preference.FieldEditor#createControl(org.eclipse.swt.widgets.Composite) - */ - protected void createControl(Composite parent) { - super.createControl(parent); - } - - public IntegerFieldEditor2(String name, String labelText, Composite parent, int size) { - super(name, labelText, parent, size); - } - - protected boolean checkState() { - Text control= getTextControl(); - if (!control.isEnabled()) { - clearErrorMessage(); - return true; - } - return super.checkState(); - } - - /** - * Overrode here to be package visible. - */ - protected void refreshValidState() { - super.refreshValidState(); - } - - /** - * Only store if the text control is enabled - * @see FieldEditor#doStore() - */ - protected void doStore() { - Text text = getTextControl(); - if (text.isEnabled()) { - super.doStore(); - } - } - /** - * Clears the error message from the message line if the error - * message is the error message from this field editor. - */ - protected void clearErrorMessage() { - if (getPreferencePage() != null) { - String message= getPreferencePage().getErrorMessage(); - if (message != null) { - if(getErrorMessage().equals(message)) { - super.clearErrorMessage(); - } - - } else { - super.clearErrorMessage(); - } - } - } - } - - public SyncViewerPreferencePage() { - super(GRID); - setTitle(Policy.bind("SyncViewerPreferencePage.6")); //$NON-NLS-1$ - setDescription(Policy.bind("SyncViewerPreferencePage.7")); //$NON-NLS-1$ - setPreferenceStore(TeamUIPlugin.getPlugin().getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - //WorkbenchHelp.setHelp(getControl(), IDebugHelpContextIds.CONSOLE_PREFERENCE_PAGE); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() - */ - public void createFieldEditors() { - - GridData data; - Group displayGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.8")); //$NON-NLS-1$ - - compressFolders = new BooleanFieldEditor(SYNCVIEW_COMPRESS_FOLDERS, Policy.bind("SyncViewerPreferencePage.9"), SWT.NONE, displayGroup); //$NON-NLS-1$ - addField(compressFolders); - - refreshGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.11")); //$NON-NLS-1$ - - bkgRefresh = new BooleanFieldEditor(SYNCVIEW_BACKGROUND_SYNC, Policy.bind("SyncViewerPreferencePage.12"), SWT.NONE, refreshGroup); //$NON-NLS-1$ - addField(bkgRefresh); - - bkgScheduledRefresh = new BooleanFieldEditor(SYNCVIEW_SCHEDULED_SYNC, Policy.bind("SyncViewerPreferencePage.13"), SWT.NONE, refreshGroup); //$NON-NLS-1$ - addField(bkgScheduledRefresh); - - scheduledDelay = new IntegerFieldEditor2(SYNCVIEW_DELAY, Policy.bind("SyncViewerPreferencePage.14"), refreshGroup, 2); //$NON-NLS-1$ - addField(scheduledDelay); - - updateLastRunTime(createLabel(refreshGroup, null, 0)); - - Group perspectiveGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.15")); //$NON-NLS-1$ - - createLabel(perspectiveGroup, Policy.bind("SynchronizationViewPreference.defaultPerspectiveDescription"), 1); //$NON-NLS-1$ - - handleDeletedPerspectives(); - String[][] perspectiveNamesAndIds = getPerspectiveNamesAndIds(); - ComboFieldEditor comboEditor= new ComboFieldEditor( - SYNCVIEW_DEFAULT_PERSPECTIVE, - Policy.bind("SynchronizationViewPreference.defaultPerspectiveLabel"), //$NON-NLS-1$ - perspectiveNamesAndIds, - perspectiveGroup); - addField(comboEditor); - - Dialog.applyDialogFont(getFieldEditorParent()); - updateLayout(displayGroup); - updateLayout(perspectiveGroup); - updateLayout(refreshGroup); - getFieldEditorParent().layout(true); - } - - private Label createLabel(Composite parent, String title, int spacer) { - GridData data; - Label l = new Label(parent, SWT.WRAP); - l.setFont(parent.getFont()); - data = new GridData(); - data.horizontalSpan = 2; - if(spacer != 0) { - data.verticalSpan = spacer; - } - data.horizontalAlignment = GridData.FILL; - l.setLayoutData(data); - if(title != null) { - l.setText(title); //$NON-NLS-1$ - } - return l; - } - - private Group createGroup(Composite parent, String title) { - Group display = new Group(parent, SWT.NONE); - updateLayout(display); - GridData data = new GridData(); - data.horizontalSpan = 2; - data.horizontalAlignment = GridData.FILL; - display.setLayoutData(data); - display.setText(title); - return display; - } - - private void updateLayout(Composite composite) { - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 5; - layout.marginHeight =5; - layout.horizontalSpacing = 5; - layout.verticalSpacing = 5; - composite.setLayout(layout); - } - - private void updateLastRunTime(Label label) { - String text; - long mills = TeamUIPlugin.getPlugin().getRefreshJob().getLastTimeRun(); - if(mills == 0) { - String never = Policy.bind("SyncViewPreferencePage.lastRefreshRunNever"); //$NON-NLS-1$ - text = Policy.bind("SyncViewPreferencePage.lastRefreshRun", never); //$NON-NLS-1$ - } else { - Date lastTimeRun = new Date(TeamUIPlugin.getPlugin().getRefreshJob().getLastTimeRun()); - String sLastTimeRun = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(lastTimeRun); - text = Policy.bind("SyncViewPreferencePage.lastRefreshRun", sLastTimeRun); //$NON-NLS-1$ - } - label.setText(text); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if(event.getSource() == bkgScheduledRefresh) { - updateEnablements(); - } - super.propertyChange(event); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - TeamUIPlugin.getPlugin().savePluginPreferences(); - return super.performOk(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#checkState() - */ - protected void initialize() { - super.initialize(); - updateEnablements(); - } - - protected void updateEnablements() { - boolean enabled = bkgScheduledRefresh.getBooleanValue(); - scheduledDelay.setEnabled(enabled, refreshGroup); - scheduledDelay.refreshValidState(); - } - - /** - * Return a 2-dimensional array of perspective names and ids. - */ - private String[][] getPerspectiveNamesAndIds() { - - IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry(); - IPerspectiveDescriptor[] perspectiveDescriptors= registry.getPerspectives(); - - Arrays.sort(perspectiveDescriptors, new PerspectiveDescriptorComparator()); - - String[][] table = new String[perspectiveDescriptors.length + 1][2]; - table[0][0] = Policy.bind("SynchronizationViewPreference.defaultPerspectiveNone"); //$NON-NLS-1$; - table[0][1] = SYNCVIEW_DEFAULT_PERSPECTIVE_NONE; - for (int i = 0; i < perspectiveDescriptors.length; i++) { - table[i + 1][0] = perspectiveDescriptors[i].getLabel(); - table[i + 1][1] = perspectiveDescriptors[i].getId(); - } - return table; - } - - private static void handleDeletedPerspectives() { - IPreferenceStore store= TeamUIPlugin.getPlugin().getPreferenceStore(); - String id= store.getString(SYNCVIEW_DEFAULT_PERSPECTIVE); - if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) { - store.putValue(SYNCVIEW_DEFAULT_PERSPECTIVE, SYNCVIEW_DEFAULT_PERSPECTIVE_NONE); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java deleted file mode 100644 index dbf86809a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java +++ /dev/null @@ -1,123 +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.preferences; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; - -public class TeamPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - Button syncModeButton; - - public TeamPreferencePage() { - setDescription(Policy.bind("TeamPreferencePage.General_settings_for_Team_support_1")); //$NON-NLS-1$ - } - - /** - * @see PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.TEAM_PREFERENCE_PAGE); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginWidth = 0; - layout.marginHeight = 0; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - - // Create the checkbox for sync mode - syncModeButton = createCheckBox(composite, Policy.bind("TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2")); //$NON-NLS-1$ - - initializeValues(); - Dialog.applyDialogFont(parent); - return composite; - } - /** - * Creates an new checkbox instance and sets the default - * layout data. - * - * @param group the composite in which to create the checkbox - * @param label the string to set into the checkbox - * @return the new checkbox - */ - private Button createCheckBox(Composite group, String label) { - Button button = new Button(group, SWT.CHECK | SWT.LEFT); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = 1; - button.setLayoutData(data); - return button; - } - /** - * Returns preference store that belongs to the our plugin. - * This is important because we want to store - * our preferences separately from the desktop. - * - * @return the preference store for this plugin - */ - protected IPreferenceStore doGetPreferenceStore() { - return TeamUIPlugin.getPlugin().getPreferenceStore(); - } - /** - * Defaults was clicked. Restore the CVS preferences to - * their default values - */ - protected void performDefaults() { - super.performDefaults(); - IPreferenceStore store = getPreferenceStore(); - //syncModeButton.setSelection(store.getDefaultBoolean(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING)); - } - /** - * OK was clicked. Store the CVS preferences. - * - * @return whether it is okay to close the preference page - */ - public boolean performOk() { - IPreferenceStore store = getPreferenceStore(); - //store.setValue(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING, syncModeButton.getSelection()); - TeamUIPlugin.getPlugin().savePluginPreferences(); - return true; - } - /** - * Initializes states of the controls from the preference store. - */ - private void initializeValues() { - IPreferenceStore store = getPreferenceStore(); - //syncModeButton.setSelection(store.getBoolean(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING)); - } - /** - * @see IWorkbenchPreferencePage#init(IWorkbench) - */ - public void init(IWorkbench workbench) { - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java deleted file mode 100644 index 57da7bcb9..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java +++ /dev/null @@ -1,402 +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.preferences; - - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ComboBoxCellEditor; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.ICellModifier; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.team.core.IFileTypeInfo; -import org.eclipse.team.core.Team; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; -/** - * This preference page displays all patterns which determine whether a resource - * is to be treated as a text file or not. The page allows the user to add or - * remove entries from this table, and change their values from Text to Binary. - */ -public class TextPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - // Some string constants for display purposes - private static final String TEXT = Policy.bind("TextPreferencePage.text"); //$NON-NLS-1$ - private static final String BINARY = Policy.bind("TextPreferencePage.binary"); //$NON-NLS-1$ - - // The name of the parameter in the file registry - private static final String TYPE = "type"; //$NON-NLS-1$ - - // The input for the table viewer - private List input; - - // Widgets - private TableViewer viewer; - private Button removeButton; - private Button changeButton; - - /** - * TableEntry is a pair of strings representing an entry in the table - */ - class TableEntry { - String ext; - String value; - public TableEntry(String ext, String value) { - this.ext = ext; - this.value = value; - } - public String getExtension() { - return ext; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - } - /** - * TableLabelProvider provides labels for TableEntrys. - */ - class TableLabelProvider extends LabelProvider implements ITableLabelProvider { - public String getColumnText(Object element, int columnIndex) { - TableEntry entry = (TableEntry)element; - switch (columnIndex) { - case 0: - return entry.getExtension(); - case 1: - return entry.getValue(); - default: - return null; - } - } - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - }; - - /* - * Method declared on IWorkbenchPreferencePage - */ - public void init(IWorkbench workbench) { - } - /* - * @see PreferencePage#createControl - */ - protected Control createContents(Composite ancestor) { - - Composite parent = new Composite(ancestor, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.numColumns = 2; - parent.setLayout(layout); - - // set F1 help - WorkbenchHelp.setHelp(parent, IHelpContextIds.FILE_TYPE_PREFERENCE_PAGE); - - Label l1 = new Label(parent, SWT.NULL); - l1.setText(Policy.bind("TextPreferencePage.description")); //$NON-NLS-1$ - GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - l1.setLayoutData(data); - - viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - Table table = viewer.getTable(); - new TableEditor(table); - table.setHeaderVisible(true); - table.setLinesVisible(true); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.widthHint = convertWidthInCharsToPixels(30); - /* - * The hardcoded hint does not look elegant, but in reality - * it does not make anything bound to this 100-pixel value, - * because in any case the tree on the left is taller and - * that's what really determines the height. - */ - gd.heightHint = 100; - table.setLayoutData(gd); - table.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - handleSelection(); - } - }); - // Create the table columns - new TableColumn(table, SWT.NULL); - new TableColumn(table, SWT.NULL); - TableColumn[] columns = table.getColumns(); - columns[0].setText(Policy.bind("TextPreferencePage.extension")); //$NON-NLS-1$ - columns[1].setText(Policy.bind("TextPreferencePage.contents")); //$NON-NLS-1$ - - CellEditor editor = new ComboBoxCellEditor(table, new String[] {TEXT, BINARY}); - viewer.setCellEditors(new CellEditor[] {null, editor}); - viewer.setColumnProperties(new String[] {"extension", "contents"}); //$NON-NLS-1$ //$NON-NLS-2$ - viewer.setCellModifier(new ICellModifier() { - public Object getValue(Object element, String property) { - String value = ((TableEntry)element).getValue(); - if (value.equals(TEXT)) { - return new Integer(0); - } else { - return new Integer(1); - } - } - public boolean canModify(Object element, String property) { - return true; - } - public void modify(Object element, String property, Object value) { - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - TableEntry entry = (TableEntry)selection.getFirstElement(); - if (((Integer)value).intValue() == 0) { - entry.setValue(TEXT); - } else { - entry.setValue(BINARY); - } - viewer.refresh(entry); - } - }); - viewer.setLabelProvider(new TableLabelProvider()); - viewer.setContentProvider(new IStructuredContentProvider() { - public void dispose() { - } - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - public Object[] getElements(Object inputElement) { - if (inputElement == null) return null; - return ((List)inputElement).toArray(); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - ISelection selection = event.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - return; - } - viewer.editElement(((IStructuredSelection)selection).getFirstElement(), 1); - } - }); - viewer.setSorter(new ViewerSorter() { - public int compare(Viewer viewer, Object e1, Object e2) { - TableEntry entry1 = (TableEntry)e1; - TableEntry entry2 = (TableEntry)e2; - return super.compare(viewer, entry1.getExtension(), entry2.getExtension()); - } - }); - TableLayout tl = new TableLayout(); - tl.addColumnData(new ColumnWeightData(50)); - tl.addColumnData(new ColumnWeightData(50)); - table.setLayout(tl); - - Composite buttons = new Composite(parent, SWT.NULL); - buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - buttons.setLayout(layout); - - Button addButton = new Button(buttons, SWT.PUSH); - addButton.setText(Policy.bind("TextPreferencePage.add")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - addButton.setLayoutData(data); - addButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - addPattern(); - } - }); - - removeButton= new Button(buttons, SWT.PUSH); - removeButton.setText(Policy.bind("TextPreferencePage.remove")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - removeButton.setLayoutData(data); - removeButton.setEnabled(false); - removeButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - removePattern(); - } - }); - - changeButton = new Button(buttons, SWT.PUSH); - changeButton.setText(Policy.bind("TextPreferencePage.change")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - changeButton.setLayoutData(data); - changeButton.setEnabled(false); - changeButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - changePattern(); - } - }); - fillTable(Team.getAllTypes()); - Dialog.applyDialogFont(parent); - return parent; - } - - protected void performDefaults() { - super.performDefaults(); - IFileTypeInfo[] infos = Team.getDefaultTypes(); - fillTable(infos); - } - - /** - * Do anything necessary because the OK button has been pressed. - * - * @return whether it is okay to close the preference page - */ - public boolean performOk() { - int size = input.size(); - String[] extensions = new String[size]; - int[] types = new int[size]; - int i = 0; - - Iterator it = input.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - String value = entry.getValue(); - if (value.equals(TEXT)) { - types[i] = Team.TEXT; - } else { - types[i] = Team.BINARY; - } - extensions[i] = entry.getExtension(); - i++; - } - Team.setAllTypes(extensions, types); - return true; - } - /** - * Fill the table with the values from the file type registry - */ - private void fillTable(IFileTypeInfo[] infos) { - this.input = new ArrayList(); - for (int i = 0; i < infos.length; i++) { - IFileTypeInfo info = infos[i]; - int type = info.getType(); - switch (type) { - case Team.TEXT: - input.add(new TableEntry(info.getExtension(), TEXT)); - break; - case Team.BINARY: - input.add(new TableEntry(info.getExtension(), BINARY)); - break; - } - } - viewer.setInput(input); - } - /** - * Add a new item to the table with the default type of Text. - */ - private void addPattern() { - InputDialog dialog = new InputDialog(getShell(), Policy.bind("TextPreferencePage.enterExtensionShort"), Policy.bind("TextPreferencePage.enterExtensionLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$ - dialog.open(); - if (dialog.getReturnCode() != InputDialog.OK) return; - String pattern = dialog.getValue(); - if (pattern.equals("")) return; //$NON-NLS-1$ - // Check if the item already exists - Iterator it = input.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - if (entry.getExtension().equals(pattern)) { - MessageDialog.openWarning(getShell(), Policy.bind("TextPreferencePage.extensionExistsShort"), Policy.bind("TextPreferencePage.extensionExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } - input.add(new TableEntry(pattern, TEXT)); - viewer.refresh(); - } - /** - * Remove the selected items from the table - */ - private void removePattern() { - ISelection selection = viewer.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - Iterator it = ss.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - input.remove(entry); - } - viewer.refresh(); - } - /** - * Toggle the selected items' content types - */ - private void changePattern() { - ISelection selection = viewer.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - Iterator it = ss.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - String string = entry.getValue(); - if (string.equals(TEXT)) { - entry.setValue(BINARY); - } else { - entry.setValue(TEXT); - } - viewer.refresh(entry); - } - } - /** - * The table viewer selection has changed. Update the remove and change button enablement. - */ - private void handleSelection() { - boolean empty = viewer.getSelection().isEmpty(); - removeButton.setEnabled(!empty); - changeButton.setEnabled(!empty); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java deleted file mode 100644 index 8b8398851..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java +++ /dev/null @@ -1,734 +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; - - -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; - -import org.eclipse.compare.BufferedContent; -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.IEditableContent; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.NavigationAction; -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.structuremergeviewer.DiffContainer; -import org.eclipse.compare.structuremergeviewer.DiffElement; -import org.eclipse.compare.structuremergeviewer.DiffTreeViewer; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.views.navigator.ResourceNavigator; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * This viewer adds a custom filter and some merge actions. - * Note this is a layer breaker and needs to be refactored. Viewers should - * not contain references to workbench actions. Actions should be contributed - * by the view. - */ -public abstract class CatchupReleaseViewer extends DiffTreeViewer { - - class ShowInNavigatorAction extends Action implements ISelectionChangedListener { - IViewSite viewSite; - public ShowInNavigatorAction(IViewSite viewSite, String title) { - super(title, null); - this.viewSite = viewSite; - } - public void run() { - showSelectionInNavigator(viewSite); - } - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); - if (selection.size() == 0) { - setEnabled(false); - return; - } - for (Iterator iter = selection.iterator(); iter.hasNext();) { - ITeamNode node = (ITeamNode)iter.next(); - if(!node.getResource().isAccessible()) { - setEnabled(false); - return; - } - } - setEnabled(true); - } - }; - - /** - * This filter hides all empty categories tree nodes. - */ - class CategoryFilter extends ViewerFilter { - static final int SHOW_INCOMING = 1; - static final int SHOW_OUTGOING = 2; - static final int SHOW_CONFLICTS = 4; - static final int SHOW_PSEUDO_CONFLICTS = 8; - - private int showMask = 0; - - CategoryFilter(int showMask) { - // Mask for all categories to show - this.showMask = showMask; - } - int getMask() { - return showMask; - } - void setMask(int mask) { - this.showMask = mask; - } - public boolean select(Viewer viewer, Object parentElement, Object element) { - // If this element has visible children, always show it. - // This is not great -- O(n^2) filtering - if (hasFilteredChildren(element)) { - return true; - } - if (element instanceof ITeamNode) { - // Filter out pseudo conflicts if requested - int kind = ((ITeamNode)element).getKind(); - if ((showMask & SHOW_PSEUDO_CONFLICTS) == 0 && (kind & IRemoteSyncElement.PSEUDO_CONFLICT) != 0) { - return false; - } - int change = ((ITeamNode)element).getKind() & IRemoteSyncElement.CHANGE_MASK; - int direction = ((ITeamNode)element).getChangeDirection(); - switch (direction) { - case ITeamNode.INCOMING: - return (showMask & SHOW_INCOMING) != 0; - case ITeamNode.OUTGOING: - return (showMask & SHOW_OUTGOING) != 0; - case Differencer.CONFLICTING: - return (showMask & SHOW_CONFLICTS) != 0; - default: - return change != 0; - } - } - // No children are visible, and this folder has no changes, so don't show it. - return false; - } - public boolean isFilterProperty(Object element, String property) { - return property.equals(PROP_KIND); - } - } - - class FilterAction extends Action { - /** - * Must subclass constructor to make it accessible to container class - */ - FilterAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - updateFilters(); - } - } - class SyncSorter extends ViewerSorter { - public int compare(Viewer viewer, Object e1, Object e2) { - boolean oneIsFile = e1 instanceof TeamFile; - boolean twoIsFile = e2 instanceof TeamFile; - if (oneIsFile != twoIsFile) { - return oneIsFile ? 1 : -1; - } - return super.compare(viewer, e1, e2); - } - } - - class RemoveFromTreeAction extends Action { - public RemoveFromTreeAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - ISelection s = getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return; - } - // mark all selected nodes as in sync - for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) { - Object element = it.next(); - setAllChildrenInSync((IDiffElement)element); - } - refresh(); - } - public void update() { - // Update action enablement - setEnabled(!getSelection().isEmpty()); - } - } - class ExpandAllAction extends Action { - public ExpandAllAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - expandSelection(); - } - public void update() { - setEnabled(!getSelection().isEmpty()); - } - } - class OpenAction extends Action { - public OpenAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - openSelection(); - } - public void update() { - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() == 1) { - Object element = ss.getFirstElement(); - setEnabled(element instanceof TeamFile); - return; - } - } - setEnabled(false); - } - } - - // The current sync mode - private int syncMode = SyncView.SYNC_NONE; - - // Actions - private FilterAction showIncoming; - private FilterAction showOutgoing; - private FilterAction showOnlyConflicts; - private Action refresh; - private OpenAction open; - private ExpandAllAction expandAll; - private RemoveFromTreeAction removeFromTree; - private ShowInNavigatorAction showInNavigator; - private Action ignoreWhiteSpace; - private Action toggleGranularity; - - private NavigationAction showPrevious; - private NavigationAction showNext; - - // Property constant for diff mode kind - static final String PROP_KIND = "team.ui.PropKind"; //$NON-NLS-1$ - - private Action copyAllRightToLeft; - - private boolean compareFileContents = false; - - /** - * Creates a new catchup/release viewer. - */ - protected CatchupReleaseViewer(Composite parent, SyncCompareInput model) { - super(parent, model.getCompareConfiguration()); - setSorter(new SyncSorter()); - initializeActions(model); - } - - /** - * Contributes actions to the provided toolbar - */ - void contributeToActionBars(IActionBars actionBars) { - IToolBarManager toolBar = actionBars.getToolBarManager(); - - toolBar.add(new Separator()); - toolBar.add(showOnlyConflicts); - - toolBar.add(new Separator()); - toolBar.add(showNext); - toolBar.add(showPrevious); - - // Drop down menu - IMenuManager menu = actionBars.getMenuManager(); - if (syncMode == SyncView.SYNC_BOTH) { - menu.add(showIncoming); - menu.add(showOutgoing); - } - menu.add(toggleGranularity); - menu.add(ignoreWhiteSpace); - menu.add(refresh); - } - - /** - * Contributes actions to the popup menu. - */ - protected void fillContextMenu(IMenuManager manager) { - open.update(); - manager.add(open); - manager.add(new Separator()); - expandAll.update(); - manager.add(expandAll); - removeFromTree.update(); - manager.add(removeFromTree); - if (showInNavigator != null) { - manager.add(showInNavigator); - } - if (syncMode == SyncView.SYNC_COMPARE) { - if(copyAllRightToLeft.isEnabled()) { - manager.add(copyAllRightToLeft); - } - } - } - - protected void openSelection() { - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - Iterator elements = ((IStructuredSelection)selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - openSelection(next); - } - } - } - - /** - * Method openSelection. - * @param next - */ - private void openSelection(Object next) { - if (next instanceof TeamFile) { - handleOpen(null); - } - } - - /** - * Expands to infinity all items in the selection. - */ - protected void expandSelection() { - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - Iterator elements = ((IStructuredSelection)selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - expandToLevel(next, ALL_LEVELS); - } - } - } - - protected int getSyncMode() { - return syncMode; - } - - /** - * Returns true if the given element has filtered children, and false otherwise. - */ - protected boolean hasFilteredChildren(Object element) { - return getFilteredChildren(element).length > 0; - } - - /** - * Creates the actions for this viewer. - */ - private void initializeActions(final SyncCompareInput diffModel) { - // Mask actions - ImageDescriptor image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING_ENABLED); - showIncoming = new FilterAction(Policy.bind("CatchupReleaseViewer.showIncomingAction"), image); //$NON-NLS-1$ - showIncoming.setToolTipText(Policy.bind("CatchupReleaseViewer.showIncomingAction")); //$NON-NLS-1$ - showIncoming.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING_DISABLED)); - showIncoming.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING)); - - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING_ENABLED); - showOutgoing = new FilterAction(Policy.bind("CatchupReleaseViewer.showOutgoingAction"), image); //$NON-NLS-1$ - showOutgoing.setToolTipText(Policy.bind("CatchupReleaseViewer.showOutgoingAction")); //$NON-NLS-1$ - showOutgoing.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING_DISABLED)); - showOutgoing.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING)); - - //show only conflicts is not a HideAction because it doesnt flip bits, it sets an exact mask - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING_ENABLED); - showOnlyConflicts = new FilterAction(Policy.bind("CatchupReleaseViewer.showOnlyConflictsAction"), image); //$NON-NLS-1$ - showOnlyConflicts.setToolTipText(Policy.bind("CatchupReleaseViewer.showOnlyConflictsAction")); //$NON-NLS-1$ - showOnlyConflicts.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING_DISABLED)); - showOnlyConflicts.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING)); - - //refresh action - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_REFRESH_ENABLED); - refresh = new Action(Policy.bind("CatchupReleaseViewer.refreshAction"), image) { //$NON-NLS-1$ - public void run() { - diffModel.refresh(); - } - }; - refresh.setToolTipText(Policy.bind("CatchupReleaseViewer.refreshAction")); //$NON-NLS-1$ - refresh.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_REFRESH_DISABLED)); - refresh.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_REFRESH)); - - // Open Action - open = new OpenAction(Policy.bind("CatchupReleaseViewer.open"), null); //$NON-NLS-1$ - WorkbenchHelp.setHelp(open, IHelpContextIds.OPEN_ACTION); - - // Expand action - expandAll = new ExpandAllAction(Policy.bind("CatchupReleaseViewer.expand"), null); //$NON-NLS-1$ - WorkbenchHelp.setHelp(expandAll, IHelpContextIds.EXPANDALL_ACTION); - - // Toggle granularity - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONTENTS_ENABLED); - toggleGranularity = new Action(Policy.bind("CatchupReleaseViewer.Compare_File_Contents_1"), image) { //$NON-NLS-1$ - public void run() { - compareFileContents = isChecked(); - diffModel.setSyncGranularity(compareFileContents ? ILocalSyncElement.GRANULARITY_CONTENTS : ILocalSyncElement.GRANULARITY_TIMESTAMP); - updateFilters(); - } - }; - compareFileContents = diffModel.getSyncGranularity() != IRemoteSyncElement.GRANULARITY_TIMESTAMP; - toggleGranularity.setChecked(compareFileContents); - toggleGranularity.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONTENTS_DISABLED)); - toggleGranularity.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONTENTS)); - - removeFromTree = new RemoveFromTreeAction(Policy.bind("CatchupReleaseViewer.removeFromView"), null); //$NON-NLS-1$ - WorkbenchHelp.setHelp(removeFromTree, IHelpContextIds.REMOVE_ACTION); - - copyAllRightToLeft = new Action(Policy.bind("CatchupReleaseViewer.copyAllRightToLeft"), null) { //$NON-NLS-1$ - public void run() { - ISelection s = getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return; - } - // action is only enabled for 1 element. the for loop - final Object element = ((IStructuredSelection)s).getFirstElement(); - if(element instanceof DiffElement) { - try { - new ProgressMonitorDialog(getTree().getShell()).run(true /* fork */, true /* cancellable */, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(null, 1000); - monitor.setTaskName(Policy.bind("CatchupReleaseViewer.Copying_right_contents_into_workspace_2")); //$NON-NLS-1$ - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - try { - monitor.beginTask(null, 100); - copyAllRightToLeft((DiffElement)element, monitor); - } finally { - monitor.done(); - } - } - }, Policy.subInfiniteMonitorFor(monitor, 1000)); - } catch(CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }); - } catch(InvocationTargetException e) { - ErrorDialog.openError(TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("CatchupReleaseViewer.errorCopyAllRightToLeft"), null, null); //$NON-NLS-1$ - } catch(InterruptedException e) { - } - } - refresh(); - } - public boolean isEnabled() { - ISelection s = getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return false; - } - return ((IStructuredSelection)s).size() == 1; - } - }; - - // Show in navigator - if (diffModel.getViewSite() != null) { - showInNavigator = new ShowInNavigatorAction(diffModel.getViewSite(), Policy.bind("CatchupReleaseViewer.showInNavigator")); //$NON-NLS-1$ - WorkbenchHelp.setHelp(showInNavigator, IHelpContextIds.NAVIGATOR_SHOW_ACTION); - addSelectionChangedListener(showInNavigator); - } - - // Ignore white space - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE_ENABLED); - ignoreWhiteSpace = new Action(Policy.bind("CatchupReleaseViewer.ignoreWhiteSpace"), image) { //$NON-NLS-1$ - public void run() { - diffModel.setIgnoreWhitespace(isChecked()); - } - }; - ignoreWhiteSpace.setId("team.ignoreWhiteSpace"); //$NON-NLS-1$ - boolean ignore = CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(CompareConfiguration.IGNORE_WHITESPACE); - ignoreWhiteSpace.setChecked(ignore); - ignoreWhiteSpace.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE_DISABLED)); - ignoreWhiteSpace.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE)); - - // Show next and previous change - showNext = new NavigationAction(true); - showPrevious = new NavigationAction(false); - showNext.setCompareEditorInput(diffModel); - showPrevious.setCompareEditorInput(diffModel); - - // Add a double-click listener for expanding/contracting - getTree().addListener(SWT.MouseDoubleClick, new Listener() { - public void handleEvent(Event e) { - mouseDoubleClicked(e); - } - }); - - // Add an F5 listener for refresh - getTree().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.F5) { - diffModel.refresh(); - } - } - }); - - // Set an initial filter -- show all changes - showIncoming.setChecked(true); - showOutgoing.setChecked(true); - showOnlyConflicts.setChecked(false); - setFilters(CategoryFilter.SHOW_INCOMING| CategoryFilter.SHOW_CONFLICTS | CategoryFilter.SHOW_OUTGOING); - } - - /** - * Method setAllChildrenInSync. - * @param iDiffElement - */ - private void setAllChildrenInSync(IDiffElement element) { - if(element instanceof DiffContainer) { - DiffContainer container = (DiffContainer)element; - IDiffElement[] children = container.getChildren(); - for (int i = 0; i < children.length; i++) { - setAllChildrenInSync(children[i]); - } - } - ((DiffElement)element).setKind(IRemoteSyncElement.IN_SYNC); - } - - protected void copyAllRightToLeft(IDiffElement element, IProgressMonitor monitor) throws CoreException { - Policy.checkCanceled(monitor); - - if(element instanceof DiffContainer) { - DiffContainer container = (DiffContainer)element; - IDiffElement[] children = container.getChildren(); - for (int i = 0; i < children.length; i++) { - copyAllRightToLeft(children[i], monitor); - } - } else if(element instanceof TeamFile) { - TeamFile file = (TeamFile)element; - if(file.getKind() != IRemoteSyncElement.IN_SYNC) { - monitor.subTask( - Policy.bind("CatchupReleaseViewer.MakingLocalLikeRemote", //$NON-NLS-1$ - Policy.toTruncatedPath(file.getMergeResource().getResource().getFullPath(), 3))); - file.setProgressMonitor(Policy.subNullMonitorFor(monitor)); - - if(file.getRight() == null || file.getLeft() == null) { - file.copy(false /* right to left */); - } - ITypedElement te = file.getLeft(); - ITypedElement rte = file.getRight(); - if(te instanceof IEditableContent) { - IEditableContent editable = (IEditableContent)te; - if(editable.isEditable()) { - if(rte instanceof BufferedContent) { - editable.setContent(((BufferedContent)rte).getContent()); - } - } - } - file.setProgressMonitor(null); - monitor.worked(1); - } - } - } - - /* - * Method declared on ContentViewer. - */ - protected void inputChanged(Object input, Object oldInput) { - super.inputChanged(input, oldInput); - // Update the refresh action - if (refresh != null) { - Tree tree = getTree(); - if (tree != null) { - refresh.setEnabled(input != null); - } - } - } - - /** - * Shows the selected resource(s) in the resource navigator. - */ - private void showSelectionInNavigator(IViewSite viewSite) { - ISelection selection = getSelection(); - if (!(selection instanceof IStructuredSelection)) { - return; - } - // Create a selection of IResource objects - Object[] selected = ((IStructuredSelection)selection).toArray(); - IResource[] resources = new IResource[selected.length]; - for (int i = 0; i < selected.length; i++) { - resources[i] = ((ITeamNode)selected[i]).getResource(); - } - ISelection resourceSelection = new StructuredSelection(resources); - - // Show the resource selection in the navigator - try { - IViewPart part = viewSite.getPage().showView(IPageLayout.ID_RES_NAV); - if (part instanceof ResourceNavigator) { - ((ResourceNavigator)part).selectReveal(resourceSelection); - } - } catch (PartInitException e) { - TeamUIPlugin.log(e); - } - } - - /** - * The mouse has been double-clicked in the tree, perform appropriate - * behaviour. - */ - private void mouseDoubleClicked(Event e) { - // Only act on single selection - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection structured = (IStructuredSelection)selection; - if (structured.size() == 1) { - Object first = structured.getFirstElement(); - if (first instanceof IDiffContainer) { - // Try to expand/contract - setExpandedState(first, !getExpandedState(first)); - } - } - } - } - - /** - * @see org.eclipse.jface.viewers.StructuredViewer#handleOpen(SelectionEvent) - */ - protected void handleOpen(SelectionEvent event) { - ISelection selection = getSelection(); - if (!selection.isEmpty() && selection instanceof IStructuredSelection) { - IStructuredSelection structured = (IStructuredSelection)selection; - Object selected = structured.getFirstElement(); - if (selected instanceof TeamFile) { - updateLabels(((TeamFile)selected).getMergeResource()); - } - } - super.handleOpen(event); - } - - /** - * Subclasses may override to provide different labels for the compare configuration. - */ - protected void updateLabels(MergeResource resource) { - resource.setLabels(getCompareConfiguration()); - } - - /** - * Set the filter mask to be the exact mask specified. - */ - private void setFilters(int maskToHide) { - ViewerFilter[] filters = getFilters(); - if (filters != null) { - for (int i = 0; i < filters.length; i++) { - if (filters[i] instanceof CategoryFilter) { - CategoryFilter filter = (CategoryFilter)filters[i]; - // Set the exact match to be applied on the filter - filter.setMask(maskToHide); - refresh(); - return; - } - } - } - // No category filter found -- add one - addFilter(new CategoryFilter(maskToHide)); - } - - /** - * The sync mode has changed. Update the filters. - */ - public void syncModeChanged(int mode) { - this.syncMode = mode; - updateFilters(); - } - - /** - * Sets the viewer filtering based on the current state - * of the filter actions. - */ - void updateFilters() { - //do nothing if viewer is disposed - Control control = getControl(); - if (control == null || control.isDisposed()) - return; - - //always show conflicts - int filters = CategoryFilter.SHOW_CONFLICTS; - - //determine what other filters to apply based on current action states - switch (syncMode) { - case SyncView.SYNC_INCOMING: - case SyncView.SYNC_MERGE: - if (!showOnlyConflicts.isChecked()) { - filters |= CategoryFilter.SHOW_INCOMING; - } - break; - case SyncView.SYNC_OUTGOING: - if (!showOnlyConflicts.isChecked()) { - filters |= CategoryFilter.SHOW_OUTGOING; - } - break; - case SyncView.SYNC_BOTH: - boolean conflictsOnly = showOnlyConflicts.isChecked(); - //if showing only conflicts, don't allow these actions to happen - showIncoming.setEnabled(!conflictsOnly); - showOutgoing.setEnabled(!conflictsOnly); - if (!conflictsOnly) { - if (showIncoming.isChecked()) { - filters |= CategoryFilter.SHOW_INCOMING; - } - if (showOutgoing.isChecked()) { - filters |= CategoryFilter.SHOW_OUTGOING; - } - } - break; - } - - //determine whether to show pseudo conflicts - if (!compareFileContents) { - filters |= CategoryFilter.SHOW_PSEUDO_CONFLICTS; - } - setFilters(filters); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java deleted file mode 100644 index 1fbc6dee3..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java +++ /dev/null @@ -1,80 +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; - - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A node in a sync tree that represents a changed folder - * (incoming/outgoing creation or deletion). - */ -public class ChangedTeamContainer extends UnchangedTeamContainer { - private MergeResource mergeResource; - - /** - * ChangedTeamContainer constructor - */ - public ChangedTeamContainer(IDiffContainer parent, MergeResource resource, int description) { - super(parent, resource.getResource(), description); - this.mergeResource = resource; - } - - /* - * Method declared on ITeamNode. - */ - public int getChangeDirection() { - return getKind() & Differencer.DIRECTION_MASK; - } - - public int getChangeType() { - return getKind() & Differencer.CHANGE_TYPE_MASK; - } - - public String getName() { - return mergeResource.getName(); - } - - /** - * Returns the team resource managed by this object. - */ - public MergeResource getMergeResource() { - return mergeResource; - } - - /* - * Method declared on IDiffContainer - */ - public void removeToRoot(IDiffElement child) { - // Don't want to remove empty changed containers - remove(child); - } - - /** - * For debugging purposes only. - */ - public String toString() { - return "ChangedTeamContainer(" + getResource().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void makeInSync() { - setKind(Differencer.NO_CHANGE); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java deleted file mode 100644 index c7890a721..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.sync; - - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Interface for a sync node that responds to team commands. - */ -public interface ITeamNode extends IDiffElement { - // Possible values for the change direction - static final int INCOMING = Differencer.RIGHT; - static final int OUTGOING = Differencer.LEFT; - static final int CONFLICTING = Differencer.CONFLICTING; - static final int NO_CHANGE = Differencer.NO_CHANGE; - - /** - * Returns the change direction for this resource. One of: - * INCOMING, OUTGOING, CONFLICTING, NO_CHANGE. - */ - public int getChangeDirection(); - - /** - * Returns the type of change for this resource. One of: - * CHANGE, DELETION, ADDITION - */ - public int getChangeType(); - - /** - * Returns the core resource represented by this node. - */ - public IResource getResource(); -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java deleted file mode 100644 index 5f71df9b0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java +++ /dev/null @@ -1,166 +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; - - -import java.io.InputStream; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.ITypedElement; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.Policy; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Encapsulates information about a resource that requires - * contact with the Team API. - */ -public class MergeResource { - private IRemoteSyncElement syncTree; - - /** - * Creates a new merge resource based on the given sync information. - */ - public MergeResource(IRemoteSyncElement syncTree) { - this.syncTree = syncTree; - } - - /** - * Returns an InputStream for the base revision of this incoming resource. - */ - public InputStream getBaseRevision() throws CoreException { - IRemoteResource remote = syncTree.getBase(); - if (remote != null && !remote.isContainer()) { - try { - return remote.getContents(new NullProgressMonitor()); - } catch (TeamException exception) { - // The remote resource has gone. - return null; - } - } - return null; - } - - public String getExtension() { - if (syncTree.isContainer()) { - return ITypedElement.FOLDER_TYPE; - } - String name = getName(); - if (name != null) { - int index = name.lastIndexOf('.'); - if (index == -1) - return ""; //$NON-NLS-1$ - if (index == (name.length() - 1)) - return ""; //$NON-NLS-1$ - return name.substring(index + 1); - } - return ITypedElement.FOLDER_TYPE; - } - - /** - * Returns an InputStream for the latest repository version of this incoming resource. - */ - public InputStream getLatestRevision() throws CoreException { - IRemoteResource remote = syncTree.getRemote(); - try { - return remote.getContents(new NullProgressMonitor()); - } catch (TeamException e) { - throw new CoreException(e.getStatus()); - } - } - - /** - * Returns an InputStream for the local resource. - */ - public InputStream getLocalStream() throws CoreException { - IResource left = syncTree.getLocal(); - if (left == null) return null; - if (left.exists() && left.getType() == IResource.FILE) { - return ((IFile)left).getContents(true); - } - return null; - } - - public String getName() { - return syncTree.getName(); - } - - /* - * @see IMergeResource#getResource. - */ - public IResource getResource() { - return syncTree.getLocal(); - } - - public IRemoteSyncElement getSyncElement() { - return syncTree; - } - - /** - * Returns true if this merge resource has a base resource, - * and false otherwise. - */ - public boolean hasBaseRevision() { - return syncTree.getBase() != null; - } - - /** - * Returns true if this merge resource has a latest revision, - * and false otherwise. - */ - public boolean hasLatestRevision() { - return syncTree.getRemote() != null; - } - - /** - * Is this a leaf node, i.e. a file? - */ - public boolean isLeaf() { - return !syncTree.isContainer(); - } - - /** - * Updates the given compare configuration with appropriate left, right - * and ancestor labels for this resource. - */ - public void setLabels(CompareConfiguration config) { - String name = getName(); - config.setLeftLabel(Policy.bind("MergeResource.workspaceFile", name)); //$NON-NLS-1$ - - - IRemoteResource remote = syncTree.getRemote(); - if (remote != null) { - config.setRightLabel(Policy.bind("MergeResource.repositoryFile", name)); //$NON-NLS-1$ - // config.setRightLabel(TeamUIPlugin.getResourceString("MergeResource.repositoryFile", new Object[] {name, remote.getVersionName()} )); - } else { - config.setRightLabel(Policy.bind("MergeResource.noRepositoryFile")); //$NON-NLS-1$ - } - - IRemoteResource base = syncTree.getBase(); - if (base != null) { - config.setAncestorLabel(Policy.bind("MergeResource.commonFile", name)); //$NON-NLS-1$ - // config.setAncestorLabel(TeamUIPlugin.getResourceString("MergeResource.commonFile", new Object[] {name, common.getVersionName()} )); - } else { - config.setAncestorLabel(Policy.bind("MergeResource.noCommonFile")); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java deleted file mode 100644 index ccb6e6a4c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java +++ /dev/null @@ -1,470 +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; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.structuremergeviewer.DiffContainer; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.ICompareInput; -import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IViewSite; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Performs a catchup or release operation on an array of resources. - */ -public abstract class SyncCompareInput extends CompareEditorInput { - private IRemoteSyncElement[] trees; - private CatchupReleaseViewer catchupReleaseViewer; - private DiffNode diffRoot; - private Shell shell; - private IViewSite viewSite; - private int granularity; - - private ICompareInputChangeListener listener = new ICompareInputChangeListener() { - public void compareInputChanged(ICompareInput source) { - SyncCompareInput.this.compareInputChanged(source); - } - }; - - /** - * Subclasses may override but must call super. - */ - protected void compareInputChanged(ICompareInput source) { - catchupReleaseViewer.update(source, new String[] {CatchupReleaseViewer.PROP_KIND}); - updateStatusLine(); - } - - /** - * Creates a new catchup or release operation. - */ - public SyncCompareInput(int granularity) { - super(new CompareConfiguration()); - privateSetSyncGranularity(granularity); - } - - /** - * Creates a new catchup or release operation. - */ - public SyncCompareInput() { - this(ILocalSyncElement.GRANULARITY_TIMESTAMP); - } - - protected abstract IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException; - - /* - * @see CompareEditorInput#createContents - */ - public Control createContents(Composite parent) { - Control result = super.createContents(parent); - initialSelectionAndExpansionState(); - return result; - } - - /** - * Subclasses must create and return a new CatchupReleaseViewer, and set the viewer - * using setViewer(). - */ - public abstract Viewer createDiffViewer(Composite parent); - - /** - * Returns the root node of the diff tree. - */ - public DiffNode getDiffRoot() { - return diffRoot; - } - - /** - * Returns the first diff element that is still unresolved in the - * subtree rooted at the given root element. - * Returns null if everything is resolved. - */ - private IDiffElement getFirstChange(IDiffElement root) { - if (root instanceof ITeamNode) { - ITeamNode node = (ITeamNode)root; - if (node instanceof TeamFile) { - return node; - } - } - if (root instanceof IDiffContainer) { - IDiffElement[] children = ((IDiffContainer)root).getChildren(); - IDiffElement result = null; - for (int i = 0; i < children.length; i++) { - result = getFirstChange(children[i]); - if (result != null) { - return result; - } - } - } - return null; - } - - protected Shell getShell() { - return shell; - } - - /** - * Returns the name of this operation. - * It is dipslayed in the CompareEditor's title bar. - */ - public String getTitle() { - return Policy.bind("SyncCompareInput.synchronize"); //$NON-NLS-1$ - } - - /** - * Returns the compare viewer; - */ - public CatchupReleaseViewer getViewer() { - return catchupReleaseViewer; - } - - /** - * Returns the view site, or null if this is a merge. - */ - public IViewSite getViewSite() { - return viewSite; - } - - /** - * Returns true if the model has incoming or conflicting changes. - */ - boolean hasIncomingChanges() { - if (diffRoot == null) { - return false; - } - SyncSet set = new SyncSet(new StructuredSelection(diffRoot.getChildren())); - return set.hasIncomingChanges() || set.hasConflicts(); - } - - /** - * Set an appropriate initial selection and expansion state. - */ - private void initialSelectionAndExpansionState() { - // Select the next change - IDiffElement next = getFirstChange(diffRoot); - if (next != null) { - catchupReleaseViewer.setSelection(new StructuredSelection(next), true); - } else { - catchupReleaseViewer.collapseAll(); - catchupReleaseViewer.setSelection(new StructuredSelection()); - } - } - - /** - * Performs a compare on the given selection. - * This method is called before the CompareEditor has been opened. - * If the result of the diff is empty (or an error has occured) - * no CompareEditor is opened but an Alert is shown. - */ - public Object prepareInput(final IProgressMonitor pm) throws InterruptedException, InvocationTargetException { - if (pm.isCanceled()) { - throw new InterruptedException(); - } - - try { - pm.beginTask(Policy.bind("SyncCompareInput.taskTitle"), 100); //$NON-NLS-1$ - - // Estimate 70% of the time is creating the sync elements - this.trees = createSyncElements(Policy.subMonitorFor(pm, 70)); - setMessage(null); - if (trees.length == 0) { - return null; - } - final TeamException[] exceptions = new TeamException[1]; - - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - // collect changes and build the diff tree - diffRoot = new DiffNode(0); - try { - doServerDelta(monitor); - } catch (TeamException e) { - exceptions[0] = e; - } - } - }; - if (pm.isCanceled()) { - throw new InterruptedException(); - } - // Estimate 30% of the time is doing the server delta - ResourcesPlugin.getWorkspace().run(runnable, Policy.subMonitorFor(pm, 30)); - if (exceptions[0] != null) throw exceptions[0]; - if (pm.isCanceled()) { - throw new InterruptedException(); - } - - if (!diffRoot.hasChildren()) { - diffRoot = null; - } - - updateStatusLine(); - - return diffRoot; - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - - void doServerDelta(IProgressMonitor pm) throws TeamException { - pm.beginTask(null, trees.length * 1000); - pm.setTaskName(Policy.bind("SyncCompareInput.taskTitle")); //$NON-NLS-1$ - for (int i = 0; i < trees.length; i++) { - IRemoteSyncElement tree = trees[i]; - IProgressMonitor monitor = Policy.subMonitorFor(pm, 1000); - monitor.beginTask(null, 1000); - IDiffElement localRoot = collectResourceChanges(null, tree, monitor); - monitor.done(); - makeParents(localRoot); - } - } - - /* - * This method expects to be past a monitor that has already had it's beginTask invoked - * and has enough ticks to allow 1 unit of work per resource in the tree and an additional - * unit for each folder. - */ - protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) throws TeamException { - int type = tree.getSyncKind(getSyncGranularity(), Policy.subMonitorFor(pm, 1)); - MergeResource mergeResource = new MergeResource(tree); - - if (tree.isContainer()) { - IDiffContainer element = new ChangedTeamContainer(parent, mergeResource, type); - ILocalSyncElement[] children = tree.members(Policy.subMonitorFor(pm, 1)); - for (int i = 0; i < children.length; i++) { - collectResourceChanges(element, (IRemoteSyncElement)children[i], pm); - } - return element; - } else { - TeamFile file = new TeamFile(parent, mergeResource, type, shell); - file.addCompareInputChangeListener(listener); - return file; - } - } - - public int getSyncGranularity() { - return granularity; - } - - public void setSyncGranularity(int granularity) { - privateSetSyncGranularity(granularity); - refresh(); - } - - private void privateSetSyncGranularity(int granularity) { - this.granularity = granularity; - if (granularity != IRemoteSyncElement.GRANULARITY_TIMESTAMP) { - if (isIgnoreWhitespace()) { - this.granularity = IRemoteSyncElement.GRANULARITY_CONTENTS_IGNORE_WHITESPACE; - } else { - this.granularity = IRemoteSyncElement.GRANULARITY_CONTENTS; - } - } - } - - public void setIgnoreWhitespace(boolean ignore) { - // Set the ignore whitespace - Boolean value = ignore ? Boolean.TRUE : Boolean.FALSE; - getCompareConfiguration().setProperty(CompareConfiguration.IGNORE_WHITESPACE, value); - // Set the granularity (which queries the ignore whitespace setting) - privateSetSyncGranularity(getSyncGranularity()); - // Refresh if the granularity is file contents - if (granularity != IRemoteSyncElement.GRANULARITY_TIMESTAMP) { - refresh(); - } - } - - public boolean isIgnoreWhitespace() { - Object o = getCompareConfiguration().getProperty(CompareConfiguration.IGNORE_WHITESPACE); - if (o instanceof Boolean) { - return ((Boolean)o).booleanValue(); - } - return CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(CompareConfiguration.IGNORE_WHITESPACE); - } - - /** - * Builds a DiffFolder tree under the given root for the given resource. - */ - private DiffContainer buildPath(DiffContainer root, IContainer resource) { - DiffContainer parent = root; - if (resource.getType() == IResource.ROOT) { - return root; - } - if (resource.getType() != IResource.PROJECT) { - parent = buildPath(root, resource.getParent()); - } - - DiffContainer c = (DiffContainer)parent.findChild(resource.getName()); - if (c == null) { - c = new UnchangedTeamContainer(parent, resource); - } - return c; - } - - void makeParents(IDiffElement element) { - IContainer parent = ((ITeamNode)element).getResource().getParent(); - DiffContainer container = buildPath(diffRoot, parent); - container.add(element); - } - - /** - * Performs a refresh, with progress and cancelation. - */ - public void refresh() { - final Object[] input = new Object[1]; - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - input[0] = prepareInput(monitor); - } - }; - try { - run(op, Policy.bind("SyncCompareInput.refresh")); //$NON-NLS-1$ - } catch (InterruptedException e) { - return; - } - - catchupReleaseViewer.setInput(input[0]); - if (input[0] == null) { - MessageDialog.openInformation(shell, Policy.bind("nothingToSynchronize"), Policy.bind("SyncCompareInput.nothingText")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); - try { - dialog.run(true, true, op); - } catch (InvocationTargetException e) { - Throwable throwable = e.getTargetException(); - IStatus error = null; - if (throwable instanceof TeamException) { - error = ((TeamException)throwable).getStatus(); - } else if (throwable instanceof CoreException) { - error = ((CoreException)throwable).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$ - } - ErrorDialog.openError(shell, problemMessage, null, error); - TeamUIPlugin.log(error.getSeverity(), error.getMessage(), throwable); - // Throw an interrupted exception so we drop out of the sync - throw new InterruptedException(); - } - } - - public void setViewSite(IViewSite viewSite) { - this.viewSite = viewSite; - this.shell = viewSite.getShell(); - } - - public void setViewer(CatchupReleaseViewer viewer) { - this.catchupReleaseViewer = viewer; - } - - /** - * Updates the status line. - */ - public void updateStatusLine() { - if (viewSite != null && !shell.isDisposed()) { - Runnable update = new Runnable() { - public void run() { - if (!shell.isDisposed()) { - IStatusLineManager statusLine = viewSite.getActionBars().getStatusLineManager(); - if (diffRoot == null) { - statusLine.setMessage(null); - statusLine.setErrorMessage(null); - return; - } - SyncSet set = getSyncSet(new StructuredSelection(diffRoot.getChildren())); - if (set.hasConflicts()) { - statusLine.setMessage(null); - statusLine.setErrorMessage(set.getStatusLineMessage()); - } else { - statusLine.setErrorMessage(null); - statusLine.setMessage(set.getStatusLineMessage()); - } - viewSite.getActionBars().updateActionBars(); - } - } - }; - // Post or run the update - if (shell.getDisplay() != Display.getCurrent()) { - shell.getDisplay().asyncExec(update); - } else { - update.run(); - } - } - } - - protected SyncSet getSyncSet(IStructuredSelection selection) { - return new SyncSet(selection); - } - public boolean saveIfNecessary() { - if (! isSaveNeeded()) return true; - - final boolean[] result = new boolean[] { false }; - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - try { - result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("SyncView.saveTitle"),//$NON-NLS-1$ - Policy.bind("SyncView.saveMessage"));//$NON-NLS-1$ - if (result[0]) { - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - saveChanges(monitor); - } - }, new NullProgressMonitor()); - } - } catch (CoreException e) { - IStatus status = e.getStatus(); - ErrorDialog.openError(getShell(), status.getMessage(), Policy.bind("SyncView.errorSaving"), status);//$NON-NLS-1$ - result[0] = false; - } - } - }); - return result[0]; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java deleted file mode 100644 index 55808a083..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java +++ /dev/null @@ -1,288 +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; - - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.Policy; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * This class contains a set of resources that are slated to be - * synchronized. It performs various operations on the - * set in preparation for catchup/release. - */ -public class SyncSet { - private HashSet set; - - /** - * Creates a new sync set on the nodes in the given selection. - */ - public SyncSet(IStructuredSelection nodeSelection) { - this.set = new HashSet(nodeSelection.size() + 1); - collectNodes(nodeSelection); - } - - /** - * Collects all nodes to which this action will apply. This means - * all nodes in the selection, plus all their children. - */ - private void collectNodes(IStructuredSelection selection) { - Object[] nodes = selection.toArray(); - for (int i = 0; i < nodes.length; i++) { - recursivelyAdd((ITeamNode)nodes[i]); - } - } - - /** - * Adds all parent creations for the given node to the sync set. - */ - private void collectParentCreations(ITeamNode node) { - IDiffElement parent = node.getParent(); - if (parent != null && parent instanceof ITeamNode) { - if (parent.getKind() != IRemoteSyncElement.IN_SYNC) { - set.add(parent); - collectParentCreations((ITeamNode)parent); - } - } - } - - /** - * Returns all nodes in the set that have changes - */ - public ITeamNode[] getChangedNodes() { - ArrayList nodeList = new ArrayList(set.size()); - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - int dir = node.getChangeDirection(); - // We assume changed nodes of the wrong type have been culled - // during set creation. - if (dir != Differencer.NO_CHANGE) { - nodeList.add(node); - } - } - ITeamNode[] nodes = new ITeamNode[nodeList.size()]; - nodeList.toArray(nodes); - return nodes; - } - - /** - * Returns the resources from all the nodes in this set. - */ - public IResource[] getResources() { - ITeamNode[] changed = getChangedNodes(); - IResource[] resources = new IResource[changed.length]; - for (int i = 0; i < changed.length; i++) { - resources[i] = changed[i].getResource(); - } - return resources; - } - - /** - * Returns a message for the status line describing this sync set. - */ - public String getStatusLineMessage() { - int incoming = 0; - int outgoing = 0; - int conflicts = 0; - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode next = (ITeamNode)it.next(); - switch (next.getChangeDirection()) { - case IRemoteSyncElement.INCOMING: - incoming++; - break; - case IRemoteSyncElement.OUTGOING: - outgoing++; - break; - case IRemoteSyncElement.CONFLICTING: - conflicts++; - break; - } - } - StringBuffer result = new StringBuffer(); - - if (conflicts == 0) { - result.append(Policy.bind("SyncSet.noConflicts")); //$NON-NLS-1$ - } else { - result.append(Policy.bind("SyncSet.conflicts", new Object[] {Integer.toString(conflicts)} )); //$NON-NLS-1$ - } - if (incoming == 0) { - result.append(Policy.bind("SyncSet.noIncomings")); //$NON-NLS-1$ - } else { - result.append(Policy.bind("SyncSet.incomings", new Object[] {Integer.toString(incoming)} )); //$NON-NLS-1$ - } - if (outgoing == 0) { - result.append(Policy.bind("SyncSet.noOutgoings")); //$NON-NLS-1$ - } else { - result.append(Policy.bind("SyncSet.outgoings", new Object[] {Integer.toString(outgoing)} )); //$NON-NLS-1$ - } - return result.toString(); - } - - /** - * Returns true if there are any conflicting nodes in the set, and - * false otherwise. - */ - public boolean hasConflicts() { - for (Iterator it = set.iterator(); it.hasNext();) { - if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.CONFLICTING) { - return true; - } - } - return false; - } - - /** - * Returns true if this sync set has incoming changes. - * Note that conflicts are not considered to be incoming changes. - */ - public boolean hasIncomingChanges() { - for (Iterator it = set.iterator(); it.hasNext();) { - if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.INCOMING) { - return true; - } - } - return false; - } - - /** - * Returns true if this sync set has outgoing changes. - * Note that conflicts are not considered to be outgoing changes. - */ - public boolean hasOutgoingChanges() { - for (Iterator it = set.iterator(); it.hasNext();) { - if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.OUTGOING) { - return true; - } - } - return false; - } - - /** - * Returns true if this sync set has auto-mergeable conflicts. - */ - public boolean hasAutoMergeableConflicts() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if ((node.getKind() & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) { - return true; - } - } - return false; - } - - /** - * Adds the given node, plus all its children, to the given set. - */ - private void recursivelyAdd(ITeamNode node) { - // Add the node and recurse - if (set.add(node)) { - if (node instanceof IDiffContainer) { - IDiffElement[] children = ((IDiffContainer)node).getChildren(); - for (int i = 0; i < children.length; i++) { - if (children[i] instanceof ITeamNode) { - recursivelyAdd((ITeamNode)children[i]); - } - } - } - // Add any created parents (can't release or load a - // resource creation without including new parents) - collectParentCreations(node); - } - } - - /** - * Removes all conflicting nodes from this set. - */ - public void removeConflictingNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if (node.getChangeDirection() == IRemoteSyncElement.CONFLICTING) { - it.remove(); - } - } - } - /** - * Removes all outgoing nodes from this set. - */ - public void removeOutgoingNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if (node.getChangeDirection() == IRemoteSyncElement.OUTGOING) { - it.remove(); - } - } - } - /** - * Removes all incoming nodes from this set. - */ - public void removeIncomingNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if (node.getChangeDirection() == IRemoteSyncElement.INCOMING) { - it.remove(); - } - } - } - /** - * Removes all nodes from this set that are not auto-mergeable conflicts - */ - public void removeNonMergeableNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if ((node.getKind() & IRemoteSyncElement.MANUAL_CONFLICT) != 0) { - it.remove(); - } else if (node.getChangeDirection() != ITeamNode.CONFLICTING) { - it.remove(); - } - } - } - - /** - * Removes all nodes that aren't applicable for the direction. - */ - public void removeNonApplicableNodes(int direction) { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - int nodeDirection = node.getKind() & IRemoteSyncElement.DIRECTION_MASK; - if (nodeDirection != IRemoteSyncElement.CONFLICTING) { - if (nodeDirection != direction) { - it.remove(); - } - } - } - } - - /** - * Remove the given node from the sync set - */ - public void remove(ITeamNode node) { - set.remove(node); - } - - protected HashSet getSyncSet() { - return set; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java deleted file mode 100644 index af58d79ab..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java +++ /dev/null @@ -1,555 +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; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.IPropertyChangeNotifier; -import org.eclipse.compare.NavigationAction; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.ISaveablePart; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.part.IShowInSource; -import org.eclipse.ui.part.ShowInContext; -import org.eclipse.ui.part.ViewPart; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * This class provides a view for performing synchronizations - * between the local workspace and a repository. - */ -public class SyncView extends ViewPart implements ISaveablePart, IPropertyChangeListener { - public static final String VIEW_ID = "org.eclipse.team.ui.sync.SyncView"; //$NON-NLS-1$ - private SyncCompareInput input; - private Composite top; - - // The possible sync modes - public static final int SYNC_NONE = 0; - public static final int SYNC_INCOMING = 1; - public static final int SYNC_OUTGOING = 2; - public static final int SYNC_BOTH = 3; - public static final int SYNC_MERGE = 4; - public static final int SYNC_COMPARE = 5; - - // Titles cached for efficiency - private final String CATCHUP_TITLE = Policy.bind("SyncView.incomingModeTitle"); //$NON-NLS-1$ - private final String RELEASE_TITLE = Policy.bind("SyncView.outgoingModeTitle"); //$NON-NLS-1$ - private final String FREE_TITLE = Policy.bind("SyncView.freeModeTitle"); //$NON-NLS-1$ - - private int currentSyncMode = SYNC_NONE; - - private String viewTitle = ""; //$NON-NLS-1$ - - /** - * Action for toggling the sync mode. - */ - class SyncModeAction extends Action { - // The sync mode that this action enables - private int syncMode; - public SyncModeAction(String title, ImageDescriptor image, int mode) { - super(title, image); - this.syncMode = mode; - } - public void run() { - SyncView.this.setSyncMode(syncMode); - } - } - - private SyncModeAction incomingMode; - private SyncModeAction outgoingMode; - private SyncModeAction freeMode; - private NavigationAction next; - private NavigationAction previous; - - private class PartListener implements IPartListener { - public void partActivated(IWorkbenchPart part) { - } - public void partBroughtToTop(IWorkbenchPart part) { - } - public void partClosed(IWorkbenchPart part) { - } - public void partDeactivated(IWorkbenchPart part) { - if (part == SyncView.this && input != null) { - input.saveIfNecessary(); - } - } - public void partOpened(IWorkbenchPart part) { - } - } - - private IPartListener partListener; - - /** - * Creates a new view. - */ - public SyncView() { - super(); - } - - /* - * @see IWorkbenchPart#createPartControl - */ - public void createPartControl(Composite parent) { - top = new Composite(parent, SWT.NONE); - - //XXX Set the control data to be this part, so the compare - //frames that will eventually live in this widget hierarchy - //have some way to access the action bars for hooking global - //actions. See corresponding XXX comment in CompareEditor#findActionBars - top.setData(this); - - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - top.setLayout(layout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - showDefaultContents(); - - initializeSyncModes(); - // add part listener - partListener = new PartListener(); - getViewSite().getWorkbenchWindow().getPartService().addPartListener(partListener); - WorkbenchHelp.setHelp(top, IHelpContextIds.SYNC_VIEW); - } - - public void dispose() { - // remove part listener - if (partListener != null) { - getViewSite().getWorkbenchWindow().getPartService().removePartListener(partListener); - partListener = null; - } - - if (input instanceof IPropertyChangeNotifier) - ((IPropertyChangeNotifier)input).removePropertyChangeListener(this); - super.dispose(); - } - - /** - * Makes the sync view visible in the active page. If there isn't a sync - * view registered <code>null</code> is returned. Otherwise the opened view - * part is returned. - */ - public static SyncView findViewInActivePage(IWorkbenchPage activePage) { - try { - if (activePage == null) { - activePage = TeamUIPlugin.getActivePage(); - if (activePage == null) return null; - } - IViewPart part = activePage.findView(VIEW_ID); - if (part == null) - part = activePage.showView(VIEW_ID); - return (SyncView)part; - } catch (PartInitException pe) { - return null; - } - } - - /** - * Sets up the sync modes and the actions for switching between them. - */ - private void initializeSyncModes() { - // Create the actions - incomingMode = new SyncModeAction( - Policy.bind("SyncView.incomingModeAction"), //$NON-NLS-1$ - TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP_ENABLED), - SYNC_INCOMING); - incomingMode.setToolTipText(Policy.bind("SyncView.incomingModeToolTip")); //$NON-NLS-1$ - incomingMode.setChecked(false); - incomingMode.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP_DISABLED)); - incomingMode.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP)); - - outgoingMode = new SyncModeAction( - Policy.bind("SyncView.outgoingModeAction"), //$NON-NLS-1$ - TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_RELEASE_ENABLED), - SYNC_OUTGOING); - outgoingMode.setToolTipText(Policy.bind("SyncView.outgoingModeToolTip")); //$NON-NLS-1$ - outgoingMode.setChecked(false); - outgoingMode.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_RELEASE_DISABLED)); - outgoingMode.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_RELEASE)); - - freeMode = new SyncModeAction( - Policy.bind("SyncView.freeModeAction"), //$NON-NLS-1$ - TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE_ENABLED), - SYNC_BOTH); - freeMode.setToolTipText(Policy.bind("SyncView.freeModeToolTip")); //$NON-NLS-1$ - freeMode.setChecked(false); - freeMode.setDisabledImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE_DISABLED)); - freeMode.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE)); - - // Set up global actions for next and previous - next = new NavigationAction(true); - previous = new NavigationAction(false); - IActionBars actionBars = getViewSite().getActionBars(); - if (actionBars != null) { - actionBars.setGlobalActionHandler(IWorkbenchActionConstants.NEXT, next); - actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, previous); - actionBars.updateActionBars(); - } - } - - private boolean isEmpty(DiffNode node) { - if (node == null) return true; - if (node.getKind() != 0) return false; - IDiffElement[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; - } - return true; - } - private boolean isEmpty(IDiffElement element) { - if (element.getKind() != 0) return false; - if (element instanceof DiffNode) { - IDiffElement[] children = ((DiffNode)element).getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; - } - } - return true; - } - - /** - * Runs an operation and handles progress and exceptions. Returns true - * if the operation was successful, and false if there were errors or - * the user canceled. - */ - private boolean run(IRunnableWithProgress op) { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(getSite().getShell()); - try { - dialog.run(true, true, op); - return true; - } catch (InvocationTargetException e) { - Throwable throwable = e.getTargetException(); - IStatus error = null; - if (throwable instanceof TeamException) { - error = ((TeamException)throwable).getStatus(); - } else if (throwable instanceof CoreException) { - error = ((CoreException)throwable).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal"), throwable); //$NON-NLS-1$ - } - ErrorDialog.openError(getSite().getShell(), Policy.bind("SyncView.unableSynchronize"), null, error); //$NON-NLS-1$ - TeamUIPlugin.log(error.getSeverity(), error.getMessage(), throwable); - } catch (InterruptedException e) { - } - return false; - } - - /** - * Asks the part to take focus within the workbench. - */ - public void setFocus() { - if (top != null && !top.isDisposed()) { - top.setFocus(); - } - } - - /** - * Activates the given sync mode. - */ - void setSyncMode(int mode) { - // Implement radio button behaviour - switch (mode) { - case SYNC_INCOMING: - incomingMode.setChecked(true); - outgoingMode.setChecked(false); - freeMode.setChecked(false); - setTitleWithDirtyIndicator(CATCHUP_TITLE); - break; - case SYNC_OUTGOING: - outgoingMode.setChecked(true); - incomingMode.setChecked(false); - freeMode.setChecked(false); - setTitleWithDirtyIndicator(RELEASE_TITLE); - break; - case SYNC_BOTH: - freeMode.setChecked(true); - outgoingMode.setChecked(false); - incomingMode.setChecked(false); - setTitleWithDirtyIndicator(FREE_TITLE); - break; - } - // Only update actions if there is valid input - if (input != null && input.getDiffRoot() != null && mode != currentSyncMode) { - currentSyncMode = mode; - input.getViewer().syncModeChanged(mode); - updateActions(); - } - } - - /** - * Shows default contents for the view if there is nothing to synchronize. - */ - private void showDefaultContents() { - Label label = new Label(top, SWT.WRAP); - label.setLayoutData(new GridData(GridData.FILL_BOTH)); - label.setText(Policy.bind("SyncView.text")); //$NON-NLS-1$ - } - - /** - * Shows synchronization information for the given resources in the sync view. - * @deprecated - */ - public void showSync(SyncCompareInput input) { - showSync(input, null); - } - - /** - * Shows synchronization information for the given resources in the sync - * view. - * @param input the diff tree to be displayed - * @param page the page on which to open the sync view - */ - public void showSync(SyncCompareInput input, IWorkbenchPage page) { - next.setCompareEditorInput(input); - previous.setCompareEditorInput(input); - IActionBars actionBars = getViewSite().getActionBars(); - actionBars.updateActionBars(); - - input.setViewSite(getViewSite()); - this.input = input; - currentSyncMode = SYNC_NONE; - - // listen to property notifications from our input, this - // is to support global save enablement. - if (input instanceof IPropertyChangeNotifier) - ((IPropertyChangeNotifier)input).addPropertyChangeListener(this); - - // Remove old viewer - Control[] oldChildren = top.getChildren(); - if (oldChildren != null) { - for (int i = 0; i < oldChildren.length; i++) { - oldChildren[i].dispose(); - } - } - // Remove actions from toolbar - IActionBars bars = getViewSite().getActionBars(); - bars.getToolBarManager().removeAll(); - bars.getToolBarManager().update(false); - bars.getMenuManager().removeAll(); - bars.getMenuManager().update(); - bars.updateActionBars(); - - // Display the default contents while running the diff - showDefaultContents(); - top.layout(); - - // Run the diff and stop if cancel or error occurred. - if (!run(input)) return; - - // Check for problem message - if (input.getMessage() != null) { - MessageDialog.openInformation(getSite().getShell(), Policy.bind("SyncView.unableSynchronize"), input.getMessage()); //$NON-NLS-1$ - return; - } - - // Check for empty comparison - if (isEmpty(input.getDiffRoot())) { - MessageDialog.openInformation(getSite().getShell(), Policy.bind("nothingToSynchronize"), Policy.bind("SyncView.same")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - // Remove the default contents - oldChildren = top.getChildren(); - if (oldChildren != null) { - for (int i = 0; i < oldChildren.length; i++) { - oldChildren[i].dispose(); - } - } - - // Show the result - Control control = input.createContents(top); - control.setLayoutData(new GridData(GridData.FILL_BOTH)); - /*TreeViewer viewer = input.getViewer(); - if (viewer != null) { - Control viewerControl = viewer.getControl(); - if (viewerControl != null && !viewerControl.isDisposed()) { - WorkbenchHelp.setHelp(viewerControl, new ViewContextComputer(this, ITeamHelpContextIds.SYNC_VIEW)); - } - }*/ - - top.layout(); - - // Set the sync mode depending on user preference - //if (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING)) { - // freeMode.run(); - //} else { - if (input.hasIncomingChanges()) { - incomingMode.run(); - } else { - outgoingMode.run(); - } - //} - // Reveal if fast view - try { - if (page == null) page = TeamUIPlugin.getActivePage(); - if (page != null) page.showView(VIEW_ID); - } catch (PartInitException e) { - TeamUIPlugin.log(e); - } - } - - /** - * Updates the actions for this view's action bar. - */ - private void updateActions() { - IActionBars bars = getViewSite().getActionBars(); - IToolBarManager toolBar = bars.getToolBarManager(); - IMenuManager menu = bars.getMenuManager(); - toolBar.removeAll(); - menu.removeAll(); - - toolBar.add(incomingMode); - toolBar.add(outgoingMode); - toolBar.add(freeMode); - input.getViewer().contributeToActionBars(bars); - - toolBar.update(false); - menu.update(false); - bars.updateActionBars(); - } - - /** - * @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() { - if (input == null || input.getViewer() == null) return null; - return new ShowInContext(null, input.getViewer().getSelection()); - } - }; - } - return super.getAdapter(key); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ - public void doSave(IProgressMonitor monitor) { - - WorkspaceModifyOperation operation= new WorkspaceModifyOperation() { - public void execute(IProgressMonitor pm) throws CoreException { - if (input instanceof CompareEditorInput) - ((CompareEditorInput)input).saveChanges(pm); - } - }; - - Shell shell= getSite().getShell(); - - try { - - operation.run(monitor); - - firePropertyChange(PROP_DIRTY); - - } catch (InterruptedException x) { - } catch (OperationCanceledException x) { - } catch (InvocationTargetException x) { - String reason= x.getTargetException().getMessage(); - ErrorDialog.openError(getSite().getShell(), Policy.bind("SyncView.cantSaveError", reason), null, null); //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#doSaveAs() - */ - public void doSaveAs() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#isDirty() - */ - public boolean isDirty() { - if (input instanceof CompareEditorInput) - return ((CompareEditorInput)input).isSaveNeeded(); - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed() - */ - public boolean isSaveAsAllowed() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded() - */ - public boolean isSaveOnCloseNeeded() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (isDirty()) { - firePropertyChange(PROP_DIRTY); - } - setTitleWithDirtyIndicator(null); - } - - private void setTitleWithDirtyIndicator(String title) { - if(title != null) { - viewTitle = title; - } - if(isDirty()) { - setTitle(Policy.bind("SyncView.dirtyIndicatorInTitle", viewTitle)); //$NON-NLS-1$ - } else { - setTitle(viewTitle); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java deleted file mode 100644 index 53e84d37f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java +++ /dev/null @@ -1,393 +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; - - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.structuremergeviewer.DiffElement; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.ICompareInput; -import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.util.ListenerList; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.TeamPlugin; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A sync node for a version-controlled file, where the left - * side is the local file, the right side is the remote file, - * and the ancestor is the common file. - */ -public class TeamFile extends DiffElement implements ICompareInput, ITeamNode, IAdaptable { - - private MergeResource mergeResource; - - private Shell shell; - private ListenerList listeners; - - private TypedBufferedContent localByteContents; - private TypedBufferedContent commonByteContents; - private TypedBufferedContent remoteByteContents; - - boolean hasBeenSaved = false; - - private IProgressMonitor monitor; - - /** - * Creates a new file node. - */ - public TeamFile(IDiffContainer parent, MergeResource res, int changeType, Shell shell) { - super(parent, changeType); - Assert.isNotNull(res); - this.mergeResource = res; - this.shell = shell; - - commonByteContents = new TypedBufferedContent(this, false) { - public InputStream createStream() throws CoreException { - return mergeResource.getBaseRevision(); - } - }; - remoteByteContents = new TypedBufferedContent(this, false) { - protected InputStream createStream() throws CoreException { - return mergeResource.getLatestRevision(); - } - }; - - if(getResource().exists()) { - localByteContents = getLocalTypedContent(); - } else { - localByteContents = null; - } - } - - public void addCompareInputChangeListener(ICompareInputChangeListener l) { - if (listeners == null) { - listeners = new ListenerList(); - } - listeners.add(l); - } - - /* - * @see ICompareInput#copy(boolean) - */ - public void copy(boolean leftToRight) { - if (leftToRight) return; - ITypedElement right = getRight(); - ITypedElement left = getLeft(); - try { - if (left == null) { - // Addition - saveChanges(new ByteArrayInputStream(new byte[0])); - localByteContents = getLocalTypedContent(); - } else { - // deletion - saveChanges(null); - localByteContents = null; - } - } catch(CoreException e) { - TeamPlugin.log(e); - } - } - - public boolean equals(Object other) { - if (other != null && other.getClass() == getClass()) { - TeamFile file = (TeamFile) other; - return mergeResource.equals(file.mergeResource); - } - return super.equals(other); - } - - /* - * @see ICompareInput#getAncestor - */ - public ITypedElement getAncestor() { - if (mergeResource.hasBaseRevision()) { - return commonByteContents; - } - return null; - } - - /* - * Method declared on ITeamNode. - */ - public int getChangeDirection() { - return getKind() & Differencer.DIRECTION_MASK; - } - - /* - * @see ITeamNode#getChangeType() - */ - public int getChangeType() { - return getKind() & Differencer.CHANGE_TYPE_MASK; - } - - /* - * @see ITypedInput#getType - */ - public Image getImage() { - return CompareUI.getImage(getType()); - } - - /* - * @see ICompareInput#getLeft - */ - public ITypedElement getLeft() { - return localByteContents; - } - - /* - * @see ITypedInput#getName - */ - public String getName() { - if(hasBeenSaved) { - return Policy.bind("TeamFile.modified", mergeResource.getName()); //$NON-NLS-1$ - } else { - return mergeResource.getName(); - } - } - - /* - * @see ICompareInput#getRight - */ - public ITypedElement getRight() { - if (mergeResource.hasLatestRevision()) { - return remoteByteContents; - } else { - return null; - } - } - - /* - * @see ITypedInput#getType - */ - public String getType() { - return mergeResource.getExtension(); - } - - /* - * @see ICompareInput#removeCompareInputChangeListener(ICompareInputChangeListener) - */ - public void removeCompareInputChangeListener(ICompareInputChangeListener listener) { - if (listeners != null) { - listeners.remove(listener); - } - } - - /* - * @see Object - */ - public int hashCode() { - return mergeResource.hashCode(); - } - - /** - * Returns the team resource managed by this object. - * Guaranteed to be non-null. - */ - public MergeResource getMergeResource() { - return mergeResource; - } - - /** - * Returns the core resource managed by this object. - * Guaranteed to be non-null. - */ - public IResource getResource() { - return mergeResource.getResource(); - } - - /** - * For debugging purposes only. - */ - public String toString() { - return "TeamFile(" + mergeResource.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected TypedBufferedContent getLocalTypedContent() { - // don't allow editing of outgoing deletion content. To revert from the deletion the - // user should use the appropriate sync view action. - boolean outgoingDeletion = getChangeDirection() == IRemoteSyncElement.OUTGOING && getChangeType() == IRemoteSyncElement.DELETION; - final String name = getName(); - return new TypedBufferedContent(this, !outgoingDeletion) { - protected InputStream createStream() throws CoreException { - return mergeResource.getLocalStream(); - } - public void setContent(byte[] contents) { - try { - if(contents==null) { - saveChanges(new ByteArrayInputStream(new byte[0])); - } else { - saveChanges(new ByteArrayInputStream(contents)); - } - } catch(CoreException e) { - ErrorDialog.openError(TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("TeamFile.saveChanges", name), null, e.getStatus()); //$NON-NLS-1$ - } - Display.getDefault().syncExec(new Runnable() { - public void run() { - fireContentChanged(); - } - }); - } - public ITypedElement replace(ITypedElement child, ITypedElement other) { - return null; - } - }; - } - - /** - * The local resource has beed modified (i.e. merged). - */ - public void merged() { - // calculate the new sync state based on the type of change that was merged. This - // logic cannot be in the IRemoteSyncElement because there is no way to update the - // base before calling getSyncKind() again. - if(getChangeDirection()==INCOMING) { - switch(getChangeType()) { - case Differencer.ADDITION: - case Differencer.CHANGE: - setKind(OUTGOING | Differencer.CHANGE); - break; - case Differencer.DELETION: - setKind(CONFLICTING | Differencer.CHANGE); - } - } else { - setKind(OUTGOING | (getKind() & Differencer.CHANGE_TYPE_MASK)); - } - hasBeenSaved = false; - } - - public void setProgressMonitor(IProgressMonitor monitor) { - this.monitor = monitor; - } - - private void saveChanges(final InputStream is) throws CoreException { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IFile file = (IFile) getResource(); - if (is != null) { - if (!file.exists()) { - createParents(getParent(), getResource().getParent()); - file.create(is, false, monitor); - } else { - file.setContents(is, false, true, monitor); - } - } else { - file.delete(false, true, monitor); - deleteParents(getParent(), getResource().getParent()); - } - hasBeenSaved = true; - - // update the UI with the sync state change. - fireThreeWayInputChange(); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - }); - } - - private void createParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException { - if(!parentFolder.exists() && parentFolder.getType() != IResource.PROJECT) { - createParents(parentNode.getParent(), parentFolder.getParent()); - ((IFolder)parentFolder).create(false /* force */, true, null); - if(parentNode instanceof ChangedTeamContainer) { - ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC); - } - } - } - - private void deleteParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException { - if(parentFolder.members().length == 0 && parentFolder.getType() != IResource.PROJECT) { - IContainer parent = parentFolder.getParent(); - parentFolder.delete(false, null); - if(parentNode instanceof ChangedTeamContainer) { - ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC); - } - deleteParents(parentNode.getParent(), parent); - } - } - - private void run(IRunnableWithProgress runnable) throws CoreException { - try { - if(monitor == null) { - new ProgressMonitorDialog(shell).run(false, false, runnable); - } else { - runnable.run(monitor); - } - } catch (InvocationTargetException e) { - if (e.getTargetException() instanceof CoreException) { - throw (CoreException)e.getTargetException(); - } else { - throw new CoreException(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, Policy.bind("simpleInternal"), e.getTargetException())); //$NON-NLS-1$ - } - } catch (InterruptedException e) { - // Ignore - } - } - - private void fireThreeWayInputChange() { - Display.getDefault().syncExec(new Runnable() { - public void run() { - if (listeners != null) { - Object[] listenerArray = listeners.getListeners(); - // Iterate backwards so that the model gets updated last - // it might want to remove the node completely, which might - // upset other listeners. - for (int i = listenerArray.length; --i >= 0;) - ((ICompareInputChangeListener) listenerArray[i]).compareInputChanged(TeamFile.this); - } - } - }); - } - - public boolean hasBeenSaved() { - return hasBeenSaved; - } - - /** - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - if (adapter == IResource.class) - return mergeResource.getResource(); - return null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java deleted file mode 100644 index f891b81b0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java +++ /dev/null @@ -1,77 +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; - - -import org.eclipse.compare.BufferedContent; -import org.eclipse.compare.IEditableContent; -import org.eclipse.compare.ITypedElement; -import org.eclipse.swt.graphics.Image; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A content buffer for resources on a server. - */ -abstract class TypedBufferedContent extends BufferedContent implements ITypedElement, IEditableContent { - private ITeamNode node; - private boolean editable; - - /** - * Creates a new content buffer for the given team node. - */ - TypedBufferedContent(ITeamNode node, boolean editable) { - this.node = node; - this.editable = editable; - } - - public Image getImage() { - return node.getImage(); - } - - public String getName() { - return node.getName(); - } - - public String getType() { - return node.getType(); - } - - /** - * Returns true if this object can be modified. - * If it returns <code>false</code> the other methods must not be called. - * - * @return <code>true</code> if this object can be modified. - */ - public boolean isEditable() { - return editable; - } - - /** - * This is not the definitive API! - * This method is called on a parent to - * - add a child, - * - remove a child, - * - copy the contents of a child - * - * What to do is encoded in the two arguments as follows: - * add: child == null other != null - * remove: child != null other == null - * copy: child != null other != null - */ - public ITypedElement replace(ITypedElement child, ITypedElement other) { - return null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java deleted file mode 100644 index 3b6a7a8de..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java +++ /dev/null @@ -1,78 +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; - - -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.ResourceNode; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.swt.graphics.Image; - -/** - * <b>Note:</b> This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A node in a diff tree that represents a folder with no changes - * to itself, it is only a placeholder for changes in its children. - */ -public class UnchangedTeamContainer extends DiffNode implements ITeamNode { - private IResource resource; - - public UnchangedTeamContainer(IDiffContainer parent, IResource resource) { - this(parent, resource, Differencer.NO_CHANGE); - } - - public UnchangedTeamContainer(IDiffContainer parent, IResource resource, int description) { - super(parent, description); - setLeft(new ResourceNode(resource)); - this.resource = resource; - } - - /* - * Method declared on ITeamNode - */ - public int getChangeDirection() { - return ITeamNode.NO_CHANGE; - } - - /* - * @see ITeamNode#getChangeType() - */ - public int getChangeType() { - return ITeamNode.NO_CHANGE; - } - - public Image getImage() { - return CompareUI.getImage(getType()); - } - - public String getName() { - return resource.getName(); - } - - /** - * Returns the resource underlying this diff node. - */ - public IResource getResource() { - return resource; - } - - public String getType() { - return ITypedElement.FOLDER_TYPE; - } -} 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 3f48529ab..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.sync.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.team.core.subscribers.TeamSubscriber; -import org.eclipse.team.internal.ui.Utils; - -class CancelSubscription extends Action { - private TeamSubscriber subscriber; - - public CancelSubscription(TeamSubscriber s) { - this.subscriber = s; - Utils.initAction(this, "action.cancelSubscriber."); //$NON-NLS-1$ - // don't enable until necessary - setEnabled(false); - } - - public void run() { - subscriber.cancel(); - } - - 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>Preferences>Java>Code Generation>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 a90c54e38..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ChooseSubscriberAction.java +++ /dev/null @@ -1,28 +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; - -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$ - } -}
\ No newline at end of file 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/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java deleted file mode 100644 index 546439888..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java +++ /dev/null @@ -1,152 +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.compare.CompareEditorInput; -import org.eclipse.compare.CompareUI; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.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.SyncInfo; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.ui.Policy; -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.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IReusableEditor; -import org.eclipse.ui.IWorkbenchPage; - -/** - * Opens a compare editor on a selected SyncInfo object - */ -public class OpenInCompareAction extends Action { - - private SynchronizeView viewer; - - public OpenInCompareAction(SynchronizeView viewer) { - this.viewer = viewer; - Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$ - } - - public void run() { - openEditor(); - } - - private void openEditor() { - CompareEditorInput input = getCompareInput(); - if(input != null) { - prefetchFileContents(); - IEditorPart editor = reuseCompareEditor((SyncInfoCompareInput)input); - if(editor != null && editor instanceof IReusableEditor) { - CompareUI.openCompareEditor(input); - // should be enabled once Bug 38770 is fixed - //((IReusableEditor)editor).setInput(input); - } else { - CompareUI.openCompareEditor(input); - } - // This could be a user preference. - //SynchronizeView.showInActivePage(viewer.getSite().getPage()); - } - } - - /* - * Prefetching the file contents will cache them for use by the compare editor - */ - private void prefetchFileContents() { - ISelection selection = viewer.getViewer().getSelection(); - Object obj = ((IStructuredSelection)selection).getFirstElement(); - SyncInfo info = getSyncInfo(obj); - final IRemoteResource remote = info.getRemote(); - final IRemoteResource base = info.getBase(); - if (remote != null || base != null) { - viewer.run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(null, (remote == null ? 0 : 100) + (base == null ? 0 : 100)); - if (remote != null) - remote.getContents(Policy.subMonitorFor(monitor, 100)); - if (base != null) - base.getContents(Policy.subMonitorFor(monitor, 100)); - monitor.done(); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - }); - } - } - - private CompareEditorInput getCompareInput() { - ISelection selection = viewer.getViewer().getSelection(); - Object obj = ((IStructuredSelection)selection).getFirstElement(); - SyncInfo info = getSyncInfo(obj); - if (info != null && info.getLocal() instanceof IFile) { - return new SyncInfoCompareInput(info); - } - return null; - } - - private SyncInfo getSyncInfo(Object obj) { - return (SyncInfo)TeamAction.getAdapter(obj, SyncInfo.class); - } - - private IEditorPart reuseCompareEditor(SyncInfoCompareInput input) { - IWorkbenchPage page = viewer.getSite().getPage(); - IEditorReference[] editorRefs = page.getEditorReferences(); - - IEditorPart editor = page.findEditor(input); - if(editor == null) { - for (int i = 0; i < editorRefs.length; i++) { - IEditorPart part = editorRefs[i].getEditor(true); - if(part != null && part.getEditorInput() instanceof SyncInfoCompareInput) { - if(! part.isDirty()) { - // should be removed once Bug 38770 is fixed - page.closeEditor(part, true /*save changes if required */); - } - } - } - } - return editor; - } - - public static void closeCompareEditorFor(final SynchronizeView viewer, final IResource resource) { - viewer.getSite().getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - IWorkbenchPage page = viewer.getSite().getPage(); - IEditorReference[] editorRefs = page.getEditorReferences(); - - for (int i = 0; i < editorRefs.length; i++) { - final IEditorPart part = editorRefs[i].getEditor(false /* don't restore editor */); - if(part != null) { - IEditorInput input = part.getEditorInput(); - if(part != null && input instanceof SyncInfoCompareInput) { - SyncInfo inputInfo = ((SyncInfoCompareInput)input).getSyncInfo(); - if(inputInfo.getLocal().equals(resource)) { - page.closeEditor(part, true /*save changes if required */); - } - } - } - } - } - }); - } -}
\ No newline at end of file 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/sync/actions/OpenWithActionGroup.java deleted file mode 100644 index 2883bb9f1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenWithActionGroup.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.sync.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.ui.actions.OpenWithMenu; -import org.eclipse.ui.views.navigator.ResourceNavigatorMessages; - -/** - * This is the action group for the open actions. - */ -public class OpenWithActionGroup extends SyncViewerActionGroup { - - private OpenFileAction openFileAction; - private OpenInCompareAction openInCompareAction; - - public OpenWithActionGroup(SynchronizeView viewer) { - super(viewer); - makeActions(); - } - - protected void makeActions() { - openFileAction = new OpenFileAction(getSyncView().getSite().getPage()); - openInCompareAction = new OpenInCompareAction(getSyncView()); - } - - public void fillContextMenu(IMenuManager menu) { - ActionContext context = getContext(); - IStructuredSelection selection = null; - if (context != null) { - selection = (IStructuredSelection) context.getSelection(); - } - fillOpenWithMenu(menu, selection); - } - - /** - * Adds the OpenWith submenu to the context menu. - * - * @param menu the context menu - * @param selection the current selection - */ - private void fillOpenWithMenu(IMenuManager menu, IStructuredSelection selection) { - - // Only supported if exactly one file is selected. - if (selection == null || selection.size() != 1) - return; - Object element = selection.getFirstElement(); - IResource resource = getResource(element); - if (!(resource instanceof IFile)) { - return; - } - if(!((resource.exists()))) { - return; - } - - menu.add(openInCompareAction); - - openFileAction.selectionChanged(selection); - menu.add(openFileAction); - - MenuManager submenu = - new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.openWith")); //$NON-NLS-1$ - submenu.add(new OpenWithMenu(getSyncView().getSite().getPage(), (IFile) resource)); - menu.add(submenu); - } - - /** - * Runs the default action (open file). - */ - public void runDefaultAction(IStructuredSelection selection) { - Object element = selection.getFirstElement(); - if (element instanceof IFile) { - openFileAction.selectionChanged(selection); - openFileAction.run(); - } - } - - private IResource getResource(Object obj) { - return (IResource)TeamAction.getAdapter(obj, IResource.class); - } - - public void openInCompareEditor() { - openInCompareAction.run(); - } -}
\ No newline at end of file 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/sync/actions/RefreshAction.java deleted file mode 100644 index fc6021ab5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java +++ /dev/null @@ -1,91 +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.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -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.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.jobs.RefreshSubscriberJob; -import org.eclipse.team.internal.ui.sync.sets.SubscriberInput; -import org.eclipse.team.internal.ui.sync.views.SynchronizeView; -import org.eclipse.ui.actions.ActionContext; - -public class RefreshAction extends Action { - private final SyncViewerActions actions; - private boolean refreshAll; - - public RefreshAction(SyncViewerActions actions, boolean refreshAll) { - 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()); - if (refreshAll || resources.length == 0) { - // If no resources are selected, refresh all the subscriber roots - resources = input.workingSetRoots(); - } - run(view, resources, input.getSubscriber()); - } - } - - private IResource[] getResources(ISelection selection) { - if(selection == null) { - return new IResource[0]; - } - return (IResource[])TeamAction.getSelectedAdaptables(selection, IResource.class); - } - - public static void run(SynchronizeView viewer, IResource[] resources, TeamSubscriber subscriber) { - // 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()), resources, subscriber); //$NON-NLS-1$ - job.schedule(); - } else { - runBlocking(viewer, subscriber, resources); - } - } - - private static void runBlocking(SynchronizeView viewer, final TeamSubscriber s, final IResource[] resources) { - viewer.run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(null, 100); - s.refresh(resources, IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100)); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }); - } -}
\ No newline at end of file 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 d2eabec69..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java +++ /dev/null @@ -1,36 +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.team.ui.sync.ISynchronizeView; -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() == ISynchronizeView.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 49e89c9bd..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java +++ /dev/null @@ -1,136 +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.TeamProvider; -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 = TeamProvider.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 907cb5f9d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java +++ /dev/null @@ -1,289 +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.IAction; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -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.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.IKeyBindingService; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.IWorkbenchActionConstants; -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; - - // other view actions - private Action collapseAll; - private Action refreshSelectionAction; - private Action toggleViewerType; - private Action refreshViewContents; - private ExpandAllAction expandAll; - private SelectAllAction selectAllAction; - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionGroup#updateActionBars() - */ - public void updateActionBars() { - super.updateActionBars(); - changeFilters.updateActionBars(); - directionsFilters.updateActionBars(); - comparisonCriteria.updateActionBars(); - subscriberInputs.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); - - IKeyBindingService kbs = getSyncView().getSite().getKeyBindingService(); - IAction a= new Action() { - public void run() { - getSyncView().gotoDifference(INavigableControl.NEXT); - } - }; - Utils.initAction(a, "action.selectNextChange."); //$NON-NLS-1$ - Utils.registerAction(kbs, a, "org.eclipse.team.ui.syncview.selectNextChange"); //$NON-NLS-1$ - getSyncView().getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.NEXT, a); - - a= new Action() { - public void run() { - getSyncView().gotoDifference(INavigableControl.PREVIOUS); - } - }; - Utils.initAction(a, "action.selectPreviousChange."); //$NON-NLS-1$ - Utils.registerAction(kbs, a, "org.eclipse.team.ui.syncview.selectPreviousChange"); //$NON-NLS-1$ - getSyncView().getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, a); - - 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$ - - - toggleViewerType = new ToggleViewAction(getSyncView(), getSyncView().getCurrentViewType()); - - 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()); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) - */ - public void fillActionBars(IActionBars actionBars) { - super.fillActionBars(actionBars); - - IToolBarManager manager = actionBars.getToolBarManager(); - manager.add(chooseSubscriberAction); - manager.add(new Separator()); - directionsFilters.fillActionBars(actionBars); - manager.add(new Separator()); - manager.add(chooseChangeFilterAction); - manager.add(collapseAll); - manager.add(toggleViewerType); - - IMenuManager dropDownMenu = actionBars.getMenuManager(); - workingSetGroup.fillActionBars(actionBars); - dropDownMenu.add(refreshViewContents); - dropDownMenu.add(new Separator()); - dropDownMenu.add(new SyncViewerShowPreferencesAction(getSyncView().getSite().getShell())); - } - - /* (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()); - 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); - toggleViewerType.setEnabled(input != null); - chooseSubscriberAction.setEnabled(input != null); - chooseChangeFilterAction.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) { - PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(workingSet); - workingSetGroup.setWorkingSet(workingSet); - } -}
\ 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 fc79110a4..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java +++ /dev/null @@ -1,234 +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.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}; - - 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; - - /** - * 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.setChecked(! DirectionFilterAction.this.isChecked()); - DirectionFilterAction.this.run(); - } - }; - IKeyBindingService kbs = refreshGroup.getSyncView().getSite().getKeyBindingService(); - Utils.registerAction(kbs, a, commandId); //$NON-NLS-1$ - } - public void run() { - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_SELECTED_MODE, modeId); - updateFilter(this); - } - public int[] getFilter() { - return syncMode; - } - } - - 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}, 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}, 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}, 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}, 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 INCOMING_MODE: incomingMode.setChecked(true); break; - case CONFLICTING_MODE: conflictsMode.setChecked(true); break; - case BOTH_MODE: bothMode.setChecked(true); break; - case 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); - } - } -}
\ 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/sync/actions/SyncViewerShowPreferencesAction.java deleted file mode 100644 index b7aa99a9c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerShowPreferencesAction.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.jface.dialogs.Dialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog; -import org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage; - -public class SyncViewerShowPreferencesAction extends Action { - private final Shell shell; - - public SyncViewerShowPreferencesAction(Shell shell) { - this.shell = shell; - Utils.initAction(this, "action.syncViewPreferences."); //$NON-NLS-1$ - } - - public void run() { - PreferencePage page = new SyncViewerPreferencePage(); - Dialog dialog = new PreferencePageContainerDialog(shell, page); - dialog.setBlockOnOpen(true); - dialog.open(); - } -} 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 a3f145eb3..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(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 d60f9ad3e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ToggleViewAction.java +++ /dev/null @@ -1,53 +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.Utils; -import org.eclipse.team.internal.ui.sync.views.SynchronizeView; -import org.eclipse.ui.IKeyBindingService; -import org.eclipse.ui.IPropertyListener; - -class ToggleViewAction extends Action implements IPropertyListener { - private SynchronizeView viewer; - - public ToggleViewAction(SynchronizeView viewer, int initialState) { - this.viewer = viewer; - Utils.initAction(this, "action.toggleView."); //$NON-NLS-1$ - Action a = new Action() { - public void run() { - ToggleViewAction.this.setChecked(! ToggleViewAction.this.isChecked()); - ToggleViewAction.this.run(); - } - }; - IKeyBindingService kbs = viewer.getSite().getKeyBindingService(); - Utils.registerAction(kbs, a, "org.eclipse.team.ui.syncview.toggleView"); //$NON-NLS-1$ - - setChecked(initialState == SynchronizeView.TREE_VIEW); - viewer.addPropertyListener(this); - } - - public void run() { - int viewerType; - if(isChecked()) { - viewerType = SynchronizeView.TREE_VIEW; - } else { - viewerType = SynchronizeView.TABLE_VIEW; - } - viewer.switchViewerType(viewerType); - } - - public void propertyChanged(Object source, int propId) { - if(propId == SynchronizeView.PROP_VIEWTYPE) { - setChecked(viewer.getCurrentViewType() == SynchronizeView.TREE_VIEW); - } - } -}
\ No newline at end of file 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/sync/compare/LocalResourceTypedElement.java deleted file mode 100644 index 4cc20e5c4..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/LocalResourceTypedElement.java +++ /dev/null @@ -1,154 +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.compare; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.compare.IEditableContent; -import org.eclipse.compare.IStreamContentAccessor; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.ResourceNode; -import org.eclipse.compare.internal.BufferedResourceNode; -import org.eclipse.compare.structuremergeviewer.IStructureComparator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * LocalResourceTypedElement - */ -public class LocalResourceTypedElement extends ResourceNode { - - private boolean fDirty= false; - private IFile fDeleteFile; - - /** - * Creates a <code>ResourceNode</code> for the given resource. - * - * @param resource the resource - */ - public LocalResourceTypedElement(IResource resource) { - super(resource); - } - - protected IStructureComparator createChild(IResource child) { - return new LocalResourceTypedElement(child); - } - - public void setContent(byte[] contents) { - fDirty= true; - super.setContent(contents); - } - - /** - * Commits buffered contents to resource. - */ - public void commit(IProgressMonitor pm) throws CoreException { - if (fDirty) { - - if (fDeleteFile != null) { - fDeleteFile.delete(true, true, pm); - return; - } - - IResource resource= getResource(); - if (resource instanceof IFile) { - ByteArrayInputStream is= new ByteArrayInputStream(getContent()); - try { - IFile file= (IFile) resource; - if (file.exists()) - file.setContents(is, false, true, pm); - else - file.create(is, false, pm); - fDirty= false; - } finally { - if (is != null) - try { - is.close(); - } catch(IOException ex) { - } - } - } - } - } - - public ITypedElement replace(ITypedElement child, ITypedElement other) { - - if (child == null) { // add resource - // create a node without a resource behind it! - IResource resource= getResource(); - if (resource instanceof IFolder) { - IFolder folder= (IFolder) resource; - IFile file= folder.getFile(other.getName()); - child= new BufferedResourceNode(file); - } - } - - if (other == null) { // delete resource - IResource resource= getResource(); - if (resource instanceof IFolder) { - IFolder folder= (IFolder) resource; - IFile file= folder.getFile(child.getName()); - if (file != null && file.exists()) { - fDeleteFile= file; - fDirty= true; - } - } - return null; - } - - if (other instanceof IStreamContentAccessor && child instanceof IEditableContent) { - IEditableContent dst= (IEditableContent) child; - - try { - InputStream is= ((IStreamContentAccessor)other).getContents(); - byte[] bytes= readBytes(is); - if (bytes != null) - dst.setContent(bytes); - } catch (CoreException ex) { - } - } - return child; - } - - public static byte[] readBytes(InputStream in) { - ByteArrayOutputStream bos= new ByteArrayOutputStream(); - try { - while (true) { - int c= in.read(); - if (c == -1) - break; - bos.write(c); - } - - } catch (IOException ex) { - return null; - - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException x) { - } - } - try { - bos.close(); - } catch (IOException x) { - } - } - return bos.toByteArray(); - } -} 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/sync/compare/RemoteResourceTypedElement.java deleted file mode 100644 index cae5e2f3d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/RemoteResourceTypedElement.java +++ /dev/null @@ -1,109 +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.compare; - -import java.io.InputStream; - -import org.eclipse.compare.BufferedContent; -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.IEditableContent; -import org.eclipse.compare.ITypedElement; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; - -/** - * RemoteResourceTypedElement - */ -public class RemoteResourceTypedElement extends BufferedContent implements ITypedElement, IEditableContent { - - private IRemoteResource remote; - private boolean editable; - - /** - * Creates a new content buffer for the given team node. - */ - RemoteResourceTypedElement(IRemoteResource remote) { - this.remote = remote; - this.editable = false; - } - - public Image getImage() { - return CompareUI.getImage(getType()); - } - - public String getName() { - return remote.getName(); - } - - public String getType() { - if (remote.isContainer()) { - return ITypedElement.FOLDER_TYPE; - } - String name = getName(); - if (name != null) { - int index = name.lastIndexOf('.'); - if (index == -1) - return ""; //$NON-NLS-1$ - if (index == (name.length() - 1)) - return ""; //$NON-NLS-1$ - return name.substring(index + 1); - } - return ITypedElement.FOLDER_TYPE; - } - - /** - * Returns true if this object can be modified. - * If it returns <code>false</code> the other methods must not be called. - * - * @return <code>true</code> if this object can be modified. - */ - public boolean isEditable() { - return editable; - } - - /** - * This is not the definitive API! - * This method is called on a parent to - * - add a child, - * - remove a child, - * - copy the contents of a child - * - * What to do is encoded in the two arguments as follows: - * add: child == null other != null - * remove: child != null other == null - * copy: child != null other != null - */ - public ITypedElement replace(ITypedElement child, ITypedElement other) { - return null; - } - - /* (non-Javadoc) - * @see BufferedContent#createStream() - */ - protected InputStream createStream() throws CoreException { - if (remote != null && !remote.isContainer()) { - try { - return remote.getContents(new NullProgressMonitor()); - } catch (TeamException exception) { - // The remote resource has gone. - return null; - } - } - return null; - } - - public IRemoteResource getRemote() { - return remote; - } -}
\ No newline at end of file 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/sync/compare/SyncInfoCompareInput.java deleted file mode 100644 index 6be461569..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java +++ /dev/null @@ -1,244 +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.compare; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.IContentChangeListener; -import org.eclipse.compare.IContentChangeNotifier; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -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.ui.ISharedImages; - -public class SyncInfoCompareInput extends CompareEditorInput { - - private SyncInfo sync; - private SyncInfoDiffNode node; - private static Image titleImage; - - /* protected */ SyncInfoCompareInput() { - super(new CompareConfiguration()); - } - - public SyncInfoCompareInput(SyncInfo sync) { - super(new CompareConfiguration()); - this.sync = sync; - - ITypedElement elements[] = SyncInfoDiffNode.getTypedElements(sync); - this.node = new SyncInfoDiffNode(elements[0] /* base */, elements[1] /* local */, elements[2] /* remote */, sync.getKind()); - initializeContentChangeListeners(); - } - - private void initializeContentChangeListeners() { - ITypedElement te = node.getLeft(); - if(te instanceof IContentChangeNotifier) { - ((IContentChangeNotifier)te).addContentChangeListener(new IContentChangeListener() { - public void contentChanged(IContentChangeNotifier source) { - try { - saveChanges(new NullProgressMonitor()); - } catch (CoreException e) { - } - } - }); - } - } - - /* (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#getTitleImage() - */ - public Image getTitleImage() { - if(titleImage == null) { - titleImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW).createImage(); - TeamUIPlugin.disposeOnShutdown(titleImage); - } - return titleImage; - } - - /* (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor) - */ - protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - // update the title now that the remote revision number as been fetched from the server - setTitle(getTitle()); - updateLabels(); - return node; - } - - /* (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#getTitle() - */ - public String getTitle() { - return Policy.bind("SyncInfoCompareInput.title", sync.getSubscriber().getName(), node.getName()); //$NON-NLS-1$ - } - - protected void updateLabels() { - CompareConfiguration config = getCompareConfiguration(); - IRemoteResource remote = sync.getRemote(); - IRemoteResource base = sync.getRemote(); - - config.setLeftLabel(Policy.bind("SyncInfoCompareInput.localLabel")); //$NON-NLS-1$ - - if(remote != null) { - try { - config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabelExists", remote.getContentIdentifier(), remote.getCreatorDisplayName(), flattenText(remote.getComment()))); //$NON-NLS-1$ - } catch (TeamException e) { - config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabel")); //$NON-NLS-1$ - } - } else { - config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabel")); //$NON-NLS-1$ - } - - if(base != null) { - try { - config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabelExists", base.getContentIdentifier(), base.getCreatorDisplayName(), flattenText(base.getComment()))); //$NON-NLS-1$ - } catch (TeamException e) { - config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabel")); //$NON-NLS-1$ - } - } else { - config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabel")); //$NON-NLS-1$ - } - } - - /* - * Flatten the text in the multiline comment - * @param string - * @return String - */ - private String flattenText(String string) { - StringBuffer buffer = new StringBuffer(string.length() + 20); - boolean skipAdjacentLineSeparator = true; - for (int i = 0; i < string.length(); i++) { - char c = string.charAt(i); - if (c == '\r' || c == '\n') { - if (!skipAdjacentLineSeparator) - buffer.append("/"); //$NON-NLS-1$ - skipAdjacentLineSeparator = true; - } else { - buffer.append(c); - skipAdjacentLineSeparator = false; - } - } - return buffer.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getToolTipText() - */ - public String getToolTipText() { - return Policy.bind("SyncInfoCompareInput.tooltip", sync.getSubscriber().getName(), node.getName()); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object other) { - if(other == this) return true; - if(other instanceof SyncInfoCompareInput) { - return equalDiffNodes(node, (SyncInfoDiffNode)((SyncInfoCompareInput)other).getCompareResult()); - } else if(other instanceof SyncInfoCompareInputFinder) { - return true; - } - return false; - } - - private boolean equalDiffNodes(SyncInfoDiffNode node1, SyncInfoDiffNode node2) { - - if(node1 == null || node2 == null) { - return false; - } - - // First, ensure the local resources are equals - IResource local1 = null; - if (node1.getLeft() != null) - local1 = ((LocalResourceTypedElement)node1.getLeft()).getResource(); - IResource local2 = null; - if (node2.getLeft() != null) - local2 = ((LocalResourceTypedElement)node2.getLeft()).getResource(); - if (!equalObjects(local1, local2)) return false; - - // Next, ensure the remote resources are equal - IRemoteResource remote1 = null; - if (node1.getRight() != null) - remote1 = ((RemoteResourceTypedElement)node1.getRight()).getRemote(); - IRemoteResource remote2 = null; - if (node2.getRight() != null) - remote2 = ((RemoteResourceTypedElement)node2.getRight()).getRemote(); - if (!equalObjects(remote1, remote2)) return false; - - // Finally, ensure the base resources are equal - IRemoteResource base1 = null; - if (node1.getAncestor() != null) - base1 = ((RemoteResourceTypedElement)node1.getAncestor()).getRemote(); - IRemoteResource base2 = null; - if (node2.getAncestor() != null) - base2 = ((RemoteResourceTypedElement)node2.getAncestor()).getRemote(); - if (!equalObjects(base1, base2)) return false; - - return true; - } - - private boolean equalObjects(Object o1, Object o2) { - if (o1 == null && o2 == null) return true; - if (o1 == null || o2 == null) return false; - return o1.equals(o2); - } - - /* (non-Javadoc) - * @see CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor) - */ - public void saveChanges(IProgressMonitor pm) throws CoreException { - super.saveChanges(pm); - if (node instanceof DiffNode) { - try { - commit(pm, (DiffNode) node); - } finally { - setDirty(false); - } - } - } - - /* - * Recursively walks the diff tree and commits all changes. - */ - private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - ITypedElement left= node.getLeft(); - if (left instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) left).commit(pm); - - ITypedElement right= node.getRight(); - if (right instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) right).commit(pm); - } - - public SyncInfo getSyncInfo() { - return sync; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInputFinder.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInputFinder.java deleted file mode 100644 index 5f88d1eb3..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInputFinder.java +++ /dev/null @@ -1,71 +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.compare; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IPersistableElement; - - -/** - * SyncInfoCompareInputFinder - */ -public class SyncInfoCompareInputFinder implements IEditorInput { - - public boolean equals(Object other) { - if(other instanceof SyncInfoCompareInput) { - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#exists() - */ - public boolean exists() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getName() - */ - public String getName() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getPersistable() - */ - public IPersistableElement getPersistable() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getToolTipText() - */ - public String getToolTipText() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - return null; - } -}
\ No newline at end of file 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/sync/compare/SyncInfoDiffNode.java deleted file mode 100644 index 950754d65..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoDiffNode.java +++ /dev/null @@ -1,59 +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.compare; - -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.core.resources.IResource; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.core.sync.IRemoteResource; - -public class SyncInfoDiffNode extends DiffNode { - - /** - * Creates a new file node. - */ - public SyncInfoDiffNode(ITypedElement base, ITypedElement local, ITypedElement remote, int syncKind) { - super(syncKind, base, local, remote); - } - - /** - * Returns the typed element for this sync element. The returned elements - * are [0] base, [1] local, [2] remote. - */ - static public ITypedElement[] getTypedElements(final SyncInfo sync) { - IRemoteResource baseResource = sync.getBase(); - IRemoteResource remoteResource = sync.getRemote(); - IResource localResource = sync.getLocal(); - - ITypedElement te[] = new ITypedElement[3]; - - if(baseResource != null) { - te[0] = new RemoteResourceTypedElement(baseResource); - } - if(remoteResource != null) { - te[2] = new RemoteResourceTypedElement(remoteResource); - } - - if(localResource != null && localResource.exists()) { - te[1] = new LocalResourceTypedElement(localResource) { - public boolean isEditable() { - int kind = sync.getKind(); - if(SyncInfo.getDirection(kind) == SyncInfo.OUTGOING && SyncInfo.getChange(kind) == SyncInfo.DELETION) { - return false; - } - return super.isEditable(); - } - }; - } - return te; - } -} 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/sync/sets/ISyncSetChangedListener.java deleted file mode 100644 index db1ef795a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/ISyncSetChangedListener.java +++ /dev/null @@ -1,22 +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.sets; - -/** - * This interface is used to receive SyncSetChangedEvents from a sync set. - */ -public interface ISyncSetChangedListener { - - /** - * The sync set has changed and the event contains the details. - */ - public void syncSetChanged(SyncSetChangedEvent event); -} 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/sync/sets/SubscriberEventHandler.java deleted file mode 100644 index 0215c4067..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java +++ /dev/null @@ -1,366 +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.sets; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.internal.core.ExceptionCollector; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * This handler collects changes and removals to resources and calculates their - * synchronization state in a background job. The result is fed input the SyncSetInput. - * - * Exceptions that occur when the job is processing the events are collected and - * returned as part of the Job's status. - * - * OPTIMIZATION: look into provinding events with multiple resources instead of - * one. - */ -public class SubscriberEventHandler { - // The number of events to process before feeding into the set. - private static final int NOTIFICATION_BATCHING_NUMBER = 10; - - // The set that receives notification when the resource synchronization state - // has been calculated by the job. - private SyncSetInputFromSubscriber set; - - // Events that need to be processed - private List awaitingProcessing = new ArrayList(); - - // Use to shutdown the job - private boolean shutdown = false; - - // The job that runs when events need to be processed - Job eventHandlerJob; - - // manages exceptions - private ExceptionCollector errors; - - /** - * Internal resource synchronization event. Can contain a result. - */ - class Event { - static final int REMOVAL = 1; - static final int CHANGE = 2; - static final int INITIALIZE = 3; - IResource resource; - int type; - int depth; - SyncInfo result; - - Event(IResource resource, int type, int depth) { - this.resource = resource; - this.type = type; - this.depth = depth; - } - public Event( - IResource resource, - int type, - int depth, - SyncInfo result) { - this(resource, type, depth); - this.result = result; - } - public int getDepth() { - return depth; - } - public IResource getResource() { - return resource; - } - public int getType() { - return type; - } - public SyncInfo getResult() { - return result; - } - } - /** - * Create a handler. This will initialize all resources for the subscriber associated with - * the set. - * @param set the subscriber set to feed changes into - */ - public SubscriberEventHandler(SyncSetInputFromSubscriber set) { - this.set = set; - errors = - new ExceptionCollector( - Policy.bind("SubscriberEventHandler.errors"), //$NON-NLS-1$ - TeamUIPlugin.ID, - IStatus.ERROR, - null /* don't log */ - ); //$NON-NLS-1$ - reset(Event.INITIALIZE); - createEventHandlingJob(); - schedule(); - } - /** - * Schedule the job or process the events now. - */ - public void schedule() { - eventHandlerJob.schedule(); - } - /** - * Initialize all resources for the subscriber associated with the set. This will basically recalculate - * all synchronization information for the subscriber. - * @param resource - * @param depth - */ - public void initialize() { - reset(Event.CHANGE); - } - /** - * Called by a client to indicate that a resource has changed and its synchronization state - * should be recalculated. - * @param resource the changed resource - * @param depth the depth of the change calculation - */ - public void change(IResource resource, int depth) { - queueEvent(new Event(resource, Event.CHANGE, depth)); - } - /** - * Called by a client to indicate that a resource has been removed and should be removed. The - * removal will propagate to the set. - * @param resource the resource that was removed - */ - public void remove(IResource resource) { - queueEvent( - new Event(resource, Event.REMOVAL, IResource.DEPTH_INFINITE)); - } - /** - * Queue the event and start the job if it's not already doing work. - */ - synchronized private void queueEvent(Event event) { - awaitingProcessing.add(event); - if (shutdown - || eventHandlerJob == null - || eventHandlerJob.getState() != Job.NONE) - return; - else { - schedule(); - } - } - /** - * Returns the events handler job. - * @return the job that calculates the synchronization state for a subscriber - */ - public Job getEventHandlerJob() { - return eventHandlerJob; - } - /** - * Shutdown the event handler. - */ - void shutdown() { - shutdown = true; - eventHandlerJob.cancel(); - } - /** - * Get the next resource to be calculated. - * @return Event to be processed - */ - synchronized Event nextElement() { - if (shutdown || awaitingProcessing.isEmpty()) { - return null; - } - return (Event) awaitingProcessing.remove(0); - } - /** - * Create the job used for processing the events in the queue. The job stops working when - * the queue is empty. - */ - private void createEventHandlingJob() { - eventHandlerJob = new Job(Policy.bind("SubscriberEventHandler.jobName")) {//$NON-NLS-1$ - public IStatus run(IProgressMonitor monitor) { - return processEvents(monitor); - } - }; - eventHandlerJob.setPriority(Job.SHORT); - eventHandlerJob.setSystem(true); - } - /** - * Process events from the events queue and dispatch results. - */ - private IStatus processEvents(IProgressMonitor monitor) { - List resultCache = new ArrayList(); - Event event; - errors.clear(); - try { - monitor.beginTask(null, 100); //$NON-NLS-1$ - - while ((event = nextElement()) != null) { - // Cancellation is dangerous because this will leave the sync info in a bad state. - // Purposely not checking - - try { - int type = event.getType(); - switch (type) { - case Event.REMOVAL : - resultCache.add(event); - break; - case Event.CHANGE : - List results = new ArrayList(); - collect( - event.getResource(), - event.getDepth(), - monitor, - results); - resultCache.addAll(results); - break; - case Event.INITIALIZE : - Event[] events = - getAllOutOfSync( - new IResource[] { event.getResource()}, - event.getDepth(), - monitor); - resultCache.addAll(Arrays.asList(events)); - break; - } - } catch (TeamException e) { - // handle exception but keep going - errors.handleException(e); - } - - if (awaitingProcessing.isEmpty() - || resultCache.size() > NOTIFICATION_BATCHING_NUMBER) { - dispatchEvents( - (Event[]) resultCache.toArray( - new Event[resultCache.size()])); - resultCache.clear(); - } - } - } finally { - monitor.done(); - } - return errors.getStatus(); - } - /** - * Collect the calculated synchronization information for the given resource at the given depth. The - * results are added to the provided list. - */ - private void collect( - IResource resource, - int depth, - IProgressMonitor monitor, - List results) - throws TeamException { - - if (resource.getType() != IResource.FILE - && depth != IResource.DEPTH_ZERO) { - IResource[] members = - set.getSubscriber().members((IContainer) resource); - for (int i = 0; i < members.length; i++) { - collect( - members[i], - depth == IResource.DEPTH_INFINITE - ? IResource.DEPTH_INFINITE - : IResource.DEPTH_ZERO, - monitor, - results); - } - } - - SyncInfo info = set.getSubscriber().getSyncInfo(resource, monitor); - // resource is no longer under the subscriber control - if (info == null) { - results.add( - new Event(resource, Event.REMOVAL, IResource.DEPTH_ZERO)); - } else { - results.add( - new Event(resource, Event.CHANGE, IResource.DEPTH_ZERO, info)); - } - } - /** - * Called to initialize to calculate the synchronization information using the optimized subscriber method. For - * subscribers that don't support the optimization, all resources in the subscriber are manually re-calculated. - * @param resources the resources to check - * @param depth the depth - * @param monitor - * @return Event[] the change events - * @throws TeamException - */ - private Event[] getAllOutOfSync( - IResource[] resources, - int depth, - IProgressMonitor monitor) - throws TeamException { - SyncInfo[] infos = - set.getSubscriber().getAllOutOfSync(resources, depth, monitor); - - // The subscriber hasn't cached out-of-sync resources. We will have to - // traverse all resources and calculate their state. - if (infos == null) { - List events = new ArrayList(); - for (int i = 0; i < resources.length; i++) { - collect( - resources[i], - IResource.DEPTH_INFINITE, - monitor, - events); - } - return (Event[]) events.toArray(new Event[events.size()]); - // The subscriber has returned the list of out-of-sync resources. - } else { - Event[] events = new Event[infos.length]; - for (int i = 0; i < infos.length; i++) { - SyncInfo info = infos[i]; - events[i] = - new Event(info.getLocal(), Event.CHANGE, depth, info); - } - return events; - } - } - - /** - * Feed the given events to the set. The appropriate method on the set is called - * for each event type. - * @param events - */ - private void dispatchEvents(Event[] events) { - // this will batch the following set changes until endInput is called. - set.getSyncSet().beginInput(); - for (int i = 0; i < events.length; i++) { - Event event = events[i]; - switch (event.getType()) { - case Event.CHANGE : - set.collect(event.getResult()); - break; - case Event.REMOVAL : - if (event.getDepth() == IResource.DEPTH_INFINITE) { - set.getSyncSet().removeAllChildren(event.getResource()); - } else { - set.remove(event.getResource()); - } - break; - } - } - set.getSyncSet().endInput(); - }; - /** - * Initialize all resources for the subscriber associated with the set. This will basically recalculate - * all synchronization information for the subscriber. - * @param type can be Event.CHANGE to recalculate all states or Event.INITIALIZE to perform the - * optimized recalculation if supported by the subscriber. - */ - private void reset(int type) { - IResource[] resources = set.getSubscriber().roots(); - for (int i = 0; i < resources.length; i++) { - queueEvent(new Event(resources[i], type, IResource.DEPTH_INFINITE)); - } - } -} 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/sync/sets/SubscriberInput.java deleted file mode 100644 index 95864092f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java +++ /dev/null @@ -1,227 +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.sets; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -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.TeamUIPlugin; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.sync.SyncInfoFilter; -import org.eclipse.ui.IWorkingSet; - -/** - * SubscriberInput encapsulates the UI model for synchronization changes associated - * with a TeamSubscriber. - */ -public class SubscriberInput implements IPropertyChangeListener, ITeamResourceChangeListener, IResourceChangeListener { - - /* - * The subscriberInput manages a sync set that contains all of the out-of-sync elements - * of a subscriber. - */ - private SyncSetInputFromSubscriber subscriberSyncSet; - - /* - * The working set sync set is used to constrain the subscriber's resources to - * a smaller workset. - */ - private WorkingSetSyncSetInput workingRootsSet; - - /* - * The filtered set contains the changes after direction and kind filters have been applied - */ - private SyncSetInputFromSyncSet filteredSyncSet; - - /* - * Responsible for calculating changes to a set based on events generated - * in the workbench. - */ - private SubscriberEventHandler eventHandler; - - public SubscriberInput(TeamSubscriber subscriber) { - Assert.isNotNull(subscriber); - subscriberSyncSet = new SyncSetInputFromSubscriber(subscriber); - workingRootsSet = new WorkingSetSyncSetInput(subscriberSyncSet.getSyncSet()); - filteredSyncSet = new SyncSetInputFromSyncSet(workingRootsSet.getSyncSet()); - eventHandler = new SubscriberEventHandler(subscriberSyncSet); - - TeamUI.addPropertyChangeListener(this); - ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE); - subscriber.addListener(this); - } - - public TeamSubscriber getSubscriber() { - return subscriberSyncSet.getSubscriber(); - } - - public SyncSet getFilteredSyncSet() { - return filteredSyncSet.getSyncSet(); - } - - public SyncSet getSubscriberSyncSet() { - return subscriberSyncSet.getSyncSet(); - } - - public SyncSet getWorkingSetSyncSet() { - return workingRootsSet.getSyncSet(); - } - - public SubscriberEventHandler getEventHandler() { - return eventHandler; - } - - public void setFilter(SyncInfoFilter filter, IProgressMonitor monitor) throws TeamException { - filteredSyncSet.setFilter(filter); - filteredSyncSet.reset(monitor); - } - - public void setWorkingSet(IWorkingSet set) { - workingRootsSet.setWorkingSet(set); - } - - public IWorkingSet getWorkingSet() { - return workingRootsSet.getWorkingSet(); - } - - public void dispose() { - eventHandler.shutdown(); - - filteredSyncSet.disconnect(); - workingRootsSet.disconnect(); - subscriberSyncSet.disconnect(); - - getSubscriber().removeListener(this); - ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); - TeamUI.removePropertyChangeListener(this); - } - - public IResource[] workingSetRoots() { - return workingRootsSet.roots(getSubscriber()); - } - - public IResource[] subscriberRoots() { - return getSubscriber().roots(); - } - - /* (non-Javadoc) - * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) { - try { - reset(); - } catch (TeamException e) { - TeamUIPlugin.log(e); - } - } - } - - public void reset() throws TeamException { - subscriberSyncSet.reset(new NullProgressMonitor()); - workingRootsSet.reset(new NullProgressMonitor()); - filteredSyncSet.reset(new NullProgressMonitor()); - eventHandler.initialize(); - } - - /** - * Process the resource delta - * - * @param delta - */ - private void processDelta(IResourceDelta delta) { - IResource resource = delta.getResource(); - int kind = delta.getKind(); - - if (resource.getType() == IResource.PROJECT) { - try { - // Handle a deleted project - if (((kind & IResourceDelta.REMOVED) != 0) - || !getSubscriber().isSupervised((IProject) resource)) { - eventHandler.remove((IProject) resource); - return; - } - // Only interested in projects mapped to the provider - if (!getSubscriber().isSupervised((IProject) resource)) { - return; - } - } catch (TeamException e) { - TeamUIPlugin.log(e); - // we return because the children of this project shouldn't be processed. - return; - } - } - - // If the resource has changed type, remove the old resource handle - // and add the new one - if ((delta.getFlags() & IResourceDelta.TYPE) != 0) { - eventHandler.remove(resource); - eventHandler.change(resource, IResource.DEPTH_INFINITE); - } - - // Check the flags for changes the SyncSet cares about. - // Notice we don't care about MARKERS currently. - int changeFlags = delta.getFlags(); - if ((changeFlags & (IResourceDelta.OPEN | IResourceDelta.CONTENT)) != 0) { - eventHandler.change(resource, IResource.DEPTH_ZERO); - } - - // Check the kind and deal with those we care about - if ((delta.getKind() & (IResourceDelta.REMOVED | IResourceDelta.ADDED)) != 0) { - eventHandler.change(resource, IResource.DEPTH_ZERO); - } - - // Handle changed children . - IResourceDelta[] affectedChildren = - delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED | IResourceDelta.ADDED); - for (int i = 0; i < affectedChildren.length; i++) { - processDelta(affectedChildren[i]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(IResourceChangeEvent event) { - processDelta(event.getDelta()); - } - - /* (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++) { - switch(deltas[i].getFlags()) { - case TeamDelta.SYNC_CHANGED: - eventHandler.change(deltas[i].getResource(), IResource.DEPTH_ZERO); - break; - case TeamDelta.PROVIDER_DECONFIGURED: - eventHandler.remove(deltas[i].getResource()); - break; - case TeamDelta.PROVIDER_CONFIGURED: - eventHandler.change(deltas[i].getResource(), IResource.DEPTH_INFINITE); - break; - } - } - } -} 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/sync/sets/SyncInfoStatistics.java deleted file mode 100644 index 2b9e16ce4..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoStatistics.java +++ /dev/null @@ -1,107 +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.sets; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * Counts SyncInfo states and allows for easy querying for different sync states. - */ -public class SyncInfoStatistics { - // {int sync kind -> int number of infos with that sync kind in this sync set} - protected Map stats = new HashMap(); - - /** - * Count this sync kind. Only the type of the sync info is stored. - * @param info the new info - */ - public void add(SyncInfo info) { - // update statistics - Long count = (Long)stats.get(new Integer(info.getKind())); - if(count == null) { - count = new Long(0); - } - stats.put(new Integer(info.getKind()), new Long(count.longValue() + 1)); - } - - /** - * Remove this sync kind. - * @param info the info type to remove - */ - public void remove(SyncInfo info) { - // update stats - Integer kind = new Integer(info.getKind()); - Long count = (Long)stats.get(kind); - if(count == null) { - // error condition, shouldn't be removing if we haven't added yet - // programmer error calling remove before add. - } else { - long newCount = count.intValue() - 1; - if(newCount > 0) { - stats.put(kind, new Long(newCount)); - } else { - stats.remove(kind); - } - } - } - - /** - * Return the count of sync infos for the specified sync kind. A mask can be used to acucmulate - * counts for specific directions or change types. - * To return the number of outgoing changes: - * long outgoingChanges = stats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK); - * - * @param kind the sync kind for which to return the count - * @param mask the mask applied to the stored sync kind - * @return the number of sync info types added for the specific kind - */ - public long countFor(int kind, int mask) { - if(mask == 0) { - Long count = (Long)stats.get(new Integer(kind)); - return count == null ? 0 : count.longValue(); - } else { - Iterator it = stats.keySet().iterator(); - long count = 0; - while (it.hasNext()) { - Integer key = (Integer) it.next(); - if((key.intValue() & mask) != 0) { - count += ((Integer)stats.get(key)).intValue(); - } - } - return count; - } - } - - /** - * Clear the statistics counts. All calls to countFor() will return 0 until new - * sync infos are added. - */ - public void clear() { - stats.clear(); - } - - /** - * For debugging - */ - public String toString() { - StringBuffer out = new StringBuffer(); - Iterator it = stats.keySet().iterator(); - while (it.hasNext()) { - Integer kind = (Integer) it.next(); - out.append(SyncInfo.kindToString(kind.intValue()) + ": " + ((Long)stats.get(kind)) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - } - return out.toString(); - } -}
\ No newline at end of file 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/sync/sets/SyncInfoWorkingSetFilter.java deleted file mode 100644 index 47fcd91a7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java +++ /dev/null @@ -1,128 +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.sets; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -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.ui.IWorkingSet; - -/** - * WorkingSet filter for a SyncSet. - */ -public class SyncInfoWorkingSetFilter extends SyncInfoFilter { - - private IWorkingSet workingSet; - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.SyncInfoFilter#select(org.eclipse.team.core.subscribers.SyncInfo) - */ - public boolean select(SyncInfo info) { - // if there's no set, the resource is included - if (workingSet == null) return true; - return isIncluded(info.getLocal()); - } - - /* - * Answer true if the given resource is included in the working set - */ - private boolean isIncluded(IResource resource) { - // otherwise, if their is a parent of the resource in the set, - // it is included - Object[] elements = workingSet.getElements(); - List result = new ArrayList(); - for (int i = 0; i < elements.length; i++) { - IResource setResource = getResource(elements[i]); - if (isParent(setResource, resource)) { - return true; - } - } - return false; - } - - private IResource getResource(Object object) { - if (object instanceof IResource) { - return (IResource)object; - } else if (object instanceof IAdaptable) { - return (IResource)((IAdaptable)object).getAdapter(IResource.class); - } - return null; - } - - private boolean isParent(IResource parent, IResource child) { - return (parent.getFullPath().isPrefixOf(child.getFullPath())); - } - - public IWorkingSet getWorkingSet() { - return workingSet; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.SyncSetInputFromSubscriber#getRoots() - */ - public IResource[] getRoots(TeamSubscriber subscriber) { - IResource[] roots = subscriber.roots(); - if (workingSet == null) return roots; - - // filter the roots by the selected working set - Set result = new HashSet(); - for (int i = 0; i < roots.length; i++) { - IResource resource = roots[i]; - result.addAll(Arrays.asList(getIntersectionWithSet(subscriber, resource))); - } - return (IResource[]) result.toArray(new IResource[result.size()]); - } - - /* - * Answer the intersection between the given resource and it's children - * and the receiver's working set. - */ - private IResource[] getIntersectionWithSet(TeamSubscriber subscriber, IResource resource) { - Object[] elements = workingSet.getElements(); - List result = new ArrayList(); - for (int i = 0; i < elements.length; i++) { - IResource setResource = getResource(elements[i]); - if (setResource != null) { - if (isParent(resource, setResource)) { - try { - if (subscriber.isSupervised(setResource)) { - result.add(setResource); - } - } catch (TeamException e) { - // Log the exception and add the resource to the list - TeamUIPlugin.log(e); - result.add(setResource); - } - } else if (isParent(setResource, resource)) { - result.add(resource); - } - } - } - return (IResource[]) result.toArray(new IResource[result.size()]); - } - /** - * @param workingSet - */ - 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/sync/sets/SyncSet.java deleted file mode 100644 index 8debeb4a2..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java +++ /dev/null @@ -1,311 +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.sets; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * This class keeps track of a set of resources and their associated synchronization - * information. It is optimized so that retrieving out-of-sync children is fast. - */ -public class SyncSet { - // fields used to hold resources of interest - // {IPath -> SyncInfo} - protected Map resources = Collections.synchronizedMap(new HashMap()); - - // {IPath -> Set of deep out of sync child IResources} - // weird thing is that the child set will include the - // parent if the parent is out of sync - protected Map parents = Collections.synchronizedMap(new HashMap()); - - // fields used for change notification - protected SyncSetChangedEvent changes; - protected Set listeners = Collections.synchronizedSet(new HashSet()); - - protected SyncInfoStatistics statistics = new SyncInfoStatistics(); - - public SyncSet() { - resetChanges(); - } - - protected void resetChanges() { - changes = new SyncSetChangedEvent(this); - } - - protected void fireChanges() { - // Use a synchronized block to ensure that the event we send is static - SyncSetChangedEvent event; - synchronized(this) { - event = changes; - resetChanges(); - } - // Fire the events - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - ISyncSetChangedListener listener = (ISyncSetChangedListener) iter.next(); - listener.syncSetChanged(event); - } - } - - /** - * Add a change listener - * @param provider - */ - public void addSyncSetChangedListener(ISyncSetChangedListener listener) { - listeners.add(listener); - } - - /** - * Remove a change listener - * @param provider - */ - public void removeSyncSetChangedListener(ISyncSetChangedListener listener) { - listeners.remove(listener); - } - - public synchronized void add(SyncInfo info) { - internalAddSyncInfo(info); - changes.added(info); - IResource local = info.getLocal(); - addToParents(local, local); - } - - private void internalAddSyncInfo(SyncInfo info) { - IResource local = info.getLocal(); - IPath path = local.getFullPath(); - if(resources.put(path, info) == null) { - statistics.add(info); - } - } - - protected synchronized void remove(IResource local) { - IPath path = local.getFullPath(); - SyncInfo info = (SyncInfo)resources.remove(path); - changes.removed(local); - statistics.remove(info); - removeFromParents(local, local); - } - - protected synchronized void changed(SyncInfo info) { - internalAddSyncInfo(info); - changes.changed(info); - } - - /** - * Reset the sync set so it is empty - */ - public synchronized void reset() { - resources.clear(); - parents.clear(); - changes.reset(); - statistics.clear(); - } - - protected boolean addToParents(IResource resource, IResource parent) { - if (parent.getType() == IResource.ROOT) { - return false; - } - // this flag is used to indicate if the parent was previosuly in the set - boolean addedParent = false; - if (parent.getType() == IResource.FILE) { - // the file is new - addedParent = true; - } else { - Set children = (Set)parents.get(parent.getFullPath()); - if (children == null) { - children = new HashSet(); - parents.put(parent.getFullPath(), children); - // this is a new folder in the sync set - addedParent = true; - } - children.add(resource); - } - // if the parent already existed and the resource is new, record it - if (!addToParents(resource, parent.getParent()) && addedParent) { - changes.addedRoot(parent); - } - return addedParent; - } - - protected boolean removeFromParents(IResource resource, IResource parent) { - if (parent.getType() == IResource.ROOT) { - return false; - } - // this flag is used to indicate if the parent was removed from the set - boolean removedParent = false; - if (parent.getType() == IResource.FILE) { - // the file will be removed - removedParent = true; - } else { - Set children = (Set)parents.get(parent.getFullPath()); - if (children != null) { - children.remove(resource); - if (children.isEmpty()) { - parents.remove(parent.getFullPath()); - removedParent = true; - } - } - } - // if the parent wasn't removed and the resource was, record it - if (!removeFromParents(resource, parent.getParent()) && removedParent) { - changes.removedRoot(parent); - } - return removedParent; - } - - /** - * Return the children of the given container who are either out-of-sync or contain - * out-of-sync resources. - * - * @param container - * @return - */ - public IResource[] members(IResource resource) { - if (resource.getType() == IResource.FILE) return new IResource[0]; - IContainer parent = (IContainer)resource; - if (parent.getType() == IResource.ROOT) return getRoots(parent); - // TODO: must be optimized so that we don't traverse all the deep children to find - // the immediate ones. - Set children = new HashSet(); - IPath path = parent.getFullPath(); - Set possibleChildren = (Set)parents.get(path); - if(possibleChildren != null) { - for (Iterator it = possibleChildren.iterator(); it.hasNext();) { - Object next = it.next(); - IResource element = (IResource)next; - IPath childPath = element.getFullPath(); - IResource modelObject = null; - if(childPath.segmentCount() == (path.segmentCount() + 1)) { - modelObject = element; - - } else if (childPath.segmentCount() > path.segmentCount()) { - IContainer childFolder = parent.getFolder(new Path(childPath.segment(path.segmentCount()))); - modelObject = childFolder; - } - if (modelObject != null) { - children.add(modelObject); - } - } - } - return (IResource[]) children.toArray(new IResource[children.size()]); - } - - /** - * Return the out-of-sync descendants of the given resource. If the given resource - * is out of sync, it will be included in the result. - * - * @param container - * @return - */ - public SyncInfo[] getOutOfSyncDescendants(IResource resource) { - if (resource.getType() == IResource.FILE) { - SyncInfo info = getSyncInfo(resource); - if (info == null) { - return new SyncInfo[0]; - } else { - return new SyncInfo[] { info }; - } - }; - IContainer container = (IContainer)resource; - IPath path = container.getFullPath(); - Set children = (Set)parents.get(path); - if (children == null) return new SyncInfo[0]; - List infos = new ArrayList(); - for (Iterator iter = children.iterator(); iter.hasNext();) { - IResource child = (IResource) iter.next(); - SyncInfo info = getSyncInfo(child); - if(info != null) { - infos.add(info); - } else { - TeamUIPlugin.log(IStatus.INFO, "missing sync info: " + child.getFullPath(), null); //$NON-NLS-1$ - } - } - return (SyncInfo[]) infos.toArray(new SyncInfo[infos.size()]); - } - - private IResource[] getRoots(IContainer root) { - Set possibleChildren = parents.keySet(); - Set children = new HashSet(); - for (Iterator it = possibleChildren.iterator(); it.hasNext();) { - Object next = it.next(); - IResource element = ((IWorkspaceRoot)root).findMember((IPath)next); - if (element != null) { - children.add(element.getProject()); - } - } - return (IResource[]) children.toArray(new IResource[children.size()]); - } - - protected boolean hasMembers(IContainer container) { - return parents.containsKey(container.getFullPath()); - } - - /** - * Return an array of all the resources that are known to be out-of-sync - * @return - */ - public SyncInfo[] allMembers() { - return (SyncInfo[]) resources.values().toArray(new SyncInfo[resources.size()]); - } - - protected synchronized void removeAllChildren(IResource resource) { - // The parent map contains a set of all out-of-sync children - Set allChildren = (Set)parents.get(resource.getFullPath()); - if (allChildren == null) return; - IResource [] removed = (IResource[]) allChildren.toArray(new IResource[allChildren.size()]); - for (int i = 0; i < removed.length; i++) { - remove(removed[i]); - } - } - - public SyncInfo getSyncInfo(IResource resource) { - return (SyncInfo)resources.get(resource.getFullPath()); - } - - /** - * This method is invoked by a SyncSetInput provider when the - * provider is starting to provide new input to the SyncSet - */ - /* package */ void beginInput() { - resetChanges(); - } - - /** - * This method is invoked by a SyncSetInput provider when the - * provider is done providing new input to the SyncSet - */ - /* package */ void endInput() { - fireChanges(); - } - - public int size() { - return resources.size(); - } - - public SyncInfoStatistics getStatistics() { - return statistics; - } -} 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/sync/sets/SyncSetChangedEvent.java deleted file mode 100644 index e8919d68e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetChangedEvent.java +++ /dev/null @@ -1,127 +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.sets; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * This event keeps track of the changes in a sync set - */ -public class SyncSetChangedEvent { - - private SyncSet set; - - // List that accumulate changes - // SyncInfo - private Set changedResources = new HashSet(); - private Set removedResources = new HashSet(); - private Set addedResources = new HashSet(); - - // IResources - private Set removedRoots = new HashSet(); - private Set addedRoots = new HashSet(); - - private boolean reset = false; - - public SyncSetChangedEvent(SyncSet set) { - super(); - this.set = set; - } - - /* package */ void added(SyncInfo info) { - addedResources.add(info); - } - - /* package */ void removed(IResource resource) { - removedResources.add(resource); - } - - /* package */ void changed(SyncInfo info) { - changedResources.add(info); - } - - public void removedRoot(IResource root) { - if (addedRoots.contains(root)) { - // The root was added and removed which is a no-op - addedRoots.remove(root); - } else { - // check if the root is a child of an existing root - // (in which case it need not be added). - // Also, remove any exisiting roots that are children - // of the new root - for (Iterator iter = removedRoots.iterator(); iter.hasNext();) { - IResource element = (IResource) iter.next(); - // check if the root is already in the list - if (root.equals(element)) return; - if (isParent(root, element)) { - // the root invalidates the current element - iter.remove(); - } else if (isParent(element, root)) { - // the root is a child of an existing element - return; - } - } - removedRoots.add(root); - } - } - - private boolean isParent(IResource root, IResource element) { - return root.getFullPath().isPrefixOf(element.getFullPath()); - } - - public void addedRoot(IResource parent) { - if (removedRoots.contains(parent)) { - // The root was re-added which is a no-op - removedRoots.remove(parent); - } else { - // TODO: May be added underneath another added root - addedRoots.add(parent); - } - - } - - public SyncInfo[] getAddedResources() { - return (SyncInfo[]) addedResources.toArray(new SyncInfo[addedResources.size()]); - } - - public IResource[] getAddedRoots() { - return (IResource[]) addedRoots.toArray(new IResource[addedRoots.size()]); - } - - public SyncInfo[] getChangedResources() { - return (SyncInfo[]) changedResources.toArray(new SyncInfo[changedResources.size()]); - } - - public IResource[] getRemovedResources() { - return (IResource[]) removedResources.toArray(new IResource[removedResources.size()]); - } - - public IResource[] getRemovedRoots() { - return (IResource[]) removedRoots.toArray(new IResource[removedRoots.size()]); - } - - public SyncSet getSet() { - return set; - } - - public void reset() { - reset = true; - } - - public boolean isReset() { - return reset; - } -} 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/sync/sets/SyncSetInput.java deleted file mode 100644 index 6bade21b9..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java +++ /dev/null @@ -1,89 +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.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; - -/** - * This is the superclass for all SyncSet input providers - */ -public abstract class SyncSetInput { - - private SyncSet syncSet = new SyncSet(); - private SyncInfoFilter filter = new SyncInfoFilter(); - - public SyncSet getSyncSet() { - return syncSet; - } - - /** - * This method is invoked from reset to get all the sync information from - * the input source. - */ - protected abstract void fetchInput(IProgressMonitor monitor) throws TeamException; - - /** - * The input is no longer being used. Disconnect it from its source. - */ - public abstract void disconnect(); - - /** - * Reset the input. This will clear the current contents of the sync set and - * obtain the contents from the input source. - */ - public void reset(IProgressMonitor monitor) throws TeamException { - try { - syncSet.beginInput(); - syncSet.reset(); - fetchInput(monitor); - } finally { - getSyncSet().endInput(); - } - } - - /** - * Collect the change in the provided sync info. - */ - protected void collect(SyncInfo info) { - boolean isOutOfSync = filter.select(info); - SyncInfo oldInfo = syncSet.getSyncInfo(info.getLocal()); - boolean wasOutOfSync = oldInfo != null; - if (isOutOfSync) { - if (wasOutOfSync) { - syncSet.changed(info); - } else { - syncSet.add(info); - } - } else if (wasOutOfSync) { - syncSet.remove(info.getLocal()); - } - } - - protected void remove(IResource resource) { - SyncInfo oldInfo = syncSet.getSyncInfo(resource); - boolean wasOutOfSync = oldInfo != null; - if (oldInfo != null) { - syncSet.remove(resource); - } - } - - public SyncInfoFilter getFilter() { - return filter; - } - - public void setFilter(SyncInfoFilter filter) { - this.filter = filter; - } -} 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/sync/sets/SyncSetInputFromSubscriber.java deleted file mode 100644 index d1bab0727..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSubscriber.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.sets; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.subscribers.TeamSubscriber; - -/** - * Records resource synchronization changes from a Team subscriber. The actual changes - * are calculated via the SubscriberEventHandler and stored in this input. - */ -public class SyncSetInputFromSubscriber extends SyncSetInput { - - private TeamSubscriber subscriber; - - public SyncSetInputFromSubscriber(TeamSubscriber subscriber) { - this.subscriber = subscriber; - } - - public void disconnect() { - } - - public TeamSubscriber getSubscriber() { - return subscriber; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.SyncSetInput#fetchInput(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void fetchInput(IProgressMonitor monitor) throws TeamException { - // don't calculate changes. The SubscriberEventHandler will fetch the - // input in a job and update this sync set when the changes are - // calculated. - } -} 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/sync/sets/SyncSetInputFromSyncSet.java deleted file mode 100644 index fc733927b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInputFromSyncSet.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.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; - -/** - * Ths class uses the contents of one sync set as the input of another. - */ -public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncSetChangedListener { - - SyncSet inputSyncSet; - - public SyncSetInputFromSyncSet(SyncSet set) { - this.inputSyncSet = set; - inputSyncSet.addSyncSetChangedListener(this); - } - - public SyncSet getInputSyncSet() { - return inputSyncSet; - } - - public void disconnect() { - if (inputSyncSet == null) return; - inputSyncSet.removeSyncSetChangedListener(this); - inputSyncSet = null; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.AbstractSyncSet#initialize(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - protected void fetchInput(IProgressMonitor monitor) throws TeamException { - if (inputSyncSet == null) return; - SyncInfo[] infos = inputSyncSet.allMembers(); - for (int i = 0; i < infos.length; i++) { - collect(infos[i]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - public void syncSetChanged(SyncSetChangedEvent event) { - SyncSet syncSet = getSyncSet(); - try { - syncSet.beginInput(); - if (event.isReset()) { - syncSet.reset(); - } - syncSetChanged(event.getChangedResources()); - syncSetChanged(event.getAddedResources()); - - remove(event.getRemovedResources()); - } finally { - getSyncSet().endInput(); - } - } - - private void syncSetChanged(SyncInfo[] infos) { - for (int i = 0; i < infos.length; i++) { - collect(infos[i]); - } - } - - private void remove(IResource[] resources) { - for (int i = 0; i < resources.length; i++) { - remove(resources[i]); - } - } -} 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/sync/sets/WorkingSetSyncSetInput.java deleted file mode 100644 index 5fdde5c4c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/WorkingSetSyncSetInput.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.sets; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.subscribers.TeamSubscriber; -import org.eclipse.ui.IWorkingSet; - -public class WorkingSetSyncSetInput extends SyncSetInputFromSyncSet { - - private SyncInfoWorkingSetFilter workingSetFilter = new SyncInfoWorkingSetFilter(); - - public WorkingSetSyncSetInput(SyncSet set) { - super(set); - setFilter(workingSetFilter); - } - - public void setWorkingSet(IWorkingSet workSet) { - workingSetFilter.setWorkingSet(workSet); - try { - reset(new NullProgressMonitor()); - } catch (TeamException e) { - // TODO: ?? - } - } - - public IWorkingSet getWorkingSet() { - return workingSetFilter.getWorkingSet(); - } - - public IResource[] roots(TeamSubscriber subscriber) { - return workingSetFilter.getRoots(subscriber); - } -} 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/sync/views/CompressedFolder.java deleted file mode 100644 index ab4e3e802..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolder.java +++ /dev/null @@ -1,52 +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.util.ArrayList; -import java.util.Arrays; -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; - -/** - * A compressed folder appears under a project and contains out-of-sync resources - */ -public class CompressedFolder extends SynchronizeViewNode { - - public CompressedFolder( SubscriberInput input, IResource resource) { - super(input, resource); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.SynchronizeViewNode#getOutOfSyncDescendants() - */ - public SyncInfo[] getChildSyncInfos() { - IResource[] children = getSyncSet().members(getResource()); - List result = new ArrayList(); - for (int i = 0; i < children.length; i++) { - IResource child = children[i]; - SyncInfo info = getSyncSet().getSyncInfo(child); - if (info != null) { - if (child.getType() == IResource.FOLDER) { - // for folders, add all out-of-sync children - // NOTE: the method getOutOfSyncDescendants includes the out-of-sync parent - result.addAll(Arrays.asList(getSyncSet().getOutOfSyncDescendants(child))); - } else { - // for files, just add the info - result.add(info); - } - } - } - return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]); - } -} 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/sync/views/CompressedFolderContentProvider.java deleted file mode 100644 index f9a40e8c0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/CompressedFolderContentProvider.java +++ /dev/null @@ -1,164 +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.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.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; - -/** - * The contents provider compressed in-sync folder paths - */ -public class CompressedFolderContentProvider extends SyncSetTreeContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceAdditions(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent) - */ - protected void handleResourceAdditions(SyncSetChangedEvent event) { - AbstractTreeViewer tree = getTreeViewer(); - if (tree != null) { - // TODO: For now, refresh any projects with additions - IResource[] roots = event.getAddedRoots(); - refreshProjects(tree, roots); - } else { - super.handleResourceAdditions(event); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent) - */ - protected void handleResourceRemovals(SyncSetChangedEvent event) { - AbstractTreeViewer tree = getTreeViewer(); - if (tree != null) { - // TODO: For now, refresh any projects with deletions - IResource[] roots = event.getRemovedRoots(); - refreshProjects(tree, roots); - } else { - super.handleResourceRemovals(event); - } - } - - private void refreshProjects(AbstractTreeViewer tree, IResource[] roots) { - if (roots.length == 0) return; - Set projects = new HashSet(); - for (int i = 0; i < roots.length; i++) { - if (roots[i].getType() == IResource.PROJECT) { - // when a project is involved, refresh the whole tree - tree.refresh(); - return; - } - projects.add(getModelObject(roots[i].getProject())); - } - for (Iterator iter = projects.iterator(); iter.hasNext();) { - Object element = (Object) iter.next(); - tree.refresh(element); - } - } - - public Object getParent(Object element) { - if (element instanceof CompressedFolder) { - // The parent of a compressed folder is always the project - return getModelObject(getResource(element).getProject()); - } - Object parent = super.getParent(element); - if (parent instanceof SynchronizeViewNode) { - SyncInfo info = ((SynchronizeViewNode)parent).getSyncInfo(); - if (info == null) { - // The resource is in-sync so return a compressed folder - IResource resource = ((SynchronizeViewNode)parent).getResource(); - if (resource.getType() == IResource.FOLDER) { - return new CompressedFolder((SubscriberInput)viewer.getInput(), resource); - - } - } - } - return parent; - } - - public Object[] getChildren(Object element) { - IResource resource = getResource(element); - if (resource != null) { - if (resource.getType() == IResource.PROJECT) { - return getProjectChildren((IProject)resource); - } else if (resource.getType() == IResource.FOLDER) { - return getFolderChildren(resource); - } - } - return super.getChildren(element); - } - - private Object[] getFolderChildren(IResource resource) { - // Folders will only contain out-of-sync children - IResource[] children = getSyncSet().members(resource); - List result = new ArrayList(); - for (int i = 0; i < children.length; i++) { - IResource child = children[i]; - SyncInfo info = getSyncSet().getSyncInfo(child); - if (info != null) { - result.add(getModelObject(info.getLocal())); - } - } - return (Object[]) result.toArray(new Object[result.size()]); - } - - private Object[] getProjectChildren(IProject project) { - SyncInfo[] outOfSync = getSyncSet().getOutOfSyncDescendants(project); - Set result = new HashSet(); - for (int i = 0; i < outOfSync.length; i++) { - SyncInfo info = outOfSync[i]; - IResource local = info.getLocal(); - if (local.getProjectRelativePath().segmentCount() == 1) { - // If the resource is a child of the project, include it uncompressed - result.add(getModelObject(local)); - } else { - IContainer container = getLowestInSyncParent(local); - if (container.getType() == IResource.FOLDER) { - result.add(getModelObject(container)); - } - } - } - return (Object[]) result.toArray(new Object[result.size()]); - } - - /** - * Return a compressed folder if the provided resource is an in-sync folder. - * Warning: This method will return a compressed folder for any in-sync - * folder, even those that do not contain out-of-sync resources (i.e. those that - * are not visible in the view). - */ - public Object getModelObject(IResource resource) { - if (resource.getType() == IResource.FOLDER && getSyncSet().getSyncInfo(resource) == null) { - return new CompressedFolder(getSubscriberInput(), resource); - } - return super.getModelObject(resource); - } - - private IContainer getLowestInSyncParent(IResource resource) { - if (resource.getType() == IResource.ROOT) return (IContainer)resource; - IContainer parent = resource.getParent(); - if (getSyncSet().getSyncInfo(parent) == null) { - return parent; - } - return getLowestInSyncParent(parent); - } - -} 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/sync/views/INavigableControl.java deleted file mode 100644 index 1c5506c74..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.sync.views; - -public interface INavigableControl { - - /** - * Direction to naviate - */ - final public static int NEXT = 1; - final public static int PREVIOUS = 2; - - /** - * 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/sync/views/SyncSetContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java deleted file mode 100644 index ddea777a8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java +++ /dev/null @@ -1,271 +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.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -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; - -/** - * 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() { - SubscriberInput input = getSubscriberInput(); - if (input == null) { - return null; - } - return ((SubscriberInput)input).getFilteredSyncSet(); - } - - protected SubscriberInput getSubscriberInput() { - if(viewer == null || viewer.getControl().isDisposed()) { - return null; - } - return (SubscriberInput)viewer.getInput(); - } - - /* (non-Javadoc) - * @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; - - if (oldInput instanceof SubscriberInput) { - oldSubscriberInput = (SubscriberInput) oldInput; - } - if (newInput instanceof SubscriberInput) { - newSubscriberInput = (SubscriberInput) newInput; - } - if (oldSubscriberInput != newSubscriberInput) { - if (oldSubscriberInput != null) { - ((SubscriberInput)oldSubscriberInput).getFilteredSyncSet().removeSyncSetChangedListener(this); - } - if (newSubscriberInput != null) { - ((SubscriberInput)newSubscriberInput).getFilteredSyncSet().addSyncSetChangedListener(this); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public abstract Object[] getElements(Object inputElement); - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() { - SubscriberInput input = getSubscriberInput(); - if (input != null) { - input.getFilteredSyncSet().removeSyncSetChangedListener(this); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - public void syncSetChanged(final SyncSetChangedEvent event) { - final Control ctrl = viewer.getControl(); - if (ctrl != null && !ctrl.isDisposed()) { - ctrl.getDisplay().asyncExec(new Runnable() { - public void run() { - if(! ctrl.isDisposed()) - handleSyncSetChanges(event); - } - }); - } - } - - /** - * Update the viewer with the sync-set changes, aditions and removals - * in the given event. This method is invoked from within the UI thread. - * @param event - */ - protected void handleSyncSetChanges(SyncSetChangedEvent event) { - viewer.getControl().setRedraw(false); - if (event.isReset()) { - // On a reset, refresh the entire view - ((StructuredViewer) viewer).refresh(); - } else { - handleResourceChanges(event); - handleResourceRemovals(event); - handleResourceAdditions(event); - } - viewer.getControl().setRedraw(true); - } - - /** - * Update the viewer for the sync set changes in the provided event. - * This method is invoked by <code>handleSyncSetChanges</code>. - * Subclasses may override. - * @param event - * @see #handleSyncSetChanges(SyncSetChangedEvent) - */ - protected void handleResourceChanges(SyncSetChangedEvent event) { - // Refresh the viewer for each changed resource - SyncInfo[] infos = event.getChangedResources(); - for (int i = 0; i < infos.length; i++) { - ((StructuredViewer) viewer).refresh(getModelObject(infos[i].getLocal()), true); - } - } - - /** - * Update the viewer for the sync set removals in the provided event. - * This method is invoked by <code>handleSyncSetChanges</code>. - * Subclasses may override. - * @param event - */ - protected void handleResourceRemovals(SyncSetChangedEvent event) { - // Update the viewer for each removed resource - IResource[] removed = event.getRemovedRoots(); - for (int i = 0; i < removed.length; i++) { - IResource resource = removed[i]; - ((StructuredViewer) viewer).refresh(getModelObject(resource)); - } - } - - /** - * Update the viewer for the sync set additions in the provided event. - * This method is invoked by <code>handleSyncSetChanges</code>. - * Subclasses may override. - * @param event - */ - protected void handleResourceAdditions(SyncSetChangedEvent event) { - // Update the viewer for each of the added resource's parents - IResource[] added = event.getAddedRoots(); - for (int i = 0; i < added.length; i++) { - IResource resource = added[i]; - ((StructuredViewer) viewer).refresh(getModelObject(resource.getParent())); - } - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - if(selection.size() == 0) { - if(viewer instanceof INavigableControl) { - ((INavigableControl)viewer).gotoDifference(INavigableControl.NEXT); - } - } - } - - 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. - */ - public Object[] members(IResource resource) { - IResource[] resources = getSubscriberInput().getFilteredSyncSet().members(resource); - Object[] result = new Object[resources.length]; - for (int i = 0; i < resources.length; i++) { - IResource child = resources[i]; - result[i] = getModelObject(child); - } - return result; - } - - /** - * Return the SyncInfo for the given model object that was returned by - * SyncSet#members(IResource). If syncSet is null, then the - * sync info will also be null. - * - * @param element - * @return - */ - public SyncInfo getSyncInfo(Object element) { - if (element instanceof SyncInfo) { - return ((SyncInfo) element); - } else if (element instanceof SynchronizeViewNode) { - SynchronizeViewNode syncResource = (SynchronizeViewNode)element; - return syncResource.getSyncInfo(); - } - return null; - } - - /** - * Get the model object (SyncSet, SyncInfo or SyncContainer) that is the - * parent of the given model object. - * - * @param syncSet - * @param object - * @return - */ - public Object getParent(Object object) { - IResource resource = getResource(object); - if (resource == null) return null; - IContainer parent = resource.getParent(); - return getModelObject(parent); - } - - /** - * Return the model object for the given IResource. - * @param resource - */ - public Object getModelObject(IResource resource) { - if (resource.getType() == IResource.ROOT) { - return getSubscriberInput(); - } else { - return new SynchronizeViewNode(getSubscriberInput(), resource); - } - } - - protected Object[] getModelObjects(IResource[] resources) { - Object[] result = new Object[resources.length]; - for (int i = 0; i < resources.length; i++) { - result[i] = getModelObject(resources[i]); - } - return result; - } -} 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/sync/views/SyncSetTableContentProvider.java deleted file mode 100644 index 7f743d7e5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTableContentProvider.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.core.resources.IResource; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.internal.ui.sync.sets.*; - -/** - * This class provides the contents for a TableViewer using a SyncSet as the model - */ -public class SyncSetTableContentProvider extends SyncSetContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object element) { - SyncInfo[] infos = getSyncSet().allMembers(); - return getModelObjects(infos); - } - - public TableViewer getTableViewer() { - if (viewer instanceof TableViewer) { - return (TableViewer)viewer; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#handleResourceAdditions(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - protected void handleResourceAdditions(SyncSetChangedEvent event) { - TableViewer table = getTableViewer(); - if (table != null) { - SyncInfo[] infos = event.getAddedResources(); - table.add(getModelObjects(infos)); - } else { - super.handleResourceAdditions(event); - } - - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - protected void handleResourceRemovals(SyncSetChangedEvent event) { - TableViewer table = getTableViewer(); - if (table != null) { - IResource[] resources = event.getRemovedResources(); - table.remove(getModelObjects(resources)); - } else { - super.handleResourceRemovals(event); - } - } - - protected Object getModelObject(SyncInfo info) { - return getModelObject(info.getLocal()); - } - - protected Object[] getModelObjects(SyncInfo[] infos) { - Object[] resources = new Object[infos.length]; - for (int i = 0; i < resources.length; i++) { - resources[i] = getModelObject(infos[i]); - } - return resources; - } -} 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/sync/views/SyncSetTreeContentProvider.java deleted file mode 100644 index 15278c5cd..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java +++ /dev/null @@ -1,114 +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.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.*; - -/** - * This class provides the contents for a AbstractTreeViewer using a SyncSet as the model - */ -public class SyncSetTreeContentProvider extends SyncSetContentProvider implements ITreeContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ - public Object[] getChildren(Object element) { - IResource resource = getResource(element); - if (resource != null) { - return members(resource); - } else if (element instanceof SubscriberInput) { - return members(ResourcesPlugin.getWorkspace().getRoot()); - } - return new Object[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ - public Object getParent(Object element) { - IResource resource = getResource(element); - if (resource == null) return null; - IContainer parent = resource.getParent(); - return getModelObject(parent); - } - - public AbstractTreeViewer getTreeViewer() { - if (viewer instanceof AbstractTreeViewer) { - return (AbstractTreeViewer)viewer; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#handleResourceAdditions(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - protected void handleResourceAdditions(SyncSetChangedEvent event) { - AbstractTreeViewer tree = getTreeViewer(); - if (tree != null) { - IResource[] added = event.getAddedRoots(); - // TODO: Should group added roots by their parent - for (int i = 0; i < added.length; i++) { - IResource resource = added[i]; - Object parent; - if (resource.getType() == IResource.PROJECT) { - parent = getSubscriberInput(); - } else { - parent = getModelParent(resource); - } - Object element = getModelObject(resource); - tree.add(parent, element); - } - } else { - super.handleResourceAdditions(event); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - protected void handleResourceRemovals(SyncSetChangedEvent event) { - AbstractTreeViewer tree = getTreeViewer(); - if (tree != null) { - IResource[] roots = event.getRemovedRoots(); - if (roots.length == 0) return; - Object[] modelRoots = new Object[roots.length]; - for (int i = 0; i < modelRoots.length; i++) { - modelRoots[i] = getModelObject(roots[i]); - } - tree.remove(modelRoots); - } else { - super.handleResourceRemovals(event); - } - } - - protected Object getModelParent(IResource resource) { - return getModelObject(resource.getParent()); - } -} 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/sync/views/SyncTableViewer.java deleted file mode 100644 index 19b06b1ea..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java +++ /dev/null @@ -1,51 +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.jface.viewers.TableViewer; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Table; - -public class SyncTableViewer extends TableViewer implements INavigableControl { - - public SyncTableViewer(Table table) { - super(table); - } - - public boolean gotoDifference(int direction) { - Control c = getControl(); - - if (!(c instanceof Table)) - return false; - - Table table = (Table)c; - int inc = direction == NEXT ? 1 : -1; - int total = table.getItemCount(); - int next = table.getSelectionIndex() + inc; - if(next >= total || next < 0) { - return true; - } - table.setSelection(next); - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#preserveSelection(int) - */ - public void preserveState(int direction) { - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#restoreSelection(int) - */ - public void restoreState(int direction) { - } -} 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/sync/views/SyncTreeViewer.java deleted file mode 100644 index e6bc3a2a0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java +++ /dev/null @@ -1,272 +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.util.ArrayList; - -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.swt.events.DisposeEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -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; - -/** - * Subclass of TreeViewer which handles decorator events properly. We should not need to create - * a subclass just for this! - */ -public class SyncTreeViewer extends TreeViewer implements INavigableControl { - - /** - * Change the tree layout between using compressed folders and regular folders - * when the user setting is changed. - */ - private IPropertyChangeListener propertyListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) { - setTreeViewerContentProvider(); - } - } - }; - - public SyncTreeViewer(Composite parent, int style) { - super(parent, style); - getStore().addPropertyChangeListener(propertyListener); - setTreeViewerContentProvider(); - } - - private void setTreeViewerContentProvider() { - if (getStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) { - setContentProvider(new CompressedFolderContentProvider()); - } else { - setContentProvider(new SyncSetTreeContentProvider()); - } - } - - /** - * Return the preference store for this plugin. - * @return IPreferenceStore for this plugin - */ - private IPreferenceStore getStore() { - return TeamUIPlugin.getPlugin().getPreferenceStore(); - } - - protected void handleLabelProviderChanged(LabelProviderChangedEvent event) { - Object[] changed= event.getElements(); - if (changed != null && getInput() != null) { - ArrayList others= new ArrayList(); - for (int i= 0; i < changed.length; i++) { - Object curr = changed[i]; - if (curr instanceof IResource) { - IContentProvider provider = getContentProvider(); - if (provider != null && provider instanceof SyncSetContentProvider) { - curr = ((SyncSetContentProvider)provider).getModelObject((IResource)curr); - } - } - others.add(curr); - } - if (others.isEmpty()) { - return; - } - event= new LabelProviderChangedEvent((IBaseLabelProvider) event.getSource(), others.toArray()); - } - super.handleLabelProviderChanged(event); - } - - /** - * Cleanup listeners and call super for content provider and label provider disposal. - */ - protected void handleDispose(DisposeEvent event) { - super.handleDispose(event); - getStore().removePropertyChangeListener(propertyListener); - } - - /** - * Selects the next (or previous) node of the current selection. - * If there is no current selection the first (last) node in the tree is selected. - * Wraps around at end or beginning. - * Clients may override. - * - * @param next if <code>true</code> the next node is selected, otherwise the previous node - */ - public boolean gotoDifference(int direction) { - boolean next = direction == INavigableControl.NEXT ? true : false; - return internalNavigate(next, false); - } - - /** - * Selects the next (or previous) node of the current selection. - * If there is no current selection the first (last) node in the tree is selected. - * Wraps around at end or beginning. - * Clients may override. - * - * @param next if <code>true</code> the next node is selected, otherwise the previous node - * @return <code>true</code> if at end (or beginning) - */ - private boolean internalNavigate(boolean next, boolean fireOpen) { - - Control c= getControl(); - if (!(c instanceof Tree)) - return false; - - Tree tree= (Tree) c; - TreeItem item= null; - TreeItem children[]= tree.getSelection(); - if (children != null && children.length > 0) - item= children[0]; - if (item == null) { - children= tree.getItems(); - if (children != null && children.length > 0) { - item= children[0]; - if (item != null && item.getItemCount() <= 0) { - internalSetSelection(item, fireOpen); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 - return false; - } - } - } - - while (true) { - item= findNextPrev(item, next); - if (item == null) - break; - if (item.getItemCount() <= 0) - break; - } - - if (item != null) { - internalSetSelection(item, fireOpen); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 - return false; - } - return true; - } - - private TreeItem findNextPrev(TreeItem item, boolean next) { - - if (item == null) - return null; - - TreeItem children[]= null; - - if (!next) { - - TreeItem parent= item.getParentItem(); - if (parent != null) - children= parent.getItems(); - else - children= item.getParent().getItems(); - - if (children != null && children.length > 0) { - // goto previous child - int index= 0; - for (; index < children.length; index++) - if (children[index] == item) - break; - - if (index > 0) { - - item= children[index-1]; - - while (true) { - createChildren(item); - int n= item.getItemCount(); - if (n <= 0) - break; - - item.setExpanded(true); - item= item.getItems()[n-1]; - } - - // previous - return item; - } - } - - // go up - return parent; - - } else { - item.setExpanded(true); - createChildren(item); - - if (item.getItemCount() > 0) { - // has children: go down - children= item.getItems(); - return children[0]; - } - - while (item != null) { - children= null; - TreeItem parent= item.getParentItem(); - if (parent != null) - children= parent.getItems(); - else - children= item.getParent().getItems(); - - if (children != null && children.length > 0) { - // goto next child - int index= 0; - for (; index < children.length; index++) - if (children[index] == item) - break; - - if (index < children.length-1) { - // next - return children[index+1]; - } - } - - // go up - item= parent; - } - } - - return item; - } - - private void internalSetSelection(TreeItem ti, boolean fireOpen) { - if (ti != null) { - Object data= ti.getData(); - if (data != null) { - // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 - ISelection selection= new StructuredSelection(data); - setSelection(selection, true); - ISelection currentSelection= getSelection(); - if (fireOpen && currentSelection != null && selection.equals(currentSelection)) { - fireOpen(new OpenEvent(this, selection)); - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#preserveState(int) - */ - public void preserveState(int direction) { - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#restoreState(int) - */ - public void restoreState(int direction) { - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java deleted file mode 100644 index 546c3c61e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.eclipse.team.internal.ui.sync.views; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.DecoratingLabelProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.internal.WorkbenchPlugin; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * The SyncViewerLabelProvider can be used in either a tree or table. - */ -public class SyncViewerLabelProvider extends LabelProvider implements ITableLabelProvider { - - //column constants - private static final int COL_RESOURCE = 0; - private static final int COL_PARENT = 1; - - private Image compressedFolderImage; - - // Keep track of the compare and workbench image providers - // so they can be properly disposed - CompareConfiguration compareConfig = new CompareConfiguration(); - WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider(); - - /** - * @return - */ - public Image getCompressedFolderImage() { - if (compressedFolderImage == null) { - compressedFolderImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER).createImage(); - } - return compressedFolderImage; - } - - /** - * Returns a sync view label provider that is hooked up to the decorator - * mechanism. - * - * @return a new <code>DecoratingLabelProvider</code> which wraps a <code> - * new <code>WorkbenchLabelProvider</code> - */ - public static ILabelProvider getDecoratingLabelProvider() { - return new DecoratingLabelProvider( - new SyncViewerLabelProvider(), - WorkbenchPlugin - .getDefault() - .getWorkbench() - .getDecoratorManager() - .getLabelDecorator()); - } - - public SyncViewerLabelProvider() { - } - - public String getText(Object element) { - if (element instanceof CompressedFolder) { - IResource resource = getResource(element); - return resource.getProjectRelativePath().toString(); - } - IResource resource = getResource(element); - return workbenchLabelProvider.getText(resource); - } - - public Image getImage(Object element) { - if (element instanceof CompressedFolder) { - return compareConfig.getImage(getCompressedFolderImage(), 0); - } - IResource resource = getResource(element); - int kind = getSyncKind(element); - switch (kind & IRemoteSyncElement.DIRECTION_MASK) { - case IRemoteSyncElement.OUTGOING: - kind = (kind &~ IRemoteSyncElement.OUTGOING) | IRemoteSyncElement.INCOMING; - break; - case IRemoteSyncElement.INCOMING: - kind = (kind &~ IRemoteSyncElement.INCOMING) | IRemoteSyncElement.OUTGOING; - break; - } - Image image = workbenchLabelProvider.getImage(resource); - return compareConfig.getImage(image, kind); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() - */ - public void dispose() { - super.dispose(); - workbenchLabelProvider.dispose(); - compareConfig.dispose(); - if (compressedFolderImage != null) - compressedFolderImage.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) - */ - public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex == COL_RESOURCE) { - return getImage(element); - } else if (columnIndex == COL_PARENT) { - IResource resource = getResource(element); - return null; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - public String getColumnText(Object element, int columnIndex) { - if (columnIndex == COL_RESOURCE) { - return getText(element); - } else if (columnIndex == COL_PARENT) { - IResource resource = getResource(element); - return resource.getParent().getFullPath().toString(); - } - return null; - } - - private IResource getResource(Object obj) { - return (IResource)TeamAction.getAdapter(obj, IResource.class); - } - - private SyncInfo getSyncInfo(Object obj) { - return (SyncInfo)TeamAction.getAdapter(obj, SyncInfo.class); - } - - private int getSyncKind(Object element) { - SyncInfo info = getSyncInfo(element); - if (info != null) { - return info.getKind(); - } - return 0; - } -}
\ No newline at end of file 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/sync/views/SyncViewerSorter.java deleted file mode 100644 index 8aa32940b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerSorter.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.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; - -/** - * This class sorts the model elements that appear in the SynchronizeView - */ -public class SyncViewerSorter extends ResourceSorter { - - public SyncViewerSorter(int criteria) { - super(criteria); - } - - /* (non-Javadoc) - * Method declared on ViewerSorter. - */ - public int compare(Viewer viewer, Object o1, Object o2) { - return super.compare(viewer, getResource(o1), getResource(o2)); - } - - protected IResource getResource(Object obj) { - return (IResource)TeamAction.getAdapter(obj, IResource.class); - } -} 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/sync/views/SyncViewerTableSorter.java deleted file mode 100644 index 37ae0e705..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerTableSorter.java +++ /dev/null @@ -1,158 +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.core.resources.IResource; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.team.internal.ui.IPreferenceIds; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.views.navigator.ResourceSorter; - -/** - * Provides support for sorting the table viewer of the SynchronizeView by column - */ -public class SyncViewerTableSorter extends SyncViewerSorter { - - private boolean reversed; - private int columnNumber; - - //column constants - public static final int COL_NAME = 0; - public static final int COL_PARENT = 1; - - // column headings: "Revision" "Tags" "Date" "Author" "Comment" - private int[][] SORT_ORDERS_BY_COLUMN = { - {COL_NAME, COL_PARENT}, /* name */ - {COL_PARENT, COL_NAME} /* parent */ - }; - - /** - * Return a listener that will change the sorter in the table when the column header - * is clicked. - */ - public static SelectionListener getColumnListener(final TableViewer tableViewer) { - /** - * This class handles selections of the column headers. - * Selection of the column header will cause resorting - * of the shown tasks using that column's sorter. - * Repeated selection of the header will toggle - * sorting order (ascending versus descending). - */ - return new SelectionAdapter() { - /** - * Handles the case of user selecting the - * header area. - * <p>If the column has not been selected previously, - * it will set the sorter of that column to be - * the current tasklist sorter. Repeated - * presses on the same column header will - * toggle sorting order (ascending/descending). - */ - public void widgetSelected(SelectionEvent e) { - // column selected - need to sort - int column = tableViewer.getTable().indexOf((TableColumn) e.widget); - SyncViewerTableSorter oldSorter = (SyncViewerTableSorter)tableViewer.getSorter(); - if (oldSorter != null && column == oldSorter.getColumnNumber()) { - SyncViewerTableSorter.getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED, !oldSorter.isReversed()); - oldSorter.setReversed(!oldSorter.isReversed()); - tableViewer.refresh(); - } else { - SyncViewerTableSorter.getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT, column); - SyncViewerTableSorter.getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED, false); - tableViewer.setSorter(new SyncViewerTableSorter()); - } - } - }; - } - - public SyncViewerTableSorter() { - super(ResourceSorter.NAME); - - this.columnNumber = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT); - this.reversed = getStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public int compare(Viewer viewer, Object e1, Object e2) { - - IResource resource1 = getResource(e1); - IResource resource2 = getResource(e2); - int result = 0; - if (resource1 == null || resource2 == null) { - result = super.compare(viewer, e1, e2); - } else { - int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber]; - for (int i = 0; i < columnSortOrder.length; ++i) { - result = compareColumnValue(columnSortOrder[i], resource1, resource2); - if (result != 0) - break; - } - } - if (reversed) - result = -result; - return result; - } - - /** - * Compares two resources, based only on the value of the specified column. - */ - int compareColumnValue(int columnNumber, IResource e1, IResource e2) { - switch (columnNumber) { - case COL_NAME: /* revision */ - - // Category behavior from superclass - int cat1 = category(e1); - int cat2 = category(e2); - - if (cat1 != cat2) - return cat1 - cat2; - - // cat1 == cat2 - - return getCollator().compare(e1.getName(), e2.getName()); - case COL_PARENT: /* parent */ - return getCollator().compare(e1.getParent().getFullPath().toString(), e2.getParent().getFullPath().toString()); - default: - return 0; - } - } - /** - * Returns the number of the column by which this is sorting. - */ - public int getColumnNumber() { - return columnNumber; - } - /** - * Returns true for descending, or false - * for ascending sorting order. - */ - public boolean isReversed() { - return reversed; - } - /** - * Sets the sorting order. - */ - public void setReversed(boolean newReversed) { - reversed = newReversed; - } - - private static IPreferenceStore getStore() { - return TeamUIPlugin.getPlugin().getPreferenceStore(); - } -} 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 1c43813d5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java +++ /dev/null @@ -1,871 +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.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jface.action.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.StructuredSelection; -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.graphics.Image; -import org.eclipse.swt.layout.GridData; -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.SyncInfo; -import org.eclipse.team.core.subscribers.TeamDelta; -import org.eclipse.team.core.subscribers.TeamProvider; -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.RefreshSubscriberInputJob; -import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob; -import org.eclipse.team.internal.ui.sync.actions.OpenInCompareAction; -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.ISharedImages; -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.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.IWorkbenchPart; -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; - - //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 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; - private SubscriberInput lastInput = null; - - // Stats about the current subscriber. This is used for status line and/or title updating - private ViewStatusInformation statusInformation; - - // A set of common actions. They are hooked to the active SubscriberInput and must - // be reset when the input changes. - private SyncViewerActions actions; - - // View images, registered with the plugin and disposed on shutdown. - private Image refreshingImg; - private Image initialImg; - private Image viewImage; - - /** - * Constructs a new SynchronizeView. - */ - public SynchronizeView() { - currentViewType = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TYPE); - if (currentViewType != TREE_VIEW) { - currentViewType = TABLE_VIEW; - } - } - /*(non-Javadoc) - * Overriden to return a title image to show that a background refresh is being run. - * @see org.eclipse.ui.IWorkbenchPart#getTitleImage() - */ - public Image getTitleImage() { - return viewImage; - } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - public void createPartControl(Composite parent) { - createViewer(parent); - this.composite = parent; - - initializeActions(); - contributeToActionBars(); - - // Register for addition/removal of subscribers - TeamProvider.addListener(this); - TeamSubscriber[] subscribers = TeamProvider.getSubscribers(); - for (int i = 0; i < subscribers.length; i++) { - TeamSubscriber subscriber = subscribers[i]; - addSubscriber(subscriber); - } - - // initialize images - initialImg = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW).createImage(); - refreshingImg = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_CATCHUP).createImage(); - TeamUIPlugin.disposeOnShutdown(initialImg); - TeamUIPlugin.disposeOnShutdown(refreshingImg); - setViewImage(initialImg); - - updateTitle(); - - initializeJobListener(); - 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); - this.lastInput = this.input; - this.input = input; - - // listen to sync set changes in order to update state relating to the - // size of the sync sets and update the title - if(lastInput != null) { - lastInput.getWorkingSetSyncSet().removeSyncSetChangedListener(this); - lastInput.getFilteredSyncSet().removeSyncSetChangedListener(this); - lastInput.getSubscriberSyncSet().removeSyncSetChangedListener(this); - } - input.getWorkingSetSyncSet().removeSyncSetChangedListener(this); - input.getFilteredSyncSet().addSyncSetChangedListener(this); - input.getSubscriberSyncSet().addSyncSetChangedListener(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); - gotoDifference(INavigableControl.NEXT); - } - }); - updateTitle(); - } - /** - * 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); - } - } - /** - * Listen to background refresh jobs to update the title image. Although - * the progres view is available, this gives the user direct feedback that the - * refresh is underway. - * Note: This may not be a good UI practice. - */ - protected void initializeJobListener() { - // add listeners - Platform.getJobManager().addJobChangeListener(new JobChangeAdapter() { - public void done(IJobChangeEvent event) { - if(event.getJob().belongsTo(RefreshSubscriberJob.getFamily())) { - setViewImage(initialImg); - } - } - - public void running(IJobChangeEvent event) { - if(event.getJob().belongsTo(RefreshSubscriberJob.getFamily())) { - setViewImage(refreshingImg); - } - } - }); - } - /** - * 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); - } - /** - * Changes the image for the view. A change event is generated such that getTitleImage - * will be called to get the new image and display it. - * @param image the new image - */ - protected void setViewImage(Image image) { - viewImage = image; - fireSafePropertyChange(IWorkbenchPart.PROP_TITLE); - } - - 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 { - switch(currentViewType) { - case TREE_VIEW: - createTreeViewerPartControl(parent); - break; - case TABLE_VIEW: - createTableViewerPartControl(parent); - break; - } - viewer.setInput(input); - viewer.getControl().setFocus(); - hookContextMenu(); - initializeListeners(); - } - } - - protected void createTreeViewerPartControl(Composite parent) { - viewer = new SyncTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setLabelProvider(SyncViewerLabelProvider.getDecoratingLabelProvider()); - viewer.setSorter(new SyncViewerSorter(ResourceSorter.NAME)); - } - - 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) { - 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); - } - } - /* - * Synchronize - (showing N of M changes) - {Subscriber name} - */ - protected void updateTitle() { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - SubscriberInput input = getInput(); - if(input != null) { - ViewStatusInformation newStatus = new ViewStatusInformation(input); - if(statusInformation == null || ! statusInformation.equals(newStatus)) { - statusInformation = newStatus; - - TeamSubscriber subscriber = input.getSubscriber(); - String changesText; - if(input.getWorkingSet() != null) { - changesText = Policy.bind("LiveSyncView.titleChangeNumbers", //$NON-NLS-1$ - new Long(statusInformation.getNumShowing()).toString(), - new Long(statusInformation.getNumInWorkingSet()).toString(), - new Long(statusInformation.getNumInWorkspace() - statusInformation.getNumInWorkingSet()).toString()); - } else { - changesText = Policy.bind("LiveSyncView.titleChangeNumbersNoWorkingSet", //$NON-NLS-1$ - new Long(statusInformation.getNumShowing()).toString(), - new Long(statusInformation.getNumInWorkingSet()).toString()); - } - String title = Policy.bind("LiveSyncView.titleWithSubscriber", new String[] {Policy.bind("LiveSyncView.title"), changesText, subscriber.getName()}); //$NON-NLS-1$ //$NON-NLS-2$ - setTitle(title); - StringBuffer b = new StringBuffer(title + "\n"); //$NON-NLS-1$ - b.append(input.getSubscriberSyncSet().getStatistics().toString()); - setTitleToolTip(b.toString()); - } - } else { - setTitle(Policy.bind("LiveSyncView.title")); //$NON-NLS-1$ - 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 - TeamProvider.removeListener(this); - for (Iterator it = subscriberInputs.values().iterator(); it.hasNext();) { - SubscriberInput input = (SubscriberInput) it.next(); - input.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); - } else if(delta.getFlags() == TeamDelta.SUBSCRIBER_DELETED) { - TeamSubscriber s = delta.getSubscriber(); - removeSubscriber(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 private 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()); - - if (si == input && lastInput != null) { - // show last input - initializeSubscriberInput(lastInput); - } - } - - 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() { - ISelection selection = getViewer().getSelection(); - if (! selection.isEmpty() && viewer instanceof AbstractTreeViewer) { - // For a tree, selection should be deep and only include out-of-sync resources - Object[] selected = ((IStructuredSelection)selection).toArray(); - Set result = new HashSet(); - for (int i = 0; i < selected.length; i++) { - Object object = selected[i]; - if (object instanceof SynchronizeViewNode) { - SynchronizeViewNode syncResource = (SynchronizeViewNode) object; - SyncInfo[] infos = syncResource.getChildSyncInfos(); - result.addAll(Arrays.asList(infos)); - } - } - selection = new StructuredSelection((Object[]) result.toArray(new Object[result.size()])); - } - return selection; - } - - /** - * 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) { - 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 (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) { - updateTitle(); - - // remove opened compare editors if file was removed from sync view and update if changed - IResource[] resources =event.getRemovedResources(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - OpenInCompareAction.closeCompareEditorFor(this, resource); - } - } - - 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 - } - } - - public boolean gotoDifference(int direction) { - if(viewer instanceof INavigableControl) { - return ((INavigableControl)viewer).gotoDifference(direction); - } - return false; - } - - 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); - updateTitle(); - } - /** - * 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$ - } - } -}
\ No newline at end of file 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/sync/views/SynchronizeViewNode.java deleted file mode 100644 index 782c91134..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeViewNode.java +++ /dev/null @@ -1,132 +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.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; - -/** - * A SynchronizeViewNode instance appears in the Synchronize View. Actions contributed to - * the view can use these instances to determine the set of resources - * shown based on the current filter applied to the view. - * <p> - * @see org.eclipse.team.ui.sync.ISynchronizeViewNode - */ -public class SynchronizeViewNode implements IAdaptable, IActionFilter, ISynchronizeViewNode { - - private IResource resource; - private SubscriberInput input; - - /** - * Construct a SynchromizeViewNode - * @param input The SubscriberInput for the node. - * @param resource The resource for the node - */ - public SynchronizeViewNode(SubscriberInput input, IResource resource) { - this.input = input; - this.resource = resource; - } - - protected SyncSet getSyncSet() { - return input.getFilteredSyncSet(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeViewNode#getTeamSubscriber() - */ - public TeamSubscriber getTeamSubscriber() { - return input.getSubscriber(); - } - - /* (non-Javadoc) - * @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) { - return getSyncInfo(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeViewNode#getSyncInfo() - */ - public SyncInfo getSyncInfo() { - return getSyncSet().getSyncInfo(resource); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeViewNode#getChildSyncInfos() - */ - public SyncInfo[] getChildSyncInfos() { - return getSyncSet().getOutOfSyncDescendants(resource); - } - - /** - * Return true if the receiver's TeamSubscriber and Resource are equal to that of object. - * @param object The object to test - * @return true has the same subsriber and resource - */ - public boolean equals(Object object) { - if (object instanceof SynchronizeViewNode) { - SynchronizeViewNode syncViewNode = (SynchronizeViewNode) object; - return getTeamSubscriber().equals(syncViewNode.getTeamSubscriber()) && - getResource().equals(syncViewNode.getResource()); - } - return super.equals(object); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getResource().hashCode() | getTeamSubscriber().hashCode(); - } - - /** - * @return IResource The receiver's resource - */ - public IResource getResource() { - return resource; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return "SynchronizeViewNode for " + getResource().getFullPath().toString(); - } - - /* (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/sync/views/TeamSynchronizingPerspective.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/TeamSynchronizingPerspective.java deleted file mode 100644 index 7d40e29d9..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/TeamSynchronizingPerspective.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.sync.views; - -import org.eclipse.ui.IFolderLayout; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IPerspectiveFactory; - -public class TeamSynchronizingPerspective implements IPerspectiveFactory { - - public final static String ID = "org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective"; //$NON-NLS-1$ - - /* (Non-javadoc) - * Method declared on IPerpsectiveFactory - */ - public void createInitialLayout(IPageLayout layout) { - defineActions(layout); - defineLayout(layout); - } - - /** - * Defines the initial actions for a page. - */ - public void defineActions(IPageLayout layout) { - - // Add "new wizards". - layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project"); //$NON-NLS-1$ - layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$ - layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); //$NON-NLS-1$ - - // Add "show views". - layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); - layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); - layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); - layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); - layout.addShowViewShortcut(SynchronizeView.VIEW_ID); - - layout.addActionSet("org.eclipse.team.ui.actionSet"); //$NON-NLS-1$ - } - - /** - * Defines the initial layout for a page. - */ - public void defineLayout(IPageLayout layout) { - String editorArea = layout.getEditorArea(); - IFolderLayout top = layout.createFolder("top", IPageLayout.LEFT, 0.25f, editorArea); //$NON-NLS-1$ - top.addView(SynchronizeView.VIEW_ID); - top.addView(IPageLayout.ID_RES_NAV); - top.addView(IPageLayout.ID_OUTLINE); - layout.setEditorAreaVisible(true); - } -} 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 e09f6d150..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/ViewStatusInformation.java +++ /dev/null @@ -1,70 +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; - - ViewStatusInformation(SubscriberInput input) { - this.subscriberName = input.getSubscriber().getName(); - 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 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/target/AuthenticatedTargetSitePropertiesPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java deleted file mode 100644 index eff28731e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java +++ /dev/null @@ -1,104 +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.target; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.AuthenticatedSite; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.dialogs.PropertyPage; - -public class AuthenticatedTargetSitePropertiesPage extends PropertyPage { - public static final int WIDTH_HINT = 250; - - private Site site; - private Text nameText, passwordText; - - /** - * Initializes the page - */ - private void initialize() { - IAdaptable element = getElement(); - if (element instanceof SiteElement) { - site = ((SiteElement)element).getSite(); - } else { - SiteElement adapter = (SiteElement)element.getAdapter(SiteElement.class); - if (adapter != null) { - site = adapter.getSite(); - } - } - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - initialize(); - Composite container = new Composite(parent, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - - Label serverLabel = new Label(container, SWT.NONE); - serverLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.Server")); //$NON-NLS-1$ - serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Label serverText = new Label(container, SWT.NONE); - serverText.setText(site.getURL().getHost()); - GridData data = new GridData(); - data.widthHint = WIDTH_HINT; - serverText.setLayoutData(data); - - Label nameLabel = new Label(container, SWT.NONE); - nameLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.User")); //$NON-NLS-1$ - nameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - nameText = new Text(container, SWT.SINGLE | SWT.BORDER); - data = new GridData(); - data.widthHint = WIDTH_HINT; - nameText.setLayoutData(data); - String name=((AuthenticatedSite)site).getUsername(); - if (name!=null) nameText.setText(name); - - Label passwordLabel = new Label(container, SWT.NONE); - passwordLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.Password")); //$NON-NLS-1$ - passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - passwordText = new Text(container, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); - passwordText.setText(""); //$NON-NLS-1$ - data = new GridData(); - data.widthHint = WIDTH_HINT; - passwordText.setLayoutData(data); - - return container; - } - - /** - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - String name = nameText.getText(); - String password = passwordText.getText(); - try { - if (name!=null && name.length()>0) ((AuthenticatedSite)site).setUsername(name); - if (password!=null && password.length()>0) ((AuthenticatedSite)site).setPassword(password); - return true; - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("AuthenticatedTargetSitePropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$ - return false; - } - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java deleted file mode 100644 index 909f35126..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java +++ /dev/null @@ -1,399 +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.target; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -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.IPath; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.IWizardContainer; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.wizards.ConfigurationWizardElement; -import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizardMainPage; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.internal.model.AdaptableList; - -public class ConfigureTargetWizard extends Wizard implements IConfigurationWizard { - protected IWorkbench workbench; - protected IProject project; - protected IConfigurationWizard wizard; - - protected ConfigureProjectWizardMainPage mainPage; - protected static MappingSelectionPage mappingPage; - - private String pluginId = TeamUIPlugin.PLUGIN_ID; - - protected final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$ - protected final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ - protected final static String ATT_NAME = "name"; //$NON-NLS-1$ - protected final static String ATT_CLASS = "class"; //$NON-NLS-1$ - protected final static String ATT_ICON = "icon"; //$NON-NLS-1$ - protected final static String ATT_ID = "id"; //$NON-NLS-1$ - - public ConfigureTargetWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(getWizardWindowTitle()); //$NON-NLS-1$ - } - - public static final String MAPPING_PAGE_NAME = "mapping-page"; //$NON-NLS-1$ - - protected SiteSelectionPage siteSelectionPage = null; - /** - * @see ConfigureProjectWizard#getExtensionPoint() - */ - protected String getExtensionPoint() { - return TeamUIPlugin.PT_TARGETCONFIG; - } - - /** - * @see ConfigureProjectWizard#getWizardDescription() - */ - protected String getWizardDescription() { - return Policy.bind("TargetSiteCreationWizard.description"); //$NON-NLS-1$ - } - - /** - * @see ConfigureProjectWizard#getWizardLabel() - */ - protected String getWizardLabel() { - return Policy.bind("TargetSiteCreationWizard.label"); //$NON-NLS-1$ - } - - /** - * @see ConfigureProjectWizard#getWizardWindowTitle() - */ - protected String getWizardWindowTitle() { - if(project != null) { - return Policy.bind("TargetSiteCreationWizard.windowTitleProject"); //$NON-NLS-1$ - } else { - return Policy.bind("TargetSiteCreationWizard.windowTitleNoProject"); //$NON-NLS-1$ - } - } - - /* - * @see Wizard#addPages - */ - public void addPages() { - Site[] sites = TargetManager.getSites(); - AdaptableList wizards = getAvailableWizards(); - - if(sites.length > 0 && project != null) { - TargetProvider provider = null; - try { - provider = TargetManager.getProvider(project); - } catch (TeamException e) { - TeamUIPlugin.log(e); - } - siteSelectionPage = new SiteSelectionPage("site-selection-page", Policy.bind("TargetSiteCreationWizard.siteSelectionPage"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE), provider); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(siteSelectionPage); - } - - if(project != null) { - mappingPage = new MappingSelectionPage(ConfigureTargetWizard.MAPPING_PAGE_NAME, Policy.bind("MappingSelectionPage.mappingTitle"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE)); //$NON-NLS-1$ - mappingPage.setWizard(this); - } - - try { - if(wizards.size() == 1) { - ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0]; - this.wizard = (IConfigurationWizard)element.createExecutableExtension(); - wizard.init(workbench, project); - wizard.addPages(); - if (wizard.getPageCount() > 0) { - wizard.setContainer(getContainer()); - IWizardPage[] pages = wizard.getPages(); - for (int i = 0; i < pages.length; i++) { - addPage(pages[i]); - } - } - } else { - mainPage = new ConfigureProjectWizardMainPage("target-selection-page", getWizardLabel(), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE), wizards, Policy.bind("ConfigureProjectWizardMainPage.selectTarget")); //$NON-NLS-1$ //$NON-NLS-2$ - mainPage.setDescription(getWizardDescription()); - mainPage.setProject(project); - mainPage.setWorkbench(workbench); - addPage(mainPage); - } - } catch (CoreException e) { - TeamUIPlugin.log(e); - return; - } - } - - public IWizardPage getNextPage(IWizardPage page) { - if(page == siteSelectionPage) { - if(siteSelectionPage.isDisconnect()) { - return null; - } - if(siteSelectionPage.getSite() != null) { - mappingPage.setSite(siteSelectionPage.getSite()); - mappingPage.setPreviousPage(page); - return mappingPage; - } else if(mainPage != null) { - return mainPage; - } else if(wizard != null) { - return wizard.getStartingPage(); - } - } - if(wizard != null) { - return wizard.getNextPage(page); - } - return super.getNextPage(page); - } - - public static MappingSelectionPage getMappingPage() { - return mappingPage; - } - - public boolean canFinish() { - // If we are on the first page, never allow finish unless the selected wizard has no pages. - IWizardPage currentPage = getContainer().getCurrentPage(); - if (currentPage == mainPage) { - if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) { - return true; - } - return false; - } else if(currentPage == siteSelectionPage) { - if(siteSelectionPage.getSite() != null || siteSelectionPage.isDisconnect()) { - return true; - } else { - return false; - } - } - - MappingSelectionPage mappingPage = getMappingPage(); - if(mappingPage != null && currentPage == mappingPage) { - return mappingPage.isPageComplete(); - } - if(wizard != null) { - return wizard.canFinish(); - } - return super.canFinish(); - } - - /* - * @see Wizard#performFinish - */ - public boolean performFinish() { - // handles finish on site selection page and on mapping page - IWizardPage currentPage = getContainer().getCurrentPage(); - if(currentPage == siteSelectionPage || currentPage == getMappingPage()) { - Site site; - if(currentPage == siteSelectionPage) { - // if the user selected the disconnect option then disconnect - // this project from the target - if(siteSelectionPage.isDisconnect()) { - try { - TargetManager.unmap(project); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("Error"), Policy.bind("ConfigureTargetWizard.errorUnmappingProject"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - return true; - } - site = siteSelectionPage.getSite(); - } else { - site = getMappingPage().getSite(); - } - // a site has been selected on either the site selection page or the - // mapping page. Use this site information to map the project to the - // target. - IPath path = Path.EMPTY; - if(getMappingPage() != null) { - path = getMappingPage().getMapping(); - } - if(! setMapping(getContainer(), project, site, path)) - return false; //mapping failed so fail finish - } - - // allow target wizard to finish - if (wizard != null) { - return wizard.performFinish(); - } - return true; - } - - public static boolean setMapping(IWizardContainer container, IProject project, Site site, IPath path) { - if(validateSite(site, container)) { - if(TargetManager.getSite(site.getType(), site.getURL()) == null) { - TargetManager.addSite(site); - } - try { - TargetProvider provider = TargetManager.getProvider(project); - if(provider != null) { - if(!provider.getSite().equals(site) && !MessageDialog.openQuestion(container.getShell(), - Policy.bind("ConfigureTargetWizardQuestion_2"), //$NON-NLS-1$ - Policy.bind("ConfigureTargetWizard.alreadyMapped", project.getName(), provider.getURL().toExternalForm()))) { //$NON-NLS-1$ - return false; - } - TargetManager.unmap(project); - } - TargetManager.map(project, site, path); - return true; - } catch (TeamException e) { - ErrorDialog.openError(container.getShell(), Policy.bind("ConfigureTargetWizardError_6"), Policy.bind("ConfigureTargetWizardError_mapping_the_project_with_this_site_7"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - } else { - return false; - } - } - - public static boolean validateSite(final Site site, final IWizardContainer container) { - final boolean[] valid = new boolean[] {true}; - final String[] message = new String[] {Policy.bind("ConfigureTargetWizardURL_doesn__t_exist_on_the_server_8")}; //$NON-NLS-1$ - final int[] code = new int[] {-1}; - try { - container.run(true, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(Policy.bind("ConfigureTargetWizardValidating_connection_to_Site..._9"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - IRemoteTargetResource remote = site.getRemoteResource(); - valid[0] = remote.canBeReached(monitor); - } catch(TeamException e) { - message[0] = e.getStatus().getMessage(); - code[0] = e.getStatus().getCode(); - valid[0] = false; - } finally { - monitor.done(); - } - } - }); - } catch (InvocationTargetException e) { - valid[0] = false; - message[0] = e.getTargetException().getMessage(); - } catch (InterruptedException e) { - return false; - } - if(! valid[0]) { - if(! MessageDialog.openQuestion(container.getShell(), - Policy.bind("ConfigureTargetWizardConnection_Error_10"), //$NON-NLS-1$ - Policy.bind("ConfigureTargetWizard.errorOccurred", new Object[] {site.getURL().toExternalForm(), new Integer(code[0]), message[0]}))) { //$NON-NLS-1$ - return false; - } - } - return true; - } - - /** - * Returns the configuration wizards that are available for invocation. - * - * @return the available wizards - */ - protected AdaptableList getAvailableWizards() { - AdaptableList result = new AdaptableList(); - IPluginRegistry registry = Platform.getPluginRegistry(); - IExtensionPoint point = registry.getExtensionPoint(pluginId, getExtensionPoint()); - if (point != null) { - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - for (int j = 0; j < elements.length; j++) { - IConfigurationElement element = elements[j]; - if (element.getName().equals(TAG_WIZARD)) { - ConfigurationWizardElement wizard = createWizardElement(element); - if (wizard != null) { - result.add(wizard); - } - } - } - } - } - - return result; - } - /** - * Returns a new ConfigurationWizardElement configured according to the parameters - * contained in the passed Registry. - * - * May answer null if there was not enough information in the Extension to create - * an adequate wizard - * - * @param element the element for which to create a wizard element - * @return the wizard element for the given element - */ - protected ConfigurationWizardElement createWizardElement(IConfigurationElement element) { - // WizardElements must have a name attribute - String nameString = element.getAttribute(ATT_NAME); - if (nameString == null) { - // Missing attribute - return null; - } - ConfigurationWizardElement result = new ConfigurationWizardElement(nameString); - if (initializeWizard(result, element)) { - // initialization was successful - return result; - } - return null; - } - /** - * Initialize the passed element's properties based on the contents of - * the passed registry. Answer a boolean indicating whether the element - * was able to be adequately initialized. - * - * @param element the element to initialize the properties for - * @param extension the registry to get properties from - * @return whether initialization was successful - */ - protected boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config) { - element.setID(config.getAttribute(ATT_ID)); - String description = ""; //$NON-NLS-1$ - IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION); - if (children.length >= 1) { - description = children[0].getValue(); - } - - element.setDescription(description); - - // apply CLASS and ICON properties - element.setConfigurationElement(config); - String iconName = config.getAttribute(ATT_ICON); - if (iconName != null) { - IExtension extension = config.getDeclaringExtension(); - element.setImageDescriptor(TeamUIPlugin.getImageDescriptorFromExtension(extension, iconName)); - } - // ensure that a class was specified - if (element.getConfigurationElement() == null) { - // Missing attribute - return false; - } - setForcePreviousAndNextButtons(true); - return true; - } - /* - * Method declared on IConfigurationWizard - */ - public void init(IWorkbench workbench, IProject project) { - this.workbench = workbench; - this.project = project; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java deleted file mode 100644 index e6ae4bcb0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; - -/** - * Action to create a new remote folder. - */ -public class CreateNewFolderAction extends TargetAction { - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedRemoteFolders().length == 1; - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - try { - Utils.runWithProgressDialog(getShell(), true /* cancelable */, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - createDir(getShell(), getSelectedRemoteFolders()[0], new String()); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - }); - } catch (InvocationTargetException e) { - handle(e, Policy.bind("Error"), Policy.bind("CreateNewFolderAction.errorCreatingFolder")); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (InterruptedException e) { - } - } - - /** - * Throws a TeamException if one occured. - * Returns null if the operation was cancelled or an exception occured - */ - public static IRemoteTargetResource createDir(final Shell shell, final IRemoteTargetResource parent, final String defaultName) throws TeamException { - final IRemoteTargetResource[] newFolder = new IRemoteTargetResource[] {null}; - try { - Utils.runWithProgressDialog(shell, true, new IRunnableWithProgress() { - public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(Policy.bind("CreateNewFolderAction.creatingFolder"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - final String[] folderName = new String[] {null}; - final String suggestedName = getSuggestedFolderName(parent, Policy.subMonitorFor(monitor, 0), defaultName); - shell.getDisplay().syncExec(new Runnable() { - public void run() { - InputDialog dialog = new InputDialog(shell, - Policy.bind("CreateNewFolderAction.title"), //$NON-NLS-1$ - Policy.bind("CreateNewFolderAction.message"), //$NON-NLS-1$ - suggestedName, - null); - Policy.checkCanceled(monitor); - if(dialog.open() == InputDialog.OK) { - folderName[0] = dialog.getValue(); - } - } - }); - if(folderName[0] != null) { - newFolder[0] = parent.getFolder(folderName[0]); - newFolder[0].mkdirs(Policy.subMonitorFor(monitor, 0)); - } - } catch(TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }); - } catch(InvocationTargetException e) { - if (e.getTargetException() instanceof TeamException) { - throw (TeamException)e.getTargetException(); - } - Utils.handle(e); - } catch(InterruptedException e) { - } - return newFolder[0]; - } - - protected static String getSuggestedFolderName(IRemoteTargetResource parent, IProgressMonitor monitor, String defaultName) throws TeamException { - IRemoteResource[] members; - monitor.subTask(Policy.bind("CreateNewFolderAction.suggestedNameProgress")); //$NON-NLS-1$ - members = parent.members(monitor); - ArrayList names = new ArrayList(); - - String suggestedFolderName = defaultName; - - boolean nameUsed = false; - - for (int i = 0; i < members.length; i++) { - String existingName = members[i].getName(); - names.add(existingName); // cache them for next round since faster - if(existingName.equals(suggestedFolderName)) { - nameUsed = true; - } - } - - if(!nameUsed) - return suggestedFolderName; - - //Otherwise, keep proposing new names by incrementing a postfix name index until we find one not used - int postfix = 1; - - String baseName = suggestedFolderName; - - do { - nameUsed = false; - for (int i = 0; i < members.length && !nameUsed; i++) { - suggestedFolderName = Policy.bind("CreateNewFolderAction.suggestedNameConcat", baseName, String.valueOf(postfix)); //$NON-NLS-1$ - String existingName = (String) names.get(i); - - if(existingName.equals(suggestedFolderName)) { - postfix = postfix + 1; - nameUsed = true; - } - } - } while(nameUsed); - return suggestedFolderName; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java deleted file mode 100644 index 573f4bc18..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.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.target; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.dialogs.DetailsDialog; - -/** - * Discards a remembered Site from Target Management. Before a Site can be - * discarded all resources using this site must be deconfigured. This action will - * prompt the user if a Site cannot be discarded because of existing connections. - */ -public class DiscardSiteAction extends TargetAction { - - private class AlreadyMappedDialog extends DetailsDialog { - private IProject[] projects; - private org.eclipse.swt.widgets.List detailsList; - private Button unmap; - - public AlreadyMappedDialog(Shell shell, IProject[] projects) { - super(shell, Policy.bind("SiteExplorerView.unmapDialogTitle")); //$NON-NLS-1$ - setImageKey(DLG_IMG_WARNING); - this.projects = projects; - } - - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - TargetProvider target; - try { - target = TargetManager.getProvider(project); - } catch (TeamException e) { - continue; - } - detailsList.add(Policy.bind("SiteExplorerView.mappedProjects", project.getName(), target.getURL().toExternalForm())); //$NON-NLS-1$ - } - return composite; - } - - protected void createMainDialogArea(Composite composite) { - Label label = new Label(composite, SWT.WRAP); - label.setText(Policy.bind("SiteExplorerView.projectsAlreadyMapped")); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(composite.getFont()); - - unmap = new Button(composite, SWT.CHECK); - unmap.setText(Policy.bind("SiteExplorerView.unmapProjectsAndDisconnect")); //$NON-NLS-1$ - unmap.setSelection(false); - unmap.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - updateEnablements(); - } - }); - setPageComplete(false); - updateEnablements(); - } - - protected void updateEnablements() { - setPageComplete(unmap.getSelection()); - } - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedSites().length > 0; - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - deletedSelected(); - } - - private void deletedSelected() { - try { - Site[] sites = getSelectedSites(); - if(sites.length > 0) { - - // sites are already mapped, ask if they want to unmap projects first - IProject[] mappedProjects = projectsMappedToSite(sites); - if( mappedProjects.length > 0 ) { - AlreadyMappedDialog dialog = new AlreadyMappedDialog(getShell(), mappedProjects); - if(dialog.open() == AlreadyMappedDialog.OK) { - for (int i = 0; i < mappedProjects.length; i++) { - TargetManager.unmap(mappedProjects[i]); - } - } else { - // nothing to do - return; - } - } else { - MessageDialog d = new MessageDialog(getShell(), - Policy.bind("SiteExplorerView.promptForDeletingSitesTitle"), //$NON-NLS-1$ - null, - Policy.bind("SiteExplorerView.promptForDeletingSites", new Integer(sites.length).toString()), //$NON-NLS-1$ - MessageDialog.QUESTION, - new String[] { - IDialogConstants.YES_LABEL, - IDialogConstants.CANCEL_LABEL }, 0); - if( d.open() != MessageDialog.OK ) { - return; - } - } - // sites aren't mapped, just ask then delete them form the view - // and from the target manager. - for (int i = 0; i < sites.length; i++) { - TargetManager.removeSite(sites[i]); - sites[i].dispose(); - } - } - } catch (TeamException e) { - ErrorDialog.openError(getShell(), - Policy.bind("Error"), //$NON-NLS-1$ - Policy.bind("CreateNewFolderAction.errorDeletingSites"), //$NON-NLS-1$ - e.getStatus()); - } - } - - private IProject[] projectsMappedToSite(Site[] sites) throws TeamException { - List mappedProjects = new ArrayList(); - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - TargetProvider target = TargetManager.getProvider(project); - for (int j = 0; j < sites.length; j++) { - if(target != null && target.getSite().equals(sites[j])) { - mappedProjects.add(project); - } - } - } - return (IProject[]) mappedProjects.toArray(new IProject[mappedProjects.size()]); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java deleted file mode 100644 index a1f63aa88..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java +++ /dev/null @@ -1,204 +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.target; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.wizards.TeamWizardPage; - -/** - * This page allows the user to save the settings used by Target sites to a file. - */ -public class ExportTargetSiteMainPage extends TeamWizardPage { - private List selectedSites = new ArrayList(); - private Text fileText; - private String fileName = ""; //$NON-NLS-1$ - private Table table; - private Button browseButton; - - /** - * Constructor for ExportTargetSiteMainPage. - * @param pageName The name of the page. - */ - public ExportTargetSiteMainPage(String pageName) { - super(pageName); - } - - /** - * Constructor for ExportTargetSiteMainPage. - * @param pageName The name of the page - * @param title The title of the page - * @param titleImage The image for the page - */ - public ExportTargetSiteMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - createLabel(composite, Policy.bind("ExportTargetSiteMainPage.Select_Sites")); //$NON-NLS-1$ - - //TODO: add F1 help. - - table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - table.setLayout(new TableLayout()); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 300; - table.setLayoutData(data); - table.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - if (event.detail == SWT.CHECK) { - TableItem item = (TableItem) event.item; - if (item.getChecked()) { - selectedSites.add(item.getData()); - } else { - selectedSites.remove(item.getData()); - } - updateEnablement(); - } - } - }); - createLabel(composite, Policy.bind("ExportTargetSiteMainPage.Target_Site_Filename")); //$NON-NLS-1$ - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ExportTargetSiteMainPage.File_name")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (fileName != null) - fileText.setText(fileName); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - fileName = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ExportTargetSiteMainPage.Browse")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell(), SWT.SAVE); - d.setFilterExtensions(new String[] { "*.tsf" }); //$NON-NLS-1$ - d.setFilterNames(new String[] { Policy.bind("ExportTargetSiteMainPage.Target_Site_Files")}); //$NON-NLS-1$ - d.setFileName(Policy.bind("ExportTargetSiteMainPage.default")); //$NON-NLS-1$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - fileName = f; - } - } - }); - - initializeSites(); - setControl(composite); - updateEnablement(); - } - - public void setSelectedSites(Site[] selectedSites) { - this.selectedSites.addAll(Arrays.asList(selectedSites)); - } - - public void setFileName(String file) { - if (file != null) { - this.fileName = file; - } - } - - private void initializeSites() { - List siteList = new ArrayList(); - Site[] workspaceSites = TargetManager.getSites(); - for (int i = 0; i < workspaceSites.length; i++) { - TableItem item = new TableItem(table, SWT.NONE); - item.setData(workspaceSites[i]); - item.setText(workspaceSites[i].getDisplayName()); - } - } - - /** - * Returns the fileName. - * @return String - */ - public String getFileName() { - return fileName; - } - - public Site[] getSelectedSites() { - return (Site[]) selectedSites.toArray(new Site[selectedSites.size()]); - } - - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - private void updateEnablement() { - boolean complete; - if (selectedSites.size() == 0) { - setMessage(null); - complete = false; - } else if (fileName.length() == 0) { - setMessage(null); - complete = false; - } else { - File f = new File(fileName); - if (f.isDirectory()) { - setMessage(Policy.bind("ExportTargetSiteMainPage.folder_specified"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java deleted file mode 100644 index fe907b12e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java +++ /dev/null @@ -1,177 +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.target; - - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.dialogs.DetailsDialog; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for getting the contents of the selected resources - */ -public class GetAction extends TargetAction { - - private class OutgoingChangesDialog extends DetailsDialog { - private IResource[] outgoingChanges; - private org.eclipse.swt.widgets.List detailsList; - - public OutgoingChangesDialog(Shell shell, IResource[] outgoingChanges) { - super(shell, Policy.bind("GetAction.confirmFileOverwriteTitle")); //$NON-NLS-1$ - setImageKey(DLG_IMG_QUESTION); - this.outgoingChanges = outgoingChanges; - } - - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - for (int i = 0; i < outgoingChanges.length; i++) { - detailsList.add(outgoingChanges[i].getFullPath().toString()); //$NON-NLS-1$ - } - return composite; - } - - protected void createMainDialogArea(Composite parent) { - Label label = new Label(parent, SWT.WRAP); - label.setText(Policy.bind("GetAction.confirmFileOverwrite")); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(parent.getFont()); - setPageComplete(true); - } - - protected void updateEnablements() { - } - } - - public void run(IAction action) { - if(promptForOutgoingChanges()) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - monitor.beginTask(null, keySet.size() * 1000); - - // perform the get on each provider - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - provider.get(providerResources, Policy.subInfiniteMonitorFor(monitor, 1000)); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("GetAction.title"), PROGRESS_DIALOG); //$NON-NLS-1$ - } - } - - private boolean promptForOutgoingChanges() { - try { - // find any outgoing changes that will be overwritten and prompt - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - - Iterator iterator = keySet.iterator(); - List outgoingChanges = new ArrayList(); - while (iterator.hasNext()) { - TargetProvider provider = (TargetProvider)iterator.next(); - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - outgoingChanges.addAll(Arrays.asList(findResourcesWithOutgoingChanges(providerResources))); - } - if(! outgoingChanges.isEmpty()) { - final OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), - (IResource[]) outgoingChanges.toArray(new IResource[outgoingChanges.size()])); - final boolean okToContinue[] = {true}; - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - if(dialog.open() != OutgoingChangesDialog.OK) { - okToContinue[0] = false; - } - } - }); - return okToContinue[0]; - } - return true; - } catch(CoreException e) { - Utils.handle(e); - } - return false; - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) - return false; - if(! provider.canPut(resource)) - return false; //if one can't don't allow for any - } - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java deleted file mode 100644 index fc90d0c81..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java +++ /dev/null @@ -1,198 +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.target; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.dialogs.PromptingDialog; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.NewProjectAction; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.ProjectLocationSelectionDialog; - -/** - * Action to transfer a remote folder and it's contents into the workspace. If - * the remote folder doesn't have a .project then the project creation wizard - * is shown to configure a new project, otherwise the a prompt is shown to choose - * the project name and location. - * - * @see GetAsProjectAction - */ -public class GetAsAction extends GetAsProjectAction { - public void run(IAction action) { - - final IRemoteTargetResource[] folders = getSelectedRemoteFolders(); - if (folders.length != 1) return; - final IRemoteTargetResource remoteFolder = folders[0]; - final String remoteName = remoteFolder.getName(); - - // Fetch the members of the folder to see if they contain a .project file. - final boolean[] hasProjectMetaFile = new boolean[] { false }; - final boolean[] errorOccured = new boolean[] { false }; - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - hasProjectMetaFile[0] = hasProjectMetaFile(remoteFolder, monitor); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("GetAs.checkoutFailed"), PROGRESS_DIALOG); //$NON-NLS-1$ - if (errorOccured[0]) return; - - // Prompt outside a workspace runnable so that the project creation delta can be heard - IProject newProject = null; - if ( ! hasProjectMetaFile[0]) { - newProject = getNewProject(remoteFolder.getName()); - if (newProject == null) return; - } - - final IProject createdProject = newProject; - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - IProject project; - if (hasProjectMetaFile[0]) { - // Prompt for name - final Shell shell = getShell(); - final int[] result = new int[] { Dialog.OK }; - project = ResourcesPlugin.getWorkspace().getRoot().getProject(remoteName); - final ProjectLocationSelectionDialog dialog = new ProjectLocationSelectionDialog(shell, project); - dialog.setTitle(Policy.bind("GetAs.enterProjectTitle", remoteName)); //$NON-NLS-1$ - - shell.getDisplay().syncExec(new Runnable() { - public void run() { - result[0] = dialog.open(); - } - }); - if (result[0] != Dialog.OK) return; - - Object[] destinationPaths = dialog.getResult(); - if (destinationPaths == null) return; - String newName = (String) destinationPaths[0]; - IPath newLocation = new Path((String) destinationPaths[1]); - - // prompt if the project exists locally - project = ResourcesPlugin.getWorkspace().getRoot().getProject(newName); - PromptingDialog prompt = new PromptingDialog(getShell(), new IResource[] { project }, - getOverwriteLocalAndFileSystemPrompt(), Policy.bind("GetAsProject.confirmOverwrite"));//$NON-NLS-1$ - if (prompt.promptForMultiple().length == 0) return; - - monitor.beginTask(null, 100); - monitor.setTaskName(Policy.bind("GetAs.taskname", remoteFolder.getName(), newName)); //$NON-NLS-1$ - - // create the project - try { - if (newLocation.equals(Platform.getLocation())) { - // create in default location - project.create(Policy.subMonitorFor(monitor, 3)); - } else { - // create in some other location - IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()); - desc.setLocation(newLocation); - project.create(desc, Policy.subMonitorFor(monitor, 3)); - } - project.open(Policy.subMonitorFor(monitor, 2)); - } catch (CoreException e) { - throw new TeamException(e.getStatus()); - } - } else { - project = createdProject; - monitor.beginTask(null, 95); - monitor.setTaskName(Policy.bind("GetAs.taskname", remoteFolder.getName(), createdProject.getName())); //$NON-NLS-1$ - } - - get(project, remoteFolder, Policy.subInfiniteMonitorFor(monitor, 95)); - - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("GetAs.checkoutFailed"), PROGRESS_DIALOG); //$NON-NLS-1$ - } - - /* - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedRemoteFolders().length == 1; - } - - /** - * Get a new project. - * - * The suggestedName is not currently used but is a desired capability. - */ - private IProject getNewProject(String suggestedName) { - NewProjectListener listener = new NewProjectListener(); - ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE); - (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run(); - ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener); - return listener.getNewProject(); - } - - protected boolean hasProjectMetaFile(IRemoteTargetResource remote, IProgressMonitor monitor) throws TeamException { - IRemoteResource[] children = remote.members(monitor); - for (int i = 0; i < children.length; i++) { - if(children[i].getName().equals(".project")) { //$NON-NLS-1$ - return true; - } - } - return false; - } - - class NewProjectListener implements IResourceChangeListener { - private IProject newProject = null; - /** - * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent) - */ - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta root = event.getDelta(); - IResourceDelta[] projectDeltas = root.getAffectedChildren(); - for (int i = 0; i < projectDeltas.length; i++) { - IResourceDelta delta = projectDeltas[i]; - IResource resource = delta.getResource(); - if (delta.getKind() == IResourceDelta.ADDED) { - newProject = (IProject)resource; - } - } - } - /** - * Gets the newProject. - * @return Returns a IProject - */ - public IProject getNewProject() { - return newProject; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java deleted file mode 100644 index ca48f090b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java +++ /dev/null @@ -1,161 +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.target; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.dialogs.IPromptCondition; -import org.eclipse.team.internal.ui.dialogs.PromptingDialog; - -/** - * Action to transfer a remote folder and it's contents into the workspace. The - * resulting project is named with the remote folder name and the kind of project - * is determined by the remote .project file. If the remote folder doesn't not - * contain a .project, then the project default simple type is used. - * - * @see GetAsAction - */ -public class GetAsProjectAction extends TargetAction { - - public void run(IAction action) { - - final IRemoteTargetResource[] remoteFolders = getSelectedRemoteFolders(); - - Set targetProjects = new HashSet(); - for (int i = 0; i < remoteFolders.length; i++) { - String projectName = remoteFolders[i].getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - targetProjects.add(project); - } - final IResource[] projects = (IResource[]) targetProjects.toArray(new IResource[targetProjects.size()]); - PromptingDialog prompt = new PromptingDialog(getShell(), projects, - getOverwriteLocalAndFileSystemPrompt(), - Policy.bind("GetAsProject.confirmOverwrite"));//$NON-NLS-1$ - - try { - if (prompt.promptForMultiple().length != projects.length) return; - } catch (InterruptedException e) { - return; - } - - try { - Utils.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(getTaskName(remoteFolders), remoteFolders.length * 100); - monitor.setTaskName(getTaskName(remoteFolders)); - for (int i = 0; i < remoteFolders.length; i++) { - IProject project = (IProject)projects[i]; - IRemoteTargetResource remote = remoteFolders[i]; - IProgressMonitor subMonitor = Policy.subInfiniteMonitorFor(monitor, 100); - get(project, remote, subMonitor); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }); - } catch (InvocationTargetException e) { - handle(e, Policy.bind("Error"), Policy.bind("GetAsProject.errorGettingResources")); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (InterruptedException e) { - return; - } - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedRemoteFolders().length > 0; - } - - protected void get(IProject project, IRemoteTargetResource remote, IProgressMonitor monitor) throws TeamException { - try { - monitor.beginTask(null, 100); - try { - if(!project.exists()) { - project.create(Policy.subMonitorFor(monitor, 5)); - } - if(!project.isOpen()) { - project.open(Policy.subMonitorFor(monitor, 5)); - } - } catch (CoreException e) { - ErrorDialog.openError(getShell(), Policy.bind("Error"), Policy.bind("GetAsProject.errorCreatingProject"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - Site site = remote.getSite(); - TargetProvider provider = TargetManager.getProvider(project); - if(provider != null) { - TargetManager.unmap(project); - } - TargetManager.map(project, site, UrlUtil.getTrailingPath(remote.getURL(), site.getURL())); - provider = TargetManager.getProvider(project); - provider.get(project, remote, Policy.subMonitorFor(monitor, 90)); - } finally { - monitor.done(); - } - } - - protected static String getTaskName(IRemoteTargetResource[] remoteFolders) { - if (remoteFolders.length == 1) { - IRemoteTargetResource folder = remoteFolders[0]; - return Policy.bind("GetAsProject.taskName1", folder.getURL().toExternalForm()); //$NON-NLS-1$ - } - else { - return Policy.bind("GetAsProject.taskNameN", new Integer(remoteFolders.length).toString()); //$NON-NLS-1$ - } - } - - protected IPromptCondition getOverwriteLocalAndFileSystemPrompt() { - return new IPromptCondition() { - // prompt if resource in workspace exists or exists in local file system - public boolean needsPrompt(IResource resource) { - File localLocation = getFileLocation(resource); - if(resource.exists() || localLocation.exists()) { - return true; - } - return false; - } - public String promptMessage(IResource resource) { - File localLocation = getFileLocation(resource); - if(resource.exists()) { - return Policy.bind("GetAsProject.thisResourceExists", resource.getName());//$NON-NLS-1$ - } else { - return Policy.bind("GetAsProject.thisExternalFileExists", resource.getName());//$NON-NLS-1$ - }//$NON-NLS-1$ - } - private File getFileLocation(IResource resource) { - return new File(resource.getParent().getLocation().toFile(), resource.getName()); - } - }; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java deleted file mode 100644 index f2129f36a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java +++ /dev/null @@ -1,149 +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.target; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.ITeamNode; -import org.eclipse.team.internal.ui.sync.SyncSet; -import org.eclipse.ui.help.WorkbenchHelp; - -public class GetSyncAction extends TargetSyncAction { - - public GetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) { - super(model, sp, label, shell); - WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_GET_ACTION); - } - - /** - * @see TargetSyncAction#isEnabled(ITeamNode) - */ - protected boolean isEnabled(ITeamNode node) { - // Get action is enabled for any changed nodes. - SyncSet set = new SyncSet(new StructuredSelection(node)); - return set.hasIncomingChanges() || set.hasConflicts(); - } - - /** - * @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int) - */ - protected void removeNonApplicableNodes(SyncSet set, int syncMode) { - set.removeOutgoingNodes(); - } - - /** - * @see TargetSyncAction#run(SyncSet, IProgressMonitor) - */ - protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) { - try { - ITeamNode[] changed = syncSet.getChangedNodes(); - if (changed.length == 0) { - return syncSet; - } - List fileResources = new ArrayList(); - List folderDeletions = new ArrayList(); - List folderAdditions = new ArrayList(); - //Find the incoming file changes the potential incoming folder deletions: - for (int i = 0; i < changed.length; i++) { - if (changed[i].getChangeDirection()==ITeamNode.INCOMING || changed[i].getChangeDirection()==ITeamNode.CONFLICTING) { - if (changed[i].getResource().getType()==IResource.FILE) fileResources.add(changed[i].getResource()); - else if (changed[i].getChangeType()==Differencer.DELETION - && /*don't delete nonexistant folders*/changed[i].getResource().exists()) - folderDeletions.add(changed[i].getResource()); - else { - //If the new remote folders have no children then we'd better explicitly create them locally: - IResource resource=changed[i].getResource(); - if (getRemoteResourceFor(resource).members(monitor).length==0) - folderAdditions.add(changed[i].getResource()); - } - } - } - get((IResource[])fileResources.toArray(new IResource[fileResources.size()]), monitor); - get((IResource[])folderAdditions.toArray(new IResource[folderDeletions.size()]), monitor); - if (folderDeletions.size()>0) { - //Prune the list of potential incoming folder deletions, retaining only those that don't have local content: - boolean delete; - Iterator iter=folderDeletions.iterator(); - for (IContainer container=(IContainer)iter.next(); iter.hasNext(); container=(IContainer)iter.next()) { - delete=true; - IResource[] children=container.members(); - for (int j = 0; j < children.length; j++) { - if (!folderDeletions.contains(children[j])) { - delete=false; - break; - } - } - if (!delete) iter.remove(); - } - get((IResource[])folderDeletions.toArray(new IResource[folderDeletions.size()]), monitor); - } - } catch (final TeamException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } catch (final CoreException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } - return syncSet; - } - - /** - * Put the given resources to their associated providers. - * - * @param resources the resources to commit - * @param monitor the progress monitor - */ - public void get(IResource[] resources, IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - Hashtable table = getTargetProviderMapping(resources); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000); - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - provider.get(providerResources, subMonitor); - } - } finally { - monitor.done(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java deleted file mode 100644 index 559896e42..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.io.File; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.wizards.TeamWizardPage; - -public class ImportTargetSiteMainPage extends TeamWizardPage { - private Text fileText; - private String file = ""; //$NON-NLS-1$ - private Button browseButton; - - /** - * @see org.eclipse.jface.wizard.WizardPage#WizardPage(String, String, ImageDescriptor) - */ - public ImportTargetSiteMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - private void updateEnablement() { - boolean complete; - - if (file.length() == 0) { - setMessage(null); - complete = false; - } else { - // See if the file exists - File f = new File(file); - if (!f.exists()) { - setMessage(Policy.bind("ImportTargetSiteMainPage.nonexistent_file"), ERROR); //$NON-NLS-1$ - complete = false; - } else if (f.isDirectory()) { - setMessage(Policy.bind("ImportTargetSiteMainPage.folder_specified"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - - /** - * single-use mutator - * @param file The name to use for the file. - */ - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - - /** - * Method getFileName. - * @return String - */ - public String getFileName() { - return file; - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) - */ - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - //TODO: add F1 help. - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ImportTargetSiteMainPage.File_name")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ImportTargetSiteMainPage.Browse")); //$NON-NLS-1$ - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell()); - d.setFilterExtensions(new String[] {"*.tsf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterNames(new String[] {Policy.bind("ImportTargetSiteMainPage.Target_Site_Files"), Policy.bind("ImportTargetSiteMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - setControl(composite); - updateEnablement(); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java deleted file mode 100644 index 1466d7f60..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java +++ /dev/null @@ -1,195 +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.target; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class MappingSelectionPage extends TargetWizardPage { - private IPath path = Path.EMPTY; - private Site site; - private TreeViewer viewer; - private Text textPath; - - public MappingSelectionPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - setDescription(Policy.bind("MappingSelectionPage.description")); //$NON-NLS-1$ - } - - public void setSite(Site site) { - this.site = site; - } - - public Site getSite() { - return site; - } - - public void createControl(Composite p) { - Composite composite = createComposite(p, 1); - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.TARGET_MAPPING_SELECTION_PAGE); - - createLabel(composite, Policy.bind("MappingSelectionPage.label")); //$NON-NLS-1$ - - viewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE); - - GridData data = new GridData (GridData.FILL_BOTH); - viewer.getTree().setLayoutData(data); - viewer.setContentProvider(new SiteLazyContentProvider()); - viewer.setLabelProvider(new WorkbenchLabelProvider()); - viewer.setSorter(new SiteViewSorter()); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateTextPath(); - } - }); - - // include only folders in view - viewer.addFilter(new ViewerFilter() { - public boolean select(Viewer viewer, Object parentElement, Object element) { - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getRemoteResource().isContainer(); - } - return false; - } - }); - - Button newFolderButton = new Button(composite, SWT.PUSH); - newFolderButton.setText(Policy.bind("MappingSelectionPage.newFolderLabel")); //$NON-NLS-1$ - newFolderButton.addListener(SWT.Selection, new Listener() { - public void handleEvent (Event event) { - Shell shell = getShell(); - try { - // assume that only one folder is selected in the folder tree - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - Object currentSelection = selection.getFirstElement(); - final IRemoteTargetResource selectedFolder = getSelectedRemoteFolder(selection); - String defaultName = ((ConfigureTargetWizard) getWizard()).project.getName(); - - IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(getShell(), selectedFolder, defaultName); - if (newFolder == null) - return; - - RemoteResourceElement newFolderUIElement = new RemoteResourceElement(newFolder); - - ((RemoteResourceElement)currentSelection).setCachedChildren(null); - viewer.refresh(currentSelection); - viewer.setExpandedState(currentSelection, true); - viewer.setSelection(new StructuredSelection(newFolderUIElement)); - } catch (TeamException e) { - Utils.handle(e); - return; - } - } - }); - setViewerInput(); - setControl(composite); - setPageComplete(true); - } - - private IRemoteTargetResource getSelectedRemoteFolder(IStructuredSelection selection) { - if (!selection.isEmpty()) { - final List filesSelection = new ArrayList(); - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if(o instanceof RemoteResourceElement) { - return ((RemoteResourceElement)o).getRemoteResource(); - } else if(o instanceof SiteElement) { - try { - return ((SiteElement)o).getSite().getRemoteResource(); - } catch (TeamException e) { - return null; - } - } - } - } - return null; - } - - /** - * Method updateTextPath. - */ - private void updateTextPath() { - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - if (!selection.isEmpty()) { - final List filesSelection = new ArrayList(); - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if(o instanceof RemoteResourceElement) { - RemoteResourceElement element = (RemoteResourceElement) o; - URL remoteResourceURL; - remoteResourceURL = element.getRemoteResource().getURL(); - this.path = UrlUtil.getTrailingPath( - remoteResourceURL, - this.site.getURL()); - return; - } - } - } - } - - public IPath getMapping() { - return this.path; - } - - /** - * Attempt to set the viewer input. - * Do nothing if we don't have enough info yet to set it. - */ - private void setViewerInput() { - if(this.site == null || viewer == null) - return; - viewer.setInput(new SiteRootsElement(new Site[] {site}, getContainer())); - } - - /** - * @see IDialogPage#setVisible(boolean) - */ - public void setVisible(boolean visible) { - if(visible) { - setViewerInput(); - viewer.setSelection(new StructuredSelection(new SiteElement(site))); - } - super.setVisible(visible); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java deleted file mode 100644 index 94d5d6f41..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java +++ /dev/null @@ -1,125 +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.target; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.dialogs.PropertyPage; - -public class ProjectTargetMappingPropertiesPage extends PropertyPage { - public static final int WIDTH_HINT = 250; - - private IProject proj; - private Site site = null; - private IPath mapping; - private TargetProvider origProvider=null; - - private Label serverText,folderText; - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - initialize(); - Composite container = new Composite(parent, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - - Label serverLabel = new Label(container, SWT.NONE); - serverLabel.setText(Policy.bind("ProjectTargetMappingPropertiesPage.URL")); //$NON-NLS-1$ - serverText = new Label(container, SWT.NONE); - serverText.setText(site.getURL().toString()); - GridData data = new GridData(); - data.widthHint = WIDTH_HINT; - serverText.setLayoutData(data); - - Label folderLabel = new Label(container, SWT.NONE); - folderLabel.setText(Policy.bind("ProjectTargetMappingPropertiesPage.FolderName")); //$NON-NLS-1$ - folderText = new Label(container, SWT.NONE); - folderText.setText(mapping.toString()); - data = new GridData(); - data.widthHint = WIDTH_HINT; - folderText.setLayoutData(data); - - Button change = new Button(container, SWT.PUSH); - change.setText(Policy.bind("ProjectTargetMappingPropertiesPage.ChangeBtn")); //$NON-NLS-1$ - change.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - ConfigureTargetWizard wizard = new ConfigureTargetWizard(); - wizard.init(null, proj); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.open(); - refreshInfo(); - } - }); - - return container; - } - - private void initialize() { - IAdaptable element = getElement(); - if (element instanceof IProject) { - proj = ((IProject) element).getProject(); - } else { - IProject adapter = (IProject) element.getAdapter(IProject.class); - if (adapter != null) { - proj = adapter.getProject(); - } - } - try { - TargetProvider provider = TargetManager.getProvider(proj); - if (origProvider==null) origProvider=provider; - site = provider.getSite(); - mapping = UrlUtil.getTrailingPath(provider.getURL(), site.getURL()); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("ProjectTargetMappingPropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$ - } - } - - private void refreshInfo() { - initialize(); - serverText.setText(site.getURL().toString()); - folderText.setText(mapping.toString()); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - super.performDefaults(); - IPath oldMapping = UrlUtil.getTrailingPath(origProvider.getURL(), origProvider.getSite().getURL()); - try { - TargetManager.unmap(proj); - TargetManager.map(proj, origProvider.getSite(), oldMapping); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("ProjectTargetMappingPropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$ - } - refreshInfo(); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java deleted file mode 100644 index 6b81f47b1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java +++ /dev/null @@ -1,78 +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.target; - - -import java.lang.reflect.InvocationTargetException; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for checking in the selected resources - */ -public class PutAction extends TargetAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000); - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("PutAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - - provider.put(providerResources, subMonitor); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("PutAction.title"), PROGRESS_DIALOG); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) - return false; - if(! provider.canGet(resource)) - return false; //if one can't don't allow for any - } - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java deleted file mode 100644 index ab141e082..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java +++ /dev/null @@ -1,149 +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.target; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.ITeamNode; -import org.eclipse.team.internal.ui.sync.SyncSet; -import org.eclipse.team.internal.ui.sync.SyncView; -import org.eclipse.ui.help.WorkbenchHelp; - -public class PutSyncAction extends TargetSyncAction { - - public PutSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) { - super(model, sp, label, shell); - WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_PUT_ACTION); - } - - /** - * @see TargetSyncAction#isEnabled(ITeamNode) - */ - protected boolean isEnabled(ITeamNode node) { - // Put action is enabled for any changed nodes. - return new SyncSet(new StructuredSelection(node)).getChangedNodes().length > 0; - } - - /** - * @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int) - */ - protected void removeNonApplicableNodes(SyncSet set, int syncMode) { - if (syncMode == SyncView.SYNC_OUTGOING) { - set.removeIncomingNodes(); - } - } - - /** - * @see TargetSyncAction#run(SyncSet, IProgressMonitor) - */ - protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) { - try { - ITeamNode[] changed = syncSet.getChangedNodes(); - if (changed.length == 0) { - return syncSet; - } - List fileResources = new ArrayList(); - List folderDeletions = new ArrayList(); - List folderAdditions = new ArrayList(); - //Find the outgoing file changes the potential outgoing folder deletions: - for (int i = 0; i < changed.length; i++) { - if (changed[i].getChangeDirection()==ITeamNode.OUTGOING || changed[i].getChangeDirection()==ITeamNode.CONFLICTING) { - if (changed[i].getResource().getType()==IResource.FILE) fileResources.add(changed[i].getResource()); - else if (changed[i].getChangeType()==Differencer.DELETION) - folderDeletions.add(changed[i].getResource()); - else if (((IContainer)(changed[i].getResource())).members().length==0) - ////If the new local folders have no children then we'd better explicitly create them remotely: - folderAdditions.add(changed[i].getResource()); - } - } - put((IResource[])fileResources.toArray(new IResource[fileResources.size()]), monitor); - if (folderAdditions.size()>0) - put((IResource[])folderAdditions.toArray(new IResource[folderDeletions.size()]), monitor); - if (folderDeletions.size()>0) { - //Prune the list of potential outgoing folder deletions, retaining only those that don't have remote content: - boolean delete; - Iterator iter=folderDeletions.iterator(); - for (IContainer i=(IContainer)iter.next(); iter.hasNext(); i=(IContainer)iter.next()) { - delete=true; - IRemoteResource[] children=getRemoteResourceFor(i).members(monitor); - for (int j = 0; j < children.length; j++) { - if (!folderDeletions.contains(children[j])) { - delete=false; - break; - } - } - if (!delete) iter.remove(); - } - put((IResource[])folderDeletions.toArray(new IResource[folderDeletions.size()]), monitor); - } - } catch (final TeamException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } catch (final CoreException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } - return syncSet; - } - - /** - * Put the given resources to their associated providers. - * - * @param resources the resources to commit - * @param monitor the progress monitor - */ - public void put(IResource[] resources, IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - Hashtable table = getTargetProviderMapping(resources); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000); - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("PutAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - provider.put(providerResources, subMonitor); - } - } finally { - monitor.done(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java deleted file mode 100644 index e90242a59..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java +++ /dev/null @@ -1,181 +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.target; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * Used to show IRemoteTargetResource instances in the UI. In addition these elements - * support caching of values returned from IRemoteTargetResource methods, as such these - * instances aren't as much proxies as the underlying remote handles. - * <p> - * Implementation in progress: support for configuring these elements with a custom - * progress monitor that can be the target of long running operations. This will - * allow showing progress in wizards and in the SiteExplorerView when navigating - * remote servers.</p> - */ -public class RemoteResourceElement implements IWorkbenchAdapter, IAdaptable { - - // remote resource this element represents - private IRemoteTargetResource remote; - - // cache for the remote values - private IRemoteResource[] children = null; - private int size = 0; - private String lastModified = null; - - // context in which to perform long-running operations - private IRunnableContext runContext; - - public RemoteResourceElement(IRemoteTargetResource remote) { - this.remote = remote; - } - - public RemoteResourceElement(IRemoteTargetResource remote, IRunnableContext runContext) { - this(remote); - this.runContext = runContext; - } - - public IRemoteTargetResource getRemoteResource() { - return remote; - } - - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) return this; - return null; - } - - public Object[] getChildren(Object o) { - final Object[][] result = new Object[1][]; - try { - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - // progress for fetching remote children is always unknown - // let's not bother even trying to guess. - monitor.beginTask(null, IProgressMonitor.UNKNOWN); - if(children == null) { - setCachedChildren(remote.members(Policy.subMonitorFor(monitor, 50))); - } - List remoteElements = new ArrayList(); - for (int i = 0; i < children.length; i++) { - IRemoteTargetResource child = (IRemoteTargetResource)children[i]; - RemoteResourceElement element = new RemoteResourceElement(child, runContext); - - // cache size and last modified - element.setLastModified(child.getLastModified(Policy.subMonitorFor(monitor, 25))); - element.setSize(child.getSize(Policy.subMonitorFor(monitor, 25))); - remoteElements.add(element); - } - result[0] = (RemoteResourceElement[])remoteElements.toArray(new RemoteResourceElement[remoteElements.size()]); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - - if(runContext == null) { - Utils.runWithProgress(null, true /*cancelable*/, runnable); - } else { - runContext.run(true, true, runnable); - } - } catch (InterruptedException e) { - return new Object[0]; - } catch (InvocationTargetException e) { - Utils.handle(e.getTargetException()); - return new Object[0]; - } - return result[0]; - } - - public ImageDescriptor getImageDescriptor(Object object) { - if(remote.isContainer()) { - return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); - } else { - return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(remote.getName()); - } - } - - public String getLabel(Object o) { - // would be nice to display more than just the name (e.g. timestamp, size...) - return remote.getName(); - } - - public Object getParent(Object o) { - return null; - } - - public int hashCode() { - return getRemoteResource().hashCode(); - } - - public boolean equals(Object obj) { - if(this == obj) - return true; - if(!(obj instanceof RemoteResourceElement)) - return false; - return ((RemoteResourceElement)obj).getRemoteResource().equals(getRemoteResource()); - } - - public void clearChildren() { - children = null; - } - - public IRemoteResource[] getCachedChildren() { - return children; - } - - public void setCachedChildren(IRemoteResource[] children) { - this.children = children; - } - - protected void setRemoteResource(IRemoteTargetResource remote) { - this.remote = remote; - } - - public String getLastModified() { - return lastModified; - } - - public int getSize() { - return size; - } - - public void setLastModified(String lastModified) { - this.lastModified = lastModified; - } - - public void setSize(int size) { - this.size = size; - } - - public String getName() { - return remote.getName(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java deleted file mode 100644 index 16fa29dd3..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.ISharedImages; - -/** - * Used to show Site instances in the UI. Sites are really just remote - * resources but are shown with a different icon and label. - * - * @see RemoteResourceElement - */ -public class SiteElement extends RemoteResourceElement { - private Site site; - - public SiteElement(Site site) { - super(null); - this.site = site; - } - - public SiteElement(Site site, IRunnableContext runContext) { - super(null, runContext); - this.site = site; - } - - public Site getSite() { - return site; - } - - public int hashCode() { - return site.hashCode(); - } - - public ImageDescriptor getImageDescriptor(Object object) { - return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SITE_ELEMENT); - } - - public String getLabel(Object o) { - return getSite().getDisplayName(); - } - - public Object getParent(Object o) { - return null; - } - - public boolean equals(Object obj) { - if(this == obj) - return true; - if(!(obj instanceof SiteElement)) - return false; - Site otherSite = ((SiteElement)obj).getSite(); - return getSite().equals(otherSite); - } - /** - * @see IWorkbenchAdapter#getChildren(Object) - */ - public Object[] getChildren(Object o) { - try { - setRemoteResource(site.getRemoteResource()); - } catch (TeamException e) { - Utils.handle(e); - return new Object[0]; - } - return super.getChildren(this); - } - /** - * @see RemoteResourceElement#getRemoteResource() - */ - public IRemoteTargetResource getRemoteResource() { - try { - return site.getRemoteResource(); - } catch (TeamException e) { - Utils.handle(e); - return null; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java deleted file mode 100644 index 512058279..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java +++ /dev/null @@ -1,574 +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.target; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.ISiteListener; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.ui.IHelpContextIds; -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.ui.ISharedImages; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.dialogs.PropertyDialogAction; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.WorkbenchImages; -import org.eclipse.ui.model.WorkbenchLabelProvider; -import org.eclipse.ui.part.ViewPart; - -/** - * Is a view that allows browsing remote target sites. It is modeled after - * a file explorer: a tree of folders is show with a table of the folder's - * contents. - * <p> - * Progress is shown in the main workbench window's status line progress - * monitor.</p> - * - * @see Site - * @see IRemoteTargetResource - */ -public class SiteExplorerView extends ViewPart implements ISiteListener { - - public static final String VIEW_ID = "org.eclipse.team.ui.target.SiteExplorerView"; //$NON-NLS-1$ - - // The tree viewer showing the folders and sites - private TreeViewer folderTree; - - // The table view that shows the resources in the currently selected folder - // from the folders tree. - private TableViewer folderContentsTable; - - // The root - private SiteRootsElement root; - - // Embedded progress monitor part used to display progress when contacting the server - // Note: this feature is not enabled yet and is still under construction - private IProgressMonitor progressMonitorPart; - - // The view's actions - private Action addSiteAction; - private Action newFolderAction; - private PropertyDialogAction propertiesAction; - - /** - * Sorter for the folderContents table - */ - class FolderListingSorter extends ViewerSorter { - private boolean reversed = false; - private int columnNumber; - - public static final int NAME = 0; - public static final int SIZE = 1; - public static final int MODIFIED = 2; - - // column headings: "Name" "Size" "Modified" - private int[][] SORT_ORDERS_BY_COLUMN = { - {NAME}, /* name */ - {SIZE, NAME}, /* size */ - {MODIFIED, NAME, SIZE}, /* modified */ - }; - - public FolderListingSorter(int columnNumber) { - this.columnNumber = columnNumber; - } - - public int compare(Viewer viewer, Object o1, Object o2) { - RemoteResourceElement e1 = (RemoteResourceElement)o1; - RemoteResourceElement e2 = (RemoteResourceElement)o2; - int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber]; - int result = 0; - for (int i = 0; i < columnSortOrder.length; ++i) { - result = compareColumnValue(columnSortOrder[i], e1, e2); - if (result != 0) - break; - } - if (reversed) - result = -result; - return result; - } - - int compareColumnValue(int columnNumber, RemoteResourceElement e1, RemoteResourceElement e2) { - IRemoteTargetResource r1 = e1.getRemoteResource(); - IRemoteTargetResource r2 = e2.getRemoteResource(); - switch (columnNumber) { - case NAME: - if (r1.isContainer() && r2.isContainer()) - return compareNames(r1, r2); - else if (r1.isContainer()) - return -1; - else if (r2.isContainer()) - return 1; - return compareNames(r1, r2); - case SIZE: - return new Integer(e1.getSize()).compareTo(new Integer(e2.getSize())); - case MODIFIED: - return getCollator().compare(e1.getLastModified(), e2.getLastModified()); - default: - return 0; - } - } - - protected int compareNames(IRemoteTargetResource resource1, IRemoteTargetResource resource2) { - return resource1.getName().compareTo(resource2.getName()); - } - - /** - * Returns the number of the column by which this is sorting. - */ - public int getColumnNumber() { - return columnNumber; - } - - /** - * Returns true for descending, or false - * for ascending sorting order. - */ - public boolean isReversed() { - return reversed; - } - - /** - * Sets the sorting order. - */ - public void setReversed(boolean newReversed) { - reversed = newReversed; - } - } - - /** - * @see IWorkbenchPart#createPartControl(Composite) - */ - public void createPartControl(Composite top) { - Composite p = new Composite(top, SWT.NULL); - GridData data = new GridData (GridData.FILL_BOTH); - p.setLayoutData(data); - GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 3; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - p.setLayout (gridLayout); - - SashForm sash = new SashForm(p, SWT.HORIZONTAL); - data = new GridData(GridData.FILL_BOTH); - data.horizontalSpan = 3; - sash.setLayoutData(data); - - folderTree = new TreeViewer(sash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - folderTree.setContentProvider(new SiteLazyContentProvider()); - folderTree.setLabelProvider(new WorkbenchLabelProvider()); - - folderTree.setSorter(new SiteViewSorter()); - folderTree.getControl().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent event) { - if (event.keyCode == SWT.F5) { - RemoteResourceElement[] selectedFolders = getSelectedRemoteFolder((IStructuredSelection)folderTree.getSelection()); - if(selectedFolders.length == 1) { - selectedFolders[0].setCachedChildren(null); - folderTree.refresh(selectedFolders[0]); - updateFileTable(selectedFolders[0]); - } - } - } - }); - - folderTree.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - final RemoteResourceElement[] remoteFolders = getSelectedRemoteFolder(selection); - if(remoteFolders.length == 1) { - updateFileTable(remoteFolders[0]); - } - } - }); - - folderTree.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent e) { - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - if(selection.size() == 1) { - expandInTreeCurrentSelection(selection, true /*toggle expanded*/); - } - } - }); - - folderTree.setSorter(new ViewerSorter() { - public int compare(Viewer viewer, Object e1, Object e2) { - String name1 = ""; //$NON-NLS-1$ - String name2 = ""; //$NON-NLS-1$ - if(e1 instanceof RemoteResourceElement) { - name1 = ((RemoteResourceElement)e1).getRemoteResource().getName(); - } else if(e1 instanceof SiteElement) { - name1 = ((SiteElement)e1).getSite().getURL().toExternalForm(); - } - if(e2 instanceof RemoteResourceElement) { - name2 = ((RemoteResourceElement)e2).getRemoteResource().getName(); - } else if(e2 instanceof SiteElement) { - name2 = ((SiteElement)e2).getSite().getURL().toExternalForm(); - } - - return getCollator().compare(name1, name2); - } - }); - - // show only folders in tree - folderTree.addFilter(new ViewerFilter() { - public boolean select(Viewer viewer, Object parentElement, Object element) { - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getRemoteResource().isContainer(); - } - return false; - } - }); - - Table table = new Table(sash, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - - TableColumn tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.Name_1")); //$NON-NLS-1$ - tableColumn.addSelectionListener(getColumnListener()); - layout.addColumnData(new ColumnWeightData(30, true)); - - tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.Size_2")); //$NON-NLS-1$ - tableColumn.setAlignment(SWT.RIGHT); - tableColumn.addSelectionListener(getColumnListener()); - layout.addColumnData(new ColumnWeightData(10, true)); - - tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.Modified_3")); //$NON-NLS-1$ - tableColumn.addSelectionListener(getColumnListener()); - layout.addColumnData(new ColumnWeightData(30, true)); - - tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.URL_4")); //$NON-NLS-1$ - layout.addColumnData(new ColumnWeightData(30, true)); - - folderContentsTable = new TableViewer(table); - folderContentsTable.setContentProvider(new SiteLazyContentProvider()); - folderContentsTable.setLabelProvider(new SiteExplorerViewLabelProvider()); - - folderContentsTable.getControl().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent event) { - if (event.keyCode == SWT.F5) { - RemoteResourceElement folder = (RemoteResourceElement)folderContentsTable.getInput(); - if(folder != null) { - folder.setCachedChildren(null); - folderContentsTable.refresh(); - } - } - } - }); - - folderContentsTable.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent e) { - IStructuredSelection selection = (IStructuredSelection)folderContentsTable.getSelection(); - if(selection.size() == 1) { - final RemoteResourceElement[] remoteFolders = getSelectedRemoteFolder(selection); - if(remoteFolders.length == 1) { - IStructuredSelection treeSelection = (IStructuredSelection)folderTree.getSelection(); - expandInTreeCurrentSelection(treeSelection, false /*don't toggle*/); - folderTree.setSelection(new StructuredSelection(remoteFolders[0])); - } - } - } - }); - FolderListingSorter sorter = new FolderListingSorter(FolderListingSorter.NAME); - sorter.setReversed(false); - folderContentsTable.setSorter(sorter); - - sash.setWeights(new int[] {33, 67}); - - TargetManager.addSiteListener(this); - - root = new SiteRootsElement(getViewSite().getWorkbenchWindow()); - initalizeActions(); - folderTree.setInput(root); - - // F1 Help - WorkbenchHelp.setHelp(folderTree.getControl(), IHelpContextIds.SITE_EXPLORER_VIEW); - } - - private Shell getShell() { - return folderTree.getTree().getShell(); - } - - private RemoteResourceElement[] getSelectedRemoteFolder(IStructuredSelection selection) { - if (!selection.isEmpty()) { - final List folders = new ArrayList(); - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if(o instanceof RemoteResourceElement) { - folders.add(o); - } - } - return (RemoteResourceElement[]) folders.toArray(new RemoteResourceElement[folders.size()]); - } - return new RemoteResourceElement[0]; - } - - private void expandInTreeCurrentSelection(IStructuredSelection selection, boolean toggle) { - if (!selection.isEmpty()) { - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object element = it.next(); - if(toggle) { - folderTree.setExpandedState(element, !folderTree.getExpandedState(element)); - } else { - folderTree.setExpandedState(element, true); - } - } - } - } - - /** - * Method updateFileTable. - */ - private void updateFileTable(RemoteResourceElement remoteFolder) { - if(remoteFolder != null && !remoteFolder.equals(folderContentsTable.getInput())) { - folderContentsTable.setInput(remoteFolder); - } - } - - private void initalizeActions() { - final Shell shell = folderContentsTable.getTable().getShell(); - // Create actions - - // Refresh (toolbar) - addSiteAction = new Action(Policy.bind("SiteExplorerView.addSiteAction"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SITE_ELEMENT)) { //$NON-NLS-1$ - public void run() { - ConfigureTargetWizard wizard = new ConfigureTargetWizard(); - wizard.init(null, null); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.open(); - } - }; - addSiteAction.setToolTipText(Policy.bind("SiteExplorerView.addSiteActionTooltip")); //$NON-NLS-1$ - WorkbenchHelp.setHelp(addSiteAction, IHelpContextIds.ADD_SITE_ACTION); - - newFolderAction = new Action(Policy.bind("SiteExplorerView.newFolderAction"), WorkbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_OBJ_FOLDER)) { //$NON-NLS-1$ - public void run() { - final Shell shell = folderTree.getTree().getShell(); - try { - // assume that only one folder is selected in the folder tree, this - // is enforced by isEnable() method for this action - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - Object currentSelection = selection.getFirstElement(); - - RemoteResourceElement selectedFolder; - if(!selection.isEmpty()) { - selectedFolder = getSelectedRemoteFolder(selection)[0]; - } else { - selectedFolder = (RemoteResourceElement)folderContentsTable.getInput(); - } - - IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(shell, selectedFolder.getRemoteResource(), Policy.bind("CreateNewFolderAction.newFolderName")); //$NON-NLS-1$ - if (newFolder == null) - return; - - // force a refresh - selectedFolder.setCachedChildren(null); - - // select the newly added folder - RemoteResourceElement newFolderUIElement = new RemoteResourceElement(newFolder); - folderTree.refresh(currentSelection); - expandInTreeCurrentSelection(new StructuredSelection(currentSelection), false); - folderTree.setSelection(new StructuredSelection(newFolderUIElement)); - } catch (TeamException e) { - Utils.handle(e); - return; - } - } - public boolean isEnabled() { - return folderContentsTable.getInput() != null || - getSelectedRemoteFolder((IStructuredSelection)folderTree.getSelection()).length == 1; - } - }; - WorkbenchHelp.setHelp(newFolderAction, IHelpContextIds.NEW_FOLDER_ACTION); - - IActionBars bars = getViewSite().getActionBars(); - IToolBarManager tbm = bars.getToolBarManager(); - tbm.add(addSiteAction); - tbm.update(false); - - // Properties - propertiesAction = new PropertyDialogAction(shell, folderTree); - getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, propertiesAction); - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - if (selection.size() == 1 && selection.getFirstElement() instanceof SiteElement) { - propertiesAction.setEnabled(true); - } else { - propertiesAction.setEnabled(false); - } - folderTree.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection ss = (IStructuredSelection)event.getSelection(); - boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof SiteElement; - propertiesAction.setEnabled(enabled); - } - }); - - MenuManager treeMgr = new MenuManager(); - MenuManager tableMgr = new MenuManager(); - Tree tree = folderTree.getTree(); - Table table = folderContentsTable.getTable(); - Menu treeMenu = treeMgr.createContextMenu(tree); - Menu tableMenu = tableMgr.createContextMenu(table); - IMenuListener menuListener = new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - // Misc additions - MenuManager sub = new MenuManager(Policy.bind("SiteExplorerView.newMenu"), IWorkbenchActionConstants.GROUP_ADD); //$NON-NLS-1$ - sub.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - manager.add(sub); - manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - sub.add(addSiteAction); - sub.add(newFolderAction); - manager.add(propertiesAction); - } - }; - treeMgr.addMenuListener(menuListener); - treeMgr.setRemoveAllWhenShown(true); - tableMgr.addMenuListener(menuListener); - tableMgr.setRemoveAllWhenShown(true); - tree.setMenu(treeMenu); - table.setMenu(tableMenu); - getSite().registerContextMenu(tableMgr, folderContentsTable); - getSite().registerContextMenu(treeMgr, folderTree); - } - - /** - * Add the new site to the viewer and make it the current selection. - * - * @see ISiteListener#siteAdded(Site) - */ - public void siteAdded(Site site) { - SiteElement element = new SiteElement(site, getViewSite().getWorkbenchWindow()); - folderTree.add(root, element); - folderTree.setSelection(new StructuredSelection(element)); - } - - /** - * Remote the site from the viewer and select the next site in the - * tree. - * - * @see ISiteListener#siteRemoved(Site) - */ - public void siteRemoved(Site site) { - folderTree.remove(new SiteElement(site)); - selectNextObjectInTreeViewer(); - } - - private void selectNextObjectInTreeViewer() { - Object[] items = folderTree.getVisibleExpandedElements(); - if(items.length > 0) { - folderTree.setSelection(new StructuredSelection(items[0])); - } else { - folderContentsTable.setInput(null); - } - } - - /** - * Adds the listener that sets the sorter. - */ - private SelectionListener getColumnListener() { - /** - * This class handles selections of the column headers. - * Selection of the column header will cause resorting - * of the shown tasks using that column's sorter. - * Repeated selection of the header will toggle - * sorting order (ascending versus descending). - */ - return new SelectionAdapter() { - /** - * Handles the case of user selecting the - * header area. - * <p>If the column has not been selected previously, - * it will set the sorter of that column to be - * the current tasklist sorter. Repeated - * presses on the same column header will - * toggle sorting order (ascending/descending). - */ - public void widgetSelected(SelectionEvent e) { - // column selected - need to sort - // only allow sorting on name for now - int column = folderContentsTable.getTable().indexOf((TableColumn) e.widget); - if(column == FolderListingSorter.NAME) { - FolderListingSorter oldSorter = (FolderListingSorter)folderContentsTable.getSorter(); - if (oldSorter != null && column == oldSorter.getColumnNumber()) { - oldSorter.setReversed(!oldSorter.isReversed()); - folderContentsTable.refresh(); - } else { - folderContentsTable.setSorter(new FolderListingSorter(column)); - } - } - } - }; - } - - /** - * @see IWorkbenchPart#setFocus() - */ - public void setFocus() { - } - /** - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - super.dispose(); - TargetManager.removeSiteListener(this); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java deleted file mode 100644 index a0f2e0ef9..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java +++ /dev/null @@ -1,54 +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.target; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class SiteExplorerViewLabelProvider extends WorkbenchLabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex == 0) { - return super.getImage(element); - } - return null; - } - public String getColumnText(Object element, int columnIndex) { - switch (columnIndex) { - case 0 : - return super.getText(element); - case 1 : - if(element instanceof RemoteResourceElement) { - RemoteResourceElement remote = ((RemoteResourceElement)element); - if(remote.getRemoteResource().isContainer()) { - return ""; //$NON-NLS-1$ - } - int size = remote.getSize(); - int sizeKb = size / 1000; - if(sizeKb == 0 && size % 1000 > 0) { - sizeKb = 1; - } - return Policy.bind("SiteExplorerViewLabelProvider.fileSize", new Integer(sizeKb).toString()); //$NON-NLS-1$ - } - case 2 : - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getLastModified(); - } - case 3 : - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getRemoteResource().getURL().toExternalForm(); - } - } - return ""; //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java deleted file mode 100644 index 0bdf305f0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java +++ /dev/null @@ -1,25 +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.target; - -import org.eclipse.ui.model.WorkbenchContentProvider; - -public class SiteLazyContentProvider extends WorkbenchContentProvider { - - public boolean hasChildren(Object element) { - if (element == null) { - return false; - } - // the + box will always appear, but then disappear - // if not needed after you first click on it. - return true; // just always return true to avoid going to server - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java deleted file mode 100644 index d7022f3a4..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java +++ /dev/null @@ -1,68 +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.target; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * Used to show all Sites defined in the workbench. - */ -public class SiteRootsElement implements IWorkbenchAdapter, IAdaptable { - private Site[] sites = null; - - // progress monitoring support - private IRunnableContext runContext; - - public SiteRootsElement(Site[] sites, IRunnableContext runContext) { - this.sites = sites; - this.runContext = runContext; - } - - public SiteRootsElement(IRunnableContext runContext) { - this(null, runContext); - } - - public ImageDescriptor getImageDescriptor(Object object) { - return null; - } - - public Object[] getChildren(Object o) { - Site[] childSites; - if(sites == null) { - childSites = TargetManager.getSites(); - } else { - childSites = sites; - } - SiteElement[] siteElements = new SiteElement[childSites.length]; - for (int i = 0; i < childSites.length; i++) { - siteElements[i] = new SiteElement(childSites[i], runContext); - } - return siteElements; - } - - public String getLabel(Object o) { - return null; - } - - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) return this; - return null; - } - - public Object getParent(Object o) { - return null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java deleted file mode 100644 index 6e4681c4a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java +++ /dev/null @@ -1,187 +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.target; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * Wizard page that allows selecting an existing target provider site - * or to create a new site. - */ -public class SiteSelectionPage extends TargetWizardPage { - private TableViewer table; - private Button useExistingRepo; - private Button useNewRepo; - private Button disconnectTarget; - private Site site; - private TargetProvider currentProvider; - - private boolean disconnect = false; - - public SiteSelectionPage(String pageName, String title, ImageDescriptor titleImage, TargetProvider currentProvider) { - super(pageName, title, titleImage); - setDescription(Policy.bind("SiteSelectionPage.description")); //$NON-NLS-1$ - this.currentProvider = currentProvider; - } - - protected TableViewer createTable(Composite parent) { - Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - TableLayout layout = new TableLayout(); - layout.addColumnData(new ColumnWeightData(100, true)); - table.setLayout(layout); - TableColumn col = new TableColumn(table, SWT.NONE); - col.setResizable(true); - - return new TableViewer(table); - } - - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 2); - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.TARGET_NEW_SITE_PAGE); - - Label description = new Label(composite, SWT.WRAP); - GridData data = new GridData(); - data.horizontalSpan = 2; - data.widthHint = 350; - description.setLayoutData(data); - description.setText(Policy.bind("SiteSelectionPage.label")); //$NON-NLS-1$ - - useExistingRepo = createRadioButton(composite, Policy.bind("SiteSelectionPage.useExisting"), 2); //$NON-NLS-1$ - table = createTable(composite); - table.setContentProvider(new WorkbenchContentProvider()); - table.setLabelProvider(new WorkbenchLabelProvider() { - protected String decorateText(String input, Object element) { - if(currentProvider != null && element.equals(new SiteElement(currentProvider.getSite()))) { - IPath mapping = UrlUtil.getTrailingPath(currentProvider.getURL(), currentProvider.getSite().getURL()); - if(mapping.isEmpty()) { - return Policy.bind("SiteSelectionPage.siteLabelCurrent", super.decorateText(input, element)); //$NON-NLS-1$ - } else { - return Policy.bind("SiteSelectionPage.siteLabelCurrentWithMapping", super.decorateText(input, element), mapping.toString()); //$NON-NLS-1$ - } - } - return super.decorateText(input, element); - } - }); - - table.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement(); - if(siteElement != null) { - site = siteElement.getSite(); - setPageComplete(true); - } else { - setPageComplete(false); - } - } - }); - useNewRepo = createRadioButton(composite, Policy.bind("SiteSelectionPage.createNew"), 2); //$NON-NLS-1$ - - useExistingRepo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - if (!useExistingRepo.getSelection()) { - table.getTable().setEnabled(false); - site = null; - } else { - table.getTable().setEnabled(true); - SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement(); - if(siteElement != null) { - site = siteElement.getSite(); - } - } - } - }); - - useNewRepo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - SiteSelectionPage.this.setPageComplete(! useNewRepo.getSelection()); - } - }); - - - if(currentProvider != null ) { - disconnectTarget = createRadioButton(composite, Policy.bind("SiteSelectionPage.disconnectTarget"), 2); //$NON-NLS-1$ - disconnectTarget.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - disconnect = disconnectTarget.getSelection(); - SiteSelectionPage.this.setPageComplete(true); - } - }); - } - - setControl(composite); - initializeValues(); - } - - /** - * Initializes states of the controls. - */ - private void initializeValues() { - Site[] sites = TargetManager.getSites(); - table.setInput(new SiteRootsElement(null /* no progress monitoring required */)); - if (sites.length == 0) { - useNewRepo.setSelection(true); - } else { - useExistingRepo.setSelection(true); - if(currentProvider != null) { - table.setSelection(new StructuredSelection(new SiteElement(currentProvider.getSite()))); - } else { - table.setSelection(new StructuredSelection(new SiteElement(sites[0]))); - } - } - } - - public Site getSite() { - return site; - } - - public boolean isDisconnect() { - return disconnect; - } - - /** - * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage() - */ - public boolean canFlipToNextPage() { - if(isDisconnect()) { - return false; - } else { - return true; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java deleted file mode 100644 index c0e12ee71..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.net.URL; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.team.internal.core.target.Site; - -public class SiteViewSorter extends ViewerSorter { - - public int category(Object element) { - if (element instanceof Site) { - return ((Site)element).getType().hashCode(); - } - return 0; - } - - public int compare(Viewer viewer, Object o1, Object o2) { - int cat1 = category(o1); - int cat2 = category(o2); - if (cat1 != cat2) return cat1 - cat2; - - if (o1 instanceof Site && o2 instanceof Site) { - URL site1 = ((Site)o1).getURL(); - URL site2 = ((Site)o2).getURL(); - return site1.toExternalForm().compareTo(site2.toExternalForm()); - } - return super.compare(viewer, o1, o2); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java deleted file mode 100644 index e4be4c143..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java +++ /dev/null @@ -1,51 +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.target; - - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.team.internal.ui.sync.SyncCompareInput; -import org.eclipse.team.internal.ui.sync.SyncView; - -/** - * Action for catchup/release in popup menus. - */ -public class SyncAction extends TeamAction { - - public void run(IAction action) { - IResource[] resources = getSelectedResources(); - SyncView view = SyncView.findViewInActivePage(getTargetPage()); - if (view != null) { - view.showSync(getCompareInput(resources), getTargetPage()); - } - } - - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (!resource.isAccessible()) return false; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) return false; - } - return true; - } - - protected SyncCompareInput getCompareInput(IResource[] resources) { - return new TargetSyncCompareInput(resources, IRemoteSyncElement.GRANULARITY_TIMESTAMP); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java deleted file mode 100644 index 777e087c9..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.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.target; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.actions.TeamAction; - -public abstract class TargetAction extends TeamAction { - /** - * Get selected remote target folders - */ - protected IRemoteTargetResource[] getSelectedRemoteFolders() { - ArrayList resources = null; - if (!selection.isEmpty()) { - resources = new ArrayList(); - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - IRemoteTargetResource remote = null; - if (next instanceof RemoteResourceElement) { - remote = ((RemoteResourceElement)next).getRemoteResource(); - } else if(next instanceof SiteElement) { - try { - remote = ((SiteElement)next).getSite().getRemoteResource(); - } catch (TeamException e) { - Utils.handle(e); - return new IRemoteTargetResource[0]; - } - } - if(remote != null && remote.isContainer()) { - resources.add(remote); - continue; - } - } - } - if (resources != null && !resources.isEmpty()) { - return (IRemoteTargetResource[])resources.toArray(new IRemoteTargetResource[resources.size()]); - } - return new IRemoteTargetResource[0]; - } - - /** - * Get selected remote target folders - */ - protected Site[] getSelectedSites() { - ArrayList sites = new ArrayList();; - if (!selection.isEmpty()) { - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - IRemoteTargetResource remote = null; - if (next instanceof SiteElement) { - sites.add(((SiteElement)next).getSite()); - } - } - } - return (Site[])sites.toArray(new Site[sites.size()]); - } - - protected IResource[] findResourcesWithOutgoingChanges(IResource[] resources) throws TeamException, CoreException { - // Collect the dirty resource - final List dirtyResources = new ArrayList(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - final TargetProvider provider = TargetManager.getProvider(resource.getProject()); - resource.accept(new IResourceVisitor() { - public boolean visit(IResource resource) throws CoreException { - if (resource.getType() == IResource.FILE) { - if (provider.isDirty(resource) || ! provider.hasBase(resource)) { - dirtyResources.add(resource); - } - } else { - // Check for outgoing folder deletions? - } - return true; - } - }, IResource.DEPTH_INFINITE, true /* include phantoms */); - } - return (IResource[]) dirtyResources.toArray(new IResource[dirtyResources.size()]); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java deleted file mode 100644 index a2770d958..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer; -import org.eclipse.team.internal.ui.sync.SyncView; -import org.eclipse.ui.help.WorkbenchHelp; -public class TargetCatchupReleaseViewer extends CatchupReleaseViewer { - private GetSyncAction getAction; - private PutSyncAction putAction; - - public TargetCatchupReleaseViewer(Composite parent, TargetSyncCompareInput input) { - super(parent, input); - initializeActions(input); - // set F1 help - WorkbenchHelp.setHelp(this.getControl(), IHelpContextIds.TARGET_CATCHUP_RELEASE_VIEWER); - } - - /** - * Creates the actions for this viewer. - */ - private void initializeActions(final TargetSyncCompareInput diffModel) { - Shell shell = getControl().getShell(); - getAction = new GetSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Get_1"), shell); //$NON-NLS-1$ - putAction = new PutSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Put_2"), shell); //$NON-NLS-1$ - } - protected void fillContextMenu(IMenuManager manager) { - super.fillContextMenu(manager); - manager.add(new Separator()); - switch (getSyncMode()) { - case SyncView.SYNC_INCOMING: - getAction.update(SyncView.SYNC_INCOMING); - manager.add(getAction); - break; - case SyncView.SYNC_OUTGOING: - putAction.update(SyncView.SYNC_INCOMING); - manager.add(putAction); - break; - case SyncView.SYNC_BOTH: - getAction.update(SyncView.SYNC_INCOMING); - manager.add(getAction); - putAction.update(SyncView.SYNC_INCOMING); - manager.add(putAction); - break; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java deleted file mode 100644 index 1e3c15bba..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java +++ /dev/null @@ -1,59 +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.target; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.actions.TeamAction; - -public class TargetProjectAction extends TeamAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IProject project = getSelectedProjects()[0]; - ConfigureTargetWizard wizard = new ConfigureTargetWizard(); - wizard.init(null, project); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.open(); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("ConfigureTargetAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (!selectedProjects[0].isAccessible()) return false; -/* try { - if (TargetManager.getProvider(selectedProjects[0]) == null) return true; - } catch (TeamException e) { - TeamPlugin.log(IStatus.ERROR, "Exception getting provider", e); - return false; - } - return false; -*/ - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java deleted file mode 100644 index 9212c6776..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java +++ /dev/null @@ -1,89 +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.target; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -public class TargetSiteContentHandler extends DefaultHandler implements ContentHandler { - private StringBuffer buffer; - private List propList; - private String target; - - /** - * Constructor for TargetSiteContentHandler. - */ - public TargetSiteContentHandler() { - super(); - propList=new LinkedList(); - } - - /** - * @see org.xml.sax.ContentHandler#characters(char[], int, int) - */ - public void characters(char[] ch, int start, int length) throws SAXException { - if (buffer!=null) - buffer.append(ch, start, length); - } - - /** - * @see org.xml.sax.ContentHandler#endElement(String, String, String) - */ - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - if (qName.equals("site")) { //$NON-NLS-1$ - Properties props=new Properties(); - byte[] bytes=buffer.toString().getBytes(); - InputStream iStream=new ByteArrayInputStream(bytes); - try { - props.load(iStream); - props.setProperty("target", target); //$NON-NLS-1$ - propList.add(props); - } catch (IOException e) { - //TODO: log an error. - } - } - } - - /** - * Retrieve the property list that has been built up. - * @return Properties[] - */ - Properties[] getProperties() { - return (Properties[]) propList.toArray(new Properties[propList.size()]); - } - - /** - * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) - */ - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - if (qName.equals("site")) { //$NON-NLS-1$ - buffer = new StringBuffer(); - target=atts.getValue("target"); //$NON-NLS-1$ - } - } - - /** - * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) - */ - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - ; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java deleted file mode 100644 index bfcbb0aab..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java +++ /dev/null @@ -1,191 +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.target; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.lang.reflect.InvocationTargetException; -import java.util.Properties; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.wizards.ProjectSetImportWizard; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; - -/** - * This wizard allows the user to save the settings used by Target sites to a file. - */ -public class TargetSiteExportWizard extends Wizard implements IExportWizard { - private ExportTargetSiteMainPage mainPage; - private IStructuredSelection selection; - /** - * Constructor for TargetSiteExportWizard. - */ - public TargetSiteExportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("TargetSiteExportWizard.Target_Site")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - final boolean[] result = new boolean[] { false }; - try { - getContainer().run(false, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - String filename = mainPage.getFileName(); - Path path = new Path(filename); - if (path.getFileExtension() == null) { - filename = filename + ".tsf"; //$NON-NLS-1$ - } - ProjectSetImportWizard.lastFile = filename; - File file = new File(filename); - File parentFile = file.getParentFile(); - if (parentFile != null && !parentFile.exists()) { - boolean r = MessageDialog.openQuestion( - getShell(), - Policy.bind("TargetSiteExportWizard.Creation_Question"), //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Create_dir")); //$NON-NLS-1$ - if (!r) { - result[0] = false; - return; - } - r = parentFile.mkdirs(); - if (!r) { - MessageDialog.openError(getShell(), - Policy.bind("TargetSiteExportWizard.Export_Problems"), //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Directory_creation_error") //$NON-NLS-1$ - ); - result[0] = false; - return; - } - } - if (file.exists() && file.isFile()) { - boolean r = MessageDialog.openQuestion( - getShell(), - Policy.bind("TargetSiteExportWizard.Overwrite_Question"), //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Overwrite_file") //$NON-NLS-1$ - ); - if (!r) { - result[0] = false; - return; - } - } - BufferedWriter writer = null; - try { - OutputStream jout = new FileOutputStream(file); - - writer = new BufferedWriter(new OutputStreamWriter(jout, "UTF-8")); //$NON-NLS-1$ - writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ - writer.newLine(); - writer.write("<tsf version=\"2.0\">"); //$NON-NLS-1$ - writer.newLine(); - writer.flush(); - - Site[] sites = mainPage.getSelectedSites(); - Properties props; - monitor.beginTask(null, 5 * sites.length); - String target; - - //The 1st one needs to have a unique comment since it only requires an opening tag: - props = sites[0].getConfiguration(); - monitor.worked(2); - target=sites[0].getType(); - monitor.worked(1); - props.store(jout, "<site target=\""+target+"\">"); //$NON-NLS-1$ //$NON-NLS-2$ - monitor.worked(2); - - // For each additional site, write the config to disk: - for (int i = 1; i < sites.length; i++) { - props = sites[i].getConfiguration(); - monitor.worked(2); - target=sites[i].getType(); - monitor.worked(1); - props.store(jout, "</site> <site target=\""+target+"\">"); //$NON-NLS-1$ //$NON-NLS-2$ - monitor.worked(2); - } - jout.flush();//This line may not actually be needed but it's not doing any harm either. - - writer.write("</site>"); //$NON-NLS-1$ - writer.newLine(); - writer.write("</tsf>"); //$NON-NLS-1$ - writer.newLine(); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException) target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException) target; - } - if (target instanceof Error) { - throw (Error) target; - } - } - return result[0]; - } - - /** - * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } - - /** - * @see org.eclipse.jface.wizard.IWizard#addPages() - */ - public void addPages() { - mainPage = new ExportTargetSiteMainPage("targetSiteMainPage", //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Export_a_Target_Site"), //$NON-NLS-1$ - TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_PROJECTSET_EXPORT_BANNER) //TODO: We need our own banner... - ); - Site[] sites = (Site[]) selection.toList().toArray(new Site[0]); - mainPage.setSelectedSites(sites); - mainPage.setFileName(ProjectSetImportWizard.lastFile); - addPage(mainPage); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java deleted file mode 100644 index 98f820a7c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java +++ /dev/null @@ -1,158 +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.target; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.core.target.ISiteFactory; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public class TargetSiteImportWizard extends Wizard implements IImportWizard { - public static String lastFile; - - private ImportTargetSiteMainPage mainPage; - - /** - * Retrieves the Site object that the TargetProvider is contained in. - * @return Site - */ - Site getSite(Properties properties) { - try { - URL url = new URL(properties.getProperty("location")); //$NON-NLS-1$ - return TargetManager.getSite(properties.getProperty("target"), url); //$NON-NLS-1$ - } catch (MalformedURLException e) { - return null; - } - } - - public TargetSiteImportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("TargetSiteImportWizard.Target_Site")); //$NON-NLS-1$ - } - - public void addPages() { - mainPage = new ImportTargetSiteMainPage( - "targetSiteMainPage", //$NON-NLS-1$ - Policy.bind("TargetSiteImportWizard.Import_Target_Site"), //$NON-NLS-1$ - TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_PROJECTSET_IMPORT_BANNER) - ); - mainPage.setFileName(lastFile); - addPage(mainPage); - } - - /** - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - try { - getContainer().run(true, true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - InputStreamReader reader = null; - try { - String filename = mainPage.getFileName(); - lastFile = filename; - reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$ - - SAXParserFactory factory = SAXParserFactory.newInstance(); - SAXParser parser; - parser = factory.newSAXParser(); - TargetSiteContentHandler handler = new TargetSiteContentHandler(); - InputSource source = new InputSource(reader); - parser.parse(source, handler); - - Properties[] propList = handler.getProperties(); - for (int i = 0; i < propList.length; i++) { - String target = propList[i].getProperty("target"); //$NON-NLS-1$ - ISiteFactory siteFactory = TargetManager.getSiteFactory(target); - Assert.isNotNull(siteFactory); - - final Site newsite = siteFactory.newSite(propList[i]); - Site[] existingSites = TargetManager.getSites(); - boolean dupe = false; - for (int j = 0; j < existingSites.length; j++) { - if (existingSites[j].equals(newsite)) - dupe = true; - } - if (!dupe) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - TargetManager.addSite(newsite); - } - }); - } - } - - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (ParserConfigurationException e) { - throw new InvocationTargetException(e); - } catch (SAXException e) { - throw new InvocationTargetException(e); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException) target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException) target; - } - if (target instanceof Error) { - throw (Error) target; - } - } - return true; - } - - /** - * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) {} - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java deleted file mode 100644 index ff99c0a08..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Set; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.team.internal.ui.sync.ChangedTeamContainer; -import org.eclipse.team.internal.ui.sync.ITeamNode; -import org.eclipse.team.internal.ui.sync.SyncSet; -import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer; - -public abstract class TargetSyncAction extends Action { - private TargetSyncCompareInput diffModel; - private ISelectionProvider selectionProvider; - - protected int syncMode; - private Shell shell; - - protected static IRemoteResource getRemoteResourceFor(IResource local) throws TeamException { - return TargetManager.getProvider(local.getProject()).getRemoteResourceFor(local); - } - - /** - * Creates a TargetSyncAction which works on selection and doesn't commit changes. - */ - public TargetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) { - super(label); - this.diffModel = model; - this.selectionProvider = sp; - this.shell = shell; - } - - protected Shell getShell() { - return shell; - } - - protected TargetSyncCompareInput getDiffModel() { - return diffModel; - } - - /** - * Returns true if at least one node can perform the specified action. - */ - private boolean isEnabled(Object[] nodes) { - for (int i = 0; i < nodes.length; i++) { - if (nodes[i] instanceof ITeamNode) { - ITeamNode node = (ITeamNode)nodes[i]; - if (isEnabled(node)) { - return true; - } - } else { - if (nodes[i] instanceof IDiffContainer) - if (isEnabled(((IDiffContainer)nodes[i]).getChildren())) - return true; - } - } - return false; - } - - protected abstract boolean isEnabled(ITeamNode node); - - /** - * Perform the sychronization operation. - */ - public void run() { - ISelection s = selectionProvider.getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return; - } - final SyncSet set = new SyncSet((IStructuredSelection)s); - removeNonApplicableNodes(set, syncMode); - final SyncSet[] result = new SyncSet[1]; - WorkspaceModifyOperation op = new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - result[0] = TargetSyncAction.this.run(set, monitor); - } - }; - try { - run(op, Policy.bind("TargetSyncAction.errorEncountered")); //$NON-NLS-1$ - } catch (InterruptedException e) { - } - if (result[0] != null) { - // all returned nodes that have a changed sync kind are assumed - // to have been operated on and will be removed from the diff tree. - removeNodes(result[0].getChangedNodes()); - - // any node that claims that it's IN_SYNC will be automatically - // filtered from the diff tree - see DiffElement.setKind(). - diffModel.updateView(); - } - } - - protected abstract void removeNonApplicableNodes(SyncSet set, int syncMode); - - /** - * The given nodes have been synchronized. Remove them from - * the sync set. - * - * For folders that are outgoing deletions, we may need to leave the - * folder as is or adjust the sync kind depending on the sync kind of - * the folder's children. - * - * @see CVSSyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor) - */ - private void removeNodes(final ITeamNode[] nodes) { - // Update the model - Set outgoingFolderDeletions = new HashSet(); - for (int i = 0; i < nodes.length; i++) { - if (nodes[i].getClass() == UnchangedTeamContainer.class) { - // Unchanged containers get removed automatically when all - // children are removed - continue; - } - if (nodes[i].getClass() == ChangedTeamContainer.class) { - // If this node still has children, convert to an - // unchanged container, then it will disappear when - // all children have been removed. - ChangedTeamContainer container = (ChangedTeamContainer)nodes[i]; - IDiffElement[] children = container.getChildren(); - if (children.length > 0) { - IDiffContainer parent = container.getParent(); - UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource()); - for (int j = 0; j < children.length; j++) { - unchanged.add(children[j]); - } - parent.removeToRoot(container); - continue; - } - // No children, it will get removed below. - } - nodes[i].getParent().removeToRoot(nodes[i]); - } - } - - /** - * Updates the action with the latest selection, setting enablement - * as necessary. - */ - public void update(int syncMode) { - this.syncMode = syncMode; - IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection(); - setEnabled(isEnabled(selection.toArray())); - } - - /** - * Subclasses must implement this method, which performs action-specific code. - * - * It may return the sync set which was passed in, or null. - */ - protected abstract SyncSet run(SyncSet syncSet, IProgressMonitor monitor); - - /** - * Helper method to run a runnable in a progress monitor dialog, and display any errors. - */ - protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); - try { - dialog.run(true, true, op); - } catch (InvocationTargetException e) { - Throwable throwable = e.getTargetException(); - IStatus error = null; - if (throwable instanceof CoreException) { - error = ((CoreException)throwable).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$ - } - ErrorDialog.openError(shell, problemMessage, error.getMessage(), error); - TeamUIPlugin.log(error.getSeverity(), error.getMessage(), throwable); - } - } - - /** - * Helper method. Check if a save is necessary. If it is, prompt the user to save. - * Return true if all necessary saves have been performed, false otherwise. - */ - protected boolean saveIfNecessary() { - return getDiffModel().saveIfNecessary(); - } - - /** - * Convenience method that maps the given resources to their target providers. - * The returned Hashtable has keys which are TargetProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - TargetProvider provider = TargetManager.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java deleted file mode 100644 index 55b00b9d5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.target.ITargetRunnable; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer; -import org.eclipse.team.internal.ui.sync.SyncCompareInput; - -public class TargetSyncCompareInput extends SyncCompareInput { - - private IResource[] resources; - - protected TargetSyncCompareInput(IResource[] resources, int granularity) { - super(granularity); - this.resources = resources; - } - - /** - * @see SyncCompareInput#createSyncElements(IProgressMonitor) - */ - protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(null, resources.length); - IRemoteSyncElement[] elements = new IRemoteSyncElement[resources.length]; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - elements[i] = provider.getRemoteSyncElement(resource); - monitor.worked(1); - } - return elements; - } finally { - monitor.done(); - } - } - - /** - * @see CompareEditorInput#createDiffViewer(Composite) - */ - public Viewer createDiffViewer(Composite parent) { - CatchupReleaseViewer viewer = new TargetCatchupReleaseViewer(parent, this); - setViewer(viewer); - return viewer; - } - - protected void updateView() { - // Update the view - if (getDiffRoot().hasChildren()) { - getViewer().refresh(); - } else { - getViewer().setInput(null); - } - - // Update the status line - updateStatusLine(); - } - - /** - * @see SyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor) - */ - protected IDiffElement collectResourceChanges( - final IDiffContainer parent, - final IRemoteSyncElement tree, - IProgressMonitor pm) throws TeamException { - - final IDiffElement[] result = new IDiffElement[] {null}; - TargetProvider provider = TargetManager.getProvider(tree.getLocal().getProject()); - provider.run(new ITargetRunnable() { - public void run(IProgressMonitor monitor) throws TeamException { - result[0] = TargetSyncCompareInput.super.collectResourceChanges(parent, tree, monitor); - } - }, pm); - return result[0]; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java deleted file mode 100644 index 3ee584f3f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java +++ /dev/null @@ -1,199 +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.target; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/* - * Common superclass for wizard pages. Provides convenience methods - * for widget creation. - */ -public abstract class TargetWizardPage extends WizardPage { - - private static final int COMBO_HISTORY_LENGTH = 5; - - /* - * WizardPage constructor comment. - * @param pageName the name of the page - */ - public TargetWizardPage(String pageName) { - super(pageName); - } - - /* - * WizardPage constructor comment. - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page - */ - public TargetWizardPage(String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - protected Button createRadioButton(Composite parent, String label, int span) { - Button button = new Button(parent, SWT.RADIO); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = span; - button.setLayoutData(data); - return button; - } - - /* - * Creates a new checkbox instance and sets the default layout data. - * - * @param group the composite in which to create the checkbox - * @param label the string to set into the checkbox - * @return the new checkbox - */ - protected Button createCheckBox(Composite group, String label) { - Button button = new Button(group, SWT.CHECK | SWT.LEFT); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = 2; - button.setLayoutData(data); - return button; - } - - /* - * Utility method that creates a combo box - * - * @param parent the parent for the new label - * @return the new widget - */ - protected Combo createCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.READ_ONLY); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - combo.setLayoutData(data); - return combo; - } - - /* - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - - /* - * Utility method that creates a label instance - * and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @return the new label - */ - protected Label createLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - return label; - } - - /* - * Create a text field specific for this application - * - * @param parent the parent of the new text field - * @return the new text field - */ - protected Text createTextField(Composite parent) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.verticalAlignment = GridData.CENTER; - data.grabExcessVerticalSpace = false; - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - text.setLayoutData(data); - return text; - } - - /* - * Adds an entry to a history, while taking care of duplicate history items - * and excessively long histories. The assumption is made that all histories - * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>. - * - * @param history the current history - * @param newEntry the entry to add to the history - * @return the history with the new entry appended - */ - protected String[] addToHistory(String[] history, String newEntry) { - ArrayList l = new ArrayList(Arrays.asList(history)); - addToHistory(l, newEntry); - String[] r = new String[l.size()]; - l.toArray(r); - return r; - } - - /* - * Adds an entry to a history, while taking care of duplicate history items - * and excessively long histories. The assumption is made that all histories - * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>. - * - * @param history the current history - * @param newEntry the entry to add to the history - */ - protected void addToHistory(List history, String newEntry) { - history.remove(newEntry); - history.add(0,newEntry); - - // since only one new item was added, we can be over the limit - // by at most one item - if (history.size() > COMBO_HISTORY_LENGTH) - history.remove(COMBO_HISTORY_LENGTH); - } - - /* - * Utility method to create an editable combo box - * - * @param parent the parent of the combo box - * @return the created combo - */ - protected Combo createEditableCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.NULL); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - combo.setLayoutData(data); - return combo; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java deleted file mode 100644 index 6daadc520..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java +++ /dev/null @@ -1,110 +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.target; - -import java.lang.reflect.InvocationTargetException; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.dialogs.IPromptCondition; -import org.eclipse.team.internal.ui.dialogs.PromptingDialog; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class UploadAction extends TargetAction { - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) - return false; - if(! provider.canPut(resource)) - return false; //if one can't don't allow for any - // Don't want to go though the resources deeply to see if there are dirty children - } - return true; - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - boolean hasOutgoing = false; - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1024); - final TargetProvider provider = (TargetProvider)iterator.next(); - subMonitor.setTaskName(Policy.bind("UploadAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - - IResource[] providerResources = (IResource[])((List)table.get(provider)).toArray(new IResource[0]); - IResource[] outgoingChanges = findResourcesWithOutgoingChanges(providerResources); - if (outgoingChanges.length > 0) { - // Prompt for any outgoing deletions - PromptingDialog prompt = new PromptingDialog( - getShell(), - outgoingChanges, - new IPromptCondition() { - public boolean needsPrompt(IResource resource) { - return ! resource.exists(); - } - public String promptMessage(IResource resource) { - return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString()); //$NON-NLS-1$ - } - }, - Policy.bind("UploadAction.confirmDeletionTitle"));//$NON-NLS-1$ - - // Put the resources that were selected - hasOutgoing = true; - provider.put(prompt.promptForMultiple(), subMonitor); - } - } - if (!hasOutgoing) { - getShell().getDisplay().syncExec( - new Runnable() { - public void run() { - MessageDialog.openInformation(getShell(), - Policy.bind("UploadAction.noDirtyTitle"), //$NON-NLS-1$ - Policy.bind("UploadAction.noDirtyMessage")); //$NON-NLS-1$ - } - }); - }; - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("UploadAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java deleted file mode 100644 index 83a7eeda3..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java +++ /dev/null @@ -1,143 +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.wizards; - - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.internal.model.WorkbenchAdapter; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * ConfigurationWizardElement represents an item in the configuration wizard table, - * declared by an extension to the configurationWizards extension point. - */ -public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable { - private String id; - private String name; - private ImageDescriptor imageDescriptor; - private String description; - private IConfigurationElement configurationElement; - - /** - * Creates a new instance of this class - * - * @param name the name of the element - */ - public ConfigurationWizardElement(String name) { - this.name = name; - } - /** - * Create an the instance of the object described by the configuration - * element. That is, create the instance of the class the isv supplied in - * the extension point. - * - * @throws CoreException if an error occurs creating the extension - */ - public Object createExecutableExtension() throws CoreException { - return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS); - } - /* - * Method declared on IAdaptable. - */ - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) { - return this; - } - return Platform.getAdapterManager().getAdapter(this, adapter); - } - /** - * Returns the configuration element - * - * @return the configuration element - */ - public IConfigurationElement getConfigurationElement() { - return configurationElement; - } - /** - * Returns the description parameter of this element - * - * @return the description of this elemnet - */ - public String getDescription() { - return description; - } - /** - * Returns the image for the given element - * - * @param element the element to get the image for - * @return the image for the given element - */ - public ImageDescriptor getImageDescriptor(Object element) { - return imageDescriptor; - } - /** - * Returns the label for the given element - * - * @param element the element to get the label for - * @return the label for the given element - */ - public String getLabel(Object element) { - return name; - } - /** - * Returns the id as specified in the extension. - * - * @return java.lang.String - */ - public String getID() { - return id; - } - /** - * Returns the image for this element. - * - * @return the image for this element - */ - public ImageDescriptor getImageDescriptor() { - return imageDescriptor; - } - /** - * Set the configuration element - * - * @param newConfigurationElement the new configuration element - */ - public void setConfigurationElement(IConfigurationElement newConfigurationElement) { - configurationElement = newConfigurationElement; - } - /** - * Set the description parameter of this element - * - * @param value the new desrciption - */ - public void setDescription(String value) { - description = value; - } - /** - * Sets the id parameter of this element - * - * @param value the new ID - */ - public void setID(String value) { - id = value; - } - /** - * Sets the image for this element. - * - * @param value the new image - */ - public void setImageDescriptor(ImageDescriptor value) { - imageDescriptor = value; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java deleted file mode 100644 index 05a8a6eef..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java +++ /dev/null @@ -1,72 +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.wizards; - - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardNode; -import org.eclipse.swt.graphics.Point; -import org.eclipse.team.internal.ui.Policy; - -/** - * ConfigurationWizardNode represents the objects in the - * table in the Configuration wizard. - */ -public class ConfigurationWizardNode implements IWizardNode { - // The element this node represents - ConfigurationWizardElement element; - // The wizard this node is in - IWizard wizard; - - /** - * Create a new ConfigurationWizardNode - * - * @param element the configuration wizard element for this node - */ - public ConfigurationWizardNode(ConfigurationWizardElement element) { - this.element = element; - } - /* - * Method declared on IWizardNode. - */ - public void dispose() { - if (wizard != null) { - wizard.dispose(); - wizard = null; - } - } - /* - * Method declared on IWizardNode. - */ - public Point getExtent() { - return new Point(-1, -1); - } - /* - * Method declared on IWizardNode. - */ - public IWizard getWizard() { - if (wizard == null) { - try { - wizard = (IWizard)element.createExecutableExtension(); - } catch (CoreException e) { - System.out.println(Policy.bind("ConfigurationWizard.exceptionCreatingWizard")); //$NON-NLS-1$ - } - } - return wizard; - } - /* - * Method declared on IWizardNode. - */ - public boolean isContentCreated() { - return wizard != null; - } -} 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 deleted file mode 100644 index b284fcd9b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java +++ /dev/null @@ -1,236 +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.wizards; - - -import org.eclipse.core.resources.IProject; -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.IPluginRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -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.ui.IWorkbench; -import org.eclipse.ui.internal.model.AdaptableList; - -/** - * The wizard for associating projects with team providers - */ -public class ConfigureProjectWizard extends Wizard implements IConfigurationWizard { - protected IWorkbench workbench; - protected IProject project; - protected IConfigurationWizard wizard; - - protected ConfigureProjectWizardMainPage mainPage; - private String pluginId = TeamUIPlugin.PLUGIN_ID; - - protected final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$ - protected final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ - protected final static String ATT_NAME = "name"; //$NON-NLS-1$ - protected final static String ATT_CLASS = "class"; //$NON-NLS-1$ - protected final static String ATT_ICON = "icon"; //$NON-NLS-1$ - protected final static String ATT_ID = "id"; //$NON-NLS-1$ - - public ConfigureProjectWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(getWizardWindowTitle()); //$NON-NLS-1$ - } - - protected String getExtensionPoint() { - return TeamUIPlugin.PT_CONFIGURATION; - } - - protected String getWizardWindowTitle() { - return Policy.bind("ConfigureProjectWizard.title"); //$NON-NLS-1$ - } - - protected String getWizardLabel() { - return Policy.bind("ConfigureProjectWizard.configureProject"); //$NON-NLS-1$ - } - - protected String getWizardDescription() { - return Policy.bind("ConfigureProjectWizard.description"); //$NON-NLS-1$ - } - - /* - * @see Wizard#addPages - */ - public void addPages() { - AdaptableList wizards = getAvailableWizards(); - if (wizards.size() == 1) { - // If there is only one wizard, skip the first page. - // Only skip the first page if the one wizard has at least one page. - ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0]; - try { - this.wizard = (IConfigurationWizard)element.createExecutableExtension(); - wizard.init(workbench, project); - wizard.addPages(); - if (wizard.getPageCount() > 0) { - wizard.setContainer(getContainer()); - IWizardPage[] pages = wizard.getPages(); - for (int i = 0; i < pages.length; i++) { - addPage(pages[i]); - } - return; - } - } catch (CoreException e) { - TeamUIPlugin.log(e); - return; - } - } - mainPage = new ConfigureProjectWizardMainPage("configurePage1", getWizardLabel(), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE), wizards); //$NON-NLS-1$ - mainPage.setDescription(getWizardDescription()); - mainPage.setProject(project); - mainPage.setWorkbench(workbench); - addPage(mainPage); - } - public IWizardPage getNextPage(IWizardPage page) { - if (wizard != null) { - return wizard.getNextPage(page); - } - return super.getNextPage(page); - } - public boolean canFinish() { - // If we are on the first page, never allow finish unless the selected wizard has no pages. - if (getContainer().getCurrentPage() == mainPage) { - if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) { - return true; - } - return false; - } - if (wizard != null) { - return wizard.canFinish(); - } - return super.canFinish(); - } - /* - * @see Wizard#performFinish - */ - public boolean performFinish() { - // There is only one wizard with at least one page - if (wizard != null) { - return wizard.performFinish(); - } - // If we are on the first page and the selected wizard has no pages then - // allow it to finish. - if (getContainer().getCurrentPage() == mainPage) { - IConfigurationWizard noPageWizard = mainPage.getSelectedWizard(); - if (noPageWizard != null) { - if (noPageWizard.canFinish()) - { - return noPageWizard.performFinish(); - } - } - } - // If the wizard has pages and there are several - // wizards registered then the registered wizard - // will call it's own performFinish(). - return true; - } - /** - * Returns the configuration wizards that are available for invocation. - * - * @return the available wizards - */ - protected AdaptableList getAvailableWizards() { - AdaptableList result = new AdaptableList(); - IPluginRegistry registry = Platform.getPluginRegistry(); - IExtensionPoint point = registry.getExtensionPoint(pluginId, getExtensionPoint()); - if (point != null) { - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - for (int j = 0; j < elements.length; j++) { - IConfigurationElement element = elements[j]; - if (element.getName().equals(TAG_WIZARD)) { - ConfigurationWizardElement wizard = createWizardElement(element); - if (wizard != null) { - result.add(wizard); - } - } - } - } - } - - return result; - } - /** - * Returns a new ConfigurationWizardElement configured according to the parameters - * contained in the passed Registry. - * - * May answer null if there was not enough information in the Extension to create - * an adequate wizard - * - * @param element the element for which to create a wizard element - * @return the wizard element for the given element - */ - protected ConfigurationWizardElement createWizardElement(IConfigurationElement element) { - // WizardElements must have a name attribute - String nameString = element.getAttribute(ATT_NAME); - if (nameString == null) { - // Missing attribute - return null; - } - ConfigurationWizardElement result = new ConfigurationWizardElement(nameString); - if (initializeWizard(result, element)) { - // initialization was successful - return result; - } - return null; - } - /** - * Initialize the passed element's properties based on the contents of - * the passed registry. Answer a boolean indicating whether the element - * was able to be adequately initialized. - * - * @param element the element to initialize the properties for - * @param extension the registry to get properties from - * @return whether initialization was successful - */ - protected boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config) { - element.setID(config.getAttribute(ATT_ID)); - String description = ""; //$NON-NLS-1$ - IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION); - if (children.length >= 1) { - description = children[0].getValue(); - } - - element.setDescription(description); - - // apply CLASS and ICON properties - element.setConfigurationElement(config); - String iconName = config.getAttribute(ATT_ICON); - if (iconName != null) { - IExtension extension = config.getDeclaringExtension(); - element.setImageDescriptor(TeamUIPlugin.getImageDescriptorFromExtension(extension, iconName)); - } - // ensure that a class was specified - if (element.getConfigurationElement() == null) { - // Missing attribute - return false; - } - setForcePreviousAndNextButtons(true); - return true; - } - /* - * Method declared on IConfigurationWizard - */ - public void init(IWorkbench workbench, IProject project) { - this.workbench = workbench; - this.project = project; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java deleted file mode 100644 index 8f34c0308..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java +++ /dev/null @@ -1,187 +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.wizards; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.model.AdaptableList; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * The main page of the configure project wizard. It contains a table - * which lists possible team providers with which to configure the project. - * The user may select one and press "Next", which will display a provider- - * specific wizard page. - */ -public class ConfigureProjectWizardMainPage extends WizardPage { - private Table table; - private TableViewer viewer; - private AdaptableList wizards; - private IWorkbench workbench; - private IProject project; - private String description; - - private IConfigurationWizard selectedWizard; - - /** - * Create a new ConfigureProjectWizardMainPage - * - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page title - * @param wizards the wizards to populate the table with - */ - public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards) { - this(pageName,title,titleImage,wizards,Policy.bind("ConfigureProjectWizardMainPage.selectRepository")); //$NON-NLS-1$ - } - - /** - * Create a new ConfigureProjectWizardMainPage - * - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page title - * @param wizards the wizards to populate the table with - * @param description The string to use as a description label - */ - public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards, String description) { - super(pageName, title, titleImage); - this.wizards = wizards; - this.description = description; - } - - public IConfigurationWizard getSelectedWizard() { - return selectedWizard; - } - /* - * @see WizardPage#canFlipToNextPage - */ - public boolean canFlipToNextPage() { - return selectedWizard != null && selectedWizard.getPageCount() > 0; - } - /* - * @see WizardPage#createControl - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - setControl(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARE_PROJECT_PAGE); - - Label label = new Label(composite, SWT.LEFT); - label.setText(description); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - - table = new Table(composite, SWT.SINGLE | SWT.BORDER); - data = new GridData(GridData.FILL_BOTH); - data.heightHint = table.getItemHeight() * 7; - table.setLayoutData(data); - viewer = new TableViewer(table); - viewer.setContentProvider(new WorkbenchContentProvider()); - viewer.setLabelProvider(new WorkbenchLabelProvider()); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - // Initialize the wizard so we can tell whether to enable the Next button - ISelection selection = event.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - selectedWizard = null; - setPageComplete(false); - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() != 1) { - selectedWizard = null; - setPageComplete(false); - return; - } - ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement(); - try { - selectedWizard = (IConfigurationWizard)selectedElement.createExecutableExtension(); - selectedWizard.init(workbench, project); - } catch (CoreException e) { - return; - } - selectedWizard.addPages(); - - // Ask the container to update button enablement - setPageComplete(true); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - getWizard().getContainer().showPage(getNextPage()); - } - }); - viewer.setInput(wizards); - } - /** - * The <code>WizardSelectionPage</code> implementation of - * this <code>IWizardPage</code> method returns the first page - * of the currently selected wizard if there is one. - * - * @see WizardPage#getNextPage - */ - public IWizardPage getNextPage() { - if (selectedWizard == null) return null; - return selectedWizard.getStartingPage(); - } - /** - * Set the workbench to the argument - * - * @param workbench the workbench to set - */ - public void setWorkbench(IWorkbench workbench) { - this.workbench = workbench; - } - /** - * Set the project to the argument - * - * @param project the project to set - */ - public void setProject(IProject project) { - this.project = project; - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - table.setFocus(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java deleted file mode 100644 index 6382e6ddd..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java +++ /dev/null @@ -1,200 +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.wizards; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class ExportProjectSetMainPage extends TeamWizardPage { - Text fileText; - String file = ""; //$NON-NLS-1$ - Button browseButton; - List selectedProjects = new ArrayList(); - - CheckboxTableViewer tableViewer; - Table table; - - class ProjectContentProvider extends WorkbenchContentProvider { - public Object[] getElements(Object element) { - if (element instanceof IProject[]) return (IProject[]) element; - return null; - } - }; - - public ExportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.EXPORT_PROJECT_SET_PAGE); - - createLabel(composite, Policy.bind("ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2")); //$NON-NLS-1$ - - table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - tableViewer = new CheckboxTableViewer(table); - table.setLayout(new TableLayout()); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 300; - table.setLayoutData(data); - tableViewer.setContentProvider(new ProjectContentProvider()); - tableViewer.setLabelProvider(new WorkbenchLabelProvider()); - tableViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - IProject project = (IProject)event.getElement(); - if (event.getChecked()) { - selectedProjects.add(project); - } else { - selectedProjects.remove(project); - } - updateEnablement(); - } - }); - createLabel(composite, Policy.bind("ExportProjectSetMainPage.Project_Set_File_Name__3")); //$NON-NLS-1$ - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ExportProjectSetMainPage.&File_name__1")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ExportProjectSetMainPage.Browse_4")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell(), SWT.SAVE); - d.setFilterExtensions(new String[] {"*.psf"}); //$NON-NLS-1$ - d.setFilterNames(new String[] {Policy.bind("ExportProjectSetMainPage.Project_Set_Files_3")}); //$NON-NLS-1$ - d.setFileName(Policy.bind("ExportProjectSetMainPage.default")); //$NON-NLS-1$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - initializeProjects(); - setControl(composite); - updateEnablement(); - } - - private void initializeProjects() { - List projectList = new ArrayList(); - IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < workspaceProjects.length; i++) { - if (RepositoryProvider.getProvider(workspaceProjects[i]) != null) { - projectList.add(workspaceProjects[i]); - } - } - tableViewer.setInput((IProject[]) projectList.toArray(new IProject[projectList.size()])); - // Check any necessary projects - if (selectedProjects != null) { - tableViewer.setCheckedElements((IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()])); - } - } - private void updateEnablement() { - boolean complete; - if (selectedProjects.size() == 0) { - setMessage(null); - complete = false; - } else if (file.length() == 0) { - setMessage(null); - complete = false; - } else { - File f = new File(file); - if (f.isDirectory()) { - setMessage(Policy.bind("ExportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - - public String getFileName() { - return file; - } - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - - public IProject[] getSelectedProjects() { - return (IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]); - } - public void setSelectedProjects(IProject[] selectedProjects) { - this.selectedProjects.addAll(Arrays.asList(selectedProjects)); - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java deleted file mode 100644 index 8de9fcc41..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java +++ /dev/null @@ -1,214 +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.wizards; - -import java.io.File; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.help.WorkbenchHelp; - -public class ImportProjectSetMainPage extends TeamWizardPage { - Text fileText; - String file = ""; //$NON-NLS-1$ - Button browseButton; - Button createWorkingSetButton; - Text workingSetNameField; - - private boolean createWorkingSet = false; - private String workingSetName = ""; //$NON-NLS-1$ - - // constants - private static final int SIZING_TEXT_FIELD_WIDTH = 80; - - public ImportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.IMPORT_PROJECT_SET_PAGE); - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ImportProjectSetMainPage.Project_Set_File_Name__2")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ImportProjectSetMainPage.Browse_3")); //$NON-NLS-1$ - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell()); - d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterNames(new String[] {Policy.bind("ImportProjectSetMainPage.Project_Set_Files_2"), Policy.bind("ImportProjectSetMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - createWorkinSetCreationArea(inner, 3); - setControl(composite); - updateEnablement(); - } - - /** - * Method createWorkinSetCreationArea. - * @param inner - */ - private void createWorkinSetCreationArea(Composite composite, int numColumns) { - - createWorkingSetButton = new Button(composite, SWT.CHECK | SWT.RIGHT); - createWorkingSetButton.setText(Policy.bind("ImportProjectSetMainPage.createWorkingSetLabel")); //$NON-NLS-1$ - createWorkingSetButton.setSelection(createWorkingSet); - GridData data = new GridData(); - data.horizontalSpan = numColumns; - createWorkingSetButton.setLayoutData(data); - - final Label label = new Label(composite, SWT.NONE); - label.setText(Policy.bind("ImportProjectSetMainPage.workingSetLabel")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalSpan = 1; - label.setLayoutData(data); - label.setEnabled(createWorkingSet); - - workingSetNameField = new Text(composite, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - data.horizontalSpan = 1; - workingSetNameField.setLayoutData(data); - workingSetNameField.setEnabled(createWorkingSet); - - createWorkingSetButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - createWorkingSet = createWorkingSetButton.getSelection(); - label.setEnabled(createWorkingSet); - workingSetNameField.setEnabled(createWorkingSet); - updateEnablement(); - } - }); - workingSetNameField.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateEnablement(); - } - }); - } - - private boolean validateWorkingSetName() { - if (createWorkingSet) { - workingSetName = workingSetNameField.getText(); - if (workingSetName.length() == 0) { - setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameEmpty"), ERROR); //$NON-NLS-1$ - return false; - } else { - // todo: verify name doesn't already exist - IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName); - if (existingSet != null) { - setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameExists"), WARNING); //$NON-NLS-1$ - return true; - } - } - } - setMessage(null); - return true; - } - - private void updateEnablement() { - boolean complete; - setMessage(null); - if (file.length() == 0) { - complete = false; - } else { - // See if the file exists - File f = new File(file); - if (!f.exists()) { - setMessage(Policy.bind("ImportProjectSetMainPage.The_specified_file_does_not_exist_4"), ERROR); //$NON-NLS-1$ - complete = false; - } else if (f.isDirectory()) { - setMessage(Policy.bind("ImportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = validateWorkingSetName(); - } - } - setPageComplete(complete); - } - - public String getFileName() { - return file; - } - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - /** - * @return String - */ - public String getWorkingSetName() { - if (!createWorkingSet) return null; - return workingSetName; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java deleted file mode 100644 index a450c9147..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java +++ /dev/null @@ -1,202 +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.wizards; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.IProjectSetSerializer; -import org.eclipse.team.core.ProjectSetCapability; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.RepositoryProviderType; -import org.eclipse.team.core.Team; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; - -public class ProjectSetExportWizard extends Wizard implements IExportWizard { - ExportProjectSetMainPage mainPage; - IStructuredSelection selection; - - public ProjectSetExportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("ProjectSetExportWizard.Project_Set_1")); //$NON-NLS-1$ - } - - public void addPages() { - mainPage = new ExportProjectSetMainPage("projectSetMainPage", Policy.bind("ProjectSetExportWizard.Export_a_Project_Set_3"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_PROJECTSET_EXPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$ - IProject[] projects = (IProject[])selection.toList().toArray(new IProject[0]); - mainPage.setSelectedProjects(projects); - mainPage.setFileName(ProjectSetImportWizard.lastFile); - addPage(mainPage); - } - public boolean performFinish() { - final boolean[] result = new boolean[] {false}; - try { - getContainer().run(false, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - String filename = mainPage.getFileName(); - Path path = new Path(filename); - if (path.getFileExtension() == null) { - filename = filename + ".psf"; //$NON-NLS-1$ - } - ProjectSetImportWizard.lastFile = filename; - File file = new File(filename); - File parentFile = file.getParentFile(); - if (parentFile != null && !parentFile.exists()) { - boolean r = MessageDialog.openQuestion(getShell(), Policy.bind("ProjectSetExportWizard.Question_4"), Policy.bind("ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5")); //$NON-NLS-1$ //$NON-NLS-2$ - if (!r) { - result[0] = false; - return; - } - r = parentFile.mkdirs(); - if (!r) { - MessageDialog.openError(getShell(), Policy.bind("ProjectSetExportWizard.Export_Problems_6"), Policy.bind("ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7")); //$NON-NLS-1$ //$NON-NLS-2$ - result[0] = false; - return; - } - } - if (file.exists() && file.isFile()) { - boolean r = MessageDialog.openQuestion(getShell(), Policy.bind("ProjectSetExportWizard.Question_8"), Policy.bind("ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9")); //$NON-NLS-1$ //$NON-NLS-2$ - if (!r) { - result[0] = false; - return; - } - } - - // Hash the projects by provider - IProject[] projects = mainPage.getSelectedProjects(); - Map map = new HashMap(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - RepositoryProvider provider = RepositoryProvider.getProvider(project); - if (provider != null) { - String id = provider.getID(); - List list = (List)map.get(id); - if (list == null) { - list = new ArrayList(); - map.put(id, list); - } - list.add(project); - } - } - - Shell shell = getShell(); - - BufferedWriter writer = null; - try { - writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); //$NON-NLS-1$ - - writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ - writer.newLine(); - writer.write("<psf version=\"2.0\">"); //$NON-NLS-1$ - writer.newLine(); - - // For each provider id, do the writing - Iterator it = map.keySet().iterator(); - monitor.beginTask(null, 1000 * map.keySet().size()); - while (it.hasNext()) { - String id = (String)it.next(); - writer.write("\t<provider id=\""); //$NON-NLS-1$ - writer.write(id); - writer.write("\">"); //$NON-NLS-1$ - writer.newLine(); - List list = (List)map.get(id); - IProject[] projectArray = (IProject[])list.toArray(new IProject[list.size()]); - IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); - if (serializer != null) { - String[] references = serializer.asReference(projectArray, shell, new SubProgressMonitor(monitor, 990)); - for (int i = 0; i < references.length; i++) { - writer.write("\t\t<project reference=\""); //$NON-NLS-1$ - writer.write(references[i]); - writer.write("\"/>"); //$NON-NLS-1$ - writer.newLine(); - } - } - writer.write("\t</provider>"); //$NON-NLS-1$ - writer.newLine(); - } - writer.write("</psf>"); //$NON-NLS-1$ - writer.newLine(); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - - // notify provider types of the project set write - for (Iterator iter = map.keySet().iterator();iter.hasNext();) { - String id = (String) iter.next(); - RepositoryProviderType type = RepositoryProviderType.getProviderType(id); - if (type != null) { - ProjectSetCapability capability = type.getProjectSetCapability(); - if (capability != null) { - capability.projectSetCreated(file, shell, new SubProgressMonitor(monitor, 10)); - } - } - } - - monitor.done(); - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException)target; - } - if (target instanceof Error) { - throw (Error)target; - } - } - return result[0]; - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java deleted file mode 100644 index 86807bb76..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.xerces.parsers.SAXParser; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.IProjectSetSerializer; -import org.eclipse.team.core.Team; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.ProjectSetContentHandler; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.IWorkingSetManager; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public class ProjectSetImportWizard extends Wizard implements IImportWizard { - ImportProjectSetMainPage mainPage; - public static String lastFile; - - public ProjectSetImportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("ProjectSetImportWizard.Project_Set_1")); //$NON-NLS-1$ - } - - public void addPages() { - mainPage = new ImportProjectSetMainPage("projectSetMainPage", Policy.bind("ProjectSetImportWizard.Import_a_Project_Set_3"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_PROJECTSET_IMPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$ - mainPage.setFileName(lastFile); - addPage(mainPage); - } - public boolean performFinish() { - - // check if the desired working set exists - final String workingSetName = mainPage.getWorkingSetName(); - if (workingSetName != null) { - IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName); - if (existingSet != null && - !MessageDialog.openConfirm(getShell(), Policy.bind("ProjectSetImportWizard.workingSetExistsTitle"), Policy.bind("ProjectSetImportWizard.workingSetExistsMessage", workingSetName))) //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - - final boolean[] result = new boolean[] {false}; - try { - getContainer().run(true, true, new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InvocationTargetException { - InputStreamReader reader = null; - try { - String filename = mainPage.getFileName(); - lastFile = filename; - reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$ - - SAXParser parser = new SAXParser(); - ProjectSetContentHandler handler = new ProjectSetContentHandler(); - parser.setContentHandler(handler); - InputSource source = new InputSource(reader); - parser.parse(source); - - Map map = handler.getReferences(); - List newProjects = new ArrayList(); - if (map.size() == 0 && handler.isVersionOne()) { - IProjectSetSerializer serializer = Team.getProjectSetSerializer("versionOneSerializer"); //$NON-NLS-1$ - if (serializer != null) { - IProject[] projects = serializer.addToWorkspace(new String[0], filename, getShell(), monitor); - if (projects != null) - newProjects.addAll(Arrays.asList(projects)); - } - } else { - Iterator it = map.keySet().iterator(); - while (it.hasNext()) { - String id = (String)it.next(); - List references = (List)map.get(id); - IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); - if (serializer != null) { - IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), filename, getShell(), monitor); - if (projects != null) - newProjects.addAll(Arrays.asList(projects)); - } - } - } - if (workingSetName != null) - createWorkingSet(workingSetName, (IProject[]) newProjects.toArray(new IProject[newProjects.size()])); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (SAXException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException)target; - } - if (target instanceof Error) { - throw (Error)target; - } - } - return result[0]; - } - - private void createWorkingSet(String workingSetName, IProject[] projects) { - IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager(); - IWorkingSet oldSet = manager.getWorkingSet(workingSetName); - if (oldSet == null) { - IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects); - manager.addWorkingSet(newSet); - }else { - oldSet.setElements(projects); - } - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java deleted file mode 100644 index a38c5c28d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java +++ /dev/null @@ -1,107 +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.wizards; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public abstract class TeamWizardPage extends WizardPage { - /** - * CVSWizardPage constructor comment. - * @param pageName the name of the page - */ - public TeamWizardPage(String pageName) { - super(pageName); - } - /** - * CVSWizardPage constructor comment. - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page - */ - public TeamWizardPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - /** - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - /** - * Utility method that creates a label instance - * and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @return the new label - */ - protected Label createLabel(Composite parent, String text) { - return createIndentedLabel(parent, text, 0); - } - /** - * Utility method that creates a label instance indented by the specified - * number of pixels and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @param indent the indent in pixels, or 0 for none - * @return the new label - */ - protected Label createIndentedLabel(Composite parent, String text, int indent) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - data.horizontalIndent = indent; - label.setLayoutData(data); - return label; - } - /** - * Create a text field specific for this application - * - * @param parent the parent of the new text field - * @return the new text field - */ - protected Text createTextField(Composite parent) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.verticalAlignment = GridData.CENTER; - data.grabExcessVerticalSpace = false; - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - text.setLayoutData(data); - return text; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java deleted file mode 100644 index 4f218794f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java +++ /dev/null @@ -1,36 +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; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.ui.IWorkbench; - -/** - * IConfigurationWizard defines the interface that users of the extension - * point org.eclipse.team.ui.configurationWizards must implement. - */ -public interface IConfigurationWizard extends IWizard { - /** - * Initializes this creation wizard using the passed workbench and - * object selection. - * <p> - * This method is called after the no argument constructor and - * before other methods are called. - * </p> - * - * @param workbench the current workbench - * @param project the selected project - */ - void init(IWorkbench workbench, IProject project); -} - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java deleted file mode 100644 index 8838e6016..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java +++ /dev/null @@ -1,83 +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; - -/** - * Images that are available for providers to re-use. They include - * common overlays and wizard images. A provider can use their own - * custom images, these shared images are only available for - * convenience. - */ -public interface ISharedImages { - // image paths - public final String ICON_PATH = "icons/full/"; //$NON-NLS-1$ - - public final String IMG_DIRTY_OVR = "ovr/dirty_ov.gif"; //$NON-NLS-1$ - public final String IMG_CHECKEDIN_OVR = "ovr/version_controlled.gif"; //$NON-NLS-1$ - public final String IMG_CHECKEDOUT_OVR = "ovr/checkedout_ov.gif"; //$NON-NLS-1$ - - public final String IMG_COLLAPSE_ALL = "clcl16/collapseall.gif"; //$NON-NLS-1$ - public final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif"; //$NON-NLS-1$ - - public final String IMG_SYNC_VIEW = "cview16/synch_synch.gif"; //$NON-NLS-1$ - - // local toolbars (colour) - public final String IMG_DLG_SYNC_INCOMING = "clcl16/incom_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_OUTGOING = "clcl16/outgo_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_CONFLICTING = "clcl16/conflict_synch.gif"; //$NON-NLS-1$ - public final String IMG_REFRESH = "clcl16/refresh.gif"; //$NON-NLS-1$ - public final String IMG_IGNORE_WHITESPACE = "clcl16/ignorews_edit.gif"; //$NON-NLS-1$ - public final String IMG_CONTENTS = "clcl16/contents.gif"; //$NON-NLS-1$ - - // local toolbars (disabled) - public final String IMG_DLG_SYNC_INCOMING_DISABLED = "dlcl16/incom_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_OUTGOING_DISABLED = "dlcl16/outgo_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_CONFLICTING_DISABLED = "dlcl16/conflict_synch.gif"; //$NON-NLS-1$ - public final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif"; //$NON-NLS-1$ - public final String IMG_IGNORE_WHITESPACE_DISABLED = "dlcl16/ignorews_edit.gif"; //$NON-NLS-1$ - public final String IMG_CONTENTS_DISABLED = "dlcl16/contents.gif"; //$NON-NLS-1$ - - // local toolbars (enabled) - public final String IMG_DLG_SYNC_INCOMING_ENABLED = "elcl16/incom_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_OUTGOING_ENABLED = "elcl16/outgo_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_CONFLICTING_ENABLED = "elcl16/conflict_synch.gif"; //$NON-NLS-1$ - public final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif"; //$NON-NLS-1$ - public final String IMG_IGNORE_WHITESPACE_ENABLED = "elcl16/ignorews_edit.gif"; //$NON-NLS-1$ - public final String IMG_CONTENTS_ENABLED = "elcl16/contents.gif"; //$NON-NLS-1$ - - // sync view modes - public final String IMG_SYNC_MODE_CATCHUP = "clcl16/catchup_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_RELEASE = "clcl16/release_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_FREE = "clcl16/catchuprelease_rls.gif"; //$NON-NLS-1$ - - // sync view modes (disabled) - public final String IMG_SYNC_MODE_CATCHUP_DISABLED = "dlcl16/catchup_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_RELEASE_DISABLED = "dlcl16/release_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_FREE_DISABLED = "dlcl16/catchuprelease_rls.gif"; //$NON-NLS-1$ - - // sync view modes (enabled) - public final String IMG_SYNC_MODE_CATCHUP_ENABLED = "elcl16/catchup_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_RELEASE_ENABLED = "elcl16/release_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_FREE_ENABLED = "elcl16/catchuprelease_rls.gif"; //$NON-NLS-1$ - - // wizard banners - public final String IMG_WIZBAN_SHARE = "wizban/share_wizban.gif"; //$NON-NLS-1$ - public final String IMG_PROJECTSET_IMPORT_BANNER = "wizban/import_projectset_wizban.gif"; //$NON-NLS-1$ - public final String IMG_PROJECTSET_EXPORT_BANNER = "wizban/export_projectset_wizban.gif"; //$NON-NLS-1$ - - //objects - public final String IMG_SITE_ELEMENT = "clcl16/site_element.gif"; //$NON-NLS-1$ - public final String IMG_CHANGE_FILTER = "clcl16/change_filter.gif"; //$NON-NLS-1$ - - // TODO: I just picked an image. We should get a custom image - public final String IMG_COMPRESSED_FOLDER = "obj/compressed_folder_obj.gif"; //$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 deleted file mode 100644 index 4164c9dfa..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java +++ /dev/null @@ -1,51 +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; - -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; - -/** - * TeamUI contains public API for generic UI-based Team functionality - */ -public class TeamUI { - // 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); - } - - /** - * Register for changes made to Team properties. - * - * @param listener the listener to add - */ - public static void addPropertyChangeListener(IPropertyChangeListener listener) { - TeamUIPlugin.addPropertyChangeListener(listener); - } - - /** - * Deregister as a Team property changes. - * - * @param listener the listener to remove - */ - public static void removePropertyChangeListener(IPropertyChangeListener listener) { - TeamUIPlugin.removePropertyChangeListener(listener); - } -} 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 deleted file mode 100644 index 110a89283..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html +++ /dev/null @@ -1,16 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <meta name="Author" content="IBM"> - <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. -</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/CompoundSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java deleted file mode 100644 index 6c7929772..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java +++ /dev/null @@ -1,18 +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; - -public abstract class CompoundSyncInfoFilter extends SyncInfoFilter { - protected SyncInfoFilter[] filters; - public CompoundSyncInfoFilter(SyncInfoFilter[] filters) { - this.filters = filters; - } -} 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 61dd575a8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import org.eclipse.core.resources.IResource; -import org.eclipse.team.core.subscribers.TeamSubscriber; -import org.eclipse.ui.IWorkingSet; - -public interface ISynchronizeView { - - /** - * 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; - - /** - * 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); -} 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/SubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberAction.java deleted file mode 100644 index 99a09a57a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberAction.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.jface.viewers.IStructuredSelection; -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.actions.TeamAction; - -/** - * This is the abstract superclass for actions associated with a subscriber. - * It is not necessary that subscriber actions be subclasses of this class. - */ -public abstract class SubscriberAction extends TeamAction { - - private TeamSubscriber subscriber; - - /** - * This method returns all instances of SynchronizeViewNode that are in the current - * selection. For a table view, this is any resource that is directly selected. - * For a tree view, this is any descendants of the selected resource that are - * contained in the view. - * - * @return the selected resources - */ - protected SyncInfo[] getSyncInfos() { - Object[] selected = ((IStructuredSelection)selection).toArray(); - Set result = new HashSet(); - for (int i = 0; i < selected.length; i++) { - Object object = selected[i]; - if (object instanceof ISynchronizeViewNode) { - ISynchronizeViewNode syncResource = (ISynchronizeViewNode) object; - SyncInfo[] infos = syncResource.getChildSyncInfos(); - result.addAll(Arrays.asList(infos)); - } - } - return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]); - } - - /** - * The default enablement behavior for subscriber actions is to enable - * the action if there is at least one SyncInfo in the selection - * for which the action is enabled (determined by invoking - * <code>isEnabled(SyncInfo)</code>). - * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return (getFilteredSyncInfos().length > 0); - } - - /** - * Return true if the action should be enabled for the given SyncInfo. - * Default behavior is to use a SyncInfoFilter to determine if the action - * is enabled. - * - * @param info - * @return - */ - protected boolean select(SyncInfo info) { - return info != null && getSyncInfoFilter().select(info); - } - - /** - * @return - */ - protected SyncInfoFilter getSyncInfoFilter() { - return new SyncInfoFilter(); - } - - /** - * Return the selected SyncInfo for which this action is enabled. - * @return - */ - protected SyncInfo[] getFilteredSyncInfos() { - SyncInfo[] infos = getSyncInfos(); - List filtered = new ArrayList(); - for (int i = 0; i < infos.length; i++) { - SyncInfo info = infos[i]; - if(subscriber == null) { - subscriber = info.getSubscriber(); - } - if (select(info)) - filtered.add(info); - } - return (SyncInfo[]) filtered.toArray(new SyncInfo[filtered.size()]); - } - - /** - * Returns the TeamSubscriber for this action. - * @return TeamSubscriber - */ - public TeamSubscriber getSubscriber() { - return subscriber; - } - - /** - * Sets the the TeamSubscriber for this action. - * @return TeamSubscriber - */ - public void setSubscriber(TeamSubscriber subscriber) { - this.subscriber = subscriber; - } -} 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.core.sync.IRemoteSyncElement; - -/** - * Thsi class filters the SyncInfo by change type (addition, deletion, change) - */ -public class SyncInfoChangeTypeFilter extends SyncInfoFilter { - - private int[] changeFilters = new int[] {IRemoteSyncElement.ADDITION, IRemoteSyncElement.DELETION, IRemoteSyncElement.CHANGE}; - - public SyncInfoChangeTypeFilter(int[] changeFilters) { - this.changeFilters = changeFilters; - } - - public SyncInfoChangeTypeFilter(int change) { - this(new int[] { change }); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo) - */ - public boolean select(SyncInfo info) { - int syncKind = info.getKind(); - for (int i = 0; i < changeFilters.length; i++) { - int filter = changeFilters[i]; - if ((syncKind & SyncInfo.CHANGE_MASK) == filter) - return true; - } - return false; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java deleted file mode 100644 index 1ec79b327..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * Filter the SyncInfo by a set of directions (incoming, outgoing, conflict) - */ -public class SyncInfoDirectionFilter extends SyncInfoFilter { - - int[] directionFilters = new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING}; - - public SyncInfoDirectionFilter(int[] directionFilters) { - this.directionFilters = directionFilters; - } - - public SyncInfoDirectionFilter(int direction) { - this(new int[] { direction }); - } - - /* (non-Javadoc) - * @see SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo) - */ - public boolean select(SyncInfo info) { - int syncKind = info.getKind(); - for (int i = 0; i < directionFilters.length; i++) { - int filter = directionFilters[i]; - if ((syncKind & SyncInfo.DIRECTION_MASK) == filter) - return true; - } - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java deleted file mode 100644 index 92f16cfd5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * A SyncInfoFilter is used by a SyncSetInput to detemine which resources - * should be part of the sync set. - */ -public class SyncInfoFilter { - - public static SyncInfoFilter getDirectionAndChangeFilter(int direction, int change) { - return new AndSyncInfoFilter(new SyncInfoFilter[] { - new SyncInfoDirectionFilter(direction), - new SyncInfoChangeTypeFilter(change) - }); - } - - /** - * Return true if the provided SyncInfo matches the filter. - * The default behavior it to include resources whose syncKind - * is non-zero. - * - * @param info - * @return - */ - public boolean select(SyncInfo info) { - return info.getKind() != 0; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java deleted file mode 100644 index b6daf1ce5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java +++ /dev/null @@ -1,206 +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 java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.team.core.subscribers.SyncInfo; - -public class SyncInfoSet { - - Set set = new HashSet(); - - public SyncInfoSet(SyncInfo[] resources) { - set.addAll(Arrays.asList(resources)); - } - /** - * Returns true if there are any conflicting nodes in the set, and - * false otherwise. - */ - public boolean hasConflicts() { - return hasNodes(new SyncInfoDirectionFilter(SyncInfo.CONFLICTING)); - } - - /** - * Returns true if this sync set has incoming changes. - * Note that conflicts are not considered to be incoming changes. - */ - public boolean hasIncomingChanges() { - return hasNodes(new SyncInfoDirectionFilter(SyncInfo.INCOMING)); - } - - /** - * Returns true if this sync set has outgoing changes. - * Note that conflicts are not considered to be outgoing changes. - */ - public boolean hasOutgoingChanges() { - return hasNodes(new SyncInfoDirectionFilter(SyncInfo.OUTGOING)); - } - - /** - * Returns true if this sync set has auto-mergeable conflicts. - */ - public boolean hasAutoMergeableConflicts() { - return hasNodes(new AutomergableFilter()); - } - - /** - * Removes all conflicting nodes from this set. - */ - public void removeConflictingNodes() { - rejectNodes(new SyncInfoDirectionFilter(SyncInfo.CONFLICTING)); - } - /** - * Removes all outgoing nodes from this set. - */ - public void removeOutgoingNodes() { - rejectNodes(new SyncInfoDirectionFilter(SyncInfo.OUTGOING)); - } - /** - * Removes all incoming nodes from this set. - */ - public void removeIncomingNodes() { - rejectNodes(new SyncInfoDirectionFilter(SyncInfo.INCOMING)); - } - - /** - * Removes all nodes from this set that are not auto-mergeable conflicts - */ - public void removeNonMergeableNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo node = (SyncInfo)it.next(); - if ((node.getKind() & SyncInfo.MANUAL_CONFLICT) != 0) { - it.remove(); - } else if ((node.getKind() & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) { - it.remove(); - } - } - } - - /** - * Indicate whether the set has nodes matching the given filter - */ - public boolean hasNodes(SyncInfoFilter filter) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info != null && filter.select(info)) { - return true; - } - } - return false; - } - - /** - * Removes all nodes from this set that do not match the given filter - */ - public void selectNodes(SyncInfoFilter filter) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info == null || !filter.select(info)) { - it.remove(); - } - } - } - - /** - * Removes all nodes from this set that match the given filter - */ - public void rejectNodes(SyncInfoFilter filter) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info != null && filter.select(info)) { - it.remove(); - } - } - } - - /** - * Return all nodes in this set that match the given filter - */ - public SyncInfo[] getNodes(SyncInfoFilter filter) { - List result = new ArrayList(); - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info != null && filter.select(info)) { - result.add(info); - } - } - return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]); - } - - public SyncInfo[] getSyncInfos() { - return (SyncInfo[]) set.toArray(new SyncInfo[set.size()]); - } - - /** - * Returns the resources from all the nodes in this set. - */ - public IResource[] getResources() { - SyncInfo[] changed = getSyncInfos(); - IResource[] resources = new IResource[changed.length]; - for (int i = 0; i < changed.length; i++) { - resources[i] = changed[i].getLocal(); - } - return resources; - } - - public boolean isEmpty() { - return set.isEmpty(); - } - - public void removeResources(IResource[] resources) { - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - removeResource(resource); - } - } - - private void removeResource(IResource resource) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo node = (SyncInfo)it.next(); - if (node.getLocal().equals(resource)) { - it.remove(); - // short-circuit the operation once a match is found - return; - } - } - } - - public int size() { - return set.size(); - } - - public SyncInfo getNodeFor(IResource resource) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo node = (SyncInfo)it.next(); - if (node.getLocal().equals(resource)) { - return node; - } - } - return null; - } - - public void addAll(SyncInfoSet set) { - SyncInfo[] resources = set.getSyncInfos(); - for (int i = 0; i < resources.length; i++) { - SyncInfo resource = resources[i]; - this.set.add(resource); - } - - } -} - |