Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2004-03-01 15:18:01 +0000
committercvs2svn2004-03-01 15:18:01 +0000
commit8d8f0956dcd2bac2d58082b5df4f32801b5179d3 (patch)
tree596c244c49769b47d943a55e3d09de03b8504d5b /bundles
parent699c5d9fd519aec16c0f812436cd838d18d4159c (diff)
downloadeclipse.platform.team-8d8f0956dcd2bac2d58082b5df4f32801b5179d3.tar.gz
eclipse.platform.team-8d8f0956dcd2bac2d58082b5df4f32801b5179d3.tar.xz
eclipse.platform.team-8d8f0956dcd2bac2d58082b5df4f32801b5179d3.zip
This commit was manufactured by cvs2svn to create branch
'branch_20040301_changeLogModelProvider'. Sprout from master 2004-03-01 15:17:59 UTC Michael Valenta <mvalenta> '53185: [Decorators] NPE and SWTException while applying decorations' 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/ICompareNavigator.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/IEncodedStreamContentAccessor.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/IStreamContentAccessorExtension2.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/BaseCompareAction.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/CompareFilter.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/CompareOutlinePage.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/ICompareNavigator.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/IEncodedStreamContentAccessor.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/IStreamContentAccessorExtension2.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/BaseCompareAction.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/CompareFilter.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/CompareOutlinePage.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/DeploymentProvider.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.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/ITeamStatus.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/TeamStatus.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FilteredSyncInfoCollector.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeEvent.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeListener.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/package.html bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/CachedResourceVariant.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariant.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariantComparator.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeEvent.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeListener.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTreeChangeEvent.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/package.html bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.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/DeploymentProviderManager.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/IJobListener.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IMemento.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/ResourceVariantCache.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCacheEntry.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.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/XMLMemento.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/registry/DeploymentProviderDescriptor.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java 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/subscribers/ContentComparator.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetChangedEvent.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetSyncSetInput.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/AbstractResourceVariantTree.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/DescendantResourceVariantByteStore.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/IResourceVariantTree.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/PersistantResourceVariantByteStore.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantByteStore.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTree.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTreeSubscriber.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/SessionResourceVariantByteStore.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.cvs.ssh2/.classpath bundles/org.eclipse.team.cvs.ssh2/.cvsignore bundles/org.eclipse.team.cvs.ssh2/.project bundles/org.eclipse.team.cvs.ssh2/about.html bundles/org.eclipse.team.cvs.ssh2/build.properties bundles/org.eclipse.team.cvs.ssh2/jsch-0.1.13.jar bundles/org.eclipse.team.cvs.ssh2/plugin.properties bundles/org.eclipse.team.cvs.ssh2/plugin.xml bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Method.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Plugin.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2PreferencePage.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2Method.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/Policy.java bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/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/DESIGN.TXT bundles/org.eclipse.team.ui/TODO-syncview.txt 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/checkin_action.gif bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.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/flatLayout.gif bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.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/next_nav.gif bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.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/rem_co.gif bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.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/checkin_action.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.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/flatLayout.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.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/next_nav.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.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/rem_co.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.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/checkin_action.gif bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.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/flatLayout.gif bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.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/next_nav.gif bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.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/rem_co.gif bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.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/confchg_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/ovr/warning_co.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/schema/synchronizeParticipants.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/OverlayIcon.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/TeamAdapterFactory.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/ITeamRunnableContext.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.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/RefreshChangeListener.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/jobs/RefreshUserNotificationPolicy.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/registry/RegistryReader.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshEvent.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshSubscriberListener.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.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/ITeamUIConstants.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.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/synchronize/AbstractSynchronizeParticipant.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/CompressedFoldersModelProvider.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/HierarchicalModelProvider.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelProvider.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html 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/.classpath 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/FileSystemSubscriber.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/SimpleAccessOperations.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/deployment/DeployAction.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/FileSystemDeploymentProvider.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/NullAction.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/UnDeployAction.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/JUnit Tests/org/eclipse/compare/tests/FilterTest.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/plugin.xml 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/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/TeamTest.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/AllTeamSynchronizeTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java tests/org.eclipse.team.tests.core/test.xml 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/book.css 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/html/00000.html tests/org.eclipse.team.tests.cvs.core/html/00001.html tests/org.eclipse.team.tests.cvs.core/html/00002.html tests/org.eclipse.team.tests.cvs.core/html/00003.html tests/org.eclipse.team.tests.cvs.core/html/00004.html tests/org.eclipse.team.tests.cvs.core/html/00005.html tests/org.eclipse.team.tests.cvs.core/html/00006.html tests/org.eclipse.team.tests.cvs.core/html/00007.html tests/org.eclipse.team.tests.cvs.core/html/00008.html tests/org.eclipse.team.tests.cvs.core/html/00009.html tests/org.eclipse.team.tests.cvs.core/html/00010.html tests/org.eclipse.team.tests.cvs.core/html/00011.html tests/org.eclipse.team.tests.cvs.core/html/00012.html tests/org.eclipse.team.tests.cvs.core/html/00013.html tests/org.eclipse.team.tests.cvs.core/html/00014.html tests/org.eclipse.team.tests.cvs.core/html/00015.html tests/org.eclipse.team.tests.cvs.core/html/00016.html tests/org.eclipse.team.tests.cvs.core/html/00017.html tests/org.eclipse.team.tests.cvs.core/html/00018.html tests/org.eclipse.team.tests.cvs.core/html/00019.html tests/org.eclipse.team.tests.cvs.core/html/00020.html tests/org.eclipse.team.tests.cvs.core/html/00021.html tests/org.eclipse.team.tests.cvs.core/html/00022.html tests/org.eclipse.team.tests.cvs.core/html/00023.html tests/org.eclipse.team.tests.cvs.core/html/00024.html tests/org.eclipse.team.tests.cvs.core/html/00025.html tests/org.eclipse.team.tests.cvs.core/html/00026.html tests/org.eclipse.team.tests.cvs.core/html/00027.html tests/org.eclipse.team.tests.cvs.core/html/00028.html tests/org.eclipse.team.tests.cvs.core/html/00028a.html tests/org.eclipse.team.tests.cvs.core/html/00029.html tests/org.eclipse.team.tests.cvs.core/html/00029a.html tests/org.eclipse.team.tests.cvs.core/html/00030.html tests/org.eclipse.team.tests.cvs.core/html/00030a.html tests/org.eclipse.team.tests.cvs.core/html/00031.html tests/org.eclipse.team.tests.cvs.core/html/00032.html tests/org.eclipse.team.tests.cvs.core/html/00033.html tests/org.eclipse.team.tests.cvs.core/html/00034.html tests/org.eclipse.team.tests.cvs.core/html/00035.html tests/org.eclipse.team.tests.cvs.core/html/00036.html tests/org.eclipse.team.tests.cvs.core/html/00037.html tests/org.eclipse.team.tests.cvs.core/html/00038.html tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS Core Tests.launch tests/org.eclipse.team.tests.cvs.core/launchConfigurations/CVS UI Tests.launch tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.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/AllCoreTests.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/CVSTestLogListener.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/CVSUITestSetup.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/TestsUserAuthenticator.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/ConcurrencyTests.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/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/CVSCompareSubscriberTest.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/TestMarkAsMergedAction.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/TestOverrideAndCommit.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/AllUITests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSOperationTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CheckoutOperationTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MiscOperationsTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java tests/org.eclipse.team.tests.cvs.core/test.xml tests/org.eclipse.team.tests.cvs.core/toc.xml
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.compare/.classpath7
-rw-r--r--bundles/org.eclipse.compare/.cvsignore1
-rw-r--r--bundles/org.eclipse.compare/.project37
-rw-r--r--bundles/org.eclipse.compare/about.html30
-rw-r--r--bundles/org.eclipse.compare/build.properties18
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html1454
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java129
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java450
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java791
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java296
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java140
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java371
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java1142
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java90
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java34
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java30
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java39
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java67
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java38
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java31
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java41
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java36
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java20
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java68
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java34
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java94
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java219
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java129
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java319
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java978
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java146
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java54
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java155
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java57
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java4151
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties98
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html45
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java35
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java138
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties45
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java475
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java43
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java130
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java29
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties22
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java98
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java133
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java53
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java122
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java59
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java124
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java258
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java105
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java393
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java32
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties58
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java157
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java106
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java384
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java913
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java20
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties38
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java78
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java197
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java65
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java237
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java133
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java53
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java21
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java24
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java19
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java33
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java41
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java26
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java142
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java145
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java30
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties32
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java47
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java90
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java398
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java43
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java163
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java35
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java451
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java20
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties40
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java21
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java161
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java375
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java26
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java65
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java53
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java31
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java32
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java385
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java176
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java581
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java65
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java17
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java154
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java102
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java132
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java524
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java134
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java19
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java32
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties90
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java135
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java1080
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java742
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/package.html99
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java77
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java60
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java57
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java208
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java542
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html44
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java111
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java91
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java357
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java719
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties53
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java526
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java354
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java142
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java38
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java62
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java61
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java45
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java110
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java370
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html79
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gifbin154 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gifbin166 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gifbin169 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gifbin170 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gifbin174 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gifbin105 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gifbin132 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gifbin229 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gifbin165 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/cview16/compare_view.gifbin128 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gifbin129 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gifbin100 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gifbin99 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gifbin90 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gifbin85 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gifbin93 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gifbin147 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gifbin130 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gifbin129 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gifbin133 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gifbin138 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gifbin102 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gifbin133 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gifbin125 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gifbin111 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gifbin122 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/eview16/compare_view.gifbin129 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/obj16/day_obj.gifbin181 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gifbin153 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gifbin95 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gifbin100 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gifbin93 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gifbin92 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gifbin123 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gifbin122 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gifbin118 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gifbin3071 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugin.properties199
-rw-r--r--bundles/org.eclipse.compare/plugin.xml302
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath7
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore1
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project37
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html30
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties18
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html1454
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java129
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java450
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java791
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java296
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java140
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java371
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java1142
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java90
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java34
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java30
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java39
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java67
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java38
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java31
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java41
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java36
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java20
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java68
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java34
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java94
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java219
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java129
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java319
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java978
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java146
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java54
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java155
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java57
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java4151
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties98
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html45
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java35
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java138
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties45
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java475
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java43
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java130
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java29
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties22
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java98
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java133
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java53
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java122
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java59
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java124
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java258
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java105
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java393
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java32
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties58
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java157
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java106
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java384
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java913
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java20
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties38
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java78
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java197
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java65
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java237
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java133
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java53
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java21
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java24
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java19
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java33
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java41
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java26
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java142
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java145
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java30
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties32
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java47
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java90
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java398
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java43
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java163
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java35
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java451
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java20
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties40
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java21
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java161
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java375
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java26
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java65
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java53
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java31
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java32
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java385
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java176
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java581
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java65
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java17
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java134
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java154
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java102
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java132
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java524
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java134
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java19
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java32
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties90
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java135
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java1080
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java742
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/package.html99
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java77
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java60
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java57
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java208
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java542
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html44
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java111
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java91
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java357
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java719
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties53
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java526
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java354
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java142
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java38
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java62
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java61
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java45
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java110
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java370
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html79
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gifbin154 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gifbin166 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gifbin169 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gifbin170 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gifbin174 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gifbin105 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gifbin132 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gifbin229 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gifbin165 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gifbin128 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gifbin129 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gifbin100 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gifbin99 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gifbin90 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gifbin85 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gifbin93 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gifbin147 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gifbin130 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gifbin129 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gifbin133 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gifbin138 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gifbin102 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gifbin133 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gifbin125 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gifbin111 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gifbin122 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gifbin129 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gifbin181 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gifbin153 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gifbin95 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gifbin100 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gifbin93 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gifbin92 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gifbin123 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gifbin122 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gifbin118 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gifbin124 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gifbin3071 -> 0 bytes
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties199
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml302
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd129
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd131
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd128
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd130
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml30
-rw-r--r--bundles/org.eclipse.compare/schema/contentMergeViewers.exsd129
-rw-r--r--bundles/org.eclipse.compare/schema/contentViewers.exsd131
-rw-r--r--bundles/org.eclipse.compare/schema/structureCreators.exsd128
-rw-r--r--bundles/org.eclipse.compare/schema/structureMergeViewers.exsd130
-rw-r--r--bundles/org.eclipse.compare/scripts/exportplugin.xml30
-rw-r--r--bundles/org.eclipse.team.core/.classpath7
-rw-r--r--bundles/org.eclipse.team.core/.cvsignore1
-rw-r--r--bundles/org.eclipse.team.core/.options6
-rw-r--r--bundles/org.eclipse.team.core/.project31
-rw-r--r--bundles/org.eclipse.team.core/about.html30
-rw-r--r--bundles/org.eclipse.team.core/build.properties14
-rw-r--r--bundles/org.eclipse.team.core/buildnotes_team.html529
-rw-r--r--bundles/org.eclipse.team.core/plugin.properties18
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml160
-rw-r--r--bundles/org.eclipse.team.core/schema/fileTypes.exsd109
-rw-r--r--bundles/org.eclipse.team.core/schema/ignore.exsd108
-rw-r--r--bundles/org.eclipse.team.core/schema/projectSets.exsd116
-rw-r--r--bundles/org.eclipse.team.core/schema/repository.exsd104
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java136
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java94
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java39
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java40
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java65
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamStatus.java39
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java46
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java631
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java159
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java619
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java94
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java49
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html20
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FilteredSyncInfoCollector.java162
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeEvent.java39
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeListener.java44
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java347
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java60
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java384
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/package.html61
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/CachedResourceVariant.java232
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java192
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariant.java72
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariantComparator.java61
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeEvent.java68
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeListener.java74
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTreeChangeEvent.java52
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java411
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java72
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java594
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java348
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/package.html82
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java106
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java362
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java59
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java101
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java447
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java157
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java106
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IJobListener.java26
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IMemento.java169
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java91
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java116
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java65
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java119
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java250
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCacheEntry.java217
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java67
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java398
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java60
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java113
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java406
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties127
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java80
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java56
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java144
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java267
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java155
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java146
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java188
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java188
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java139
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java138
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java277
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java289
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java140
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java444
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java80
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java107
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java95
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java111
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetChangedEvent.java104
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java93
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java57
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java117
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetSyncSetInput.java36
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/AbstractResourceVariantTree.java303
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/DescendantResourceVariantByteStore.java173
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/IResourceVariantTree.java87
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/PersistantResourceVariantByteStore.java160
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantByteStore.java113
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTree.java93
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTreeSubscriber.java185
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/SessionResourceVariantByteStore.java146
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/.classpath7
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/.cvsignore1
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/.options7
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/.project23
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/about.html92
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/build.properties14
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/plugin.properties12
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/plugin.xml40
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java1220
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java724
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java53
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java471
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java52
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java164
-rw-r--r--bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties39
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/.classpath8
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/.cvsignore1
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/.project25
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/about.html69
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/build.properties10
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/jsch-0.1.13.jarbin100427 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/plugin.properties14
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/plugin.xml62
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Method.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Plugin.java55
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2PreferencePage.java1137
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java102
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java280
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2Method.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java142
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/Policy.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/messages.properties80
-rw-r--r--bundles/org.eclipse.team.ui/.classpath7
-rw-r--r--bundles/org.eclipse.team.ui/.cvsignore1
-rw-r--r--bundles/org.eclipse.team.ui/.project42
-rw-r--r--bundles/org.eclipse.team.ui/DESIGN.TXT93
-rw-r--r--bundles/org.eclipse.team.ui/TODO-syncview.txt173
-rw-r--r--bundles/org.eclipse.team.ui/about.html30
-rw-r--r--bundles/org.eclipse.team.ui/build.properties14
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gifbin145 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gifbin184 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gifbin174 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gifbin170 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gifbin88 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gifbin229 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gifbin159 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gifbin100 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gifbin106 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gifbin105 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gifbin132 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gifbin182 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gifbin174 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gifbin149 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gifbin164 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gifbin147 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gifbin236 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gifbin167 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gifbin176 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gifbin145 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gifbin184 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gifbin88 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gifbin84 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gifbin229 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gifbin92 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gifbin71 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gifbin75 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gifbin104 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gifbin103 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gifbin149 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gifbin66 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gifbin99 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gifbin145 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gifbin184 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gifbin138 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gifbin133 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gifbin88 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gifbin111 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gifbin229 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gifbin128 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gifbin103 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gifbin119 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gifbin116 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gifbin143 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gifbin102 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gifbin144 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gifbin234 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gifbin149 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gifbin162 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gifbin138 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gifbin131 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gifbin173 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gifbin231 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gifbin230 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/obj/share_project.gifbin164 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gifbin106 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gifbin93 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gifbin75 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gifbin80 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gifbin116 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gifbin2528 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gifbin2711 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gifbin2877 -> 0 bytes
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties59
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml207
-rw-r--r--bundles/org.eclipse.team.ui/schema/configurationWizards.exsd142
-rw-r--r--bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd146
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java32
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java99
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java200
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java102
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java380
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java473
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java70
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ITeamRunnableContext.java46
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java114
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java125
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java329
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java362
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java306
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java108
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java213
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java412
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java126
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java55
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java351
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java118
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties374
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java185
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java194
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java226
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java123
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java375
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java144
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java119
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java342
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java197
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java64
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshEvent.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshSubscriberListener.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java157
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java293
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java115
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java519
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java344
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java58
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java71
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java55
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java117
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java165
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java102
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java136
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java74
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java133
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java202
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java123
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java131
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java85
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java140
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java72
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java230
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java179
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java202
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java216
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java202
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java164
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java107
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java81
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java61
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java235
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java90
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java162
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html47
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java176
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java312
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java312
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java195
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java135
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html43
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/CompressedFoldersModelProvider.java281
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/HierarchicalModelProvider.java230
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java29
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java401
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java261
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java235
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java196
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java190
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java207
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java47
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelProvider.java426
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java356
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html82
734 files changed, 0 insertions, 95473 deletions
diff --git a/bundles/org.eclipse.compare/.classpath b/bundles/org.eclipse.compare/.classpath
deleted file mode 100644
index 3e86ace7d..000000000
--- a/bundles/org.eclipse.compare/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="compare"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.compare/.cvsignore b/bundles/org.eclipse.compare/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/bundles/org.eclipse.compare/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.compare/.project b/bundles/org.eclipse.compare/.project
deleted file mode 100644
index f0d1e74ed..000000000
--- a/bundles/org.eclipse.compare/.project
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.compare</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.ui.ide</project>
- <project>org.eclipse.ui.views</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.compare/about.html b/bundles/org.eclipse.compare/about.html
deleted file mode 100644
index 9db411aab..000000000
--- a/bundles/org.eclipse.compare/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/build.properties b/bundles/org.eclipse.compare/build.properties
deleted file mode 100644
index 22bed075e..000000000
--- a/bundles/org.eclipse.compare/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.compare.jar = compare/
-bin.includes = icons/,\
- plugin.xml,\
- *.jar,\
- plugin.properties,\
- about.html
-src.includes = about.html,\
- schema/
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
deleted file mode 100644
index 655f1078f..000000000
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ /dev/null
@@ -1,1454 +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="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <meta name="Author" content="IBM">
- <title>Eclipse Platform Release Notes - Desktop</title>
-</head>
-<body>
-
-<h1>
-Eclipse Platform Build Notes<br>
-Compare</h1>
-Eclipse Build Input March 2th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=42731">#42731</a>: Synchronize horizontal scrolling in compare editor<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2278">#2278</a>: DCR: Would like coupled horizontal scrolling in compare browser (1GEJNHO)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=53368">#53368</a>: Layout problem with focus ring<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 17th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=51593">#51593</a>: ArrayIndexOutOfBoundsException at org.eclipse.compare.internal.patch.PatchWizard.setTargets<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=52055">#52055</a>: Method compare is broken<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 10th 2004 (M7)
-
-<h2>
-API Additions</h2>
-Added new interface IEncodedStreamContentAccessor; deprecated IStreamContentAccessorExtension2<br>
-Added first cut of outline view support.
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 27th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=50565">#50565</a>: [Preferences] Pref page Workbench/Compare/Patch; no mnemonic for "Filtered Members"<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 13th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=49695">#49695</a>: Apply Patch wizard is leaking 7 Images<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=49803">#49803</a>: Replace with local history leaks 2 images<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 6th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32329">#32329</a>: Support filters for compare<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 18th (M6) 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=47866">#47866</a>: Internal error in synchronize perspective<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=45239">#45239</a>: Show ancestor for incoming and outgoing changes<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=41815">#41815</a>: Internal error comparing with repository<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46709">#46709</a>: PatchWizard should use scheduling rule on project<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 25th 2003
-
-<h2>
-Problem reports fixed</h2>
-removed use of deprecated symbols
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 19th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46805">#46805</a>: prepare Compare for encoding support<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46877">#46877</a>: Remove dependancies on Xerces<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46977">#46977</a>: Comparing/merging two local files screws up the content<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input August 26th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=40727">#40727</a>: Allow navigation workflow control from other view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=39757">#39757</a>: Some compare operations fail on resources that do not exist<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=35380">#35380</a>: Replace with Local History and read-only resources<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input July 15th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38836">#38836</a>: CompareEditorInput clears dirty state too quickly<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input July 1st 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38808">#38808</a>: NPE in log file when restoring files from history.<br>
-fixed minor error in schema files
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 24th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 10th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38713">#38713</a>: Compare with -> Each other is not enabled<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 3rd 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37531">#37531</a>: the javadoc of CompareViewerPane.setImage(Image)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38262">#38262</a>: Apply patch applies unchecked changes<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=36399">#36399</a>: Compare did retrieve entire remote ZIP contents on selection change<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38198">#38198</a>: TVT21: Strings are not externalized<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input Mai 27th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37849">#37849</a>: "Ignore whitespace" ignores also closing brackets?!?<br>
-
-Problem reports closed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37582">#37582</a>: Ignore whitespace option should be a button in the compare editor<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 27th 2003
-
-<h2>
-Problem reports fixed</h2>
-Fixed 5 Javadoc warnings
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 24th 2003
-
-<h2>
-Problem reports fixed</h2>
-Updated schema copyright notices<br>
-updated javadoc
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 19th 2003
-
-<h2>
-Problem reports fixed</h2>
-Fixed wording in properties files<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=35130">#35130</a>: Dialogs do not set the dialog font<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 14th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=34732">#34732</a>: Compare/Patch preference page mnemonic<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=34696">#34696</a>: Title casing issues<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 6th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=27405">#27405</a>: Should consider using the new font propogation support<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24255">#24255</a>: Internal error when invoking "Restore from Local History" in Outline view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32737">#32737</a>: NegativeArraySizeException: Compare/patch preference page<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 4th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32769">#32769</a>: Missing mneumonic in compare preference page<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32798">#32798</a>: No mnemonic for ComparePreferencePage.useSingleLine.label<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32207">#32207</a>: Wording: "Open with Compare Editor" action in sync view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28190">#28190</a>: Middle area should act like sash<br>
-added required IDs for compare viewers in plugin.xml<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 20th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=20248">#20248</a>: [Compare] Have to perform two actions to see diff<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24165">#24165</a>: Should have menu action for showing compare contents<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13332">#13332</a>: autosave before patching: can i undo?<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24077">#24077</a>: Comparing file named 'platformOption' does not use text editor<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=23958">#23958</a>: NPE in compare with patch<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28402">#28402</a>: CompareConfiguration leaks Images<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13844">#13844</a>: TextMergeViewer should keep track of its posted runnables<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14353">#14353</a>: Cannot perform merge with keyboard accelerators/mnemonics<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 18th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5323">#5323</a>: Compare does not handle correctly conflicts at same location<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=26035">#26035</a>: Local history uses wrong character encoding<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=15654">#15654</a>: Can't maximize Compare with Local History window<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 13th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=31136">#31136</a>: Red icon too intrusive<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=31357">#31357</a>: Compare View -- Compare-style option required.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=31633">#31633</a>: Cannot apply patch successfully<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10754">#10754</a>: Compare actions should target source window<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 11th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=25507">#25507</a>: Compare view prevents Ctrl + F6 working<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18571">#18571</a>: patch: scary error dialog when no patch in clipboard<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28840">#28840</a>: Strange behavious applying patch<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 6th 2003 (M5 aka RC0)
-
-<h2>
-API Additions</h2>
-Added new method EditionSelectionDialog.getSelection()
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=30525">#30525</a>: "Team" menu item missing accelerator<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28202">#28202</a>: contentmergeviewers do not work with mixed-case extensions<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19114">#19114</a>: Restore Java Element from Local History should also provide check boxes [compare]<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28436">#28436</a>: Overview rule green only after focus change<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=29793">#29793</a>: Automatically suggest a fuzz factor when applying a patch<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 28th 2003
-
-<h2>
-API Additions</h2>
-Added new method CompareUI.findContentViewer(..., Object input, ...)
-
-<h2>
-Problem reports fixed</h2>
-Remoced doc folder.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24597">#24597</a>: Compare UI API issues<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=23883">#23883</a>: CompareDialog.commitAction.label string resource name is wrong<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=29791">#29791</a>: Rename 'Compare to Patch' to 'Apply Patch'<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 14th 2003
-
-<h2>
-Problem reports fixed</h2>
-Extension point schema files added.<br>
-Resolve status indicator is only shown if there are incoming changes.
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 7th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28278">#28278</a>: TextMergeViewer leaks Color objects<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=27864">#27864</a>: Load of CompareUI fails when not triggered in UI thread<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28388">#28388</a>: Illegal Argument Exceptions in compare viewer<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 17th 2002
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28388">#28388</a>: Illegal Argument Exceptions in compare viewer<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 16th 2002
-
-<h2>
-Problem reports fixed</h2>
-Fixed a problem with trim in compare viewer on Mac OS X.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28278">#28278</a>: TextMergeViewer leaks Color objects<br>
-
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 13th 2002
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28012">#28012</a>: Double-click behaving strangely in Synchronize View<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 10th 2002
-
-<h2>
-What's new in this drop</h2>
-The Textmergeviewer sports a first cut of a new UI for left/right copying,
-showing the 'resolved' status of a change, and uses smooth lines to
-connect the differing ranges in the left and right panes.
-The new UI options are off by default. You can turn them on
-with the three 'experimental' options on the Compare preference page.
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=27993">#27993</a>: Incorrect structure comparison<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 3rd 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API Additions</h3>
-Made internal class Splitter public API.
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#24597</a>: Compare UI API issues<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 26th 2002
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#20975</a>: Compare preference page has no F1 help<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 27th 2002
-
-<h2>
-What's new in this drop</h2>
-Updated JavaDoc package.html files
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 25th 2002
-
-<h2>
-What's new in this drop</h2>
-Updated JavaDoc
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 12th 2002
-
-<h2>
-What's new in this drop</h2>
-
-There were several complains that clicking on a zip file in the left pane (structure input pane) feeds all other
-compare panes (see bug 13730). There are cases where this is expensive (for example a large zip file that has
-to be read from a repository). To avoid those situations the left pane now honors single or double click mode as
-set in Preferences->Workbench. So if this preference is set to double click the user has to double click on a file
-in the left pane to actually feed all other compare panes.
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 8th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#18807</a>: Compare with patch fails due to missing LF<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13730">#13730</a>: Entire zipfiles content sent prior when computing synchronization view content<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 7th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13730">#13730</a>: Entire zipfiles content sent prior when computing synchronization view content<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14952">#14952</a>: Diff Browser Opens Too Small / Not Easily Resizable<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 6th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-New constant CompareUI.PLUGIN_ID
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13949">#13949</a>: DBCS: bogus at text compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19013">#19013</a>: backgronud color: is it honored?<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19216">#19216</a>: Accessibility in Workbench > Compare > Text Compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19371">#19371</a>: Java & Compare editor's Next/Previous toolbar buttons shouldn't be retargetable<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 1st 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-Made class NavigationAction public.
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8004">#8004</a>: Ctrl+E beeps every time<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14800">#14800</a>: Compare View eats tabs<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18200">#18200</a>: Both sets of arrows say "Select Next Change"<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18206">#18206</a>: Casing, wording issue on "Last Resource reached" prompt<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16285">#16285</a>: Add from Local History needs a description label<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17431">#17431</a>: Accessibility issues<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18148">#18148</a>: Using combinations of No and Next file button break wrapping<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18151">#18151</a>: Next File button does not ding when on last file<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16570">#16570</a>: Compare refuses to show further differences if not ignoring whitespaces<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10790">#10790</a>: Patch does not apply if file not found locally<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=12643">#12643</a>: Expand all does not disable when there is no selection<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 31st 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18116">#18116</a>: Compare view does not inherit Java editor background color<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13190">#13190</a>: Compare with Patch does not apply Patch, if single file selected<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 30th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17699">#17699</a>: Java Editor: Local Histroy menu entries are enabled for read-only files<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16283">#16283</a>: Add from Local History items are unsorted<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16288">#16288</a>: Add from Local History: list of available editions flashes<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17664">#17664</a>: Applying a patch with deleted package fails<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 29th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14040">#14040</a>: Platform interoperability issue w.r.t. Compare With Patch<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17790">#17790</a>: Missing mnemonics in patch selection dialog<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10917">#10917</a>: Patch support does not use mnemonics<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 28th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17889">#17889</a>: Should not assume type of PropertyChangeEvent values<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17678">#17678</a>: Applying a patch does many compiles<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17536">#17536</a>: NPE in compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17121">#17121</a>: Casing of message when end of changes needs to be sentence style<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17648">#17648</a>: Can't apply patch w/o ignoring whitespace<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16936">#16936</a>: Compare with patch requires "Ignore Whitespace" to be turned off<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 18th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14371">#14371</a>: TextMergeViewer.sameDoc() is broken<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14378">#14378</a>: CompareEditorInput never resets dirtyness flag (detailed)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14680">#14680</a>: Compare unreadable in high contrast black<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14952">#14952</a>: Diff Browser Opens Too Small / Not Easily Resizable<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14742">#14742</a>: Ignore whitespace preference<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14624">#14624</a>: No visual cue when compared file wraps<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13606">#13606</a>: Support multiple selection in Add from local history<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 16th 2002
-
-<h2>
-What's new in this drop</h2>
-Bumped plugin version number to 2.0.0<br>
-Adapted to new findEditor methods<br>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8373">#8373</a>: Compare With->Patch... missing mnemonic<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=12719">#12719</a>: "Show Pseudo-Conflicts" setting is problematic<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input April 30th 2002
-
-<h2>
-What's new in this drop</h2>
-All strings NLSed.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14515">#14515</a>: java compare uses internal jcore scanner<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14782">#14782</a>: Add from Local History missing mnemonic<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input April 18th 2002
-
-<h2>
-What's new in this drop</h2>
-All strings NLSed.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13152">#13152</a>: Internal error in "Add from Local History..." on packages<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input April 9th 2002
-
-<h2>
-What's new in this drop</h2>
-New context menu action 'Add From Local History'. Just select any resource container and
-'Add From Local History' presents all files that were deleted from the workspace but are
-still in the local history.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-The new 'Add From Local History' suffers from #12915. It works if the files were deleted
-within the same session. However if you shut down and restart a workspace some deleted
-files are nor listed.
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11578">#11578</a>: Patch: Missing resource on dialog<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11579">#11579</a>: Compare with Patch should be disabled on closed projects<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11907">#11907</a>: clicking in bird's eye view spots does nothing if panes not synched<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11536">#11536</a>: Option to turn off structured comparison<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10682">#10682</a>: Need better UI for recovering deletions from local history<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11446">#11446</a>: provide "add from local history" for compilation units<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8615">#8615</a>: Styled Text widget does not respond to system color change<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9673">#9673</a>: editor background color - no effect on other viewers<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11642">#11642</a>: Compare editors not using default background colors<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10434">#10434</a>: Compare browser fails silently and does not give result<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 18th 2002
-
-<h2>
-What's new in this drop</h2>
-First cut of a birdseyeview for the text compare viewer.<br>
-'Compare which Each other' for Java elements.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3641">#3641</a>: DCR: Can't compare from outliner (1GDHJKK)<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 14th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11305">#11305</a>: Can't compare a "C" file<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 12th 2002
-
-<h2>
-What's new in this drop</h2>
-Structure Compare viewers are enabled by default.<br>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10379">#10379</a>: Compare with Local History Dialog: lower pane is missing a bordeer<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9768">#9768</a>: (empty-menu) in compare view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9842">#9842</a>: Expand All action needed in structure compare view<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 5th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9869">#9869</a>: Need more support for creating/deleting resources<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 26th 2002
-
-<h2>
-What's new in this drop</h2>
-Patch: for every rejected file a task marker is added<br>
-Compare preference page shows options in a preview<br>
-New preference option for additional compare status line information
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9540">#9540</a>: Compare with patch: it should not be possible to check items that could not be applied<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9532">#9532</a>: Compare with patch: next disabled although clipboard specified<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7681">#7681</a>: Structured results expands import statements<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9572">#9572</a>: Debugging trace left in status bar<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 12th 2002
-
-<h2>
-What's new in this drop</h2>
-The patch wizard no longer opens a Compare Editor but applies the
-patch directly to the workspace. This will be the default.
-In the future the old behavior of opening the Compare Editor will be
-an additional option when finishing the wizard.
-<br>
-Patch wizard has a 'Reverse' option for applying a "reversed" patch.
-This option can be used to 'undo' a patch.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9153">#9153</a>: NPE when closing synchronize view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9331">#9331</a>: NPE during compare with stream version<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6346">#6346</a>: Problems with Patch<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6727">#6727</a>: Patch: *.rej file must be saved in workspace<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7358">#7358</a>: Internal Error in Compare with Patch with new files<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 5th 2002
-
-<h2>
-What's new in this drop</h2>
-The structure compare pane opens when a resource is selected.
-In previous version a double click was required.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5063">#5063</a>: Should not have to double-click to open Structure Compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2602">#2602</a>: Compare FW accessibility issues (1GK79UB)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2707">#2707</a>: Merge viewer should ask for save before releasing (1GI9JXS)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2772">#2772</a>: DCR: Automatic structure compare (1GJ6EUY)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3829">#3829</a>: Smart rename button enabled when no smartness is available (1GEUVHN)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9089">#9089</a>: Local history - Selecting item in structured compare has no effect<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 29th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6271">#6271</a>: Can't tell which file is which in Compare browser<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2519">#2519</a>: next/prev arrows active when only one difference in compare (1GFIQX3)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8363">#8363</a>: NPE comparing two resources in the navigator.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2501">#2501</a>: Empty menu in compare browser (1GFBQKE)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2854">#2854</a>: Compare: Save code path problematic (1GJYGAX)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8574">#8574</a>: Not structure compare in compare with local history<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 23th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8089">#8089</a>: Replace from local history: parse error<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 22th 2002
-
-<h2>
-What's new in this drop</h2>
-Fixed an inconsistency in the binary compare viewer:
-info message didn't match +/-icon in the resource compare pane.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3859">#3859</a>: replace from history does not work for elements with error (1GEYIZ6)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6177">#6177</a>: Double click action dangerous in 'Restore from Local History'<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7821">#7821</a>: Team 2.0 CVS synchronze bug 'no-name' dirs..<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2773">#2773</a>: Java structure compare should give better indication when no changes (1GJ6ENE)<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 15th 2002
-
-<h2>
-What's new in this drop</h2>
-Fixed a problem in DiffNode.getName()and the DiffTreeViewer's label provider
-where the left and right half of a DiffNode label would be reversed because
-the "leftIsLocal" property of a CompareConfiguration wasn't obeyed.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=1893">#1893</a>: Compare Viewer doesn't scroll to last line (1GBB34N)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5839">#5839</a>: Usability: Initial diff is sometimes not horizontally aligned<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5325">#5325</a>: Compare always scroll the text pane to the extreme limit<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7048">#7048</a>: First element not selected<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2548">#2548</a>: Project compare should open viewing selected file (1GFMRP6)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2938">#2938</a>: Replace from local history should show busy cursor (1GKU0P3)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7594">#7594</a>: Menu entry "Replace with Previous" shouldn't have a "..."<br>
-Workaround added for:<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7320">#7320</a>: Next diff scrolls when going into current diff<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 8th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-Added methods to CompareUI plugin for adding and removing aliases
-for the file extension to StructureCompareViewer mapping
-(addStructureViewerAlias, removeStructureViewerAlias).
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6828">#6828</a>: Support with replace with previous<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2396">#2396</a>: Save in compare editors needs progress bar (1GEYF58)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5271">#5271</a>: JARs compared as source in release browser<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5121">#5121</a>: Replace with Previous (from local history)<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 11th 2001
-
-<h2>
-What's new in this drop</h2>
-Keyboard shortcuts for 'Goto next Difference' and 'Goto previous Difference'
-changed to Control-E and Control-Shift-E.<br>
-Better NLS support.<br>
-Updated file "about.html".
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 4th 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=4381">#4381</a>: Replace from local histroy - workspace element included <br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 27th 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6298">#6298</a>: Replace with Local History: Workbench -> Workspace<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5238">#5238</a>: Compare fails if takes more than 20 seconds<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 210, November 12th, 2001
-
-<h2>
-What's new in this drop</h2>
-First cut for 'rejected hunk' support.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-new classes CompareViewerPane and CompareViewerSwitchingPane<br>
-
-<h3>
-Other highlights</h3>
-Improved Patch wizard.<br>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5723">#5723</a>: Apply Patch dialog has no radio selection<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 207, November 1st, 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5334">#5334: Internal errors using patch tool</a><br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5150">#5150: Compare with patch cannot read VCM's CVS patch file</a><br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 204, October 12th, 2001
-
-<h2>
-What's new in this drop</h2>
-First cut of patch support.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 202, September 27th, 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GKKUA5: ITPUI:WINNT - Severe: memory leak in sync view<br>
-1GKKGGS: ITPJUI:WIN2000 - (136) compares zips as source<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 201, September 21st, 2001
-
-<h2>
-What's new in this drop</h2>
-removed direction icon in TextMergeViewer for two-way compare
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GJURWJ: ITPUI:WIN2000 - Hebrew + Japanese: compare view defaults to binary<br>
-1GK0388: ITPJCORE:WIN2000 - replace with local history: selecting (workspace) deletes source<br>
-1GITG2V: ITPUI:WIN2000 - Comparing html files uses binary compare<br>
-1GJW2TP: ITPJUI:WIN2000 - java compare: why beep every time?<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 200, September 13th, 2001
-
-<h2>
-What's new in this drop</h2>
-If not specified otherwise Compare viewer font is taken from workbench text font<br>
-The shortcut for "Goto Next/Previous Difference" is Ctrl-D/Ctrl-Shift-D
-to avoid a clash with Ctrl-P of the Print command.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-new method EditionSelectionDialog.setHideIdenticalEntries(boolean)<br>
-new method EditionSelectionDialog.setTargetIsRight(boolean)<br>
-new method EditionSelectionDialog.setAddMode(boolean)<br>
-new method CompareEditorInput.saveChanges(...)<br>
-new method TextMergeViewer.createLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace)<br>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty<br>
-1GG0ELM: ITPVCM:ALL - Local history displayed some of Today's items as Yesterday<br>
-1GGNKHN: ITPJUI:ALL - No progress during replace with local history<br>
-1GF2JNI: ITPUI:ALL - (minor)Compare failed title should be title case<br>
-1GHBPA1: ITPVCM:WINNT - Compare - next change arrow switches to wrong file<br>
-1GGQQH3: ITPJUI:WINNT - Compare hightlights a non-change instead of the change<br>
-1GI5DN9: ITPUI:WIN2000 - Conflicting token deletions don't show up in text compare viewer<br>
-1GI3KUR: ITPJUI:WIN2000 - Compare: double-click in versions list closes view<br>
-1GFFR4B: ITPUI:WIN98 - local history is misleading<br>
-1GBM0IL: ITPUI:WINNT - CompareEditorInput#save should throw CoreException<br>
-1GI99LE: ITPUI:ALL - Compare viewer does not show last line when horizontal scroll bar is present<br>
-1GBB34N: ITPJUI:WIN2000 - Compare Viewer doesn't scroll to last line<br>
-1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range<br>
-1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files<br>
-1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update<br>
-1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options<br>
-1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()<br>
-1GI3HDZ: ITPJUI:ALL - Compare: conflicts with no ancestor does not show differences<br>
-1GEUX0D: ITPJUI:ALL - not state aware toolbar button in compare<br>
-
-<h2>
-Problem reports closed</h2>
-1GF9Y9C: ITPUI:WIN2000 - DCR: only get ancestor pane contents if pane is visible<br>
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
deleted file mode 100644
index 2c1f7b769..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.internal.Utilities;
-
-/**
- * Abstract implementation for a buffered <code>IStreamContentAccessor</code>.
- * <p>
- * Subclasses must implement the <code>createStream</code> method
- * to connect the buffered content with a streamable source (e.g., a file).
- * <p>
- * As long as the contents of <code>BufferedContent</code> is only retrieved as an input stream
- * (by means of <code>getContents</code>) and the <code>BufferedContent</code> is not modified (with
- * <code>setContent</code>) no buffering takes place.
- * Buffering starts when either method <code>getContent</code> or <code>setContent</code> is called.
- *
- * @see IContentChangeNotifier
- * @see IStreamContentAccessor
- */
-public abstract class BufferedContent implements IContentChangeNotifier, IStreamContentAccessor {
-
- byte[] fContent;
- private ListenerList fListenerList;
-
- /**
- * Creates a buffered stream content accessor.
- */
- protected BufferedContent() {
- }
-
- /* (non-Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() throws CoreException {
- if (fContent != null)
- return new ByteArrayInputStream(fContent);
- return createStream();
- }
-
- /**
- * Creates and returns a stream for reading the contents.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @return the stream from which the content is read
- * @exception CoreException if the contents could not be accessed
- */
- protected abstract InputStream createStream() throws CoreException;
-
- /**
- * Sets the contents. Registered content change listeners are notified.
- *
- * @param contents the new contents
- */
- public void setContent(byte[] contents) {
- fContent= contents;
- fireContentChanged();
- }
-
- /**
- * Returns the contents as an array of bytes.
- *
- * @return the contents as an array of bytes, or <code>null</code> if
- * the contents could not be accessed
- */
- public byte[] getContent() {
- if (fContent == null) {
- try {
- InputStream is= createStream();
- fContent= Utilities.readBytes(is);
- } catch(CoreException ex) {
- // NeedWork
- }
- }
- return fContent;
- }
-
- /**
- * Discards the buffered content.
- */
- public void discardBuffer() {
- fContent= null;
- }
-
- /* (non-Javadoc)
- * see IContentChangeNotifier.addChangeListener
- */
- public void addContentChangeListener(IContentChangeListener listener) {
- if (fListenerList == null)
- fListenerList= new ListenerList();
- fListenerList.add(listener);
- }
-
- /* (non-Javadoc)
- * see IContentChangeNotifier.removeChangeListener
- */
- public void removeContentChangeListener(IContentChangeListener listener) {
- if (fListenerList != null) {
- fListenerList.remove(listener);
- if (fListenerList.isEmpty())
- fListenerList= null;
- }
- }
-
- /**
- * Notifies all registered <code>IContentChangeListener</code>s of a content change.
- */
- protected void fireContentChanged() {
- if (fListenerList != null) {
- Object[] listeners= fListenerList.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IContentChangeListener)listeners[i]).contentChanged(this);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
deleted file mode 100644
index 4894d833a..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.HashMap;
-
-import org.eclipse.swt.graphics.*;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-
-/**
- * A <code>CompareConfiguration</code> object
- * controls various UI aspects of compare/merge viewers like
- * title labels and images, or whether a side of a merge viewer is editable.
- * In addition to these fixed properties <code>ICompareConfiguration</code> provides
- * API for an open ended set of properties. Different viewers which share the same
- * configuration can communicate via this mechanism. E.g. if a compare editor
- * has a button for controlling whether compare viewers ignore white space,
- * the button would trigger a change of the boolean <code>IGNORE_WHITESPACE</code> property
- * and all interested viewers would receive notification.
- * <p>
- * Suitable default labels are provided (without images); both the left and right sides
- * are editable.
- * </p>
- * <p>
- * Clients may use this class as is, or subclass to add new state and behavior.
- * </p>
- */
-public class CompareConfiguration {
-
- /**
- * Name of the ignore whitespace property (value <code>"IGNORE_WHITESPACE"</code>).
- */
- public static final String IGNORE_WHITESPACE= "IGNORE_WHITESPACE"; //$NON-NLS-1$
- /**
- * Name of the show pseudo conflicts property (value <code>"SHOW_PSEUDO_CONFLICTS"</code>).
- */
- public static final String SHOW_PSEUDO_CONFLICTS= "SHOW_PSEUDO_CONFLICTS"; //$NON-NLS-1$
- /**
- * Name of the use outline view property (value <code>"USE_OUTLINE_VIEW"</code>).
- * @since 3.0
- */
- public static final String USE_OUTLINE_VIEW= "USE_OUTLINE_VIEW"; //$NON-NLS-1$
-
-
- private static final int WIDTH= 22;
-
- private static ImageDescriptor[] fgImages= new ImageDescriptor[16];
- private static Object fgDummy= new Object();
- private static HashMap fgMap= new HashMap(20);
- private static boolean fLeftIsLocal= true;
-
- static {
- if (fLeftIsLocal) {
- fgImages[Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/del_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/r_inadd_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/r_outadd_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/add_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/r_indel_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/r_outdel_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.LEFT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/r_inchg_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/r_outchg_ov.gif"); //$NON-NLS-1$
- } else {
- fgImages[Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/add_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/inadd_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/outadd_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/del_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/indel_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/outdel_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.LEFT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/inchg_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/outchg_ov.gif"); //$NON-NLS-1$
- }
-
- fgImages[Differencer.CONFLICTING + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/confadd_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.CONFLICTING + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/confdel_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.CONFLICTING + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/confchg_ov.gif"); //$NON-NLS-1$
- }
-
- private IPreferenceStore fPreferenceStore;
- private ListenerList fListeners= new ListenerList();
- private HashMap fProperties= new HashMap();
- private boolean fLeftEditable= true;
- private boolean fRightEditable= true;
- private String fAncestorLabel;
- private String fLeftLabel;
- private String fRightLabel;
- private Image fAncestorImage;
- private Image fRightImage;
- private Image fLeftImage;
- private Image[] fImages= new Image[16];
-
- /**
- * Creates a new configuration with editable left and right sides,
- * suitable default labels, and no images.
- * The given preference store is used to connect this configuration
- * with the Compare preference page properties <code>ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE</code>,
- * and <code>CompareConfiguration.IGNORE_WHITESPACE</code>.
- *
- * @param prefStore the preference store which this configuration holds onto.
- * @since 2.0
- */
- public CompareConfiguration(IPreferenceStore prefStore) {
-
- setProperty("LEFT_IS_LOCAL", new Boolean(fLeftIsLocal)); //$NON-NLS-1$
-
- fPreferenceStore= prefStore;
- if (fPreferenceStore != null) {
- boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE);
- setProperty(ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE, new Boolean(b));
-
- b= fPreferenceStore.getBoolean(ComparePreferencePage.IGNORE_WHITESPACE);
- setProperty(CompareConfiguration.IGNORE_WHITESPACE, new Boolean(b));
- }
- }
-
- /**
- * Creates a new configuration with editable left and right sides,
- * suitable default labels, and no images.
- * This configuration uses the preference store of the Compare plugin
- * (<code>CompareUIPlugin.getDefault().getPreferenceStore()</code>).
- */
- public CompareConfiguration() {
- this(CompareUIPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * Returns the preference store of this configuration.
- * @return the preference store of this configuration.
- * @since 2.0
- */
- public IPreferenceStore getPreferenceStore() {
- return fPreferenceStore;
- }
-
- /**
- * Returns an image showing the specified change kind.
- * The different kind of changes are defined in the <code>Differencer</code>.
- * Newly created images are remembered by this class and
- * disposed when the <code>dispose</code> method is called.
- *
- * @param kind the kind of change as defined in <code>Differencer</code>.
- * @return an modification of the base image reflecting the kind of change.
- * @see org.eclipse.compare.structuremergeviewer.Differencer
- * @since 2.0
- */
- public Image getImage(int kind) {
- Image image= fImages[kind & 15];
- if (image == null) {
- ImageDescriptor id= fgImages[kind & 15];
- if (id != null)
- image= id.createImage();
- fImages[kind & 15]= image;
- }
- return image;
- }
-
- /**
- * Returns an image showing the specified change kind applied to a
- * given base image. The different kind of changes are defined in the <code>Differencer</code>.
- * Typically an implementation would build a composite image
- * from the given base image and an image representing the change kind.
- * Newly created images are remembered by this class and
- * disposed when the <code>dispose</code> method is called.
- *
- * @param base the image which is modified to reflect the kind of change
- * @param kind the kind of change as defined in <code>Differencer</code>.
- * @return an modification of the base image reflecting the kind of change.
- * @see org.eclipse.compare.structuremergeviewer.Differencer
- */
- public Image getImage(Image base, int kind) {
-
- Object key= base;
- if (key == null)
- key= fgDummy;
-
- kind &= 15;
-
- Image[] a= (Image[]) fgMap.get(key);
- if (a == null) {
- a= new Image[16];
- fgMap.put(key, a);
- }
- Image b= a[kind];
- if (b == null) {
- b= new DiffImage(base, fgImages[kind], WIDTH, !fLeftIsLocal).createImage();
- CompareUI.disposeOnShutdown(b);
- a[kind]= b;
- }
- return b;
- }
-
- /**
- * Dispose of this compare configuration.
- * This method is called if the compare configuration is no longer used.
- * An implementation must dispose of all resources.
- */
- public void dispose() {
- if (fImages != null) {
- for (int i= 0; i < fImages.length; i++){
- Image image= fImages[i];
- if (image != null && !image.isDisposed())
- image.dispose();
- }
- }
- fImages= null;
- }
-
- /**
- * Fires a <code>PropertyChangeEvent</code> to registered listeners.
- *
- * @param propertyName the name of the property that has changed
- * @param oldValue the property's old value
- * @param newValue the property's new value
- */
- private void fireChange(String propertyName, Object oldValue, Object newValue) {
- PropertyChangeEvent event= null;
- Object[] listeners= fListeners.getListeners();
- if (listeners != null) {
- for (int i= 0; i < listeners.length; i++) {
- IPropertyChangeListener l= (IPropertyChangeListener) listeners[i];
- if (event == null)
- event= new PropertyChangeEvent(this, propertyName, oldValue, newValue);
- l.propertyChange(event);
- }
- }
- }
-
- /* (non javadoc)
- * see IPropertyChangeNotifier.addListener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.add(listener);
- }
-
- /* (non javadoc)
- * see IPropertyChangeNotifier.removeListener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Sets the property with the given name.
- * If the new value differs from the old a <code>PropertyChangeEvent</code>
- * is sent to registered listeners.
- *
- * @param propertyName the name of the property to set
- * @param value the new value of the property
- */
- public void setProperty(String key, Object newValue) {
- Object oldValue= fProperties.get(key);
- fProperties.put(key, newValue);
- if (oldValue == null || !oldValue.equals(newValue))
- fireChange(key, oldValue, newValue);
- }
-
- /**
- * Returns the property with the given name, or <code>null</code>
- * if no such property exists.
- *
- * @param propertyName the name of the property to retrieve
- * @return the property with the given name, or <code>null</code> if not found
- */
- public Object getProperty(String key) {
- return fProperties.get(key);
- }
-
- //---- ancestor
-
- /**
- * Sets the label to use for the ancestor of compare/merge viewers.
- *
- * @param label the new label for the ancestor of compare/merge viewers
- */
- public void setAncestorLabel(String label) {
- fAncestorLabel= label;
- }
-
- /**
- * Returns the label for the ancestor side of compare/merge viewers.
- * This label is typically shown in the title of the ancestor area in a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the label for the ancestor side or <code>null</code>
- */
- public String getAncestorLabel(Object element) {
- return fAncestorLabel;
- }
-
- /**
- * Sets the image to use for the ancestor of compare/merge viewers.
- * The CompareConfiguration does not automatically dispose the old image.
- *
- * @param image the new image for the ancestor of compare/merge viewers
- */
- public void setAncestorImage(Image image) {
- fAncestorImage= image;
- }
-
- /**
- * Returns the image for the ancestor side of compare/merge viewers.
- * This image is typically shown in the title of the ancestor area in a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the image for the ancestor side or <code>null</code>
- */
- public Image getAncestorImage(Object element) {
- return fAncestorImage;
- }
-
- //---- left side
-
- /**
- * Controls whether the left side of a merge viewer is editable.
- *
- * @param editable if the value is <code>true</code> left side is editable
- */
- public void setLeftEditable(boolean editable) {
- fLeftEditable= editable;
- }
-
- /**
- * Returns whether the left hand side of a merge viewer is editable.
- *
- * @return <code>true</code> if the left hand side is editable
- */
- public boolean isLeftEditable() {
- return fLeftEditable;
- }
-
- /**
- * Sets the label to use for the left side of compare/merge viewers.
- *
- * @param label the new label for the left side of compare/merge viewers
- */
- public void setLeftLabel(String label) {
- fLeftLabel= label;
- }
-
- /**
- * Returns the label for the left hand side of compare/merge viewers.
- * This label is typically shown in the title of the left side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the label for the left hand side or <code>null</code>
- */
- public String getLeftLabel(Object element) {
- return fLeftLabel;
- }
-
- /**
- * Sets the image to use for the left side of compare/merge viewers.
- * The compare configuration does not automatically dispose the old image.
- *
- * @param image the new image for the left side of compare/merge viewers
- */
- public void setLeftImage(Image image) {
- fLeftImage= image;
- }
-
- /**
- * Returns the image for the left hand side of compare/merge viewers.
- * This image is typically shown in the title of the left side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the image for the left hand side or <code>null</code>
- */
- public Image getLeftImage(Object element) {
- return fLeftImage;
- }
-
- //---- right side
-
- /**
- * Controls whether the right side of a merge viewer is editable.
- *
- * @param editable if the value is <code>true</code> right side is editable
- */
- public void setRightEditable(boolean editable) {
- fRightEditable= editable;
- }
-
- /**
- * Returns whether the right hand side of a merge viewer is editable.
- *
- * @return <code>true</code> if the right hand side is editable
- */
- public boolean isRightEditable() {
- return fRightEditable;
- }
-
- /**
- * Sets the label to use for the right side of compare/merge viewers.
- *
- * @param label the new label for the right side of compare/merge viewers
- */
- public void setRightLabel(String label) {
- fRightLabel= label;
- }
-
- /**
- * Returns the label for the right hand side of compare/merge viewers.
- * This label is typically shown in the title of the right side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the label for the right hand side or <code>null</code>
- */
- public String getRightLabel(Object element) {
- return fRightLabel;
- }
-
- /**
- * Sets the image to use for the right side of compare/merge viewers.
- * The compare configuration does not automatically dispose the old image.
- *
- * @param image the new image for the right side of compare/merge viewers
- */
- public void setRightImage(Image image) {
- fRightImage= image;
- }
-
- /**
- * Returns the image for the right hand side of compare/merge viewers.
- * This image is typically shown in the title of the right side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the image for the right hand side or <code>null</code>
- */
- public Image getRightImage(Object element) {
- return fRightImage;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
deleted file mode 100644
index 180fbb89e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ /dev/null
@@ -1,791 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.lang.reflect.InvocationTargetException;
-
-import java.util.ArrayList;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.custom.BusyIndicator;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IEditorInput;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * A compare operation which can present its results in a special editor.
- * Running the compare operation and presentating the results in a compare editor
- * are combined in one class because it allows a client to keep the implementation
- * all in one place while separating it from the innards of a specific UI implementation of compare/merge.
- * <p>
- * A <code>CompareEditorInput</code> defines methods for the following sequence steps:
- * <UL>
- * <LI>running a lengthy compare operation under progress monitor control,
- * <LI>creating a UI for displaying the model and initializing the some widgets with the compare result,
- * <LI>tracking the dirty state of the model in case of merge,
- * <LI>saving the model.
- * </UL>
- * The Compare plug-in's <code>openCompareEditor</code> method takes an <code>ICompareEditorInput</code>
- * and starts sequencing through the above steps. If the compare result is not empty a new compare editor
- * is opened and takes over the sequence until eventually closed.
- * <p>
- * The <code>prepareInput</code> method should contain the
- * code of the compare operation. It is executed under control of a progress monitor
- * and can be canceled. If the result of the compare is not empty, that is if there are differences
- * that needs to be presented, the <code>ICompareEditorInput</code> should hold onto them and return them with
- * the <code>getCompareResult</code> method.
- * If the value returned from <code>getCompareResult</code> is not <code>null</code>
- * a compare editor is opened on the <code>ICompareEditorInput</code> with title and title image initialized by the
- * corresponding methods of the <code>ICompareEditorInput</code>.
- * <p>
- * Creation of the editor's SWT controls is delegated to the <code>createContents</code> method.
- * Here the SWT controls must be created and initialized with the result of the compare operation.
- * <p>
- * If merging is allowed, the modification state of the compared constituents must be tracked and the dirty
- * state returned from method <code>isSaveNeeded</code>. The value <code>true</code> triggers a subsequent call
- * to <code>save</code> where the modified resources can be saved.
- * <p>
- * The most important part of this implementation is the setup of the compare/merge UI.
- * The UI uses a simple browser metaphor to present compare results.
- * The top half of the layout shows the structural compare results (e.g. added, deleted, and changed files),
- * the bottom half the content compare results (e.g. textual differences between two files).
- * A selection in the top pane is fed to the bottom pane. If a content viewer is registered
- * for the type of the selected object, this viewer is installed in the pane.
- * In addition if a structure viewer is registered for the selection type the top pane
- * is split horizontally to make room for another pane and the structure viewer is installed
- * in it. When comparing Java files this second structure viewer would show the structural
- * differences within a Java file, e.g. added, deleted or changed methods and fields.
- * <p>
- * Subclasses provide custom setups, e.g. for a Catchup/Release operation
- * by passing a subclass of <code>CompareConfiguration</code> and by implementing the <code>prepareInput</code> method.
- * If a subclass cannot use the <code>DiffTreeViewer</code> which is installed by default in the
- * top left pane, method <code>createDiffViewer</code> can be overridden.
- *
- * @see CompareUI
- * @see CompareEditorInput
- */
-public abstract class CompareEditorInput implements IEditorInput, IPropertyChangeNotifier, IRunnableWithProgress {
-
- private static final boolean DEBUG= false;
-
- /**
- * The name of the "dirty" property (value <code>"DIRTY_STATE"</code>).
- */
- public static final String DIRTY_STATE= "DIRTY_STATE"; //$NON-NLS-1$
-
- private static final String COMPARE_EDITOR_IMAGE_NAME= "cview16/compare_view.gif"; //$NON-NLS-1$
- private static Image fgTitleImage;
-
- private Splitter fComposite;
- private CompareConfiguration fCompareConfiguration;
- private CompareViewerSwitchingPane fStructureInputPane;
- private CompareViewerSwitchingPane fStructurePane1;
- private CompareViewerSwitchingPane fStructurePane2;
- private CompareViewerSwitchingPane fContentInputPane;
- private CompareViewerSwitchingPane fFocusPane;
- private String fMessage;
- private Object fInput;
- private String fTitle;
- private ListenerList fListenerList= new ListenerList();
- private CompareNavigator fNavigator;
- private boolean fDirty= false;
- private ArrayList fDirtyViewers= new ArrayList();
- private IPropertyChangeListener fDirtyStateListener;
-
- private IgnoreWhiteSpaceAction fIgnoreWhitespace;
- private ShowPseudoConflicts fShowPseudoConflicts;
-
- boolean fStructureCompareOnSingleClick= true;
- boolean fUseOutlineView= false;
-
- /**
- * Creates a <code>CompareEditorInput</code> which is initialized with the given
- * compare configuration.
- * The compare configuration is passed to subsequently created viewers.
- *
- * @param configuration the compare configuration
- */
- public CompareEditorInput(CompareConfiguration configuration) {
- fCompareConfiguration= configuration;
- Assert.isNotNull(configuration);
-
- Object object= fCompareConfiguration.getProperty(CompareConfiguration.USE_OUTLINE_VIEW);
- if (object instanceof Boolean)
- fUseOutlineView= ((Boolean) object).booleanValue();
-
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
- fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, configuration);
- fShowPseudoConflicts= new ShowPseudoConflicts(bundle, configuration);
-
- fDirtyStateListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent e) {
- String propertyName= e.getProperty();
- if (CompareEditorInput.DIRTY_STATE.equals(propertyName)) {
- boolean changed= false;
- Object newValue= e.getNewValue();
- if (newValue instanceof Boolean)
- changed= ((Boolean)newValue).booleanValue();
- setDirty(e.getSource(), changed);
- }
- }
- };
-
- IPreferenceStore ps= configuration.getPreferenceStore();
- if (ps != null)
- fStructureCompareOnSingleClick= ps.getBoolean(ComparePreferencePage.OPEN_STRUCTURE_COMPARE);
- }
-
- private boolean structureCompareOnSingleClick() {
- return fStructureCompareOnSingleClick;
- }
-
- /* (non Javadoc)
- * see IAdaptable.getAdapter
- */
- public Object getAdapter(Class adapter) {
- if (ICompareNavigator.class.equals(adapter) || CompareNavigator.class.equals(adapter)) {
- if (fNavigator == null)
- fNavigator= new CompareNavigator(
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
- return fNavigator;
- }
- return null;
- }
-
- /* (non Javadoc)
- * see IEditorInput.getImageDescriptor
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /* (non Javadoc)
- * see IEditorInput.getToolTipText
- */
- public String getToolTipText() {
- return getTitle();
- }
-
- /* (non Javadoc)
- * see IEditorInput.getName
- */
- public String getName() {
- return getTitle();
- }
-
- /**
- * Returns <code>null</code> since this editor cannot be persisted.
- *
- * @return <code>null</code> because this editor cannot be persisted
- */
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /**
- * Returns <code>false</code> to indicate that this input
- * should not appear in the "File Most Recently Used" menu.
- *
- * @return <code>false</code>
- */
- public boolean exists() {
- return false;
- }
-
- /*
- * FIXME!
- */
- protected void setMessage(String message) {
- fMessage= message;
- }
-
- /*
- * FIXME!
- */
- public String getMessage() {
- return fMessage;
- }
-
- /**
- * Returns the title which will be used in the compare editor's title bar.
- * It can be set with <code>setTitle</code>.
- *
- * @return the title
- */
- public String getTitle() {
- if (fTitle == null)
- return Utilities.getString("CompareEditorInput.defaultTitle"); //$NON-NLS-1$
- return fTitle;
- }
-
- /**
- * Sets the title which will be used when presenting the compare result.
- * This method must be called before the editor is opened.
- *
- * @param title the title to use for the CompareEditor
- */
- public void setTitle(String title) {
- fTitle= title;
- }
-
- /**
- * Returns the title image which will be used in the compare editor's title bar.
- * Returns the title image which will be used when presenting the compare result.
- * This implementation returns a generic compare icon.
- * Subclasses can override.
- *
- * @return the title image, or <code>null</code> if none
- */
- public Image getTitleImage() {
- if (fgTitleImage == null) {
- fgTitleImage= CompareUIPlugin.getImageDescriptor(COMPARE_EDITOR_IMAGE_NAME).createImage();
- CompareUI.disposeOnShutdown(fgTitleImage);
- }
- return fgTitleImage;
- }
-
- /**
- * Returns the configuration object for the viewers within the compare editor.
- * Returns the configuration which was passed to the constructor.
- *
- * @return the compare configuration
- */
- public CompareConfiguration getCompareConfiguration() {
- return fCompareConfiguration;
- }
-
- /**
- * Adds standard actions to the given <code>ToolBarManager</code>.
- * <p>
- * Subclasses may override to add their own actions.
- * </p>
- *
- * @param toolBarManager the <code>ToolBarManager</code> to which to contribute
- */
- public void contributeToToolBar(ToolBarManager toolBarManager) {
-
- toolBarManager.add(new Separator());
- toolBarManager.add(fIgnoreWhitespace);
- toolBarManager.add(fShowPseudoConflicts);
- }
-
- /**
- * Runs the compare operation and stores the compare result.
- *
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @exception InvocationTargetException if the <code>prepareInput</code> method must propagate a checked exception,
- * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
- * wrapped in an <code>InvocationTargetException</code> by the calling context
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- */
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- fInput= prepareInput(monitor);
- }
-
- /**
- * Runs the compare operation and returns the compare result.
- * If <code>null</code> is returned no differences were found and no compare editor needs to be opened.
- * Progress should be reported to the given progress monitor.
- * A request to cancel the operation should be honored and acknowledged
- * by throwing <code>InterruptedException</code>.
- * <p>
- * Note: this method is typically called in a modal context thread which doesn't have a Display assigned.
- * Implementors of this method shouldn't therefore allocated any SWT resources in this method.
- * </p>
- *
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @return the result of the compare operation, or <code>null</code> if there are no differences
- * @exception InvocationTargetException if the <code>prepareInput</code> method must propagate a checked exception,
- * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
- * wrapped in an <code>InvocationTargetException</code> by the calling context
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- */
- protected abstract Object prepareInput(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException;
-
- /**
- * Returns the compare result computed by the most recent call to the
- * <code>run</code> method. Returns <code>null</code> if no
- * differences were found.
- *
- * @return the compare result prepared in method <code>prepareInput</code>
- * or <code>null</code> if there were no differences
- */
- public Object getCompareResult() {
- return fInput;
- }
-
- /**
- * Create the SWT controls that are used to display the result of the compare operation.
- * Creates the SWT Controls and sets up the wiring between the individual panes.
- * This implementation creates all four panes but makes only the necessary ones visible.
- * Finally it feeds the compare result into the top left structure viewer
- * and the content viewer.
- * <p>
- * Subclasses may override if they need to change the layout or wiring between panes.
- *
- * @param parent the parent control under which the control must be created
- * @return the SWT control hierarchy for the compare editor
- */
- public Control createContents(Composite parent) {
-
- fComposite= new Splitter(parent, SWT.VERTICAL);
- fComposite.setData(this);
-
- Control outline= null;
- if (!fUseOutlineView)
- outline= createOutlineContents(fComposite, SWT.HORIZONTAL);
-
- fContentInputPane= new CompareViewerSwitchingPane(fComposite, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findContentViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- if (fFocusPane == null)
- fFocusPane= fContentInputPane;
- if (outline != null)
- fComposite.setVisible(outline, false);
- fComposite.setVisible(fContentInputPane, true);
-
- if (fStructureInputPane != null)
- fComposite.setWeights(new int[] { 30, 70 });
-
- fComposite.layout();
-
- if (fStructureInputPane != null && fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
-
- fComposite.setData("Nav", //$NON-NLS-1$
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
-
- return fComposite;
- }
-
- /**
- * @param parent the parent control under which the control must be created
- * @return the SWT control hierarchy for the outline part of the compare editor
- * @since 3.0
- */
- public Control createOutlineContents(Composite parent, int direction) {
- final Splitter h= new Splitter(parent, direction);
-
- fStructureInputPane= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof DiffNode) {
- DiffNode dn= (DiffNode) input;
- if (dn.hasChildren())
- return createDiffViewer(this);
- }
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- fFocusPane= fStructureInputPane;
-
- fStructurePane1= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- h.setVisible(fStructurePane1, false);
-
- fStructurePane2= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- h.setVisible(fStructurePane2, false);
-
- // setup the wiring for top left pane
- fStructureInputPane.addOpenListener(
- new IOpenListener() {
- public void open(OpenEvent oe) {
- feed1(oe.getSelection());
- }
- }
- );
- fStructureInputPane.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- ISelection s= e.getSelection();
- if (s == null || s.isEmpty())
- feed1(s);
- }
- }
- );
- fStructureInputPane.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- feedDefault1(event.getSelection());
- }
- }
- );
-
- fStructurePane1.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feed2(e.getSelection());
- }
- }
- );
-
- fStructurePane2.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feed3(e.getSelection());
- }
- }
- );
-
- if (fUseOutlineView) {
- if (fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
-
- fComposite.setData("Nav", //$NON-NLS-1$
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
- }
-
- return h;
- }
-
- private void feed1(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (selection == null || selection.isEmpty()) {
- Object input= fStructureInputPane.getInput();
- fContentInputPane.setInput(input);
- fStructurePane2.setInput(null); // clear downstream pane
- fStructurePane1.setInput(null);
- } else {
- Object input= getElement(selection);
- fContentInputPane.setInput(input);
- if (structureCompareOnSingleClick())
- fStructurePane1.setInput(input);
- fStructurePane2.setInput(null); // clear downstream pane
- if (fStructurePane1.getInput() != input)
- fStructurePane1.setInput(null);
- }
- }
- }
- );
- }
-
- private void feedDefault1(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (!selection.isEmpty())
- fStructurePane1.setInput(getElement(selection));
- }
- }
- );
- }
-
- private void feed2(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (selection.isEmpty()) {
- Object input= fStructurePane1.getInput();
- fContentInputPane.setInput(input);
- fStructurePane2.setInput(null);
- } else {
- Object input= getElement(selection);
- fContentInputPane.setInput(input);
- fStructurePane2.setInput(input);
- }
- }
- }
- );
- }
-
- private void feed3(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (selection.isEmpty())
- fContentInputPane.setInput(fStructurePane2.getInput());
- else
- fContentInputPane.setInput(getElement(selection));
- }
- }
- );
-
- }
-
- /**
- * Returns the first element of the given selection if the selection
- * is a <code>IStructuredSelection</code> with exactly one element. Returns
- * <code>null</code> otherwise.
- *
- * @param selection the selection
- * @return the first element of the selection, or <code>null</code>
- */
- private static Object getElement(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) selection;
- if (ss.size() == 1)
- return ss.getFirstElement();
- }
- return null;
- }
-
- /**
- * Asks this input to take focus within its container (editor).
- * <p>
- * Clients should not call this method but they may
- * override if they implement a different layout with different visual
- * components. Clients are free to call the inherited method.
- * </p>
- */
- public void setFocus() {
- if (fFocusPane != null) {
- Viewer v= fFocusPane.getViewer();
- if (v != null) {
- Control c= v.getControl();
- if (c != null)
- c.setFocus();
- }
- } else if (fComposite != null)
- fComposite.setFocus();
- }
-
- /**
- * Factory method for creating a differences viewer for the top left pane.
- * It is called from <code>createContents</code> and returns a <code>DiffTreeViewer</code>.
- * <p>
- * Subclasses may override if they need a different viewer.
- * </p>
- *
- * @param parent the SWT parent control under which to create the viewer's SWT controls
- * @return a compare viewer for the top left pane
- */
- public Viewer createDiffViewer(Composite parent) {
- return new DiffTreeViewer(parent, fCompareConfiguration);
- }
-
- /**
- * Implements the dynamic viewer switching for structure viewers.
- * The method must return a compare viewer based on the old (or current) viewer
- * and a new input object. If the old viewer is suitable for showing the new input the old viewer
- * can be returned. Otherwise a new viewer must be created under the given parent composite or
- * <code>null</code> can be returned to indicate that no viewer could be found.
- * <p>
- * This implementation forwards the request to <code>CompareUI.findStructureViewer</code>.
- * <p>
- * Subclasses may override to implement a different strategy.
- * </p>
- *
- * @return a compare viewer which is suitable for the given input object or <code>null</code>
- */
- public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, fCompareConfiguration);
- }
-
- /**
- * Implements the dynamic viewer switching for content viewers.
- * The method must return a compare viewer based on the old (or current) viewer
- * and a new input object. If the old viewer is suitable for showing the new input the old viewer
- * can be returned. Otherwise a new viewer must be created under the given parent composite or
- * <code>null</code> can be returned to indicate that no viewer could be found.
- * <p>
- * This implementation forwards the request to <code>CompareUI.findContentViewer</code>.
- * <p>
- * Subclasses may override to implement a different strategy.
- * </p>
- *
- * @return a compare viewer which is suitable for the given input object or <code>null</code>
- */
- public Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
-
- Viewer newViewer= CompareUIPlugin.findContentViewer(oldViewer, input, parent, fCompareConfiguration);
-
- boolean isNewViewer= newViewer != oldViewer;
- if (DEBUG) System.out.println("CompareEditorInput.findContentViewer: " + isNewViewer); //$NON-NLS-1$
-
- if (isNewViewer && newViewer instanceof IPropertyChangeNotifier) {
- final IPropertyChangeNotifier dsp= (IPropertyChangeNotifier) newViewer;
- dsp.addPropertyChangeListener(fDirtyStateListener);
-
- Control c= newViewer.getControl();
- c.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- dsp.removePropertyChangeListener(fDirtyStateListener);
- }
- }
- );
- }
-
- return newViewer;
- }
-
- /**
- * Returns <code>true</code> if there are unsaved changes.
- * The value returned is the value of the <code>DIRTY_STATE</code> property of this input object.
-
- * Returns <code>true</code> if this input has unsaved changes,
- * that is if <code>setDirty(true)</code> has been called.
- * Subclasses don't have to override if the functionality provided by <doce>setDirty</code>
- * is sufficient.
- *
- * @return <code>true</code> if there are changes that need to be saved
- */
- public boolean isSaveNeeded() {
- return fDirty || fDirtyViewers.size() > 0;
- }
-
- /**
- * Sets the dirty state of this input to the given
- * value and sends out a <code>PropertyChangeEvent</code> if the new value differs from the old value.
- *
- * @param dirty the dirty state for this compare input
- */
- public void setDirty(boolean dirty) {
-
- boolean confirmSave= true;
- Object o= fCompareConfiguration.getProperty(CompareEditor.CONFIRM_SAVE_PROPERTY);
- if (o instanceof Boolean)
- confirmSave= ((Boolean)o).booleanValue();
-
- if (!confirmSave) {
- fDirty= dirty;
- if (!fDirty)
- fDirtyViewers.clear();
- }
- }
-
- private void setDirty(Object source, boolean dirty) {
- Assert.isNotNull(source);
- boolean oldDirty= fDirtyViewers.size() > 0;
- if (dirty)
- fDirtyViewers.add(source);
- else
- fDirtyViewers.remove(source);
- boolean newDirty= fDirtyViewers.size() > 0;
- if (DEBUG) System.out.println("setDirty("+source+", "+dirty+"): " + newDirty); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if (oldDirty != newDirty)
- Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE, new Boolean(oldDirty), new Boolean(newDirty));
- }
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.addListener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (listener != null)
- fListenerList.add(listener);
- }
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.removeListener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (listener != null)
- fListenerList.remove(listener);
- }
-
- /**
- * Save any unsaved changes.
- * Empty implementation.
- * Subclasses must override to save any changes.
- *
- * @param progressMonitor an <code>IProgressMonitor</code> that the implementation of save may use to show progress
- * @deprecated Override method saveChanges instead.
- */
- public void save(IProgressMonitor pm) {
- }
-
- /**
- * Save any unsaved changes.
- * Subclasses must override to save any changes.
- * This implementation tries to flush changes in all viewers by
- * calling <code>ISavable.save</code> on them.
- *
- * @param progressMonitor an <code>IProgressMonitor</code> that the implementation of save may use to show progress
- * @since 2.0
- */
- public void saveChanges(IProgressMonitor pm) throws CoreException {
-
- // flush changes in any dirty viewer
- flushViewer(fStructureInputPane, pm);
- flushViewer(fStructurePane1, pm);
- flushViewer(fStructurePane2, pm);
- flushViewer(fContentInputPane, pm);
-
- save(pm);
- }
-
- private static void flushViewer(CompareViewerSwitchingPane pane, IProgressMonitor pm) throws CoreException {
- if (pane != null) {
- Viewer v= pane.getViewer();
- if (v instanceof ISavable)
- ((ISavable)v).save(pm);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
deleted file mode 100644
index fab93628a..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-
-/**
- * The class <code>CompareUI</code> defines the entry point to initiate a configurable
- * compare operation on arbitrary resources. The result of the compare
- * is opened into a compare editor where the details can be browsed and
- * edited in dynamically selected structure and content viewers.
- * <p>
- * The Compare UI provides a registry for content and structure compare viewers,
- * which is initialized from extensions contributed to extension points
- * declared by this plug-in.
- */
-public final class CompareUI {
-
- /**
- * Compare Plug-in ID (value <code>"org.eclipse.compare"</code>).
- * @since 2.0
- */
- public static final String PLUGIN_ID= "org.eclipse.compare"; //$NON-NLS-1$
-
- /**
- * Image descriptor for the disabled icon of the 'Next' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_DTOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.DTOOL_NEXT);
- /**
- * Image descriptor for the normal icon of the 'Next' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_CTOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.CTOOL_NEXT);
- /**
- * Image descriptor for the roll-over icon of the 'Next' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_ETOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.ETOOL_NEXT);
-
- /**
- * Image descriptor for the disabled icon of the 'Previous' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_DTOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.DTOOL_PREV);
- /**
- * Image descriptor for the normal icon of the 'Previous' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_CTOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.CTOOL_PREV);
- /**
- * Image descriptor for the roll-over icon of the 'Previous' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_ETOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.ETOOL_PREV);
-
- /**
- * Name of the title property of a compare viewer.
- * If a property with this name is set
- * on the top level SWT control of a viewer, it is used as a title in the pane's
- * title bar.
- */
- public static final String COMPARE_VIEWER_TITLE= "org.eclipse.compare.CompareUI.CompareViewerTitle"; //$NON-NLS-1$
-
- private CompareUI() {
- }
-
- public static AbstractUIPlugin getPlugin() {
- return CompareUIPlugin.getDefault();
- }
-
- /**
- * Returns this plug-in's resource bundle.
- *
- * @return the plugin's resource bundle
- */
- public static ResourceBundle getResourceBundle() {
- return CompareUIPlugin.getResourceBundle();
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare editor on the result in the currently active workbench page.
- *
- * @param input the input on which to open the compare editor
- */
- public static void openCompareEditor(CompareEditorInput input) {
- openCompareEditorOnPage(input, null);
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare editor on the result in the given workbench page.
- *
- * @param input the input on which to open the compare editor
- * @param page the workbench page in which to open the compare editor
- * @since 2.1
- */
- public static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page) {
- CompareUIPlugin plugin= CompareUIPlugin.getDefault();
- if (plugin != null)
- plugin.openCompareEditor(input, page, null);
- }
-
- /**
- * Performs the comparison described by the given input and
- * shows the result in the given editor.
- *
- * @param input the input on which to open the compare editor
- * @param editor the compare editor to reuse or null to create a new one
- * @since 3.0
- */
- public static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor) {
- CompareUIPlugin plugin= CompareUIPlugin.getDefault();
- if (plugin != null)
- plugin.openCompareEditor(input, null, editor);
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * modal compare dialog on the result.
- *
- * @param input the input on which to open the compare dialog
- */
- public static void openCompareDialog(CompareEditorInput input) {
- CompareUIPlugin plugin= CompareUIPlugin.getDefault();
- if (plugin != null)
- plugin.openCompareDialog(input);
- }
-
- /**
- * Registers an image descriptor for the given type.
- *
- * @param type the type
- * @param descriptor the image descriptor
- */
- public static void registerImageDescriptor(String type, ImageDescriptor descriptor) {
- CompareUIPlugin.registerImageDescriptor(type, descriptor);
- }
-
- /**
- * Returns a shared image for the given type, or a generic image if none
- * has been registered for the given type.
- * <p>
- * Note: Images returned from this method will be automatically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param type the type
- * @return the image
- */
- public static Image getImage(String type) {
- return CompareUIPlugin.getImage(type);
- }
-
- /**
- * 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) {
- CompareUIPlugin.disposeOnShutdown(image);
- }
-
- /**
- * Returns a shared image for the given adaptable.
- * This convenience method queries the given adaptable
- * for its <code>IWorkbenchAdapter.getImageDescriptor</code>, which it
- * uses to create an image if it does not already have one.
- * <p>
- * Note: Images returned from this method will be automatically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param adaptable the adaptable for which to find an image
- * @return an image
- */
- public static Image getImage(IAdaptable adaptable) {
- return CompareUIPlugin.getImage(adaptable);
- }
-
- /**
- * Returns a structure compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input, the old viewer
- * is returned. Otherwise, the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a structure compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a structure viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
- CompareConfiguration configuration) {
-
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, configuration);
- }
-
- /**
- * Returns a content compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input the old viewer
- * is returned. Otherwise the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a content compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a content viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent,
- CompareConfiguration configuration) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
- }
-
- /**
- * Returns a content compare viewer based on an old viewer and an input
- * object. If the old viewer is suitable for showing the input the old
- * viewer is returned. Otherwise the input's type is used to find a viewer
- * descriptor in the registry which in turn is used to create a content
- * compare viewer under the given parent composite. In order to determine
- * the input's type, the input must either implement IStreamContentAccessor
- * and ITypedElement or ICompareInput. If no viewer descriptor can be found
- * <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a content viewer. Must
- * implement either <code>IStreamContentAccessor</code> and<code>
- * ITypedElement</code> or <code>ICompareInput</code>.
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent,
- CompareConfiguration configuration) {
-
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
- }
-
- /**
- * Adds an alias for the given type.
- * Subsequent calls to <code>findStructureViewer</code>
- * treat alias as a synonym for type and return the same viewer.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- * @param type a type name for which a viewer has been registered
- * @param alias a type name which should be treated as a synonym of type
- * @since 2.0
- */
- public static void addStructureViewerAlias(String type, String alias) {
- CompareUIPlugin.addStructureViewerAlias(type, alias);
- }
-
- /**
- * Remove all aliases for the given type. This method does not affect
- * the initial binding between type and viewer. If no aliases exist for the
- * given type this method does nothing.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- * @param type the type name for which all synonymes are removed.
- * @since 2.0
- */
- public static void removeAllStructureViewerAliases(String type) {
- CompareUIPlugin.removeAllStructureViewerAliases(type);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
deleted file mode 100644
index 43033a295..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.action.ToolBarManager;
-
-/**
- * A <code>CompareViewerPane</code> is a convenience class which installs a
- * <code>CLabel</code> and a <code>Toolbar</code> in a <code>ViewForm</code>.
- * <P>
- * Double clicking onto the <code>CompareViewerPane</code>'s title bar maximizes
- * the <code>CompareViewerPane</code> to the size of an enclosing <code>Splitter</code>
- * (if there is one).
- * If more <code>Splitters</code> are nested maximizing walks up and
- * maximizes to the outermost <code>Splitter</code>.
- *
- * @since 2.0
- */
-public class CompareViewerPane extends ViewForm {
-
- private ToolBarManager fToolBarManager;
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public CompareViewerPane(Composite container, int style) {
- super(container, style);
-
- marginWidth= 0;
- marginHeight= 0;
-
- CLabel label= new CLabel(this, SWT.NONE) {
- public Point computeSize(int wHint, int hHint, boolean changed) {
- return super.computeSize(wHint, Math.max(24, hHint), changed);
- }
- };
- setTopLeft(label);
-
- MouseAdapter ml= new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- Control content= getContent();
- if (content != null && content.getBounds().contains(e.x, e.y))
- return;
- Control parent= getParent();
- if (parent instanceof Splitter)
- ((Splitter)parent).setMaximizedControl(CompareViewerPane.this);
- }
- };
-
- addMouseListener(ml);
- label.addMouseListener(ml);
- }
-
- /**
- * Set the pane's title text.
- * The value <code>null</code> clears it.
- *
- * @param text the text to be displayed in the pane or null
- */
- public void setText(String label) {
- CLabel cl= (CLabel) getTopLeft();
- cl.setText(label);
- }
-
- /**
- * Set the pane's title Image.
- * The value <code>null</code> clears it.
- *
- * @param image the image to be displayed in the pane or null
- */
- public void setImage(Image image) {
- CLabel cl= (CLabel) getTopLeft();
- cl.setImage(image);
- }
-
- /**
- * Returns a <code>ToolBarManager</code> if the given parent is a
- * <code>CompareViewerPane</code> or <code>null</code> otherwise.
- *
- * @param parent a <code>Composite</code> or <code>null</code>
- * @return a <code>ToolBarManager</code> if the given parent is a <code>CompareViewerPane</code> otherwise <code>null</code>
- */
- public static ToolBarManager getToolBarManager(Composite parent) {
- if (parent instanceof CompareViewerPane) {
- CompareViewerPane pane= (CompareViewerPane) parent;
- return pane.getToolBarManager();
- }
- return null;
- }
-
- /**
- * Clears tool items in the <code>CompareViewerPane</code>'s control bar.
- *
- * @param parent a <code>Composite</code> or <code>null</code>
- */
- public static void clearToolBar(Composite parent) {
- ToolBarManager tbm= getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
- tbm.update(true);
- }
- }
-
- //---- private stuff
-
- private ToolBarManager getToolBarManager() {
- if (fToolBarManager == null) {
- ToolBar tb= new ToolBar(this, SWT.FLAT);
- setTopCenter(tb);
- fToolBarManager= new ToolBarManager(tb);
- }
- return fToolBarManager;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
deleted file mode 100644
index 0011f2eba..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.text.MessageFormat;
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-
-/**
- * A custom <code>CompareViewerPane</code> that supports dynamic viewer switching.
- *
- * <p>
- * Clients must implement the viewer switching strategy by implementing
- * the <code>getViewer(Viewer, Object)</code> method.
- * <p>
- * If a property with the name <code>CompareUI.COMPARE_VIEWER_TITLE</code> is set
- * on the top level SWT control of a viewer, it is used as a title in the <code>CompareViewerPane</code>'s
- * title bar.
- *
- * @since 2.0
- */
-public abstract class CompareViewerSwitchingPane extends CompareViewerPane
- implements ISelectionChangedListener, ISelectionProvider, IDoubleClickListener {
-
- private Viewer fViewer;
- private Object fInput;
- private ListenerList fSelectionListeners= new ListenerList();
- private ListenerList fDoubleClickListener= new ListenerList();
- private ListenerList fOpenListener= new ListenerList();
- private boolean fControlVisibility= false;
- private String fTitle;
- private String fTitleArgument;
-
- private IOpenListener fOpenHandler= new IOpenListener() {
- public void open(OpenEvent event) {
- Object[] listeners= fOpenListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IOpenListener) listeners[i]).open(event);
- }
- };
-
- /**
- * Creates a <code>CompareViewerSwitchingPane</code> as a child of the given parent and with the
- * specified SWT style bits.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public CompareViewerSwitchingPane(Composite parent, int style) {
- this(parent, style, false);
- }
-
- /**
- * Creates a <code>CompareViewerSwitchingPane</code> as a child of the given parent and with the
- * specified SWT style bits.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- * @param visibility the initial visibility of the CompareViewerSwitchingPane
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public CompareViewerSwitchingPane(Composite parent, int style, boolean visibility) {
- super(parent, style);
-
- fControlVisibility= visibility;
-
- setViewer(new NullViewer(this));
-
- addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).removeSelectionChangedListener(CompareViewerSwitchingPane.this);
- if (fViewer instanceof StructuredViewer) {
- StructuredViewer sv= (StructuredViewer) fViewer;
- sv.removeDoubleClickListener(CompareViewerSwitchingPane.this);
- sv.removeOpenListener(fOpenHandler);
- }
- fViewer= null;
- fInput= null;
- fSelectionListeners= null;
- }
- }
- );
- }
-
- /**
- * Returns the current viewer.
- *
- * @return the current viewer
- */
- public Viewer getViewer() {
- return fViewer;
- }
-
- private void setViewer(Viewer newViewer) {
-
- if (newViewer == fViewer)
- return;
-
- boolean oldEmpty= isEmpty();
-
- if (fViewer != null) {
-
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).removeSelectionChangedListener(this);
-
- if (fViewer instanceof StructuredViewer) {
- StructuredViewer sv= (StructuredViewer) fViewer;
- sv.removeDoubleClickListener(this);
- sv.removeOpenListener(fOpenHandler);
- }
-
- Control content= getContent();
- setContent(null);
-
- fViewer.setInput(null);
-
- if (content != null && !content.isDisposed())
- content.dispose();
-
- } else
- oldEmpty= false;
- setContent(null);
-
- fViewer= newViewer;
-
- if (fViewer != null) {
- // we have to remember and restore the old visibility of the CustomPane
- // since setContent changes the visibility
- boolean old= getVisible();
- setContent(fViewer.getControl());
- setVisible(old); // restore old visibility
-
- boolean newEmpty= isEmpty();
-
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).addSelectionChangedListener(this);
-
- if (fViewer instanceof StructuredViewer) {
- StructuredViewer sv= (StructuredViewer) fViewer;
- sv.addDoubleClickListener(this);
- sv.addOpenListener(fOpenHandler);
- }
-
- if (oldEmpty != newEmpty) { // relayout my container
- Composite parent= getParent();
- if (parent instanceof Splitter)
- ((Splitter)parent).setVisible(this, fControlVisibility ? !newEmpty : true);
- }
-
- layout(true);
- }
- }
-
- /**
- * Returns the optional title argument that has been set with <code>setTitelArgument</code>
- * or <code>null</code> if no optional title argument has been set.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- *
- * @return the optional title argument or <code>null</code>
- */
- public String getTitleArgument() {
- return fTitleArgument;
- }
-
- /**
- * Returns <code>true</code> if no viewer is installed or if the current viewer
- * is a <code>NullViewer</code>.
- *
- * @return <code>true</code> if no viewer is installed or if the current viewer is a <code>NullViewer</code>
- */
- public boolean isEmpty() {
- return fViewer == null || fViewer instanceof NullViewer;
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener l) {
- fSelectionListeners.add(l);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener l) {
- fSelectionListeners.remove(l);
- }
-
- public void addDoubleClickListener(IDoubleClickListener l) {
- fDoubleClickListener.add(l);
- }
-
- public void removeDoubleClickListener(IDoubleClickListener l) {
- fDoubleClickListener.remove(l);
- }
-
- public void addOpenListener(IOpenListener l) {
- fOpenListener.add(l);
- }
-
- public void removeOpenListener(IOpenListener l) {
- fOpenListener.remove(l);
- }
-
- public void doubleClick(DoubleClickEvent event) {
- Object[] listeners= fDoubleClickListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IDoubleClickListener) listeners[i]).doubleClick(event);
- }
-
- public ISelection getSelection() {
- if (fViewer instanceof ISelectionProvider)
- return ((ISelectionProvider) fViewer).getSelection();
- return null;
- }
-
- public void setSelection(ISelection s) {
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).setSelection(s);
- }
-
- public void selectionChanged(SelectionChangedEvent ev) {
- Object[] listeners= fSelectionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((ISelectionChangedListener) listeners[i]).selectionChanged(ev);
- }
-
- private boolean hasFocus2() {
- // do we have focus?
- Display display= getDisplay();
- if (display != null)
- for (Control focus= display.getFocusControl(); focus != null; focus= focus.getParent())
- if (focus == this)
- return true;
- return false;
- }
-
- /**
- * Sets the input object of this pane.
- * For this input object a suitable viewer is determined by calling the abstract
- * method <code>getViewer(Viewer, Object)</code>.
- * If the returned viewer differs from the current one, the old viewer
- * is disposed and the new one installed. Then the input object is fed
- * into the newly installed viewer by calling its <code>setInput(Object)</code> method.
- * If new and old viewer don't differ no new viewer is installed but just
- * <code>setInput(Object)</code> is called.
- * If the input is <code>null</code> the pane is cleared,
- * that is the current viewer is disposed.
- *
- * @param input the new input object or <code>null</code>
- */
- public void setInput(Object input) {
-
- if (fInput == input)
- return;
-
- boolean hadFocus= hasFocus2();
-
- fInput= input;
-
- // viewer switching
- Viewer newViewer= null;
- if (input != null)
- newViewer= getViewer(fViewer, input);
-
- if (newViewer == null) {
- if (fViewer instanceof NullViewer)
- return;
- newViewer= new NullViewer(this);
- }
-
- setViewer(newViewer);
-
- // set input
- fViewer.setInput(input);
-
- Image image= null;
- if (!(fViewer instanceof NullViewer) && input instanceof ICompareInput)
- image= ((ICompareInput)input).getImage();
- setImage(image);
-
- String title= null;
- if (fViewer != null) {
- Control c= fViewer.getControl();
- if (c != null) {
- Object data= c.getData(CompareUI.COMPARE_VIEWER_TITLE);
- if (data instanceof String)
- title= (String) data;
- if (hadFocus)
- c.setFocus();
- }
- }
-
- fTitle= title;
- updateTitle();
- }
-
- /**
- * Sets an additional and optional argument for the pane's title.
- * Note: this method is for internal use only. Clients should not call this method.
- *
- * @param argument an optional argument for the pane's title
- */
- public void setTitleArgument(String argument) {
- fTitleArgument= argument;
- updateTitle();
- }
-
- private void updateTitle() {
- if (fTitle != null) {
- if (fTitleArgument != null) {
- String format= CompareMessages.getString("CompareViewerSwitchingPane.Titleformat"); //$NON-NLS-1$
- String t= MessageFormat.format(format, new String[] { fTitle, fTitleArgument } );
- setText(t);
- } else
- setText(fTitle);
- } else {
- setText(""); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the current input of this pane or null if the pane has no input.
- *
- * @return an <code>Object</code> that is the input to this pane or null if the pane has no input.
- */
- public Object getInput() {
- return fInput;
- }
-
- /**
- * Returns a viewer which is able to display the given input.
- * If no viewer can be found, <code>null</code> is returned.
- * The additional argument oldViewer represents the viewer currently installed
- * in the pane (or <code>null</code> if no viewer is installed).
- * It can be returned from this method if the current viewer can deal with the
- * input (and no new viewer must be created).
- *
- * @param oldViewer the currently installed viewer or <code>null</code>
- * @param input the input object for which a viewer must be determined or <code>null</code>
- * @return a viewer for the given input, or <code>null</code> if no viewer can be determined
- */
- abstract protected Viewer getViewer(Viewer oldViewer, Object input);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
deleted file mode 100644
index 2eb990a18..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ /dev/null
@@ -1,1142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.HashMap;
-import java.util.ResourceBundle;
-import java.util.Date;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.HashSet;
-import java.util.Calendar;
-import java.text.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.dialogs.*;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * A dialog where one input element can be compared against
- * a list of historic variants (editions) of the same input element.
- * The dialog can be used to implement functions like "Compare/Replace with Version" or
- * "Compare/Replace from Local History" on workspace resources.
- * <p>
- * In addition it is possible to specify a subsection of the input element
- * (e.g. a method in a Java source file) by means of a "path".
- * In this case the dialog compares only the subsection (as specified by the path)
- * with the corresponding subsection in the list of editions.
- * Only those editions are shown where the subsection differs from the same subsection in
- * another edition thereby minimizing the number of presented variants.
- * This functionality can be used to implement "Replace from Local History"
- * for the Java language.
- * <p>
- * Subsections of an input element are determined by first finding an
- * <code>IStructureCreator</code> for the input's type.
- * Then the method <code>locate</code> is used to extract the subsection.
- * <p>
- * Each edition (variant in the list of variants) must implement the <code>IModificationDate</code> interface
- * so that the dialog can sort the editions and present them in a tree structure where every
- * node corresponds one day.
- * <p>
- * The functionality is surfaced in a single function <code>selectEdition</code>.
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- *
- * @see IModificationDate
- * @see ITypedElement
- */
-public class EditionSelectionDialog extends ResizableDialog {
-
- /**
- * An item in an underlying edition.
- */
- private static class Pair {
-
- private ITypedElement fEdition;
- private ITypedElement fItem;
- private String fContent;
- private IStructureCreator fStructureCreator;
- private boolean fHasError= false;
-
- Pair(IStructureCreator structureCreator, ITypedElement edition, ITypedElement item) {
- fStructureCreator= structureCreator;
- fEdition= edition;
- fItem= item;
- }
-
- Pair(IStructureCreator structureCreator, ITypedElement edition) {
- this(structureCreator, edition, edition);
- }
-
- ITypedElement getEdition() {
- return fEdition;
- }
-
- ITypedElement getItem() {
- return fItem;
- }
-
- /**
- * The content is lazily loaded
- */
- private String getContent() {
- if (fContent == null) {
- if (fStructureCreator != null)
- fContent= fStructureCreator.getContents(fItem, false);
- else {
- if (fItem instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) fItem;
- try {
- fContent= Utilities.readString(sca);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
- if (fContent == null)
- fContent= ""; //$NON-NLS-1$
- }
- return fContent;
- }
-
- /**
- * Compares content of item.
- */
- public boolean equals(Object other) {
- if (other != null && other.getClass() == getClass()) {
- if (getContent().equals(((Pair)other).getContent()))
- return true;
- }
- return super.equals(other);
- }
- }
-
- // Configuration options
- private CompareConfiguration fCompareConfiguration;
- private ArrayList fArrayList= new ArrayList();
- /** use a side-by-side compare viewer */
- private boolean fCompare= true;
- /** show target on right hand side */
- private boolean fTargetIsRight= false;
- /** hide entries which have identical content */
- private boolean fHideIdentical= true;
- /** add mode if true, otherwise replace mode */
- private boolean fAddMode= false;
- /** compare mode if true, otherwise replace/add mode */
- private boolean fCompareMode= false;
- /** perform structure compare on editions */
- private boolean fStructureCompare= false;
- /** allow for multiple selection */
- private boolean fMultiSelect= false;
-
- /**
- * Maps from members to their corresponding editions.
- * Has only a single entry if dialog is used in "Replace" (and not "Add") mode.
- */
- private HashMap fMemberEditions;
- /**
- * Maps from members to their corresponding selected edition.
- */
- private HashMap fMemberSelection;
- /** The editions of the current selected member */
- private List fCurrentEditions;
- private Thread fThread;
- private Pair fTargetPair;
- /** The selected edition in the edition viewer */
- private ITypedElement fSelectedItem;
- private String fTitleArg;
- private Image fTitleImage;
-
- // SWT controls
- private CompareViewerSwitchingPane fContentPane;
- private Button fCommitButton;
- private Table fMemberTable;
- private CompareViewerPane fMemberPane;
- private Tree fEditionTree;
- private CompareViewerPane fEditionPane;
- private Image fDateImage;
- private Image fTimeImage;
- private CompareViewerSwitchingPane fStructuredComparePane;
-
- /**
- * Creates a new modal, resizable dialog.
- * Various titles, icons, and labels are configured from the given resource bundle.
- * The following resource keys are used:
- * <pre>
- * key type description
- * title String dialog title
- * width Integer initial width of dialog
- * height Integer initial height of dialog
- * treeTitleFormat MessageFormat pane title for edition tree; arg 0 is the target
- * dateIcon String icon for node in edition tree; path relative to plugin
- * timeIcon String icon for leaf in edition tree; path relative to plugin
- * todayFormat MessageFormat format string if date is todays date; arg 0 is date
- * yesterdayFormat MessageFormat format string if date is yesterdays date; arg 0 is date
- * dayFormat MessageFormat format string if date is any other date; arg 0 is date
- * editionLabel String label for editions side of compare viewer; arg 0 is the date
- * targetLabel String label for target side of compare viewer
- * buttonLabel String label for OK button; default is IDialogConstants.OK_LABEL
- * </pre>
- *
- * @param parent if not <code>null</code> the new dialog stays on top of this parent shell
- * @param bundle <code>ResourceBundle</code> to configure the dialog
- */
- public EditionSelectionDialog(Shell parent, ResourceBundle bundle) {
- super(parent, bundle);
- }
-
- private CompareConfiguration getCompareConfiguration() {
- if (fCompareConfiguration == null) {
- fCompareConfiguration= new CompareConfiguration();
- fCompareConfiguration.setLeftEditable(false);
- fCompareConfiguration.setRightEditable(false);
- }
- return fCompareConfiguration;
- }
-
- /**
- * Sets an additional and optional argument for the edition pane's title.
- *
- * @param titleArgument an optional argument for the edition pane's title
- * @since 2.0
- */
- public void setEditionTitleArgument(String titleArgument) {
- fTitleArg= titleArgument;
- }
-
- /**
- * Sets an optional image for the edition pane's title.
- *
- * @param titleImage an optional image for the edition pane's title
- * @since 2.0
- */
- public void setEditionTitleImage(Image titleImage) {
- fTitleImage= titleImage;
- }
-
- /**
- * Select the previous edition (presenting a UI).
- *
- * @param target the input object against which the editions are compared; must not be <code>null</code>
- * @param editions the list of editions (element type: <code>ITypedElement</code>s)
- * @param path If <code>null</code> dialog shows full input; if non <code>null</code> it extracts a subsection
- * @return returns the selected edition or <code>null</code> if error occurred.
- * The returned <code>ITypedElement</code> is one of the original editions
- * if <code>path</code> was <code>null</code>; otherwise
- * it is an <code>ITypedElement</code> returned from <code>IStructureCreator.locate(path, item)</code>
- * @since 2.0
- */
- public ITypedElement selectPreviousEdition(final ITypedElement target, ITypedElement[] inputEditions, Object ppath) {
- Assert.isNotNull(target);
- fTargetPair= new Pair(null, target);
-
- // sort input editions
- final int count= inputEditions.length;
- final IModificationDate[] editions= new IModificationDate[count];
- for (int i= 0; i < count; i++)
- editions[i]= (IModificationDate) inputEditions[i];
- if (count > 1)
- internalSort(editions, 0, count-1);
-
- // find StructureCreator if ppath is not null
- IStructureCreator structureCreator= null;
- if (ppath != null) {
- String type= target.getType();
- IStructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
- if (scd != null)
- structureCreator= scd.createStructureCreator();
- }
-
- if (fAddMode) {
- // does not work in add mode
- return null;
- }
-
- if (structureCreator != null) {
- Pair pair= createPair(structureCreator, ppath, target);
- if (pair != null)
- fTargetPair= pair;
- else
- ppath= null; // couldn't extract item because of error
- }
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++) {
-
- ITypedElement edition= (ITypedElement) editions[i];
- Pair pair= null;
-
- if (structureCreator != null && ppath != null) {
- // extract sub element from edition
- pair= createPair(structureCreator, ppath, edition);
- } else {
- pair= new Pair(null, edition);
- }
-
- if (pair != null && pair.fHasError)
- return null;
-
- if (pair != null && !fTargetPair.equals(pair)) {
- return pair.fItem;
- }
- }
-
- // nothing found
- return null;
- }
-
- /**
- * Presents this modal dialog with the functionality described in the class comment above.
- *
- * @param target the input object against which the editions are compared; must not be <code>null</code>
- * @param editions the list of editions (element type: <code>ITypedElement</code>s)
- * @param path If <code>null</code> dialog shows full input; if non <code>null</code> it extracts a subsection
- * @return returns the selected edition or <code>null</code> if dialog was cancelled.
- * The returned <code>ITypedElement</code> is one of the original editions
- * if <code>path</code> was <code>null</code>; otherwise
- * it is an <code>ITypedElement</code> returned from <code>IStructureCreator.locate(path, item)</code>
- */
- public ITypedElement selectEdition(final ITypedElement target, ITypedElement[] inputEditions, Object ppath) {
-
- Assert.isNotNull(target);
- fTargetPair= new Pair(null, target);
-
- // sort input editions
- final int count= inputEditions.length;
- final IModificationDate[] editions= new IModificationDate[count];
- for (int i= 0; i < count; i++)
- editions[i]= (IModificationDate) inputEditions[i];
- if (count > 1)
- internalSort(editions, 0, count-1);
-
- // find StructureCreator if ppath is not null
- IStructureCreator structureCreator= null;
- if (ppath != null) {
- String type= target.getType();
- IStructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
- if (scd != null)
- structureCreator= scd.createStructureCreator();
- }
-
- if (!fAddMode) {
- // replace mode
-
- if (structureCreator != null) {
- Pair pair= createPair(structureCreator, ppath, target);
- if (pair != null)
- fTargetPair= pair;
- else
- ppath= null; // couldn't extract item because of error
- }
-
- // set the left and right labels for the compare viewer
- String targetLabel= getTargetLabel(target, fTargetPair.getItem());
- if (fTargetIsRight)
- getCompareConfiguration().setRightLabel(targetLabel);
- else
- getCompareConfiguration().setLeftLabel(targetLabel);
-
- if (structureCreator != null && ppath != null) { // extract sub element
-
- final IStructureCreator sc= structureCreator;
- final Object path= ppath;
-
- // construct the comparer thread
- // and perform the background extract
- fThread= new Thread() {
- public void run() {
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++) {
-
- if (fEditionTree == null || fEditionTree.isDisposed())
- break;
- ITypedElement edition= (ITypedElement) editions[i];
-
- // extract sub element from edition
- Pair pair= createPair(sc, path, edition);
- if (pair != null)
- sendPair(pair);
- }
- sendPair(null);
- }
- };
- } else {
- // create tree widget
- create();
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++)
- addMemberEdition(new Pair(null, (ITypedElement) editions[i]));
- }
-
- } else {
- // add mode
- final Object container= ppath;
- Assert.isNotNull(container);
-
- if (structureCreator == null)
- return null; // error
-
- // extract all elements of container
- final HashSet current= new HashSet();
- IStructureComparator sco= structureCreator.locate(container, target);
- if (sco != null) {
- Object[] children= sco.getChildren();
- if (children != null)
- for (int i= 0; i < children.length; i++)
- current.add(children[i]);
- }
-
- final IStructureCreator sc= structureCreator;
-
- // construct the comparer thread
- // and perform the background extract
- fThread= new Thread() {
- public void run() {
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++) {
-
- if (fEditionTree == null || fEditionTree.isDisposed())
- break;
- ITypedElement edition= (ITypedElement) editions[i];
-
- IStructureComparator sco2= sc.locate(container, edition);
- if (sco2 != null) {
- Object[] children= sco2.getChildren();
- if (children != null) {
- for (int i2= 0; i2 < children.length; i2++) {
- ITypedElement child= (ITypedElement) children[i2];
- if (!current.contains(child))
- sendPair(new Pair(sc, edition, child));
- }
- }
- }
- }
- sendPair(null);
- }
- };
- }
-
- open();
-
- if (getReturnCode() == OK)
- return fSelectedItem;
- return null;
- }
-
- private Pair createPair(IStructureCreator sc, Object path, ITypedElement input) {
- IStructureComparator scmp= sc.locate(path, input);
- if (scmp == null && sc.getStructure(input) == null) { // parse error
- Pair p= new Pair(sc, input);
- p.fHasError= true;
- return p;
- }
- if (scmp instanceof ITypedElement)
- return new Pair(sc, input, (ITypedElement) scmp);
- return null;
- }
-
- /**
- * Controls whether identical entries are shown or not (default).
- * This method must be called before <code>selectEdition</code>.
- *
- * @param hide if true identical entries are hidden; otherwise they are shown.
- * @since 2.0
- */
- public void setHideIdenticalEntries(boolean hide) {
- fHideIdentical= hide;
- }
-
- /**
- * Controls whether workspace target is on the left (the default) or right hand side.
- *
- * @param isRight if true target is shown on right hand side.
- * @since 2.0
- */
- public void setTargetIsRight(boolean isRight) {
- fTargetIsRight= isRight;
- }
-
- /**
- * Controls whether the <code>EditionSelectionDialog</code> is in 'add' mode
- * or 'replace' mode (the default).
- *
- * @param addMode if true dialog is in 'add' mode.
- * @since 2.0
- */
- public void setAddMode(boolean addMode) {
- fAddMode= addMode;
- fMultiSelect= addMode;
- }
-
- /**
- * Controls whether the <code>EditionSelectionDialog</code> is in 'compare' mode
- * or 'add/replace' (the default) mode.
- *
- * @param addMode if true dialog is in 'add' mode.
- * @since 2.0
- */
- public void setCompareMode(boolean compareMode) {
- fCompareMode= compareMode;
- fStructureCompare= fCompareMode && !fAddMode;
- }
-
- /**
- * Returns the input target that has been specified with the most recent call
- * to <code>selectEdition</code>. If a not <code>null</code> path was specified this method
- * returns a subsection of this target (<code>IStructureCreator.locate(path, target)</code>)
- * instead of the input target.
- * <p>
- * For example if the <code>target</code> is a Java compilation unit and <code>path</code> specifies
- * a method, the value returned from <code>getTarget</code> will be the method not the compilation unit.
- *
- * @return the last specified target or a subsection thereof.
- */
- public ITypedElement getTarget() {
- return fTargetPair.getItem();
- }
-
- /**
- * Returns the editions that have been selected with the most
- * recent call to <code>selectEdition</code>.
- *
- * @return the selected editions as an array.
- * @since 2.1
- */
- public ITypedElement[] getSelection() {
- ArrayList result= new ArrayList();
- if (fMemberSelection != null) {
- Iterator iter= fArrayList.iterator();
- for (int i= 0; iter.hasNext(); i++) {
- Object edition= iter.next();
- Object item= fMemberSelection.get(edition);
- if (item != null)
- result.add(item);
- }
- } else if (fSelectedItem != null)
- result.add(fSelectedItem);
- return (ITypedElement[]) result.toArray(new ITypedElement[result.size()]);
- }
-
- /**
- * Returns a label for identifying the target side of a compare viewer.
- * This implementation extracts the value for the key "targetLabel" from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the name of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param target the target element for which a label must be returned
- * @param item if a path has been specified in <code>selectEdition</code> a sub element of the given target; otherwise the same as target
- * @return a label the target side of a compare viewer
- */
- protected String getTargetLabel(ITypedElement target, ITypedElement item) {
- String format= null;
- if (target instanceof ResourceNode)
- format= Utilities.getString(fBundle, "workspaceTargetLabel", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "targetLabel"); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
- return MessageFormat.format(format, new Object[] { target.getName() });
- }
-
- /**
- * Returns a label for identifying the edition side of a compare viewer.
- * This implementation extracts the value for the key "editionLabel" from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the formatted modification date of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param selectedEdition the selected edition for which a label must be returned
- * @param item if a path has been specified in <code>selectEdition</code> a sub element of the given selectedEdition; otherwise the same as selectedEdition
- * @return a label for the edition side of a compare viewer
- */
- protected String getEditionLabel(ITypedElement selectedEdition, ITypedElement item) {
- String format= null;
- if (selectedEdition instanceof ResourceNode)
- format= Utilities.getString(fBundle, "workspaceEditionLabel", null); //$NON-NLS-1$
- else if (selectedEdition instanceof HistoryItem)
- format= Utilities.getString(fBundle, "historyEditionLabel", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "editionLabel"); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
-
- String date= ""; //$NON-NLS-1$
- if (selectedEdition instanceof IModificationDate) {
- long modDate= ((IModificationDate)selectedEdition).getModificationDate();
- date= DateFormat.getDateTimeInstance().format(new Date(modDate));
- }
-
- return MessageFormat.format(format, new Object[] { date });
- }
-
- /**
- * Returns a label for identifying a node in the edition tree viewer.
- * This implementation extracts the value for the key "workspaceTreeFormat" or
- * "treeFormat" (in that order) from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the formatted modification date of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param edition the edition for which a label must be returned
- * @param item if a path has been specified in <code>edition</code> a sub element of the given edition; otherwise the same as edition
- * @return a label of a node in the edition tree viewer
- * @since 2.0
- */
- protected String getShortEditionLabel(ITypedElement edition, ITypedElement item, Date date) {
- String format= null;
- if (edition instanceof ResourceNode)
- format= Utilities.getString(fBundle, "workspaceTreeFormat", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "treeFormat", null); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
- String ds= DateFormat.getTimeInstance().format(date);
- return MessageFormat.format(format, new Object[] { ds });
- }
-
- /**
- * Returns an image for identifying the edition side of a compare viewer.
- * This implementation extracts the value for the key "editionLabel" from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the formatted modification date of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param selectedEdition the selected edition for which a label must be returned
- * @param item if a path has been specified in <code>selectEdition</code> a sub element of the given selectedEdition; otherwise the same as selectedEdition
- * @return a label the edition side of a compare viewer
- * @since 2.0
- */
- protected Image getEditionImage(ITypedElement selectedEdition, ITypedElement item) {
- if (selectedEdition instanceof ResourceNode)
- return selectedEdition.getImage();
- if (selectedEdition instanceof HistoryItem) {
- if (fTimeImage == null) {
- String iconName= Utilities.getString(fBundle, "timeIcon", "obj16/resource_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- ImageDescriptor id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fTimeImage= id.createImage();
- }
- return fTimeImage;
- }
- return null;
- }
-
- /* (non Javadoc)
- * Creates SWT control tree.
- */
- protected synchronized Control createDialogArea(Composite parent2) {
-
- Composite parent= (Composite) super.createDialogArea(parent2);
-
- getShell().setText(Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
- Splitter vsplitter= new Splitter(parent, SWT.VERTICAL);
- vsplitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-
- vsplitter.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fCompareConfiguration != null) {
- fCompareConfiguration.dispose();
- fCompareConfiguration= null;
- }
- if (fDateImage != null) {
- fDateImage.dispose();
- fDateImage= null;
- }
- if (fTimeImage != null) {
- fTimeImage.dispose();
- fTimeImage= null;
- }
- }
- }
- );
-
- if (fAddMode) {
- // we need two panes: the left for the elements, the right one for the editions
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- fMemberPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- fMemberPane.setText(Utilities.getString(fBundle, "memberPaneTitle")); //$NON-NLS-1$
-
- int flags= SWT.H_SCROLL + SWT.V_SCROLL;
- if (fMultiSelect)
- flags|= SWT.CHECK;
- fMemberTable= new Table(fMemberPane, flags);
- fMemberTable.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (e.detail == SWT.CHECK) {
- if (e.item instanceof TableItem) {
- TableItem ti= (TableItem) e.item;
- Object data= ti.getData();
- if (ti.getChecked())
- fArrayList.add(data);
- else
- fArrayList.remove(data);
-
- if (fCommitButton != null)
- fCommitButton.setEnabled(fArrayList.size() > 0);
-
- fMemberTable.setSelection(new TableItem[] { ti });
- }
- }
- handleMemberSelect(e.item);
- }
- }
- );
- fMemberPane.setContent(fMemberTable);
- fMemberTable.setFocus();
-
- fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- } else {
- if (fStructureCompare) {
- // we need two panes: the left for the elements, the right one for the structured diff
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- fStructuredComparePane= new CompareViewerSwitchingPane(hsplitter, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return CompareUIPlugin.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration());
- return null;
- }
- };
- fStructuredComparePane.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feedInput2(e.getSelection());
- }
- }
- );
- } else {
- // only a single pane showing the editions
- fEditionPane= new CompareViewerPane(vsplitter, SWT.BORDER | SWT.FLAT);
- }
- if (fTitleArg == null)
- fTitleArg= fTargetPair.getItem().getName();
- String titleFormat= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$
- String title= MessageFormat.format(titleFormat, new String[] { fTitleArg });
- fEditionPane.setText(title);
- if (fTitleImage != null)
- fEditionPane.setImage(fTitleImage);
- }
-
- fEditionTree= new Tree(fEditionPane, SWT.H_SCROLL + SWT.V_SCROLL);
- fEditionTree.addSelectionListener(
- new SelectionAdapter() {
-// public void widgetDefaultSelected(SelectionEvent e) {
-// handleDefaultSelected();
-// }
- public void widgetSelected(SelectionEvent e) {
- feedInput(e.item);
- }
- }
- );
- fEditionPane.setContent(fEditionTree);
-
- // now start the thread (and forget about it)
- if (fThread != null) {
- fThread.start();
- fThread= null;
- }
-
- fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, getCompareConfiguration());
- }
- };
- vsplitter.setWeights(new int[] { 30, 70 });
-
- applyDialogFont(parent);
- return parent;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- String buttonLabel= Utilities.getString(fBundle, "buttonLabel", IDialogConstants.OK_LABEL); //$NON-NLS-1$
- if (fCompareMode) {
- // only a 'Done' button
- createButton(parent, IDialogConstants.CANCEL_ID, buttonLabel, false);
- } else {
- // a 'Cancel' and a 'Add/Replace' button
- fCommitButton= createButton(parent, IDialogConstants.OK_ID, buttonLabel, true);
- fCommitButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- }
-
- /**
- * Overidden to disable dismiss on double click in compare mode.
- * @since 2.0
- */
- protected void okPressed() {
- if (fCompareMode)
- ; // don't dismiss dialog
- else
- super.okPressed();
- }
-
- //---- private stuff ----------------------------------------------------------------------------------------
-
- /**
- * Asynchroneously sends a Pair (or null) to the UI thread.
- */
- private void sendPair(final Pair pair) {
- if (fEditionTree != null && !fEditionTree.isDisposed()) {
- Display display= fEditionTree.getDisplay();
- display.asyncExec(
- new Runnable() {
- public void run() {
- addMemberEdition(pair);
- }
- }
- );
- }
- }
-
- private static void internalSort(IModificationDate[] keys, int left, int right) {
-
- int original_left= left;
- int original_right= right;
-
- IModificationDate mid= keys[(left + right) / 2];
- do {
- while (keys[left].getModificationDate() > mid.getModificationDate())
- left++;
-
- while (mid.getModificationDate() > keys[right].getModificationDate())
- right--;
-
- if (left <= right) {
- IModificationDate tmp= keys[left];
- keys[left]= keys[right];
- keys[right]= tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (original_left < right)
- internalSort(keys, original_left, right);
-
- if (left < original_right)
- internalSort(keys, left, original_right);
- }
-
- /**
- * Adds the given Pair to the member editions.
- * If HIDE_IDENTICAL is true the new Pair is only added if its contents
- * is different from the preceeding Pair.
- * If the argument is <code>null</code> the message "No Editions found" is shown
- * in the member or edition viewer.
- */
- private void addMemberEdition(Pair pair) {
-
- if (pair == null) { // end of list of pairs
- if (fMemberTable != null) {
- if (!fMemberTable.isDisposed() && fMemberTable.getItemCount() == 0) {
- if (fMultiSelect) {
- fMemberTable.dispose();
- fMemberTable= new Table(fMemberPane, SWT.NONE);
- fMemberPane.setContent(fMemberTable);
- }
- TableItem ti= new TableItem(fMemberTable, SWT.NONE);
- ti.setText(Utilities.getString(fBundle, "noAdditionalMembersMessage")); //$NON-NLS-1$
- }
- return;
- }
- if (fEditionTree != null && !fEditionTree.isDisposed() && fEditionTree.getItemCount() == 0) {
- TreeItem ti= new TreeItem(fEditionTree, SWT.NONE);
- ti.setText(Utilities.getString(fBundle, "notFoundInLocalHistoryMessage")); //$NON-NLS-1$
- }
- return;
- }
-
- if (fMemberEditions == null)
- fMemberEditions= new HashMap();
- if (fMultiSelect && fMemberSelection == null)
- fMemberSelection= new HashMap();
-
- ITypedElement item= pair.getItem();
- List editions= (List) fMemberEditions.get(item);
- if (editions == null) {
- editions= new ArrayList();
- fMemberEditions.put(item, editions);
- if (fMemberTable != null && !fMemberTable.isDisposed()) {
- ITypedElement te= item;
- String name= te.getName();
-
- // find position
- TableItem[] items= fMemberTable.getItems();
- int where= items.length;
- for (int i= 0; i < where; i++) {
- String n= items[i].getText();
- if (n.compareTo(name) > 0) {
- where= i;
- break;
- }
- }
-
- TableItem ti= new TableItem(fMemberTable, where, SWT.NULL);
- ti.setImage(te.getImage());
- ti.setText(name);
- ti.setData(editions);
- }
- }
- if (fHideIdentical) {
- Pair last= fTargetPair;
- int size= editions.size();
- if (size > 0)
- last= (Pair) editions.get(size-1);
- if (last != null && last.equals(pair))
- return; // don't add since the new one is equal to old
- }
- editions.add(pair);
-
- if (!fAddMode || editions == fCurrentEditions)
- addEdition(pair);
- }
-
- /**
- * Returns the number of s since Jan 1st, 1970.
- * The given date is converted to GMT and daylight saving is taken into account too.
- */
- private long dayNumber(long date) {
- int ONE_DAY_MS= 24*60*60 * 1000; // one day in milli seconds
-
- Calendar calendar= Calendar.getInstance();
- long localTimeOffset= calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
-
- return (date + localTimeOffset) / ONE_DAY_MS;
- }
-
- /**
- * Adds the given Pair to the edition tree.
- * It takes care of creating tree nodes for different dates.
- */
- private void addEdition(Pair pair) {
- if (fEditionTree == null || fEditionTree.isDisposed())
- return;
-
- // find last day
- TreeItem[] days= fEditionTree.getItems();
- TreeItem lastDay= null;
- if (days.length > 0)
- lastDay= days[days.length-1];
-
- boolean first= lastDay == null;
-
- ITypedElement edition= pair.getEdition();
- ITypedElement item= pair.getItem();
-
- long ldate= ((IModificationDate)edition).getModificationDate();
- long day= dayNumber(ldate);
- Date date= new Date(ldate);
- if (lastDay == null || day != dayNumber(((Date)lastDay.getData()).getTime())) {
- lastDay= new TreeItem(fEditionTree, SWT.NONE);
- if (fDateImage == null) {
- String iconName= Utilities.getString(fBundle, "dateIcon", "obj16/day_obj.gif"); //$NON-NLS-2$ //$NON-NLS-1$
- ImageDescriptor id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fDateImage= id.createImage();
- }
- lastDay.setImage(fDateImage);
- String df= DateFormat.getDateInstance().format(date);
- long today= dayNumber(System.currentTimeMillis());
-
- String formatKey;
- if (day == today)
- formatKey= "todayFormat"; //$NON-NLS-1$
- else if (day == today-1)
- formatKey= "yesterdayFormat"; //$NON-NLS-1$
- else
- formatKey= "dayFormat"; //$NON-NLS-1$
- String pattern= Utilities.getString(fBundle, formatKey);
- if (pattern != null)
- df= MessageFormat.format(pattern, new String[] { df });
- lastDay.setText(df);
- lastDay.setData(date);
- }
- TreeItem ti= new TreeItem(lastDay, SWT.NONE);
- ti.setImage(getEditionImage(edition, item));
-
- String s= getShortEditionLabel(edition, item, date);
- if (pair.fHasError) {
- String pattern= Utilities.getString(fBundle, "parseErrorFormat"); //$NON-NLS-1$
- s= MessageFormat.format(pattern, new String[] { s } );
- }
- ti.setText(s);
-
- ti.setData(pair);
-
- // determine selected TreeItem
- TreeItem selection= first ? ti : null;
- if (fMemberSelection != null) {
- Object selected= fMemberSelection.get(fCurrentEditions);
- if (selected != null) {
- if (selected == pair.getItem())
- selection= ti;
- else
- selection= null;
- }
- }
- if (selection != null) {
- fEditionTree.setSelection(new TreeItem[] { selection });
- if (!fAddMode)
- fEditionTree.setFocus();
- feedInput(selection);
- }
-
- if (first) // expand first node
- lastDay.setExpanded(true);
- }
-
- /**
- * Feeds selection from member viewer to edition viewer.
- */
- private void handleMemberSelect(Widget w) {
- Object data= w.getData();
- if (data instanceof List) {
- List editions= (List) data;
- if (editions != fCurrentEditions) {
- fCurrentEditions= editions;
- fEditionTree.removeAll();
-
- String pattern= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$
- String title= MessageFormat.format(pattern, new Object[] { ((Item)w).getText() });
- fEditionPane.setText(title);
-
- Iterator iter= editions.iterator();
- while (iter.hasNext()) {
- Object item= iter.next();
- if (item instanceof Pair)
- addEdition((Pair) item);
- }
- }
- }
- }
-
- private void setInput(Object input) {
- if (!fCompare && input instanceof ICompareInput) {
- ICompareInput ci= (ICompareInput) input;
- if (fTargetIsRight)
- input= ci.getLeft();
- else
- input= ci.getRight();
- }
- fContentPane.setInput(input);
- if (fStructuredComparePane != null)
- fStructuredComparePane.setInput(input);
- }
-
- /*
- * Feeds selection from edition viewer to content (and structure) viewer.
- */
- private void feedInput(Widget w) {
- Object input= w.getData();
- boolean isOK= false;
- if (input instanceof Pair) {
- Pair pair= (Pair) input;
- fSelectedItem= pair.getItem();
- isOK= !pair.fHasError;
-
- ITypedElement edition= pair.getEdition();
- String editionLabel= getEditionLabel(edition, fSelectedItem);
- Image editionImage= getEditionImage(edition, fSelectedItem);
-
- if (fAddMode) {
- if (fMemberSelection != null)
- fMemberSelection.put(fCurrentEditions, fSelectedItem);
- setInput(fSelectedItem);
- fContentPane.setText(editionLabel);
- fContentPane.setImage(editionImage);
- } else {
- getCompareConfiguration();
- if (fTargetIsRight) {
- fCompareConfiguration.setLeftLabel(editionLabel);
- fCompareConfiguration.setLeftImage(editionImage);
- setInput(new DiffNode(fSelectedItem, fTargetPair.getItem()));
- } else {
- fCompareConfiguration.setRightLabel(editionLabel);
- fCompareConfiguration.setRightImage(editionImage);
- setInput(new DiffNode(fTargetPair.getItem(), fSelectedItem));
- }
- }
- } else {
- fSelectedItem= null;
- setInput(null);
- }
- if (fCommitButton != null) {
- if (fMultiSelect)
- fCommitButton.setEnabled(isOK && fSelectedItem != null && fArrayList.size() > 0);
- else
- fCommitButton.setEnabled(isOK && fSelectedItem != null && fTargetPair.getItem() != fSelectedItem);
- }
- }
-
- /*
- * Feeds selection from structure viewer to content viewer.
- */
- private void feedInput2(ISelection sel) {
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) sel;
- if (ss.size() == 1)
- fContentPane.setInput(ss.getFirstElement());
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
deleted file mode 100644
index 8a348e182..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.core.resources.IFileState;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A combination <code>IFileState</code> and <code>ITypedElement</code> that can be used as
- * an input to a compare viewer or other places where an <code>IStreamContentAccessor</code>
- * is needed.
- * <p>
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- */
-public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate {
-
- private ITypedElement fBase;
- private IFileState fFileState;
-
- /**
- * Creates a <code>HistoryItem</code> object which combines the given <code>IFileState</code>
- * and <code>ITypedElement</code> into an object
- * which is suitable as input for a compare viewer or <code>ReplaceWithEditionDialog</code>.
- *
- * @param base the implementation of the <code>ITypedElement</code> interface delegates to this base <code>ITypedElement</code>
- * @param fileState the <code>IFileState</code> from which the streamable contents and the modification time is derived from
- */
- public HistoryItem(ITypedElement base, IFileState fileState) {
- fBase= base;
- fFileState= fileState;
- }
-
- /* (non-Javadoc)
- * see ITypedElement.getName
- */
- public String getName() {
- return fBase.getName();
- }
-
- /* (non-Javadoc)
- * see ITypedElement.getImage
- */
- public Image getImage() {
- return fBase.getImage();
- }
-
- /* (non-Javadoc)
- * see ITypedElement.getType
- */
- public String getType() {
- return fBase.getType();
- }
-
- /* (non-Javadoc)
- * see IModificationDate.getModificationDate
- */
- public long getModificationDate() {
- return fFileState.getModificationTime();
- }
-
- /* (non-Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() throws CoreException {
- return new BufferedInputStream(fFileState.getContents());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
- */
- public String getCharset() throws CoreException {
- return fFileState.getCharset();
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
deleted file mode 100644
index d0d3e06a1..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * A <code>ICompareNavigator</code> is used to navigate through the individual
- * differences of a <code>CompareEditorInput</code>.
- * <p>
- * Please note: the following might change before the final release of Eclipse 3.0.
- * You can retrieve an object implementing the <code>ICompareNavigator</code> from a
- * <code>CompareEditorInput</code> by calling <code>getAdapter(ICompareNavigator)</code>
- * on the <code>CompareEditorInput</code>.
- * </p>
- * @since 3.0
- */
-public interface ICompareNavigator {
-
- /**
- * Starting from the current selection <code>selectChange</code> selects and reveals the next (previous) change.
- * If the end (or beginning) is reached, the method returns <code>true</code>.
- *
- * @param next if <code>true</code> the next change is selected, otherwise the previous change
- * @return returns <code>true</code> if end (beginning) is reached, <code>false</code> otherwise
- */
- public boolean selectChange(boolean next);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
deleted file mode 100644
index 16aa27c0b..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * An <code>IContentChangeListener</code> is informed about content changes of a
- * <code>IContentChangeNotifier</code>.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IContentChangeNotifier
- */
-public interface IContentChangeListener {
-
- /**
- * Called whenever the content of the given source has changed.
- *
- * @param source the source whose contents has changed
- */
- void contentChanged(IContentChangeNotifier source);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
deleted file mode 100644
index 55641c97d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Interface common to all objects that provide a means for registering
- * for content change notification.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IContentChangeListener
- */
-public interface IContentChangeNotifier {
-
- /**
- * Adds a content change listener to this notifier.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a content changed listener
- */
- void addContentChangeListener(IContentChangeListener listener);
-
- /**
- * Removes the given content changed listener from this notifier.
- * Has no effect if the listener is not registered.
- *
- * @param listener a content changed listener
- */
- void removeContentChangeListener(IContentChangeListener listener);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
deleted file mode 100644
index a972a0a7d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Common interface for objects with editable contents.
- * Typically it is implemented by objects that also implement
- * the <code>IStreamContentAccessor</code> interface.
- * <p>
- * Clients may implement this interface.
- * <p>
- * Note that implementing <code>IEditableContent</code> does not
- * automatically mean that it is editable. An object is only editable if
- * it implements <code>IEditableContent</code> and the <code>isEditable</code> method returns <code>true</code>.
- *
- * @see IStreamContentAccessor
- */
-public interface IEditableContent {
-
- /**
- * Returns <code>true</code> if this object can be modified.
- * If it returns <code>false</code> the other methods of this API must not be called.
- *
- * @return <code>true</code> if this object can be modified
- */
- boolean isEditable();
-
- /**
- * Replaces the current content with the given new bytes.
- *
- * @param newContent this new contents replaces the old contents
- */
- void setContent(byte[] newContent);
-
- /**
- * This method is called on a parent to add or remove a child,
- * or to copy the contents of a child.
- *
- * What to do is encoded in the two arguments as follows:
- * <TABLE>
- * <TR>
- * <TD>add:</TD>
- * <TD>child == null</TD>
- * <TD>other != null</TD>
- * </TR>
- * <TR>
- * <TD>remove:</TD>
- * <TD>child != null</TD>
- * <TD>other == null</TD>
- * </TR>
- * <TR>
- * <TD>copy:</TD>
- * <TD>child != null</TD>
- * <TD>other != null</TD>
- * </TR>
- * </TABLE>
- */
- ITypedElement replace(ITypedElement child, ITypedElement other);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
deleted file mode 100644
index 1d0f3e261..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Extension for <code>IStreamContentAccessor</code>. Extends the original
- * concept of a <code>IStreamContentAccessor</code> to answer the Charset (encoding) used for the stream.
- * <p>
- * <b>Note</b>: This interface is part of early access API that may well
- * change in incompatible ways until reach their finished form.
- * </p>
- * @since 3.0
- */
-public interface IEncodedStreamContentAccessor extends IStreamContentAccessor {
-
- /**
- * Returns the name of a charset encoding to be used when decoding this
- * stream accessor's contents into characters. Returns <code>null</code> if a proper
- * encoding cannot be determined.
- *
- * @return the name of a charset, or <code>null</code>
- * @exception CoreException if an error happens while determining
- * the charset. See any refinements for more information.
- * @see IStreamContentAccessor#getContents
- * @since 3.0
- */
- String getCharset() throws CoreException;
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
deleted file mode 100644
index 1ddeb2b78..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Common interface for objects with a modification date. The modification date
- * can be used in the UI to give the user a general idea of how old an object is.
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface IModificationDate {
-
- /**
- * Returns the modification time of this object.
- * <p>
- * Note that this value should only be used to give the user a general idea of how
- * old the object is.
- *
- * @return the time of last modification, in milliseconds since January 1, 1970, 00:00:00 GMT
- */
- long getModificationDate();
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
deleted file mode 100644
index f4ed5212c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-/**
- * Interface common to all objects that provide a means for registering
- * for property change notification.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see org.eclipse.jface.util.IPropertyChangeListener
- */
-public interface IPropertyChangeNotifier {
-
- /**
- * Adds a listener for property changes to this notifier.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a property change listener
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Removes the given content change listener from this notifier.
- * Has no effect if the identical listener is not registered.
- *
- * @param listener a property change listener
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java
deleted file mode 100644
index 453bc6a4e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * An <code>IStreamContentAccessor</code> object represents a set of bytes which can be
- * accessed by means of a stream.
- * <p>
- * Clients may implement this interface, or use the standard implementation,
- * <code>BufferedContent</code>.
- *
- * @see BufferedContent
- */
-public interface IStreamContentAccessor {
- /**
- * Returns an open <code>InputStream</code> for this object which can be used to retrieve the object's content.
- * The client is responsible for closing the stream when finished.
- * Returns <code>null</code> if this object has no streamable contents.
- *
- * @return an input stream containing the contents of this object
- * @exception CoreException if the contents of this object could not be accessed
- */
- InputStream getContents() throws CoreException;
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java
deleted file mode 100644
index 4fa9131bc..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Extension interface for <code>IStreamContentAccessor</code>. Extends the original
- * concept of a <code>IStreamContentAccessor</code> to answer the Charset (encoding) used for the stream.
- *
- * @deprecated Use <code>IEncodedStreamContentAccessor</code> instead
- */
-public interface IStreamContentAccessorExtension2 extends IEncodedStreamContentAccessor {
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java
deleted file mode 100644
index 6717c8da2..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface for getting the name, image, and type for an object.
- * <p>
- * These methods are typically used to present an input object in the compare UI
- * (<code>getName</code> and <code>getImage</code>)
- * and for finding a viewer for a given input type (<code>getType</code>).
- * <p>
- * Clients may implement this interface.
- */
-public interface ITypedElement {
-
- /**
- * Type for a folder input (value <code>"FOLDER"</code>).
- * Folders are comparison elements that have no contents, only a name and children.
- */
- public static final String FOLDER_TYPE= "FOLDER"; //$NON-NLS-1$
-
- /**
- * Type for an element whose actual type is text (value <code>"txt"</code>).
- */
- public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$
-
- /**
- * Type for an element whose actual type could not
- * be determined. (value <code>"???"</code>).
- */
- public static final String UNKNOWN_TYPE= "???"; //$NON-NLS-1$
-
- /**
- * Returns the name of this object.
- * The name is used when displaying this object in the UI.
- *
- * @return the name of this object
- */
- String getName();
-
- /**
- * Returns an image for this object.
- * This image is used when displaying this object in the UI.
- *
- * @return the image of this object or <code>null</code> if this type of input has no image
- */
- Image getImage();
-
- /**
- * Returns the type of this object. For objects with a file name
- * this is typically the file extension. For folders its the constant
- * <code>FOLDER_TYPE</code>.
- * The type is used for determining a suitable viewer for this object.
- *
- * @return the type of this object
- */
- String getType();
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java
deleted file mode 100644
index 91433c80c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A factory object for <code>Viewer</code>.
- * <p>
- * This interface is only required when creating a <code>Viewer</code> from a plugin.xml file.
- * Since <code>Viewer</code>s have no default constructor they cannot be
- * instantiated directly with <code>Class.forName</code>.
- */
-public interface IViewerCreator {
-
- /**
- * Creates a new viewer under the given SWT parent control.
- *
- * @param parent the SWT parent control under which to create the viewer's SWT control
- * @param config a compare configuration the newly created viewer might want to use
- * @return a new viewer
- */
- Viewer createViewer(Composite parent, CompareConfiguration config);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
deleted file mode 100644
index c3bf5245c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.ResourceBundle;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.compare.internal.CompareMessages;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.internal.Utilities;
-
-
-/**
- * A <code>NavigationAction</code> is used to navigate through the individual
- * differences of a <code>CompareEditorInput</code>.
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class NavigationAction extends Action {
-
- private boolean fNext;
- private CompareEditorInput fCompareEditorInput;
-
-
- /**
- * Creates a <code>NavigationAction</code>.
- *
- * @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference.
- */
- public NavigationAction(boolean next) {
- this(CompareUIPlugin.getResourceBundle(), next);
- }
-
- /**
- * Creates a <code>NavigationAction</code> that initializes its attributes
- * from the given <code>ResourceBundle</code>.
- *
- * @param bundle is used to initialize the action
- * @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference.
- */
- public NavigationAction(ResourceBundle bundle, boolean next) {
- Utilities.initAction(this, bundle, next ? "action.Next." : "action.Previous."); //$NON-NLS-2$ //$NON-NLS-1$
- fNext= next;
- }
-
- public void run() {
- if (fCompareEditorInput != null) {
- Object adapter= fCompareEditorInput.getAdapter(ICompareNavigator.class);
- if (adapter instanceof ICompareNavigator) {
- boolean atEnd= ((ICompareNavigator)adapter).selectChange(fNext);
- Shell shell= CompareUIPlugin.getShell();
- if (atEnd && shell != null) {
-
- Display display= shell.getDisplay();
- if (display != null)
- display.beep();
-
- String title;
- String message;
- if (fNext) {
- title= CompareMessages.getString("CompareNavigator.atEnd.title"); //$NON-NLS-1$
- message= CompareMessages.getString("CompareNavigator.atEnd.message"); //$NON-NLS-1$
- } else {
- title= CompareMessages.getString("CompareNavigator.atBeginning.title"); //$NON-NLS-1$
- message= CompareMessages.getString("CompareNavigator.atBeginning.message"); //$NON-NLS-1$
- }
- MessageDialog.openInformation(shell, title, message);
- }
- }
- }
- }
-
- /**
- * Sets the <code>CompareEditorInput</code> on which this action operates.
- *
- * @param input the <code>CompareEditorInput</code> on which this action operates; if <code>null</code> action does nothing
- */
- public void setCompareEditorInput(CompareEditorInput input) {
- fCompareEditorInput= input;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
deleted file mode 100644
index 39a88a93a..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.*;
-import java.util.ArrayList;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-
-/**
- * A <code>ResourceNode</code> wrappers an <code>IResources</code> so that it can be used
- * as input for the differencing engine (interfaces <code>IStructureComparator</code> and <code>ITypedElement</code>)
- * and the <code>ReplaceWithEditionDialog</code> (interfaces <code>ITypedElement</code> and <code>IModificationDate</code>).
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- *
- * @see EditionSelectionDialog
- */
-public class ResourceNode extends BufferedContent
- implements IEncodedStreamContentAccessor, IStructureComparator, ITypedElement,
- IEditableContent, IModificationDate {
-
- private IResource fResource;
- private ArrayList fChildren;
-
-
- /**
- * Creates a <code>ResourceNode</code> for the given resource.
- *
- * @param resource the resource
- */
- public ResourceNode(IResource resource) {
- fResource= resource;
- Assert.isNotNull(resource);
- }
-
- /**
- * Returns the corresponding resource for this object.
- *
- * @return the corresponding resource
- */
- public IResource getResource() {
- return fResource;
- }
-
- /* (non Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() throws CoreException {
- if (fResource instanceof IStorage)
- return super.getContents();
- return null;
- }
-
- /* (non Javadoc)
- * see IModificationDate.getModificationDate
- */
- public long getModificationDate() {
- IPath path= fResource.getLocation();
- File file= path.toFile();
- return file.lastModified();
- }
-
- /* (non Javadoc)
- * see ITypedElement.getName
- */
- public String getName() {
- if (fResource != null)
- return fResource.getName();
- return null;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getType
- */
- public String getType() {
- if (fResource instanceof IContainer)
- return ITypedElement.FOLDER_TYPE;
- if (fResource != null) {
- String s= fResource.getFileExtension();
- if (s != null)
- return s;
- }
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getImage
- */
- public Image getImage() {
- return CompareUI.getImage(fResource);
- }
-
- /**
- * Returns <code>true</code> if the other object is of type <code>ITypedElement</code>
- * and their names are identical. The content is not considered.
- */
- /* (non Javadoc)
- * see IStructureComparator.equals
- */
- public boolean equals(Object other) {
- if (other instanceof ITypedElement) {
- String otherName= ((ITypedElement)other).getName();
- return getName().equals(otherName);
- }
- return super.equals(other);
- }
-
- /**
- * Returns the hash code of the name.
- */
- /* (non Javadoc)
- * see IStructureComparator.hashCode
- */
- public int hashCode() {
- return getName().hashCode();
- }
-
- /* (non Javadoc)
- * see IStructureComparator.getChildren
- */
- public Object[] getChildren() {
- if (fChildren == null) {
- fChildren= new ArrayList();
- if (fResource instanceof IContainer) {
- try {
- IResource members[]= ((IContainer)fResource).members();
- for (int i= 0; i < members.length; i++) {
- IStructureComparator child= createChild(members[i]);
- if (child != null)
- fChildren.add(child);
- }
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
- return fChildren.toArray();
- }
-
- /**
- * This hook method is called from <code>getChildren</code> once for every
- * member of a container resource. This implementation
- * creates a new <code>ResourceNode</code> for the given child resource.
- * Clients may override this method to create a different type of
- * <code>IStructureComparator</code> or to filter children by returning <code>null</code>.
- *
- * @param child the child resource for which a <code>IStructureComparator</code> must be returned
- * @return a <code>ResourceNode</code> for the given child or <code>null</code>
- */
- protected IStructureComparator createChild(IResource child) {
- return new ResourceNode(child);
- }
-
- /**
- * Returns an open stream if the corresponding resource implements the
- * <code>IStorage</code> interface. Otherwise the value <code>null</code> is returned.
- *
- * @return a buffered input stream containing the contents of this storage
- * @exception CoreException if the contents of this storage could not be accessed
- */
- protected InputStream createStream() throws CoreException {
- if (fResource instanceof IStorage) {
- InputStream is= null;
- IStorage storage= (IStorage) fResource;
- try {
- is= storage.getContents();
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- fResource.refreshLocal(IResource.DEPTH_INFINITE, null);
- is= storage.getContents();
- } else
- throw e;
- }
- if (is != null)
- return new BufferedInputStream(is);
- }
- return null;
- }
-
- /* (non Javadoc)
- * see IEditableContent.isEditable
- */
- public boolean isEditable() {
- return true;
- }
-
- /* (non Javadoc)
- * see IEditableContent.replace
- */
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
- return child;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
- */
- public String getCharset() {
- return Utilities.getCharset(fResource);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
deleted file mode 100644
index d6c60c7ff..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.SashForm;
-
-/**
- * The Splitter adds support for nesting to a SashForm.
- * <P>
- * If Splitters are nested directly:
- * <UL>
- * <LI>changing the visibility of a child may propagate upward to the parent Splitter if the child
- * is the last child to become invisible or the first to become visible.</LI>
- * <LI>maximizing a child makes it as large as the topmost enclosing Splitter</LI>
- * </UL>
- *
- * @since 2.1
- */
-public class Splitter extends SashForm {
-
- private static final String VISIBILITY= "org.eclipse.compare.internal.visibility"; //$NON-NLS-1$
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public Splitter(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * Sets the visibility of the given child in this Splitter. If this change
- * affects the visibility state of the whole Splitter, and if the Splitter
- * is directly nested in one or more Splitters, this method recursively
- * propagates the new state upward.
- *
- * @param child the child control for which the visibility is changed
- * @param visible the new visibility state
- */
- public void setVisible(Control child, boolean visible) {
-
- boolean wasEmpty= isEmpty();
-
- child.setVisible(visible);
- child.setData(VISIBILITY, new Boolean(visible));
-
- if (wasEmpty != isEmpty()) {
- // recursively walk up
- Composite parent= getParent();
- if (parent instanceof Splitter) {
- Splitter sp= (Splitter) parent;
- sp.setVisible(this, visible);
- sp.layout();
- }
- } else {
- layout();
- }
- }
-
- /* (non-Javadoc)
- * Recursively calls setMaximizedControl for all direct parents that are
- * itself Splitters.
- */
- public void setMaximizedControl(Control control) {
- if (control == null || control == getMaximizedControl())
- super.setMaximizedControl(null);
- else
- super.setMaximizedControl(control);
-
- // recursively walk upward
- Composite parent= getParent();
- if (parent instanceof Splitter)
- ((Splitter) parent).setMaximizedControl(this);
- else
- layout(true);
- }
-
- /* (non-Javadoc)
- * Returns true if Splitter has no children or if all children are invisible.
- */
- private boolean isEmpty() {
- Control[] controls= getChildren();
- for (int i= 0; i < controls.length; i++)
- if (isVisible(controls[i]))
- return false;
- return true;
- }
-
- /* (non-Javadoc)
- * Returns the visibility state of the given child control. If the
- * control is a Sash, this method always returns false.
- */
- private boolean isVisible(Control child) {
- if (child instanceof Sash)
- return false;
- Object data= child.getData(VISIBILITY);
- if (data instanceof Boolean)
- return ((Boolean)data).booleanValue();
- return true;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
deleted file mode 100644
index 8f06ebc72..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * This implementation of the <code>IStructureCreator</code> interface
- * makes the contents of a zip archive available as a
- * hierarchical structure of <code>IStructureComparator</code>s.
- * <p>
- * It is used when comparing the internal structure of a zip archive.
- *
- * @since 2.0
- */
-public class ZipFileStructureCreator implements IStructureCreator {
-
- /**
- * Common base class for ZipFolder and ZipFile
- */
- static abstract class ZipResource implements IStructureComparator, ITypedElement {
-
- private String fName;
-
- ZipResource(String name) {
- fName= name;
- }
-
- public String getName() {
- return fName;
- }
-
- public Image getImage() {
- return CompareUI.getImage(getType());
- }
-
- /**
- * Returns true if other is ITypedElement and names are equal.
- * @see IComparator#equals
- */
- public boolean equals(Object other) {
- if (other instanceof ITypedElement)
- return fName.equals(((ITypedElement) other).getName());
- return super.equals(other);
- }
-
- public int hashCode() {
- return fName.hashCode();
- }
- }
-
- static class ZipFolder extends ZipResource {
-
- private HashMap fChildren= new HashMap(10);
-
- ZipFolder(String name) {
- super(name);
- }
-
- public String getType() {
- return ITypedElement.FOLDER_TYPE;
- }
-
- public Object[] getChildren() {
- Object[] children= new Object[fChildren.size()];
- Iterator iter= fChildren.values().iterator();
- for (int i= 0; iter.hasNext(); i++)
- children[i]= iter.next();
- return children;
- }
-
- ZipFile createContainer(String path) {
- String entry= path;
- int pos= path.indexOf('/');
- if (pos < 0)
- pos= path.indexOf('\\');
- if (pos >= 0) {
- entry= path.substring(0, pos);
- path= path.substring(pos + 1);
- } else if (entry.length() > 0) {
- if (CompareUIPlugin.filter(path, false, true))
- return null;
- ZipFile ze= new ZipFile(entry);
- fChildren.put(entry, ze);
- return ze;
- } else
- return null;
-
- ZipFolder folder= null;
- if (fChildren != null) {
- Object o= fChildren.get(entry);
- if (o instanceof ZipFolder)
- folder= (ZipFolder) o;
- }
-
- if (folder == null) {
- if (path.length() > 0 && CompareUIPlugin.filter(path, true, true))
- return null;
- folder= new ZipFolder(entry);
- fChildren.put(entry, folder);
- }
-
- return folder.createContainer(path);
- }
- }
-
- static class ZipFile extends ZipResource implements IStreamContentAccessor {
-
- private byte[] fContents;
-
- ZipFile(String name) {
- super(name);
- }
-
- public String getType() {
- String s= this.getName();
- int pos= s.lastIndexOf('.');
- if (pos >= 0)
- return s.substring(pos + 1);
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- public Object[] getChildren() {
- return null;
- }
-
- public InputStream getContents() {
- if (fContents == null)
- fContents= new byte[0];
- return new ByteArrayInputStream(fContents);
- }
-
- byte[] getBytes() {
- return fContents;
- }
-
- void setBytes(byte[] buffer) {
- fContents= buffer;
- }
-
- void appendBytes(byte[] buffer, int length) {
- if (length > 0) {
- int oldLen= 0;
- if (fContents != null)
- oldLen= fContents.length;
- byte[] newBuf= new byte[oldLen + length];
- if (oldLen > 0)
- System.arraycopy(fContents, 0, newBuf, 0, oldLen);
- System.arraycopy(buffer, 0, newBuf, oldLen, length);
- fContents= newBuf;
- }
- }
- }
-
- private String fTitle;
-
- /**
- * Create a new ZipFileStructureCreator.
- */
- public ZipFileStructureCreator() {
- this(Utilities.getString("ZipStructureCreator.name")); //$NON-NLS-1$
- }
-
- /**
- * Create a new ZipFileStructureCreator with the given title.
- * The title is returned by the method <code>getName()</code>.
- * @param title the title of this strcuture creator
- */
- public ZipFileStructureCreator(String title) {
- fTitle= title;
- }
-
- public String getName() {
- return fTitle;
- }
-
- public IStructureComparator getStructure(Object input) {
-
- InputStream is= null;
-
- if (input instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) input;
- try {
- is= sca.getContents();
- } catch (CoreException ex) {
- // NeedWork
- }
- }
-
- if (is == null)
- return null;
-
- ZipInputStream zip= new ZipInputStream(is);
- ZipFolder root= new ZipFolder(""); //$NON-NLS-1$
- try {
- for (;;) {
- ZipEntry entry= zip.getNextEntry();
- if (entry == null)
- break;
-
- ZipFile ze= root.createContainer(entry.getName());
- if (ze != null) {
- int length= (int) entry.getSize();
- if (length >= 0) {
- byte[] buffer= new byte[length];
- int offset= 0;
-
- do {
- int n= zip.read(buffer, offset, length);
- offset += n;
- length -= n;
- } while (length > 0);
-
- ze.setBytes(buffer);
- } else {
- byte[] buffer= new byte[1024];
- int n;
- do {
- n= zip.read(buffer, 0, 1024);
- ze.appendBytes(buffer, n);
- } while (n >= 0);
- }
- }
- zip.closeEntry();
- }
- } catch (IOException ex) {
- return null;
- } finally {
- try {
- zip.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
-
- if (root.fChildren.size() == 1) {
- Iterator iter= root.fChildren.values().iterator();
- return (IStructureComparator) iter.next();
- }
- return root;
- }
-
- public String getContents(Object o, boolean ignoreWhitespace) {
- if (o instanceof ZipFile) {
- byte[] bytes= ((ZipFile)o).getBytes();
- if (bytes != null)
- return new String(bytes);
- return ""; //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Returns <code>false</code> since we cannot update a zip archive.
- * @return <code>false</code>
- */
- public boolean canSave() {
- return false;
- }
-
- /**
- * Called whenever a copy operation has been performed on a tree node.
- * This implementation throws an <code>AssertionFailedException</code>
- * since we cannot update a zip archive.
- *
- * @param structure the node for which to save the new content
- * @param input the object from which the structure tree was created in <code>getStructure</code>
- */
- public void save(IStructureComparator structure, Object input) {
- Assert.isTrue(false); // Cannot update zip archive
- }
-
- public IStructureComparator locate(Object path, Object source) {
- return null;
- }
-
- /**
- * Returns <code>false</code> since this <code>IStructureCreator</code>
- * cannot rewrite the diff tree in order to fold certain combinations of
- * additons and deletions.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- * @return <code>false</code>
- */
- public boolean canRewriteTree() {
- return false;
- }
-
- /**
- * Empty implementation since this <code>IStructureCreator</code>
- * cannot rewrite the diff tree in order to fold certain combinations of
- * additons and deletions.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- */
- public void rewriteTree(Differencer diff, IDiffContainer root) {
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
deleted file mode 100644
index 846a9ac77..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ /dev/null
@@ -1,978 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.compare.contentmergeviewer;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.ContentViewer;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.compare.internal.*;
-
-/**
- * An abstract compare and merge viewer with two side-by-side content areas
- * and an optional content area for the ancestor. The implementation makes no
- * assumptions about the content type.
- * <p>
- * <code>ContentMergeViewer</code>
- * <ul>
- * <li>implements the overall layout and defines hooks so that subclasses
- * can easily provide an implementation for a specific content type,
- * <li>implements the UI for making the areas resizable,
- * <li>has an action for controlling whether the ancestor area is visible or not,
- * <li>has actions for copying one side of the input to the other side,
- * <li>tracks the dirty state of the left and right sides and send out notification
- * on state changes.
- * </ul>
- * A <code>ContentMergeViewer</code> accesses its
- * model by means of a content provider which must implement the
- * <code>IMergeViewerContentProvider</code> interface.
- * </p>
- * <p>
- * Clients may wish to use the standard concrete subclass <code>TextMergeViewer</code>,
- * or define their own subclass.
- *
- * @see IMergeViewerContentProvider
- * @see TextMergeViewer
- */
-public abstract class ContentMergeViewer extends ContentViewer
- implements IPropertyChangeNotifier, ISavable {
-
- class SaveAction extends MergeViewerAction {
-
- SaveAction(boolean left) {
- super(true, false, false);
- Utilities.initAction(this, getResourceBundle(), "action.save."); //$NON-NLS-1$
- }
-
- public void run() {
- saveContent(getInput());
- }
- }
-
- /**
- * Property names.
- */
- private static final String ANCESTOR_ENABLED= ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE;
-
- /* package */ static final int HORIZONTAL= 1;
- /* package */ static final int VERTICAL= 2;
-
- static final double HSPLIT= 0.5;
- static final double VSPLIT= 0.3;
-
- private class ContentMergeViewerLayout extends Layout {
-
- public Point computeSize(Composite c, int w, int h, boolean force) {
- return new Point(100, 100);
- }
-
- public void layout(Composite composite, boolean force) {
-
- // determine some derived sizes
- int headerHeight= fLeftLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
- Rectangle r= composite.getClientArea();
-
- int centerWidth= getCenterWidth();
- int width1= (int)((r.width-centerWidth)*fHSplit);
- int width2= r.width-width1-centerWidth;
-
- int height1= 0;
- int height2= 0;
- if (fAncestorEnabled && fShowAncestor) {
- height1= (int)((r.height-(2*headerHeight))*fVSplit);
- height2= r.height-(2*headerHeight)-height1;
- } else {
- height1= 0;
- height2= r.height-headerHeight;
- }
-
- int y= 0;
-
- if (fAncestorEnabled && fShowAncestor) {
- fAncestorLabel.setBounds(0, y, r.width, headerHeight);
- fAncestorLabel.setVisible(true);
- y+= headerHeight;
- handleResizeAncestor(0, y, r.width, height1);
- y+= height1;
- } else {
- fAncestorLabel.setVisible(false);
- handleResizeAncestor(0, 0, 0, 0);
- }
-
- fLeftLabel.getSize(); // without this resizing would not always work
-
- if (centerWidth > 3) {
- fLeftLabel.setBounds(0, y, width1+1, headerHeight);
- fDirectionLabel.setVisible(true);
- fDirectionLabel.setBounds(width1+1, y, centerWidth-1, headerHeight);
- fRightLabel.setBounds(width1+centerWidth, y, width2, headerHeight);
- } else {
- fLeftLabel.setBounds(0, y, width1, headerHeight);
- fDirectionLabel.setVisible(false);
- fRightLabel.setBounds(width1, y, r.width-width1, headerHeight);
- }
-
- y+= headerHeight;
-
- if (fCenter != null && !fCenter.isDisposed())
- fCenter.setBounds(width1, y, centerWidth, height2);
-
- handleResizeLeftRight(0, y, width1, centerWidth, width2, height2);
- }
- }
-
- class Resizer extends MouseAdapter implements MouseMoveListener {
-
- Control fControl;
- int fX, fY;
- int fWidth1, fWidth2;
- int fHeight1, fHeight2;
- int fDirection;
- boolean fLiveResize;
- boolean fIsDown;
-
- public Resizer(Control c, int dir) {
- fDirection= dir;
- fControl= c;
- fLiveResize= !(fControl instanceof Sash);
- fControl.addMouseListener(this);
- fControl.addMouseMoveListener(this);
- fControl.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fControl= null;
- }
- }
- );
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- if ((fDirection & HORIZONTAL) != 0)
- fHSplit= HSPLIT;
- if ((fDirection & VERTICAL) != 0)
- fVSplit= VSPLIT;
- fComposite.layout(true);
- }
-
- public void mouseDown(MouseEvent e) {
- Composite parent= fControl.getParent();
-
- Point s= parent.getSize();
- Point as= fAncestorLabel.getSize();
- Point ys= fLeftLabel.getSize();
- Point ms= fRightLabel.getSize();
-
- fWidth1= ys.x;
- fWidth2= ms.x;
- fHeight1= fLeftLabel.getLocation().y-as.y;
- fHeight2= s.y-(fLeftLabel.getLocation().y+ys.y);
-
- fX= e.x;
- fY= e.y;
- fIsDown= true;
- }
-
- public void mouseUp(MouseEvent e) {
- fIsDown= false;
- if (!fLiveResize)
- resize(e);
- }
-
- public void mouseMove(MouseEvent e) {
- if (fIsDown && fLiveResize)
- resize(e);
- }
-
- private void resize(MouseEvent e) {
- int dx= e.x-fX;
- int dy= e.y-fY;
-
- int centerWidth= fCenter.getSize().x;
-
- if (fWidth1 + dx > centerWidth && fWidth2 - dx > centerWidth) {
- fWidth1+= dx;
- fWidth2-= dx;
- if ((fDirection & HORIZONTAL) != 0)
- fHSplit= (double)fWidth1/(double)(fWidth1+fWidth2);
- }
- if (fHeight1 + dy > centerWidth && fHeight2 - dy > centerWidth) {
- fHeight1+= dy;
- fHeight2-= dy;
- if ((fDirection & VERTICAL) != 0)
- fVSplit= (double)fHeight1/(double)(fHeight1+fHeight2);
- }
-
- fComposite.layout(true);
- fControl.getDisplay().update();
- }
- }
-
- /** Style bits for top level composite */
- private int fStyles;
- private ResourceBundle fBundle;
- private CompareConfiguration fCompareConfiguration;
- private IPropertyChangeListener fPropertyChangeListener;
- private ICompareInputChangeListener fCompareInputChangeListener;
- private ListenerList fListenerList;
- boolean fConfirmSave= true;
-
- private double fHSplit= HSPLIT; // width ratio of left and right panes
- private double fVSplit= VSPLIT; // height ratio of ancestor and bottom panes
-
- private boolean fAncestorEnabled= true; // show ancestor in case of conflicts
- /* package */ boolean fShowAncestor= false; // if current input has conflicts
- private boolean fIsThreeWay= false;
- private ActionContributionItem fAncestorItem;
-
- private Action fCopyLeftToRightAction; // copy from left to right
- private Action fCopyRightToLeftAction; // copy from right to left
-
- MergeViewerAction fLeftSaveAction;
- MergeViewerAction fRightSaveAction;
-
- private IKeyBindingService fKeyBindingService;
-
- // SWT widgets
- /* package */ Composite fComposite;
- private CLabel fAncestorLabel;
- private CLabel fLeftLabel;
- private CLabel fRightLabel;
- /* package */ CLabel fDirectionLabel;
- /* package */ Control fCenter;
-
- //---- SWT resources to be disposed
- private Image fRightArrow;
- private Image fLeftArrow;
- private Image fBothArrow;
- //---- end
-
- /**
- * Creates a new content merge viewer and initializes with a resource bundle and a
- * configuration.
- *
- * @param bundle the resource bundle
- * @param cc the configuration object
- */
- protected ContentMergeViewer(int style, ResourceBundle bundle, CompareConfiguration cc) {
- fStyles= style;
- fBundle= bundle;
-
- fAncestorEnabled= Utilities.getBoolean(cc, ANCESTOR_ENABLED, fAncestorEnabled);
- fConfirmSave= Utilities.getBoolean(cc, CompareEditor.CONFIRM_SAVE_PROPERTY, fConfirmSave);
-
- setContentProvider(new MergeViewerContentProvider(cc));
-
- fCompareInputChangeListener= new ICompareInputChangeListener() {
- public void compareInputChanged(ICompareInput input) {
- ContentMergeViewer.this.internalRefresh(input);
- }
- };
-
- fCompareConfiguration= cc;
- if (fCompareConfiguration != null) {
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- ContentMergeViewer.this.propertyChange(event);
- }
- };
- fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- fLeftSaveAction= new SaveAction(true);
- fLeftSaveAction.setEnabled(false);
- fRightSaveAction= new SaveAction(false);
- fRightSaveAction.setEnabled(false);
- }
-
- //---- hooks ---------------------
-
- /**
- * Returns the viewer's name.
- *
- * @return the viewer's name
- */
- public String getTitle() {
- return Utilities.getString(getResourceBundle(), "title"); //$NON-NLS-1$
- }
-
- /**
- * Creates the SWT controls for the ancestor, left, and right
- * content areas of this compare viewer.
- * Implementations typically hold onto the controls
- * so that they can be initialized with the input objects in method
- * <code>updateContent</code>.
- *
- * @param composite the container for the three areas
- */
- abstract protected void createControls(Composite composite);
-
- /**
- * Lays out the ancestor area of the compare viewer.
- * It is called whenever the viewer is resized or when the sashes between
- * the areas are moved to adjust the size of the areas.
- *
- * @param x the horizontal position of the ancestor area within its container
- * @param y the vertical position of the ancestor area within its container
- * @param width the width of the ancestor area
- * @param height the height of the ancestor area
- */
- abstract protected void handleResizeAncestor(int x, int y, int width, int height);
-
- /**
- * Lays out the left and right areas of the compare viewer.
- * It is called whenever the viewer is resized or when the sashes between
- * the areas are moved to adjust the size of the areas.
- *
- * @param x the horizontal position of the left area within its container
- * @param y the vertical position of the left and right area within its container
- * @param leftWidth the width of the left area
- * @param centerWidth the width of the gap between the left and right areas
- * @param rightWidth the width of the right area
- * @param height the height of the left and right areas
- */
- abstract protected void handleResizeLeftRight(int x, int y, int leftWidth, int centerWidth,
- int rightWidth, int height);
-
- /**
- * Contributes items to the given <code>ToolBarManager</code>.
- * It is called when this viewer is installed in its container and if the container
- * has a <code>ToolBarManager</code>.
- * The <code>ContentMergeViewer</code> implementation of this method does nothing.
- * Subclasses may reimplement.
- *
- * @param toolBarManager the toolbar manager to contribute to
- */
- protected void createToolItems(ToolBarManager toolBarManager) {
- }
-
- /**
- * Initializes the controls of the three content areas with the given input objects.
- *
- * @param ancestor the input for the ancestor area
- * @param left the input for the left area
- * @param right the input for the right area
- */
- abstract protected void updateContent(Object ancestor, Object left, Object right);
-
- /**
- * Copies the content of one side to the other side.
- * Called from the (internal) actions for copying the sides of the viewer's input object.
- *
- * @param leftToRight if <code>true</code>, the left side is copied to the right side;
- * if <code>false</code>, the right side is copied to the left side
- */
- abstract protected void copy(boolean leftToRight);
-
- /**
- * Returns the byte contents of the left or right side. If the viewer
- * has no editable content <code>null</code> can be returned.
- *
- * @param left if <code>true</code>, the byte contents of the left area is returned;
- * if <code>false</code>, the byte contents of the right area
- * @return the content as an array of bytes, or <code>null</code>
- */
- abstract protected byte[] getContents(boolean left);
-
- //----------------------------
-
- /**
- * Returns the resource bundle of this viewer.
- *
- * @return the resource bundle
- */
- protected ResourceBundle getResourceBundle() {
- return fBundle;
- }
-
- /**
- * Returns the compare configuration of this viewer,
- * or <code>null</code> if this viewer does not yet have a configuration.
- *
- * @return the compare configuration, or <code>null</code> if none
- */
- protected CompareConfiguration getCompareConfiguration() {
- return fCompareConfiguration;
- }
-
- /**
- * The <code>ContentMergeViewer</code> implementation of this
- * <code>ContentViewer</code> method
- * checks to ensure that the content provider is an <code>IMergeViewerContentProvider</code>.
- */
- public void setContentProvider(IContentProvider contentProvider) {
- Assert.isTrue(contentProvider instanceof IMergeViewerContentProvider);
- super.setContentProvider(contentProvider);
- }
-
- /* package */ IMergeViewerContentProvider getMergeContentProvider() {
- return (IMergeViewerContentProvider) getContentProvider();
- }
-
- /**
- * The <code>ContentMergeViewer</code> implementation of this
- * <code>Viewer</code> method returns the empty selection. Subclasses may override.
- */
- public ISelection getSelection() {
- return new ISelection() {
- public boolean isEmpty() {
- return true;
- }
- };
- }
-
- /**
- * The <code>ContentMergeViewer</code> implementation of this
- * <code>Viewer</code> method does nothing. Subclasses may reimplement.
- */
- public void setSelection(ISelection s, boolean reveal) {
- }
-
- /* package */ void propertyChange(PropertyChangeEvent event) {
-
- String key= event.getProperty();
-
- if (key.equals(ANCESTOR_ENABLED)) {
- fAncestorEnabled= Utilities.getBoolean(getCompareConfiguration(), ANCESTOR_ENABLED, fAncestorEnabled);
- fComposite.layout(true);
- return;
- }
- }
-
- void setAncestorVisibility(boolean visible, boolean enabled) {
- if (fAncestorItem != null) {
- Action action= (Action) fAncestorItem.getAction();
- if (action != null) {
- action.setChecked(visible);
- action.setEnabled(enabled);
- }
- }
- if (fCompareConfiguration != null)
- fCompareConfiguration.setProperty(ANCESTOR_ENABLED, new Boolean(visible));
- }
-
- //---- input
-
- /* package */ boolean isThreeWay() {
- return fIsThreeWay;
- }
-
- /**
- * Internal hook method called when the input to this viewer is
- * initially set or subsequently changed.
- * <p>
- * The <code>ContentMergeViewer</code> implementation of this <code>Viewer</code>
- * method tries to save the old input by calling <code>doSave(...)</code> and
- * then calls <code>internalRefresh(...)</code>.
- *
- * @param input the new input of this viewer, or <code>null</code> if there is no new input
- * @param oldInput the old input element, or <code>null</code> if there was previously no input
- */
- protected final void inputChanged(Object input, Object oldInput) {
-
- if (input != oldInput)
- if (oldInput instanceof ICompareInput)
- ((ICompareInput)oldInput).removeCompareInputChangeListener(fCompareInputChangeListener);
-
- boolean success= doSave(input, oldInput);
-
- if (input != oldInput)
- if (input instanceof ICompareInput)
- ((ICompareInput)input).addCompareInputChangeListener(fCompareInputChangeListener);
-
- if (success) {
- setLeftDirty(false);
- setRightDirty(false);
- }
-
- if (input != oldInput)
- internalRefresh(input);
- }
-
- /**
- * This method is called from the <code>Viewer</code> method <code>inputChanged</code>
- * to save any unsaved changes of the old input.
- * <p>
- * The <code>ContentMergeViewer</code> implementation of this
- * method calls <code>saveContent(...)</code>. If confirmation has been turned on
- * with <code>setConfirmSave(true)</code>, a confirmation alert is posted before saving.
- * </p>
- * Clients can override this method and are free to decide whether
- * they want to call the inherited method.
- * @param newInput the new input of this viewer, or <code>null</code> if there is no new input
- * @param oldInput the old input element, or <code>null</code> if there was previously no input
- * @return <code>true</code> if saving was successful, or if the user didn't want to save (by pressing 'NO' in the confirmation dialog).
- * @since 2.0
- */
- protected boolean doSave(Object newInput, Object oldInput) {
-
- // before setting the new input we have to save the old
- if (fLeftSaveAction.isEnabled() || fRightSaveAction.isEnabled()) {
-
- // post alert
- if (fConfirmSave) {
- Shell shell= fComposite.getShell();
-
- MessageDialog dialog= new MessageDialog(shell,
- Utilities.getString(getResourceBundle(), "saveDialog.title"), //$NON-NLS-1$
- null, // accept the default window icon
- Utilities.getString(getResourceBundle(), "saveDialog.message"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- },
- 0); // default button index
-
- switch (dialog.open()) { // open returns index of pressed button
- case 0:
- saveContent(oldInput);
- break;
- case 1:
- setLeftDirty(false);
- setRightDirty(false);
- break;
- case 2:
- throw new ViewerSwitchingCancelled();
- }
- } else
- saveContent(oldInput);
- return true;
- }
- return false;
- }
-
- /**
- * Controls whether <code>doSave(Object, Object)</code> asks for confirmation before saving
- * the old input with <code>saveContent(Object)</code>.
- * @param enable a value of <code>true</code> enables confirmation
- * @since 2.0
- */
- public void setConfirmSave(boolean enable) {
- fConfirmSave= enable;
- }
-
- /* (non Javadoc)
- * see Viewer.refresh
- */
- public void refresh() {
- internalRefresh(getInput());
- }
-
- private void internalRefresh(Object input) {
-
- IMergeViewerContentProvider content= getMergeContentProvider();
- if (content != null) {
- Object ancestor= content.getAncestorContent(input);
- if (input instanceof ICompareInput)
- fIsThreeWay= (((ICompareInput)input).getKind() & Differencer.DIRECTION_MASK) != 0;
- else
- fIsThreeWay= ancestor != null;
-
- if (fAncestorItem != null)
- fAncestorItem.setVisible(fIsThreeWay);
-
- boolean oldFlag= fShowAncestor;
- fShowAncestor= fIsThreeWay && content.showAncestor(input);
-
- if (fAncestorEnabled && oldFlag != fShowAncestor)
- fComposite.layout(true);
-
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(fComposite.getParent());
- if (tbm != null) {
- updateToolItems();
- tbm.update(true);
- tbm.getControl().getParent().layout(true);
- }
-
- updateHeader();
-
- Object left= content.getLeftContent(input);
- Object right= content.getRightContent(input);
- updateContent(ancestor, left, right);
- }
- }
-
- //---- layout & SWT control creation
-
- /**
- * Builds the SWT controls for the three areas of a compare/merge viewer.
- * <p>
- * Calls the hooks <code>createControls</code> and <code>createToolItems</code>
- * to let subclasses build the specific content areas and to add items to
- * an enclosing toolbar.
- * <p>
- * This method must only be called in the constructor of subclasses.
- *
- * @param parent the parent control
- * @return the new control
- */
- protected final Control buildControl(Composite parent) {
-
- fComposite= new Composite(parent, fStyles) {
- public boolean setFocus() {
- return internalSetFocus();
- }
- };
- fComposite.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
-
- hookControl(fComposite); // hook help & dispose listener
-
- fComposite.setLayout(new ContentMergeViewerLayout());
-
- int style= SWT.SHADOW_OUT;
- fAncestorLabel= new CLabel(fComposite, style);
-
- fLeftLabel= new CLabel(fComposite, style);
- new Resizer(fLeftLabel, VERTICAL);
-
- fDirectionLabel= new CLabel(fComposite, style);
- fDirectionLabel.setAlignment(SWT.CENTER);
- new Resizer(fDirectionLabel, HORIZONTAL | VERTICAL);
-
- fRightLabel= new CLabel(fComposite, style);
- new Resizer(fRightLabel, VERTICAL);
-
- if (fCenter == null || fCenter.isDisposed())
- fCenter= createCenter(fComposite);
-
- createControls(fComposite);
-
- IWorkbenchPartSite ps= Utilities.findSite(fComposite);
- fKeyBindingService= ps != null ? ps.getKeyBindingService() : null;
-
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
-
- // define groups
- tbm.add(new Separator("modes")); //$NON-NLS-1$
- tbm.add(new Separator("merge")); //$NON-NLS-1$
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
-
- CompareConfiguration cc= getCompareConfiguration();
-
- if (cc.isRightEditable()) {
- fCopyLeftToRightAction=
- new Action() {
- public void run() {
- copy(true);
- }
- };
- Utilities.initAction(fCopyLeftToRightAction, getResourceBundle(), "action.CopyLeftToRight."); //$NON-NLS-1$
- tbm.appendToGroup("merge", fCopyLeftToRightAction); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, fCopyLeftToRightAction, "org.eclipse.compare.copyAllLeftToRight"); //$NON-NLS-1$
- }
-
- if (cc.isLeftEditable()) {
- fCopyRightToLeftAction=
- new Action() {
- public void run() {
- copy(false);
- }
- };
- Utilities.initAction(fCopyRightToLeftAction, getResourceBundle(), "action.CopyRightToLeft."); //$NON-NLS-1$
- tbm.appendToGroup("merge", fCopyRightToLeftAction); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, fCopyRightToLeftAction, "org.eclipse.compare.copyAllRightToLeft"); //$NON-NLS-1$
- }
-
- Action a= new ChangePropertyAction(fBundle, fCompareConfiguration, "action.EnableAncestor.", ANCESTOR_ENABLED); //$NON-NLS-1$
- a.setChecked(fAncestorEnabled);
- fAncestorItem= new ActionContributionItem(a);
- fAncestorItem.setVisible(false);
- tbm.appendToGroup("modes", fAncestorItem); //$NON-NLS-1$
-
- createToolItems(tbm);
- updateToolItems();
-
- tbm.update(true);
- }
-
- return fComposite;
- }
-
- /* package */ boolean internalSetFocus() {
- return false;
- }
-
- /* package */ int getCenterWidth() {
- return 3;
- }
-
- /* package */ boolean getAncestorEnabled() {
- return fAncestorEnabled;
- }
-
- /* package */ Control createCenter(Composite parent) {
- Sash sash= new Sash(parent, SWT.VERTICAL);
- new Resizer(sash, HORIZONTAL);
- return sash;
- }
-
- /* package */ Control getCenter() {
- return fCenter;
- }
-
- /*
- * @see Viewer.getControl()
- */
- public Control getControl() {
- return fComposite;
- }
-
- /**
- * Called on the viewer disposal.
- * Unregisters from the compare configuration.
- * Clients may extend if they have to do additional cleanup.
- */
- protected void handleDispose(DisposeEvent event) {
-
- if (fKeyBindingService != null) {
- if (fCopyLeftToRightAction != null)
- fKeyBindingService.unregisterAction(fCopyLeftToRightAction);
- if (fCopyRightToLeftAction != null)
- fKeyBindingService.unregisterAction(fCopyRightToLeftAction);
- fKeyBindingService= null;
- }
-
- Object input= getInput();
- if (input instanceof ICompareInput)
- ((ICompareInput)input).removeCompareInputChangeListener(fCompareInputChangeListener);
-
- if (fCompareConfiguration != null && fPropertyChangeListener != null) {
- fCompareConfiguration.removePropertyChangeListener(fPropertyChangeListener);
- fPropertyChangeListener= null;
- }
-
- fAncestorLabel= null;
- fLeftLabel= null;
- fDirectionLabel= null;
- fRightLabel= null;
- fCenter= null;
-
- if (fRightArrow != null) {
- fRightArrow.dispose();
- fRightArrow= null;
- }
- if (fLeftArrow != null) {
- fLeftArrow.dispose();
- fLeftArrow= null;
- }
- if (fBothArrow != null) {
- fBothArrow.dispose();
- fBothArrow= null;
- }
-
- super.handleDispose(event);
- }
-
- /**
- * Updates the enabled state of the toolbar items.
- * <p>
- * This method is called whenever the state of the items needs updating.
- * <p>
- * Subclasses may extend this method, although this is generally not required.
- */
- protected void updateToolItems() {
-
- IMergeViewerContentProvider content= getMergeContentProvider();
-
- Object input= getInput();
-
- if (fCopyLeftToRightAction != null) {
- boolean enable= content.isRightEditable(input);
-// if (enable && input instanceof ICompareInput) {
-// ITypedElement e= ((ICompareInput) input).getLeft();
-// if (e == null)
-// enable= false;
-// }
- fCopyLeftToRightAction.setEnabled(enable);
- }
-
- if (fCopyRightToLeftAction != null) {
- boolean enable= content.isLeftEditable(input);
-// if (enable && input instanceof ICompareInput) {
-// ITypedElement e= ((ICompareInput) input).getRight();
-// if (e == null)
-// enable= false;
-// }
- fCopyRightToLeftAction.setEnabled(enable);
- }
- }
-
- /**
- * Updates the headers of the three areas
- * by querying the content provider for a name and image for
- * the three sides of the input object.
- * <p>
- * This method is called whenever the header must be updated.
- * <p>
- * Subclasses may extend this method, although this is generally not required.
- */
- protected void updateHeader() {
-
- IMergeViewerContentProvider content= getMergeContentProvider();
- Object input= getInput();
-
- if (fAncestorLabel != null) {
- fAncestorLabel.setImage(content.getAncestorImage(input));
- fAncestorLabel.setText(content.getAncestorLabel(input));
- }
- if (fLeftLabel != null) {
- fLeftLabel.setImage(content.getLeftImage(input));
- fLeftLabel.setText(content.getLeftLabel(input));
- }
- if (fRightLabel != null) {
- fRightLabel.setImage(content.getRightImage(input));
- fRightLabel.setText(content.getRightLabel(input));
- }
- }
-
-// private Image loadImage(String name) {
-// ImageDescriptor id= ImageDescriptor.createFromFile(ContentMergeViewer.class, name);
-// if (id != null)
-// return id.createImage();
-// return null;
-// }
-
- /**
- * Calculates the height of the header.
- */
- /* package */ int getHeaderHeight() {
- int headerHeight= fLeftLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
- headerHeight= Math.max(headerHeight, fDirectionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y);
- return headerHeight;
- }
-
- //---- merge direction
-
- /**
- * Returns true if both sides are editable.
- */
- /* package */ boolean canToggleMergeDirection() {
- IMergeViewerContentProvider content= getMergeContentProvider();
- Object input= getInput();
- return content.isLeftEditable(input) && content.isRightEditable(input);
- }
-
- //---- dirty state & saving state
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.addPropertyChangeListener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fListenerList == null)
- fListenerList= new ListenerList();
- fListenerList.add(listener);
- }
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.removePropertyChangeListener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fListenerList != null) {
- fListenerList.remove(listener);
- if (fListenerList.isEmpty())
- fListenerList= null;
- }
- }
-
- /* package */ void fireDirtyState(boolean state) {
- Utilities.firePropertyChange(fListenerList, this, CompareEditorInput.DIRTY_STATE, null, new Boolean(state));
- }
-
- /**
- * Sets the dirty state of the left side of this viewer.
- * If the new value differs from the old
- * all registered listener are notified with
- * a <code>PropertyChangeEvent</code> with the
- * property name <code>CompareEditorInput.DIRTY_STATE</code>.
- *
- * @param dirty the state of the left side dirty flag
- */
- protected void setLeftDirty(boolean dirty) {
- if (fLeftSaveAction.isEnabled() != dirty) {
- fLeftSaveAction.setEnabled(dirty);
- fireDirtyState(dirty);
- }
- }
-
- /**
- * Sets the dirty state of the right side of this viewer.
- * If the new value differs from the old
- * all registered listener are notified with
- * a <code>PropertyChangeEvent</code> with the
- * property name <code>CompareEditorInput.DIRTY_STATE</code>.
- *
- * @param dirty the state of the right side dirty flag
- */
- protected void setRightDirty(boolean dirty) {
- if (fRightSaveAction.isEnabled() != dirty) {
- fRightSaveAction.setEnabled(dirty);
- fireDirtyState(dirty);
- }
- }
-
- /**
- * Save the viewers's content.
- * Note: this method is for internal use only. Clients should not call this method.
- * @since 2.0
- */
- public void save(IProgressMonitor pm) throws CoreException {
- saveContent(getInput());
- }
-
- /**
- * Save modified content back to input elements via the content provider.
- */
- /* package */ void saveContent(Object oldInput) {
-
- // write back modified contents
- IMergeViewerContentProvider content= (IMergeViewerContentProvider) getContentProvider();
-
- boolean leftEmpty= content.getLeftContent(oldInput) == null;
- boolean rightEmpty= content.getRightContent(oldInput) == null;
-
- if (fCompareConfiguration.isLeftEditable() && fLeftSaveAction.isEnabled()) {
- byte[] bytes= getContents(true);
- if (leftEmpty && bytes != null && bytes.length == 0)
- bytes= null;
- setLeftDirty(false);
- content.saveLeftContent(oldInput, bytes);
- }
-
- if (fCompareConfiguration.isRightEditable() && fRightSaveAction.isEnabled()) {
- byte[] bytes= getContents(false);
- if (rightEmpty && bytes != null && bytes.length == 0)
- bytes= null;
- setRightDirty(false);
- content.saveRightContent(oldInput, bytes);
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java
deleted file mode 100644
index 7918ba558..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.core.runtime.IProgressMonitor;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-
-
-class DelayedProgressMonitor implements IProgressMonitor {
-
- ProgressMonitorDialog fProgressDialog;
- IProgressMonitor fRealProgressMonitor;
- String fTaskName;
- String fSubTaskName;
- int fTotalWork;
- int fWorked;
- boolean fCancelable;
- Shell fShell;
- int fTime;
-
-
- DelayedProgressMonitor(Shell shell) {
- fShell= shell;
- }
-
- /*
- * @see IProgressMonitor#beginTask(String, int)
- */
- public void beginTask(String name, int totalWork) {
- fTaskName= name;
- fTotalWork= totalWork;
- fTime= 0;
- }
-
- /*
- * @see IProgressMonitor#done()
- */
- public void done() {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.done();
- }
-
- /*
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- if (fRealProgressMonitor != null) {
- fRealProgressMonitor.internalWorked(work);
- }
- }
-
- private void checkTimeout() {
- if (fRealProgressMonitor == null) {
-
- //if (fTime++ < 100)
- // return;
-
- fProgressDialog= new ProgressMonitorDialog(fShell);
- fProgressDialog.setCancelable(true);
- fProgressDialog.open();
- fRealProgressMonitor= fProgressDialog.getProgressMonitor();
- fRealProgressMonitor.beginTask(fTaskName, fTotalWork);
- if (fSubTaskName != null)
- fRealProgressMonitor.subTask(fSubTaskName);
- fRealProgressMonitor.worked(fWorked);
- }
- }
-
- /*
- * @see IProgressMonitor#isCanceled()
- */
- public boolean isCanceled() {
- checkTimeout();
- if (fRealProgressMonitor != null)
- return fRealProgressMonitor.isCanceled();
- return false;
- }
-
- /*
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean value) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.setCanceled(value);
- else
- fCancelable= value;
- }
-
- /*
- * @see IProgressMonitor#setTaskName(String)
- */
- public void setTaskName(String name) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.setTaskName(name);
- else
- fTaskName= name;
- }
-
- /*
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.subTask(name);
- else
- fSubTaskName= name;
- }
-
- /*
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.internalWorked(work);
- else {
- fWorked+= work;
- checkTimeout();
- }
- }
-
- public static void run(Shell shell, boolean fork, boolean cancelable, IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
-
- DelayedProgressMonitor pm= new DelayedProgressMonitor(shell);
- pm.checkTimeout();
- try {
- ModalContext.run(runnable, fork, pm, shell.getDisplay());
- } finally {
- if (pm.fProgressDialog != null)
- pm.fProgressDialog.close();
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
deleted file mode 100644
index fedb53161..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * Defines a subrange in a document.
- * <p>
- * It is used by text viewers that can work on a subrange of a document. For example,
- * a text viewer for Java compilation units might use this to restrict the view
- * to a single method.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see TextMergeViewer
- * @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode
- */
-public interface IDocumentRange {
-
- /**
- * The position category typically used for an <code>IDocumentRange</code> position
- * (value <code>"DocumentRangeCategory"</code>).
- * @since 2.0
- */
- public static final String RANGE_CATEGORY= "DocumentRangeCategory"; //$NON-NLS-1$
-
- /**
- * Returns the underlying document.
- *
- * @return the underlying document
- */
- IDocument getDocument();
-
- /**
- * Returns a position that specifies a subrange in the underlying document,
- * or <code>null</code> if this document range spans the whole underlying document.
- *
- * @return a position that specifies a subrange in the underlying document, or <code>null</code>
- */
- Position getRange();
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
deleted file mode 100644
index 90e1f0139..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.jface.viewers.IContentProvider;
-
-
-/**
- * A content provider that mediates between a <code>ContentMergeViewer</code>'s model
- * and the viewer itself.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see ContentMergeViewer
- */
-public interface IMergeViewerContentProvider extends IContentProvider {
-
- //---- ancestor side
-
- /**
- * Returns the label for the ancestor side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the label for the ancestor side of a <code>ContentMergeViewer</code>
- */
- String getAncestorLabel(Object input);
-
- /**
- * Returns an optional image for the ancestor side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the image for the ancestor side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Image getAncestorImage(Object input);
-
- /**
- * Returns the contents for the ancestor side of a <code>ContentMergeViewer</code>.
- * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the content for the ancestor side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Object getAncestorContent(Object input);
-
- /**
- * Returns whether the ancestor side of the given input element should be shown.
- *
- * @return <code>true</code> if the ancestor side of the given input element should be shown
- */
- boolean showAncestor(Object input);
-
- //---- left side
-
- /**
- * Returns the label for the left side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the label for the left side of a <code>ContentMergeViewer</code>
- */
- String getLeftLabel(Object input);
-
- /**
- * Returns an optional image for the left side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the image for the left side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Image getLeftImage(Object input);
-
- /**
- * Returns the contents for the left side of a <code>ContentMergeViewer</code>.
- * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the content for the left side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Object getLeftContent(Object input);
-
- /**
- * Returns whether the left side is editable.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return <code>true</code> if the left side of a <code>ContentMergeViewer</code> is editable
- */
- boolean isLeftEditable(Object input);
-
- /**
- * Saves new contents for the left side of the <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @param bytes the new contents to save for the left side
- */
- void saveLeftContent(Object input, byte[] bytes);
-
- //---- right side
-
- /**
- * Returns the label for the right side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the label for the right side of a <code>ContentMergeViewer</code>
- */
- String getRightLabel(Object input);
-
- /**
- * Returns an optional image for the right side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the image for the right side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Image getRightImage(Object input);
-
- /**
- * Returns the contents for the right side of a <code>ContentMergeViewer</code>.
- * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the content for the right side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Object getRightContent(Object input);
-
- /**
- * Returns whether the right side is editable.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return <code>true</code> if the right side of a <code>ContentMergeViewer</code> is editable
- */
- boolean isRightEditable(Object input);
-
- /**
- * Saves new contents for the right side of the <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @param bytes the new contents to save for the right side
- */
- void saveRightContent(Object input, byte[] bytes);
-}
-
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
deleted file mode 100644
index 43f03f1f4..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.compare.rangedifferencer.IRangeComparator;
-
-
-/**
- * For performing a so-called "token compare" on a line of text.
- * This interface extends the <code>IRangeComparator</code> interface
- * so that it can be used by the <code>TextMergeViewer</code>.
- * <p>
- * <code>TextMergeViewer</code> activates the token compare when navigating into
- * a range of differing lines. At first the lines are selected as a block.
- * When navigating into this block the token compare shows for every line
- * the differing token by selecting them.
- * <p>
- * <code>TextMergeViewer</code>'s default token comparator works on characters separated
- * by whitespace. If a different strategy is needed (for example, to use Java tokens in
- * a Java-aware merge viewer), clients may create their own token
- * comparators by implementing this interface (and overriding the
- * <code>TextMergeViewer.createTokenComparator</code> factory method).
- * </p>
- *
- * @see TextMergeViewer
- */
-public interface ITokenComparator extends IRangeComparator {
-
- /**
- * Returns the start character position of the token with the given index.
- * If the index is out of range (but not negative) the character position
- * behind the last character (the length of the input string) is returned.
- *
- * @param index index of the token for which to return the start position
- * @return the start position of the token with the given index
- * @throws java.lang.IndexOutOfBoundsException if index is negative
- */
- int getTokenStart(int index);
-
- /**
- * Returns the character length of the token with the given index.
- * If the index is out of range (but not negative) the value 0 is returned.
- *
- * @param index index of the token for which to return the start position
- * @return the character length of the token with the given index
- * @throws java.lang.IndexOutOfBoundsException if index is negative
- */
- int getTokenLength(int index);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
deleted file mode 100644
index afe0b5051..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ /dev/null
@@ -1,4151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * channingwalton@mac.com - curved line code
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ResourceBundle;
-import java.text.MessageFormat;
-
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.compare.internal.MergeSourceViewer;
-import org.eclipse.compare.internal.BufferedCanvas;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.internal.TokenComparator;
-import org.eclipse.compare.internal.DocLineComparator;
-import org.eclipse.compare.internal.ComparePreferencePage;
-import org.eclipse.compare.internal.INavigatable;
-import org.eclipse.compare.internal.CompareNavigator;
-import org.eclipse.compare.internal.TimeoutContext;
-import org.eclipse.compare.internal.DocumentManager;
-import org.eclipse.compare.internal.CompareMessages;
-import org.eclipse.compare.rangedifferencer.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-/**
- * A text merge viewer uses the <code>RangeDifferencer</code> to perform a
- * textual, line-by-line comparison of two (or three) input documents.
- * It is based on the <code>ContentMergeViewer</code> and uses <code>TextViewer</code>s
- * to implement the ancestor, left, and right content areas.
- * <p>
- * In the three-way compare case ranges of differing lines are highlighted and framed
- * with different colors to show whether the difference is an incoming, outgoing, or conflicting change.
- * The <code>TextMergeViewer</code> supports the notion of a current "differing range"
- * and provides toolbar buttons to navigate from one range to the next (or previous).
- * <p>
- * If there is a current "differing range" and the underlying document is editable
- * the <code>TextMergeViewer</code> enables actions in context menu and toolbar to
- * copy a range from one side to the other side, thereby performing a merge operation.
- * <p>
- * In addition to a line-by-line comparison the <code>TextMergeViewer</code>
- * uses a token based compare on differing lines.
- * The token compare is activated when navigating into
- * a range of differing lines. At first the lines are selected as a block.
- * When navigating into this block the token compare shows for every line
- * the differing token by selecting them.
- * <p>
- * The <code>TextMergeViewer</code>'s default token compare works on characters separated
- * by whitespace. If a different strategy is needed (for example, Java tokens in
- * a Java-aware merge viewer), clients can create their own token
- * comparators by implementing the <code>ITokenComparator</code> interface and overriding the
- * <code>TextMergeViewer.createTokenComparator</code> factory method).
- * <p>
- * Access to the <code>TextMergeViewer</code>'s model is by means of an
- * <code>IMergeViewerContentProvider</code>. Its <code>get<it>X</it></code>Content</code> methods must return
- * either an <code>IDocument</code>, an <code>IDocumentRange</code>, or an <code>IStreamContentAccessor</code>.
- * In the <code>IDocumentRange</code> case the <code>TextMergeViewer</code>
- * works on a subrange of a document. In the <code>IStreamContentAccessor</code> case
- * a document is created internally and initialized from the stream.
- * <p>
- * A <code>TextMergeViewer</code> can be used as is. However clients may subclass
- * to customize the behavior. For example a <code>MergeTextViewer</code> for Java would override
- * the <code>configureTextViewer</code> method to configure the <code>TextViewer</code> for Java source code,
- * the <code>createTokenComparator</code> method to create a Java specific tokenizer.
- *
- * @see org.eclipse.compare.rangedifferencer.RangeDifferencer
- * @see org.eclipse.jface.text.TextViewer
- * @see ITokenComparator
- * @see IDocumentRange
- * @see org.eclipse.compare.IStreamContentAccessor
- */
-public class TextMergeViewer extends ContentMergeViewer {
-
- private static final boolean DEBUG= false;
-
- private static final String[] GLOBAL_ACTIONS= {
- ActionFactory.UNDO.getId(),
- ActionFactory.REDO.getId(),
- ActionFactory.CUT.getId(),
- ActionFactory.COPY.getId(),
- ActionFactory.PASTE.getId(),
- ActionFactory.DELETE.getId(),
- ActionFactory.SELECT_ALL.getId(),
- ActionFactory.SAVE.getId()
- };
- private static final String[] TEXT_ACTIONS= {
- MergeSourceViewer.UNDO_ID,
- MergeSourceViewer.REDO_ID,
- MergeSourceViewer.CUT_ID,
- MergeSourceViewer.COPY_ID,
- MergeSourceViewer.PASTE_ID,
- MergeSourceViewer.DELETE_ID,
- MergeSourceViewer.SELECT_ALL_ID,
- MergeSourceViewer.SAVE_ID
- };
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.contentmergeviewer.TextMergeViewerResources"; //$NON-NLS-1$
-
- // constants
- /** Width of left and right vertical bar */
- private static final int MARGIN_WIDTH= 6;
- /** Width of center bar */
- private static final int CENTER_WIDTH= 34;
- /** Width of birds eye view */
- private static final int BIRDS_EYE_VIEW_WIDTH= 12;
- /** Width of birds eye view */
- private static final int BIRDS_EYE_VIEW_INSET= 2;
- /** */
- private static final int RESOLVE_SIZE= 5;
- /** if true copying conflicts from one side to other concatenates both sides */
- private static final boolean APPEND_CONFLICT= true;
-
- /** line width of change borders */
- private static final int LW= 1;
- /** Selects between smartTokenDiff and mergingTokenDiff */
- private static final boolean USE_MERGING_TOKEN_DIFF= false;
- /** When calculating differences show Progress after this timeout (in milliseconds) */
- private static final int TIMEOUT= 2000;
-
- // determines whether a change between left and right is considered incoming or outgoing
- private boolean fLeftIsLocal;
- private boolean fShowCurrentOnly= false;
- private boolean fShowCurrentOnly2= false;
- private int fMarginWidth= MARGIN_WIDTH;
- private int fTopInset;
-
- // Colors
- private RGB fBackground;
- private RGB fForeground;
- private boolean fPollSystemForeground= true;
- private boolean fPollSystemBackground= true;
-
- private RGB SELECTED_INCOMING;
- private RGB INCOMING;
- private RGB INCOMING_FILL;
-
- private RGB SELECTED_CONFLICT;
- private RGB CONFLICT;
- private RGB CONFLICT_FILL;
-
- private RGB SELECTED_OUTGOING;
- private RGB OUTGOING;
- private RGB OUTGOING_FILL;
-
- private RGB RESOLVED;
-
- private boolean fEndOfDocReached;
- private IDocumentListener fDocumentListener;
-
- private IPreferenceStore fPreferenceStore;
- private IPropertyChangeListener fPreferenceChangeListener;
-
- /** All diffs for calculating scrolling position (includes line ranges without changes) */
- private ArrayList fAllDiffs;
- /** Subset of above: just real differences. */
- private ArrayList fChangeDiffs;
- /** The current diff */
- private Diff fCurrentDiff;
-
- private HashMap fNewAncestorRanges= new HashMap();
- private HashMap fNewLeftRanges= new HashMap();
- private HashMap fNewRightRanges= new HashMap();
-
- private MergeSourceViewer fAncestor;
- private MergeSourceViewer fLeft;
- private MergeSourceViewer fRight;
-
- private int fLeftLineCount;
- private int fRightLineCount;
-
- private boolean fInScrolling;
-
- private int fPts[]= new int[8]; // scratch area for polygon drawing
-
- private boolean fIgnoreAncestor= false;
- private ActionContributionItem fIgnoreAncestorItem;
- private boolean fHiglightRanges;
-
- private boolean fShowPseudoConflicts= false;
-
- private boolean fUseSplines= true;
- private boolean fUseSingleLine= true;
- private boolean fUseResolveUI= fUseSingleLine; // resolve UI only for single lines private boolean fShowSummeryIcon;
-
- private String fSymbolicFontName;
-
- private ActionContributionItem fNextItem; // goto next difference
- private ActionContributionItem fPreviousItem; // goto previous difference
- private ActionContributionItem fCopyDiffLeftToRightItem;
- private ActionContributionItem fCopyDiffRightToLeftItem;
-
- private IKeyBindingService fKeyBindingService;
-
- private boolean fSynchronizedScrolling= true;
- private boolean fShowMoreInfo= false;
-
- private MergeSourceViewer fFocusPart;
-
- private boolean fSubDoc= true;
- private IPositionUpdater fPositionUpdater;
- private boolean fIsMotif;
- private boolean fIsCarbon;
-
-
- // SWT widgets
- private BufferedCanvas fAncestorCanvas;
- private BufferedCanvas fLeftCanvas;
- private BufferedCanvas fRightCanvas;
- private Canvas fScrollCanvas;
- private ScrollBar fVScrollBar;
- private Canvas fBirdsEyeCanvas;
- private Canvas fSummaryHeader;
- private HeaderPainter fHeaderPainter;
-
- // SWT resources to be disposed
- private Map fColors;
- private Cursor fBirdsEyeCursor;
-
- // points for center curves
- private double[] fBasicCenterCurve;
-
- private Button fCenterButton;
- private Diff fButtonDiff;
-
- class HeaderPainter implements PaintListener {
-
- private static final int INSET= BIRDS_EYE_VIEW_INSET;
-
- private RGB fIndicatorColor;
- private Color fSeparatorColor;
-
- public HeaderPainter() {
- fSeparatorColor= getColor(fSummaryHeader.getDisplay(), ViewForm.borderInsideRGB);
- }
-
- /**
- * Returns true on color change
- */
- public boolean setColor(RGB color) {
- RGB oldColor= fIndicatorColor;
- fIndicatorColor= color;
- if (color == null)
- return oldColor != null;
- if (oldColor != null)
- return !color.equals(oldColor);
- return true;
- }
-
- private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) {
- gc.setForeground(topLeft);
- gc.drawLine(x, y, x + w -1, y);
- gc.drawLine(x, y, x, y + h -1);
-
- gc.setForeground(bottomRight);
- gc.drawLine(x + w, y, x + w, y + h);
- gc.drawLine(x, y + h, x + w, y + h);
- }
-
- public void paintControl(PaintEvent e) {
-
- Point s= fSummaryHeader.getSize();
-
- if (fIndicatorColor != null) {
- Display d= fSummaryHeader.getDisplay();
- e.gc.setBackground(getColor(d, fIndicatorColor));
- int min= Math.min(s.x, s.y)-2*INSET;
- Rectangle r= new Rectangle((s.x-min)/2, (s.y-min)/2, min, min);
- e.gc.fillRectangle(r);
- if (d != null)
- drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
-
- e.gc.setForeground(fSeparatorColor);
- e.gc.setLineWidth(1);
- e.gc.drawLine(0+1, s.y-1, s.x-1-1, s.y-1);
- }
- }
- }
-
- /**
- * The position updater used to adapt the positions representing
- * the child document ranges to changes of the parent document.
- */
- class ChildPositionUpdater extends DefaultPositionUpdater {
-
- /**
- * Creates the position updated.
- */
- protected ChildPositionUpdater(String category) {
- super(category);
- }
-
- /**
- * Child document ranges cannot be deleted other then by calling
- * freeChildDocument.
- */
- protected boolean notDeleted() {
- return true;
- }
-
- /**
- * If an insertion happens at a child document's start offset, the
- * position is extended rather than shifted. Also, if something is added
- * right behind the end of the position, the position is extended rather
- * than kept stable.
- */
- protected void adaptToInsert() {
-
- if (fPosition == fLeft.getRegion() || fPosition == fRight.getRegion()) {
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length;
- myEnd= Math.max(myStart, myEnd);
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fReplaceLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart)
- return;
-
- if (myStart <= yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
- } else {
- super.adaptToInsert();
- }
- }
- }
-
- /**
- * A Diff represents synchronized character ranges in two or three Documents.
- * The MergeTextViewer uses Diffs to find differences in line and token ranges.
- */
- /* package */ class Diff {
- /** character range in ancestor document */
- Position fAncestorPos;
- /** character range in left document */
- Position fLeftPos;
- /** character range in right document */
- Position fRightPos;
- /** if this is a TokenDiff fParent points to the enclosing LineDiff */
- Diff fParent;
- /** if Diff has been resolved */
- boolean fResolved;
- int fDirection;
- boolean fIsToken= false;
- /** child token diffs */
- ArrayList fDiffs;
- boolean fIsWhitespace= false;
-
- /**
- * Create Diff from two ranges and an optional parent diff.
- */
- Diff(Diff parent, int dir, IDocument ancestorDoc, Position aRange, int ancestorStart, int ancestorEnd,
- IDocument leftDoc, Position lRange, int leftStart, int leftEnd,
- IDocument rightDoc, Position rRange, int rightStart, int rightEnd) {
- fParent= parent != null ? parent : this;
- fDirection= dir;
-
- fLeftPos= createPosition(leftDoc, lRange, leftStart, leftEnd);
- fRightPos= createPosition(rightDoc, rRange, rightStart, rightEnd);
- if (ancestorDoc != null)
- fAncestorPos= createPosition(ancestorDoc, aRange, ancestorStart, ancestorEnd);
- }
-
- Position getPosition(char type) {
- switch (type) {
- case 'A':
- return fAncestorPos;
- case 'L':
- return fLeftPos;
- case 'R':
- return fRightPos;
- }
- return null;
- }
-
- boolean isInRange(char type, int pos) {
- Position p= getPosition(type);
- return (pos >= p.offset) && (pos < (p.offset+p.length));
- }
-
- String changeType() {
- boolean leftEmpty= fLeftPos.length == 0;
- boolean rightEmpty= fRightPos.length == 0;
-
- if (fDirection == RangeDifference.LEFT) {
- if (!leftEmpty && rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.addition"); //$NON-NLS-1$
- if (leftEmpty && !rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.deletion"); //$NON-NLS-1$
- } else {
- if (leftEmpty && !rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.addition"); //$NON-NLS-1$
- if (!leftEmpty && rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.deletion"); //$NON-NLS-1$
- }
- return CompareMessages.getString("TextMergeViewer.changeType.change"); //$NON-NLS-1$
- }
-
- Image getImage() {
- int code= Differencer.CHANGE;
- switch (fDirection) {
- case RangeDifference.RIGHT:
- code+= Differencer.LEFT;
- break;
- case RangeDifference.LEFT:
- code+= Differencer.RIGHT;
- break;
- case RangeDifference.ANCESTOR:
- case RangeDifference.CONFLICT:
- code+= Differencer.CONFLICTING;
- break;
- }
- if (code != 0)
- return getCompareConfiguration().getImage(code);
- return null;
- }
-
- Position createPosition(IDocument doc, Position range, int start, int end) {
- try {
- int l= end-start;
- if (range != null) {
- int dl= range.length;
- if (l > dl)
- l= dl;
- } else {
- int dl= doc.getLength();
- if (start+l > dl)
- l= dl-start;
- }
-
- Position p= null;
- try {
- p= new Position(start, l);
- } catch (RuntimeException ex) {
- // silently ignored
- }
-
- try {
- doc.addPosition(IDocumentRange.RANGE_CATEGORY, p);
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- }
- return p;
- } catch (BadLocationException ee) {
- // silently ignored
- }
- return null;
- }
-
- void add(Diff d) {
- if (fDiffs == null)
- fDiffs= new ArrayList();
- fDiffs.add(d);
- }
-
- boolean isDeleted() {
- if (fAncestorPos != null && fAncestorPos.isDeleted())
- return true;
- return fLeftPos.isDeleted() || fRightPos.isDeleted();
- }
-
- void setResolved(boolean r) {
- fResolved= r;
- if (r)
- fDiffs= null;
- }
-
- boolean isResolved() {
- if (!fResolved && fDiffs != null) {
- Iterator e= fDiffs.iterator();
- while (e.hasNext()) {
- Diff d= (Diff) e.next();
- if (!d.isResolved())
- return false;
- }
- return true;
- }
- return fResolved;
- }
-
-// private boolean isIncoming() {
-// switch (fDirection) {
-// case RangeDifference.RIGHT:
-// if (fLeftIsLocal)
-// return true;
-// break;
-// case RangeDifference.LEFT:
-// if (!fLeftIsLocal)
-// return true;
-// break;
-// }
-// return false;
-// }
-
- private boolean isIncomingOrConflicting() {
- switch (fDirection) {
- case RangeDifference.RIGHT:
- if (fLeftIsLocal)
- return true;
- break;
- case RangeDifference.LEFT:
- if (!fLeftIsLocal)
- return true;
- break;
- case RangeDifference.CONFLICT:
- return true;
- }
- return false;
- }
-
-// private boolean isUnresolvedIncoming() {
-// if (fResolved)
-// return false;
-// return isIncoming();
-// }
-
- private boolean isUnresolvedIncomingOrConflicting() {
- if (fResolved)
- return false;
- return isIncomingOrConflicting();
- }
-
- Position getPosition(MergeSourceViewer w) {
- if (w == fLeft)
- return fLeftPos;
- if (w == fRight)
- return fRightPos;
- if (w == fAncestor)
- return fAncestorPos;
- return null;
- }
-
- /**
- * Returns true if given character range overlaps with this Diff.
- */
- boolean contains(MergeSourceViewer w, int start, int end) {
- Position h= getPosition(w);
- if (h != null) {
- int offset= h.getOffset();
- if (start >= offset) {
- int endPos= offset+h.getLength();
- if (end < endPos)
- return true;
- if (endPos == w.getDocument().getLength())
- return true;
- }
- }
- return false;
- }
-
- int getMaxDiffHeight(boolean withAncestor) {
- Point region= new Point(0, 0);
- int h= fLeft.getLineRange(fLeftPos, region).y;
- if (withAncestor)
- h= Math.max(h, fAncestor.getLineRange(fAncestorPos, region).y);
- return Math.max(h, fRight.getLineRange(fRightPos, region).y);
- }
-
- int getAncestorHeight() {
- Point region= new Point(0, 0);
- return fAncestor.getLineRange(fAncestorPos, region).y;
- }
-
- int getLeftHeight() {
- Point region= new Point(0, 0);
- return fLeft.getLineRange(fLeftPos, region).y;
- }
-
- int getRightHeight() {
- Point region= new Point(0, 0);
- return fRight.getLineRange(fRightPos, region).y;
- }
- }
-
- //---- MergeTextViewer
-
- /**
- * Creates a text merge viewer under the given parent control.
- *
- * @param parent the parent control
- * @param configuration the configuration object
- */
- public TextMergeViewer(Composite parent, CompareConfiguration configuration) {
- this(parent, SWT.NULL, configuration);
- }
-
- /**
- * Creates a text merge viewer under the given parent control.
- *
- * @param parent the parent control
- * @param style SWT style bits for top level composite of this viewer
- * @param configuration the configuration object
- */
- public TextMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
- super(style, ResourceBundle.getBundle(BUNDLE_NAME), configuration);
-
- fSymbolicFontName= getClass().getName();
-
- String platform= SWT.getPlatform();
- fIsMotif= "motif".equals(platform); //$NON-NLS-1$
- fIsCarbon= "carbon".equals(platform); //$NON-NLS-1$
-
- if (fIsMotif)
- fMarginWidth= 0;
-
- Display display= parent.getDisplay();
-
- fPreferenceChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- TextMergeViewer.this.propertyChange(event);
- }
- };
-
- fPreferenceStore= configuration.getPreferenceStore();
- if (fPreferenceStore != null) {
- fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
-
- checkForColorUpdate(display);
-
- fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
- fSynchronizedScrolling= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
- fShowMoreInfo= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_MORE_INFO);
- fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
- //fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
- fUseSingleLine= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
- fUseResolveUI= fUseSingleLine;
- //fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
- }
-
- fDocumentListener= new IDocumentListener() {
-
- public void documentAboutToBeChanged(DocumentEvent e) {
- }
-
- public void documentChanged(DocumentEvent e) {
- TextMergeViewer.this.documentChanged(e);
- }
- };
-
- buildControl(parent);
-
- INavigatable nav= new INavigatable() {
- public boolean gotoDifference(boolean next) {
- return navigate(next, false, false);
- }
- };
- fComposite.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
- fBirdsEyeCursor= new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
-
- JFaceResources.getFontRegistry().addListener(fPreferenceChangeListener);
- updateFont();
- }
-
- private void updateFont() {
- Font f= JFaceResources.getFont(fSymbolicFontName);
- if (f != null) {
- if (fAncestor != null)
- fAncestor.setFont(f);
- if (fLeft != null)
- fLeft.setFont(f);
- if (fRight != null)
- fRight.setFont(f);
- }
- }
-
- private void checkForColorUpdate(Display display) {
- if (fPollSystemForeground) {
- RGB fg= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
- if (fForeground == null || !fg.equals(fForeground)) {
- fForeground= fg;
- updateColors(display);
- }
- }
- if (fPollSystemBackground) {
- RGB bg= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
- if (fBackground == null || !bg.equals(fBackground)) {
- fBackground= bg;
- updateColors(display);
- }
- }
- }
-
- /**
- * Sets the viewer's background color to the given RGB value.
- * If the value is <code>null</code> the system's default background color is used.
- * @param background the background color or <code>null</code> to use the system's default background color
- * @since 2.0
- */
- public void setBackgroundColor(RGB background) {
- fPollSystemBackground= (background == null);
- fBackground= background;
- updateColors(null);
- }
-
- private RGB getBackground(Display display) {
- if (fBackground != null)
- return fBackground;
- if (display == null)
- display= fComposite.getDisplay();
- return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
- }
-
- /**
- * Sets the viewer's foreground color to the given RGB value.
- * If the value is <code>null</code> the system's default foreground color is used.
- * @param foreground the foreground color or <code>null</code> to use the system's default foreground color
- * @since 2.0
- */
- public void setForegroundColor(RGB foreground) {
- fPollSystemForeground= (foreground == null);
- fForeground= foreground;
- updateColors(null);
- }
-
- private RGB getForeground(Display display) {
- if (fForeground != null)
- return fForeground;
- if (display == null)
- display= fComposite.getDisplay();
- return display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
- }
-
- private void updateColors(Display display) {
-
- if (display == null)
- display= fComposite.getDisplay();
-
- Color color= null;
- if (fBackground != null)
- color= getColor(display, fBackground);
-
- if (fAncestor != null)
- fAncestor.setBackgroundColor(color);
- if (fLeft != null)
- fLeft.setBackgroundColor(color);
- if (fRight != null)
- fRight.setBackgroundColor(color);
-
- RGB bg= getBackground(display);
- SELECTED_INCOMING= new RGB(0, 0, 255);
- INCOMING= interpolate(SELECTED_INCOMING, bg, 0.6);
- INCOMING_FILL= interpolate(SELECTED_INCOMING, bg, 0.97);
-
- SELECTED_CONFLICT= new RGB(255, 0, 0);
- CONFLICT= interpolate(SELECTED_CONFLICT, bg, 0.6);
- CONFLICT_FILL= interpolate(SELECTED_CONFLICT, bg, 0.97);
-
- SELECTED_OUTGOING= getForeground(display);
- OUTGOING= interpolate(SELECTED_OUTGOING, bg, 0.6);
- OUTGOING_FILL= interpolate(SELECTED_OUTGOING, bg, 0.97);
-
- RESOLVED= new RGB(0, 255, 0);
-
- refreshBirdsEyeView();
- invalidateLines();
-
- updateAllDiffBackgrounds(display);
- }
-
- /**
- * Invalidates the current presentation by invalidating the three text viewers.
- * @since 2.0
- */
- public void invalidateTextPresentation() {
- if (fAncestor != null)
- fAncestor.invalidateTextPresentation();
- if (fLeft != null)
- fLeft.invalidateTextPresentation();
- if (fRight != null)
- fRight.invalidateTextPresentation();
- }
-
- /**
- * Configures the passed text viewer.
- * This method is called after the three text viewers have been created for the
- * content areas.
- * The <code>TextMergeViewer</code> implementation of this method does nothing.
- * Subclasses may reimplement to provide a specific configuration for the text viewer.
- *
- * @param textViewer the text viewer to configure
- */
- protected void configureTextViewer(TextViewer textViewer) {
- }
-
- /**
- * Creates an <code>ITokenComparator</code> which is used to show the
- * intra line differences.
- * The <code>TextMergeViewer</code> implementation of this method returns a
- * tokenizer that breaks a line into words separated by whitespace.
- * Subclasses may reimplement to provide a specific tokenizer.
- *
- * @return a ITokenComparator which is used for a second level token compare.
- */
- protected ITokenComparator createTokenComparator(String s) {
- return new TokenComparator(s);
- }
-
- /**
- * Returns a document partitioner which is suitable for the underlying content type.
- * This method is only called if the input provided by the content provider is a
- * <code>IStreamContentAccessor</code> and an internal document must be created. This
- * document is initialized with the partitioner returned from this method.
- * <p>
- * The <code>TextMergeViewer</code> implementation of this method returns
- * <code>null</code>. Subclasses may reimplement to create a partitioner for a
- * specific content type.
- *
- * @return a document partitioner, or <code>null</code>
- */
- protected IDocumentPartitioner getDocumentPartitioner() {
- return null;
- }
-
- /**
- * Called on the viewer disposal.
- * Unregisters from the compare configuration.
- * Clients may extend if they have to do additional cleanup.
- */
- protected void handleDispose(DisposeEvent event) {
-
- if (fKeyBindingService != null) {
- IAction a;
- if (fNextItem != null) {
- a= fNextItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- if (fPreviousItem != null) {
- a= fPreviousItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- if (fCopyDiffLeftToRightItem != null) {
- a= fCopyDiffLeftToRightItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- if (fCopyDiffRightToLeftItem != null) {
- a= fCopyDiffRightToLeftItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- fKeyBindingService= null;
- }
-
- Object input= getInput();
- DocumentManager.remove(getDocument2('A', input));
- DocumentManager.remove(getDocument2('L', input));
- DocumentManager.remove(getDocument2('R', input));
-
- if (DEBUG)
- DocumentManager.dump();
-
- if (fPreferenceChangeListener != null) {
- JFaceResources.getFontRegistry().removeListener(fPreferenceChangeListener);
- if (fPreferenceStore != null)
- fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener);
- fPreferenceChangeListener= null;
- }
-
- fLeftCanvas= null;
- fRightCanvas= null;
- fVScrollBar= null;
- fBirdsEyeCanvas= null;
- fSummaryHeader= null;
-
- unsetDocument(fAncestor);
- unsetDocument(fLeft);
- unsetDocument(fRight);
-
- if (fColors != null) {
- Iterator i= fColors.values().iterator();
- while (i.hasNext()) {
- Color color= (Color) i.next();
- if (!color.isDisposed())
- color.dispose();
- }
- fColors= null;
- }
-
- if (fBirdsEyeCursor != null) {
- fBirdsEyeCursor.dispose();
- fBirdsEyeCursor= null;
- }
-
- super.handleDispose(event);
- }
-
- //-------------------------------------------------------------------------------------------------------------
- //--- internal ------------------------------------------------------------------------------------------------
- //-------------------------------------------------------------------------------------------------------------
-
- /**
- * Creates the specific SWT controls for the content areas.
- * Clients must not call or override this method.
- */
- protected void createControls(Composite composite) {
-
- WorkbenchHelp.setHelp(composite, ICompareContextIds.TEXT_MERGE_VIEW);
-
- // 1st row
- if (fMarginWidth > 0) {
- fAncestorCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintSides(gc, fAncestor, fAncestorCanvas, false);
- }
- };
- fAncestorCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handleMouseInSides(fAncestorCanvas, fAncestor, e.y), false);
- }
- }
- );
- }
-
- fAncestor= createPart(composite);
- fAncestor.setEditable(false);
-
- fSummaryHeader= new Canvas(composite, SWT.NONE);
- fHeaderPainter= new HeaderPainter();
- fSummaryHeader.addPaintListener(fHeaderPainter);
- updateResolveStatus();
-
- // 2nd row
- if (fMarginWidth > 0) {
- fLeftCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintSides(gc, fLeft, fLeftCanvas, false);
- }
- };
- fLeftCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handleMouseInSides(fLeftCanvas, fLeft, e.y), false);
- }
- }
- );
- }
-
- fLeft= createPart(composite);
- fLeft.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- fLeft.addAction(MergeSourceViewer.SAVE_ID, fLeftSaveAction);
-
- fRight= createPart(composite);
- fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- fRight.addAction(MergeSourceViewer.SAVE_ID, fRightSaveAction);
-
- hsynchViewport(fLeft, fRight);
- hsynchViewport(fRight, fLeft);
-
- if (fMarginWidth > 0) {
- fRightCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintSides(gc, fRight, fRightCanvas, fSynchronizedScrolling);
- }
- };
- fRightCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handleMouseInSides(fRightCanvas, fRight, e.y), false);
- }
- }
- );
- }
-
- fScrollCanvas= new Canvas(composite, SWT.V_SCROLL);
- //Rectangle trim= fScrollCanvas.computeTrim(0, 0, 0, 0);
- Rectangle trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- fTopInset= trim.y;
-
- fVScrollBar= fScrollCanvas.getVerticalBar();
- fVScrollBar.setIncrement(1);
- fVScrollBar.setVisible(true);
- fVScrollBar.addListener(SWT.Selection,
- new Listener() {
- public void handleEvent(Event e) {
- int vpos= ((ScrollBar)e.widget).getSelection();
- scrollVertical(vpos, vpos, vpos, null);
- }
- }
- );
-
- fBirdsEyeCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintBirdsEyeView(this, gc);
- }
- };
- //fBirdsEyeCanvas.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
- fBirdsEyeCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handlemouseInBirdsEyeView(fBirdsEyeCanvas, e.y), true);
- }
- }
- );
- fBirdsEyeCanvas.addMouseMoveListener(
- new MouseMoveListener() {
-
- private Cursor fLastCursor;
-
- public void mouseMove(MouseEvent e) {
- Cursor cursor= null;
- Diff diff= handlemouseInBirdsEyeView(fBirdsEyeCanvas, e.y);
- if (diff != null && diff.fDirection != Differencer.NO_CHANGE)
- cursor= fBirdsEyeCursor;
- if (fLastCursor != cursor) {
- fBirdsEyeCanvas.setCursor(cursor);
- fLastCursor= cursor;
- }
- }
- }
- );
- }
-
- private void hsynchViewport(final TextViewer tv1, final TextViewer tv2) {
- final StyledText st1= tv1.getTextWidget();
- final StyledText st2= tv2.getTextWidget();
- final ScrollBar sb1= st1.getHorizontalBar();
- final ScrollBar sb2= st2.getHorizontalBar();
- sb1.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int max= sb1.getMaximum()-sb1.getThumb();
- double v= 0.0;
- if (max > 0)
- v= (float)sb1.getSelection() / (float)max;
- max= sb2.getMaximum()-sb2.getThumb();
- st2.setHorizontalPixel((int)(max * v));
- }
- });
- }
-
- private void setCurrentDiff2(Diff diff, boolean reveal) {
- if (diff != null && diff.fDirection != Differencer.NO_CHANGE) {
- //fCurrentDiff= null;
- setCurrentDiff(diff, reveal);
- }
- }
-
- private Diff handleMouseInSides(Canvas canvas, MergeSourceViewer tp, int my) {
-
- int lineHeight= tp.getTextWidget().getLineHeight();
- int visibleHeight= tp.getViewportHeight();
-
- if (! fHiglightRanges)
- return null;
-
- if (fChangeDiffs != null) {
- int shift= tp.getVerticalScrollOffset() + (2-LW);
-
- Point region= new Point(0, 0);
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- tp.getLineRange(diff.getPosition(tp), region);
- int y= (region.x * lineHeight) + shift;
- int h= region.y * lineHeight;
-
- if (y+h < 0)
- continue;
- if (y >= visibleHeight)
- break;
-
- if (my >= y && my < y+h)
- return diff;
- }
- }
- return null;
- }
-
- private Diff getDiffUnderMouse(Canvas canvas, int mx, int my, Rectangle r) {
-
- if (! fSynchronizedScrolling)
- return null;
-
- int lineHeight= fLeft.getTextWidget().getLineHeight();
- int visibleHeight= fRight.getViewportHeight();
-
- Point size= canvas.getSize();
- int w= size.x;
-
- if (! fHiglightRanges)
- return null;
-
- if (fChangeDiffs != null) {
- int lshift= fLeft.getVerticalScrollOffset();
- int rshift= fRight.getVerticalScrollOffset();
-
- Point region= new Point(0, 0);
-
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- fLeft.getLineRange(diff.fLeftPos, region);
- int ly= (region.x * lineHeight) + lshift;
- int lh= region.y * lineHeight;
-
- fRight.getLineRange(diff.fRightPos, region);
- int ry= (region.x * lineHeight) + rshift;
- int rh= region.y * lineHeight;
-
- if (Math.max(ly+lh, ry+rh) < 0)
- continue;
- if (Math.min(ly, ry) >= visibleHeight)
- break;
-
- int cx= (w-RESOLVE_SIZE)/2;
- int cy= ((ly+lh/2) + (ry+rh/2) - RESOLVE_SIZE)/2;
- if (my >= cy && my < cy+RESOLVE_SIZE && mx >= cx && mx < cx+RESOLVE_SIZE) {
- if (r != null) {
- r.x= cx+RESOLVE_SIZE/2-10;
- r.y= cy+RESOLVE_SIZE/2-10;
- r.width= 20;
- r.height= 20;
- }
- return diff;
- }
- }
- }
- return null;
- }
-
- private Diff handlemouseInBirdsEyeView(Canvas canvas, int my) {
- int yy, hh;
-
- Point size= canvas.getSize();
-
- int virtualHeight= fSynchronizedScrolling ? getVirtualHeight() : getRightHeight();
- if (virtualHeight < getViewportHeight())
- return null;
-
- int y= 0;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- int h= fSynchronizedScrolling ? diff.getMaxDiffHeight(fShowAncestor)
- : diff.getRightHeight();
- if (useChange(diff.fDirection) && !diff.fIsWhitespace) {
-
- yy= (y*size.y)/virtualHeight;
- hh= (h*size.y)/virtualHeight;
- if (hh < 3)
- hh= 3;
-
- if (my >= yy && my < yy+hh)
- return diff;
- }
- y+= h;
- }
- }
- return null;
- }
-
- private void paintBirdsEyeView(Canvas canvas, GC gc) {
-
- Color c;
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int yy, hh;
-
- Point size= canvas.getSize();
-
- int virtualHeight= fSynchronizedScrolling ? getVirtualHeight() : getRightHeight();
- if (virtualHeight < getViewportHeight())
- return;
-
- Display display= canvas.getDisplay();
- int y= 0;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- int h= fSynchronizedScrolling ? diff.getMaxDiffHeight(fShowAncestor)
- : diff.getRightHeight();
-
- if (useChange(diff.fDirection) && !diff.fIsWhitespace) {
-
- yy= (y*size.y)/virtualHeight;
- hh= (h*size.y)/virtualHeight;
- if (hh < 3)
- hh= 3;
-
- c= getColor(display, getFillColor(diff));
- if (c != null) {
- gc.setBackground(c);
- gc.fillRectangle(BIRDS_EYE_VIEW_INSET, yy, size.x-(2*BIRDS_EYE_VIEW_INSET),hh);
- }
- c= getColor(display, getStrokeColor(diff));
- if (c != null) {
- gc.setForeground(c);
- r.x= BIRDS_EYE_VIEW_INSET;
- r.y= yy;
- r.width= size.x-(2*BIRDS_EYE_VIEW_INSET)-1;
- r.height= hh;
- if (diff == fCurrentDiff ||
- (fCurrentDiff != null && diff == fCurrentDiff.fParent)) {
- gc.setLineWidth(2);
- r.x++;
- r.y++;
- r.width--;
- r.height--;
- } else {
- gc.setLineWidth(1);
- }
- gc.drawRectangle(r);
- }
- }
-
- y+= h;
- }
- }
- }
-
- private void refreshBirdsEyeView() {
- if (fBirdsEyeCanvas != null)
- fBirdsEyeCanvas.redraw();
- }
-
- /**
- * Called whenever setFocus() is called on the ContentViewer's top level SWT Composite.
- * This implementation sets the focus to the first enabled text widget.
- */
- /* package */ boolean internalSetFocus() {
- if (fFocusPart == null) {
- if (fLeft != null && fLeft.getEnabled()) {
- fFocusPart= fLeft;
- } else if (fRight != null && fRight.getEnabled()) {
- fFocusPart= fRight;
- } else if (fAncestor != null && fAncestor.getEnabled()) {
- fFocusPart= fAncestor;
- }
- }
- if (fFocusPart != null) {
- StyledText st= fFocusPart.getTextWidget();
- if (st != null)
- return st.setFocus();
- }
- return false; // could not set focus
- }
-
-
- class HoverResizer extends Resizer {
- Canvas fCanvas;
- public HoverResizer(Canvas c, int dir) {
- super(c, dir);
- fCanvas= c;
- }
- public void mouseMove(MouseEvent e) {
- if (!fIsDown && showResolveUI() && handleMouseMoveOverCenter(fCanvas, e.x, e.y))
- return;
- super.mouseMove(e);
- }
- }
-
- /**
- * Creates the central Canvas.
- * Called from ContentMergeViewer.
- */
- /* package */ Control createCenter(Composite parent) {
- if (fSynchronizedScrolling) {
- final Canvas canvas= new BufferedCanvas(parent, SWT.NONE) {
- public void doPaint(GC gc) {
- paintCenter(this, gc);
- }
- };
- if (!fUseResolveUI) {
- new Resizer(canvas, HORIZONTAL);
- } else {
-
- new HoverResizer(canvas, HORIZONTAL);
-
- fCenterButton= new Button(canvas, "carbon".equals(SWT.getPlatform()) ? SWT.FLAT : SWT.PUSH); //$NON-NLS-1$
- fCenterButton.setText("<"); //$NON-NLS-1$
- fCenterButton.pack();
- fCenterButton.setVisible(false);
- fCenterButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fCenterButton.setVisible(false);
- if (fButtonDiff != null) {
- setCurrentDiff(fButtonDiff, false);
- copy(fCurrentDiff, false, fCurrentDiff.fDirection == RangeDifference.CONFLICT);
- }
- }
- }
- );
- }
-
- return canvas;
- }
- return super.createCenter(parent);
- }
-
- private boolean handleMouseMoveOverCenter(Canvas canvas, int x, int y) {
- Rectangle r= new Rectangle(0, 0, 0, 0);
- Diff diff= getDiffUnderMouse(canvas, x, y, r);
- if (diff != null && !diff.isUnresolvedIncomingOrConflicting())
- diff= null;
- if (diff != fButtonDiff) {
- if (diff != null) {
- if (fLeft.isEditable()) {
- fButtonDiff= diff;
- fCenterButton.setText("<"); //$NON-NLS-1$
- String tt= fCopyDiffRightToLeftItem.getAction().getToolTipText();
- fCenterButton.setToolTipText(tt);
- fCenterButton.setBounds(r);
- fCenterButton.setVisible(true);
- } else if (fRight.isEditable()) {
- fButtonDiff= diff;
- fCenterButton.setText(">"); //$NON-NLS-1$
- String tt= fCopyDiffLeftToRightItem.getAction().getToolTipText();
- fCenterButton.setToolTipText(tt);
- fCenterButton.setBounds(r);
- fCenterButton.setVisible(true);
- } else
- fButtonDiff= null;
- } else {
- fCenterButton.setVisible(false);
- fButtonDiff= null;
- }
- }
- return fButtonDiff != null;
- }
-
- /**
- * Returns width of central canvas.
- * Overridden from ContentMergeViewer.
- */
- /* package */ int getCenterWidth() {
- if (fSynchronizedScrolling)
- return CENTER_WIDTH;
- return super.getCenterWidth();
- }
-
- /**
- * Creates and initializes a text part.
- */
- private MergeSourceViewer createPart(Composite parent) {
-
- final MergeSourceViewer part= new MergeSourceViewer(parent, getResourceBundle());
- final StyledText te= part.getTextWidget();
-
- if (!fConfirmSave)
- part.hideSaveAction();
-
- te.addPaintListener(
- new PaintListener() {
- public void paintControl(PaintEvent e) {
- paint(e, part);
- }
- }
- );
- te.addKeyListener(
- new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleSelectionChanged(part);
- }
- }
- );
- te.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- //syncViewport(part);
- handleSelectionChanged(part);
- }
- }
- );
-
- te.addFocusListener(
- new FocusAdapter() {
- public void focusGained(FocusEvent fe) {
- fFocusPart= part;
- connectGlobalActions(fFocusPart);
- }
- public void focusLost(FocusEvent fe) {
- connectGlobalActions(null);
- }
- }
- );
-
- part.addViewportListener(
- new IViewportListener() {
- public void viewportChanged(int verticalPosition) {
- syncViewport(part);
- }
- }
- );
-
- Font font= JFaceResources.getFont(fSymbolicFontName);
- if (font != null)
- te.setFont(font);
-
- if (fBackground != null) // not default
- te.setBackground(getColor(parent.getDisplay(), fBackground));
-
- configureTextViewer(part);
-
- return part;
- }
-
- private void connectGlobalActions(MergeSourceViewer part) {
- IActionBars actionBars= Utilities.findActionBars(fComposite);
- if (actionBars != null) {
- for (int i= 0; i < GLOBAL_ACTIONS.length; i++) {
- IAction action= null;
- if (part != null) {
- action= part.getAction(TEXT_ACTIONS[i]);
- if (action == null && TEXT_ACTIONS[i].equals(MergeSourceViewer.SAVE_ID)) {
- if (part == fLeft)
- action= fLeftSaveAction;
- else
- action= fRightSaveAction;
- }
- }
- actionBars.setGlobalActionHandler(GLOBAL_ACTIONS[i], action);
- }
- actionBars.updateActionBars();
- }
- }
-
- ITypedElement getLeg(char type, Object input) {
- if (input instanceof ICompareInput) {
- switch (type) {
- case 'A':
- return ((ICompareInput)input).getAncestor();
- case 'L':
- return ((ICompareInput)input).getLeft();
- case 'R':
- return ((ICompareInput)input).getRight();
- }
- }
- return null;
- }
-
- IDocument getDocument(char type, Object input) {
- ITypedElement te= getLeg(type, input);
- if (te instanceof IDocument)
- return (IDocument) te;
- if (te instanceof IDocumentRange)
- return ((IDocumentRange) te).getDocument();
- if (te instanceof IStreamContentAccessor)
- return DocumentManager.get(te);
- return null;
- }
-
- IDocument getDocument2(char type, Object input) {
- IDocument doc= getDocument(type, input);
- if (doc != null)
- return doc;
-
- if (input instanceof IDiffElement) {
- IDiffContainer parent= ((IDiffElement)input).getParent();
- return getDocument(type, parent);
- }
- return null;
- }
-
- /**
- * Returns true if the given inputs map to the same documents
- */
- boolean sameDoc(char type, Object newInput, Object oldInput) {
- IDocument newDoc= getDocument2(type, newInput);
- IDocument oldDoc= getDocument2(type, oldInput);
- return newDoc == oldDoc;
- }
-
- /**
- * Overridden to prevent save confirmation if new input is sub document of current input.
- * @param newInput the new input of this viewer, or <code>null</code> if there is no new input
- * @param oldInput the old input element, or <code>null</code> if there was previously no input
- * @return <code>true</code> if saving was successful, or if the user didn't want to save (by pressing 'NO' in the confirmation dialog).
- * @since 2.0
- */
- protected boolean doSave(Object newInput, Object oldInput) {
-
- if (oldInput != null && newInput != null) {
- // check whether underlying documents have changed.
- if (sameDoc('A', newInput, oldInput) &&
- sameDoc('L', newInput, oldInput) &&
- sameDoc('R', newInput, oldInput)) {
- if (DEBUG) System.out.println("----- Same docs !!!!"); //$NON-NLS-1$
- return false;
- }
- }
-
- if (DEBUG) System.out.println("***** New docs !!!!"); //$NON-NLS-1$
-
- IDocument aDoc= getDocument2('A', oldInput);
- DocumentManager.remove(aDoc);
- IDocument lDoc= getDocument2('L', oldInput);
- DocumentManager.remove(lDoc);
- IDocument rDoc= getDocument2('R', oldInput);
- DocumentManager.remove(rDoc);
-
- if (DEBUG)
- DocumentManager.dump();
-
- return super.doSave(newInput, oldInput);
- }
-
- private ITypedElement getParent(char type) {
- Object input= getInput();
- if (input instanceof IDiffElement) {
- IDiffContainer parent= ((IDiffElement)input).getParent();
- return getLeg(type, parent);
- }
- return null;
- }
-
- /**
- * Initializes the text viewers of the three content areas with the given input objects.
- * Subclasses may extend.
- */
- protected void updateContent(Object ancestor, Object left, Object right) {
-
- boolean emptyInput= (ancestor == null && left == null && right == null);
-
- int n= 0;
- if (left != null)
- n++;
- if (right != null)
- n++;
- fHiglightRanges= n > 1;
-
- // clear stuff
- fCurrentDiff= null;
- fChangeDiffs= null;
- fAllDiffs= null;
- fEndOfDocReached= false;
-
- CompareConfiguration cc= getCompareConfiguration();
- IMergeViewerContentProvider cp= getMergeContentProvider();
-
- boolean rightEditable= cc.isRightEditable() && cp.isRightEditable(getInput());
- boolean leftEditable= cc.isLeftEditable() && cp.isLeftEditable(getInput());
-
- fRight.setEditable(rightEditable);
- fLeft.setEditable(leftEditable);
-
- // set new documents
- setDocument(fLeft, 'L', left);
- fLeftLineCount= fLeft.getLineCount();
- setDocument(fRight, 'R', right);
- fRightLineCount= fRight.getLineCount();
-
- setDocument(fAncestor, 'A', ancestor);
-
- doDiff();
-
- invalidateLines();
- updateVScrollBar();
- refreshBirdsEyeView();
-
- if (!emptyInput && !fComposite.isDisposed()) {
- if (true) { // see #13844
- selectFirstDiff();
- } else {
- // delay so that StyledText widget gets a chance to resize itself
- // (otherwise selectFirstDiff would not know its visible area)
- fComposite.getDisplay().asyncExec(
- new Runnable() {
- public void run() {
- selectFirstDiff();
- }
- }
- );
- }
- }
- }
-
- private void updateDiffBackground(Diff diff) {
-
- if (! fHiglightRanges)
- return;
-
- if (diff == null || diff.fIsToken)
- return;
-
- if (fShowCurrentOnly && !isCurrentDiff(diff))
- return;
-
- Color c= getColor(null, getFillColor(diff));
- if (c == null)
- return;
-
- if (isThreeWay())
- fAncestor.setLineBackground(diff.fAncestorPos, c);
- fLeft.setLineBackground(diff.fLeftPos, c);
- fRight.setLineBackground(diff.fRightPos, c);
- }
-
- private void updateAllDiffBackgrounds(Display display) {
- if (fChangeDiffs != null) {
- boolean threeWay= isThreeWay();
- Iterator iter= fChangeDiffs.iterator();
- while (iter.hasNext()) {
- Diff diff= (Diff) iter.next();
- Color c= getColor(display, getFillColor(diff));
- if (threeWay)
- fAncestor.setLineBackground(diff.fAncestorPos, c);
- fLeft.setLineBackground(diff.fLeftPos, c);
- fRight.setLineBackground(diff.fRightPos, c);
- }
- }
- }
-
- boolean isCurrentDiff(Diff diff) {
- if (diff == null)
- return false;
- if (diff == fCurrentDiff)
- return true;
- if (fCurrentDiff != null && fCurrentDiff.fParent == diff)
- return true;
- return false;
- }
-
- /**
- * Called whenver one of the documents changes.
- * Sets the dirty state of this viewer and updates the lines.
- * Implements IDocumentListener.
- */
- private void documentChanged(DocumentEvent e) {
-
- IDocument doc= e.getDocument();
-
- if (doc == fLeft.getDocument()) {
- setLeftDirty(true);
- } else if (doc == fRight.getDocument()) {
- setRightDirty(true);
- }
-
- updateLines(doc);
- }
-
-// private static ITypedElement getLeg(ICompareInput input, char type) {
-// switch (type) {
-// case 'A':
-// return input.getAncestor();
-// case 'L':
-// return input.getLeft();
-// case 'R':
-// return input.getRight();
-// }
-// return null;
-// }
-
- /**
- * This method is called if a range of text on one side is copied into an empty subdocument
- * on the other side. The method returns the position where the subdocument is placed into the base document.
- * This default implementation determines the position by using the text range differencer.
- * However this position is not always optimal for specific types of text.
- * So subclasses (which are awrae of the type of text they are dealing with)
- * may override this method to find a better position where to insert a newly added
- * piece of text.
- * @param type the side for which the insertion position should be determined: 'A' for ancestor, 'L' for left hand side, 'R' for right hand side.
- * @param input the current input object of this viewer
- * @since 2.0
- */
- protected int findInsertionPosition(char type, ICompareInput input) {
-
- ITypedElement other= null;
- char otherType= 0;
-
- switch (type) {
- case 'A':
- other= input.getLeft();
- otherType= 'L';
- if (other == null) {
- other= input.getRight();
- otherType= 'R';
- }
- break;
- case 'L':
- other= input.getRight();
- otherType= 'R';
- if (other == null) {
- other= input.getAncestor();
- otherType= 'A';
- }
- break;
- case 'R':
- other= input.getLeft();
- otherType= 'L';
- if (other == null) {
- other= input.getAncestor();
- otherType= 'A';
- }
- break;
- }
-
- if (other instanceof IDocumentRange) {
- IDocumentRange dr= (IDocumentRange) other;
- Position p= dr.getRange();
- Diff diff= findDiff(otherType, p.offset);
- if (diff != null) {
- switch (type) {
- case 'A':
- if (diff.fAncestorPos != null)
- return diff.fAncestorPos.offset;
- break;
- case 'L':
- if (diff.fLeftPos != null)
- return diff.fLeftPos.offset;
- break;
- case 'R':
- if (diff.fRightPos != null)
- return diff.fRightPos.offset;
- break;
- }
- }
- }
- return 0;
- }
-
- /**
- * Returns true if a new Document could be installed.
- */
- private boolean setDocument(MergeSourceViewer tp, char type, Object o) {
-
- if (tp == null)
- return false;
-
- IDocument newDoc= null;
- Position range= null;
-
- if (o instanceof IDocumentRange) {
- newDoc= ((IDocumentRange)o).getDocument();
- range= ((IDocumentRange)o).getRange();
-
- } else if (o instanceof IDocument) {
- newDoc= (IDocument) o;
-
- } else if (o instanceof IStreamContentAccessor) {
-
- newDoc= DocumentManager.get(o);
- if (newDoc == null) {
- IStreamContentAccessor sca= (IStreamContentAccessor) o;
- String s= null;
-
- try {
- s= Utilities.readString(sca);
- } catch (CoreException ex) {
- // NeedWork
- }
-
- newDoc= new Document(s != null ? s : ""); //$NON-NLS-1$
- DocumentManager.put(o, newDoc);
- IDocumentPartitioner partitioner= getDocumentPartitioner();
- if (partitioner != null) {
- newDoc.setDocumentPartitioner(partitioner);
- partitioner.connect(newDoc);
- }
- }
- } else if (o == null) { // deletion on one side
-
- ITypedElement parent= getParent(type); // we try to find an insertion position within the deletion's parent
-
- if (parent instanceof IDocumentRange) {
- newDoc= ((IDocumentRange)parent).getDocument();
- newDoc.addPositionCategory(IDocumentRange.RANGE_CATEGORY);
- Object input= getInput();
- range= getNewRange(type, input);
- if (range == null) {
- int pos= 0;
- if (input instanceof ICompareInput)
- pos= findInsertionPosition(type, (ICompareInput)input);
- range= new Position(pos, 0);
- try {
- newDoc.addPosition(IDocumentRange.RANGE_CATEGORY, range);
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- if (DEBUG) System.out.println("BadPositionCategoryException: " + ex); //$NON-NLS-1$
- } catch (BadLocationException ex) {
- // silently ignored
- if (DEBUG) System.out.println("BadLocationException: " + ex); //$NON-NLS-1$
- }
- addNewRange(type, input, range);
- }
- } else if (parent instanceof IDocument) {
- newDoc= ((IDocumentRange)o).getDocument();
- }
- }
-
- boolean enabled= true;
- if (newDoc == null) {
- //System.out.println("setDocument: create new Document");
- newDoc= new Document(""); //$NON-NLS-1$
- enabled= false;
- }
-
- IDocument oldDoc= tp.getDocument();
-
- if (newDoc != oldDoc) {
-
- // got a new document
-
- unsetDocument(tp);
-
- if (newDoc != null) {
- newDoc.addPositionCategory(IDocumentRange.RANGE_CATEGORY);
- if (fPositionUpdater == null)
- fPositionUpdater= new ChildPositionUpdater(IDocumentRange.RANGE_CATEGORY);
- else
- newDoc.removePositionUpdater(fPositionUpdater);
- newDoc.addPositionUpdater(fPositionUpdater);
- }
-
- // install new document
- if (newDoc != null) {
-
- tp.setRegion(range);
- if (fSubDoc) {
- if (range != null) {
- IRegion r= normalizeDocumentRegion(newDoc, toRegion(range));
- tp.setDocument(newDoc, r.getOffset(), r.getLength());
- } else
- tp.setDocument(newDoc);
- } else
- tp.setDocument(newDoc);
-
- newDoc.addDocumentListener(fDocumentListener);
- }
-
- } else { // same document but different range
-
- tp.setRegion(range);
- if (fSubDoc) {
- if (range != null) {
- IRegion r= normalizeDocumentRegion(newDoc, toRegion(range));
- tp.setVisibleRegion(r.getOffset(), r.getLength());
- } else
- tp.resetVisibleRegion();
- } else
- tp.resetVisibleRegion();
- }
-
- tp.setEnabled(enabled);
-
- return enabled;
- }
-
- private Position getNewRange(char type, Object input) {
- switch (type) {
- case 'A':
- return (Position) fNewAncestorRanges.get(input);
- case 'L':
- return (Position) fNewLeftRanges.get(input);
- case 'R':
- return (Position) fNewRightRanges.get(input);
- }
- return null;
- }
-
- private void addNewRange(char type, Object input, Position range) {
- switch (type) {
- case 'A':
- fNewAncestorRanges.put(input, range);
- break;
- case 'L':
- fNewLeftRanges.put(input, range);
- break;
- case 'R':
- fNewRightRanges.put(input, range);
- break;
- }
- }
-
- private void unsetDocument(MergeSourceViewer tp) {
- IDocument oldDoc= tp.getDocument();
- if (oldDoc != null) {
- // deinstall old positions
- if (fPositionUpdater != null)
- oldDoc.removePositionUpdater(fPositionUpdater);
- try {
- oldDoc.removePositionCategory(IDocumentRange.RANGE_CATEGORY);
- } catch (BadPositionCategoryException ex) {
- // NeedWork
- }
-
- oldDoc.removeDocumentListener(fDocumentListener);
- }
- }
-
- /**
- * Returns the contents of the underlying document as an array of bytes.
- *
- * @param left if <code>true</code> the contents of the left side is returned; otherwise the right side
- * @return the contents of the left or right document or null
- */
- protected byte[] getContents(boolean left) {
- MergeSourceViewer v= left ? fLeft : fRight;
- if (v != null) {
- IDocument d= v.getDocument();
- if (d != null) {
- String contents= d.get();
- if (contents != null) {
- byte[] bytes;
- try {
- bytes= contents.getBytes(ResourcesPlugin.getEncoding());
- } catch(UnsupportedEncodingException ex) {
- // use default encoding
- bytes= contents.getBytes();
- }
- return bytes;
- }
- }
- }
- return null;
- }
-
- private IRegion normalizeDocumentRegion(IDocument doc, IRegion region) {
-
- if (region == null || doc == null)
- return region;
-
- int maxLength= doc.getLength();
-
- int start= region.getOffset();
- if (start < 0)
- start= 0;
- else if (start > maxLength)
- start= maxLength;
-
- int length= region.getLength();
- if (length < 0)
- length= 0;
- else if (start + length > maxLength)
- length= maxLength - start;
-
- return new Region(start, length);
- }
-
- protected final void handleResizeAncestor(int x, int y, int width, int height) {
- if (width > 0) {
- Rectangle trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height;
- if (Utilities.okToUse(fAncestorCanvas))
- fAncestorCanvas.setVisible(true);
- if (fAncestor.isControlOkToUse())
- fAncestor.getTextWidget().setVisible(true);
-
- if (fAncestorCanvas != null) {
- fAncestorCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- x+= fMarginWidth;
- width-= fMarginWidth;
- }
- fAncestor.getTextWidget().setBounds(x, y, width, height);
- } else {
- if (Utilities.okToUse(fAncestorCanvas))
- fAncestorCanvas.setVisible(false);
- if (fAncestor.isControlOkToUse()) {
- StyledText t= fAncestor.getTextWidget();
- t.setVisible(false);
- t.setBounds(0, 0, 0, 0);
- if (fFocusPart == fAncestor) {
- fFocusPart= fLeft;
- fFocusPart.getTextWidget().setFocus();
- }
- }
- }
- }
-
- /**
- * Lays out everything.
- */
- protected final void handleResizeLeftRight(int x, int y, int width1, int centerWidth, int width2, int height) {
-
- if (fBirdsEyeCanvas != null)
- width2-= BIRDS_EYE_VIEW_WIDTH;
-
- Rectangle trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height + trim.x;
-
- Composite composite= (Composite) getControl();
-
- int leftTextWidth= width1;
- if (fLeftCanvas != null) {
- fLeftCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- x+= fMarginWidth;
- leftTextWidth-= fMarginWidth;
- }
-
- fLeft.getTextWidget().setBounds(x, y, leftTextWidth, height);
- x+= leftTextWidth;
-
- if (fCenter == null || fCenter.isDisposed())
- fCenter= createCenter(composite);
- fCenter.setBounds(x, y, centerWidth, height-scrollbarHeight);
- x+= centerWidth;
-
- if (!fSynchronizedScrolling) { // canvas is to the left of text
- if (fRightCanvas != null) {
- fRightCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- fRightCanvas.redraw();
- x+= fMarginWidth;
- }
- // we draw the canvas to the left of the text widget
- }
-
- int scrollbarWidth= 0;
- if (fSynchronizedScrolling && fScrollCanvas != null) {
- trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- scrollbarWidth= trim.width + 2*trim.x;
- }
- int rightTextWidth= width2-scrollbarWidth;
- if (fRightCanvas != null)
- rightTextWidth-= fMarginWidth;
- fRight.getTextWidget().setBounds(x, y, rightTextWidth, height);
- x+= rightTextWidth;
-
- if (fSynchronizedScrolling) {
- if (fRightCanvas != null) { // canvas is to the right of the text
- fRightCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- x+= fMarginWidth;
- }
- if (fScrollCanvas != null)
- fScrollCanvas.setBounds(x, y, scrollbarWidth, height-scrollbarHeight);
- }
-
- if (fBirdsEyeCanvas != null) {
- int verticalScrollbarButtonHeight= scrollbarWidth;
- int horizontalScrollbarButtonHeight= scrollbarHeight;
- if (fIsCarbon) {
- verticalScrollbarButtonHeight+= 2;
- horizontalScrollbarButtonHeight= 18;
- }
- if (fSummaryHeader != null)
- fSummaryHeader.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, verticalScrollbarButtonHeight);
- y+= verticalScrollbarButtonHeight;
- fBirdsEyeCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, height-(2*verticalScrollbarButtonHeight+horizontalScrollbarButtonHeight));
- }
-
- // doesn't work since TextEditors don't have their correct size yet.
- updateVScrollBar();
- refreshBirdsEyeView();
- }
-
- /**
- * Track selection changes to update the current Diff.
- */
- private void handleSelectionChanged(MergeSourceViewer tw) {
- Point p= tw.getSelectedRange();
- Diff d= findDiff(tw, p.x, p.x+p.y);
- updateStatus(d);
- setCurrentDiff(d, false); // don't select or reveal
- }
-
- private static IRegion toRegion(Position position) {
- if (position != null)
- return new Region(position.getOffset(), position.getLength());
- return null;
- }
-
- //---- the differencing
-
- private static int maxWork(IRangeComparator a, IRangeComparator l, IRangeComparator r) {
- int ln= l.getRangeCount();
- int rn= r.getRangeCount();
- if (a != null) {
- int an= a.getRangeCount();
- return (2 * Math.max(an, ln)) + (2 * Math.max(an, rn));
- }
- return 2 * Math.max(ln, rn);
- }
-
- /**
- * Perform a two level 2- or 3-way diff.
- * The first level is based on line comparison, the second level on token comparison.
- */
- private void doDiff() {
-
- fAllDiffs= new ArrayList();
- fChangeDiffs= new ArrayList();
- fCurrentDiff= null;
-
- IDocument aDoc= null;
- IDocument lDoc= fLeft.getDocument();
- IDocument rDoc= fRight.getDocument();
- if (lDoc == null || rDoc == null)
- return;
-
- Position aRegion= null;
- Position lRegion= fLeft.getRegion();
- Position rRegion= fRight.getRegion();
-
- boolean threeWay= isThreeWay();
-
- if (threeWay && !fIgnoreAncestor) {
- aDoc= fAncestor.getDocument();
- aRegion= fAncestor.getRegion();
- }
-
- fAncestor.resetLineBackground();
- fLeft.resetLineBackground();
- fRight.resetLineBackground();
-
- boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false);
-
- DocLineComparator sright= new DocLineComparator(rDoc, toRegion(rRegion), ignoreWhiteSpace);
- DocLineComparator sleft= new DocLineComparator(lDoc, toRegion(lRegion), ignoreWhiteSpace);
- DocLineComparator sancestor= null;
- if (aDoc != null)
- sancestor= new DocLineComparator(aDoc, toRegion(aRegion), ignoreWhiteSpace);
-
- if (!fSubDoc && rRegion != null && lRegion != null) {
- // we have to add a diff for the ignored lines
-
- int astart= 0;
- int as= 0;
- if (aRegion != null) {
- astart= aRegion.getOffset();
- as= Math.max(0, astart-1);
- }
- int ys= Math.max(0, lRegion.getOffset()-1);
- int ms= Math.max(0, rRegion.getOffset()-1);
-
- if (as > 0 || ys > 0 || ms > 0) {
- Diff diff= new Diff(null, RangeDifference.NOCHANGE,
- aDoc, aRegion, 0, astart,
- lDoc, lRegion, 0, lRegion.getOffset(),
- rDoc, rRegion, 0, rRegion.getOffset());
- fAllDiffs.add(diff);
- }
- }
-
- final ResourceBundle bundle= getResourceBundle();
-
- final Object[] result= new Object[1];
- final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- String progressTitle= Utilities.getString(bundle, "compareProgressTask.title"); //$NON-NLS-1$
- monitor.beginTask(progressTitle, maxWork(sa, sl, sr));
- try {
- result[0]= RangeDifferencer.findRanges(monitor, sa, sl, sr);
- } catch (OutOfMemoryError ex) {
- System.gc();
- throw new InvocationTargetException(ex);
- }
- if (monitor.isCanceled()) { // cancelled
- throw new InterruptedException();
- }
- monitor.done();
- }
- };
-
- RangeDifference[] e= null;
- try {
- TimeoutContext.run(true, TIMEOUT, getControl().getShell(), runnable);
- e= (RangeDifference[]) result[0];
- } catch (InvocationTargetException ex) {
- String title= Utilities.getString(bundle, "tooComplexError.title"); //$NON-NLS-1$
- String format= Utilities.getString(bundle, "tooComplexError.format"); //$NON-NLS-1$
- String msg= MessageFormat.format(format, new Object[] { Integer.toString(TIMEOUT/1000) } );
- MessageDialog.openError(fComposite.getShell(), title, msg);
- e= null;
- } catch (InterruptedException ex) {
- //
- }
-
- if (e == null) {
- // we create a NOCHANGE range for the whole document
- Diff diff= new Diff(null, RangeDifference.NOCHANGE,
- aDoc, aRegion, 0, aDoc != null ? aDoc.getLength() : 0,
- lDoc, lRegion, 0, lDoc.getLength(),
- rDoc, rRegion, 0, rDoc.getLength());
-
- fAllDiffs.add(diff);
- } else {
- for (int i= 0; i < e.length; i++) {
- String a= null, s= null, d= null;
- RangeDifference es= e[i];
-
- int kind= es.kind();
-
- int ancestorStart= 0;
- int ancestorEnd= 0;
- if (sancestor != null) {
- ancestorStart= sancestor.getTokenStart(es.ancestorStart());
- ancestorEnd= getTokenEnd2(sancestor, es.ancestorStart(), es.ancestorLength());
- }
-
- int leftStart= sleft.getTokenStart(es.leftStart());
- int leftEnd= getTokenEnd2(sleft, es.leftStart(), es.leftLength());
-
- int rightStart= sright.getTokenStart(es.rightStart());
- int rightEnd= getTokenEnd2(sright, es.rightStart(), es.rightLength());
-
- Diff diff= new Diff(null, kind,
- aDoc, aRegion, ancestorStart, ancestorEnd,
- lDoc, lRegion, leftStart, leftEnd,
- rDoc, rRegion, rightStart, rightEnd);
-
- fAllDiffs.add(diff); // remember all range diffs for scrolling
-
- if (ignoreWhiteSpace) {
- if (sancestor != null)
- a= extract2(aDoc, sancestor, es.ancestorStart(), es.ancestorLength());
- s= extract2(lDoc, sleft, es.leftStart(), es.leftLength());
- d= extract2(rDoc, sright, es.rightStart(), es.rightLength());
-
- if ((a == null || a.trim().length() == 0) && s.trim().length() == 0 && d.trim().length() == 0) {
- diff.fIsWhitespace= true;
- continue;
- }
- }
-
- if (useChange(kind)) {
- fChangeDiffs.add(diff); // here we remember only the real diffs
- updateDiffBackground(diff);
-
- if (s == null)
- s= extract2(lDoc, sleft, es.leftStart(), es.leftLength());
- if (d == null)
- d= extract2(rDoc, sright, es.rightStart(), es.rightLength());
-
- if (s.length() > 0 && d.length() > 0) {
- if (a == null && sancestor != null)
- a= extract2(aDoc, sancestor, es.ancestorStart(), es.ancestorLength());
- if (USE_MERGING_TOKEN_DIFF)
- mergingTokenDiff(diff, aDoc, a, rDoc, d, lDoc, s);
- else
- simpleTokenDiff(diff, aDoc, a, rDoc, d, lDoc, s);
- }
- }
- }
- }
-
- if (!fSubDoc && rRegion != null && lRegion != null) {
- // we have to add a diff for the ignored lines
-
- int aEnd= 0;
- int aLen= 0;
- if (aRegion != null && aDoc != null) {
- aEnd= aRegion.getOffset()+aRegion.getLength();
- aLen= aDoc.getLength();
- }
- Diff diff= new Diff(null, RangeDifference.NOCHANGE,
- aDoc, aRegion, aEnd, aLen,
- lDoc, lRegion, lRegion.getOffset()+lRegion.getLength(), lDoc.getLength(),
- rDoc, rRegion, rRegion.getOffset()+rRegion.getLength(), rDoc.getLength());
- fAllDiffs.add(diff);
- }
- }
-
- private Diff findDiff(char type, int pos) {
-
- IDocument aDoc= null;
- IDocument lDoc= fLeft.getDocument();
- IDocument rDoc= fRight.getDocument();
- if (lDoc == null || rDoc == null)
- return null;
-
- Position aRegion= null;
- Position lRegion= null;
- Position rRegion= null;
-
- boolean threeWay= isThreeWay();
-
- if (threeWay && !fIgnoreAncestor)
- aDoc= fAncestor.getDocument();
-
- boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false);
-
- DocLineComparator sright= new DocLineComparator(rDoc, toRegion(rRegion), ignoreWhiteSpace);
- DocLineComparator sleft= new DocLineComparator(lDoc, toRegion(lRegion), ignoreWhiteSpace);
- DocLineComparator sancestor= null;
- if (aDoc != null)
- sancestor= new DocLineComparator(aDoc, toRegion(aRegion), ignoreWhiteSpace);
-
- final ResourceBundle bundle= getResourceBundle();
-
- final Object[] result= new Object[1];
- final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- String progressTitle= Utilities.getString(bundle, "compareProgressTask.title"); //$NON-NLS-1$
- monitor.beginTask(progressTitle, maxWork(sa, sl, sr));
- try {
- result[0]= RangeDifferencer.findRanges(monitor, sa, sl, sr);
- } catch (OutOfMemoryError ex) {
- System.gc();
- throw new InvocationTargetException(ex);
- }
- if (monitor.isCanceled()) { // cancelled
- throw new InterruptedException();
- }
- monitor.done();
- }
- };
-
- RangeDifference[] e= null;
- try {
- TimeoutContext.run(true, TIMEOUT, getControl().getShell(), runnable);
- e= (RangeDifference[]) result[0];
- } catch (InvocationTargetException ex) {
- String title= Utilities.getString(bundle, "tooComplexError.title"); //$NON-NLS-1$
- String format= Utilities.getString(bundle, "tooComplexError.format"); //$NON-NLS-1$
- String msg= MessageFormat.format(format, new Object[] { Integer.toString(TIMEOUT/1000) } );
- MessageDialog.openError(fComposite.getShell(), title, msg);
- e= null;
- } catch (InterruptedException ex) {
- //
- }
-
- if (e != null) {
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
-
- int kind= es.kind();
-
- int ancestorStart= 0;
- int ancestorEnd= 0;
- if (sancestor != null) {
- ancestorStart= sancestor.getTokenStart(es.ancestorStart());
- ancestorEnd= getTokenEnd2(sancestor, es.ancestorStart(), es.ancestorLength());
- }
-
- int leftStart= sleft.getTokenStart(es.leftStart());
- int leftEnd= getTokenEnd2(sleft, es.leftStart(), es.leftLength());
-
- int rightStart= sright.getTokenStart(es.rightStart());
- int rightEnd= getTokenEnd2(sright, es.rightStart(), es.rightLength());
-
- Diff diff= new Diff(null, kind,
- aDoc, aRegion, ancestorStart, ancestorEnd,
- lDoc, lRegion, leftStart, leftEnd,
- rDoc, rRegion, rightStart, rightEnd);
-
- if (diff.isInRange(type, pos))
- return diff;
- }
- }
-
- return null;
- }
-
- /**
- * Returns true if kind of change should be shown.
- */
- private boolean useChange(int kind) {
- if (kind == RangeDifference.NOCHANGE)
- return false;
- if (kind == RangeDifference.ANCESTOR)
- return fShowPseudoConflicts;
- return true;
- }
-
- private int getTokenEnd(ITokenComparator tc, int start, int count) {
- if (count <= 0)
- return tc.getTokenStart(start);
- int index= start + count - 1;
- return tc.getTokenStart(index) + tc.getTokenLength(index);
- }
-
- private static int getTokenEnd2(ITokenComparator tc, int start, int length) {
- return tc.getTokenStart(start + length);
- }
-
- /**
- * Returns the content of lines in the specified range as a String.
- * This includes the line separators.
- *
- * @param doc the document from which to extract the characters
- * @param start index of first line
- * @param length number of lines
- * @return the contents of the specified line range as a String
- */
- private String extract2(IDocument doc, ITokenComparator tc, int start, int length) {
- int count= tc.getRangeCount();
- if (length > 0 && count > 0) {
-
-//
-// int startPos= tc.getTokenStart(start);
-// int endPos= startPos;
-//
-// if (length > 1)
-// endPos= tc.getTokenStart(start + (length-1));
-// endPos+= tc.getTokenLength(start + (length-1));
-//
-
- int startPos= tc.getTokenStart(start);
- int endPos;
-
- if (length == 1) {
- endPos= startPos + tc.getTokenLength(start);
- } else {
- endPos= tc.getTokenStart(start + length);
- }
-
- try {
- return doc.get(startPos, endPos - startPos);
- } catch (BadLocationException e) {
- // silently ignored
- }
-
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Performs a token based 3-way diff on the character range specified by the given baseDiff.
- */
- private void simpleTokenDiff(final Diff baseDiff,
- IDocument ancestorDoc, String a,
- IDocument rightDoc, String d,
- IDocument leftDoc, String s) {
-
- int ancestorStart= 0;
- ITokenComparator sa= null;
- if (ancestorDoc != null) {
- ancestorStart= baseDiff.fAncestorPos.getOffset();
- sa= createTokenComparator(a);
- }
-
- int rightStart= baseDiff.fRightPos.getOffset();
- ITokenComparator sm= createTokenComparator(d);
-
- int leftStart= baseDiff.fLeftPos.getOffset();
- ITokenComparator sy= createTokenComparator(s);
-
- RangeDifference[] e= RangeDifferencer.findRanges(sa, sy, sm);
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
- int kind= es.kind();
- if (kind != RangeDifference.NOCHANGE) {
-
- int ancestorStart2= ancestorStart;
- int ancestorEnd2= ancestorStart;
- if (ancestorDoc != null) {
- ancestorStart2 += sa.getTokenStart(es.ancestorStart());
- ancestorEnd2 += getTokenEnd(sa, es.ancestorStart(), es.ancestorLength());
- }
-
- int leftStart2= leftStart + sy.getTokenStart(es.leftStart());
- int leftEnd2= leftStart + getTokenEnd(sy, es.leftStart(), es.leftLength());
-
- int rightStart2= rightStart + sm.getTokenStart(es.rightStart());
- int rightEnd2= rightStart + getTokenEnd(sm, es.rightStart(), es.rightLength());
-
- Diff diff= new Diff(baseDiff, kind,
- ancestorDoc, null, ancestorStart2, ancestorEnd2,
- leftDoc, null, leftStart2, leftEnd2,
- rightDoc, null, rightStart2, rightEnd2);
-
- // ensure that token diff is smaller than basediff
- int leftS= baseDiff.fLeftPos.offset;
- int leftE= baseDiff.fLeftPos.offset+baseDiff.fLeftPos.length;
- int rightS= baseDiff.fRightPos.offset;
- int rightE= baseDiff.fRightPos.offset+baseDiff.fRightPos.length;
- if (leftS != leftStart2 || leftE != leftEnd2 ||
- rightS != rightStart2 || rightE != rightEnd2) {
- diff.fIsToken= true;
- // add to base Diff
- baseDiff.add(diff);
- }
- }
- }
- }
-
- /**
- * Performs a "smart" token based 3-way diff on the character range specified by the given baseDiff.
- * It is "smart" because it tries to minimize the number of token diffs by merging them.
- */
- private void mergingTokenDiff(Diff baseDiff,
- IDocument ancestorDoc, String a,
- IDocument rightDoc, String d,
- IDocument leftDoc, String s) {
- ITokenComparator sa= null;
- int ancestorStart= 0;
- if (ancestorDoc != null) {
- sa= createTokenComparator(a);
- ancestorStart= baseDiff.fAncestorPos.getOffset();
- }
-
- int rightStart= baseDiff.fRightPos.getOffset();
- ITokenComparator sm= createTokenComparator(d);
-
- int leftStart= baseDiff.fLeftPos.getOffset();
- ITokenComparator sy= createTokenComparator(s);
-
- RangeDifference[] r= RangeDifferencer.findRanges(sa, sy, sm);
- for (int i= 0; i < r.length; i++) {
- RangeDifference es= r[i];
- // determine range of diffs in one line
- int start= i;
- int leftLine= -1;
- int rightLine= -1;
- try {
- leftLine= leftDoc.getLineOfOffset(leftStart+sy.getTokenStart(es.leftStart()));
- rightLine= rightDoc.getLineOfOffset(rightStart+sm.getTokenStart(es.rightStart()));
- } catch (BadLocationException e) {
- // silently ignored
- }
- i++;
- for (; i < r.length; i++) {
- es= r[i];
- try {
- if (leftLine != leftDoc.getLineOfOffset(leftStart+sy.getTokenStart(es.leftStart())))
- break;
- if (rightLine != rightDoc.getLineOfOffset(rightStart+sm.getTokenStart(es.rightStart())))
- break;
- } catch (BadLocationException e) {
- // silently ignored
- }
- }
- int end= i;
-
- // find first diff from left
- RangeDifference first= null;
- for (int ii= start; ii < end; ii++) {
- es= r[ii];
- if (useChange(es.kind())) {
- first= es;
- break;
- }
- }
-
- // find first diff from mine
- RangeDifference last= null;
- for (int ii= end-1; ii >= start; ii--) {
- es= r[ii];
- if (useChange(es.kind())) {
- last= es;
- break;
- }
- }
-
- if (first != null && last != null) {
-
- int ancestorStart2= 0;
- int ancestorEnd2= 0;
- if (ancestorDoc != null) {
- ancestorStart2= ancestorStart+sa.getTokenStart(first.ancestorStart());
- ancestorEnd2= ancestorStart+getTokenEnd(sa, last.ancestorStart(), last.ancestorLength());
- }
-
- int leftStart2= leftStart+sy.getTokenStart(first.leftStart());
- int leftEnd2= leftStart+getTokenEnd(sy, last.leftStart(), last.leftLength());
-
- int rightStart2= rightStart+sm.getTokenStart(first.rightStart());
- int rightEnd2= rightStart+getTokenEnd(sm, last.rightStart(), last.rightLength());
- Diff diff= new Diff(baseDiff, first.kind(),
- ancestorDoc, null, ancestorStart2, ancestorEnd2+1,
- leftDoc, null, leftStart2, leftEnd2+1,
- rightDoc, null, rightStart2, rightEnd2+1);
- diff.fIsToken= true;
- baseDiff.add(diff);
- }
- }
- }
-
- //---- update UI stuff
-
- private void updateControls() {
-
- boolean leftToRight= false;
- boolean rightToLeft= false;
-
- updateStatus(fCurrentDiff);
- updateResolveStatus();
-
- if (fCurrentDiff != null) {
- IMergeViewerContentProvider cp= getMergeContentProvider();
- if (cp != null) {
- rightToLeft= cp.isLeftEditable(getInput());
- leftToRight= cp.isRightEditable(getInput());
- }
- }
-
- if (fDirectionLabel != null) {
- if (fHiglightRanges && fCurrentDiff != null && isThreeWay() && !fIgnoreAncestor) {
- fDirectionLabel.setImage(fCurrentDiff.getImage());
- } else {
- fDirectionLabel.setImage(null);
- }
- }
-
- if (fCopyDiffLeftToRightItem != null)
- ((Action)fCopyDiffLeftToRightItem.getAction()).setEnabled(leftToRight);
- if (fCopyDiffRightToLeftItem != null)
- ((Action)fCopyDiffRightToLeftItem.getAction()).setEnabled(rightToLeft);
-
- boolean enableNavigation= false;
- if (fCurrentDiff == null && fChangeDiffs != null && fChangeDiffs.size() > 0)
- enableNavigation= true;
- else if (fChangeDiffs != null && fChangeDiffs.size() > 1)
- enableNavigation= true;
- else if (fCurrentDiff != null && fCurrentDiff.fDiffs != null)
- enableNavigation= true;
- else if (fCurrentDiff != null && fCurrentDiff.fIsToken)
- enableNavigation= true;
-
- if (fNextItem != null) {
- IAction a= fNextItem.getAction();
- a.setEnabled(enableNavigation);
- }
- if (fPreviousItem != null) {
- IAction a= fPreviousItem.getAction();
- a.setEnabled(enableNavigation);
- }
- }
-
- private void updateResolveStatus() {
-
- RGB rgb= null;
-
- if (showResolveUI()) {
- // we only show red or green if there is at least one incoming or conflicting change
- int incomingOrConflicting= 0;
- int unresolvedIncoming= 0;
- int unresolvedConflicting= 0;
-
- if (fChangeDiffs != null) {
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff d= (Diff) e.next();
- if (d.isIncomingOrConflicting() /* && useChange(d.fDirection) && !d.fIsWhitespace */) {
- incomingOrConflicting++;
- if (!d.fResolved) {
- if (d.fDirection == RangeDifference.CONFLICT) {
- unresolvedConflicting++;
- break; // we can stop here because a conflict has the maximum priority
- } else {
- unresolvedIncoming++;
- }
- }
- }
- }
- }
-
- if (incomingOrConflicting > 0) {
- if (unresolvedConflicting > 0)
- rgb= SELECTED_CONFLICT;
- else if (unresolvedIncoming > 0)
- rgb= SELECTED_INCOMING;
- else
- rgb= RESOLVED;
- }
- }
-
- if (fHeaderPainter.setColor(rgb))
- fSummaryHeader.redraw();
- }
-
- private void updateStatus(Diff diff) {
-
- if (! fShowMoreInfo)
- return;
-
- IActionBars bars= Utilities.findActionBars(fComposite);
- if (bars == null)
- return;
- IStatusLineManager slm= bars.getStatusLineManager();
- if (slm == null)
- return;
-
- String diffDescription;
-
- if (diff == null) {
- diffDescription= CompareMessages.getString("TextMergeViewer.diffDescription.noDiff.format"); //$NON-NLS-1$
- } else {
-
- if (diff.fIsToken) // we don't show special info for token diffs
- diff= diff.fParent;
-
- String format= CompareMessages.getString("TextMergeViewer.diffDescription.diff.format"); //$NON-NLS-1$
- diffDescription= MessageFormat.format(format,
- new String[] {
- getDiffType(diff), // 0: diff type
- getDiffNumber(diff), // 1: diff number
- getDiffRange(fLeft, diff.fLeftPos), // 2: left start line
- getDiffRange(fRight, diff.fRightPos) // 3: left end line
- }
- );
- }
-
- String format= CompareMessages.getString("TextMergeViewer.statusLine.format"); //$NON-NLS-1$
- String s= MessageFormat.format(format,
- new String[] {
- getCursorPosition(fLeft), // 0: left column
- getCursorPosition(fRight), // 1: right column
- diffDescription // 2: diff description
- }
- );
-
- slm.setMessage(s);
- }
-
- private void clearStatus() {
-
- IActionBars bars= Utilities.findActionBars(fComposite);
- if (bars == null)
- return;
- IStatusLineManager slm= bars.getStatusLineManager();
- if (slm == null)
- return;
-
- slm.setMessage(null);
- }
-
- private String getDiffType(Diff diff) {
- String s= ""; //$NON-NLS-1$
- switch(diff.fDirection) {
- case RangeDifference.LEFT:
- s= CompareMessages.getString("TextMergeViewer.direction.outgoing"); //$NON-NLS-1$
- break;
- case RangeDifference.RIGHT:
- s= CompareMessages.getString("TextMergeViewer.direction.incoming"); //$NON-NLS-1$
- break;
- case RangeDifference.CONFLICT:
- s= CompareMessages.getString("TextMergeViewer.direction.conflicting"); //$NON-NLS-1$
- break;
- }
- String format= CompareMessages.getString("TextMergeViewer.diffType.format"); //$NON-NLS-1$
- return MessageFormat.format(format, new String[] { s, diff.changeType() } );
- }
-
- private String getDiffNumber(Diff diff) {
- // find the diff's number
- int diffNumber= 0;
- if (fChangeDiffs != null) {
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff d= (Diff) e.next();
- diffNumber++;
- if (d == diff)
- break;
- }
- }
- return Integer.toString(diffNumber);
- }
-
- private String getDiffRange(MergeSourceViewer v, Position pos) {
- Point p= v.getLineRange(pos, new Point(0, 0));
- int startLine= p.x+1;
- int endLine= p.x+p.y;
-
- String format;
- if (endLine < startLine)
- format= CompareMessages.getString("TextMergeViewer.beforeLine.format"); //$NON-NLS-1$
- else
- format= CompareMessages.getString("TextMergeViewer.range.format"); //$NON-NLS-1$
- return MessageFormat.format(format,
- new String[] { Integer.toString(startLine),
- Integer.toString(endLine) } );
- }
-
- /**
- * Returns a description of the cursor position.
- *
- * @return a description of the cursor position
- */
- private String getCursorPosition(MergeSourceViewer v) {
- if (v != null) {
- StyledText styledText= v.getTextWidget();
-
- IDocument document= v.getDocument();
- if (document != null) {
- int offset= v.getVisibleRegion().getOffset();
- int caret= offset + styledText.getCaretOffset();
-
- try {
-
- int line=document.getLineOfOffset(caret);
-
- int lineOffset= document.getLineOffset(line);
- int occurrences= 0;
- for (int i= lineOffset; i < caret; i++)
- if ('\t' == document.getChar(i))
- ++ occurrences;
-
- int tabWidth= styledText.getTabs();
- int column= caret - lineOffset + (tabWidth -1) * occurrences;
-
- String format= CompareMessages.getString("TextMergeViewer.cursorPosition.format"); //$NON-NLS-1$
- return MessageFormat.format(format,
- new String[] { Integer.toString(line + 1), Integer.toString(column + 1) } );
-
- } catch (BadLocationException x) {
- // silently ignored
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- protected void updateHeader() {
-
- super.updateHeader();
-
- updateControls();
- }
-
- /**
- * Creates the two items for copying a difference range from one side to the other
- * and adds them to the given toolbar manager.
- */
- protected void createToolItems(ToolBarManager tbm) {
-
- IWorkbenchPartSite ps= Utilities.findSite(fComposite);
- fKeyBindingService= ps != null ? ps.getKeyBindingService() : null;
-
- final String ignoreAncestorActionKey= "action.IgnoreAncestor."; //$NON-NLS-1$
- Action ignoreAncestorAction= new Action() {
- public void run() {
- setIgnoreAncestor(! fIgnoreAncestor);
- Utilities.initToggleAction(this, getResourceBundle(), ignoreAncestorActionKey, fIgnoreAncestor);
- }
- };
- ignoreAncestorAction.setChecked(fIgnoreAncestor);
- Utilities.initAction(ignoreAncestorAction, getResourceBundle(), ignoreAncestorActionKey);
- Utilities.initToggleAction(ignoreAncestorAction, getResourceBundle(), ignoreAncestorActionKey, fIgnoreAncestor);
-
- fIgnoreAncestorItem= new ActionContributionItem(ignoreAncestorAction);
- fIgnoreAncestorItem.setVisible(false);
- tbm.appendToGroup("modes", fIgnoreAncestorItem); //$NON-NLS-1$
-
- tbm.add(new Separator());
-
- Action a= new Action() {
- public void run() {
- navigate(true, true, true);
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.NextDiff."); //$NON-NLS-1$
- fNextItem= new ActionContributionItem(a);
- tbm.appendToGroup("navigation", fNextItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.selectNextChange"); //$NON-NLS-1$
-
- a= new Action() {
- public void run() {
- navigate(false, true, true);
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.PrevDiff."); //$NON-NLS-1$
- fPreviousItem= new ActionContributionItem(a);
- tbm.appendToGroup("navigation", fPreviousItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.selectPreviousChange"); //$NON-NLS-1$
-
-
- CompareConfiguration cc= getCompareConfiguration();
-
- if (cc.isRightEditable()) {
- a= new Action() {
- public void run() {
- copyDiffLeftToRight();
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.CopyDiffLeftToRight."); //$NON-NLS-1$
- fCopyDiffLeftToRightItem= new ActionContributionItem(a);
- fCopyDiffLeftToRightItem.setVisible(true);
- tbm.appendToGroup("merge", fCopyDiffLeftToRightItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.copyLeftToRight"); //$NON-NLS-1$
- }
-
- if (cc.isLeftEditable()) {
- a= new Action() {
- public void run() {
- copyDiffRightToLeft();
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.CopyDiffRightToLeft."); //$NON-NLS-1$
- fCopyDiffRightToLeftItem= new ActionContributionItem(a);
- fCopyDiffRightToLeftItem.setVisible(true);
- tbm.appendToGroup("merge", fCopyDiffRightToLeftItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.copyRightToLeft"); //$NON-NLS-1$
- }
- }
-
- /* package */ void propertyChange(PropertyChangeEvent event) {
-
- String key= event.getProperty();
-
- if (key.equals(CompareConfiguration.IGNORE_WHITESPACE)
- || key.equals(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS)) {
-
- fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
-
- // clear stuff
- fCurrentDiff= null;
- fChangeDiffs= null;
- fAllDiffs= null;
-
- doDiff();
-
- updateControls();
- invalidateLines();
- updateVScrollBar();
- refreshBirdsEyeView();
-
- selectFirstDiff();
-
-// } else if (key.equals(ComparePreferencePage.USE_SPLINES)) {
-// fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
-// invalidateLines();
-
- } else if (key.equals(ComparePreferencePage.USE_SINGLE_LINE)) {
- fUseSingleLine= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
- fUseResolveUI= fUseSingleLine;
- fBasicCenterCurve= null;
- updateResolveStatus();
- invalidateLines();
-
-// } else if (key.equals(ComparePreferencePage.USE_RESOLVE_UI)) {
-// fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
-// updateResolveStatus();
-// invalidateLines();
-
- } else if (key.equals(fSymbolicFontName)) {
- updateFont();
- invalidateLines();
-
- } else if (key.equals(ComparePreferencePage.SYNCHRONIZE_SCROLLING)) {
-
- boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
- if (b != fSynchronizedScrolling)
- toggleSynchMode();
-
- } else if (key.equals(ComparePreferencePage.SHOW_MORE_INFO)) {
-
- boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_MORE_INFO);
- if (b != fShowMoreInfo) {
- fShowMoreInfo= b;
- if (fShowMoreInfo)
- updateStatus(fCurrentDiff);
- else
- clearStatus();
- }
-
- } else
- super.propertyChange(event);
- }
-
- private void setIgnoreAncestor(boolean ignore) {
- if (ignore != fIgnoreAncestor) {
- fIgnoreAncestor= ignore;
- setAncestorVisibility(false, !fIgnoreAncestor);
-
- // clear stuff
- fCurrentDiff= null;
- fChangeDiffs= null;
- fAllDiffs= null;
-
- doDiff();
-
- invalidateLines();
- updateVScrollBar();
- refreshBirdsEyeView();
-
- selectFirstDiff();
- }
- }
-
- private void selectFirstDiff() {
-
- if (fLeft == null || fRight == null) {
- return;
- }
- if (fLeft.getDocument() == null || fRight.getDocument() == null) {
- return;
- }
-
- Diff firstDiff= null;
- if (CompareNavigator.getDirection(fComposite))
- firstDiff= findNext(fRight, fChangeDiffs, -1, -1, false);
- else
- firstDiff= findPrev(fRight, fChangeDiffs, 9999999, 9999999, false);
- setCurrentDiff(firstDiff, true);
- }
-
- private void toggleSynchMode() {
- fSynchronizedScrolling= ! fSynchronizedScrolling;
-
- scrollVertical(0, 0, 0, null);
-
- // throw away central control (Sash or Canvas)
- Control center= getCenter();
- if (center != null && !center.isDisposed())
- center.dispose();
-
- fLeft.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
-
- fComposite.layout(true);
- }
-
- protected void updateToolItems() {
-
- if (fIgnoreAncestorItem != null)
- fIgnoreAncestorItem.setVisible(isThreeWay());
-
- super.updateToolItems();
- }
-
- //---- painting lines
-
- /**
- *
- */
- private void updateLines(IDocument d) {
-
- boolean left= false;
- boolean right= false;
-
- // FIXME: this optimization is incorrect because
- // it doesn't take replace operations into account where
- // the old and new line count does not differ
- if (d == fLeft.getDocument()) {
- int l= fLeft.getLineCount();
- left= fLeftLineCount != l;
- fLeftLineCount= l;
- } else if (d == fRight.getDocument()) {
- int l= fRight.getLineCount();
- right= fRightLineCount != l;
- fRightLineCount= l;
- }
-
- if (left || right) {
-
- if (left) {
- if (fLeftCanvas != null)
- fLeftCanvas.redraw();
- } else {
- if (fRightCanvas != null)
- fRightCanvas.redraw();
- }
- Control center= getCenter();
- if (center != null)
- center.redraw();
-
- updateVScrollBar();
- refreshBirdsEyeView();
- }
- }
-
- private void invalidateLines() {
- if (isThreeWay()) {
- if (Utilities.okToUse(fAncestorCanvas))
- fAncestorCanvas.redraw();
- if (fAncestor != null && fAncestor.isControlOkToUse())
- fAncestor.getTextWidget().redraw();
- }
-
- if (Utilities.okToUse(fLeftCanvas))
- fLeftCanvas.redraw();
-
- if (fLeft != null && fLeft.isControlOkToUse())
- fLeft.getTextWidget().redraw();
-
- if (Utilities.okToUse(getCenter()))
- getCenter().redraw();
-
- if (fRight != null && fRight.isControlOkToUse())
- fRight.getTextWidget().redraw();
-
- if (Utilities.okToUse(fRightCanvas))
- fRightCanvas.redraw();
- }
-
- private boolean showResolveUI() {
- if (!fUseResolveUI || !isThreeWay() || fIgnoreAncestor)
- return false;
- CompareConfiguration cc= getCompareConfiguration();
- if (cc == null)
- return false;
- // we only enable the new resolve ui if exactly one side is editable
- boolean l= cc.isLeftEditable();
- boolean r= cc.isRightEditable();
- //return (l && !r) || (r && !l);
- return l || r;
- }
-
- private void paintCenter(Canvas canvas, GC g) {
-
- Display display= canvas.getDisplay();
-
- checkForColorUpdate(display);
-
- if (! fSynchronizedScrolling)
- return;
-
- int lineHeight= fLeft.getTextWidget().getLineHeight();
- int visibleHeight= fRight.getViewportHeight();
-
- Point size= canvas.getSize();
- int x= 0;
- int w= size.x;
-
- g.setBackground(canvas.getBackground());
- g.fillRectangle(x+1, 0, w-2, size.y);
-
- if (!fIsMotif) {
- // draw thin line between center ruler and both texts
- g.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- g.fillRectangle(0, 0, 1, size.y);
- g.fillRectangle(w-1, 0, 1, size.y);
- }
-
- if (! fHiglightRanges)
- return;
-
- boolean showResolveUI= showResolveUI();
-
- if (fChangeDiffs != null) {
- int lshift= fLeft.getVerticalScrollOffset();
- int rshift= fRight.getVerticalScrollOffset();
-
- Point region= new Point(0, 0);
-
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- fLeft.getLineRange(diff.fLeftPos, region);
- int ly= (region.x * lineHeight) + lshift;
- int lh= region.y * lineHeight;
-
- fRight.getLineRange(diff.fRightPos, region);
- int ry= (region.x * lineHeight) + rshift;
- int rh= region.y * lineHeight;
-
- if (Math.max(ly+lh, ry+rh) < 0)
- continue;
- if (Math.min(ly, ry) >= visibleHeight)
- break;
-
- fPts[0]= x; fPts[1]= ly; fPts[2]= w; fPts[3]= ry;
- fPts[6]= x; fPts[7]= ly+lh; fPts[4]= w; fPts[5]= ry+rh;
-
- Color fillColor= getColor(display, getFillColor(diff));
- Color strokeColor= getColor(display, getStrokeColor(diff));
-
- if (fUseSingleLine) {
- int w2= 3;
-
- g.setBackground(fillColor);
- g.fillRectangle(0, ly, w2, lh); // left
- g.fillRectangle(w-w2, ry, w2, rh); // right
-
- g.setLineWidth(LW);
- g.setForeground(strokeColor);
- g.drawRectangle(0-1, ly, w2, lh); // left
- g.drawRectangle(w-w2, ry, w2, rh); // right
-
- if (fUseSplines) {
- int[] points= getCenterCurvePoints(w2, ly+lh/2, w-w2, ry+rh/2);
- for (int i= 1; i < points.length; i++)
- g.drawLine(w2+i-1, points[i-1], w2+i, points[i]);
- } else {
- g.drawLine(w2, ly+lh/2, w-w2, ry+rh/2);
- }
- } else {
- // two lines
- if (fUseSplines) {
- g.setBackground(fillColor);
-
- g.setLineWidth(LW);
- g.setForeground(strokeColor);
-
- int[] topPoints= getCenterCurvePoints(fPts[0], fPts[1], fPts[2], fPts[3]);
- int[] bottomPoints= getCenterCurvePoints(fPts[6], fPts[7], fPts[4], fPts[5]);
- g.setForeground(fillColor);
- g.drawLine(0, bottomPoints[0], 0, topPoints[0]);
- for (int i= 1; i < bottomPoints.length; i++) {
- g.setForeground(fillColor);
- g.drawLine(i, bottomPoints[i], i, topPoints[i]);
- g.setForeground(strokeColor);
- g.drawLine(i-1, topPoints[i-1], i, topPoints[i]);
- g.drawLine(i-1, bottomPoints[i-1], i, bottomPoints[i]);
- }
- } else {
- g.setBackground(fillColor);
- g.fillPolygon(fPts);
-
- g.setLineWidth(LW);
- g.setForeground(strokeColor);
- g.drawLine(fPts[0], fPts[1], fPts[2], fPts[3]);
- g.drawLine(fPts[6], fPts[7], fPts[4], fPts[5]);
- }
- }
-
- if (showResolveUI && diff.isUnresolvedIncomingOrConflicting()) {
- // draw resolve state
- int cx= (w-RESOLVE_SIZE)/2;
- int cy= ((ly+lh/2) + (ry+rh/2) - RESOLVE_SIZE)/2;
-
- g.setBackground(fillColor);
- g.fillRectangle(cx, cy, RESOLVE_SIZE, RESOLVE_SIZE);
-
- g.setForeground(strokeColor);
- g.drawRectangle(cx, cy, RESOLVE_SIZE, RESOLVE_SIZE);
- }
- }
- }
- }
-
- private int[] getCenterCurvePoints(int startx, int starty, int endx, int endy) {
- if (fBasicCenterCurve == null)
- buildBaseCenterCurve(endx-startx);
- double height= endy - starty;
- height= height/2;
- int width= endx-startx;
- int[] points= new int[width];
- for (int i= 0; i < width; i++) {
- points[i]= (int) (-height * fBasicCenterCurve[i] + height + starty);
- }
- return points;
- }
-
- private void buildBaseCenterCurve(int w) {
- double width= w;
- fBasicCenterCurve= new double[getCenterWidth()];
- for (int i= 0; i < getCenterWidth(); i++) {
- double r= i / width;
- fBasicCenterCurve[i]= Math.cos(Math.PI * r);
- }
- }
-
- private void paintSides(GC g, MergeSourceViewer tp, Canvas canvas, boolean right) {
-
- Display display= canvas.getDisplay();
-
- int lineHeight= tp.getTextWidget().getLineHeight();
- int visibleHeight= tp.getViewportHeight();
-
- Point size= canvas.getSize();
- int x= 0;
- int w= fMarginWidth;
- int w2= w/2;
-
- g.setBackground(canvas.getBackground());
- g.fillRectangle(x, 0, w, size.y);
-
- if (!fIsMotif) {
- // draw thin line between ruler and text
- g.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- if (right)
- g.fillRectangle(0, 0, 1, size.y);
- else
- g.fillRectangle(size.x-1, 0, 1, size.y);
- }
-
- if (! fHiglightRanges)
- return;
-
- if (fChangeDiffs != null) {
- int shift= tp.getVerticalScrollOffset() + (2-LW);
-
- Point region= new Point(0, 0);
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- tp.getLineRange(diff.getPosition(tp), region);
- int y= (region.x * lineHeight) + shift;
- int h= region.y * lineHeight;
-
- if (y+h < 0)
- continue;
- if (y >= visibleHeight)
- break;
-
- g.setBackground(getColor(display, getFillColor(diff)));
- if (right)
- g.fillRectangle(x, y, w2, h);
- else
- g.fillRectangle(x+w2, y, w2, h);
-
- g.setLineWidth(LW);
- g.setForeground(getColor(display, getStrokeColor(diff)));
- if (right)
- g.drawRectangle(x-1, y-1, w2, h);
- else
- g.drawRectangle(x+w2, y-1, w2, h);
- }
- }
- }
-
- private void paint(PaintEvent event, MergeSourceViewer tp) {
-
- if (! fHiglightRanges)
- return;
- if (fChangeDiffs == null)
- return;
-
- Control canvas= (Control) event.widget;
- GC g= event.gc;
-
- Display display= canvas.getDisplay();
-
- int lineHeight= tp.getTextWidget().getLineHeight();
- int w= canvas.getSize().x;
- int shift= tp.getVerticalScrollOffset() + (2-LW);
- int maxh= event.y+event.height; // visibleHeight
-
- //if (fIsMotif)
- shift+= fTopInset;
-
- Point range= new Point(0, 0);
-
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly && !isCurrentDiff(diff))
- continue;
-
- tp.getLineRange(diff.getPosition(tp), range);
- int y= (range.x * lineHeight) + shift;
- int h= range.y * lineHeight;
-
- if (y+h < event.y)
- continue;
- if (y > maxh)
- break;
-
- g.setBackground(getColor(display, getStrokeColor(diff)));
- g.fillRectangle(0, y-1, w, LW);
- g.fillRectangle(0, y+h-1, w, LW);
- }
- }
-
- private RGB getFillColor(Diff diff) {
- boolean selected= fCurrentDiff != null && fCurrentDiff.fParent == diff;
-
- RGB selected_fill= getBackground(null);
-
- if (isThreeWay() && !fIgnoreAncestor) {
- switch (diff.fDirection) {
- case RangeDifference.RIGHT:
- if (fLeftIsLocal)
- return selected ? selected_fill : INCOMING_FILL;
- return selected ? selected_fill : OUTGOING_FILL;
- case RangeDifference.ANCESTOR:
- return selected ? selected_fill : CONFLICT_FILL;
- case RangeDifference.LEFT:
- if (fLeftIsLocal)
- return selected ? selected_fill : OUTGOING_FILL;
- return selected ? selected_fill : INCOMING_FILL;
- case RangeDifference.CONFLICT:
- return selected ? selected_fill : CONFLICT_FILL;
- }
- return null;
- }
- return selected ? selected_fill : OUTGOING_FILL;
- }
-
- private RGB getStrokeColor(Diff diff) {
- boolean selected= fCurrentDiff != null && fCurrentDiff.fParent == diff;
-
- if (isThreeWay() && !fIgnoreAncestor) {
- switch (diff.fDirection) {
- case RangeDifference.RIGHT:
- if (fLeftIsLocal)
- return selected ? SELECTED_INCOMING : INCOMING;
- return selected ? SELECTED_OUTGOING : OUTGOING;
- case RangeDifference.ANCESTOR:
- return selected ? SELECTED_CONFLICT : CONFLICT;
- case RangeDifference.LEFT:
- if (fLeftIsLocal)
- return selected ? SELECTED_OUTGOING : OUTGOING;
- return selected ? SELECTED_INCOMING : INCOMING;
- case RangeDifference.CONFLICT:
- return selected ? SELECTED_CONFLICT : CONFLICT;
- }
- return null;
- }
- return selected ? SELECTED_OUTGOING : OUTGOING;
- }
-
- private Color getColor(Display display, RGB rgb) {
- if (rgb == null)
- return null;
- if (fColors == null)
- fColors= new HashMap(20);
- Color c= (Color) fColors.get(rgb);
- if (c == null) {
- c= new Color(display, rgb);
- fColors.put(rgb, c);
- }
- return c;
- }
-
- static RGB interpolate(RGB fg, RGB bg, double scale) {
- return new RGB(
- (int)((1.0-scale) * fg.red + scale * bg.red),
- (int)((1.0-scale) * fg.green + scale * bg.green),
- (int)((1.0-scale) * fg.blue + scale * bg.blue)
- );
- }
-
- //---- Navigating and resolving Diffs
-
- /**
- * Returns true if end (or beginning) of document reached.
- */
- private boolean navigate(boolean down, boolean wrap, boolean deep) {
-
- Diff diff= null;
-
- for (;;) {
-
- if (fChangeDiffs != null) {
- MergeSourceViewer part= fFocusPart;
- if (part == null)
- part= fRight;
-
- if (part != null) {
- Point s= part.getSelectedRange();
- if (down)
- diff= findNext(part, fChangeDiffs, s.x, s.x+s.y, deep);
- else
- diff= findPrev(part, fChangeDiffs, s.x, s.x+s.y, deep);
- }
- }
-
- if (diff == null) { // at end or beginning
- if (wrap) {
- if (!fEndOfDocReached) {
- fEndOfDocReached= true;
- if (! endOfDocumentReached(down))
- return true;
- }
- fEndOfDocReached= false;
- if (fChangeDiffs != null && fChangeDiffs.size() > 0) {
- if (down)
- diff= (Diff) fChangeDiffs.get(0);
- else
- diff= (Diff) fChangeDiffs.get(fChangeDiffs.size()-1);
- }
- } else {
- fEndOfDocReached= false;
- return true;
- }
- }
-
- setCurrentDiff(diff, true);
-
- if (diff != null && diff.fDirection == RangeDifference.ANCESTOR
- && !getAncestorEnabled())
- continue;
-
- break;
- }
-
- return false;
- }
-
- private boolean endOfDocumentReached(boolean down) {
- Control c= getControl();
- if (Utilities.okToUse(c)) {
-
- c.getDisplay().beep();
-
- String key= down ? "atEnd" : "atBeginning"; //$NON-NLS-1$ //$NON-NLS-2$
- return MessageDialog.openQuestion(c.getShell(),
- CompareMessages.getString("TextMergeViewer."+key+".title"), //$NON-NLS-1$ //$NON-NLS-2$
- CompareMessages.getString("TextMergeViewer."+key+".message")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return false;
- }
-
- /**
- * Find the Diff that overlaps with the given TextPart's text range.
- * If the range doesn't overlap with any range <code>null</code>
- * is returned.
- */
- private Diff findDiff(MergeSourceViewer tp, int rangeStart, int rangeEnd) {
- if (fChangeDiffs != null) {
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.contains(tp, rangeStart, rangeEnd))
- return diff;
- }
- }
- return null;
- }
-
- private static Diff findNext(MergeSourceViewer tp, List v, int start, int end, boolean deep) {
- for (int i= 0; i < v.size(); i++) {
- Diff diff= (Diff) v.get(i);
- Position p= diff.getPosition(tp);
- if (p != null) {
- int startOffset= p.getOffset();
- if (end < startOffset) // <=
- return diff;
- if (deep && diff.fDiffs != null) {
- Diff d= null;
- int endOffset= startOffset + p.getLength();
- if (start == startOffset && (end == endOffset || end == endOffset-1)) {
- d= findNext(tp, diff.fDiffs, start-1, start-1, deep);
- } else if (end < endOffset) {
- d= findNext(tp, diff.fDiffs, start, end, deep);
- }
- if (d != null)
- return d;
- }
- }
- }
- return null;
- }
-
- private static Diff findPrev(MergeSourceViewer tp, List v, int start, int end, boolean deep) {
- for (int i= v.size()-1; i >= 0; i--) {
- Diff diff= (Diff) v.get(i);
- Position p= diff.getPosition(tp);
- if (p != null) {
- int startOffset= p.getOffset();
- int endOffset= startOffset + p.getLength();
- if (start > endOffset)
- return diff;
- if (deep && diff.fDiffs != null) {
- Diff d= null;
- if (start == startOffset && end == endOffset) {
- d= findPrev(tp, diff.fDiffs, end, end, deep);
- } else if (start >= startOffset) {
- d= findPrev(tp, diff.fDiffs, start, end, deep);
- }
- if (d != null)
- return d;
- }
- }
- }
- return null;
- }
-
- /*
- * Set the currently active Diff and update the toolbars controls and lines.
- * If <code>revealAndSelect</code> is <code>true</code> the Diff is revealed and
- * selected in both TextParts.
- */
- private void setCurrentDiff(Diff d, boolean revealAndSelect) {
-
-// if (d == fCurrentDiff)
-// return;
-
- if (fCenterButton != null)
- fCenterButton.setVisible(false);
-
- fEndOfDocReached= false;
-
- Diff oldDiff= fCurrentDiff;
-
- if (d != null && revealAndSelect) {
-
- // before we set fCurrentDiff we change the selection
- // so that the paint code uses the old background colors
- // otherwise selection isn't drawn correctly
- if (isThreeWay() && !fIgnoreAncestor)
- fAncestor.setSelection(d.fAncestorPos);
- fLeft.setSelection(d.fLeftPos);
- fRight.setSelection(d.fRightPos);
-
- // now switch diffs
- fCurrentDiff= d;
- revealDiff(d, d.fIsToken);
- } else {
- fCurrentDiff= d;
- }
-
- Diff d1= oldDiff != null ? oldDiff.fParent : null;
- Diff d2= fCurrentDiff != null ? fCurrentDiff.fParent : null;
- if (d1 != d2) {
- updateDiffBackground(d1);
- updateDiffBackground(d2);
- }
-
- updateControls();
- invalidateLines();
- refreshBirdsEyeView();
- }
-
- /**
- * Smart determines whether
- */
- private void revealDiff(Diff d, boolean smart) {
-
- boolean ancestorIsVisible= false;
- boolean leftIsVisible= false;
- boolean rightIsVisible= false;
-
- if (smart) {
- Point region= new Point(0, 0);
- // find the starting line of the diff in all text widgets
- int ls= fLeft.getLineRange(d.fLeftPos, region).x;
- int rs= fRight.getLineRange(d.fRightPos, region).x;
-
- if (isThreeWay() && !fIgnoreAncestor) {
- int as= fAncestor.getLineRange(d.fAncestorPos, region).x;
- if (as >= fAncestor.getTopIndex() && as <= fAncestor.getBottomIndex())
- ancestorIsVisible= true;
- }
-
- if (ls >= fLeft.getTopIndex() && ls <= fLeft.getBottomIndex())
- leftIsVisible= true;
-
- if (rs >= fRight.getTopIndex() && rs <= fRight.getBottomIndex())
- rightIsVisible= true;
- }
-
- // vertical scrolling
- if (!leftIsVisible || !rightIsVisible) {
- int avpos= 0, lvpos= 0, rvpos= 0;
-
- MergeSourceViewer allButThis= null;
- if (leftIsVisible) {
- avpos= lvpos= rvpos= realToVirtualPosition(fLeft, fLeft.getTopIndex());
- allButThis= fLeft;
- } else if (rightIsVisible) {
- avpos= lvpos= rvpos= realToVirtualPosition(fRight, fRight.getTopIndex());
- allButThis= fRight;
- } else if (ancestorIsVisible) {
- avpos= lvpos= rvpos= realToVirtualPosition(fAncestor, fAncestor.getTopIndex());
- allButThis= fAncestor;
- } else {
- if (fAllDiffs != null) {
- int vpos= 0;
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- if (diff == d)
- break;
- if (fSynchronizedScrolling) {
- vpos+= diff.getMaxDiffHeight(fShowAncestor);
- } else {
- avpos+= diff.getAncestorHeight();
- lvpos+= diff.getLeftHeight();
- rvpos+= diff.getRightHeight();
- }
- }
- if (fSynchronizedScrolling)
- avpos= lvpos= rvpos= vpos;
- }
- int delta= fRight.getViewportLines()/4;
- avpos-= delta;
- if (avpos < 0)
- avpos= 0;
- lvpos-= delta;
- if (lvpos < 0)
- lvpos= 0;
- rvpos-= delta;
- if (rvpos < 0)
- rvpos= 0;
- }
-
- scrollVertical(avpos, lvpos, rvpos, allButThis);
-
- if (fVScrollBar != null)
- fVScrollBar.setSelection(avpos);
- }
-
- // horizontal scrolling
- if (d.fIsToken) {
- // we only scroll horizontally for token diffs
- reveal(fAncestor, d.fAncestorPos);
- reveal(fLeft, d.fLeftPos);
- reveal(fRight, d.fRightPos);
- } else {
- // in all other cases we reset the horizontal offset
- hscroll(fAncestor);
- hscroll(fLeft);
- hscroll(fRight);
- }
- }
-
- private static void reveal(MergeSourceViewer v, Position p) {
- if (v != null && p != null) {
- StyledText st= v.getTextWidget();
- if (st != null) {
- Rectangle r= st.getClientArea();
- if (!r.isEmpty()) // workaround for #7320: Next diff scrolls when going into current diff
- v.revealRange(p.offset, p.length);
- }
- }
- }
-
- private static void hscroll(MergeSourceViewer v) {
- if (v != null) {
- StyledText st= v.getTextWidget();
- if (st != null)
- st.setHorizontalIndex(0);
- }
- }
-
- //--------------------------------------------------------------------------------
-
- void copyAllUnresolved(boolean leftToRight) {
- if (fChangeDiffs != null && isThreeWay() && !fIgnoreAncestor) {
- IRewriteTarget target= leftToRight ? fRight.getRewriteTarget() : fLeft.getRewriteTarget();
- boolean compoundChangeStarted= false;
- Iterator e= fChangeDiffs.iterator();
- try {
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- switch (diff.fDirection) {
- case RangeDifference.LEFT:
- if (leftToRight) {
- if (!compoundChangeStarted) {
- target.beginCompoundChange();
- compoundChangeStarted= true;
- }
- copy(diff, leftToRight);
- }
- break;
- case RangeDifference.RIGHT:
- if (!leftToRight) {
- if (!compoundChangeStarted) {
- target.beginCompoundChange();
- compoundChangeStarted= true;
- }
- copy(diff, leftToRight);
- }
- break;
- default:
- continue;
- }
- }
- } finally {
- if (compoundChangeStarted) {
- target.endCompoundChange();
- }
- }
- }
- }
-
- /*
- * Copy whole document from one side to the other.
- */
- protected void copy(boolean leftToRight) {
-
- if (showResolveUI()) {
- copyAllUnresolved(leftToRight);
- invalidateLines();
- return;
- }
-
- if (leftToRight) {
- if (fLeft.getEnabled()) {
- // copy text
- String text= fLeft.getTextWidget().getText();
- fRight.getTextWidget().setText(text);
- fRight.setEnabled(true);
- } else {
- // delete
- fRight.getTextWidget().setText(""); //$NON-NLS-1$
- fRight.setEnabled(false);
- }
- fRightLineCount= fRight.getLineCount();
- setRightDirty(true);
- } else {
- if (fRight.getEnabled()) {
- // copy text
- String text= fRight.getTextWidget().getText();
- fLeft.getTextWidget().setText(text);
- fLeft.setEnabled(true);
- } else {
- // delete
- fLeft.getTextWidget().setText(""); //$NON-NLS-1$
- fLeft.setEnabled(false);
- }
- fLeftLineCount= fLeft.getLineCount();
- setLeftDirty(true);
- }
- doDiff();
- invalidateLines();
- updateVScrollBar();
- selectFirstDiff();
- refreshBirdsEyeView();
- }
-
- private void copyDiffLeftToRight() {
- copy(fCurrentDiff, true, false);
- }
-
- private void copyDiffRightToLeft() {
- copy(fCurrentDiff, false, false);
- }
-
- /*
- * Copy the contents of the given diff from one side to the other.
- */
- private void copy(Diff diff, boolean leftToRight, boolean gotoNext) {
- if (copy(diff, leftToRight)) {
- if (gotoNext) {
- navigate(true, true, true);
- } else {
- revealDiff(diff, true);
- updateControls();
- }
- }
- }
-
- /*
- * Copy the contents of the given diff from one side to the other but
- * doesn't reveal anything.
- * Returns true if copy was succesful.
- */
- private boolean copy(Diff diff, boolean leftToRight) {
-
- if (diff != null && !diff.isResolved()) {
-
- Position fromPos= null;
- Position toPos= null;
- IDocument fromDoc= null;
- IDocument toDoc= null;
-
- if (leftToRight) {
- fRight.setEnabled(true);
- fromPos= diff.fLeftPos;
- toPos= diff.fRightPos;
- fromDoc= fLeft.getDocument();
- toDoc= fRight.getDocument();
- } else {
- fLeft.setEnabled(true);
- fromPos= diff.fRightPos;
- toPos= diff.fLeftPos;
- fromDoc= fRight.getDocument();
- toDoc= fLeft.getDocument();
- }
-
- if (fromDoc != null) {
-
- int fromStart= fromPos.getOffset();
- int fromLen= fromPos.getLength();
-
- int toStart= toPos.getOffset();
- int toLen= toPos.getLength();
-
- try {
- String s= null;
-
- switch (diff.fDirection) {
- case RangeDifference.RIGHT:
- case RangeDifference.LEFT:
- s= fromDoc.get(fromStart, fromLen);
- break;
- case RangeDifference.ANCESTOR:
- break;
- case RangeDifference.CONFLICT:
- if (APPEND_CONFLICT) {
- s= toDoc.get(toStart, toLen);
- s+= fromDoc.get(fromStart, fromLen);
- } else
- s= fromDoc.get(fromStart, fromLen);
- break;
- }
- if (s != null) {
- toDoc.replace(toStart, toLen, s);
- toPos.setOffset(toStart);
- toPos.setLength(s.length());
- }
-
- } catch (BadLocationException e) {
- // silently ignored
- }
- }
-
- diff.setResolved(true);
- updateResolveStatus();
-
- return true;
- }
- return false;
- }
-
- //---- scrolling
-
- /**
- * Calculates virtual height (in lines) of views by adding the maximum of corresponding diffs.
- */
- private int getVirtualHeight() {
- int h= 1;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- h+= diff.getMaxDiffHeight(fShowAncestor);
- }
- }
- return h;
- }
-
- /**
- * Calculates height (in lines) of right view by adding the height of the right diffs.
- */
- private int getRightHeight() {
- int h= 1;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- h+= diff.getRightHeight();
- }
- }
- return h;
- }
-
- /**
- * The height of the TextEditors in lines.
- */
- private int getViewportHeight() {
- StyledText te= fLeft.getTextWidget();
-
- int vh= te.getClientArea().height;
- if (vh == 0) {
- Rectangle trim= te.computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height;
-
- int headerHeight= getHeaderHeight();
-
- Composite composite= (Composite) getControl();
- Rectangle r= composite.getClientArea();
-
- vh= r.height-headerHeight-scrollbarHeight;
- }
-
- return vh / te.getLineHeight();
- }
-
- /**
- * Returns the virtual position for the given view position.
- */
- private int realToVirtualPosition(MergeSourceViewer w, int vpos) {
-
- if (! fSynchronizedScrolling || fAllDiffs == null)
- return vpos;
-
- int viewPos= 0; // real view position
- int virtualPos= 0; // virtual position
- Point region= new Point(0, 0);
-
- Iterator e= fAllDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- Position pos= diff.getPosition(w);
- w.getLineRange(pos, region);
- int realHeight= region.y;
- int virtualHeight= diff.getMaxDiffHeight(fShowAncestor);
- if (vpos <= viewPos + realHeight) { // OK, found!
- vpos-= viewPos; // make relative to this slot
- // now scale position within this slot to virtual slot
- if (realHeight <= 0)
- vpos= 0;
- else
- vpos= (vpos*virtualHeight)/realHeight;
- return virtualPos+vpos;
- }
- viewPos+= realHeight;
- virtualPos+= virtualHeight;
- }
- return virtualPos;
- }
-
- private void scrollVertical(int avpos, int lvpos, int rvpos, MergeSourceViewer allBut) {
-
- int s= 0;
-
- if (fSynchronizedScrolling) {
- s= getVirtualHeight() - rvpos;
- int height= fRight.getViewportLines()/4;
- if (s < 0)
- s= 0;
- if (s > height)
- s= height;
- }
-
- fInScrolling= true;
-
- if (isThreeWay() && allBut != fAncestor) {
- if (fSynchronizedScrolling || allBut == null) {
- int y= virtualToRealPosition(fAncestor, avpos+s)-s;
- fAncestor.vscroll(y);
- }
- }
-
- if (allBut != fLeft) {
- if (fSynchronizedScrolling || allBut == null) {
- int y= virtualToRealPosition(fLeft, lvpos+s)-s;
- fLeft.vscroll(y);
- }
- }
-
- if (allBut != fRight) {
- if (fSynchronizedScrolling || allBut == null) {
- int y= virtualToRealPosition(fRight, rvpos+s)-s;
- fRight.vscroll(y);
- }
- }
-
- fInScrolling= false;
-
- if (isThreeWay() && fAncestorCanvas != null)
- fAncestorCanvas.repaint();
-
- if (fLeftCanvas != null)
- fLeftCanvas.repaint();
-
- Control center= getCenter();
- if (center instanceof BufferedCanvas)
- ((BufferedCanvas)center).repaint();
-
- if (fRightCanvas != null)
- fRightCanvas.repaint();
- }
-
- /**
- * Updates Scrollbars with viewports.
- */
- private void syncViewport(MergeSourceViewer w) {
-
- if (fInScrolling)
- return;
-
- int ix= w.getTopIndex();
- int ix2= w.getDocumentRegionOffset();
-
- int viewPosition= realToVirtualPosition(w, ix-ix2);
-
- scrollVertical(viewPosition, viewPosition, viewPosition, w); // scroll all but the given views
-
- if (fVScrollBar != null) {
- int value= Math.max(0, Math.min(viewPosition, getVirtualHeight() - getViewportHeight()));
- fVScrollBar.setSelection(value);
- //refreshBirdEyeView();
- }
- }
-
- /**
- */
- private void updateVScrollBar() {
-
- if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
- int virtualHeight= getVirtualHeight();
- int viewPortHeight= getViewportHeight();
- int pageIncrement= viewPortHeight-1;
- int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
-
- fVScrollBar.setPageIncrement(pageIncrement);
- fVScrollBar.setMaximum(virtualHeight);
- fVScrollBar.setThumb(thumb);
- }
- }
-
- /**
- * maps given virtual position into a real view position of this view.
- */
- private int virtualToRealPosition(MergeSourceViewer part, int v) {
-
- if (! fSynchronizedScrolling || fAllDiffs == null)
- return v;
-
- int virtualPos= 0;
- int viewPos= 0;
- Point region= new Point(0, 0);
-
- Iterator e= fAllDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- Position pos= diff.getPosition(part);
- int viewHeight= part.getLineRange(pos, region).y;
- int virtualHeight= diff.getMaxDiffHeight(fShowAncestor);
- if (v < (virtualPos + virtualHeight)) {
- v-= virtualPos; // make relative to this slot
- if (viewHeight <= 0) {
- v= 0;
- } else {
- v= (v*viewHeight)/virtualHeight;
- }
- return viewPos+v;
- }
- virtualPos+= virtualHeight;
- viewPos+= viewHeight;
- }
- return viewPos;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties
deleted file mode 100644
index 491657991..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties
+++ /dev/null
@@ -1,98 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# @(#)TextMergeViewerResources.properties
-#
-# Resource strings for TextMergeViewer.java
-
-title= Text Compare
-
-saveDialog.title= Save Resource
-saveDialog.message= Resource has been modified. Save changes?
-
-compareProgressTask.title= Computing Differences...
-
-tooComplexError.title= Error
-tooComplexError.format= Too many differences. Turn on the ''Ignore White Space'' option or do a structure compare first.
-
-#####################################################
-# Toolbar actions
-#####################################################
-
-action.CopyLeftToRight.label=Copy Left to Right
-action.CopyLeftToRight.tooltip=Copy All from Left to Right
-action.CopyLeftToRight.image=copy_r_co.gif
-
-action.CopyRightToLeft.label=Copy Right to Left
-action.CopyRightToLeft.tooltip=Copy All Non-Conflicting Changes from Right to Left
-action.CopyRightToLeft.image=copy_l_co.gif
-
-action.CopyDiffLeftToRight.label=Copy Current Diff
-action.CopyDiffLeftToRight.tooltip=Copy Current Change from Left to Right
-action.CopyDiffLeftToRight.image=copycont_r_co.gif
-
-action.CopyDiffRightToLeft.label=Copy Current Diff
-action.CopyDiffRightToLeft.tooltip=Copy Current Change from Right to Left
-action.CopyDiffRightToLeft.image=copycont_l_co.gif
-
-action.NextDiff.label=Next
-action.NextDiff.tooltip=Select Next Change
-action.NextDiff.image=next_nav.gif
-
-action.PrevDiff.label=Previous
-action.PrevDiff.tooltip=Select Previous Change
-action.PrevDiff.image=prev_nav.gif
-
-action.EnableAncestor.label=Enable Ancestor Pane
-action.EnableAncestor.tooltip.unchecked=Show Ancestor Pane
-action.EnableAncestor.tooltip.checked=Hide Ancestor Pane
-action.EnableAncestor.description.unchecked=Show Ancestor Pane
-action.EnableAncestor.description.checked=Hide Ancestor Pane
-action.EnableAncestor.image=ancestorpane_co.gif
-
-action.IgnoreAncestor.label=Ignore Ancestor
-action.IgnoreAncestor.tooltip.unchecked=Two-Way Compare (Ignore Ancestor)
-action.IgnoreAncestor.tooltip.checked=Three-Way Compare
-action.IgnoreAncestor.description.unchecked=Two-Way Compare (Ignore Ancestor)
-action.IgnoreAncestor.description.checked=Three-Way Compare
-action.IgnoreAncestor.image=twowaycompare_co.gif
-
-
-#####################################################
-# Context menu actions
-#####################################################
-
-action.undo.label=Undo@Ctrl+Z
-action.undo.tooltip=Undo Last Operation
-
-action.redo.label=Redo@Ctrl+Y
-action.redo.tooltip=Redo Last Operation
-
-action.cut.label=Cut@Ctrl+X
-action.cut.tooltip=Cut Text Selection to Clipboard
-
-action.copy.label=Copy@Ctrl+C
-action.copy.tooltip=Copy Text Selection to Clipboard
-
-action.paste.label=Paste@Ctrl+V
-action.paste.tooltip=Replace Text Selection with Clipboard
-
-action.delete.label=Delete
-action.delete.tooltip=Delete Current Text Selection
-
-action.find.label=Find...@Ctrl+F
-action.find.tooltip=Find Occurrence
-
-action.selectAll.label=Select All@Ctrl+A
-action.selectAll.tooltip=Select All Changes
-
-action.save.label=Save@Ctrl+S
-action.save.tooltip=Save Changes
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html
deleted file mode 100644
index 9f606fb95..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html
+++ /dev/null
@@ -1,45 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Support for compare and merge viewers which show the
-content side-by-side.
-<h2>
-Package Specification</h2>
-
-The <b>ContentMergeViewer</b> is an abstract compare and merge viewer
-with two side-by-side content areas and an optional content area for a
-common ancestor (for three-way compare). Because the implementation makes
-no assumptions about the content type it is a subclass responsibility to
-deal with a specific type. Its subclass <b>ImageMergeViewer</b> in
-package org.eclipse.compare.internal shows how to base a simple
-mergeviewer for images on <b>ContentMergeViewer</b>.
-<p>
-
-A <b>ContentMergeViewer</b> accesses its model by means of a content
-provider which must implement the <b>IMergeViewerContentProvider</b> interface.
-<p>
-
-The <b>TextMergeViewer</b> is the standard concrete subclass of
-<b>ContentMergeViewer</b> for comparing and merging text content.
-<br>
-A text merge viewer uses the <b>org.eclipse.compare.rangedifferencer.RangeDifferencer</b>
-to perform a textual, line-by-line comparison of two (or three) input documents.
-For text lines that differ the <b>TextMergeViewer</b> uses an <b>ITokenComparator</b>
-to find longest sequences of matching and non-matching tokens.
-The <b>TextMergeViewer</b>'s
-default token compare works on characters separated by whitespace. If a
-different strategy is needed (for example, Java tokens in a Java-aware
-merge viewer), clients can create their own token comparators by implementing
-the <b>ITokenComparator</b> interface.
-<p>The <b>TextMergeViewer</b> not only works on whole documents but on
-subranges of documents too. In this case the viewer's input must be an
-<b>IDocumentRange</b> instead of an <b>IDocument</b>.
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
deleted file mode 100644
index d6c202174..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.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.compare.internal;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.Viewer;
-
-
-public abstract class AbstractViewer extends Viewer {
-
- public void setInput(Object input) {
- }
-
- public Object getInput() {
- return null;
- }
-
- public ISelection getSelection() {
- return null;
- }
-
- public void setSelection(ISelection s, boolean reveal) {
- }
-
- public void refresh() {
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
deleted file mode 100644
index 51892e496..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.util.ResourceBundle;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-
-public class AddFromHistoryAction extends BaseCompareAction {
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.internal.AddFromHistoryAction"; //$NON-NLS-1$
-
- public AddFromHistoryAction() {
- }
-
- protected boolean isEnabled(ISelection selection) {
- return Utilities.getResources(selection).length == 1;
- }
-
- protected void run(ISelection selection) {
-
- ResourceBundle bundle= ResourceBundle.getBundle(BUNDLE_NAME);
- String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
- Shell parentShell= CompareUIPlugin.getShell();
- AddFromHistoryDialog dialog= null;
-
- Object[] s= Utilities.getResources(selection);
-
- for (int i= 0; i < s.length; i++) {
- Object o= s[i];
- if (o instanceof IContainer) {
- IContainer container= (IContainer) o;
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(parentShell);
- IProgressMonitor pm= pmdialog.getProgressMonitor();
- IFile[] states= null;
- try {
- states= container.findDeletedMembersWithHistory(IResource.DEPTH_INFINITE, pm);
- } catch (CoreException ex) {
- pm.done();
- }
-
- if (states == null || states.length <= 0) {
- String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
- MessageDialog.openInformation(parentShell, title, msg);
- return;
- }
-
- if (dialog == null) {
- dialog= new AddFromHistoryDialog(parentShell, bundle);
- dialog.setHelpContextId(ICompareContextIds.ADD_FROM_HISTORY_DIALOG);
- }
-
- if (dialog.select(container, states)) {
-
- AddFromHistoryDialog.HistoryInput[] selected= dialog.getSelected();
-
- if (selected != null && selected.length > 0) {
- try {
- updateWorkspace(bundle, parentShell, selected);
-
- } catch (InterruptedException x) {
- // Do nothing. Operation has been canceled by user.
-
- } catch (InvocationTargetException x) {
- String reason= x.getTargetException().getMessage();
- MessageDialog.openError(parentShell, title, Utilities.getFormattedString(bundle, "replaceError", reason)); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
-
- void createContainers(IResource resource) throws CoreException {
- IContainer container= resource.getParent();
- if (container instanceof IFolder) {
- IFolder parent= (IFolder) container;
- if (parent != null && !parent.exists()) {
- createContainers(parent);
- parent.create(false, true, null);
- }
- }
- }
-
- private void updateWorkspace(final ResourceBundle bundle, Shell shell,
- final AddFromHistoryDialog.HistoryInput[] selected)
- throws InvocationTargetException, InterruptedException {
-
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws InvocationTargetException {
- try {
- String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
- pm.beginTask(taskName, selected.length);
-
- for (int i= 0; i < selected.length; i++) {
- IFile file= selected[i].fFile;
- IFileState fileState= selected[i].fFileState;
- createContainers(file);
-
- SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 1);
- try {
- file.create(fileState.getContents(), false, subMonitor);
- } finally {
- subMonitor.done();
- }
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- pm.done();
- }
- }
- };
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties
deleted file mode 100644
index e25207118..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties
+++ /dev/null
@@ -1,45 +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
-###############################################################################
-
-# @(#)AddFromHistoryAction.properties
-#
-# Resources for AddFromHistoryAction.java
-
-title= Restore from Local History
-
-memberPaneTitle= {0} - Available Files in Local History:
-
-treeTitleFormat= Local History of ''{0}''
-dateIcon= obj16/day_obj.gif
-timeIcon= obj16/resource_obj.gif
-
-memberDescription= Check files to restore from the local history:
-editionDescription= Select an edition of a file:
-
-treeFormat= {0}
-workspaceTreeFormat= {0} (Workspace File)
-parseErrorFormat= {0} (Parse Error)
-
-editionLabel= Local History ({0})
-workspaceEditionLabel= Workspace File
-
-targetLabel= {0}
-
-todayFormat= Today ({0})
-yesterdayFormat= Yesterday ({0})
-dayFormat= {0}
-
-buttonLabel= Restore
-
-noLocalHistoryError= No deleted resources in local history for selected container.
-replaceError=Can''t replace resource (reason: {0}).
-
-taskName=Restoring \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
deleted file mode 100644
index 3d323f541..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
+++ /dev/null
@@ -1,475 +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.compare.internal;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.compare.*;
-
-
-public class AddFromHistoryDialog extends ResizableDialog {
-
- static class HistoryInput implements ITypedElement, IEncodedStreamContentAccessor, IModificationDate {
- IFile fFile;
- IFileState fFileState;
-
- HistoryInput(IFile file, IFileState fileState) {
- fFile= file;
- fFileState= fileState;
- }
- public InputStream getContents() throws CoreException {
- return new BufferedInputStream(fFileState.getContents());
- }
- public String getCharset() {
- String charset= null;
- try {
- charset= fFileState.getCharset();
- } catch (CoreException e) {
- // fall through
- }
- if (charset == null)
- charset= Utilities.getCharset(fFile);
- return charset;
- }
- public String getName() {
- return fFile.getName();
- }
- public String getType() {
- return fFile.getFileExtension();
- }
- public Image getImage() {
- return CompareUI.getImage(fFile);
- }
- public long getModificationDate() {
- return fFileState.getModificationTime();
- }
- }
-
- static class FileHistory {
- private IFile fFile;
- private IFileState[] fStates;
- private int fSelected;
-
- FileHistory(IFile file) {
- fFile= file;
- }
-
- IFile getFile() {
- return fFile;
- }
-
- IFileState[] getStates() {
- if (fStates == null) {
- try {
- fStates= fFile.getHistory(new NullProgressMonitor());
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- return fStates;
- }
-
- IFileState getSelectedState() {
- return getStates()[fSelected];
- }
-
- void setSelected(IFileState state) {
- for (int i= 0; i < fStates.length; i++) {
- if (fStates[i] == state) {
- fSelected= i;
- return;
- }
- }
- }
-
- HistoryInput getHistoryInput() {
- return new HistoryInput(fFile, getSelectedState());
- }
-
- boolean isSelected(int index) {
- return index == fSelected;
- }
- }
-
- private CompareConfiguration fCompareConfiguration;
- private ArrayList fArrayList= new ArrayList();
- private FileHistory fCurrentFileHistory;
-
- // SWT controls
- private CompareViewerSwitchingPane fContentPane;
- private Button fCommitButton;
- private Table fMemberTable;
- private CompareViewerPane fMemberPane;
- private Tree fEditionTree;
- private CompareViewerPane fEditionPane;
- private Image fDateImage;
- private Image fTimeImage;
-
-
- public AddFromHistoryDialog(Shell parent, ResourceBundle bundle) {
- super(parent, bundle);
-
- String iconName= Utilities.getString(fBundle, "dateIcon", "obj16/day_obj.gif"); //$NON-NLS-2$ //$NON-NLS-1$
- ImageDescriptor id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fDateImage= id.createImage();
- iconName= Utilities.getString(fBundle, "timeIcon", "obj16/resource_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fTimeImage= id.createImage();
- }
-
- public boolean select(IContainer root, IFile[] inputFiles) {
-
- create(); // create widgets
-
- String format= Utilities.getString(fBundle, "memberPaneTitle"); //$NON-NLS-1$
- String title= MessageFormat.format(format, new Object[] { root.getName() });
- fMemberPane.setImage(CompareUI.getImage(root));
- fMemberPane.setText(title);
-
- // sort input files
- final int count= inputFiles.length;
- final IFile[] files= new IFile[count];
- for (int i= 0; i < count; i++)
- files[i]= inputFiles[i];
- if (count > 1)
- internalSort(files, 0, count-1);
-
-
- String prefix= root.getFullPath().toString();
-
- if (fMemberTable != null && !fMemberTable.isDisposed()) {
- for (int i= 0; i < files.length; i++) {
- IFile file= files[i];
- String path= file.getFullPath().toString();
- if (path.startsWith(prefix))
- path= path.substring(prefix.length()+1);
- TableItem ti= new TableItem(fMemberTable, SWT.NONE);
- ti.setImage(CompareUI.getImage(file));
- ti.setText(path);
- ti.setData(new FileHistory(file));
- }
- }
-
- open();
-
- return (getReturnCode() == OK) && (fArrayList.size() > 0);
- }
-
- HistoryInput[] getSelected() {
- HistoryInput[] selected= new HistoryInput[fArrayList.size()];
- Iterator iter= fArrayList.iterator();
- for (int i= 0; iter.hasNext(); i++) {
- FileHistory h= (FileHistory) iter.next();
- selected[i]= h.getHistoryInput();
- }
- return selected;
- }
-
- protected synchronized Control createDialogArea(Composite parent2) {
-
- Composite parent= (Composite) super.createDialogArea(parent2);
-
- getShell().setText(Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
- org.eclipse.compare.Splitter vsplitter= new org.eclipse.compare.Splitter(parent, SWT.VERTICAL);
- vsplitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-
- vsplitter.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fDateImage != null)
- fDateImage.dispose();
- if (fTimeImage != null)
- fTimeImage.dispose();
- }
- }
- );
-
- // we need two panes: the left for the elements, the right one for the editions
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- Composite c= new Composite(hsplitter, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 2;
- layout.verticalSpacing= 2;
- layout.numColumns= 1;
- c.setLayout(layout);
- Label l1= new Label(c, SWT.NONE);
- l1.setText(Utilities.getString(fBundle, "memberDescription")); //$NON-NLS-1$
- fMemberPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- fMemberPane.setLayoutData(gd);
-
- fMemberTable= new Table(fMemberPane, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL);
- fMemberTable.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (e.detail == SWT.CHECK) {
- if (e.item instanceof TableItem) {
- TableItem ti= (TableItem) e.item;
- if (ti.getChecked())
- fArrayList.add(ti.getData());
- else
- fArrayList.remove(ti.getData());
-
- if (fCommitButton != null)
- fCommitButton.setEnabled(fArrayList.size() > 0);
- }
- } else {
- handleMemberSelect(e.item);
- }
- }
- }
- );
-
- fMemberPane.setContent(fMemberTable);
-
- c= new Composite(hsplitter, SWT.NONE);
- layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 2;
- layout.verticalSpacing= 2;
- layout.numColumns= 1;
- c.setLayout(layout);
- Label l2= new Label(c, SWT.NONE);
- l2.setText(Utilities.getString(fBundle, "editionDescription")); //$NON-NLS-1$
- fEditionPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT);
- gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- fEditionPane.setLayoutData(gd);
-
- fEditionTree= new Tree(fEditionPane, SWT.H_SCROLL | SWT.V_SCROLL);
- fEditionTree.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- feedContent(e.item);
- }
- }
- );
- fEditionPane.setContent(fEditionTree);
-
- applyDialogFont(parent); // to avoid applying font to compare viewer
- fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, fCompareConfiguration);
- }
- };
- vsplitter.setWeights(new int[] { 30, 70 });
-
- return parent;
- }
-
- /**
- * Feeds selection from member viewer to edition viewer.
- */
- private void handleMemberSelect(Widget w) {
- Object data= null;
- if (w != null)
- data= w.getData();
- if (data instanceof FileHistory) {
-
- FileHistory h= (FileHistory) data;
- fCurrentFileHistory= h;
-
- IFile file= h.getFile();
- IFileState[] states= h.getStates();
-
- fEditionPane.setImage(CompareUI.getImage(file));
- String pattern= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$
- String title= MessageFormat.format(pattern, new Object[] { file.getName() });
- fEditionPane.setText(title);
-
- if (fEditionTree != null) {
- fEditionTree.setRedraw(false);
- fEditionTree.removeAll();
- for (int i= 0; i < states.length; i++) {
- addEdition(new HistoryInput(file, states[i]), h.isSelected(i));
- }
- fEditionTree.setRedraw(true);
- }
- } else
- fCurrentFileHistory= null;
- }
-
- /**
- * Adds the given Pair to the edition tree.
- * It takes care of creating tree nodes for different dates.
- */
- private void addEdition(HistoryInput input, boolean isSelected) {
- if (fEditionTree == null || fEditionTree.isDisposed())
- return;
-
- IFileState state= input.fFileState;
-
- // find last day
- TreeItem[] days= fEditionTree.getItems();
- TreeItem lastDay= null;
- if (days.length > 0)
- lastDay= days[days.length-1];
-
- long ldate= state.getModificationTime();
- long day= dayNumber(ldate);
- Date date= new Date(ldate);
- if (lastDay == null || day != dayNumber(((Date)lastDay.getData()).getTime())) {
- lastDay= new TreeItem(fEditionTree, SWT.NONE);
- lastDay.setImage(fDateImage);
- String df= DateFormat.getDateInstance().format(date);
- long today= dayNumber(System.currentTimeMillis());
-
- String formatKey;
- if (day == today)
- formatKey= "todayFormat"; //$NON-NLS-1$
- else if (day == today-1)
- formatKey= "yesterdayFormat"; //$NON-NLS-1$
- else
- formatKey= "dayFormat"; //$NON-NLS-1$
- String pattern= Utilities.getString(fBundle, formatKey);
- if (pattern != null)
- df= MessageFormat.format(pattern, new String[] { df });
- lastDay.setText(df);
- lastDay.setData(date);
- }
- TreeItem ti= new TreeItem(lastDay, SWT.NONE);
- ti.setImage(fTimeImage);
- ti.setText(DateFormat.getTimeInstance().format(date));
- ti.setData(input);
-
- if (isSelected) {
- lastDay.setExpanded(true);
- fEditionTree.setSelection(new TreeItem[] { ti });
- feedContent(ti);
- }
- }
-
- /**
- * Returns the number of s since Jan 1st, 1970.
- * The given date is converted to GMT and daylight saving is taken into account too.
- */
- private long dayNumber(long date) {
- int ONE_DAY_MS= 24*60*60 * 1000; // one day in milli seconds
-
- Calendar calendar= Calendar.getInstance();
- long localTimeOffset= calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
-
- return (date + localTimeOffset) / ONE_DAY_MS;
- }
-
- /**
- * Feeds the tree viewer's selection to the contentviewer
- */
- private void feedContent(Widget w) {
- if (fContentPane != null && !fContentPane.isDisposed()) {
- Object o= w.getData();
- if (o instanceof HistoryInput) {
- HistoryInput selected= (HistoryInput) o;
- fContentPane.setInput(selected);
- fContentPane.setText(getEditionLabel(selected));
- fContentPane.setImage(fTimeImage);
-
- if (fCurrentFileHistory != null)
- fCurrentFileHistory.setSelected(selected.fFileState);
- } else {
- fContentPane.setInput(null);
- }
- }
- }
-
- protected String getEditionLabel(HistoryInput input) {
- String format= Utilities.getString(fBundle, "historyEditionLabel", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "editionLabel"); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
- long modDate= input.getModificationDate();
- String date= DateFormat.getDateTimeInstance().format(new Date(modDate));
-
- return MessageFormat.format(format, new Object[] { date });
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- String buttonLabel= Utilities.getString(fBundle, "buttonLabel", IDialogConstants.OK_LABEL); //$NON-NLS-1$
- // a 'Cancel' and a 'Add' button
- fCommitButton= createButton(parent, IDialogConstants.OK_ID, buttonLabel, true);
- fCommitButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- * Returns true if the pathname of f1 comes after f2
- */
- private static boolean greaterThan(IFile f1, IFile f2) {
- String[] ss1= f1.getFullPath().segments();
- String[] ss2= f2.getFullPath().segments();
- int l1= ss1.length;
- int l2= ss2.length;
- int n= Math.max(l1, l2);
-
- for (int i= 0; i < n; i++) {
- String s1= i < l1 ? ss1[i] : ""; //$NON-NLS-1$
- String s2= i < l2 ? ss2[i] : ""; //$NON-NLS-1$
- int rc= s1.compareToIgnoreCase(s2);
- if (rc != 0)
- return rc < 0;
- }
- return false;
- }
-
- private static void internalSort(IFile[] keys, int left, int right) {
-
- int original_left= left;
- int original_right= right;
-
- IFile mid= keys[(left + right) / 2];
- do {
- while (greaterThan(keys[left], mid))
- left++;
-
- while (greaterThan(mid, keys[right]))
- right--;
-
- if (left <= right) {
- IFile tmp= keys[left];
- keys[left]= keys[right];
- keys[right]= tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (original_left < right)
- internalSort(keys, original_left, right);
-
- if (left < original_right)
- internalSort(keys, left, original_right);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
deleted file mode 100644
index 7771b93d3..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
+++ /dev/null
@@ -1,43 +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.compare.internal;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IActionDelegate;
-
-
-public abstract class BaseCompareAction implements IActionDelegate {
-
- private ISelection fSelection;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- final public void run(IAction action) {
- run(fSelection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- final public void selectionChanged(IAction action, ISelection selection) {
- fSelection= selection;
- if (action != null)
- action.setEnabled(isEnabled(fSelection));
- }
-
- protected boolean isEnabled(ISelection selection) {
- return false;
- }
-
- abstract protected void run(ISelection selection);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
deleted file mode 100644
index 41b23e86d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.io.*;
-import java.util.ResourceBundle;
-import java.text.MessageFormat;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-/**
- * A simple compare viewer for binary files.
- * Shows the position of the first non-matching byte.
- */
-public class BinaryCompareViewer extends AbstractViewer {
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.internal.BinaryCompareViewerResources"; //$NON-NLS-1$
-
- private static final int EOF= -1;
- private Text fControl;
- private ICompareInput fInput;
- private ResourceBundle fBundle;
- private boolean fLeftIsLocal;
-
-
- public BinaryCompareViewer(Composite parent, CompareConfiguration cc) {
-
- WorkbenchHelp.setHelp(parent, ICompareContextIds.BINARY_COMPARE_VIEW);
-
- fBundle= ResourceBundle.getBundle(BUNDLE_NAME);
-
- fControl= new Text(parent, SWT.NONE);
- fControl.setEditable(false);
- fControl.setData(CompareUI.COMPARE_VIEWER_TITLE, Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
- fLeftIsLocal= Utilities.getBoolean(cc, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
- }
-
- public Control getControl() {
- return fControl;
- }
-
- public void setInput(Object input) {
- if (fControl != null && input instanceof ICompareInput) {
- fInput= (ICompareInput) input;
-
- InputStream left= null;
- InputStream right= null;
-
- String message= null;
- try {
- left= getStream(fInput.getLeft());
- right= getStream(fInput.getRight());
-
- if (left != null && right != null) {
- int pos= 0;
- while (true) {
- int l= left.read();
- int r= right.read();
- if (l != r) {
- String format= Utilities.getString(fBundle, "diffMessageFormat"); //$NON-NLS-1$
- message= MessageFormat.format(format, new String[] { Integer.toString(pos) } );
- break;
- }
- if (l == EOF)
- break;
- pos++;
- }
- } else if (left == null && right == null) {
- message= Utilities.getString(fBundle, "deleteConflictMessage"); //$NON-NLS-1$
- } else if (left == null) {
- if (fLeftIsLocal)
- message= Utilities.getString(fBundle, "deletedMessage"); //$NON-NLS-1$
- else
- message= Utilities.getString(fBundle, "addedMessage"); //$NON-NLS-1$
- } else if (right == null) {
- if (fLeftIsLocal)
- message= Utilities.getString(fBundle, "addedMessage"); //$NON-NLS-1$
- else
- message= Utilities.getString(fBundle, "deletedMessage"); //$NON-NLS-1$
- }
- } catch (CoreException ex) {
- message= Utilities.getString(fBundle, "errorMessage"); //$NON-NLS-1$
- } catch (IOException ex) {
- message= Utilities.getString(fBundle, "errorMessage"); //$NON-NLS-1$
- } finally {
- if (left != null) {
- try {
- left.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- if (right != null) {
- try {
- right.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- if (message != null)
- fControl.setText(message);
- }
- }
-
- public Object getInput() {
- return fInput;
- }
-
- private InputStream getStream(ITypedElement input) throws CoreException {
- if (input instanceof IStreamContentAccessor)
- return ((IStreamContentAccessor)input).getContents();
- return null;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java
deleted file mode 100644
index 8c98ec6ff..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.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.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-
-/**
- * A factory object for the <code>BinaryCompareViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class BinaryCompareViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new BinaryCompareViewer(parent, mp);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties
deleted file mode 100644
index dbfc7d70e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties
+++ /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
-###############################################################################
-
-# @(#)BinaryCompareViewerResources.properties
-#
-# Resource strings for BinaryCompareViewer.java
-
-title= Binary Compare
-
-diffMessageFormat= First bytes differ at position {0}
-deleteConflictMessage= Delete Conflict
-addedMessage= Added Resource
-deletedMessage= Removed Resource
-errorMessage= Internal Error
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
deleted file mode 100644
index 79b34255d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
+++ /dev/null
@@ -1,98 +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.compare.internal;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * A Canvas which reduces flicker by drawing in an off screen buffer.
- */
-public abstract class BufferedCanvas extends Canvas {
-
- //private static final boolean USE_DOUBLE_BUFFER= !"carbon".equals(SWT.getPlatform()); //$NON-NLS-1$
- private static final boolean USE_DOUBLE_BUFFER= true;
-
- /** The drawable for double buffering */
- Image fBuffer;
-
- public BufferedCanvas(Composite parent, int flags) {
- super(parent, flags + SWT.NO_BACKGROUND);
-
- addPaintListener(
- new PaintListener() {
- public void paintControl(PaintEvent event) {
- doubleBufferPaint(event.gc);
- }
- }
- );
-
- addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fBuffer != null) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- }
- );
- }
-
- public void repaint() {
- if (!isDisposed()) {
- GC gc= new GC(this);
- doubleBufferPaint(gc);
- gc.dispose();
- }
- }
-
- /**
- * Double buffer drawing.
- */
- void doubleBufferPaint(GC dest) {
-
- if (!USE_DOUBLE_BUFFER) {
- doPaint(dest);
- return;
- }
-
- Point size= getSize();
-
- if (size.x <= 1 || size.y <= 1) // we test for <= 1 because on X11 controls have initial size 1,1
- return;
-
- if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
- if (r.width != size.x || r.height != size.y) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- if (fBuffer == null)
- fBuffer= new Image(getDisplay(), size.x, size.y);
-
- GC gc= new GC(fBuffer);
- try {
- gc.setBackground(getBackground());
- gc.fillRectangle(0, 0, size.x, size.y);
- doPaint(gc);
- } finally {
- gc.dispose();
- }
-
- dest.drawImage(fBuffer, 0, 0);
- }
-
- abstract public void doPaint(GC gc);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
deleted file mode 100644
index 80d36bfb0..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
+++ /dev/null
@@ -1,133 +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.compare.internal;
-
-import java.io.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-
-/**
- * A buffer for a workspace resource.
- */
-public class BufferedResourceNode extends ResourceNode {
-
- private boolean fDirty= false;
- private IFile fDeleteFile;
-
- /**
- * Creates a <code>ResourceNode</code> for the given resource.
- *
- * @param resource the resource
- */
- public BufferedResourceNode(IResource resource) {
- super(resource);
- }
-
- protected IStructureComparator createChild(IResource child) {
- return new BufferedResourceNode(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) {
-
- byte[] bytes= getContent();
- /*
- String enc1= getEncoding();
- String enc2= Utilities.getCharset((IFile)resource);
- if (! enc1.equals(enc2)) {
- try {
- String content= new String(bytes, enc1);
- bytes= content.getBytes(enc2);
- } catch (UnsupportedEncodingException e) {
- // ignore
- }
- }
- */
- ByteArrayInputStream is= new ByteArrayInputStream(bytes);
- 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) {
- // Silently ignored
- }
- }
- }
- }
- }
-
- 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= Utilities.readBytes(is);
- if (bytes != null)
- dst.setContent(bytes);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- return child;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
deleted file mode 100644
index 824ed3e1c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.compare.CompareConfiguration;
-
-/**
- * Toggles a boolean property of an <code>ICompareConfiguration</code>.
- */
-public class ChangePropertyAction extends Action {
-
- private CompareConfiguration fCompareConfiguration;
- private String fPropertyKey;
- private ResourceBundle fBundle;
- private String fPrefix;
-
-
- public ChangePropertyAction(ResourceBundle bundle, CompareConfiguration cc, String rkey, String pkey) {
- fPropertyKey= pkey;
- fBundle= bundle;
- fPrefix= rkey;
- Utilities.initAction(this, fBundle, fPrefix);
- setCompareConfiguration(cc);
- }
-
- public void run() {
- boolean b= !Utilities.getBoolean(fCompareConfiguration, fPropertyKey, false);
- setChecked(b);
- if (fCompareConfiguration != null)
- fCompareConfiguration.setProperty(fPropertyKey, new Boolean(b));
- }
-
- public void setChecked(boolean state) {
- super.setChecked(state);
- Utilities.initToggleAction(this, fBundle, fPrefix, state);
- }
-
- public void setCompareConfiguration(CompareConfiguration cc) {
- fCompareConfiguration= cc;
- setChecked(Utilities.getBoolean(fCompareConfiguration, fPropertyKey, false));
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java
deleted file mode 100644
index 787c3fb26..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.ColorDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.resource.JFaceResources;
-
-/**
- * A "button" of a certain color determined by the color picker.
- */
-public class ColorEditor {
-
- private Point fExtent;
- private Image fImage;
- private RGB fColorValue;
- private Color fColor;
- private Button fButton;
-
- public ColorEditor(Composite parent) {
-
- fButton= new Button(parent, SWT.PUSH);
- fExtent= computeImageSize(parent);
- fImage= new Image(parent.getDisplay(), fExtent.x, fExtent.y);
-
- GC gc= new GC(fImage);
- gc.setBackground(fButton.getBackground());
- gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
- gc.dispose();
-
- fButton.setImage(fImage);
- fButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- ColorDialog colorDialog= new ColorDialog(fButton.getShell());
- colorDialog.setRGB(fColorValue);
- RGB newColor = colorDialog.open();
- if (newColor != null) {
- fColorValue= newColor;
- updateColorImage();
- }
- }
- });
-
- fButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- if (fImage != null) {
- fImage.dispose();
- fImage= null;
- }
- if (fColor != null) {
- fColor.dispose();
- fColor= null;
- }
- }
- });
- }
-
- public RGB getColorValue() {
- return fColorValue;
- }
-
- public void setColorValue(RGB rgb) {
- fColorValue= rgb;
- updateColorImage();
- }
-
- public Button getButton() {
- return fButton;
- }
-
- protected void updateColorImage() {
-
- Display display= fButton.getDisplay();
-
- GC gc= new GC(fImage);
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
-
- if (fColor != null)
- fColor.dispose();
-
- fColor= new Color(display, fColorValue);
- gc.setBackground(fColor);
- gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
- gc.dispose();
-
- fButton.setImage(fImage);
- }
-
- protected Point computeImageSize(Control window) {
- GC gc= new GC(window);
- Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
- gc.setFont(f);
- int height= gc.getFontMetrics().getHeight();
- gc.dispose();
- Point p= new Point(height * 3 - 6, height);
- return p;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
deleted file mode 100644
index d0f4d805a..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.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.compare.internal;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-
-
-/*
- * The "Compare with each other" action
- */
-public class CompareAction extends BaseCompareAction implements IObjectActionDelegate {
-
- private ResourceCompareInput fInput;
- private IWorkbenchPage fWorkbenchPage;
-
-
- public void run(ISelection selection) {
- if (fInput != null) {
- fInput.setSelection(selection);
- fInput.initializeCompareConfiguration();
- CompareUI.openCompareEditorOnPage(fInput, fWorkbenchPage);
- fInput= null; // don't reuse this input!
- }
- }
-
- protected boolean isEnabled(ISelection selection) {
- if (fInput == null) {
- CompareConfiguration cc= new CompareConfiguration();
- // buffered merge mode: don't ask for confirmation
- // when switching between modified resources
- cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false));
-
- // uncomment following line to have separate outline view
- //cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, new Boolean(true));
-
- fInput= new ResourceCompareInput(cc);
- }
- return fInput.isEnabled(selection);
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- fWorkbenchPage= targetPart.getSite().getPage();
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
deleted file mode 100644
index 3116aca44..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.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.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-
-public class CompareDialog extends ResizableDialog implements IPropertyChangeListener {
-
- private CompareEditorInput fCompareEditorInput;
- private Button fCommitButton;
-
-
- CompareDialog(Shell shell, CompareEditorInput input) {
- super(shell, null);
-
- Assert.isNotNull(input);
- fCompareEditorInput= input;
- fCompareEditorInput.addPropertyChangeListener(this);
- setHelpContextId(ICompareContextIds.COMPARE_DIALOG);
- }
-
- public boolean close() {
- if (super.close()) {
- if (fCompareEditorInput != null)
- fCompareEditorInput.addPropertyChangeListener(this);
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- fCommitButton= createButton(parent, IDialogConstants.OK_ID, Utilities.getString("CompareDialog.commitAction.label"), true); //$NON-NLS-1$
- fCommitButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (fCommitButton != null && fCompareEditorInput != null)
- fCommitButton.setEnabled(fCompareEditorInput.isSaveNeeded());
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent2) {
-
- Composite parent= (Composite) super.createDialogArea(parent2);
-
- Control c= fCompareEditorInput.createContents(parent);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Shell shell= c.getShell();
- shell.setText(fCompareEditorInput.getTitle());
- shell.setImage(fCompareEditorInput.getTitleImage());
- applyDialogFont(parent);
- return parent;
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- public int open() {
-
- int rc= super.open();
-
- if (rc == OK && fCompareEditorInput.isSaveNeeded()) {
-
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws CoreException {
- fCompareEditorInput.saveChanges(pm);
- }
- };
-
- Shell shell= getParentShell();
- ProgressMonitorDialog pmd= new ProgressMonitorDialog(shell);
- try {
- operation.run(pmd.getProgressMonitor());
-
- } catch (InterruptedException x) {
- // NeedWork
- } catch (OperationCanceledException x) {
- // NeedWork
- } catch (InvocationTargetException x) {
- String title= Utilities.getString("CompareDialog.saveErrorTitle"); //$NON-NLS-1$
- String msg= Utilities.getString("CompareDialog.saveErrorMessage"); //$NON-NLS-1$
- MessageDialog.openError(shell, title, msg + x.getTargetException().getMessage());
- }
- }
-
- return rc;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
deleted file mode 100644
index d7caece31..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.compare.*;
-
-
-/**
- * A CompareEditor takes a ICompareEditorInput as input.
- * Most functionality is delegated to the ICompareEditorInput.
- */
-public class CompareEditor extends EditorPart implements IReusableEditor {
-
- /**
- * Internal property change listener for handling changes in the editor's input.
- */
- class PropertyChangeListener implements IPropertyChangeListener {
- /*
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- CompareEditor.this.propertyChange(event);
- }
- }
-
- public final static String CONFIRM_SAVE_PROPERTY= "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY"; //$NON-NLS-1$
-
- private IActionBars fActionBars;
- /** The editor's property change listener. */
- private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
- /** the SWT control */
- private Control fControl;
- /** the outline page */
- private CompareOutlinePage fOutlinePage;
- /** enable outline */
-
-
- public CompareEditor() {
- }
-
- /** (non-Javadoc)
- * Method declared on IAdaptable
- */
- public Object getAdapter(Class key) {
-
- if (key.equals(IContentOutlinePage.class)) {
- Object object= getCompareConfiguration().getProperty(CompareConfiguration.USE_OUTLINE_VIEW);
- if (object instanceof Boolean && ((Boolean)object).booleanValue()) {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput) {
- fOutlinePage= new CompareOutlinePage((CompareEditorInput) input);
- return fOutlinePage;
- }
- }
- }
- return super.getAdapter(key);
- }
-
- /* package */ CompareConfiguration getCompareConfiguration() {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput)
- return ((CompareEditorInput)input).getCompareConfiguration();
- return null;
- }
-
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
-
- if (!(input instanceof CompareEditorInput))
- throw new PartInitException(Utilities.getString("CompareEditor.invalidInput")); //$NON-NLS-1$
-
- setSite(site);
- setInput(input);
- }
-
- public void setInput(IEditorInput input) {
- try {
- doSetInput(input);
- } catch (CoreException x) {
- String title= Utilities.getString("CompareEditor.error.setinput.title"); //$NON-NLS-1$
- String msg= Utilities.getString("CompareEditor.error.setinput.message"); //$NON-NLS-1$
- ErrorDialog.openError(getSite().getShell(), title, msg, x.getStatus());
- }
- }
-
- public void doSetInput(IEditorInput input) throws CoreException {
-
- if (!(input instanceof CompareEditorInput)) {
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, Utilities.getString("CompareEditor.invalidInput"), null); //$NON-NLS-1$
- throw new CoreException(s);
- }
-
- IEditorInput oldInput= getEditorInput();
- if (oldInput instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
-
- super.setInput(input);
-
- CompareEditorInput cei= (CompareEditorInput) input;
-
- setTitleImage(cei.getTitleImage());
- setTitle(cei.getTitle());
-
- if (input instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).addPropertyChangeListener(fPropertyChangeListener);
-
- if (oldInput != null) {
- if (fControl != null && !fControl.isDisposed()) {
- Point oldSize= fControl.getSize();
- Composite parent= fControl.getParent();
- fControl.dispose();
- createPartControl(parent);
- if (fControl != null)
- fControl.setSize(oldSize);
- }
- }
- }
-
- public IActionBars getActionBars() {
- return fActionBars;
- }
-
- public void setActionBars(IActionBars actionBars) {
- fActionBars= actionBars;
- }
-
- /*
- * @see IDesktopPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- parent.setData(this);
-
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput) {
- fControl= ((CompareEditorInput) input).createContents(parent);
- WorkbenchHelp.setHelp(fControl, ICompareContextIds.COMPARE_EDITOR);
- }
- }
-
- /*
- * @see DesktopPart#dispose
- */
- public void dispose() {
-
- IEditorInput input= getEditorInput();
- if (input instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
-
- super.dispose();
-
- fPropertyChangeListener= null;
- }
-
- /*
- * @see IDesktopPart#setFocus
- */
- public void setFocus() {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput)
- ((CompareEditorInput)input).setFocus();
- }
-
- /**
- * Returns false because the editor doesn't support "Save As...".
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- public void gotoMarker(IMarker marker) {
- }
-
- /**
- * Always throws an AssertionFailedException.
- */
- /*
- * @see IEditorPart#doSaveAs()
- */
- public void doSaveAs() {
- Assert.isTrue(false); // Save As not supported for CompareEditor
- }
-
- /*
- * @see IEditorPart#doSave()
- */
- public void doSave(IProgressMonitor progressMonitor) {
-
- final IEditorInput input= getEditorInput();
-
- 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(progressMonitor);
-
- firePropertyChange(PROP_DIRTY);
-
- } catch (InterruptedException x) {
- // NeedWork
- } catch (OperationCanceledException x) {
- // NeedWork
- } catch (InvocationTargetException x) {
- String title= Utilities.getString("CompareEditor.saveError.title"); //$NON-NLS-1$
- String reason= x.getTargetException().getMessage();
- MessageDialog.openError(shell, title, Utilities.getFormattedString("CompareEditor.cantSaveError", reason)); //$NON-NLS-1$
- }
- }
-
- /*
- * @see IEditorPart#isDirty()
- */
- public boolean isDirty() {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput)
- return ((CompareEditorInput)input).isSaveNeeded();
- return false;
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- Object old_value= event.getOldValue();
- Object new_value= event.getNewValue();
- if (old_value == null || new_value == null || !old_value.equals(new_value))
- firePropertyChange(PROP_DIRTY);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
deleted file mode 100644
index 254d0d395..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
+++ /dev/null
@@ -1,105 +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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-import org.eclipse.compare.*;
-
-
-public class CompareEditorContributor extends EditorActionBarContributor {
-
- private IEditorPart fActiveEditorPart= null;
-
- private IgnoreWhiteSpaceAction fIgnoreWhitespace;
- private NavigationAction fNext;
- private NavigationAction fPrevious;
-
- private NavigationAction fToolbarNext;
- private NavigationAction fToolbarPrevious;
-
-
- public CompareEditorContributor() {
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
-
- fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, null);
- WorkbenchHelp.setHelp(fIgnoreWhitespace, ICompareContextIds.IGNORE_WHITESPACE_ACTION);
-
- fNext= new NavigationAction(bundle, true);
- WorkbenchHelp.setHelp(fNext, ICompareContextIds.GLOBAL_NEXT_DIFF_ACTION);
-
- fPrevious= new NavigationAction(bundle, false);
- WorkbenchHelp.setHelp(fPrevious, ICompareContextIds.GLOBAL_PREVIOUS_DIFF_ACTION);
-
- fToolbarNext= new NavigationAction(bundle, true);
- WorkbenchHelp.setHelp(fToolbarNext, ICompareContextIds.NEXT_DIFF_ACTION);
-
- fToolbarPrevious= new NavigationAction(bundle, false);
- WorkbenchHelp.setHelp(fToolbarPrevious, ICompareContextIds.PREVIOUS_DIFF_ACTION);
- }
-
- /*
- * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager)
- */
- public void contributeToToolBar(IToolBarManager tbm) {
- tbm.add(new Separator());
- tbm.add(fIgnoreWhitespace);
- tbm.add(fToolbarNext);
- tbm.add(fToolbarPrevious);
- }
-
- /*
- * @see EditorActionBarContributor#contributeToMenu(IMenuManager)
- */
- public void contributeToMenu(IMenuManager menuManager) {
- }
-
- public void setActiveEditor(IEditorPart targetEditor) {
-
- if (fActiveEditorPart == targetEditor)
- return;
-
- fActiveEditorPart= targetEditor;
-
- if (fActiveEditorPart != null) {
- IEditorInput input= fActiveEditorPart.getEditorInput();
- if (input instanceof CompareEditorInput) {
- CompareEditorInput compareInput= (CompareEditorInput) input;
- fNext.setCompareEditorInput(compareInput);
- fPrevious.setCompareEditorInput(compareInput);
- // Begin fix http://bugs.eclipse.org/bugs/show_bug.cgi?id=20105
- fToolbarNext.setCompareEditorInput(compareInput);
- fToolbarPrevious.setCompareEditorInput(compareInput);
- // End fix http://bugs.eclipse.org/bugs/show_bug.cgi?id=20105
- }
- }
-
- if (targetEditor instanceof CompareEditor) {
- IActionBars actionBars= getActionBars();
-
- CompareEditor editor= (CompareEditor) targetEditor;
- editor.setActionBars(actionBars);
-
- actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNext);
- actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPrevious);
-
- CompareConfiguration cc= editor.getCompareConfiguration();
- fIgnoreWhitespace.setCompareConfiguration(cc);
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
deleted file mode 100644
index 5d1b1ae91..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.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.compare.internal;
-
-import java.text.MessageFormat;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IStatus;
-
-
-public class CompareFilter {
- private static final char[][] NO_CHAR_CHAR= new char[0][];
-
- private char[][] fExtraResourceFileFilters;
- private String[] fExtraResourceFolderFilters;
-
-
- public CompareFilter() {
- }
-
- public boolean filter(String path0, boolean folder, boolean isArchive) {
- if (!folder && fExtraResourceFileFilters != null) {
- char[] name= path0.toCharArray();
- for (int i= 0, l= fExtraResourceFileFilters.length; i < l; i++)
- if (match(fExtraResourceFileFilters[i], name, true))
- return true;
- }
- if (folder && fExtraResourceFolderFilters != null) {
- for (int i= 0, l= fExtraResourceFolderFilters.length; i < l; i++)
- if (fExtraResourceFolderFilters[0].equals(path0))
- return true;
- }
- return false;
- }
-
- public static String validateResourceFilters(String text) {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- String[] filters= getTokens(text, ","); //$NON-NLS-1$
- for (int i= 0; i < filters.length; i++) {
- String fileName= filters[i].replace('*', 'x');
- int resourceType= IResource.FILE;
- int lastCharacter= fileName.length() - 1;
- if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
- fileName= fileName.substring(0, lastCharacter);
- resourceType= IResource.FOLDER;
- }
- IStatus status= workspace.validateName(fileName, resourceType);
- if (status.matches(IStatus.ERROR)) {
- String format= Utilities.getString("ComparePreferencePage.filter.invalidsegment.error"); //$NON-NLS-1$
- return MessageFormat.format(format, new String[] { status.getMessage() } );
- }
- }
- return null;
- }
-
- public void setFilters(String filterSequence) {
- char[][] filters= filterSequence != null && filterSequence.length() > 0
- ? splitAndTrimOn(',', filterSequence.toCharArray())
- : null;
- if (filters == null) {
- fExtraResourceFileFilters= null;
- fExtraResourceFolderFilters= null;
- } else {
- int fileCount= 0, folderCount= 0;
- for (int i= 0, l= filters.length; i < l; i++) {
- char[] f= filters[i];
- if (f.length == 0)
- continue;
- if (f[f.length - 1] == '/')
- folderCount++;
- else
- fileCount++;
- }
- fExtraResourceFileFilters= new char[fileCount][];
- fExtraResourceFolderFilters= new String[folderCount];
- for (int i= 0, l= filters.length; i < l; i++) {
- char[] f= filters[i];
- if (f.length == 0)
- continue;
- if (f[f.length - 1] == '/')
- fExtraResourceFolderFilters[--folderCount]= new String(subarray(f, 0, f.length - 1));
- else
- fExtraResourceFileFilters[--fileCount]= f;
- }
- }
- }
-
- /////////
-
- private static String[] getTokens(String text, String separator) {
- StringTokenizer tok= new StringTokenizer(text, separator); //$NON-NLS-1$
- int nTokens= tok.countTokens();
- String[] res= new String[nTokens];
- for (int i= 0; i < res.length; i++)
- res[i]= tok.nextToken().trim();
- return res;
- }
-
- /**
- * Answers true if the pattern matches the given name, false otherwise.
- * This char[] pattern matching accepts wild-cards '*' and '?'.
- *
- * When not case sensitive, the pattern is assumed to already be
- * lowercased, the name will be lowercased character per character as
- * comparing. If name is null, the answer is false. If pattern is null, the
- * answer is true if name is not null. <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => true
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '?' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * pattern = { 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param pattern
- * the given pattern
- * @param name
- * the given name
- * @param isCaseSensitive
- * flag to know whether or not the matching should be case
- * sensitive
- * @return true if the pattern matches the given name, false otherwise
- */
- private boolean match(char[] pattern, char[] name, boolean isCaseSensitive) {
- if (name == null)
- return false; // null name cannot match
- if (pattern == null)
- return true; // null pattern is equivalent to '*'
- return match(pattern, 0, pattern.length, name, 0, name.length, isCaseSensitive);
- }
-
- /**
- * Answers true if the a sub-pattern matches the subpart of the given name,
- * false otherwise. char[] pattern matching, accepting wild-cards '*' and
- * '?'. Can match only subset of name/pattern. end positions are
- * non-inclusive. The subpattern is defined by the patternStart and
- * pattternEnd positions. When not case sensitive, the pattern is assumed
- * to already be lowercased, the name will be lowercased character per
- * character as comparing. <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 3 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 4 isCaseSensitive = true result => true
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 2 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 2 isCaseSensitive = true result => false
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param pattern
- * the given pattern
- * @param patternStart
- * the given pattern start
- * @param patternEnd
- * the given pattern end
- * @param name
- * the given name
- * @param nameStart
- * the given name start
- * @param nameEnd
- * the given name end
- * @param isCaseSensitive
- * flag to know if the matching should be case sensitive
- * @return true if the a sub-pattern matches the subpart of the given name,
- * false otherwise
- */
- private boolean match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd,
- boolean isCaseSensitive) {
- if (name == null)
- return false; // null name cannot match
- if (pattern == null)
- return true; // null pattern is equivalent to '*'
- int iPattern= patternStart;
- int iName= nameStart;
- if (patternEnd < 0)
- patternEnd= pattern.length;
- if (nameEnd < 0)
- nameEnd= name.length;
- /* check first segment */
- char patternChar= 0;
- while ((iPattern < patternEnd) && (patternChar= pattern[iPattern]) != '*') {
- if (iName == nameEnd)
- return false;
- if (patternChar != (isCaseSensitive ? name[iName] : Character.toLowerCase(name[iName])) && patternChar != '?') {
- return false;
- }
- iName++;
- iPattern++;
- }
- /* check sequence of star+segment */
- int segmentStart;
- if (patternChar == '*') {
- segmentStart= ++iPattern; // skip star
- } else {
- segmentStart= 0; // force iName check
- }
- int prefixStart= iName;
- checkSegment : while (iName < nameEnd) {
- if (iPattern == patternEnd) {
- iPattern= segmentStart; // mismatch - restart current segment
- iName= ++prefixStart;
- continue checkSegment;
- }
- /* segment is ending */
- if ((patternChar= pattern[iPattern]) == '*') {
- segmentStart= ++iPattern; // skip start
- if (segmentStart == patternEnd) {
- return true;
- }
- prefixStart= iName;
- continue checkSegment;
- }
- /* check current name character */
- if ((isCaseSensitive ? name[iName] : Character.toLowerCase(name[iName])) != patternChar && patternChar != '?') {
- iPattern= segmentStart; // mismatch - restart current segment
- iName= ++prefixStart;
- continue checkSegment;
- }
- iName++;
- iPattern++;
- }
- return (segmentStart == patternEnd) || (iName == nameEnd && iPattern == patternEnd)
- || (iPattern == patternEnd - 1 && pattern[iPattern] == '*');
- }
-
- /**
- * Return a new array which is the split of the given array using the given
- * divider and triming each subarray to remove whitespaces equals to ' '.
- * <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * divider = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * divider = 'b' array = { 'a' , ' ', 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * divider = 'c' array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param divider
- * the given divider
- * @param array
- * the given array
- * @return a new array which is the split of the given array using the
- * given divider and triming each subarray to remove whitespaces
- * equals to ' '
- */
- private char[][] splitAndTrimOn(char divider, char[] array) {
- int length= array == null ? 0 : array.length;
- if (length == 0)
- return NO_CHAR_CHAR;
- int wordCount= 1;
- for (int i= 0; i < length; i++)
- if (array[i] == divider)
- wordCount++;
- char[][] split= new char[wordCount][];
- int last= 0, currentWord= 0;
- for (int i= 0; i < length; i++) {
- if (array[i] == divider) {
- int start= last, end= i - 1;
- while (start < i && array[start] == ' ')
- start++;
- while (end > start && array[end] == ' ')
- end--;
- split[currentWord]= new char[end - start + 1];
- System.arraycopy(array, start, split[currentWord++], 0, end - start + 1);
- last= i + 1;
- }
- }
- int start= last, end= length - 1;
- while (start < length && array[start] == ' ')
- start++;
- while (end > start && array[end] == ' ')
- end--;
- split[currentWord]= new char[end - start + 1];
- System.arraycopy(array, start, split[currentWord++], 0, end - start + 1);
- return split;
- }
-
- /**
- * Answers a new array which is a copy of the given array starting at the
- * given start and ending at the given end. The given start is inclusive
- * and the given end is exclusive. Answers null if start is greater than
- * end, if start is lower than 0 or if end is greater than the length of
- * the given array. If end equals -1, it is converted to the array length.
- * <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * array = { 'a' , 'b' } start = 0 end = 1 result => { 'a' }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * array = { 'a', 'b' } start = 0 end = -1 result => { 'a' , 'b' }
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param array
- * the given array
- * @param start
- * the given starting index
- * @param end
- * the given ending index
- * @return a new array which is a copy of the given array starting at the
- * given start and ending at the given end
- * @exception NullPointerException
- * if the given array is null
- */
- private char[] subarray(char[] array, int start, int end) {
- if (end == -1)
- end= array.length;
- if (start > end)
- return null;
- if (start < 0)
- return null;
- if (end > array.length)
- return null;
- char[] result= new char[end - start];
- System.arraycopy(array, start, result, 0, end - start);
- return result;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java
deleted file mode 100644
index b6fb85fd5..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class CompareMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.compare.internal.CompareMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private CompareMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
deleted file mode 100644
index e29774d71..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
+++ /dev/null
@@ -1,58 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-ComparePlugin.internal_error= Internal Error
-ExceptionDialog.seeErrorLogMessage= See error log for more details.
-
-#
-# Title format for CompareViewerSwitchingPane
-#
-CompareViewerSwitchingPane.Titleformat= {0} ({1})
-
-#
-# Title message for StructureDiffViewer if no structural differences could be found
-#
-StructureDiffViewer.NoStructuralDifferences= No Structural Differences
-StructureDiffViewer.StructureError= Can't Compare Structures
-
-#
-# TextMergeViewer
-#
-TextMergeViewer.cursorPosition.format= {0} : {1}
-
-TextMergeViewer.beforeLine.format= before line {0}
-TextMergeViewer.range.format= {0} : {1}
-
-TextMergeViewer.changeType.addition= addition
-TextMergeViewer.changeType.deletion= deletion
-TextMergeViewer.changeType.change= change
-
-TextMergeViewer.direction.outgoing= outgoing
-TextMergeViewer.direction.incoming= incoming
-TextMergeViewer.direction.conflicting= conflicting
-
-TextMergeViewer.diffType.format= {0} {1}
-
-TextMergeViewer.diffDescription.noDiff.format= no diff
-TextMergeViewer.diffDescription.diff.format= {0} #{1} (Left: {2}, Right: {3})
-TextMergeViewer.statusLine.format= Left: {0}, Right: {1}, {2}
-
-TextMergeViewer.atEnd.title= Go to Next Difference
-TextMergeViewer.atEnd.message= End of document reached. Continue at beginning?
-
-TextMergeViewer.atBeginning.title= Go to Previous Difference
-TextMergeViewer.atBeginning.message= Beginning of document reached. Continue at end?
-
-CompareNavigator.atEnd.title= Go to Next Difference
-CompareNavigator.atEnd.message= Last difference reached.
-
-CompareNavigator.atBeginning.title= Go to Previous Difference
-CompareNavigator.atBeginning.message= First difference reached.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java
deleted file mode 100644
index a5f28495c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.*;
-
-/**
- * Supports cross-pane navigation through differences.
- * XXX: Design is as it is because the feature had to be added without touching API.
- */
-public class CompareNavigator implements ICompareNavigator {
-
- private boolean fLastDirection= true;
- private CompareViewerSwitchingPane[] fPanes;
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- private boolean fNextFirstTime= true;
-
- public CompareNavigator(CompareViewerSwitchingPane[] panes) {
- fPanes= panes;
- }
-
- public CompareViewerSwitchingPane[] getPanes() {
- return fPanes;
- }
-
- public boolean selectChange(boolean next) {
-
- fLastDirection= next;
-
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- if (next && fNextFirstTime && mustOpen()) {
- fNextFirstTime= false;
- openElement();
- }
-
- // find most down stream CompareViewerPane
- int n= 0;
- INavigatable[] navigators= new INavigatable[4];
- for (int i= 0; i < fPanes.length; i++) {
- navigators[n]= getNavigator(fPanes[i]);
- if (navigators[n] != null)
- n++;
- }
-
- while (n > 0) {
- n--;
- if (navigators[n].gotoDifference(next)) {
- // at end of this navigator
- continue;
- } else // not at end
- return false;
- }
-
- return true;
- }
-
- private static INavigatable getNavigator(CompareViewerSwitchingPane pane) {
- if (pane == null)
- return null;
- if (pane.isEmpty())
- return null;
- Viewer viewer= pane.getViewer();
- if (viewer == null)
- return null;
- Control control= viewer.getControl();
- if (control == null)
- return null;
- Object data= control.getData(INavigatable.NAVIGATOR_PROPERTY);
- if (data instanceof INavigatable)
- return (INavigatable) data;
- return null;
- }
-
- private static CompareNavigator findNavigator(Control c) {
- while (c != null && !c.isDisposed()) { // PR 1GEUVV2
- Object data= c.getData();
- if (data instanceof CompareEditorInput) {
- CompareEditorInput cei= (CompareEditorInput) data;
- Object adapter= cei.getAdapter(CompareNavigator.class);
- if (adapter instanceof CompareNavigator)
- return (CompareNavigator)adapter;
- }
- c= c.getParent();
- }
- return null;
- }
-
- private boolean resetDirection() {
- boolean last= fLastDirection;
- fLastDirection= true;
- return last;
- }
-
- public static boolean getDirection(Control c) {
- CompareNavigator nav= findNavigator(c);
- if (nav != null)
- return nav.resetDirection();
- return true;
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private boolean mustOpen() {
- if (fPanes == null || fPanes.length == 0)
- return false;
- for (int i= 1; i < fPanes.length; i++) {
- CompareViewerSwitchingPane pane= fPanes[i];
- if (pane != null && pane.getInput() != null)
- return false;
- }
- return true;
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private void openElement() {
- if (fPanes == null || fPanes.length == 0)
- return;
- IOpenable openable= getOpenable(fPanes[0]);
- if (openable != null) {
- openable.openSelected();
- }
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private static IOpenable getOpenable(CompareViewerSwitchingPane pane) {
- if (pane == null)
- return null;
- if (pane.isEmpty())
- return null;
- Viewer viewer= pane.getViewer();
- if (viewer == null)
- return null;
- Control control= viewer.getControl();
- if (control == null)
- return null;
- Object data= control.getData(IOpenable.OPENABLE_PROPERTY);
- if (data instanceof IOpenable)
- return (IOpenable) data;
- return null;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
deleted file mode 100644
index bc599075d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.CompareEditorInput;
-
-/**
- */
-public class CompareOutlinePage implements IContentOutlinePage {
-
- private Control fControl;
- private ListenerList fListeners= new ListenerList();
- private ISelection fSelection;
- //private IActionBars fActionBars;
- private CompareEditorInput fCompareEditorInput;
-
- CompareOutlinePage(CompareEditorInput input) {
- fCompareEditorInput= input;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- if (fCompareEditorInput != null) {
- fControl= fCompareEditorInput.createOutlineContents(parent, SWT.VERTICAL);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#dispose()
- */
- public void dispose() {
- if (fControl != null)
- fControl.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#getControl()
- */
- public Control getControl() {
- return fControl;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- //fActionBars= actionBars;
- //if (fControl != null)
- // fControl.setData("actionBars", actionBars);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setFocus()
- */
- public void setFocus() {
- if (fControl != null)
- fControl.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return fSelection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- fListeners.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection) {
- fSelection= selection;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
deleted file mode 100644
index 116874914..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
+++ /dev/null
@@ -1,384 +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.compare.internal;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-public class ComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- class FakeInput implements ITypedElement, IEncodedStreamContentAccessor {
- static final String UTF_16= "UTF-16"; //$NON-NLS-1$
- String fContent;
-
- FakeInput(String name) {
- fContent= loadPreviewContentFromFile(name);
- }
- public Image getImage() {
- return null;
- }
- public String getName() {
- return "no name"; //$NON-NLS-1$
- }
- public String getType() {
- return "no type"; //$NON-NLS-1$
- }
- public InputStream getContents() {
- return new ByteArrayInputStream(Utilities.getBytes(fContent, UTF_16));
- }
- public String getCharset() {
- return UTF_16;
- }
- }
-
- private static final String PREFIX= CompareUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
- public static final String OPEN_STRUCTURE_COMPARE= PREFIX + "OpenStructureCompare"; //$NON-NLS-1$
- public static final String SYNCHRONIZE_SCROLLING= PREFIX + "SynchronizeScrolling"; //$NON-NLS-1$
- public static final String SHOW_PSEUDO_CONFLICTS= PREFIX + "ShowPseudoConflicts"; //$NON-NLS-1$
- public static final String INITIALLY_SHOW_ANCESTOR_PANE= PREFIX + "InitiallyShowAncestorPane"; //$NON-NLS-1$
- public static final String PREF_SAVE_ALL_EDITORS= PREFIX + "SaveAllEditors"; //$NON-NLS-1$
- public static final String SHOW_MORE_INFO= PREFIX + "ShowMoreInfo"; //$NON-NLS-1$
- public static final String IGNORE_WHITESPACE= PREFIX + "IgnoreWhitespace"; //$NON-NLS-1$
- //public static final String USE_SPLINES= PREFIX + "UseSplines"; //$NON-NLS-1$
- public static final String USE_SINGLE_LINE= PREFIX + "UseSingleLine"; //$NON-NLS-1$
- //public static final String USE_RESOLVE_UI= PREFIX + "UseResolveUI"; //$NON-NLS-1$
- public static final String PATH_FILTER= PREFIX + "PathFilter"; //$NON-NLS-1$
-
-
- private TextMergeViewer fPreviewViewer;
- private IPropertyChangeListener fPreferenceChangeListener;
- private CompareConfiguration fCompareConfiguration;
- private OverlayPreferenceStore fOverlayStore;
- private Map fCheckBoxes= new HashMap();
- private SelectionListener fCheckBoxListener;
-
-
- public final OverlayPreferenceStore.OverlayKey[] fKeys= new OverlayPreferenceStore.OverlayKey[] {
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, OPEN_STRUCTURE_COMPARE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SYNCHRONIZE_SCROLLING),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_PSEUDO_CONFLICTS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, INITIALLY_SHOW_ANCESTOR_PANE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_MORE_INFO),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PREF_SAVE_ALL_EDITORS),
-
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT),
-
- //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SPLINES),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SINGLE_LINE),
- //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_RESOLVE_UI),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PATH_FILTER),
- };
-
-
- public static void initDefaults(IPreferenceStore store) {
- store.setDefault(OPEN_STRUCTURE_COMPARE, true);
- store.setDefault(SYNCHRONIZE_SCROLLING, true);
- store.setDefault(SHOW_PSEUDO_CONFLICTS, false);
- store.setDefault(INITIALLY_SHOW_ANCESTOR_PANE, false);
- store.setDefault(SHOW_MORE_INFO, false);
- store.setDefault(IGNORE_WHITESPACE, false);
- store.setDefault(PREF_SAVE_ALL_EDITORS, false);
- //store.setDefault(USE_SPLINES, false);
- store.setDefault(USE_SINGLE_LINE, true);
- //store.setDefault(USE_RESOLVE_UI, false);
- store.setDefault(PATH_FILTER, ""); //$NON-NLS-1$
-
- store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true);
- }
-
- public ComparePreferencePage() {
-
- //setDescription(Utilities.getString("ComparePreferencePage.description")); //$NON-NLS-1$
-
- setPreferenceStore(CompareUIPlugin.getDefault().getPreferenceStore());
-
- fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), fKeys);
- fPreferenceChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String key= event.getProperty();
- if (key.equals(INITIALLY_SHOW_ANCESTOR_PANE)) {
- boolean b= fOverlayStore.getBoolean(INITIALLY_SHOW_ANCESTOR_PANE);
- if (fCompareConfiguration != null) {
- fCompareConfiguration.setProperty(INITIALLY_SHOW_ANCESTOR_PANE, new Boolean(b));
- }
- }
- }
- };
- fOverlayStore.addPropertyChangeListener(fPreferenceChangeListener);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init()
- */
- public void init(IWorkbench workbench) {
- }
-
- /*
- * @see PreferencePage#performOk()
- */
- public boolean performOk() {
- fOverlayStore.propagate();
- return true;
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
-
- fOverlayStore.loadDefaults();
- initializeFields();
-
- super.performDefaults();
- }
-
- /*
- * @see DialogPage#dispose()
- */
- public void dispose() {
-
- if (fOverlayStore != null) {
- if (fPreferenceChangeListener != null) {
- fOverlayStore.removePropertyChangeListener(fPreferenceChangeListener);
- fPreferenceChangeListener= null;
- }
- fOverlayStore.stop();
- fOverlayStore= null;
- }
-
- super.dispose();
- }
-
- static public boolean getSaveAllEditors() {
- IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(PREF_SAVE_ALL_EDITORS);
- }
-
- static public void setSaveAllEditors(boolean value) {
- IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
- store.setValue(PREF_SAVE_ALL_EDITORS, value);
- }
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- WorkbenchHelp.setHelp(parent, ICompareContextIds.COMPARE_PREFERENCE_PAGE);
-
- fOverlayStore.load();
- fOverlayStore.start();
-
- TabFolder folder= new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem item= new TabItem(folder, SWT.NONE);
- item.setText(Utilities.getString("ComparePreferencePage.generalTab.label")); //$NON-NLS-1$
- //item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
- item.setControl(createGeneralPage(folder));
-
- item= new TabItem(folder, SWT.NONE);
- item.setText(Utilities.getString("ComparePreferencePage.textCompareTab.label")); //$NON-NLS-1$
- //item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
- item.setControl(createTextComparePage(folder));
-
- initializeFields();
- Dialog.applyDialogFont(folder);
- return folder;
- }
-
- private Control createGeneralPage(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 1;
- composite.setLayout(layout);
-
- addCheckBox(composite, "ComparePreferencePage.structureCompare.label", OPEN_STRUCTURE_COMPARE, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.showMoreInfo.label", SHOW_MORE_INFO, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.ignoreWhitespace.label", IGNORE_WHITESPACE, 0); //$NON-NLS-1$
-
- // a spacer
- new Label(composite, SWT.NONE);
-
- addCheckBox(composite, "ComparePreferencePage.saveBeforePatching.label", PREF_SAVE_ALL_EDITORS, 0); //$NON-NLS-1$
-
- // a spacer
- new Label(composite, SWT.NONE);
-
- Label l= new Label(composite, SWT.WRAP);
- l.setText(Utilities.getString("ComparePreferencePage.filter.description")); //$NON-NLS-1$
-
- Composite c2= new Composite(composite, SWT.NONE);
- c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- layout= new GridLayout(2, false);
- layout.marginWidth= 0;
- c2.setLayout(layout);
-
- l= new Label(c2, SWT.NONE);
- l.setText(Utilities.getString("ComparePreferencePage.filter.label")); //$NON-NLS-1$
-
- final Text t= new Text(c2, SWT.BORDER);
- t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- t.setText(fOverlayStore.getString(PATH_FILTER));
- t.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- String filters= t.getText();
- String message= CompareFilter.validateResourceFilters(filters);
- setValid(message == null);
- setMessage(null);
- setErrorMessage(message);
- fOverlayStore.setValue(PATH_FILTER, filters);
- }
- }
- );
-
- return composite;
- }
-
- private Control createTextComparePage(Composite parent) {
-
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 1;
- composite.setLayout(layout);
-
- addCheckBox(composite, "ComparePreferencePage.synchronizeScrolling.label", SYNCHRONIZE_SCROLLING, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.initiallyShowAncestorPane.label", INITIALLY_SHOW_ANCESTOR_PANE, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.showPseudoConflicts.label", SHOW_PSEUDO_CONFLICTS, 0); //$NON-NLS-1$
-
- //addCheckBox(composite, "ComparePreferencePage.useSplines.label", USE_SPLINES, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.useSingleLine.label", USE_SINGLE_LINE, 0); //$NON-NLS-1$
- //addCheckBox(composite, "ComparePreferencePage.useResolveUI.label", USE_RESOLVE_UI, 0); //$NON-NLS-1$
-
- // a spacer
- new Label(composite, SWT.NONE);
-
- Label previewLabel= new Label(composite, SWT.NULL);
- previewLabel.setText(Utilities.getString("ComparePreferencePage.preview.label")); //$NON-NLS-1$
-
- Control previewer= createPreviewer(composite);
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.widthHint= convertWidthInCharsToPixels(60);
- gd.heightHint= convertHeightInCharsToPixels(13);
- previewer.setLayoutData(gd);
-
- return composite;
- }
-
- private Control createPreviewer(Composite parent) {
-
- fCompareConfiguration= new CompareConfiguration(fOverlayStore);
- fCompareConfiguration.setAncestorLabel(Utilities.getString("ComparePreferencePage.ancestor.label")); //$NON-NLS-1$
-
- fCompareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.left.label")); //$NON-NLS-1$
- fCompareConfiguration.setLeftEditable(false);
-
- fCompareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$
- fCompareConfiguration.setRightEditable(false);
-
- fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration);
-
- fPreviewViewer.setInput(
- new DiffNode(Differencer.CONFLICTING,
- new FakeInput("ComparePreferencePage.previewAncestor"), //$NON-NLS-1$
- new FakeInput("ComparePreferencePage.previewLeft"), //$NON-NLS-1$
- new FakeInput("ComparePreferencePage.previewRight") //$NON-NLS-1$
- )
- );
-
- Control c= fPreviewViewer.getControl();
- c.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fCompareConfiguration != null)
- fCompareConfiguration.dispose();
- }
- });
-
- return c;
- }
-
- private void initializeFields() {
-
- Iterator e= fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b= (Button) e.next();
- String key= (String) fCheckBoxes.get(b);
- b.setSelection(fOverlayStore.getBoolean(key));
- }
- }
-
- // overlay stuff
-
- private Button addCheckBox(Composite parent, String labelKey, String key, int indentation) {
-
- String label= Utilities.getString(labelKey);
-
- Button checkBox= new Button(parent, SWT.CHECK);
- checkBox.setText(label);
-
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent= indentation;
- gd.horizontalSpan= 2;
- checkBox.setLayoutData(gd);
-
- if (fCheckBoxListener == null) {
- fCheckBoxListener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button= (Button) e.widget;
- fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
- }
- };
- }
- checkBox.addSelectionListener(fCheckBoxListener);
-
- fCheckBoxes.put(checkBox, key);
-
- return checkBox;
- }
-
- private String loadPreviewContentFromFile(String key) {
-
- String preview= Utilities.getString(key);
- String separator= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer buffer= new StringBuffer();
- for (int i= 0; i < preview.length(); i++) {
- char c= preview.charAt(i);
- if (c == '\n')
- buffer.append(separator);
- else
- buffer.append(c);
- }
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
deleted file mode 100644
index 54c544022..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ /dev/null
@@ -1,913 +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.compare.internal;
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.net.*;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * The Compare UI plug-in defines the entry point to initiate a configurable
- * compare operation on arbitrary resources. The result of the compare
- * is opened into a compare editor where the details can be browsed and
- * edited in dynamically selected structure and content viewers.
- * <p>
- * The Compare UI provides a registry for content and structure compare viewers,
- * which is initialized from extensions contributed to extension points
- * declared by this plug-in.
- * <p>
- * This class is the plug-in runtime class for the
- * <code>"org.eclipse.compare"</code> plug-in.
- * </p>
- */
-public final class CompareUIPlugin extends AbstractUIPlugin {
-
- public static final String DTOOL_NEXT= "dlcl16/next_nav.gif"; //$NON-NLS-1$
- public static final String CTOOL_NEXT= "clcl16/next_nav.gif"; //$NON-NLS-1$
- public static final String ETOOL_NEXT= "elcl16/next_nav.gif"; //$NON-NLS-1$
-
- public static final String DTOOL_PREV= "dlcl16/prev_nav.gif"; //$NON-NLS-1$
- public static final String CTOOL_PREV= "clcl16/prev_nav.gif"; //$NON-NLS-1$
- public static final String ETOOL_PREV= "elcl16/prev_nav.gif"; //$NON-NLS-1$
-
- /** Status code describing an internal error */
- public static final int INTERNAL_ERROR= 1;
-
- private static boolean NORMALIZE_CASE= true;
-
- private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private final static String EXTENSIONS_ATTRIBUTE= "extensions"; //$NON-NLS-1$
-
- public static final String PLUGIN_ID= "org.eclipse.compare"; //$NON-NLS-1$
-
- private static final String STRUCTURE_CREATOR_EXTENSION_POINT= "structureCreators"; //$NON-NLS-1$
- private static final String STRUCTURE_MERGEVIEWER_EXTENSION_POINT= "structureMergeViewers"; //$NON-NLS-1$
- private static final String CONTENT_MERGEVIEWER_EXTENSION_POINT= "contentMergeViewers"; //$NON-NLS-1$
- private static final String CONTENT_VIEWER_EXTENSION_POINT= "contentViewers"; //$NON-NLS-1$
-
- private static final String COMPARE_EDITOR= PLUGIN_ID + ".CompareEditor"; //$NON-NLS-1$
-
- private static final String STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME= "StructureViewerAliases"; //$NON-NLS-1$
-
- /** Maps type to icons */
- private static Map fgImages= new Hashtable(10);
- /** Maps type to ImageDescriptors */
- private static Map fgImageDescriptors= new Hashtable(10);
- /** Maps ImageDescriptors to Images */
- private static Map fgImages2= new Hashtable(10);
-
- private static Map fgStructureCreators= new Hashtable(10);
- private static Map fgStructureViewerDescriptors= new Hashtable(10);
- private static Map fgStructureViewerAliases= new Hashtable(10);
- private static Map fgContentViewerDescriptors= new Hashtable(10);
- private static Map fgContentMergeViewerDescriptors= new Hashtable(10);
-
- private static List fgDisposeOnShutdownImages= new ArrayList();
-
- private static ResourceBundle fgResourceBundle;
-
- private static CompareUIPlugin fgComparePlugin;
-
- private CompareFilter fFilter;
- private IPropertyChangeListener fPropertyChangeListener;
-
- /**
- * Creates the <code>CompareUIPlugin</code> object and registers all
- * structure creators, content merge viewers, and structure merge viewers
- * contributed to this plug-in's extension points.
- * <p>
- * Note that instances of plug-in runtime classes are automatically created
- * by the platform in the course of plug-in activation.
- * </p>
- *
- * @param descriptor the plug-in descriptor
- */
- public CompareUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
-
- fgComparePlugin= this;
-
- fgResourceBundle= descriptor.getResourceBundle();
-
- registerExtensions();
-
- initPreferenceStore();
- }
-
- /**
- * @see AbstractUIPlugin#initializeDefaultPreferences
- */
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- super.initializeDefaultPreferences(store);
-
- ComparePreferencePage.initDefaults(store);
- }
-
- /**
- * Registers all structure creators, content merge viewers, and structure merge viewers
- * that are found in the XML plugin files.
- */
- private void registerExtensions() {
- IPluginRegistry registry= Platform.getPluginRegistry();
-
- // collect all IStructureCreators
- IConfigurationElement[] elements= registry.getConfigurationElementsFor(PLUGIN_ID, STRUCTURE_CREATOR_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- final IConfigurationElement conf= elements[i];
- String extensions= conf.getAttribute(EXTENSIONS_ATTRIBUTE);
- registerStructureCreator(extensions,
- new IStructureCreatorDescriptor() {
- public IStructureCreator createStructureCreator() {
- try {
- return (IStructureCreator) conf.createExecutableExtension(CLASS_ATTRIBUTE);
- } catch (CoreException ex) {
- // NeedWork
- }
- return null;
- }
- }
- );
- }
-
- // collect all viewers which define the structure mergeviewer extension point
- elements= registry.getConfigurationElementsFor(PLUGIN_ID, STRUCTURE_MERGEVIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ViewerDescriptor desc= new ViewerDescriptor(elements[i]);
- String ext= desc.getExtension();
- if (ext != null)
- registerStructureViewerDescriptor(desc.getExtension(), desc);
- }
-
- // collect all viewers which define the content mergeviewer extension point
- elements= registry.getConfigurationElementsFor(PLUGIN_ID, CONTENT_MERGEVIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ViewerDescriptor desc= new ViewerDescriptor(elements[i]);
- String ext= desc.getExtension();
- if (ext != null)
- registerContentMergeViewerDescriptor(desc.getExtension(), desc);
- }
-
- // collect all viewers which define the content viewer extension point
- elements= registry.getConfigurationElementsFor(PLUGIN_ID, CONTENT_VIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ViewerDescriptor desc= new ViewerDescriptor(elements[i]);
- String ext= desc.getExtension();
- if (ext != null)
- registerContentViewerDescriptor(desc.getExtension(), desc);
- }
- }
-
- /**
- * Returns the singleton instance of this plug-in runtime class.
- *
- * @return the compare plug-in instance
- */
- public static CompareUIPlugin getDefault() {
- return fgComparePlugin;
- }
-
- /**
- * Returns this plug-in's resource bundle.
- *
- * @return the plugin's resource bundle
- */
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
- public static IWorkbench getActiveWorkbench() {
- CompareUIPlugin plugin= getDefault();
- if (plugin == null)
- return null;
- return plugin.getWorkbench();
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- IWorkbench workbench= getActiveWorkbench();
- if (workbench == null)
- return null;
- return workbench.getActiveWorkbenchWindow();
- }
-
- /**
- * Returns the active workkbench page or <code>null</code> if
- * no active workkbench page can be determined.
- *
- * @return the active workkbench page or <code>null</code> if
- * no active workkbench page can be determined
- */
- private static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window == null)
- return null;
- return window.getActivePage();
- }
-
- /**
- * Returns the SWT Shell of the active workbench window or <code>null</code> if
- * no workbench window is active.
- *
- * @return the SWT Shell of the active workbench window, or <code>null</code> if
- * no workbench window is active
- */
- public static Shell getShell() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window == null)
- return null;
- return window.getShell();
- }
-
- /**
- * 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)
- fgDisposeOnShutdownImages.add(image);
- }
-
- /* (non-Javadoc)
- * Method declared on Plugin.
- * Frees all resources of the compare plug-in.
- */
- public void shutdown() throws CoreException {
-
- /*
- * Converts the aliases into a single string before they are stored
- * in the preference store.
- * The format is:
- * <key> '.' <alias> ' ' <key> '.' <alias> ...
- */
- IPreferenceStore ps= getPreferenceStore();
- if (ps != null) {
- StringBuffer sb= new StringBuffer();
- Iterator iter= fgStructureViewerAliases.keySet().iterator();
- while (iter.hasNext()) {
- String key= (String) iter.next();
- String alias= (String) fgStructureViewerAliases.get(key);
- sb.append(key);
- sb.append('.');
- sb.append(alias);
- sb.append(' ');
- }
- ps.setValue(STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME, sb.toString());
-
- if (fPropertyChangeListener != null) {
- ps.removePropertyChangeListener(fPropertyChangeListener);
- fPropertyChangeListener= null;
- }
- }
-
- super.shutdown();
-
- if (fgDisposeOnShutdownImages != null) {
- Iterator i= fgDisposeOnShutdownImages.iterator();
- while (i.hasNext()) {
- Image img= (Image) i.next();
- if (!img.isDisposed())
- img.dispose();
- }
- fgImages= null;
- }
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare editor on the result.
- *
- * @param input the input on which to open the compare editor
- * @param page the workbench page on which to create a new compare editor
- * @param editor if not null the input is opened in this editor
- * @see CompareEditorInput
- */
- public void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, IReusableEditor editor) {
-
- if (compareResultOK(input)) {
-
- if (editor != null) { // reuse the given editor
- editor.setInput(input);
- return;
- }
-
- if (page == null)
- page= getActivePage();
- if (page != null) {
- // open new CompareEditor on page
- try {
- page.openEditor(input, COMPARE_EDITOR);
- } catch (PartInitException e) {
- MessageDialog.openError(getShell(), Utilities.getString("CompareUIPlugin.openEditorError"), e.getMessage()); //$NON-NLS-1$
- }
- } else {
- MessageDialog.openError(getShell(),
- Utilities.getString("CompareUIPlugin.openEditorError"), //$NON-NLS-1$
- Utilities.getString("CompareUIPlugin.noActiveWorkbenchPage")); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare dialog on the result.
- *
- * @param input the input on which to open the compare editor
- * @see CompareEditorInput
- */
- public void openCompareDialog(final CompareEditorInput input) {
-
- if (compareResultOK(input)) {
- CompareDialog dialog= new CompareDialog(getShell(), input);
- dialog.open();
- }
- }
-
- /**
- * @return <code>true</code> if compare result is OK to show, <code>false</code> otherwise
- */
- private boolean compareResultOK(CompareEditorInput input) {
- final Shell shell= getShell();
- try {
-
- // run operation in separate thread and make it canceable
- new ProgressMonitorDialog(shell).run(true, true, input);
-
- String message= input.getMessage();
- if (message != null) {
- MessageDialog.openError(shell, Utilities.getString("CompareUIPlugin.compareFailed"), message); //$NON-NLS-1$
- return false;
- }
-
- if (input.getCompareResult() == null) {
- MessageDialog.openInformation(shell, Utilities.getString("CompareUIPlugin.dialogTitle"), Utilities.getString("CompareUIPlugin.noDifferences")); //$NON-NLS-2$ //$NON-NLS-1$
- return false;
- }
-
- return true;
-
- } catch (InterruptedException x) {
- // cancelled by user
- } catch (InvocationTargetException x) {
- MessageDialog.openError(shell, Utilities.getString("CompareUIPlugin.compareFailed"), x.getTargetException().getMessage()); //$NON-NLS-1$
- }
- return false;
- }
-
- /**
- * Registers an image for the given type.
- */
- private static void registerImage(String type, Image image, boolean dispose) {
- fgImages.put(normalizeCase(type), image);
- if (image != null && dispose) {
- fgDisposeOnShutdownImages.add(image);
- }
- }
-
- /**
- * Registers an image descriptor for the given type.
- *
- * @param type the type
- * @param descriptor the image descriptor
- */
- public static void registerImageDescriptor(String type, ImageDescriptor descriptor) {
- fgImageDescriptors.put(normalizeCase(type), descriptor);
- }
-
- public static ImageDescriptor getImageDescriptor(String relativePath) {
-
- URL installURL= null;
- if (fgComparePlugin != null)
- installURL= fgComparePlugin.getDescriptor().getInstallURL();
-
- if (installURL != null) {
- try {
- URL url= new URL(installURL, Utilities.getIconPath(null) + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- Assert.isTrue(false);
- }
- }
- return null;
- }
-
- /**
- * Returns a shared image for the given type, or a generic image if none
- * has been registered for the given type.
- * <p>
- * Note: Images returned from this method will be automitically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param type the type
- * @return the image
- */
- public static Image getImage(String type) {
-
- type= normalizeCase(type);
-
- boolean dispose= false;
- Image image= null;
- if (type != null)
- image= (Image) fgImages.get(type);
- if (image == null) {
- ImageDescriptor id= (ImageDescriptor) fgImageDescriptors.get(type);
- if (id != null) {
- image= id.createImage();
- dispose= true;
- }
-
- if (image == null) {
- if (fgComparePlugin != null) {
- if (ITypedElement.FOLDER_TYPE.equals(type)) {
- image= getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- //image= SharedImages.getImage(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- image= createWorkbenchImage(type);
- dispose= true;
- }
- } else {
- id= (ImageDescriptor) fgImageDescriptors.get(normalizeCase("file")); //$NON-NLS-1$
- image= id.createImage();
- dispose= true;
- }
- }
- if (image != null)
- registerImage(type, image, dispose);
- }
- return image;
- }
-
- /**
- * Returns a shared image for the given adaptable.
- * This convenience method queries the given adaptable
- * for its <code>IWorkbenchAdapter.getImageDescriptor</code>, which it
- * uses to create an image if it does not already have one.
- * <p>
- * Note: Images returned from this method will be automitically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param adaptable the adaptable for which to find an image
- * @return an image
- */
- public static Image getImage(IAdaptable adaptable) {
- if (adaptable != null) {
- Object o= adaptable.getAdapter(IWorkbenchAdapter.class);
- if (o instanceof IWorkbenchAdapter) {
- ImageDescriptor id= ((IWorkbenchAdapter) o).getImageDescriptor(adaptable);
- if (id != null) {
- Image image= (Image)fgImages2.get(id);
- if (image == null) {
- image= id.createImage();
- try {
- fgImages2.put(id, image);
- } catch (NullPointerException ex) {
- // NeedWork
- }
- fgDisposeOnShutdownImages.add(image);
-
- }
- return image;
- }
- }
- }
- return null;
- }
-
- private static Image createWorkbenchImage(String type) {
- IEditorRegistry er= getDefault().getWorkbench().getEditorRegistry();
- ImageDescriptor id= er.getImageDescriptor("foo." + type); //$NON-NLS-1$
- return id.createImage();
- }
-
- /**
- * Registers the given structure creator descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param descriptor the descriptor to register
- */
- public static void registerStructureCreator(String types, IStructureCreatorDescriptor descriptor) {
- if (types != null) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgStructureCreators.put(normalizeCase(extension), descriptor);
- }
- }
- }
-
- /**
- * Returns an structure creator descriptor for the given type.
- *
- * @param type the type for which to find a descriptor
- * @return a descriptor for the given type, or <code>null</code> if no
- * descriptor has been registered
- */
- public static IStructureCreatorDescriptor getStructureCreator(String type) {
- return (IStructureCreatorDescriptor) fgStructureCreators.get(normalizeCase(type));
- }
-
- /**
- * Registers the given structure viewer descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param the descriptor to register
- */
- public static void registerStructureViewerDescriptor(String types, IViewerDescriptor descriptor) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgStructureViewerDescriptors.put(normalizeCase(extension), descriptor);
- }
- }
-
- /**
- * Registers the given content merge viewer descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param descriptor the descriptor to register
- */
- public static void registerContentMergeViewerDescriptor(String types, IViewerDescriptor descriptor) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgContentMergeViewerDescriptors.put(normalizeCase(extension), descriptor);
- }
- }
-
- /**
- * Registers the given content viewer descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param descriptor the descriptor to register
- */
- public static void registerContentViewerDescriptor(String types, IViewerDescriptor descriptor) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgContentViewerDescriptors.put(normalizeCase(extension), descriptor);
- }
- }
-
- /**
- * Returns a structure compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input, the old viewer
- * is returned. Otherwise, the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a structure compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a structure viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
- CompareConfiguration configuration) {
-
- if (input.getLeft() == null || input.getRight() == null) // we don't show the structure of additions or deletions
- return null;
-
- String[] types= getTypes(input);
- if (!isHomogenous(types))
- return null;
- String type= types[0];
-
- type= normalizeCase(type);
-
- IViewerDescriptor vd= (IViewerDescriptor) fgStructureViewerDescriptors.get(type);
- if (vd == null) {
- String alias= (String) fgStructureViewerAliases.get(type);
- if (alias != null)
- vd= (IViewerDescriptor) fgStructureViewerDescriptors.get(alias);
- }
- if (vd != null)
- return vd.createViewer(oldViewer, parent, configuration);
-
- IStructureCreatorDescriptor scc= getStructureCreator(type);
- if (scc != null) {
- IStructureCreator sc= scc.createStructureCreator();
- if (sc != null) {
- StructureDiffViewer sdv= new StructureDiffViewer(parent, configuration);
- sdv.setStructureCreator(sc);
- return sdv;
- }
- }
- return null;
- }
-
- /**
- * Returns a content compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input the old viewer
- * is returned. Otherwise the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a content compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a content viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findContentViewer(Viewer oldViewer, Object in, Composite parent, CompareConfiguration cc) {
-
- if (in instanceof IStreamContentAccessor) {
- String type= ITypedElement.TEXT_TYPE;
-
- if (in instanceof ITypedElement) {
- ITypedElement tin= (ITypedElement) in;
- String ty= tin.getType();
- if (ty != null)
- type= ty;
- }
- type= normalizeCase(type);
-
- IViewerDescriptor vd= (IViewerDescriptor) fgContentViewerDescriptors.get(type);
- Viewer viewer= null;
- if (vd != null) {
- viewer= vd.createViewer(oldViewer, parent, cc);
- if (viewer != null)
- return viewer;
- }
- // fallback
- return new SimpleTextViewer(parent);
- }
-
- if (!(in instanceof ICompareInput))
- return null;
-
- ICompareInput input= (ICompareInput) in;
- String[] types= getTypes(input);
- String type= null;
- if (isHomogenous(types))
- type= types[0];
-
- if (ITypedElement.FOLDER_TYPE.equals(type))
- return null;
-
- if (type == null) {
- int n= 0;
- for (int i= 0; i < types.length; i++)
- if (!ITypedElement.UNKNOWN_TYPE.equals(types[i])) {
- n++;
- if (type == null)
- type= types[i]; // remember the first known type
- }
- if (n > 1) // don't use the type if there were more than one
- type= null;
- }
-
- if (type != null) {
- IViewerDescriptor vd= (IViewerDescriptor) fgContentMergeViewerDescriptors.get(type);
- Viewer viewer= null;
- if (vd != null) {
- viewer= vd.createViewer(oldViewer, parent, cc);
- if (viewer != null)
- return viewer;
- }
- }
-
- // fallback
- String leftType= guessType(input.getLeft());
- String rightType= guessType(input.getRight());
-
- if (leftType != null || rightType != null) {
- boolean right_text= rightType != null && ITypedElement.TEXT_TYPE.equals(rightType);
- boolean left_text= leftType != null && ITypedElement.TEXT_TYPE.equals(leftType);
- if ((leftType == null && right_text) || (left_text && rightType == null) || (left_text && right_text))
- type= ITypedElement.TEXT_TYPE;
- else
- type= "binary"; //$NON-NLS-1$
-
- IViewerDescriptor vd= (IViewerDescriptor) fgContentMergeViewerDescriptors.get(normalizeCase(type));
- if (vd != null)
- return vd.createViewer(oldViewer, parent, cc);
- }
- return null;
- }
-
- private static String[] getTypes(ICompareInput input) {
- ITypedElement ancestor= input.getAncestor();
- ITypedElement left= input.getLeft();
- ITypedElement right= input.getRight();
-
- String[] types= new String[3];
- int cnt= 0;
-
- if (ancestor != null) {
- String type= ancestor.getType();
- if (type != null)
- types[cnt++]= normalizeCase(type);
- }
- if (left != null) {
- String type= left.getType();
- if (type != null)
- types[cnt++]= normalizeCase(type);
- }
- if (right != null) {
- String type= right.getType();
- if (type != null)
- types[cnt++]= normalizeCase(type);
- }
-
- String[] result= new String[cnt];
- for (int i= 0; i < cnt; i++)
- result[i]= types[i];
- return result;
- }
-
- /**
- * Determines the type of the given threeway input by analyzing
- * the types (file extension) of the individual parts.
- * Returns null if no type can be determined.
- */
- private static boolean isHomogenous(String[] types) {
- switch (types.length) {
- case 1:
- return true;
- case 2:
- return types[0].equals(types[1]);
- case 3:
- return types[0].equals(types[1]) && types[1].equals(types[2]);
- }
- return false;
- }
-
- /**
- * Guesses the file type of the given input.
- * Returns ITypedElement.TEXT_TYPE if none of the first 10 lines is longer than 1000 bytes.
- * Returns ITypedElement.UNKNOWN_TYPE otherwise.
- * Returns <code>null</code> if the input isn't an <code>IStreamContentAccessor</code>.
- */
- private static String guessType(ITypedElement input) {
- if (input instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) input;
- InputStream is= null;
- try {
- is= sca.getContents();
- if (is == null)
- return null;
- int lineLength= 0;
- int lines= 0;
- while (lines < 10) {
- int c= is.read();
- if (c == -1) // EOF
- break;
- if (c == '\n' || c == '\r') { // reset line length
- lineLength= 0;
- lines++;
- } else
- lineLength++;
- if (lineLength > 1000)
- return ITypedElement.UNKNOWN_TYPE;
- }
- return ITypedElement.TEXT_TYPE;
- } catch (CoreException ex) {
- // be silent and return UNKNOWN_TYPE
- } catch (IOException ex) {
- // be silent and return UNKNOWN_TYPE
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- return ITypedElement.UNKNOWN_TYPE;
- }
- return null;
- }
-
- private static String normalizeCase(String s) {
- if (NORMALIZE_CASE && s != null)
- return s.toUpperCase();
- return s;
- }
-
- //---- alias mgmt
-
- private void initPreferenceStore() {
- //System.out.println("initPreferenceStore");
- final IPreferenceStore ps= getPreferenceStore();
- if (ps != null) {
- String aliases= ps.getString(STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME);
- //System.out.println(" <" + aliases + ">");
- if (aliases != null && aliases.length() > 0) {
- StringTokenizer st= new StringTokenizer(aliases, " "); //$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String pair= st.nextToken();
- int pos= pair.indexOf('.');
- if (pos > 0) {
- String key= pair.substring(0, pos);
- String alias= pair.substring(pos+1);
- fgStructureViewerAliases.put(key, alias);
- //System.out.println("<" + key + "><" + alias + ">");
- }
- }
- }
- fFilter= new CompareFilter();
- fFilter.setFilters(ps.getString(ComparePreferencePage.PATH_FILTER));
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (ComparePreferencePage.PATH_FILTER.equals(event.getProperty()))
- fFilter.setFilters(ps.getString(ComparePreferencePage.PATH_FILTER));
- }
- };
- ps.addPropertyChangeListener(fPropertyChangeListener);
- }
- }
-
- public static void addStructureViewerAlias(String type, String alias) {
- //System.out.println("addStructureViewerAlias: " + type + " " + alias);
- fgStructureViewerAliases.put(normalizeCase(alias), normalizeCase(type));
- }
-
- public static void removeAllStructureViewerAliases(String type) {
- String t= normalizeCase(type);
- Set entrySet= fgStructureViewerAliases.entrySet();
- for (Iterator iter= entrySet.iterator(); iter.hasNext(); ) {
- Map.Entry entry= (Map.Entry)iter.next();
- if (entry.getValue().equals(t))
- iter.remove();
- }
- }
-
- /**
- * Returns an array of all editors that have an unsaved content. If the identical content is
- * presented in more than one editor, only one of those editor parts is part of the result.
- *
- * @return an array of all dirty editor parts.
- */
- public static IEditorPart[] getDirtyEditors() {
- Set inputs= new HashSet();
- List result= new ArrayList(0);
- IWorkbench workbench= getDefault().getWorkbench();
- IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
- for (int i= 0; i < windows.length; i++) {
- IWorkbenchPage[] pages= windows[i].getPages();
- for (int x= 0; x < pages.length; x++) {
- IEditorPart[] editors= pages[x].getDirtyEditors();
- for (int z= 0; z < editors.length; z++) {
- IEditorPart ep= editors[z];
- IEditorInput input= ep.getEditorInput();
- if (!inputs.contains(input)) {
- inputs.add(input);
- result.add(ep);
- }
- }
- }
- }
- return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, CompareMessages.getString("ComparePlugin.internal_error"), e)); //$NON-NLS-1$
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static String getPluginId() {
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static boolean filter(String name, boolean isFolder, boolean isArchive) {
- CompareFilter f= getDefault().fFilter;
- return f.filter(name, isFolder, isArchive);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
deleted file mode 100644
index f8cef54d1..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-public class CompareWithEditionAction extends EditionAction {
-
- public CompareWithEditionAction() {
- super(false, "org.eclipse.compare.internal.CompareWithEditionAction"); //$NON-NLS-1$
- this.fHelpContextId= ICompareContextIds.COMPARE_WITH_EDITION_DIALOG;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties
deleted file mode 100644
index 154531afa..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties
+++ /dev/null
@@ -1,38 +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
-###############################################################################
-
-# @(#)CompareWithEditionAction.properties
-#
-# Resources for CompareWithEditionAction.java
-
-title= Compare with Local History
-
-treeTitleFormat= Local History of ''{0}''
-dateIcon= obj16/day_obj.gif
-timeIcon= obj16/resource_obj.gif
-
-treeFormat= {0}
-workspaceTreeFormat= {0} (Workspace File)
-parseErrorFormat= {0} (Parse Error)
-
-editionLabel= Local History ({0})
-workspaceEditionLabel= Workspace File
-
-targetLabel= Editor Buffer
-workspaceTargetLabel= Workspace File
-
-todayFormat= Today ({0})
-yesterdayFormat= Yesterday ({0})
-dayFormat= {0}
-
-closeButton.label=Close
-
-noLocalHistoryError= No local history available for selected resource.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java
deleted file mode 100644
index 1c17ded85..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.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.compare.internal;
-
-import org.eclipse.swt.graphics.*;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Combines an image with an overlay.
- */
-public class DiffImage extends CompositeImageDescriptor {
-
- static final int HEIGHT= 16;
-
- private Image fBaseImage;
- private ImageDescriptor fOverlayImage;
- private int fWidth;
- private boolean fLeft= true;
-
- public DiffImage(Image base, ImageDescriptor overlay, int w) {
- fBaseImage= base;
- fOverlayImage= overlay;
- fWidth= w;
- }
-
- public DiffImage(Image base, ImageDescriptor overlay, int w, boolean onLeft) {
- fBaseImage= base;
- fOverlayImage= overlay;
- fWidth= w;
- fLeft= onLeft;
- }
-
- protected Point getSize() {
- return new Point(fWidth, HEIGHT);
- }
-
- protected void drawCompositeImage(int width, int height) {
- if (fLeft) {
- if (fBaseImage != null) {
- ImageData base= fBaseImage.getImageData();
- if (base == null)
- base= DEFAULT_IMAGE_DATA;
- drawImage(base, fWidth - base.width, 0);
- }
-
- if (fOverlayImage != null) {
- ImageData overlay= fOverlayImage.getImageData();
- if (overlay == null)
- overlay= DEFAULT_IMAGE_DATA;
- drawImage(overlay, 0, (HEIGHT - overlay.height) / 2);
- }
- } else {
- if (fBaseImage != null) {
- ImageData base= fBaseImage.getImageData();
- if (base == null)
- base= DEFAULT_IMAGE_DATA;
- drawImage(base, 0, 0);
- }
-
- if (fOverlayImage != null) {
- ImageData overlay= fOverlayImage.getImageData();
- if (overlay == null)
- overlay= DEFAULT_IMAGE_DATA;
- drawImage(overlay, fWidth - overlay.width, (HEIGHT - overlay.height) / 2);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
deleted file mode 100644
index 20dc15a3b..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
+++ /dev/null
@@ -1,197 +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.compare.internal;
-
-import org.eclipse.jface.text.*;
-import org.eclipse.compare.contentmergeviewer.ITokenComparator;
-import org.eclipse.compare.rangedifferencer.IRangeComparator;
-
-/**
- * Implements the <code>IRangeComparator</code> interface for lines in a document.
- * A <code>DocLineComparator</code> is used as the input for the <code>RangeDifferencer</code>
- * engine to perform a line oriented compare on documents.
- * <p>
- * A <code>DocLineComparator</code> doesn't know anything about line separators because
- * its notion of lines is solely defined in the underlying <code>IDocument</code>.
- */
-public class DocLineComparator implements ITokenComparator {
-
- private IDocument fDocument;
- private int fLineOffset;
- private int fLineCount;
- private int fLength;
- private boolean fIgnoreWhiteSpace;
-
- /**
- * Creates a <code>DocLineComparator</code> for the given document range.
- * ignoreWhiteSpace controls whether comparing lines (in method
- * <code>rangesEqual<code>) should ignore whitespace.
- *
- * @param document the document from which the lines are taken
- * @param region if non-<code>null</code> only lines within this range are taken
- * @param ignoreWhiteSpace if <code>true</code> white space is ignored when comparing lines
- */
- public DocLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace) {
-
- fDocument= document;
- fIgnoreWhiteSpace= ignoreWhiteSpace;
-
- fLineOffset= 0;
- if (region != null) {
- fLength= region.getLength();
- int start= region.getOffset();
- try {
- fLineOffset= fDocument.getLineOfOffset(start);
- } catch (BadLocationException ex) {
- // silently ignored
- }
-
- if (fLength == 0)
- fLineCount= 0;
- else {
- int endLine= fDocument.getNumberOfLines();
- try {
- endLine= fDocument.getLineOfOffset(start + fLength);
- } catch (BadLocationException ex) {
- // silently ignored
- }
- fLineCount= endLine - fLineOffset + 1;
- }
-
- } else {
- fLength= document.getLength();
- fLineCount= fDocument.getNumberOfLines();
- }
- }
-
- /**
- * Returns the number of lines in the document.
- *
- * @return number of lines
- */
- public int getRangeCount() {
- return fLineCount;
- }
-
- /* (non Javadoc)
- * see ITokenComparator.getTokenStart
- */
- public int getTokenStart(int line) {
- try {
- IRegion r= fDocument.getLineInformation(fLineOffset + line);
- return r.getOffset();
- } catch (BadLocationException ex) {
- return fDocument.getLength();
- }
- }
-
- /* (non Javadoc)
- * Returns the length of the given line.
- * see ITokenComparator.getTokenLength
- */
- public int getTokenLength(int line) {
- return getTokenStart(line+1) - getTokenStart(line);
- }
-
- /**
- * Returns <code>true</code> if a line given by the first index
- * matches a line specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the number of the line within this range comparator
- * @param other the range comparator to compare this with
- * @param otherIndex the number of the line within the other comparator
- * @return <code>true</code> if the lines are equal
- */
- public boolean rangesEqual(int thisIndex, IRangeComparator other0, int otherIndex) {
-
- if (other0 != null && other0.getClass() == getClass()) {
- DocLineComparator other= (DocLineComparator) other0;
-
- if (fIgnoreWhiteSpace) {
- String s1= extract(thisIndex);
- String s2= other.extract(otherIndex);
- return compare(s1, s2);
- }
-
- int tlen= getTokenLength(thisIndex);
- int olen= other.getTokenLength(otherIndex);
- if (tlen == olen) {
- String s1= extract(thisIndex);
- String s2= other.extract(otherIndex);
- return s1.equals(s2);
- }
- }
- return false;
- }
-
- /**
- * Aborts the comparison if the number of tokens is too large.
- *
- * @return <code>true</code> to abort a token comparison
- */
- public boolean skipRangeComparison(int length, int max, IRangeComparator other) {
- return false;
- }
-
- //---- private methods
-
- /**
- * Extract a single line from the underlying document without the line separator.
- *
- * @param line the number of the line to extract
- * @return the contents of the line as a String
- */
- private String extract(int line) {
- if (line < fLineCount) {
- try {
- IRegion r= fDocument.getLineInformation(fLineOffset + line);
- return fDocument.get(r.getOffset(), r.getLength());
- } catch(BadLocationException e) {
- // silently ignored
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- private boolean compare(String s1, String s2) {
- int l1= s1.length();
- int l2= s2.length();
- int c1= 0, c2= 0;
- int i1= 0, i2= 0;
-
- while (c1 != -1) {
-
- c1= -1;
- while (i1 < l1) {
- char c= s1.charAt(i1++);
- if (! Character.isWhitespace(c)) {
- c1= c;
- break;
- }
- }
-
- c2= -1;
- while (i2 < l2) {
- char c= s2.charAt(i2++);
- if (! Character.isWhitespace(c)) {
- c2= c;
- break;
- }
- }
-
- if (c1 != c2)
- return false;
- }
- return true;
- }
-
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
deleted file mode 100644
index b2db19190..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.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.compare.internal;
-
-import java.util.*;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- * No API yet.
- */
-public class DocumentManager {
-
- private static final boolean DEBUG= false;
-
- private static ArrayList fgKeys= new ArrayList();
- private static ArrayList fgValues= new ArrayList();
-
- public static IDocument get(Object o) {
-
- for (int i= 0; i < fgKeys.size(); i++) {
- if (fgKeys.get(i) == o)
- return (IDocument) fgValues.get(i);
- }
- return null;
- }
-
- public static void put(Object o, IDocument document) {
- if (DEBUG) System.out.println("DocumentManager.put: " + document); //$NON-NLS-1$
- for (int i= 0; i < fgKeys.size(); i++) {
- if (fgKeys.get(i) == o) {
- fgValues.set(i, document);
- return;
- }
- }
- fgKeys.add(o);
- fgValues.add(document);
- }
-
- public static void remove(IDocument document) {
- if (document != null) {
- if (DEBUG) System.out.println("DocumentManager.remove: " + document); //$NON-NLS-1$
- for (int i= 0; i < fgValues.size(); i++) {
- if (fgValues.get(i) == document) {
- fgKeys.remove(i);
- fgValues.remove(i);
- return;
- }
- }
- if (DEBUG) System.out.println("DocumentManager.remove: not found"); //$NON-NLS-1$
- }
- }
-
- public static void dump() {
- if (DEBUG) System.out.println("DocumentManager: managed docs:" + fgValues.size()); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
deleted file mode 100644
index da39a3484..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
+++ /dev/null
@@ -1,237 +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.compare.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ResourceBundle;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.BadLocationException;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.IStreamContentAccessor;
-
-
-public class EditionAction extends BaseCompareAction {
-
- /**
- * Implements the IStreamContentAccessor and ITypedElement protocols
- * for a Document.
- */
- class DocumentBufferNode implements ITypedElement, IEncodedStreamContentAccessor {
- private static final String UTF_16= "UTF-16"; //$NON-NLS-1$
- private IDocument fDocument;
- private IFile fFile;
-
- DocumentBufferNode(IDocument document, IFile file) {
- fDocument= document;
- fFile= file;
- }
-
- public String getName() {
- return fFile.getName();
- }
-
- public String getType() {
- return fFile.getFileExtension();
- }
-
- public Image getImage() {
- return null;
- }
-
- public InputStream getContents() {
- return new ByteArrayInputStream(Utilities.getBytes(fDocument.get(), UTF_16));
- }
-
- public String getCharset() {
- return UTF_16;
- }
- }
-
- private String fBundleName;
- private boolean fReplaceMode;
- protected boolean fPrevious= false;
- protected String fHelpContextId;
-
- EditionAction(boolean replaceMode, String bundleName) {
- fReplaceMode= replaceMode;
- fBundleName= bundleName;
- }
-
- protected boolean isEnabled(ISelection selection) {
- return Utilities.getFiles(selection).length == 1; // we don't support multiple selection for now
- }
-
- protected void run(ISelection selection) {
- IFile[] files= Utilities.getFiles(selection);
- for (int i= 0; i < files.length; i++)
- doFromHistory(files[i]);
- }
-
- private void doFromHistory(final IFile file) {
-
- ResourceBundle bundle= ResourceBundle.getBundle(fBundleName);
- String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
- Shell parentShell= CompareUIPlugin.getShell();
-
- IFileState states[]= null;
- try {
- states= file.getHistory(null);
- } catch (CoreException ex) {
- MessageDialog.openError(parentShell, title, ex.getMessage());
- return;
- }
-
- if (states == null || states.length <= 0) {
- String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
- MessageDialog.openInformation(parentShell, title, msg);
- return;
- }
-
- ITypedElement base= new ResourceNode(file);
-
- IDocument document= getDocument(file);
- ITypedElement target= base;
- if (document != null)
- target= new DocumentBufferNode(document, file);
-
- ITypedElement[] editions= new ITypedElement[states.length+1];
- editions[0]= base;
- for (int i= 0; i < states.length; i++)
- editions[i+1]= new HistoryItem(base, states[i]);
-
- EditionSelectionDialog d= new EditionSelectionDialog(parentShell, bundle);
- d.setEditionTitleArgument(file.getName());
- d.setEditionTitleImage(CompareUIPlugin.getImage(file));
- //d.setHideIdenticalEntries(false);
- if (fHelpContextId != null)
- d.setHelpContextId(fHelpContextId);
-
- if (fReplaceMode) {
-
- ITypedElement ti= null;
- if (fPrevious)
- ti= d.selectPreviousEdition(target, editions, null);
- else
- ti= d.selectEdition(target, editions, null);
-
- if (ti instanceof IStreamContentAccessor) {
- IStreamContentAccessor sa= (IStreamContentAccessor)ti;
-
- if (Utilities.validateResource(file, parentShell, title)) {
- try {
-
- if (document != null)
- updateDocument(document, sa);
- else
- updateWorkspace(bundle, parentShell, sa, file);
-
- } catch (InterruptedException x) {
- // Do nothing. Operation has been canceled by user.
-
- } catch (InvocationTargetException x) {
- String reason= x.getTargetException().getMessage();
- MessageDialog.openError(parentShell, title, Utilities.getFormattedString(bundle, "replaceError", reason)); //$NON-NLS-1$
- }
- }
- }
- } else {
- d.setCompareMode(true);
-
- d.selectEdition(target, editions, null);
- }
- }
-
- private void updateWorkspace(final ResourceBundle bundle, Shell shell,
- final IStreamContentAccessor sa, final IFile file)
- throws InvocationTargetException, InterruptedException {
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws InvocationTargetException {
- try {
- String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
- pm.beginTask(taskName, IProgressMonitor.UNKNOWN);
- file.setContents(sa.getContents(), false, true, pm);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- pm.done();
- }
- }
- };
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
- }
-
- private void updateDocument(IDocument document, IStreamContentAccessor sa) throws InvocationTargetException {
- try {
- String text= Utilities.readString(sa);
- document.replace(0, document.getLength(), text);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (BadLocationException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- private IDocument getDocument(IFile file) {
- IWorkbench wb= PlatformUI.getWorkbench();
- if (wb == null)
- return null;
- IWorkbenchWindow[] ws= wb.getWorkbenchWindows();
- if (ws == null)
- return null;
-
- FileEditorInput test= new FileEditorInput(file);
-
- for (int i= 0; i < ws.length; i++) {
- IWorkbenchWindow w= ws[i];
- IWorkbenchPage[] wps= w.getPages();
- if (wps != null) {
- for (int j= 0; j < wps.length; j++) {
- IWorkbenchPage wp= wps[j];
- IEditorPart ep= wp.findEditor(test);
- if (ep instanceof ITextEditor) {
- ITextEditor te= (ITextEditor) ep;
- IDocumentProvider dp= te.getDocumentProvider();
- if (dp != null) {
- IDocument doc= dp.getDocument(ep);
- if (doc != null)
- return doc;
- }
- }
- }
- }
- }
- return null;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
deleted file mode 100644
index 3ea3ba5f8..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
+++ /dev/null
@@ -1,133 +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.compare.internal;
-
-import java.io.StringWriter;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-/**
- * The default exception handler shows an error dialog when one of its handle methods
- * is called. If the passed exception is a <code>CoreException</code> an error dialog
- * pops up showing the exception's status information. For a <code>InvocationTargetException</code>
- * a normal message dialog pops up showing the exception's message. Additionally the exception
- * is written to the platform log.
- */
-public class ExceptionHandler {
-
- private static ExceptionHandler fgInstance= new ExceptionHandler();
-
- /**
- * Logs the given exception using the platform's logging mechanism. The exception is
- * logged as an error with the error code <code>JavaStatusConstants.INTERNAL_ERROR</code>.
- */
- public static void log(Throwable t, String message) {
- CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(),
- CompareUIPlugin.INTERNAL_ERROR, message, t));
- }
-
- /**
- * Handles the given <code>CoreException</code>. The workbench shell is used as a parent
- * for the dialog window.
- *
- * @param e the <code>CoreException</code> to be handled
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(CoreException e, String title, String message) {
- handle(e, CompareUIPlugin.getShell(), title, message);
- }
-
- /**
- * Handles the given <code>CoreException</code>.
- *
- * @param e the <code>CoreException</code> to be handled
- * @param parent the dialog window's parent shell
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(CoreException e, Shell parent, String title, String message) {
- fgInstance.perform(e, parent, title, message);
- }
-
- /**
- * Handles the given <code>InvocationTargetException</code>. The workbench shell is used
- * as a parent for the dialog window.
- *
- * @param e the <code>InvocationTargetException</code> to be handled
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(InvocationTargetException e, String title, String message) {
- handle(e, CompareUIPlugin.getShell(), title, message);
- }
-
- /**
- * Handles the given <code>InvocationTargetException</code>.
- *
- * @param e the <code>InvocationTargetException</code> to be handled
- * @param parent the dialog window's parent shell
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(InvocationTargetException e, Shell parent, String title, String message) {
- fgInstance.perform(e, parent, title, message);
- }
-
- //---- Hooks for subclasses to control exception handling ------------------------------------
-
- protected void perform(CoreException e, Shell shell, String title, String message) {
- CompareUIPlugin.log(e);
- IStatus status= e.getStatus();
- if (status != null) {
- ErrorDialog.openError(shell, title, message, status);
- } else {
- displayMessageDialog(e, e.getMessage(), shell, title, message);
- }
- }
-
- protected void perform(InvocationTargetException e, Shell shell, String title, String message) {
- Throwable target= e.getTargetException();
- if (target instanceof CoreException) {
- perform((CoreException)target, shell, title, message);
- } else {
- CompareUIPlugin.log(e);
- if (e.getMessage() != null && e.getMessage().length() > 0) {
- displayMessageDialog(e, e.getMessage(), shell, title, message);
- } else {
- displayMessageDialog(e, target.getMessage(), shell, title, message);
- }
- }
- }
-
- //---- Helper methods -----------------------------------------------------------------------
-
- private void displayMessageDialog(Throwable t, String exceptionMessage, Shell shell, String title, String message) {
- StringWriter msg= new StringWriter();
- if (message != null) {
- msg.write(message);
- msg.write("\n\n"); //$NON-NLS-1$
- }
- if (exceptionMessage == null || exceptionMessage.length() == 0)
- msg.write(CompareMessages.getString("ExceptionDialog.seeErrorLogMessage")); //$NON-NLS-1$
- else
- msg.write(exceptionMessage);
- MessageDialog.openError(shell, title, msg.toString());
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
deleted file mode 100644
index a6df241e4..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.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.compare.internal;
-
-import org.eclipse.compare.CompareUI;
-
-/**
- * Help context ids for the Compare UI.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-public interface ICompareContextIds {
-
- public static final String PREFIX= CompareUI.PLUGIN_ID + '.';
-
- // Dialogs
- public static final String EDITION_DIALOG= PREFIX + "edition_dialog_context"; //$NON-NLS-1$
-
- public static final String COMPARE_EDITOR= PREFIX + "compare_editor_context"; //$NON-NLS-1$
- public static final String PATCH_INPUT_WIZARD_PAGE= PREFIX + "patch_input_wizard_page_context"; //$NON-NLS-1$
- public static final String PATCH_PREVIEW_WIZARD_PAGE= PREFIX + "patch_preview_wizard_page_context"; //$NON-NLS-1$
- public static final String ADD_FROM_HISTORY_DIALOG= PREFIX + "add_from_history_dialog_context"; //$NON-NLS-1$
- public static final String COMPARE_DIALOG= PREFIX + "compare_dialog_context"; //$NON-NLS-1$
- public static final String COMPARE_WITH_EDITION_DIALOG= PREFIX + "compare_with_edition_dialog_context"; //$NON-NLS-1$
- public static final String REPLACE_WITH_EDITION_DIALOG= PREFIX + "replace_with_edition_dialog_context"; //$NON-NLS-1$
-
- // Viewer
- public static final String TEXT_MERGE_VIEW= PREFIX + "text_merge_view_context"; //$NON-NLS-1$
- public static final String IMAGE_COMPARE_VIEW= PREFIX + "image_compare_view_context"; //$NON-NLS-1$
- public static final String BINARY_COMPARE_VIEW= PREFIX + "binary_compare_view_context"; //$NON-NLS-1$
- public static final String DIFF_VIEW= PREFIX + "diff_view_context"; //$NON-NLS-1$
-
- // Actions
- public static final String GLOBAL_NEXT_DIFF_ACTION= PREFIX + "global_next_diff_action_context"; //$NON-NLS-1$
- public static final String GLOBAL_PREVIOUS_DIFF_ACTION= PREFIX + "global_previous_diff_action_context"; //$NON-NLS-1$
- public static final String NEXT_DIFF_ACTION= PREFIX + "next_diff_action_context"; //$NON-NLS-1$
- public static final String PREVIOUS_DIFF_ACTION= PREFIX + "previous_diff_action_context"; //$NON-NLS-1$
- public static final String IGNORE_WHITESPACE_ACTION= PREFIX + "ignore_whitespace_action_context"; //$NON-NLS-1$
-
- // Preference page
- public static final String COMPARE_PREFERENCE_PAGE= PREFIX + "compare_preference_page_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java
deleted file mode 100644
index 3e64e2e9c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java
+++ /dev/null
@@ -1,21 +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.compare.internal;
-
-public interface INavigatable {
-
- static final String NAVIGATOR_PROPERTY= "org.eclipse.compare.internal.Navigator"; //$NON-NLS-1$
-
- /**
- * Returns true if at end or beginning.
- */
- boolean gotoDifference(boolean next);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java
deleted file mode 100644
index 013885909..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java
+++ /dev/null
@@ -1,24 +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.compare.internal;
-
-/*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
-public interface IOpenable {
-
- static final String OPENABLE_PROPERTY= "org.eclipse.compare.internal.Openable"; //$NON-NLS-1$
-
- /**
- * Opens the selected element
- */
- void openSelected();
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java
deleted file mode 100644
index a15db7c68..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java
+++ /dev/null
@@ -1,19 +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.compare.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-public interface ISavable {
-
- void save(IProgressMonitor pm) throws CoreException;
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java
deleted file mode 100644
index f5a845e80..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.compare.structuremergeviewer.IStructureCreator;
-
-/**
- * A factory object for creating <code>IStructureCreator</code>s from a descriptor.
- * <p>
- * It is used when registering <code>IStructureCreator</code> for types
- * in <code>CompareUIPlugin.registerStructureCreator</code>.
- * </p>
- *
- * @see IStructureCreator
- * @see CompareUIPlugin
- */
-public interface IStructureCreatorDescriptor {
-
- /**
- * Creates a new structure creator.
- *
- * @return a newly created structure creator
- */
- IStructureCreator createStructureCreator();
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java
deleted file mode 100644
index 2dda66e0d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.compare.CompareConfiguration;
-
-/**
- * A factory object for creating a <code>Viewer</code>s from a descriptor.
- * <p>
- * It is used when registering a viewer for a specific type
- * in <code>CompareUIPlugin.registerContentViewerDescriptor</code> and
- * in <code>CompareUIPlugin.registerStructureViewerDescriptor</code>.
- *
- * @see org.eclipse.compare.structuremergeviewer.IStructureCreator
- * @see CompareUIPlugin
- */
-public interface IViewerDescriptor {
-
- /**
- * Creates a new viewer from this descriptor under the given STW parent control.
- * If the current viewer has the same type as a new viewer
- * the implementation of this method is free to return the current viewer instead.
- *
- * @param currentViewer the current viewer which is going to be replaced with a new viewer.
- * @param parent the SWT parent control under which the new viewer has to be created.
- * @param config a compare configuration the new viewer might be interested in.
- * @return a new viewer or the current viewer.
- */
- Viewer createViewer(Viewer currentViewer, Composite parent, CompareConfiguration config);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java
deleted file mode 100644
index b6b0fa14d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.compare.*;
-
-/**
- * Toggles the <code>ICompareConfiguration.IGNORE_WS</code> property of an
- * <code>ICompareConfiguration</code>.
- */
-public class IgnoreWhiteSpaceAction extends ChangePropertyAction {
-
- public IgnoreWhiteSpaceAction(ResourceBundle bundle, CompareConfiguration cc) {
- super(bundle, cc, "action.IgnoreWhiteSpace.", CompareConfiguration.IGNORE_WHITESPACE); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java
deleted file mode 100644
index f598f89b8..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A <code>Canvas</code> showing a single centered SWT <code>Image</code>.
- * If the <code>Image</code> is larger than the <code>Canvas<code>,
- * <code>Scrollbars</code> will appear.
- */
-class ImageCanvas extends Canvas {
-
- private Image fImage;
-
- /**
- * Create a new ImageCanvas with the given SWT stylebits.
- * (SWT.H_SCROLL and SWT.V_SCROLL are automtically added).
- */
- public ImageCanvas(Composite parent, int style) {
- super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL);
-
- ScrollBar sb= getHorizontalBar();
- sb.setIncrement(20);
- sb.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- repaint();
- }
- });
-
- sb= getVerticalBar();
- sb.setIncrement(20);
- sb.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- repaint();
- }
- });
-
- addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event e) {
- updateScrollbars();
- }
- });
-
- addListener(SWT.Paint, new Listener() {
- public void handleEvent(Event event) {
- paint(event.gc);
- }
- });
- }
-
- /**
- * Set the SWT Image to use as the ImageCanvas contents.
- */
- public void setImage(Image img) {
- fImage= img;
-
- if (!isDisposed()) {
- getHorizontalBar().setSelection(0);
- getVerticalBar().setSelection(0);
- updateScrollbars();
- getParent().layout();
- redraw();
- }
- }
-
- public void repaint() {
- if (!isDisposed()) {
- GC gc= new GC(this);
- paint(gc);
- gc.dispose();
- }
- }
-
- /**
- * @private
- */
- void paint(GC gc) {
- if (fImage != null) {
- Rectangle bounds= fImage.getBounds();
- Rectangle clientArea= getClientArea();
-
- int x;
- if (bounds.width < clientArea.width)
- x= (clientArea.width - bounds.width) / 2;
- else
- x= -getHorizontalBar().getSelection();
-
- int y;
- if (bounds.height < clientArea.height)
- y= (clientArea.height - bounds.height) / 2;
- else
- y= -getVerticalBar().getSelection();
-
- gc.drawImage(fImage, x, y);
- }
- }
-
- /**
- * @private
- */
- void updateScrollbars() {
- Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0);
- Point size= getSize();
- Rectangle clientArea= getClientArea();
-
- ScrollBar horizontal= getHorizontalBar();
- if (bounds.width <= clientArea.width) {
- horizontal.setVisible(false);
- horizontal.setSelection(0);
- } else {
- horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
- int max= bounds.width + (size.x - clientArea.width);
- horizontal.setMaximum(max);
- horizontal.setThumb(size.x > max ? max : size.x);
- horizontal.setVisible(true);
- }
-
- ScrollBar vertical= getVerticalBar();
- if (bounds.height <= clientArea.height) {
- vertical.setVisible(false);
- vertical.setSelection(0);
- } else {
- vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
- int max= bounds.height + (size.y - clientArea.height);
- vertical.setMaximum(max);
- vertical.setThumb(size.y > max ? max : size.y);
- vertical.setVisible(true);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
deleted file mode 100644
index d205e2fd1..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
+++ /dev/null
@@ -1,145 +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.compare.internal;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
-
-/**
- */
-public class ImageMergeViewer extends ContentMergeViewer {
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.internal.ImageMergeViewerResources"; //$NON-NLS-1$
-
- private Object fLeftImage;
- private Object fRightImage;
-
- private ImageCanvas fAncestor;
- private ImageCanvas fLeft;
- private ImageCanvas fRight;
-
-
- public ImageMergeViewer(Composite parent, int styles, CompareConfiguration mp) {
- super(styles, ResourceBundle.getBundle(BUNDLE_NAME), mp);
-
- WorkbenchHelp.setHelp(parent, ICompareContextIds.IMAGE_COMPARE_VIEW);
-
- buildControl(parent);
- String title= Utilities.getString(getResourceBundle(), "title"); //$NON-NLS-1$
- getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, title);
- }
-
- protected void updateContent(Object ancestor, Object left, Object right) {
-
- setInput(fAncestor, ancestor);
-
- fLeftImage= left;
- setInput(fLeft, left);
-
- fRightImage= right;
- setInput(fRight, right);
- }
-
- /**
- * We can't modify the contents of either side we just return null.
- */
- protected byte[] getContents(boolean left) {
- return null;
- }
-
- public void createControls(Composite composite) {
- fAncestor= new ImageCanvas(composite, SWT.NO_FOCUS);
- fLeft= new ImageCanvas(composite, SWT.NO_FOCUS);
- fRight= new ImageCanvas(composite, SWT.NO_FOCUS);
- }
-
- private static void setInput(ImageCanvas canvas, Object input) {
- if (canvas != null) {
-
- InputStream stream= null;
- if (input instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) input;
- if (sca != null) {
- try {
- stream= sca.getContents();
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
-
- Image image= null;
- Display display= canvas.getDisplay();
- if (stream != null) {
- try {
- image= new Image(display, stream);
- } catch (SWTException ex) {
- // silently ignored
- }
- }
-
- canvas.setImage(image);
- if (image != null) {
- canvas.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- } else {
- canvas.setBackground(null);
- }
-
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- }
-
- protected void handleResizeAncestor(int x, int y, int width, int height) {
- if (width > 0) {
- fAncestor.setVisible(true);
- fAncestor.setBounds(x, y, width, height);
- } else {
- fAncestor.setVisible(false);
- }
- }
-
- protected void handleResizeLeftRight(int x, int y, int width1, int centerWidth, int width2, int height) {
- fLeft.setBounds(x, y, width1, height);
- fRight.setBounds(x+width1+centerWidth, y, width2, height);
- }
-
- protected void copy(boolean leftToRight) {
- if (leftToRight) {
- fRightImage= fLeftImage;
- setInput(fRight, fRightImage);
- setRightDirty(true);
- } else {
- fLeftImage= fRightImage;
- setInput(fLeft, fLeftImage);
- setLeftDirty(true);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java
deleted file mode 100644
index ae0ab7813..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java
+++ /dev/null
@@ -1,30 +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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.compare.*;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A factory object for the <code>ImageMergeViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class ImageMergeViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new ImageMergeViewer(parent, SWT.NULL, mp);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties
deleted file mode 100644
index cb23466b0..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# @(#)ImageMergeViewerResources.properties
-#
-# Resource strings for ImageMergeViewer.java
-
-title= Image Compare
-
-#####################################################
-# Actions
-#####################################################
-
-action.CopyLeftToRight.label= Copy Left to Right
-action.CopyLeftToRight.tooltip= Copy Image from Left to Right
-action.CopyLeftToRight.image= elcl16/copy_r_co.gif
-
-action.CopyRightToLeft.label= Copy Right to Left
-action.CopyRightToLeft.tooltip= Copy Image from Right to Left
-action.CopyRightToLeft.image= elcl16/copy_l_co.gif
-
-action.EnableAncestor.label= Enable Ancestor Pane
-action.EnableAncestor.tooltip= Control Visibility of Ancestor Pane
-action.EnableAncestor.image= elcl16/ancestorpane_co.gif
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
deleted file mode 100644
index b39150c19..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A specialized content provider to show a list of editor parts.
- */
-public class ListContentProvider implements IStructuredContentProvider {
- List fContents;
-
- public ListContentProvider() {
- }
-
- public Object[] getElements(Object input) {
- if (fContents != null && fContents == input)
- return fContents.toArray();
- return new Object[0];
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof List)
- fContents= (List)newInput;
- else
- fContents= null;
- // we use a fixed set.
- }
-
- public void dispose() {
- }
-
- public boolean isDeleted(Object o) {
- return fContents != null && !fContents.contains(o);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java
deleted file mode 100644
index 5df991bc3..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java
+++ /dev/null
@@ -1,90 +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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-public class ListDialog extends SelectionDialog {
-
- private IStructuredContentProvider fContentProvider;
- private ILabelProvider fLabelProvider;
- private Object fInput;
- private TableViewer fTableViewer;
- private boolean fAddCancelButton;
-
- public ListDialog(Shell parent) {
- super(parent);
- fAddCancelButton= false;
- }
-
- public void setInput(Object input) {
- fInput= input;
- }
-
- public void setContentProvider(IStructuredContentProvider sp){
- fContentProvider= sp;
- }
-
- public void setLabelProvider(ILabelProvider lp){
- fLabelProvider= lp;
- }
-
- public void setAddCancelButton(boolean addCancelButton) {
- fAddCancelButton= addCancelButton;
- }
-
- public TableViewer getTableViewer(){
- return fTableViewer;
- }
-
- public boolean hasFilters(){
- return fTableViewer.getFilters() != null && fTableViewer.getFilters().length != 0;
- }
-
- public void create() {
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE);
- super.create();
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- if (! fAddCancelButton)
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- else
- super.createButtonsForButtonBar(parent);
- }
-
- protected Control createDialogArea(Composite container) {
- Composite parent= (Composite) super.createDialogArea(container);
- createMessageArea(parent);
- fTableViewer= new TableViewer(parent, getTableStyle());
- fTableViewer.setContentProvider(fContentProvider);
- Table table= fTableViewer.getTable();
- fTableViewer.setLabelProvider(fLabelProvider);
- fTableViewer.setInput(fInput);
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= convertHeightInCharsToPixels(15);
- gd.widthHint= convertWidthInCharsToPixels(55);
- table.setLayoutData(gd);
- applyDialogFont(parent);
- return parent;
- }
-
- protected int getTableStyle() {
- return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
deleted file mode 100644
index 707b2f1ef..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
+++ /dev/null
@@ -1,398 +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.compare.internal;
-
-import java.util.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.graphics.Font;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.*;
-
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-/**
- * Extends the JFace SourceViewer with some convenience methods.
- */
-public class MergeSourceViewer extends SourceViewer
- implements ISelectionChangedListener, ITextListener, IMenuListener {
-
- public static final String UNDO_ID= "undo"; //$NON-NLS-1$
- public static final String REDO_ID= "redo"; //$NON-NLS-1$
- public static final String CUT_ID= "cut"; //$NON-NLS-1$
- public static final String COPY_ID= "copy"; //$NON-NLS-1$
- public static final String PASTE_ID= "paste"; //$NON-NLS-1$
- public static final String DELETE_ID= "delete"; //$NON-NLS-1$
- public static final String SELECT_ALL_ID= "selectAll"; //$NON-NLS-1$
- public static final String SAVE_ID= "save"; //$NON-NLS-1$
-
- class TextOperationAction extends MergeViewerAction {
-
- private int fOperationCode;
-
- TextOperationAction(int operationCode, boolean mutable, boolean selection, boolean content) {
- super(mutable, selection, content);
- fOperationCode= operationCode;
- update();
- }
-
- public void run() {
- if (isEnabled())
- doOperation(fOperationCode);
- }
-
- public boolean isEnabled() {
- return fOperationCode != -1 && canDoOperation(fOperationCode);
- }
-
- public void update() {
- this.setEnabled(isEnabled());
- }
- }
-
- private ResourceBundle fResourceBundle;
- private Position fRegion;
- private boolean fEnabled= true;
- private HashMap fActions= new HashMap();
-
- private boolean fAddSaveAction= true;
-
-
- public MergeSourceViewer(Composite parent, ResourceBundle bundle) {
- super(parent, null, SWT.H_SCROLL + SWT.V_SCROLL);
-
- fResourceBundle= bundle;
-
- MenuManager menu= new MenuManager();
- menu.setRemoveAllWhenShown(true);
- menu.addMenuListener(this);
- StyledText te= getTextWidget();
- te.setMenu(menu.createContextMenu(te));
- }
-
- public void hideSaveAction() {
- fAddSaveAction= false;
- }
-
- public void setFont(Font font) {
- StyledText te= getTextWidget();
- if (te != null)
- te.setFont(font);
- }
-
- public void setBackgroundColor(Color color) {
- StyledText te= getTextWidget();
- if (te != null)
- te.setBackground(color);
- }
-
- public void setEnabled(boolean enabled) {
- if (enabled != fEnabled) {
- fEnabled= enabled;
- StyledText c= getTextWidget();
- if (c != null) {
- c.setEnabled(enabled);
- Display d= c.getDisplay();
- c.setBackground(enabled ? d.getSystemColor(SWT.COLOR_LIST_BACKGROUND) : null);
- }
- }
- }
-
- public boolean getEnabled() {
- return fEnabled;
- }
-
- public void setRegion(Position region) {
- fRegion= region;
- }
-
- public Position getRegion() {
- return fRegion;
- }
-
- public boolean isControlOkToUse() {
- StyledText t= getTextWidget();
- return t != null && !t.isDisposed();
- }
-
- public void setSelection(Position position) {
- if (position != null)
- setSelectedRange(position.getOffset(), position.getLength());
- }
-
- public void setLineBackground(Position position, Color c) {
- StyledText t= getTextWidget();
- if (t != null && !t.isDisposed()) {
- Point region= new Point(0, 0);
- getLineRange(position, region);
-
- region.x-= getDocumentRegionOffset();
-
- try {
- t.setLineBackground(region.x, region.y, c);
- } catch (IllegalArgumentException ex) {
- // silently ignored
- }
- }
- }
-
- public void resetLineBackground() {
- StyledText t= getTextWidget();
- if (t != null && !t.isDisposed()) {
- int lines= getLineCount();
- t.setLineBackground(0, lines, null);
- }
- }
-
- /**
- * Returns number of lines in document region.
- */
- public int getLineCount() {
- IRegion region= getVisibleRegion();
-
- int length= region.getLength();
- if (length == 0)
- return 0;
-
- IDocument doc= getDocument();
- int startLine= 0;
- int endLine= 0;
-
- int start= region.getOffset();
- try {
- startLine= doc.getLineOfOffset(start);
- } catch(BadLocationException ex) {
- // silently ignored
- }
- try {
- endLine= doc.getLineOfOffset(start+length);
- } catch(BadLocationException ex) {
- // silently ignored
- }
-
- return endLine-startLine+1;
- }
-
- public int getViewportLines() {
- StyledText te= getTextWidget();
- Rectangle clArea= te.getClientArea();
- if (!clArea.isEmpty())
- return clArea.height / te.getLineHeight();
- return 0;
- }
-
- public int getViewportHeight() {
- StyledText te= getTextWidget();
- Rectangle clArea= te.getClientArea();
- if (!clArea.isEmpty())
- return clArea.height;
- return 0;
- }
-
- /**
- * Returns lines
- */
- public int getDocumentRegionOffset() {
- int start= getVisibleRegion().getOffset();
- IDocument doc= getDocument();
- if (doc != null) {
- try {
- return doc.getLineOfOffset(start);
- } catch(BadLocationException ex) {
- // silently ignored
- }
- }
- return 0;
- }
-
- public int getVerticalScrollOffset() {
- StyledText st= getTextWidget();
- int lineHeight= st.getLineHeight();
- return getTopInset() - ((getDocumentRegionOffset()*lineHeight) + st.getTopPixel());
- }
-
- /**
- * Returns the start line and the number of lines which correspond to the given position.
- * Starting line number is 0 based.
- */
- public Point getLineRange(Position p, Point region) {
-
- IDocument doc= getDocument();
-
- if (p == null || doc == null) {
- region.x= 0;
- region.y= 0;
- return region;
- }
-
- int start= p.getOffset();
- int length= p.getLength();
-
- int startLine= 0;
- try {
- startLine= doc.getLineOfOffset(start);
- } catch (BadLocationException e) {
- // silently ignored
- }
-
- int lineCount= 0;
-
- if (length == 0) {
-// // if range length is 0 and if range starts a new line
-// try {
-// if (start == doc.getLineStartOffset(startLine)) {
-// lines--;
-// }
-// } catch (BadLocationException e) {
-// lines--;
-// }
-
- } else {
- int endLine= 0;
- try {
- endLine= doc.getLineOfOffset(start + length - 1); // why -1?
- } catch (BadLocationException e) {
- // silently ignored
- }
- lineCount= endLine-startLine+1;
- }
-
- region.x= startLine;
- region.y= lineCount;
- return region;
- }
-
- /**
- * Scroll TextPart to the given line.
- */
- public void vscroll(int line) {
-
- int srcViewSize= getLineCount();
- int srcExtentSize= getViewportLines();
-
- if (srcViewSize > srcExtentSize) {
-
- if (line < 0)
- line= 0;
-
- int cp= getTopIndex();
- if (cp != line)
- setTopIndex(line + getDocumentRegionOffset());
- }
- }
-
- public void addAction(String actionId, MergeViewerAction action) {
- fActions.put(actionId, action);
- }
-
- public MergeViewerAction getAction(String actionId) {
- MergeViewerAction action= (MergeViewerAction) fActions.get(actionId);
- if (action == null) {
- action= createAction(actionId);
- if (action == null)
- return null;
-
- if (action.isContentDependent())
- addTextListener(this);
- if (action.isSelectionDependent())
- addSelectionChangedListener(this);
-
- Utilities.initAction(action, fResourceBundle, "action." + actionId + "."); //$NON-NLS-1$ //$NON-NLS-2$
- fActions.put(actionId, action);
- }
- if (action.isEditableDependent() && !isEditable())
- return null;
- return action;
- }
-
- protected MergeViewerAction createAction(String actionId) {
- if (UNDO_ID.equals(actionId))
- return new TextOperationAction(UNDO, true, false, true);
- if (REDO_ID.equals(actionId))
- return new TextOperationAction(REDO, true, false, true);
- if (CUT_ID.equals(actionId))
- return new TextOperationAction(CUT, true, true, false);
- if (COPY_ID.equals(actionId))
- return new TextOperationAction(COPY, false, true, false);
- if (PASTE_ID.equals(actionId))
- return new TextOperationAction(PASTE, true, false, false);
- if (DELETE_ID.equals(actionId))
- return new TextOperationAction(DELETE, true, false, false);
- if (SELECT_ALL_ID.equals(actionId))
- return new TextOperationAction(SELECT_ALL, false, false, false);
- return null;
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- Iterator e= fActions.values().iterator();
- while (e.hasNext()) {
- MergeViewerAction action= (MergeViewerAction) e.next();
- if (action.isSelectionDependent())
- action.update();
- }
- }
-
- public void textChanged(TextEvent event) {
- Iterator e= fActions.values().iterator();
- while (e.hasNext()) {
- MergeViewerAction action= (MergeViewerAction) e.next();
- if (action.isContentDependent())
- action.update();
- }
- }
-
- /**
- * Allows the viewer to add menus and/or tools to the context menu.
- */
- public void menuAboutToShow(IMenuManager menu) {
-
- menu.add(new Separator("undo")); //$NON-NLS-1$
- addMenu(menu, UNDO_ID);
- addMenu(menu, REDO_ID);
-
- menu.add(new Separator("ccp")); //$NON-NLS-1$
- addMenu(menu, CUT_ID);
- addMenu(menu, COPY_ID);
- addMenu(menu, PASTE_ID);
- addMenu(menu, DELETE_ID);
- addMenu(menu, SELECT_ALL_ID);
-
- menu.add(new Separator("edit")); //$NON-NLS-1$
- menu.add(new Separator("find")); //$NON-NLS-1$
- //addMenu(menu, FIND_ID);
-
- menu.add(new Separator("save")); //$NON-NLS-1$
- if (fAddSaveAction)
- addMenu(menu, SAVE_ID);
-
- menu.add(new Separator("rest")); //$NON-NLS-1$
- }
-
- private void addMenu(IMenuManager menu, String actionId) {
- IAction action= getAction(actionId);
- if (action != null)
- menu.add(action);
- }
-
- protected void handleDispose() {
-
- removeTextListener(this);
- removeSelectionChangedListener(this);
-
- super.handleDispose();
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
deleted file mode 100644
index 590ab8696..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
+++ /dev/null
@@ -1,43 +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.compare.internal;
-
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.jface.action.Action;
-
-
-public abstract class MergeViewerAction extends Action implements IUpdate {
-
- private boolean fMutable;
- private boolean fSelection;
- private boolean fContent;
-
- public MergeViewerAction(boolean mutable, boolean selection, boolean content) {
- fMutable= mutable;
- fSelection= selection;
- fContent= content;
- }
-
- public boolean isSelectionDependent() {
- return fSelection;
- }
-
- public boolean isContentDependent() {
- return fContent;
- }
-
- public boolean isEditableDependent() {
- return fMutable;
- }
-
- public void update() {
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
deleted file mode 100644
index a21e6a4cd..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
+++ /dev/null
@@ -1,163 +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.compare.internal;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
-
-/**
- * Adapts any <code>ContentMergeViewer</code> to work on an <code>ICompareInput</code>
- * e.g. a <code>DiffNode</code>.
- */
-public class MergeViewerContentProvider implements IMergeViewerContentProvider {
-
- private CompareConfiguration fCompareConfiguration;
-
- public MergeViewerContentProvider(CompareConfiguration cc) {
- fCompareConfiguration= cc;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer v, Object o1, Object o2) {
- // we are not interested since we have no state
- }
-
- //---- ancestor
-
- public String getAncestorLabel(Object element) {
- return fCompareConfiguration.getAncestorLabel(element);
- }
-
- public Image getAncestorImage(Object element) {
- return fCompareConfiguration.getAncestorImage(element);
- }
-
- public Object getAncestorContent(Object element) {
- if (element instanceof ICompareInput)
- return ((ICompareInput) element).getAncestor();
- return null;
- }
-
- public boolean showAncestor(Object element) {
- if (element instanceof ICompareInput)
- return true; // fix for #45239: Show ancestor for incoming and outgoing changes
- //return (((ICompareInput)element).getKind() & Differencer.DIRECTION_MASK) == Differencer.CONFLICTING;
- return false;
- }
-
- //---- left
-
- public String getLeftLabel(Object element) {
- return fCompareConfiguration.getLeftLabel(element);
- }
-
- public Image getLeftImage(Object element) {
- return fCompareConfiguration.getLeftImage(element);
- }
-
- public Object getLeftContent(Object element) {
- if (element instanceof ICompareInput)
- return ((ICompareInput) element).getLeft();
- return null;
- }
-
- public boolean isLeftEditable(Object element) {
- if (element instanceof ICompareInput) {
- Object left= ((ICompareInput) element).getLeft();
- if (left == null) {
- IDiffElement parent= ((IDiffElement)element).getParent();
- if (parent instanceof ICompareInput)
- left= ((ICompareInput) parent).getLeft();
- }
- if (left instanceof IEditableContent)
- return ((IEditableContent)left).isEditable();
- }
- return false;
- }
-
- public void saveLeftContent(Object element, byte[] bytes) {
- if (element instanceof ICompareInput) {
- ICompareInput node= (ICompareInput) element;
- if (bytes != null) {
- ITypedElement left= node.getLeft();
- // #9869: problem if left is null (because no resource exists yet) nothing is done!
- if (left == null) {
- node.copy(false);
- left= node.getLeft();
- }
- if (left instanceof IEditableContent)
- ((IEditableContent)left).setContent(bytes);
- if (node instanceof ResourceCompareInput.MyDiffNode)
- ((ResourceCompareInput.MyDiffNode)node).fireChange();
- } else {
- node.copy(false);
- }
- }
- }
-
- //---- right
-
- public String getRightLabel(Object element) {
- return fCompareConfiguration.getRightLabel(element);
- }
-
- public Image getRightImage(Object element) {
- return fCompareConfiguration.getRightImage(element);
- }
-
- public Object getRightContent(Object element) {
- if (element instanceof ICompareInput)
- return ((ICompareInput) element).getRight();
- return null;
- }
-
- public boolean isRightEditable(Object element) {
- if (element instanceof ICompareInput) {
- Object right= ((ICompareInput) element).getRight();
- if (right == null) {
- IDiffContainer parent= ((IDiffElement)element).getParent();
- if (parent instanceof ICompareInput)
- right= ((ICompareInput) parent).getRight();
- }
- if (right instanceof IEditableContent)
- return ((IEditableContent)right).isEditable();
- }
- return false;
- }
-
- public void saveRightContent(Object element, byte[] bytes) {
- if (element instanceof ICompareInput) {
- ICompareInput node= (ICompareInput) element;
- if (bytes != null) {
- ITypedElement right= node.getRight();
- // #9869: problem if right is null (because no resource exists yet) nothing is done!
- if (right == null) {
- node.copy(true);
- right= node.getRight();
- }
- if (right instanceof IEditableContent)
- ((IEditableContent)right).setContent(bytes);
- if (node instanceof ResourceCompareInput.MyDiffNode)
- ((ResourceCompareInput.MyDiffNode)node).fireChange();
- } else {
- node.copy(true);
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java
deleted file mode 100644
index 495a8cf28..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.compare.CompareViewerPane;
-
-/**
- * Used whenever the input is null or no viewer can be found.
- */
-public class NullViewer extends AbstractViewer {
-
- private Control fDummy;
-
- public NullViewer(Composite parent) {
-
- fDummy= new Tree(parent, SWT.NULL);
-
- CompareViewerPane.clearToolBar(parent);
- }
-
- public Control getControl() {
- return fDummy;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
deleted file mode 100644
index 9fd741dad..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
+++ /dev/null
@@ -1,451 +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.compare.internal;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * An overlaying preference store.
- */
-public class OverlayPreferenceStore implements IPreferenceStore {
-
-
- public static final class TypeDescriptor {
- private TypeDescriptor() {
- }
- }
-
- public static final TypeDescriptor BOOLEAN= new TypeDescriptor();
- public static final TypeDescriptor DOUBLE= new TypeDescriptor();
- public static final TypeDescriptor FLOAT= new TypeDescriptor();
- public static final TypeDescriptor INT= new TypeDescriptor();
- public static final TypeDescriptor LONG= new TypeDescriptor();
- public static final TypeDescriptor STRING= new TypeDescriptor();
-
- public static class OverlayKey {
-
- TypeDescriptor fDescriptor;
- String fKey;
-
- public OverlayKey(TypeDescriptor descriptor, String key) {
- fDescriptor= descriptor;
- fKey= key;
- }
- }
-
- private class PropertyListener implements IPropertyChangeListener {
-
- /*
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- OverlayKey key= findOverlayKey(event.getProperty());
- if (key != null)
- propagateProperty(fParent, key, fStore);
- }
- }
-
-
- private IPreferenceStore fParent;
- private IPreferenceStore fStore;
- private OverlayKey[] fOverlayKeys;
-
- private PropertyListener fPropertyListener;
-
-
- public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
- fParent= parent;
- fOverlayKeys= overlayKeys;
- fStore= new PreferenceStore();
- }
-
- private OverlayKey findOverlayKey(String key) {
- for (int i= 0; i < fOverlayKeys.length; i++) {
- if (fOverlayKeys[i].fKey.equals(key))
- return fOverlayKeys[i];
- }
- return null;
- }
-
- private boolean covers(String key) {
- return (findOverlayKey(key) != null);
- }
-
- private void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
-
- if (orgin.isDefault(key.fKey)) {
- if (!target.isDefault(key.fKey))
- target.setToDefault(key.fKey);
- return;
- }
-
- TypeDescriptor d= key.fDescriptor;
- if (BOOLEAN == d) {
-
- boolean originValue= orgin.getBoolean(key.fKey);
- boolean targetValue= target.getBoolean(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (DOUBLE == d) {
-
- double originValue= orgin.getDouble(key.fKey);
- double targetValue= target.getDouble(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (FLOAT == d) {
-
- float originValue= orgin.getFloat(key.fKey);
- float targetValue= target.getFloat(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (INT == d) {
-
- int originValue= orgin.getInt(key.fKey);
- int targetValue= target.getInt(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (LONG == d) {
-
- long originValue= orgin.getLong(key.fKey);
- long targetValue= target.getLong(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (STRING == d) {
-
- String originValue= orgin.getString(key.fKey);
- String targetValue= target.getString(key.fKey);
- if (targetValue != null && originValue != null && !targetValue.equals(originValue))
- target.setValue(key.fKey, originValue);
-
- }
- }
-
- public void propagate() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- propagateProperty(fStore, fOverlayKeys[i], fParent);
- }
-
- private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
- TypeDescriptor d= key.fDescriptor;
- if (BOOLEAN == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, true);
- target.setValue(key.fKey, orgin.getBoolean(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
-
- } else if (DOUBLE == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0D);
- target.setValue(key.fKey, orgin.getDouble(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
-
- } else if (FLOAT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0F);
- target.setValue(key.fKey, orgin.getFloat(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
-
- } else if (INT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1);
- target.setValue(key.fKey, orgin.getInt(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
-
- } else if (LONG == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1L);
- target.setValue(key.fKey, orgin.getLong(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
-
- } else if (STRING == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, "1"); //$NON-NLS-1$
- target.setValue(key.fKey, orgin.getString(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
-
- }
- }
-
- public void load() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- loadProperty(fParent, fOverlayKeys[i], fStore, true);
- }
-
- public void loadDefaults() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- setToDefault(fOverlayKeys[i].fKey);
- }
-
- public void start() {
- if (fPropertyListener == null) {
- fPropertyListener= new PropertyListener();
- fParent.addPropertyChangeListener(fPropertyListener);
- }
- }
-
- public void stop() {
- if (fPropertyListener != null) {
- fParent.removePropertyChangeListener(fPropertyListener);
- fPropertyListener= null;
- }
- }
-
- /*
- * @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fStore.addPropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fStore.removePropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- fStore.firePropertyChangeEvent(name, oldValue, newValue);
- }
-
- /*
- * @see IPreferenceStore#contains(String)
- */
- public boolean contains(String name) {
- return fStore.contains(name);
- }
-
- /*
- * @see IPreferenceStore#getBoolean(String)
- */
- public boolean getBoolean(String name) {
- return fStore.getBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultBoolean(String)
- */
- public boolean getDefaultBoolean(String name) {
- return fStore.getDefaultBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultDouble(String)
- */
- public double getDefaultDouble(String name) {
- return fStore.getDefaultDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultFloat(String)
- */
- public float getDefaultFloat(String name) {
- return fStore.getDefaultFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultInt(String)
- */
- public int getDefaultInt(String name) {
- return fStore.getDefaultInt(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultLong(String)
- */
- public long getDefaultLong(String name) {
- return fStore.getDefaultLong(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultString(String)
- */
- public String getDefaultString(String name) {
- return fStore.getDefaultString(name);
- }
-
- /*
- * @see IPreferenceStore#getDouble(String)
- */
- public double getDouble(String name) {
- return fStore.getDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getFloat(String)
- */
- public float getFloat(String name) {
- return fStore.getFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getInt(String)
- */
- public int getInt(String name) {
- return fStore.getInt(name);
- }
-
- /*
- * @see IPreferenceStore#getLong(String)
- */
- public long getLong(String name) {
- return fStore.getLong(name);
- }
-
- /*
- * @see IPreferenceStore#getString(String)
- */
- public String getString(String name) {
- return fStore.getString(name);
- }
-
- /*
- * @see IPreferenceStore#isDefault(String)
- */
- public boolean isDefault(String name) {
- return fStore.isDefault(name);
- }
-
- /*
- * @see IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return fStore.needsSaving();
- }
-
- /*
- * @see IPreferenceStore#putValue(String, String)
- */
- public void putValue(String name, String value) {
- if (covers(name))
- fStore.putValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, double)
- */
- public void setDefault(String name, double value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, float)
- */
- public void setDefault(String name, float value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, int)
- */
- public void setDefault(String name, int value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, long)
- */
- public void setDefault(String name, long value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, String)
- */
- public void setDefault(String name, String value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, boolean)
- */
- public void setDefault(String name, boolean value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setToDefault(String)
- */
- public void setToDefault(String name) {
- fStore.setToDefault(name);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, double)
- */
- public void setValue(String name, double value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, float)
- */
- public void setValue(String name, float value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, int)
- */
- public void setValue(String name, int value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, long)
- */
- public void setValue(String name, long value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, String)
- */
- public void setValue(String name, String value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, boolean)
- */
- public void setValue(String name, boolean value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
deleted file mode 100644
index fdcc7bf68..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-
-public class ReplaceWithEditionAction extends EditionAction {
-
- public ReplaceWithEditionAction() {
- super(true, "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$
- fHelpContextId= ICompareContextIds.REPLACE_WITH_EDITION_DIALOG;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
deleted file mode 100644
index db582dff6..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
+++ /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
-###############################################################################
-
-# @(#)ReplaceWithEditionAction.properties
-#
-# Resources for ReplaceWithEditionAction.java
-
-title= Replace from Local History
-
-treeTitleFormat= Local History of ''{0}''
-dateIcon= obj16/day_obj.gif
-timeIcon= obj16/resource_obj.gif
-
-treeFormat= {0}
-workspaceTreeFormat= {0} (Workspace File)
-parseErrorFormat= {0} (Parse Error)
-
-editionLabel= Local History ({0})
-workspaceEditionLabel= Workspace File
-
-targetLabel= {0}
-
-todayFormat= Today ({0})
-yesterdayFormat= Yesterday ({0})
-dayFormat= {0}
-
-buttonLabel= Replace
-
-noLocalHistoryError= No local history available for selected resource.
-replaceError=Can''t replace resource (reason: {0}).
-
-taskName=Replacing \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
deleted file mode 100644
index 3fa6b07aa..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
+++ /dev/null
@@ -1,21 +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.compare.internal;
-
-
-public class ReplaceWithPreviousEditionAction extends EditionAction {
-
- public ReplaceWithPreviousEditionAction() {
- super(true,
- "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$
- fPrevious= true;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
deleted file mode 100644
index 423ba9711..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.DialogSettings;
-
-
-/**
- * Base class for resizable Dialogs with persistent window bounds.
- */
-public abstract class ResizableDialog extends Dialog {
-
- // dialog store id constants
- private final static String DIALOG_BOUNDS_KEY= "ResizableDialogBounds"; //$NON-NLS-1$
- private static final String X= "x"; //$NON-NLS-1$
- private static final String Y= "y"; //$NON-NLS-1$
- private static final String WIDTH= "width"; //$NON-NLS-1$
- private static final String HEIGHT= "height"; //$NON-NLS-1$
-
- protected ResourceBundle fBundle;
- private Rectangle fNewBounds;
- private IDialogSettings fSettings;
- private String fContextId;
-
-
- public ResizableDialog(Shell parent, ResourceBundle bundle) {
- super(parent);
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
-
- fBundle= bundle;
-
- fSettings= CompareUIPlugin.getDefault().getDialogSettings();
- }
-
- public void setHelpContextId(String contextId) {
- fContextId= contextId;
- }
-
- /*
- * @see org.eclipse.jface.window.Window#configureShell(Shell)
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- if (fContextId != null)
- WorkbenchHelp.setHelp(newShell, fContextId);
- }
-
- protected Point getInitialSize() {
-
- int width= 0;
- int height= 0;
-
- final Shell s= getShell();
- if (s != null) {
- s.addControlListener(
- new ControlListener() {
- public void controlMoved(ControlEvent arg0) {
- fNewBounds= s.getBounds();
- }
- public void controlResized(ControlEvent arg0) {
- fNewBounds= s.getBounds();
- }
- }
- );
- }
-
- IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY); //$NON-NLS-1$
- if (bounds == null) {
- if (fBundle != null) {
- width= Utilities.getInteger(fBundle, WIDTH, 0);
- height= Utilities.getInteger(fBundle, HEIGHT, 0);
- Shell shell= getParentShell();
- if (shell != null) {
- Point parentSize= shell.getSize();
- if (width <= 0)
- width= parentSize.x-300;
- if (height <= 0)
- height= parentSize.y-200;
- }
- } else {
- Shell shell= getParentShell();
- if (shell != null) {
- Point parentSize= shell.getSize();
- width= parentSize.x-100;
- height= parentSize.y-100;
- }
- }
- if (width < 700)
- width= 700;
- if (height < 500)
- height= 500;
- } else {
- try {
- width= bounds.getInt(WIDTH);
- } catch (NumberFormatException e) {
- width= 700;
- }
- try {
- height= bounds.getInt(HEIGHT);
- } catch (NumberFormatException e) {
- height= 500;
- }
- }
-
- return new Point(width, height);
- }
-
- protected Point getInitialLocation(Point initialSize) {
- Point loc= super.getInitialLocation(initialSize);
-
- IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY);
- if (bounds != null) {
- try {
- loc.x= bounds.getInt(X);
- } catch (NumberFormatException e) {
- }
- try {
- loc.y= bounds.getInt(Y);
- } catch (NumberFormatException e) {
- }
- }
- return loc;
- }
-
- public boolean close() {
- boolean closed= super.close();
- if (closed && fNewBounds != null)
- saveBounds(fNewBounds);
- return closed;
- }
-
- private void saveBounds(Rectangle bounds) {
- IDialogSettings dialogBounds= fSettings.getSection(DIALOG_BOUNDS_KEY);
- if (dialogBounds == null) {
- dialogBounds= new DialogSettings(DIALOG_BOUNDS_KEY);
- fSettings.addSection(dialogBounds);
- }
- dialogBounds.put(X, bounds.x);
- dialogBounds.put(Y, bounds.y);
- dialogBounds.put(WIDTH, bounds.width);
- dialogBounds.put(HEIGHT, bounds.height);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
deleted file mode 100644
index fc76172f1..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ /dev/null
@@ -1,375 +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.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * A two-way or three-way compare for arbitrary IResources.
- */
-class ResourceCompareInput extends CompareEditorInput {
-
- private static final boolean NORMALIZE_CASE= true;
-
- private boolean fThreeWay= false;
- private Object fRoot;
- private IStructureComparator fAncestor;
- private IStructureComparator fLeft;
- private IStructureComparator fRight;
- private IResource fAncestorResource;
- private IResource fLeftResource;
- private IResource fRightResource;
- private DiffTreeViewer fDiffViewer;
- private IAction fOpenAction;
-
- class MyDiffNode extends DiffNode {
-
- private boolean fDirty= false;
- private ITypedElement fLastId;
- private String fLastName;
-
-
- public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- super(parent, description, ancestor, left, right);
- }
- public void fireChange() {
- super.fireChange();
- setDirty(true);
- fDirty= true;
- if (fDiffViewer != null)
- fDiffViewer.refresh(this);
- }
- void clearDirty() {
- fDirty= false;
- }
- public String getName() {
- if (fLastName == null)
- fLastName= super.getName();
- if (fDirty)
- return '<' + fLastName + '>';
- return fLastName;
- }
-
- public ITypedElement getId() {
- ITypedElement id= super.getId();
- if (id == null)
- return fLastId;
- fLastId= id;
- return id;
- }
- }
-
- static class FilteredBufferedResourceNode extends BufferedResourceNode {
- FilteredBufferedResourceNode(IResource resource) {
- super(resource);
- }
- protected IStructureComparator createChild(IResource child) {
- String name= child.getName();
- if (CompareUIPlugin.filter(name, child instanceof IContainer, false))
- return null;
- return new FilteredBufferedResourceNode(child);
- }
- }
-
- /**
- * Creates an compare editor input for the given selection.
- */
- ResourceCompareInput(CompareConfiguration config) {
- super(config);
- }
-
- public Viewer createDiffViewer(Composite parent) {
- fDiffViewer= new DiffTreeViewer(parent, getCompareConfiguration()) {
- protected void fillContextMenu(IMenuManager manager) {
-
- if (fOpenAction == null) {
- fOpenAction= new Action() {
- public void run() {
- handleOpen(null);
- }
- };
- Utilities.initAction(fOpenAction, getBundle(), "action.CompareContents."); //$NON-NLS-1$
- }
-
- boolean enable= false;
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection)selection;
- if (ss.size() == 1) {
- Object element= ss.getFirstElement();
- if (element instanceof MyDiffNode) {
- ITypedElement te= ((MyDiffNode) element).getId();
- if (te != null)
- enable= !ITypedElement.FOLDER_TYPE.equals(te.getType());
- } else
- enable= true;
- }
- }
- fOpenAction.setEnabled(enable);
-
- manager.add(fOpenAction);
-
- super.fillContextMenu(manager);
- }
- };
- return fDiffViewer;
- }
-
- void setSelection(ISelection s) {
-
- IResource[] selection= Utilities.getResources(s);
-
- fThreeWay= selection.length == 3;
-
- fAncestorResource= null;
- fLeftResource= selection[0];
- fRightResource= selection[1];
- if (fThreeWay) {
- fLeftResource= selection[1];
- fRightResource= selection[2];
- }
-
- fAncestor= null;
- fLeft= getStructure(fLeftResource);
- fRight= getStructure(fRightResource);
-
- if (fThreeWay) {
- fAncestorResource= selection[0];
- fAncestor= getStructure(fAncestorResource);
- }
- }
-
- /**
- * Returns true if compare can be executed for the given selection.
- */
- public boolean isEnabled(ISelection s) {
-
- IResource[] selection= Utilities.getResources(s);
- if (selection.length < 2 || selection.length > 3)
- return false;
-
- fThreeWay= selection.length == 3;
-
- fLeftResource= selection[0];
- fRightResource= selection[1];
- if (fThreeWay) {
- fLeftResource= selection[1];
- fRightResource= selection[2];
- }
-
- if (!comparable(fLeftResource, fRightResource))
- return false;
-
- if (fThreeWay) {
- fAncestorResource= selection[0];
-
- if (!comparable(fLeftResource, fRightResource))
- return false;
- }
-
- return true;
- }
-
- /**
- * Initializes the images in the compare configuration.
- */
- void initializeCompareConfiguration() {
- CompareConfiguration cc= getCompareConfiguration();
- if (fLeftResource != null) {
- cc.setLeftLabel(buildLabel(fLeftResource));
- cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource));
- }
- if (fRightResource != null) {
- cc.setRightLabel(buildLabel(fRightResource));
- cc.setRightImage(CompareUIPlugin.getImage(fRightResource));
- }
- if (fThreeWay && fAncestorResource != null) {
- cc.setAncestorLabel(buildLabel(fAncestorResource));
- cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource));
- }
- }
-
- /**
- * Returns true if both resources are either structured or unstructured.
- */
- private boolean comparable(IResource c1, IResource c2) {
- return hasStructure(c1) == hasStructure(c2);
- }
-
- /**
- * Returns true if the given argument has a structure.
- */
- private boolean hasStructure(IResource input) {
-
- if (input instanceof IContainer)
- return true;
-
- if (input instanceof IFile) {
- IFile file= (IFile) input;
- String type= file.getFileExtension();
- if (type != null) {
- type= normalizeCase(type);
- return "JAR".equals(type) || "ZIP".equals(type); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- return false;
- }
-
- /**
- * Creates a <code>IStructureComparator</code> for the given input.
- * Returns <code>null</code> if no <code>IStructureComparator</code>
- * can be found for the <code>IResource</code>.
- */
- private IStructureComparator getStructure(IResource input) {
-
- if (input instanceof IContainer)
- return new FilteredBufferedResourceNode(input);
-
- if (input instanceof IFile) {
- IStructureComparator rn= new FilteredBufferedResourceNode(input);
- IFile file= (IFile) input;
- String type= normalizeCase(file.getFileExtension());
- if ("JAR".equals(type) || "ZIP".equals(type)) //$NON-NLS-2$ //$NON-NLS-1$
- return new ZipFileStructureCreator().getStructure(rn);
- return rn;
- }
- return null;
- }
-
- /**
- * Performs a two-way or three-way diff on the current selection.
- */
- public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException {
-
- try {
- // fix for PR 1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty
- fLeftResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- fRightResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- if (fThreeWay && fAncestorResource != null)
- fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- // end fix
-
- pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
-
- String leftLabel= fLeftResource.getName();
- String rightLabel= fRightResource.getName();
-
- String title;
- if (fThreeWay) {
- String format= Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$
- String ancestorLabel= fAncestorResource.getName();
- title= MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel});
- } else {
- String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$
- title= MessageFormat.format(format, new String[] {leftLabel, rightLabel});
- }
- setTitle(title);
-
- Differencer d= new Differencer() {
- protected Object visit(Object parent, int description, Object ancestor, Object left, Object right) {
- return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
- };
-
- fRoot= d.findDifferences(fThreeWay, pm, null, fAncestor, fLeft, fRight);
- return fRoot;
-
- } catch (CoreException ex) {
- throw new InvocationTargetException(ex);
- } finally {
- pm.done();
- }
- }
-
- public String getToolTipText() {
- if (fLeftResource != null && fRightResource != null) {
- String leftLabel= fLeftResource.getFullPath().makeRelative().toString();
- String rightLabel= fRightResource.getFullPath().makeRelative().toString();
- if (fThreeWay) {
- String format= Utilities.getString("ResourceCompare.threeWay.tooltip"); //$NON-NLS-1$
- String ancestorLabel= fAncestorResource.getFullPath().makeRelative().toString();
- return MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel});
- } else {
- String format= Utilities.getString("ResourceCompare.twoWay.tooltip"); //$NON-NLS-1$
- return MessageFormat.format(format, new String[] {leftLabel, rightLabel});
- }
- }
- // fall back
- return super.getToolTipText();
- }
-
- private String buildLabel(IResource r) {
- String n= r.getFullPath().toString();
- if (n.charAt(0) == IPath.SEPARATOR)
- return n.substring(1);
- return n;
- }
-
- public void saveChanges(IProgressMonitor pm) throws CoreException {
- super.saveChanges(pm);
- if (fRoot instanceof DiffNode) {
- try {
- commit(pm, (DiffNode) fRoot);
- } finally {
- if (fDiffViewer != null)
- fDiffViewer.refresh();
- setDirty(false);
- }
- }
- }
-
- /*
- * Recursively walks the diff tree and commits all changes.
- */
- private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException {
-
- if (node instanceof MyDiffNode)
- ((MyDiffNode)node).clearDirty();
-
- ITypedElement left= node.getLeft();
- if (left instanceof BufferedResourceNode)
- ((BufferedResourceNode) left).commit(pm);
-
- ITypedElement right= node.getRight();
- if (right instanceof BufferedResourceNode)
- ((BufferedResourceNode) right).commit(pm);
-
- IDiffElement[] children= node.getChildren();
- if (children != null) {
- for (int i= 0; i < children.length; i++) {
- IDiffElement element= children[i];
- if (element instanceof DiffNode)
- commit(pm, (DiffNode) element);
- }
- }
- }
-
- private static String normalizeCase(String s) {
- if (NORMALIZE_CASE && s != null)
- return s.toUpperCase();
- return s;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java
deleted file mode 100644
index 581527039..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.compare.*;
-
-/**
- * Toggles the <code>ICompareConfiguration.SHOW_PSEUDO_CONFLICTS</code> property of an
- * <code>ICompareConfiguration</code>.
- */
-public class ShowPseudoConflicts extends ChangePropertyAction {
-
- public ShowPseudoConflicts(ResourceBundle bundle, CompareConfiguration cc) {
- super(bundle, cc, "action.ShowPseudoConflicts.", CompareConfiguration.SHOW_PSEUDO_CONFLICTS); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
deleted file mode 100644
index a28339bfb..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.Document;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-
-public class SimpleTextViewer extends AbstractViewer {
-
- private SourceViewer fSourceViewer;
- private ICompareInput fInput;
-
-
- SimpleTextViewer(Composite parent) {
- fSourceViewer= new SourceViewer(parent, null, SWT.H_SCROLL + SWT.V_SCROLL);
- fSourceViewer.setEditable(false);
- }
-
- public Control getControl() {
- return fSourceViewer.getTextWidget();
- }
-
- public void setInput(Object input) {
- if (input instanceof IStreamContentAccessor) {
- fSourceViewer.setDocument(new Document(getString(input)));
- } else if (input instanceof ICompareInput) {
- fInput= (ICompareInput) input;
- ITypedElement left= fInput.getLeft();
- fSourceViewer.setDocument(new Document(getString(left)));
- }
- }
-
- public Object getInput() {
- return fInput;
- }
-
- private String getString(Object input) {
-
- if (input instanceof IStreamContentAccessor) {
- try {
- return Utilities.readString((IStreamContentAccessor) input);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
deleted file mode 100644
index 739b82f0e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-public class TabFolderLayout extends Layout {
-
- protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control [] children = composite.getChildren ();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
- }
-
- if (wHint != SWT.DEFAULT)
- maxWidth= wHint;
- if (hHint != SWT.DEFAULT)
- maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
- }
-
- protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java
deleted file mode 100644
index 1a5d1d8be..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.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.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
-
-/**
- * A factory object for the <code>TextMergeViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class TextMergeViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new TextMergeViewer(parent, mp);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java
deleted file mode 100644
index 66eaba9f8..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IViewerCreator;
-
-
-/**
- * A factory object for the <code>TextMergeViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class TextViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new SimpleTextViewer(parent);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java
deleted file mode 100644
index e8e70af13..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java
+++ /dev/null
@@ -1,385 +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.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * A modal dialog that displays progress during a long running operation.
- */
-public class TimeoutContext {
-
- private static class ModalContextThread extends Thread {
-
- private boolean fWorking;
- private IRunnableWithProgress fRunnable;
- private Throwable fThrowable;
- private IProgressMonitor fProgressMonitor;
- private boolean fContinueEventDispatching= true;
- private Display fDisplay;
-
- private ModalContextThread(IRunnableWithProgress operation, IProgressMonitor monitor) {
- super("TimeoutContext"); //$NON-NLS-1$
- fRunnable= operation;
- fProgressMonitor= monitor;
- }
-
- synchronized boolean timeout(Display display) {
- fDisplay= display;
- return fWorking;
- }
-
- public void run() {
- try {
- fWorking= true;
- if (fRunnable != null)
- fRunnable.run(fProgressMonitor);
- } catch (InvocationTargetException e) {
- fThrowable= e;
- } catch (InterruptedException e) {
- fThrowable= e;
- } catch (RuntimeException e) {
- fThrowable= e;
- } catch (ThreadDeath e) {
- // Make sure to propagate ThreadDeath, or threads will never fully terminate
- throw e;
- } catch (Error e) {
- fThrowable= e;
- } finally {
- fWorking= false;
-
- if (fDisplay != null) {
- // Make sure that all events in the asynchronous event queue
- // are dispatched.
- fDisplay.syncExec(
- new Runnable() {
- public void run() {
- // do nothing
- }
- }
- );
-
- // Stop event dispatching
- fContinueEventDispatching= false;
-
- // Force the event loop to return from sleep () so that
- // it stops event dispatching.
- fDisplay.asyncExec(null);
- }
- }
- }
-
- public void block() {
- while (fContinueEventDispatching)
- if (!fDisplay.readAndDispatch())
- fDisplay.sleep();
- }
- }
-
- static class ProgressMonitorDialog extends org.eclipse.jface.dialogs.Dialog {
-
- protected ProgressIndicator fProgressIndicator;
- protected Label fTaskLabel;
- protected Label fSubTaskLabel;
- protected Button fCancel;
- protected boolean fEnableCancelButton;
- private ProgressMonitor fProgressMonitor;
- private Cursor fArrowCursor;
- private Cursor fWaitCursor;
- private Shell fParentShell;
-
- private ProgressMonitorDialog(Shell parent, boolean cancelable, ProgressMonitor pm) {
- super(parent);
- fProgressMonitor= pm;
- fParentShell= parent;
- fEnableCancelButton= cancelable;
- this.setBlockOnOpen(false);
- setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL); // no close button
- }
-
- public boolean close() {
- if (fCancel != null && !fCancel.isDisposed())
- fCancel.setCursor(null);
- Shell shell= getShell();
- if (shell != null && !shell.isDisposed())
- shell.setCursor(null);
- if (fArrowCursor != null)
- fArrowCursor.dispose();
- if (fWaitCursor != null)
- fWaitCursor.dispose();
- fArrowCursor= null;
- fWaitCursor= null;
- return super.close();
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(JFaceResources.getString("ProgressMonitorDialog.title")); //$NON-NLS-1$
- if (fWaitCursor == null)
- fWaitCursor= new Cursor(shell.getDisplay(),SWT.CURSOR_WAIT);
- shell.setCursor(fWaitCursor);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- // cancel button
- fCancel= createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
- if(fArrowCursor == null)
- fArrowCursor= new Cursor(fCancel.getDisplay(),SWT.CURSOR_ARROW);
- fCancel.setCursor(fArrowCursor);
- fCancel.addListener(SWT.Selection,
- new Listener() {
- public void handleEvent(Event e) {
- if (fCancel != null && !fCancel.isDisposed())
- fCancel.setEnabled(false);
- fProgressMonitor.setCanceled(true);
- }
- }
- );
- fCancel.setEnabled(fEnableCancelButton);
- }
-
- protected Control createDialogArea(Composite parent) {
-
- Composite c= (Composite)super.createDialogArea(parent);
- ((GridLayout)c.getLayout()).numColumns= 2;
-
- // icon
- Label iconLabel= new Label(c, SWT.LEFT);
- GridData gd= new GridData();
- iconLabel.setLayoutData(gd);
- iconLabel.setFont(parent.getFont());
- Image i= JFaceResources.getImageRegistry().get(org.eclipse.jface.dialogs.Dialog.DLG_IMG_INFO);
- if (i != null)
- iconLabel.setImage(i);
- else
- iconLabel.setText(JFaceResources.getString("Image_not_found")); //$NON-NLS-1$
-
- // label on right hand side of icon
- fTaskLabel= new Label(c, SWT.LEFT | SWT.WRAP);
- fTaskLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fTaskLabel.setFont(parent.getFont());
-
- // progress indicator
- fProgressIndicator= new ProgressIndicator(c);
- gd= new GridData();
- gd.heightHint= 15;
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.horizontalSpan= 2;
- fProgressIndicator.setLayoutData(gd);
-
- // label showing current task
- fSubTaskLabel= new Label(c, SWT.LEFT | SWT.WRAP);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint= 35;
- gd.horizontalSpan= 2;
- fSubTaskLabel.setLayoutData(gd);
- fSubTaskLabel.setFont(parent.getFont());
-
- // update with values fProgressMonitor
- String s= fProgressMonitor.fTask;
- if (s == null)
- s= ""; //$NON-NLS-1$
- fTaskLabel.setText(s);
-
- if (fProgressMonitor.fMaxWork == IProgressMonitor.UNKNOWN)
- fProgressIndicator.beginAnimatedTask();
- else
- fProgressIndicator.beginTask(fProgressMonitor.fMaxWork);
-
- if (fProgressMonitor.fSubTask != null)
- fSubTaskLabel.setText(fProgressMonitor.fSubTask);
- fProgressIndicator.worked(fProgressMonitor.fWorked);
-
- fProgressMonitor.activate(this);
- applyDialogFont(c);
- return c;
- }
-
- void beginTask(final String name, final int totalWork) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- fTaskLabel.setText(name);
-
- if (fProgressIndicator != null && fProgressIndicator.isDisposed()) {
- if (totalWork == IProgressMonitor.UNKNOWN)
- fProgressIndicator.beginAnimatedTask();
- else
- fProgressIndicator.beginTask(totalWork);
- }
- }
- }
- );
- }
-
- void setTaskName(final String name) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- if (fTaskLabel != null && fTaskLabel.isDisposed())
- fTaskLabel.setText(name);
- }
- }
- );
- }
-
- void setSubTaskName(final String name) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- String n= (name == null) ? "" : name; //$NON-NLS-1$
- if (fSubTaskLabel != null && !fSubTaskLabel.isDisposed())
- fSubTaskLabel.setText(n);
- }
- }
- );
- }
-
- void done() {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- if (fProgressIndicator != null && !fProgressIndicator.isDisposed()) {
- fProgressIndicator.sendRemainingWork();
- fProgressIndicator.done();
- }
- }
- }
- );
- }
-
- void worked(final double work) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- if (fProgressIndicator != null && !fProgressIndicator.isDisposed())
- fProgressIndicator.worked(work);
- }
- }
- );
- }
-
- protected Point getInitialSize() {
- return getShell().computeSize(450, SWT.DEFAULT);
- }
- }
-
- private static class ProgressMonitor implements IProgressMonitor {
-
- private int fMaxWork;
- private String fTask;
- private String fSubTask;
- private int fWorked;
- private ProgressMonitorDialog fProgressMonitorDialog;
- private boolean fIsCanceled;
-
- public void beginTask(String name, int totalWork) {
-
- fTask= name;
- fMaxWork= totalWork;
- fWorked= 0;
-
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.beginTask(name, totalWork);
- }
-
- void activate(ProgressMonitorDialog dialog) {
- fProgressMonitorDialog= dialog;
- }
-
- public void done() {
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.done();
- }
-
- public void setTaskName(String name) {
- fTask= name;
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.setTaskName(name);
- }
-
- public boolean isCanceled() {
- return fIsCanceled;
- }
-
- public void setCanceled(boolean b) {
- fIsCanceled= b;
- }
-
- public void subTask(String name) {
- fSubTask= name;
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.setSubTaskName(name);
- }
-
- public void worked(int work) {
- if (fProgressMonitorDialog != null)
- internalWorked(work);
- else
- fWorked+= work;
- }
-
- public void internalWorked(double work) {
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.worked(work);
- }
- }
-
- public static void run(boolean cancelable, int timeout, Shell parent, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
-
- Display display= parent.getDisplay();
-
- ProgressMonitor pm= new ProgressMonitor();
-
- ModalContextThread t= new ModalContextThread(runnable, pm);
- t.start(); // start the long running operation
-
- // wait until long operations terminates or timeout
- try {
- t.join(timeout);
- } catch (InterruptedException e) {
- // silently ignored
- }
-
- if (t.timeout(display)) { // timeout
- ProgressMonitorDialog dialog= new ProgressMonitorDialog(parent, cancelable, pm);
- dialog.open();
- t.block();
- dialog.close();
- }
-
- Throwable throwable= t.fThrowable;
- if (throwable != null) {
- if (throwable instanceof InvocationTargetException) {
- throw (InvocationTargetException) throwable;
- } else if (throwable instanceof InterruptedException) {
- throw (InterruptedException) throwable;
- } else if (throwable instanceof OperationCanceledException) {
- throw new InterruptedException(throwable.getMessage());
- } else {
- throw new InvocationTargetException(throwable);
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java
deleted file mode 100644
index e1aca48c9..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java
+++ /dev/null
@@ -1,176 +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.compare.internal;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.compare.rangedifferencer.IRangeComparator;
-import org.eclipse.compare.contentmergeviewer.ITokenComparator;
-
-/**
- * Implements the <code>ITokenComparator</code> interface for words (or tokens)
- * in a string.
- * A <code>TokenComparator</code> is used as the input for the <code>RangeDifferencer</code>
- * engine to perform a token oriented compare on strings.
- */
-public class TokenComparator implements ITokenComparator {
-
- private boolean fShouldEscape= true;
- private String fText;
- private int fCount;
- private int[] fStarts;
- private int[] fLengths;
-
- /**
- * Creates a <code>TokenComparator</code> for the given string.
- *
- * @param string the string that is split into token
- */
- public TokenComparator(String text) {
-
- Assert.isNotNull(text);
-
- fText= text;
-
- int length= fText.length();
- fStarts= new int[length]; // pessimistic assumption!
- fLengths= new int[length];
- fCount= 0;
-
- char lastCategory= 0; // 0: no category
- for (int i= 0; i < length; i++) {
- char c= fText.charAt(i);
-
- char category= '?'; // unspecified category
- if (Character.isWhitespace(c))
- category= ' '; // white space category
- else if (Character.isDigit(c))
- category= '0'; // digits
- else if (Character.isLetter(c))
- category= 'a'; // letters
-
- if (category != lastCategory) {
- // start a new token
- fStarts[fCount++]= i;
- lastCategory= category;
- }
- fLengths[fCount-1]++;
- }
- }
-
- /**
- * Creates a <code>TokenComparator</code> for the given string.
- *
- * @param string the string that is split into token
- * @param shouldEscape
- */
- public TokenComparator(String s, boolean shouldEscape) {
- this(s);
- fShouldEscape= shouldEscape;
- }
-
- /**
- * Returns the number of token in the string.
- *
- * @return number of token in the string
- */
- public int getRangeCount() {
- return fCount;
- }
-
- /* (non Javadoc)
- * see ITokenComparator.getTokenStart
- */
- public int getTokenStart(int index) {
- if (index < fCount)
- return fStarts[index];
- return fText.length();
- }
-
- /* (non Javadoc)
- * see ITokenComparator.getTokenLength
- */
- public int getTokenLength(int index) {
- if (index < fCount)
- return fLengths[index];
- return 0;
- }
-
- /**
- * Returns <code>true</code> if a token given by the first index
- * matches a token specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the number of the token within this range comparator
- * @param other the range comparator to compare this with
- * @param otherIndex the number of the token within the other comparator
- * @return <code>true</code> if the token are equal
- */
- public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) {
- if (other != null && getClass() == other.getClass()) {
- TokenComparator tc= (TokenComparator) other;
- int thisLen= getTokenLength(thisIndex);
- int otherLen= tc.getTokenLength(otherIndex);
- if (thisLen == otherLen)
- return fText.regionMatches(false, getTokenStart(thisIndex), tc.fText, tc.getTokenStart(otherIndex), thisLen);
- }
- return false;
- }
-
- /**
- * Aborts the comparison if the number of tokens is too large.
- *
- * @return <code>true</code> to abort a token comparison
- */
- public boolean skipRangeComparison(int length, int max, IRangeComparator other) {
-
- if (!fShouldEscape)
- return false;
-
- if (getRangeCount() < 50 || other.getRangeCount() < 50)
- return false;
-
- if (max < 100)
- return false;
-
- if (length < 100)
- return false;
-
- if (max > 800)
- return true;
-
- if (length < max / 4)
- return false;
-
- return true;
- }
-
-// public static void main(String args[]) {
-// //String in= "private static boolean isWhitespace(char c) {";
-// //String in= "for (int j= 0; j < l-1; j++) {";
-// String in= "for do i= 123; i++";
-// TokenComparator tc= new TokenComparator(in, false);
-//
-// System.out.println("n: " + tc.getRangeCount());
-// System.out.println(in);
-//
-// int p= 0;
-// for (int i= 0; i < tc.getRangeCount(); i++) {
-// int l= tc.getTokenLength(i);
-// System.out.print("<");
-//
-// for (int j= 0; j < l-1; j++)
-// System.out.print(" ");
-// }
-// System.out.println();
-//
-// //System.out.println("extract: <" + tc.extract(16, 1) + ">");
-// }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
deleted file mode 100644
index 0f986513e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ /dev/null
@@ -1,581 +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.compare.internal;
-
-import java.io.*;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.ui.*;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IEncodedStreamContentAccessor;
-import org.eclipse.compare.IStreamContentAccessor;
-
-/**
- * Convenience and utility methods.
- */
-public class Utilities {
-
- public static void registerAction(IKeyBindingService kbs, IAction a, String id) {
- if (kbs != null) {
- a.setActionDefinitionId(id);
- kbs.registerAction(a);
- }
- }
-
- public static IWorkbenchPartSite findSite(Control c) {
- while (c != null && !c.isDisposed()) {
- Object data= c.getData();
- if (data instanceof IWorkbenchPart)
- return ((IWorkbenchPart)data).getSite();
- c= c.getParent();
- }
- return null;
- }
-
- public static IActionBars findActionBars(Control c) {
- while (c != null && !c.isDisposed()) {
- Object data= c.getData();
- if (data instanceof CompareEditor)
- return ((CompareEditor)data).getActionBars();
-
- // PR 1GDVZV7: ITPVCM:WIN98 - CTRL + C does not work in Java source compare
- if (data instanceof IViewPart)
- return ((IViewPart)data).getViewSite().getActionBars();
- // end PR 1GDVZV7
-
- c= c.getParent();
- }
- return null;
- }
-
- public static void setEnableComposite(Composite composite, boolean enable) {
- Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++)
- children[i].setEnabled(enable);
- }
-
- public static boolean getBoolean(CompareConfiguration cc, String key, boolean dflt) {
- if (cc != null) {
- Object value= cc.getProperty(key);
- if (value instanceof Boolean)
- return ((Boolean) value).booleanValue();
- }
- return dflt;
- }
-
- public static void firePropertyChange(ListenerList ll, Object source, String property, Object old, Object newValue) {
- if (ll != null) {
- PropertyChangeEvent event= null;
- Object[] listeners= ll.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- IPropertyChangeListener l= (IPropertyChangeListener) listeners[i];
- if (event == null)
- event= new PropertyChangeEvent(source, property, old, newValue);
- l.propertyChange(event);
- }
- }
- }
-
- public static boolean okToUse(Widget widget) {
- return widget != null && !widget.isDisposed();
- }
-
- private static ArrayList internalGetResources(ISelection selection, Class type) {
-
- ArrayList tmp= new ArrayList();
-
- if (selection instanceof IStructuredSelection) {
-
- Object[] s= ((IStructuredSelection)selection).toArray();
-
- for (int i= 0; i < s.length; i++) {
-
- IResource resource= null;
-
- Object o= s[i];
- if (type.isInstance(o)) {
- resource= (IResource) o;
-
- } else if (o instanceof IAdaptable) {
- IAdaptable a= (IAdaptable) o;
- Object adapter= a.getAdapter(IResource.class);
- if (type.isInstance(adapter))
- resource= (IResource) adapter;
- }
-
- if (resource != null && resource.isAccessible())
- tmp.add(resource);
- }
- }
-
- return tmp;
- }
-
- /**
- * Convenience method: extract all accessible <code>IResources</code> from given selection.
- * Never returns null.
- */
- public static IResource[] getResources(ISelection selection) {
- ArrayList tmp= internalGetResources(selection, IResource.class);
- return (IResource[]) tmp.toArray(new IResource[tmp.size()]);
- }
-
- /**
- * Convenience method: extract all accessible <code>IFiles</code> from given selection.
- * Never returns null.
- */
- public static IFile[] getFiles(ISelection selection) {
- ArrayList tmp= internalGetResources(selection, IFile.class);
- return (IFile[]) tmp.toArray(new IFile[tmp.size()]);
- }
-
- 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) {
- // silently ignored
- }
- }
- try {
- bos.close();
- } catch (IOException x) {
- // silently ignored
- }
- }
-
- return bos.toByteArray();
- }
-
- public static String getIconPath(Display display) {
- return "icons/full/"; //$NON-NLS-1$
- }
-
- /**
- * Initialize the given Action from a ResourceBundle.
- */
- public static void initAction(IAction a, ResourceBundle bundle, 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;
- }
-
- a.setText(getString(bundle, labelKey, labelKey));
- a.setToolTipText(getString(bundle, tooltipKey, null));
- a.setDescription(getString(bundle, descriptionKey, null));
-
- String relPath= getString(bundle, imageKey, null);
- if (relPath != null && 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= CompareUIPlugin.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87)
- if (id != null)
- a.setDisabledImageDescriptor(id);
- id= CompareUIPlugin.getImageDescriptor(cPath);
- if (id != null)
- a.setHoverImageDescriptor(id);
- id= CompareUIPlugin.getImageDescriptor(ePath);
- if (id != null)
- a.setImageDescriptor(id);
- }
- }
-
- public static void initToggleAction(IAction a, ResourceBundle bundle, String prefix, boolean checked) {
-
- String tooltip= null;
- if (checked)
- tooltip= getString(bundle, prefix + "tooltip.checked", null); //$NON-NLS-1$
- else
- tooltip= getString(bundle, prefix + "tooltip.unchecked", null); //$NON-NLS-1$
- if (tooltip == null)
- tooltip= getString(bundle, prefix + "tooltip", null); //$NON-NLS-1$
-
- if (tooltip != null)
- a.setToolTipText(tooltip);
-
- String description= null;
- if (checked)
- description= getString(bundle, prefix + "description.checked", null); //$NON-NLS-1$
- else
- description= getString(bundle, prefix + "description.unchecked", null); //$NON-NLS-1$
- if (description == null)
- description= getString(bundle, prefix + "description", null); //$NON-NLS-1$
-
- if (description != null)
- a.setDescription(description);
-
- }
-
- public static String getString(ResourceBundle bundle, String key, String dfltValue) {
-
- if (bundle != null) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException x) {
- // NeedWork
- }
- }
- return dfltValue;
- }
-
- public static String getFormattedString(ResourceBundle bundle, String key, String arg) {
-
- if (bundle != null) {
- try {
- return MessageFormat.format(bundle.getString(key), new String[] { arg });
- } catch (MissingResourceException x) {
- // NeedWork
- }
- }
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
-
- public static String getString(String key) {
- try {
- return CompareUIPlugin.getResourceBundle().getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static String getFormattedString(String key, String arg) {
- try{
- return MessageFormat.format(CompareUIPlugin.getResourceBundle().getString(key), new String[] { arg });
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static String getString(ResourceBundle bundle, String key) {
- return getString(bundle, key, key);
- }
-
- public static int getInteger(ResourceBundle bundle, String key, int dfltValue) {
-
- if (bundle != null) {
- try {
- String s= bundle.getString(key);
- if (s != null)
- return Integer.parseInt(s);
- } catch (NumberFormatException x) {
- // NeedWork
- } catch (MissingResourceException x) {
- // NeedWork
- }
- }
- return dfltValue;
- }
-
- /**
- * Answers <code>true</code> if the given selection contains resources that don't
- * have overlapping paths and <code>false</code> otherwise.
- */
- /*
- public static boolean isSelectionNonOverlapping() throws TeamException {
- IResource[] resources = getSelectedResources();
- // allow operation for non-overlapping resource selections
- if(resources.length>0) {
- List validPaths = new ArrayList(2);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
-
- // only allow cvs resources to be selected
- if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
- return false;
- }
-
- // check if this resource overlaps other selections
- IPath resourceFullPath = resource.getFullPath();
- if(!validPaths.isEmpty()) {
- for (Iterator it = validPaths.iterator(); it.hasNext();) {
- IPath path = (IPath) it.next();
- if(path.isPrefixOf(resourceFullPath) ||
- resourceFullPath.isPrefixOf(path)) {
- return false;
- }
- }
- }
- validPaths.add(resourceFullPath);
-
- // ensure that resources are managed
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if(cvsResource.isFolder()) {
- if( ! ((ICVSFolder)cvsResource).isCVSFolder()) return false;
- } else {
- if( ! cvsResource.isManaged()) return false;
- }
- }
- return true;
- }
- return false;
- }
- */
-
- /* validate edit utilities */
-
- /**
- * Status constant indicating that an validateEdit call has changed the
- * content of a file on disk.
- */
- private static final int VALIDATE_EDIT_PROBLEM= 10004;
-
-
- /**
- * Makes the given resources committable. Committable means that all
- * resources are writeable and that the content of the resources hasn't
- * changed by calling <code>validateEdit</code> for a given file on
- * <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param shell the Shell passed to <code>validateEdit</code> as a context
- * @return returns <code>true</code> if all resources are committable, <code>false</code> otherwise
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- public static boolean validateResource(IResource resource, Shell shell, String title) {
- return validateResources(new IResource[] { resource }, shell, title);
- }
-
- /**
- * Makes the given resources committable. Committable means that all
- * resources are writeable and that the content of the resources hasn't
- * changed by calling <code>validateEdit</code> for a given file on
- * <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param shell the Shell passed to <code>validateEdit</code> as a context
- * @return returns <code>true</code> if all resources are committable, <code>false</code> otherwise
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- public static boolean validateResources(List resources, Shell shell, String title) {
- IResource r[]= (IResource[]) resources.toArray(new IResource[resources.size()]);
- return validateResources(r, shell, title);
- }
-
- /**
- * Makes the given resources committable. Committable means that all
- * resources are writeable and that the content of the resources hasn't
- * changed by calling <code>validateEdit</code> for a given file on
- * <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param shell the Shell passed to <code>validateEdit</code> as a context
- * @return returns <code>true</code> if all resources are committable, <code>false</code> otherwise
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- public static boolean validateResources(IResource[] resources, Shell shell, String title) {
-
- // get all readonly files
- List readOnlyFiles= getReadonlyFiles(resources);
- if (readOnlyFiles.size() == 0)
- return true;
-
- // get timestamps of readonly files before validateEdit
- Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
-
- IFile[] files= (IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]);
- IStatus status= ResourcesPlugin.getWorkspace().validateEdit(files, shell);
- if (! status.isOK()) {
- String message= getString("ValidateEdit.error.unable_to_perform"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, message, status); //$NON-NLS-1$
- return false;
- }
-
- IStatus modified= null;
- Map newTimeStamps= createModificationStampMap(readOnlyFiles);
- for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
- IFile file= (IFile) iter.next();
- if (file.isReadOnly()) {
- IStatus entry= new Status(IStatus.ERROR,
- CompareUIPlugin.getPluginId(),
- VALIDATE_EDIT_PROBLEM,
- getFormattedString("ValidateEdit.error.stillReadonly", file.getFullPath().toString()), //$NON-NLS-1$
- null);
- modified= addStatus(modified, entry);
- } else if (! oldTimeStamps.get(file).equals(newTimeStamps.get(file))) {
- IStatus entry= new Status(IStatus.ERROR,
- CompareUIPlugin.getPluginId(),
- VALIDATE_EDIT_PROBLEM,
- getFormattedString("ValidateEdit.error.fileModified", file.getFullPath().toString()), //$NON-NLS-1$
- null);
- modified= addStatus(modified, entry);
- }
- }
- if (modified != null) {
- String message= getString("ValidateEdit.error.unable_to_perform"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, message, modified);
- return false;
- }
- return true;
- }
-
- private static List getReadonlyFiles(IResource[] resources) {
- List readOnlyFiles= new ArrayList();
- for (int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (resource.getType() == IResource.FILE && resource.isReadOnly())
- readOnlyFiles.add(resource);
- }
- return readOnlyFiles;
- }
-
- private static Map createModificationStampMap(List files) {
- Map map= new HashMap();
- for (Iterator iter= files.iterator(); iter.hasNext(); ) {
- IFile file= (IFile)iter.next();
- map.put(file, new Long(file.getModificationStamp()));
- }
- return map;
- }
-
- private static IStatus addStatus(IStatus status, IStatus entry) {
-
- if (status == null)
- return entry;
-
- if (status.isMultiStatus()) {
- ((MultiStatus)status).add(entry);
- return status;
- }
-
- MultiStatus result= new MultiStatus(CompareUIPlugin.getPluginId(),
- VALIDATE_EDIT_PROBLEM,
- getString("ValidateEdit.error.unable_to_perform"), null); //$NON-NLS-1$
- result.add(status);
- result.add(entry);
- return result;
- }
-
- // encoding
-
- /**
- * Returns null if an error occurred.
- */
- public static String readString(InputStream is, String encoding) {
- if (is == null)
- return null;
- BufferedReader reader= null;
- try {
- StringBuffer buffer= new StringBuffer();
- char[] part= new char[2048];
- int read= 0;
- reader= new BufferedReader(new InputStreamReader(is, encoding));
-
- while ((read= reader.read(part)) != -1)
- buffer.append(part, 0, read);
-
- return buffer.toString();
-
- } catch (IOException ex) {
- // NeedWork
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- return null;
- }
-
- public static String getCharset(IResource resource) {
- if (resource instanceof IEncodedStreamContentAccessor) {
- try {
- return ((IEncodedStreamContentAccessor)resource).getCharset();
- } catch (CoreException ex) {
- // fall through
- }
- }
- return ResourcesPlugin.getEncoding();
- }
-
- public static byte[] getBytes(String s, String encoding) {
- byte[] bytes= null;
- if (s != null) {
- try {
- bytes= s.getBytes(encoding); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- bytes= s.getBytes();
- }
- }
- return bytes;
- }
-
- public static String readString(IStreamContentAccessor sa) throws CoreException {
- InputStream is= sa.getContents();
- String encoding= null;
- if (sa instanceof IEncodedStreamContentAccessor)
- encoding= ((IEncodedStreamContentAccessor)sa).getCharset();
- if (encoding == null)
- encoding= ResourcesPlugin.getEncoding();
- return Utilities.readString(is, encoding);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
deleted file mode 100644
index 3d5dbcc6f..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.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.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.compare.*;
-
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Creates <code>Viewer</code>s from an <code>IConfigurationElement</code>.
- */
-public class ViewerDescriptor implements IViewerDescriptor {
-
- private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private final static String EXTENSIONS_ATTRIBUTE= "extensions"; //$NON-NLS-1$
-
- private IConfigurationElement fConfiguration;
- private IViewerCreator fViewerCreator;
- private Class fViewerClass;
-
- public ViewerDescriptor(IConfigurationElement config) {
- fConfiguration= config;
- }
-
- public Viewer createViewer(Viewer currentViewer, Composite parent, CompareConfiguration mp) {
-
- if (currentViewer != null && currentViewer.getClass() == fViewerClass) {
- //System.out.println("reused viewer: " + currentViewer.getClass().getName());
- return currentViewer;
- }
-
- if (fViewerCreator == null) {
- try {
- fViewerCreator= (IViewerCreator) fConfiguration.createExecutableExtension(CLASS_ATTRIBUTE);
- } catch (CoreException e) {
- // NeedWork
- }
- }
-
- if (fViewerCreator != null) {
- Viewer viewer= fViewerCreator.createViewer(parent, mp);
- if (viewer != null)
- fViewerClass= viewer.getClass();
- return viewer;
- }
-
- return null;
- }
-
- public String getExtension() {
- return fConfiguration.getAttribute(EXTENSIONS_ATTRIBUTE);
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java
deleted file mode 100644
index 27e580c5e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java
+++ /dev/null
@@ -1,17 +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.compare.internal;
-
-
-public class ViewerSwitchingCancelled extends Error {
-
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java
deleted file mode 100644
index 08b7b9556..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.ui.IEditorPart;
-
-import org.eclipse.compare.internal.*;
-
-
-public class CompareWithPatchAction extends BaseCompareAction {
-
- static class PatchWizardDialog extends WizardDialog {
-
- PatchWizardDialog(Shell parent, IWizard wizard) {
- super(parent, wizard);
-
- setShellStyle(getShellStyle() | SWT.RESIZE);
- setMinimumPageSize(700, 500);
- }
- }
-
- protected boolean isEnabled(ISelection selection) {
- return Utilities.getResources(selection).length == 1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.internal.BaseCompareAction#run(org.eclipse.jface.viewers.ISelection)
- */
- protected void run(ISelection selection) {
- PatchWizard wizard= new PatchWizard(selection);
-
- if (areAllEditorsSaved()) {
- PatchWizardDialog dialog= new PatchWizardDialog(CompareUIPlugin.getShell(), wizard);
- dialog.open();
- }
- }
-
- private boolean areAllEditorsSaved(){
- if (CompareUIPlugin.getDirtyEditors().length == 0)
- return true;
- if (! saveAllDirtyEditors())
- return false;
- Shell shell= CompareUIPlugin.getShell();
- try {
- // Save isn't cancelable.
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceDescription description= workspace.getDescription();
- boolean autoBuild= description.isAutoBuilding();
- description.setAutoBuilding(false);
- workspace.setDescription(description);
- try {
- new ProgressMonitorDialog(shell).run(false, false, createRunnable());
- } finally {
- description.setAutoBuilding(autoBuild);
- workspace.setDescription(description);
- }
- return true;
- } catch (InvocationTargetException e) {
- ExceptionHandler.handle(e, shell, PatchMessages.getString("PatchAction.ExceptionTitle"), PatchMessages.getString("Exception")); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- } catch (CoreException e) {
- ExceptionHandler.handle(e, shell, PatchMessages.getString("PatchAction.ExceptionTitle"), PatchMessages.getString("Exception")); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- } catch (InterruptedException e) {
- Assert.isTrue(false); // Can't happen. Operation isn't cancelable.
- return false;
- }
- }
-
- private IRunnableWithProgress createRunnable() {
- return new IRunnableWithProgress() {
- public void run(IProgressMonitor pm) {
- IEditorPart[] editorsToSave= CompareUIPlugin.getDirtyEditors();
- pm.beginTask(PatchMessages.getString("PatchAction.SavingDirtyEditorsTask"), editorsToSave.length); //$NON-NLS-1$
- for (int i= 0; i < editorsToSave.length; i++) {
- editorsToSave[i].doSave(new SubProgressMonitor(pm, 1));
- pm.worked(1);
- }
- pm.done();
- }
- };
- }
-
- private boolean saveAllDirtyEditors() {
- if (ComparePreferencePage.getSaveAllEditors()) //must save everything
- return true;
- ListDialog dialog= new ListDialog(CompareUIPlugin.getShell()) {
- protected Control createDialogArea(Composite parent) {
- Composite result= (Composite) super.createDialogArea(parent);
- final Button check= new Button(result, SWT.CHECK);
- check.setText(PatchMessages.getString("PatchAction.AlwaysSaveQuestion")); //$NON-NLS-1$
- check.setSelection(ComparePreferencePage.getSaveAllEditors());
- check.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ComparePreferencePage.setSaveAllEditors(check.getSelection());
- }
- }
- );
- applyDialogFont(result);
- return result;
- }
- };
- dialog.setTitle(PatchMessages.getString("PatchAction.SaveAllQuestion")); //$NON-NLS-1$
- dialog.setAddCancelButton(true);
- dialog.setLabelProvider(createDialogLabelProvider());
- dialog.setMessage(PatchMessages.getString("PatchAction.SaveAllDescription")); //$NON-NLS-1$
- dialog.setContentProvider(new ListContentProvider());
- dialog.setInput(Arrays.asList(CompareUIPlugin.getDirtyEditors()));
- return dialog.open() == Window.OK;
- }
-
- private ILabelProvider createDialogLabelProvider() {
- return new LabelProvider() {
- public Image getImage(Object element) {
- return ((IEditorPart) element).getTitleImage();
- }
- public String getText(Object element) {
- return ((IEditorPart) element).getTitle();
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java
deleted file mode 100644
index ad5899bbe..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-
-
-/* package */ class Diff {
-
- IPath fOldPath, fNewPath;
- long fOldDate, fNewDate; // if 0: no file
- List fHunks= new ArrayList();
- boolean fMatches= false;
- private boolean fIsEnabled2= true;
- String fRejected;
-
-
- /* package */ Diff(IPath oldPath, long oldDate, IPath newPath, long newDate) {
- fOldPath= oldPath;
- fOldDate= oldPath == null ? 0 : oldDate;
- fNewPath= newPath;
- fNewDate= newPath == null ? 0 : newDate;
- }
-
- boolean isEnabled() {
- return fIsEnabled2;
- }
-
- void setEnabled(boolean b) {
- fIsEnabled2= b;
- }
-
- void reverse() {
- IPath tp= fOldPath;
- fOldPath= fNewPath;
- fNewPath= tp;
-
- long t= fOldDate;
- fOldDate= fNewDate;
- fNewDate= t;
-
- Iterator iter= fHunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- hunk.reverse();
- }
- }
-
- Hunk[] getHunks() {
- return (Hunk[]) fHunks.toArray(new Hunk[fHunks.size()]);
- }
-
- IPath getPath() {
- if (fOldPath != null)
- return fOldPath;
- return fNewPath;
- }
-
- void finish() {
- if (fHunks.size() == 1) {
- Hunk h= (Hunk) fHunks.get(0);
- if (h.fNewLength == 0) {
- fNewDate= 0;
- fNewPath= fOldPath;
- }
- }
- }
-
- /* package */ void add(Hunk hunk) {
- fHunks.add(hunk);
- }
-
- /* package */ int getType() {
- if (fOldDate == 0)
- return Differencer.ADDITION;
- if (fNewDate == 0)
- return Differencer.DELETION;
- return Differencer.CHANGE;
- }
-
- /* package */ String getDescription(int strip) {
- IPath path= fOldPath;
- if (fOldDate == 0)
- path= fNewPath;
- if (strip > 0 && strip < path.segmentCount())
- path= path.removeFirstSegments(strip);
- return path.toOSString();
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java
deleted file mode 100644
index 9efd347da..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.util.List;
-
-/**
- * A Hunk describes a range of changed lines and some context lines.
- */
-/* package */ class Hunk {
-
- Diff fParent;
- int fOldStart, fOldLength;
- int fNewStart, fNewLength;
- String[] fLines;
- boolean fMatches= false;
- private boolean fIsEnabled= true;
-
-
- /* package */ Hunk(Diff parent, int[] oldRange, int[] newRange, List lines) {
-
- fParent= parent;
- if (fParent != null)
- fParent.add(this);
-
- if (oldRange[0] > 0)
- fOldStart= oldRange[0]-1; // line number start at 0!
- else
- fOldStart= 0;
- fOldLength= oldRange[1];
- if (newRange[0] > 0)
- fNewStart= newRange[0]-1; // line number start at 0!
- else
- fNewStart= 0;
- fNewLength= newRange[1];
-
- fLines= (String[]) lines.toArray(new String[lines.size()]);
- }
-
- boolean isEnabled() {
- return fIsEnabled;
- }
-
- void setEnabled(boolean enable) {
- fIsEnabled= enable;
- }
-
- void reverse() {
- int t= fOldStart;
- fOldStart= fNewStart;
- fNewStart= t;
-
- t= fOldLength;
- fOldLength= fNewLength;
- fNewLength= t;
-
- for (int i= 0; i < fLines.length; i++) {
- String line= fLines[i];
- char c= line.charAt(0);
- switch (c) {
- case '+':
- fLines[i]= '-' + line.substring(1);
- break;
- case '-':
- fLines[i]= '+' + line.substring(1);
- break;
- default:
- break;
- }
- }
- }
-
- /**
- * Returns the contents of this hunk.
- * Each line starts with a control character. Their meaning is as follows:
- * <ul>
- * <li>
- * '+': add the line
- * <li>
- * '-': delete the line
- * <li>
- * ' ': no change, context line
- * </ul>
- */
- String getContent() {
- StringBuffer sb= new StringBuffer();
- for (int i= 0; i < fLines.length; i++) {
- String line= fLines[i];
- sb.append(line.substring(0, Patcher.length(line)));
- sb.append('\n');
- }
- return sb.toString();
- }
-
- /**
- * Returns a descriptive String for this hunk.
- * It is in the form old_start,old_length -> new_start,new_length.
- */
- String getDescription() {
- StringBuffer sb= new StringBuffer();
- sb.append(Integer.toString(fOldStart));
- sb.append(',');
- sb.append(Integer.toString(fOldLength));
- sb.append(" -> "); //$NON-NLS-1$
- sb.append(Integer.toString(fNewStart));
- sb.append(',');
- sb.append(Integer.toString(fNewLength));
- return sb.toString();
- }
-
- String getRejectedDescription() {
- StringBuffer sb= new StringBuffer();
- sb.append("@@ -"); //$NON-NLS-1$
- sb.append(Integer.toString(fOldStart));
- sb.append(',');
- sb.append(Integer.toString(fOldLength));
- sb.append(" +"); //$NON-NLS-1$
- sb.append(Integer.toString(fNewStart));
- sb.append(',');
- sb.append(Integer.toString(fNewLength));
- sb.append(" @@"); //$NON-NLS-1$
- return sb.toString();
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
deleted file mode 100644
index 1aaaf2a75..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
+++ /dev/null
@@ -1,524 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.text.MessageFormat;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.model.*;
-
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-
-/* package */ class InputPatchPage extends WizardPage {
-
- // constants
- protected static final int SIZING_TEXT_FIELD_WIDTH= 250;
- protected static final int COMBO_HISTORY_LENGTH= 5;
-
- // dialog store id constants
- private final static String PAGE_NAME= "PatchWizardPage1"; //$NON-NLS-1$
- private final static String STORE_PATCH_FILES_ID= PAGE_NAME + ".PATCH_FILES"; //$NON-NLS-1$
- private final static String STORE_USE_CLIPBOARD_ID= PAGE_NAME + ".USE_CLIPBOARD"; //$NON-NLS-1$
-
- private boolean fShowError= false;
-
- // SWT widgets
- private Button fUseClipboardButton;
- private Combo fPatchFileNameField;
- private Button fPatchFileBrowseButton;
- private Button fUsePatchFileButton;
- private Group fPatchFileGroup;
- private CheckboxTreeViewer fPatchTargets;
- private PatchWizard fPatchWizard;
-
-
- InputPatchPage(PatchWizard pw) {
- super("InputPatchPage", PatchMessages.getString("InputPatchPage.title"), null); //$NON-NLS-1$ //$NON-NLS-2$
- fPatchWizard= pw;
- setMessage(PatchMessages.getString("InputPatchPage.message")); //$NON-NLS-1$
- }
-
- /**
- * Get a path from the supplied text widget.
- * @return org.eclipse.core.runtime.IPath
- */
- protected IPath getPathFromText(Text textField) {
- return (new Path(textField.getText())).makeAbsolute();
- }
-
- /* package */ String getPatchName() {
- if (getUseClipboard())
- return PatchMessages.getString("InputPatchPage.Clipboard"); //$NON-NLS-1$
- return getPatchFilePath();
- }
-
- public void createControl(Composite parent) {
-
- Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(/* GridData.VERTICAL_ALIGN_FILL | */ GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- Label l= new Label(composite, SWT.NONE); // a spacer
- l.setText(PatchMessages.getString("InputPatchPage.SelectInput")); //$NON-NLS-1$
- buildInputGroup(composite);
-
- new Label(composite, SWT.NONE); // a spacer
-
- buildPatchFileGroup(composite);
-
- restoreWidgetValues();
-
- updateWidgetEnablements();
- //updatePageCompletion();
-
- Dialog.applyDialogFont(composite);
- WorkbenchHelp.setHelp(composite, ICompareContextIds.PATCH_INPUT_WIZARD_PAGE);
- }
-
- /* (non-JavaDoc)
- * Method declared in IWizardPage.
- */
- public IWizardPage getNextPage() {
-
- Patcher patcher= ((PatchWizard) getWizard()).getPatcher();
-
- String source;
- // Create a reader for the input
- Reader reader= null;
- if (getUseClipboard()) {
- Control c= getControl();
- if (c != null) {
- Clipboard clipboard= new Clipboard(c.getDisplay());
- Object o= clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- if (o instanceof String)
- reader= new StringReader((String)o);
- }
- source= PatchMessages.getString("InputPatchPage.Clipboard.title"); //$NON-NLS-1$
- } else {
- String patchFilePath= getPatchFilePath();
- if (patchFilePath != null) {
- try {
- reader= new FileReader(patchFilePath);
- } catch (FileNotFoundException ex) {
- MessageDialog.openError(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), //$NON-NLS-1$
- PatchMessages.getString("InputPatchPage.PatchFileNotFound.message")); //$NON-NLS-1$
- }
- }
- source= PatchMessages.getString("InputPatchPage.PatchFile.title"); //$NON-NLS-1$
- }
-
- // parse the input
- if (reader != null) {
- try {
- patcher.parse(new BufferedReader(reader));
- } catch (IOException ex) {
- MessageDialog.openError(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), //$NON-NLS-1$
- PatchMessages.getString("InputPatchPage.ParseError.message")); //$NON-NLS-1$
- }
-
- try {
- reader.close();
- } catch (IOException x) {
- // silently ignored
- }
- }
-
- Diff[] diffs= patcher.getDiffs();
- if (diffs == null || diffs.length == 0) {
- String format= PatchMessages.getString("InputPatchPage.NoDiffsFound.format"); //$NON-NLS-1$
- String message= MessageFormat.format(format, new String[] { source });
- MessageDialog.openInformation(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), message); //$NON-NLS-1$
- return this;
- }
-
- // if selected target is file ensure that patch file
- // contains only a patch for a single file
- IResource target= fPatchWizard.getTarget();
- if (target instanceof IFile && diffs.length > 1) {
- String format= PatchMessages.getString("InputPatchPage.SingleFileError.format"); //$NON-NLS-1$
- String message= MessageFormat.format(format, new String[] { source });
- MessageDialog.openInformation(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), message); //$NON-NLS-1$
- return this;
- }
-
- // guess prefix count
- int guess= 0; // guessPrefix(diffs);
- patcher.setStripPrefixSegments(guess);
-
- return super.getNextPage();
- }
-
- /* (non-JavaDoc)
- * Method declared in IWizardPage.
- */
- public boolean canFlipToNextPage() {
- // we can't call getNextPage to determine if flipping is allowed since computing
- // the next page is quite expensive. So we say yes if the page is complete.
- return isPageComplete();
- }
-
- private void setEnablePatchFile(boolean enable) {
- fPatchFileNameField.setEnabled(enable);
- fPatchFileBrowseButton.setEnabled(enable);
- }
-
- /**
- * Create the group for selecting the patch file
- */
- private void buildPatchFileGroup(Composite parent) {
-
- fPatchFileGroup= new Group(parent, SWT.NONE);
- fPatchFileGroup.setText(PatchMessages.getString("InputPatchPage.SelectPatch.title")); //$NON-NLS-1$
- GridLayout layout= new GridLayout();
- layout.numColumns= 3;
- fPatchFileGroup.setLayout(layout);
- fPatchFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // 1st row
- fUsePatchFileButton= new Button(fPatchFileGroup, SWT.RADIO);
- fUsePatchFileButton.setText(PatchMessages.getString("InputPatchPage.FileButton.text")); //$NON-NLS-1$
-
- fPatchFileNameField= new Combo(fPatchFileGroup, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- //gd.horizontalIndent= 8;
- gd.widthHint= SIZING_TEXT_FIELD_WIDTH;
- fPatchFileNameField.setLayoutData(gd);
-
- fPatchFileBrowseButton= new Button(fPatchFileGroup, SWT.PUSH);
- fPatchFileBrowseButton.setText(PatchMessages.getString("InputPatchPage.ChooseFileButton.text")); //$NON-NLS-1$
- fPatchFileBrowseButton.setLayoutData(new GridData());
-
- // 2nd row
- fUseClipboardButton= new Button(fPatchFileGroup, SWT.RADIO);
- fUseClipboardButton.setText(PatchMessages.getString("InputPatchPage.UseClipboardButton.text")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan= 2;
- fUseClipboardButton.setLayoutData(gd);
-
-
- // Add listeners
- fUsePatchFileButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fShowError= true;
- setEnablePatchFile(!getUseClipboard());
- updateWidgetEnablements();
- }
- }
- );
- fPatchFileNameField.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setSourceName(fPatchFileNameField.getText());
- updateWidgetEnablements();
- }
- }
- );
- fPatchFileNameField.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- fShowError= true;
- updateWidgetEnablements();
- }
- }
- );
- fPatchFileBrowseButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handlePatchFileBrowseButtonPressed();
- updateWidgetEnablements();
- }
- }
- );
-
- //fPatchFileNameField.setFocus();
- }
-
- private void buildInputGroup(Composite parent) {
-
- PatchWizard pw= (PatchWizard) getWizard();
- IResource target= pw.getTarget();
- IWorkspace workspace= target.getWorkspace();
- IWorkspaceRoot root= workspace.getRoot();
-
- Tree tree= new Tree(parent, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint= 200;
- tree.setLayoutData(gd);
-
- fPatchTargets= new CheckboxTreeViewer(tree);
- fPatchTargets.setLabelProvider(new WorkbenchLabelProvider());
- fPatchTargets.setContentProvider(new WorkbenchContentProvider());
- fPatchTargets.setSorter(new WorkbenchViewerSorter());
- fPatchTargets.setInput(root);
- if (target != null) {
- fPatchTargets.expandToLevel(target, 0);
- fPatchTargets.setSelection(new StructuredSelection(target));
- }
-
- // register listeners
- fPatchTargets.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fPatchWizard.setTargets(Utilities.getResources(event.getSelection()));
- updateWidgetEnablements();
- }
- }
- );
- }
-
- /**
- * Updates the enable state of this page's controls.
- */
- private void updateWidgetEnablements() {
-
- String error= null;
-
- ISelection selection= fPatchTargets.getSelection();
- boolean anySelected= selection != null && !selection.isEmpty();
- if (!anySelected)
- error= PatchMessages.getString("InputPatchPage.NothingSelected.message"); //$NON-NLS-1$
-
- boolean gotPatch= false;
- if (getUseClipboard()) {
- Control c= getControl();
- if (c != null) {
- Clipboard clipboard= new Clipboard(c.getDisplay());
- Object o= clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- if (o instanceof String) {
- String s= ((String) o).trim();
- if (s.length() > 0)
- gotPatch= true;
- else
- error= PatchMessages.getString("InputPatchPage.ClipboardIsEmpty.message"); //$NON-NLS-1$
- } else
- error= PatchMessages.getString("InputPatchPage.NoTextInClipboard.message"); //$NON-NLS-1$
- } else
- error= PatchMessages.getString("InputPatchPage.CouldNotReadClipboard.message"); //$NON-NLS-1$
- } else {
- String path= fPatchFileNameField.getText();
- if (path != null && path.length() > 0) {
- File file= new File(path);
- gotPatch= file.exists() && file.isFile() && file.length() > 0;
- if (!gotPatch)
- error= PatchMessages.getString("InputPatchPage.CannotLocatePatch.message") + path; //$NON-NLS-1$
- } else {
- error= PatchMessages.getString("InputPatchPage.NoFileName.message"); //$NON-NLS-1$
- }
- }
-
- setPageComplete(anySelected && gotPatch);
- if (fShowError)
- setErrorMessage(error);
- }
-
- protected void handlePatchFileBrowseButtonPressed() {
- FileDialog dialog= new FileDialog(getShell(), SWT.NONE);
- dialog.setText(PatchMessages.getString("InputPatchPage.SelectPatchFileDialog.title")); //$NON-NLS-1$
- dialog.setFilterPath(getPatchFilePath());
- String res= dialog.open();
- if (res == null)
- return;
-
- String patchFilePath= dialog.getFileName();
- IPath filterPath= new Path(dialog.getFilterPath());
- IPath path= filterPath.append(patchFilePath).makeAbsolute();
- patchFilePath= path.toOSString();
- //fDialogSettings.put(IUIConstants.DIALOGSTORE_LASTEXTJAR, filterPath.toOSString());
-
- fPatchFileNameField.setText(patchFilePath);
- //setSourceName(patchFilePath);
- }
-
- /**
- * Sets the source name of the import to be the supplied path.
- * Adds the name of the path to the list of items in the
- * source combo and selects it.
- *
- * @param path the path to be added
- */
- protected void setSourceName(String path) {
-
- if (path.length() > 0) {
-
- String[] currentItems= fPatchFileNameField.getItems();
- int selectionIndex= -1;
- for (int i= 0; i < currentItems.length; i++)
- if (currentItems[i].equals(path))
- selectionIndex= i;
-
- if (selectionIndex < 0) { // not found in history
- int oldLength= currentItems.length;
- String[] newItems= new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength]= path;
- fPatchFileNameField.setItems(newItems);
- selectionIndex= oldLength;
- }
- fPatchFileNameField.select(selectionIndex);
-
- //resetSelection();
- }
- }
-
- /**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If false is returned then the wizard will
- * not close.
- *
- * @return boolean
- */
- public boolean finish() {
-// if (!ensureSourceIsValid())
-// return false;
-
- saveWidgetValues();
-
-// Iterator resourcesEnum = getSelectedResources().iterator();
-// List fileSystemObjects = new ArrayList();
-// while (resourcesEnum.hasNext()) {
-// fileSystemObjects.add(
-// ((FileSystemElement) resourcesEnum.next()).getFileSystemObject());
-// }
-//
-// if (fileSystemObjects.size() > 0)
-// return importResources(fileSystemObjects);
-//
-// MessageDialog
-// .openInformation(
-// getContainer().getShell(),
-// DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
-// DataTransferMessages.getString("FileImport.noneSelected")); //$NON-NLS-1$
-//
-// return false;
-
- return true;
- }
-
- /**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
- private void restoreWidgetValues() {
-
- boolean useClipboard= false;
-
- IDialogSettings settings= getDialogSettings();
- if (settings != null) {
-
- useClipboard= settings.getBoolean(STORE_USE_CLIPBOARD_ID);
-
- // set filenames history
- String[] sourceNames= settings.getArray(STORE_PATCH_FILES_ID);
- if (sourceNames != null)
- for (int i= 0; i < sourceNames.length; i++)
- if (sourceNames[i] != null && sourceNames[i].length() > 0)
- fPatchFileNameField.add(sourceNames[i]);
-
- // set patch file path
- String patchFilePath= settings.get(STORE_PATCH_FILES_ID);
- if (patchFilePath != null)
- setSourceName(patchFilePath);
- }
-
- // set 'Use Clipboard' radio buttons
- setUseClipboard(useClipboard);
- }
-
- /**
- * Since Finish was pressed, write widget values to the dialog store so that they
- * will persist into the next invocation of this wizard page
- */
- void saveWidgetValues() {
- IDialogSettings settings= getDialogSettings();
- if (settings != null) {
-
- settings.put(STORE_USE_CLIPBOARD_ID, getUseClipboard());
- settings.put(STORE_PATCH_FILES_ID, getPatchFilePath());
-
- // update source names history
- String[] sourceNames= settings.getArray(STORE_PATCH_FILES_ID);
- if (sourceNames == null)
- sourceNames= new String[0];
-
- sourceNames= addToHistory(sourceNames, getPatchFilePath());
- settings.put(STORE_PATCH_FILES_ID, sourceNames);
- }
- }
-
- // static helpers
-
- private void setUseClipboard(boolean useClipboard) {
- if (useClipboard)
- fUseClipboardButton.setSelection(true);
- else
- fUsePatchFileButton.setSelection(true);
- setEnablePatchFile(!useClipboard);
- }
-
- private boolean getUseClipboard() {
- if (fUseClipboardButton != null)
- return fUseClipboardButton.getSelection();
- return false;
- }
-
- private String getPatchFilePath() {
- if (fPatchFileNameField != null)
- return fPatchFileNameField.getText();
- return ""; //$NON-NLS-1$
- }
-
- /**
- * 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>COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- protected static String[] addToHistory(String[] history, String newEntry) {
- java.util.ArrayList l= new java.util.ArrayList(java.util.Arrays.asList(history));
-
- l.remove(newEntry);
- l.add(0,newEntry);
-
- // since only one new item was added, we can be over the limit
- // by at most one item
- if (l.size() > COMBO_HISTORY_LENGTH)
- l.remove(COMBO_HISTORY_LENGTH);
-
- return (String[]) l.toArray(new String[l.size()]);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
deleted file mode 100644
index d52929878..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-/* package */ class LineReader {
-
- private boolean fHaveChar= false;
- private int fLastChar;
- private boolean fSawEOF= false;
- private BufferedReader fReader;
- private boolean fIgnoreSingleCR= false;
-
-
- /* package */ LineReader(BufferedReader reader) {
- fReader= reader;
- Assert.isNotNull(reader);
- }
-
- void ignoreSingleCR() {
- fIgnoreSingleCR= true;
- }
-
- /**
- * Reads a line of text. A line is considered to be terminated by any one
- * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
- * followed immediately by a linefeed.
- * @return A string containing the contents of the line including
- * the line-termination characters, or <code>null</code> if the end of the
- * stream has been reached
- * @exception IOException If an I/O error occurs
- */
- /* package */ String readLine() throws IOException {
- StringBuffer sb= null;
-
- while (!fSawEOF) {
- int c= readChar();
- if (c == -1) {
- fSawEOF= true;
- break;
- }
- if (sb == null)
- sb= new StringBuffer();
- sb.append((char)c);
- if (c == '\n')
- break;
- if (c == '\r') {
- c= readChar();
- if (c == -1) {
- fSawEOF= true;
- break; // EOF
- }
- if (c != '\n') {
- if (fIgnoreSingleCR) {
- sb.append((char)c);
- continue;
- } else {
- fHaveChar= true;
- fLastChar= c;
- }
- } else
- sb.append((char)c);
- break;
- }
- }
-
- if (sb != null)
- return sb.toString();
- return null;
- }
-
- /* package */ void close() {
- try {
- fReader.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
-
- /* package */ List readLines() {
- try {
- List lines= new ArrayList();
- String line;
- while ((line= readLine()) != null)
- lines.add(line);
- return lines;
- } catch (IOException ex) {
- // NeedWork
- //System.out.println("error while reading file: " + fileName + "(" + ex + ")");
- } finally {
- close();
- }
- return null;
- }
- /**
- * Returns the number of characters in the given string without
- * counting a trailing line separator.
- */
- /* package */ int lineContentLength(String line) {
- if (line == null)
- return 0;
- int length= line.length();
- for (int i= length-1; i >= 0; i--) {
- char c= line.charAt(i);
- if (c =='\n' || c == '\r')
- length--;
- else
- break;
- }
- return length;
- }
-
- //---- private
-
- private int readChar() throws IOException {
- if (fHaveChar) {
- fHaveChar= false;
- return fLastChar;
- }
- return fReader.read();
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
deleted file mode 100644
index 7b1b0a702..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-public class PatchErrorDialog {
-
- private PatchErrorDialog() {
- // no instance.
- }
-
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java
deleted file mode 100644
index fc7520bc8..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class PatchMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.compare.internal.patch.PatchMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private PatchMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties
deleted file mode 100644
index 14f0bf2d3..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties
+++ /dev/null
@@ -1,90 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-#
-# 'Compare with Patch' Action
-#
-PatchAction.ExceptionTitle=Saving Resources
-PatchAction.Exception=Unexpected exception. See log for details
-PatchAction.SavingDirtyEditorsTask=Saving dirty editors
-PatchAction.AlwaysSaveQuestion=&Always save all modified resources automatically prior to patching
-PatchAction.SaveAllQuestion=Save all modified resources
-PatchAction.SaveAllDescription=All modified resources have to be saved before this operation.\nClick 'OK' to confirm or click 'Cancel'.
-
-#
-# PatchWizard
-#
-PatchWizard.title=Apply Patch
-PatchWizard.unexpectedException.message= Unexpected exception while applying the patch. See log for a detailed error description.
-
-#
-# InputPatchPage
-#
-InputPatchPage.title= Patch Input Specification
-InputPatchPage.message= Define the resource to patch and the patch to apply
-InputPatchPage.Clipboard=Clipboard
-InputPatchPage.SelectInput=Select a single file or folder to patch:
-InputPatchPage.PatchErrorDialog.title=Patch Error
-InputPatchPage.PatchErrorDialog=Patch Error
-InputPatchPage.SelectPatch.title=Select Patch
-InputPatchPage.FileButton.text=Fil&e
-InputPatchPage.ChooseFileButton.text=&Browse...
-InputPatchPage.UseClipboardButton.text=&Clipboard
-InputPatchPage.NothingSelected.message=Select a file or folder to be patched
-InputPatchPage.ClipboardIsEmpty.message=Clipboard is empty
-InputPatchPage.NoTextInClipboard.message=Clipboard does not contain text
-InputPatchPage.CouldNotReadClipboard.message=Couldn't retrieve clipboard contents
-InputPatchPage.CannotLocatePatch.message=Can't locate patch file:
-InputPatchPage.NoFileName.message=No file name
-InputPatchPage.SelectPatchFileDialog.title=Select Patch File
-InputPatchPage.PatchFileNotFound.message=Patch file not found.
-InputPatchPage.ParseError.message=Error while parsing patch
-InputPatchPage.Clipboard.title=Clipboard
-InputPatchPage.PatchFile.title=Patch file
-InputPatchPage.NoDiffsFound.format={0} does not contain valid patch.
-InputPatchPage.SingleFileError.format={0} contains multiple patches. You cannot apply them to a single file.
-
-#
-# PreviewPatchPage
-#
-PreviewPatchPage.title= Verify Patch
-PreviewPatchPage.message= The tree shows the contents of the patch.\nA checked item indicates that a patch can be applied successfully. To remove an item, clear its checkbox.
-PreviewPatchPage.Left.title= Original
-PreviewPatchPage.Right.title= Result
-PreviewPatchPage.PatchOptions.title=Patch Options
-PreviewPatchPage.IgnoreSegments.text=&Ignore leading path name segments:
-PreviewPatchPage.ReversePatch.text=&Reverse patch
-PreviewPatchPage.FuzzFactor.text=&Maximum fuzz factor:
-PreviewPatchPage.FuzzFactor.tooltip=Allow context to shift this number of lines from the original place
-PreviewPatchPage.IgnoreWhitespace.text=Ignore &white space
-PreviewPatchPage.NoName.text=no name
-PreviewPatchPage.FileExists.error=(file already exists)
-PreviewPatchPage.FileDoesNotExist.error=(file doesn't exist)
-PreviewPatchPage.NoMatch.error=(no match)
-PreviewPatchPage.FileIsReadOnly.error=(file is read only)
-PreviewPatchPage.GuessFuzz.text= &Guess
-PreviewPatchPage.GuessFuzzProgress.text= Guessing Fuzz Factor...
-PreviewPatchPage.GuessFuzzProgress.format= {0} (hunk #{1})
-
-#
-# Patcher
-#
-Patcher.ErrorDialog.title=title
-Patcher.DeleteError.message=Error while deleting resource
-Patcher.UpdateError.message=Error while updating resource
-Patcher.RefreshError.message=Error while refreshing from local
-Patcher.Marker.message=Rejected patch
-Patcher.Task.message=Patching
-
-#
-# PatchCompareInput
-#
-PatchCompareInput.RightTitle.format= Patch: {0}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
deleted file mode 100644
index 1ad13ef1d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.Wizard;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.compare.internal.*;
-
-
-/* package */ class PatchWizard extends Wizard {
-
- // dialog store id constants
- private final static String DIALOG_SETTINGS_KEY= "PatchWizard"; //$NON-NLS-1$
-
- private boolean fHasNewDialogSettings;
-
- private InputPatchPage fPatchWizardPage;
-
- private Patcher fPatcher;
- private IResource fTarget;
-
-
- /**
- * Creates a wizard for applying a patch file to the workspace.
- */
- /* package */ PatchWizard(ISelection selection) {
-
- setDefaultPageImageDescriptor(CompareUIPlugin.getImageDescriptor("wizban/applypatch_wizban.gif")); //$NON-NLS-1$
- setWindowTitle(PatchMessages.getString("PatchWizard.title")); //$NON-NLS-1$
-
- setTargets(Utilities.getResources(selection));
-
- fPatcher= new Patcher();
-
- IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY); //$NON-NLS-1$
- if (section == null)
- fHasNewDialogSettings= true;
- else {
- fHasNewDialogSettings= false;
- setDialogSettings(section);
- }
- }
-
- Patcher getPatcher() {
- return fPatcher;
- }
-
- IResource getTarget() {
- return fTarget;
- }
-
- void setTargets(IResource[] targets) {
- if (targets != null && targets.length > 0)
- fTarget= targets[0]; // right now we can only deal with a single selection
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- super.addPages();
-
- addPage(fPatchWizardPage= new InputPatchPage(this));
- addPage(new PreviewPatchPage(this));
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean needsProgressMonitor() {
- return true;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
-
- fPatcher.setName(fPatchWizardPage.getPatchName());
-
- try {
- WorkspaceModifyOperation op= new WorkspaceModifyOperation(fTarget.getProject()) {
- protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- fPatcher.applyAll(getTarget(), monitor, getShell(), PatchMessages.getString("PatchWizard.title")); //$NON-NLS-1$
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- getContainer().run(true, false, op);
-
- } catch (InvocationTargetException e) {
- ExceptionHandler.handle(e,
- PatchMessages.getString("PatchWizard.title"), //$NON-NLS-1$
- PatchMessages.getString("PatchWizard.unexpectedException.message")); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // cannot happen
- // NeedWork: use assert!
- }
-
- // Save the dialog settings
- if (fHasNewDialogSettings) {
- IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY);
- section= workbenchSettings.addNewSection(DIALOG_SETTINGS_KEY);
- setDialogSettings(section);
- }
-
- fPatchWizardPage.saveWidgetValues();
- //fPreviewPatchPage.saveWidgetValues();
-
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
deleted file mode 100644
index 721db089e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ /dev/null
@@ -1,1080 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.*;
-
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-
-/**
- * A Patcher
- * - knows how to parse various patch file formats into some in-memory structure,
- * - holds onto the parsed data and the options to use when applying the patches,
- * - knows how to apply the patches to files and folders.
- */
-public class Patcher {
-
- private static final boolean DEBUG= false;
-
- private static final String DEV_NULL= "/dev/null"; //$NON-NLS-1$
-
- private static final String REJECT_FILE_EXTENSION= ".rej"; //$NON-NLS-1$
-
- private static final String MARKER_TYPE= "org.eclipse.compare.rejectedPatchMarker"; //$NON-NLS-1$
-
- // diff formats
-// private static final int CONTEXT= 0;
-// private static final int ED= 1;
-// private static final int NORMAL= 2;
-// private static final int UNIFIED= 3;
-
- // we recognize the following date/time formats
- private static DateFormat[] DATE_FORMATS= new DateFormat[] {
- new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy"), //$NON-NLS-1$
- new SimpleDateFormat("yyyy/MM/dd kk:mm:ss"), //$NON-NLS-1$
- new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy", Locale.US) //$NON-NLS-1$
- };
-
- private String fName;
- private Diff[] fDiffs;
- // patch options
- private int fStripPrefixSegments;
- private int fFuzz;
- private boolean fIgnoreWhitespace= false;
- private boolean fIgnoreLineDelimiter= true;
- private boolean fPreserveLineDelimiters= false;
- private boolean fReverse= false;
- private boolean fAdjustShift= true;
-
-
- Patcher() {
- }
-
- //---- options
-
- void setName(String name) {
- fName= name;
- }
-
- String getName() {
- return fName;
- }
-
- /**
- * Returns an array of Diffs after a sucessfull call to <code>parse</code>.
- * If <code>parse</code> hasn't been called returns <code>null</code>.
- */
- Diff[] getDiffs() {
- return fDiffs;
- }
-
- IPath getPath(Diff diff) {
- IPath path= diff.getPath();
- if (fStripPrefixSegments > 0 && fStripPrefixSegments < path.segmentCount())
- path= path.removeFirstSegments(fStripPrefixSegments);
- return path;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setStripPrefixSegments(int strip) {
- if (strip != fStripPrefixSegments) {
- fStripPrefixSegments= strip;
- return true;
- }
- return false;
- }
-
- int getStripPrefixSegments() {
- return fStripPrefixSegments;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setFuzz(int fuzz) {
- if (fuzz != fFuzz) {
- fFuzz= fuzz;
- return true;
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setReversed(boolean reverse) {
- if (fReverse != reverse) {
- fReverse= reverse;
-
- for (int i= 0; i < fDiffs.length; i++)
- fDiffs[i].reverse();
-
- return true;
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setIgnoreWhitespace(boolean ignoreWhitespace) {
- if (ignoreWhitespace != fIgnoreWhitespace) {
- fIgnoreWhitespace= ignoreWhitespace;
- return true;
- }
- return false;
- }
-
- //---- parsing patch files
-
- /* package */ void parse(BufferedReader reader) throws IOException {
- List diffs= new ArrayList();
- String line= null;
- boolean reread= false;
- String diffArgs= null;
- String fileName= null;
-
- LineReader lr= new LineReader(reader);
- if (!"carbon".equals(SWT.getPlatform())) //$NON-NLS-1$
- lr.ignoreSingleCR();
-
- // read leading garbage
- while (true) {
- if (!reread)
- line= lr.readLine();
- reread= false;
- if (line == null)
- break;
- if (line.length() < 4)
- continue; // too short
-
- // remember some infos
- if (line.startsWith("Index: ")) { //$NON-NLS-1$
- fileName= line.substring(7).trim();
- continue;
- }
- if (line.startsWith("diff")) { //$NON-NLS-1$
- diffArgs= line.substring(4).trim();
- continue;
- }
-
- if (line.startsWith("--- ")) { //$NON-NLS-1$
- line= readUnifiedDiff(diffs, lr, line, diffArgs, fileName);
- diffArgs= fileName= null;
- reread= true;
- } else if (line.startsWith("*** ")) { //$NON-NLS-1$
- line= readContextDiff(diffs, lr, line, diffArgs, fileName);
- diffArgs= fileName= null;
- reread= true;
- }
- }
-
- lr.close();
-
- fDiffs= (Diff[]) diffs.toArray(new Diff[diffs.size()]);
- }
-
- /**
- * Returns the next line that does not belong to this diff
- */
- private String readUnifiedDiff(List diffs, LineReader reader, String line, String args, String fileName) throws IOException {
-
- String[] oldArgs= split(line.substring(4));
-
- // read info about new file
- line= reader.readLine();
- if (line == null || !line.startsWith("+++ ")) //$NON-NLS-1$
- return line;
-
- String[] newArgs= split(line.substring(4));
-
- Diff diff= new Diff(extractPath(oldArgs, 0, fileName), extractDate(oldArgs, 1),
- extractPath(newArgs, 0, fileName), extractDate(newArgs, 1));
- diffs.add(diff);
-
- int[] oldRange= new int[2];
- int[] newRange= new int[2];
- List lines= new ArrayList();
-
- try {
- // read lines of hunk
- while (true) {
-
- line= reader.readLine();
- if (line == null)
- return null;
-
- if (reader.lineContentLength(line) == 0) {
- //System.out.println("Warning: found empty line in hunk; ignored");
- //lines.add(' ' + line);
- continue;
- }
-
- char c= line.charAt(0);
- switch (c) {
- case '@':
- if (line.startsWith("@@ ")) { //$NON-NLS-1$
- // flush old hunk
- if (lines.size() > 0) {
- new Hunk(diff, oldRange, newRange, lines);
- lines.clear();
- }
-
- // format: @@ -oldStart,oldLength +newStart,newLength @@
- extractPair(line, '-', oldRange);
- extractPair(line, '+', newRange);
- continue;
- }
- break;
- case ' ':
- case '+':
- case '-':
- lines.add(line);
- continue;
- case '\\':
- if (line.startsWith("No newline at end of file", 2)) { //$NON-NLS-1$
- int lastIndex= lines.size();
- if (lastIndex > 0) {
- line= (String) lines.get(lastIndex-1);
- int end= line.length()-1;
- char lc= line.charAt(end);
- if (lc == '\n') {
- end--;
- if (end > 0 && line.charAt(end-1) == '\r')
- end--;
- } else if (lc == '\r') {
- end--;
- }
- line= line.substring(0, end);
- lines.set(lastIndex-1, line);
- }
- continue;
- }
- break;
- default:
- if (DEBUG) {
- int a1= c, a2= 0;
- if (line.length() > 1)
- a2= line.charAt(1);
- System.out.println("char: " + a1 + " " + a2); //$NON-NLS-1$ //$NON-NLS-2$
- }
- break;
- }
- return line;
- }
- } finally {
- if (lines.size() > 0)
- new Hunk(diff, oldRange, newRange, lines);
- diff.finish();
- }
- }
-
- /**
- * Returns the next line that does not belong to this diff
- */
- private String readContextDiff(List diffs, LineReader reader, String line, String args, String fileName) throws IOException {
-
- String[] oldArgs= split(line.substring(4));
-
- // read info about new file
- line= reader.readLine();
- if (line == null || !line.startsWith("--- ")) //$NON-NLS-1$
- return line;
-
- String[] newArgs= split(line.substring(4));
-
- Diff diff= new Diff(extractPath(oldArgs, 0, fileName), extractDate(oldArgs, 1),
- extractPath(newArgs, 0, fileName), extractDate(newArgs, 1));
- diffs.add(diff);
-
- int[] oldRange= new int[2];
- int[] newRange= new int[2];
- List oldLines= new ArrayList();
- List newLines= new ArrayList();
- List lines= oldLines;
-
- try {
- // read lines of hunk
- while (true) {
-
- line= reader.readLine();
- if (line == null)
- return line;
-
- int l= line.length();
- if (l == 0)
- continue;
- if (l > 1) {
- switch (line.charAt(0)) {
- case '*':
- if (line.startsWith("***************")) { // new hunk //$NON-NLS-1$
- // flush old hunk
- if (oldLines.size() > 0 || newLines.size() > 0) {
- new Hunk(diff, oldRange, newRange, unifyLines(oldLines, newLines));
- oldLines.clear();
- newLines.clear();
- }
- continue;
- }
- if (line.startsWith("*** ")) { // old range //$NON-NLS-1$
- // format: *** oldStart,oldEnd ***
- extractPair(line, ' ', oldRange);
- oldRange[1]= oldRange[1]-oldRange[0]+1;
- lines= oldLines;
- continue;
- }
- break;
- case ' ': // context line
- case '+': // addition
- case '!': // change
- if (line.charAt(1) == ' ') {
- lines.add(line);
- continue;
- }
- break;
- case '-':
- if (line.charAt(1) == ' ') { // deletion
- lines.add(line);
- continue;
- }
- if (line.startsWith("--- ")) { // new range //$NON-NLS-1$
- // format: *** newStart,newEnd ***
- extractPair(line, ' ', newRange);
- newRange[1]= newRange[1]-newRange[0]+1;
- lines= newLines;
- continue;
- }
- break;
- default:
- break;
- }
- }
- return line;
- }
- } finally {
- // flush last hunk
- if (oldLines.size() > 0 || newLines.size() > 0)
- new Hunk(diff, oldRange, newRange, unifyLines(oldLines, newLines));
- diff.finish();
- }
- }
-
- /**
- * Creates a List of lines in the unified format from
- * two Lists of lines in the 'classic' format.
- */
- private List unifyLines(List oldLines, List newLines) {
- List result= new ArrayList();
-
- String[] ol= (String[]) oldLines.toArray(new String[oldLines.size()]);
- String[] nl= (String[]) newLines.toArray(new String[newLines.size()]);
-
- int oi= 0, ni= 0;
-
- while (true) {
-
- char oc= 0;
- String o= null;
- if (oi < ol.length) {
- o= ol[oi];
- oc= o.charAt(0);
- }
-
- char nc= 0;
- String n= null;
- if (ni < nl.length) {
- n= nl[ni];
- nc= n.charAt(0);
- }
-
- // EOF
- if (oc == 0 && nc == 0)
- break;
-
- // deletion in old
- if (oc == '-') {
- do {
- result.add('-' + o.substring(2));
- oi++;
- if (oi >= ol.length)
- break;
- o= ol[oi];
- } while (o.charAt(0) == '-');
- continue;
- }
-
- // addition in new
- if (nc == '+') {
- do {
- result.add('+' + n.substring(2));
- ni++;
- if (ni >= nl.length)
- break;
- n= nl[ni];
- } while (n.charAt(0) == '+');
- continue;
- }
-
- // differing lines on both sides
- if (oc == '!' && nc == '!') {
- // remove old
- do {
- result.add('-' + o.substring(2));
- oi++;
- if (oi >= ol.length)
- break;
- o= ol[oi];
- } while (o.charAt(0) == '!');
-
- // add new
- do {
- result.add('+' + n.substring(2));
- ni++;
- if (ni >= nl.length)
- break;
- n= nl[ni];
- } while (n.charAt(0) == '!');
-
- continue;
- }
-
- // context lines
- if (oc == ' ' && nc == ' ') {
- do {
- Assert.isTrue(o.equals(n), "non matching context lines"); //$NON-NLS-1$
- result.add(' ' + o.substring(2));
- oi++;
- ni++;
- if (oi >= ol.length || ni >= nl.length)
- break;
- o= ol[oi];
- n= nl[ni];
- } while (o.charAt(0) == ' ' && n.charAt(0) == ' ');
- continue;
- }
-
- if (oc == ' ') {
- do {
- result.add(' ' + o.substring(2));
- oi++;
- if (oi >= ol.length)
- break;
- o= ol[oi];
- } while (o.charAt(0) == ' ');
- continue;
- }
-
- if (nc == ' ') {
- do {
- result.add(' ' + n.substring(2));
- ni++;
- if (ni >= nl.length)
- break;
- n= nl[ni];
- } while (n.charAt(0) == ' ');
- continue;
- }
-
- Assert.isTrue(false, "unexpected char <" + oc + "> <" + nc + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- return result;
- }
-
- /**
- * Breaks the given string into tab separated substrings.
- * Leading and trailing whitespace is removed from each token.
- */
- private String[] split(String line) {
- List l= new ArrayList();
- StringTokenizer st= new StringTokenizer(line, "\t"); //$NON-NLS-1$
- while (st.hasMoreElements()) {
- String token= st.nextToken().trim();
- if (token.length() > 0)
- l.add(token);
- }
- return (String[]) l.toArray(new String[l.size()]);
- }
-
- /**
- * @return the parsed time/date in milliseconds or -1 on error
- */
- private long extractDate(String[] args, int n) {
- if (n < args.length) {
- String line= args[n];
- for (int i= 0; i < DATE_FORMATS.length; i++) {
- DATE_FORMATS[i].setLenient(true);
- try {
- Date date= DATE_FORMATS[i].parse(line);
- return date.getTime();
- } catch (ParseException ex) {
- // silently ignored
- }
- }
- // System.err.println("can't parse date: <" + line + ">");
- }
- return -1;
- }
-
- /**
- * Returns null if file name is "/dev/null".
- */
- private IPath extractPath(String[] args, int n, String path2) {
- if (n < args.length) {
- String path= args[n];
- if (DEV_NULL.equals(path))
- return null;
- int pos= path.lastIndexOf(':');
- if (pos >= 0)
- path= path.substring(0, pos);
- if (path2 != null && !path2.equals(path)) {
- if (DEBUG) System.out.println("path mismatch: " + path2); //$NON-NLS-1$
- path= path2;
- }
- return new Path(path);
- }
- return null;
- }
-
- /**
- * Tries to extract two integers separated by a comma.
- * The parsing of the line starts at the position after
- * the first occurrence of the given character start an ends
- * at the first blank (or the end of the line).
- * If only a single number is found this is assumed to be the length of the range.
- * In this case the start of the range is set to 1.
- * If an error occurs the range -1,-1 is returned.
- */
- private void extractPair(String line, char start, int[] pair) {
- pair[0]= pair[1]= -1;
- int startPos= line.indexOf(start);
- if (startPos < 0) {
- if (DEBUG) System.out.println("parsing error in extractPair: couldn't find \'" + start + "\'"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- line= line.substring(startPos+1);
- int endPos= line.indexOf(' ');
- if (endPos < 0) {
- if (DEBUG) System.out.println("parsing error in extractPair: couldn't find end blank"); //$NON-NLS-1$
- return;
- }
- line= line.substring(0, endPos);
- int comma= line.indexOf(',');
- if (comma >= 0) {
- pair[0]= Integer.parseInt(line.substring(0, comma));
- pair[1]= Integer.parseInt(line.substring(comma+1));
- } else {
- pair[0]= 1;
- pair[1]= Integer.parseInt(line.substring(comma+1));
- }
- }
-
- //---- applying a patch file
-
- /**
- * Tries to patch the given lines with the specified Diff.
- * Any hunk that couldn't be applied is returned in the list failedHunks.
- */
- /* package */ void patch(Diff diff, List lines, List failedHunks) {
-
- int shift= 0;
- Iterator iter= diff.fHunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- hunk.fMatches= false;
- shift= patch(hunk, lines, shift, failedHunks);
- }
- }
-
- /**
- * Tries to apply the specified hunk to the given lines.
- * If the hunk cannot be applied at the original position
- * the methods tries Fuzz lines before and after.
- * If this fails the Hunk is added to the given list of failed hunks.
- */
- private int patch(Hunk hunk, List lines, int shift, List failedHunks) {
- if (tryPatch(hunk, lines, shift)) {
- if (hunk.isEnabled())
- shift+= doPatch(hunk, lines, shift);
- } else {
- boolean found= false;
- int oldShift= shift;
-
- for (int i= 1; i <= fFuzz; i++) {
- if (tryPatch(hunk, lines, shift-i)) {
- if (fAdjustShift)
- shift-= i;
- found= true;
- break;
- }
- }
-
- if (! found) {
- for (int i= 1; i <= fFuzz; i++) {
- if (tryPatch(hunk, lines, shift+i)) {
- if (fAdjustShift)
- shift+= i;
- found= true;
- break;
- }
- }
- }
-
- if (found) {
- if (DEBUG) System.out.println("patched hunk at offset: " + (shift-oldShift)); //$NON-NLS-1$
- shift+= doPatch(hunk, lines, shift);
- } else {
- if (failedHunks != null) {
- if (DEBUG) System.out.println("failed hunk"); //$NON-NLS-1$
- failedHunks.add(hunk);
- }
- }
- }
- return shift;
- }
-
- /**
- * Tries to apply the given hunk on the specified lines.
- * The parameter shift is added to the line numbers given
- * in the hunk.
- */
- private boolean tryPatch(Hunk hunk, List lines, int shift) {
- int pos= hunk.fOldStart + shift;
- int deleteMatches= 0;
- for (int i= 0; i < hunk.fLines.length; i++) {
- String s= hunk.fLines[i];
- Assert.isTrue(s.length() > 0);
- String line= s.substring(1);
- char controlChar= s.charAt(0);
- if (controlChar == ' ') { // context lines
- while (true) {
- if (pos < 0 || pos >= lines.size())
- return false;
- if (linesMatch(line, (String) lines.get(pos))) {
- pos++;
- break;
- }
- return false;
- }
- } else if (controlChar == '-') {
- // deleted lines
- while (true) {
- if (pos < 0 || pos >= lines.size())
- return false;
- if (linesMatch(line, (String) lines.get(pos))) {
- deleteMatches++;
- pos++;
- break;
- }
- if (deleteMatches <= 0)
- return false;
- pos++;
- }
- } else if (controlChar == '+') {
- // added lines
- // we don't have to do anything for a 'try'
- } else
- Assert.isTrue(false, "tryPatch: unknown control character: " + controlChar); //$NON-NLS-1$
- }
- return true;
- }
-
- private int doPatch(Hunk hunk, List lines, int shift) {
- int pos= hunk.fOldStart + shift;
- for (int i= 0; i < hunk.fLines.length; i++) {
- String s= hunk.fLines[i];
- Assert.isTrue(s.length() > 0);
- String line= s.substring(1);
- char controlChar= s.charAt(0);
- if (controlChar == ' ') { // context lines
- while (true) {
- Assert.isTrue(pos < lines.size(), "doPatch: inconsistency in context"); //$NON-NLS-1$
- if (linesMatch(line, (String) lines.get(pos))) {
- pos++;
- break;
- }
- pos++;
- }
- } else if (controlChar == '-') {
- // deleted lines
- while (true) {
- Assert.isTrue(pos < lines.size(), "doPatch: inconsistency in deleted lines"); //$NON-NLS-1$
- if (linesMatch(line, (String) lines.get(pos))) {
- break;
- }
- pos++;
- }
- lines.remove(pos);
- } else if (controlChar == '+') {
- // added lines
- lines.add(pos, line);
- pos++;
- } else
- Assert.isTrue(false, "doPatch: unknown control character: " + controlChar); //$NON-NLS-1$
- }
- hunk.fMatches= true;
- return hunk.fNewLength - hunk.fOldLength;
- }
-
- public void applyAll(IResource target, IProgressMonitor pm, Shell shell, String title) throws CoreException {
-
- final int WORK_UNIT= 10;
-
- int i;
-
- IFile singleFile= null; // file to be patched
- IContainer container= null;
- if (target instanceof IContainer)
- container= (IContainer) target;
- else if (target instanceof IFile) {
- singleFile= (IFile) target;
- container= singleFile.getParent();
- } else {
- Assert.isTrue(false);
- }
-
- // get all files to be modified in order to call validateEdit
- List list= new ArrayList();
- if (singleFile != null)
- list.add(singleFile);
- else {
- for (i= 0; i < fDiffs.length; i++) {
- Diff diff= fDiffs[i];
- if (diff.isEnabled()) {
- switch (diff.getType()) {
- case Differencer.CHANGE:
- list.add(createPath(container, getPath(diff)));
- break;
- }
- }
- }
- }
- if (! Utilities.validateResources(list, shell, title))
- return;
-
- if (pm != null) {
- String message= PatchMessages.getString("Patcher.Task.message"); //$NON-NLS-1$
- pm.beginTask(message, fDiffs.length*WORK_UNIT);
- }
-
- for (i= 0; i < fDiffs.length; i++) {
-
- int workTicks= WORK_UNIT;
-
- Diff diff= fDiffs[i];
- if (diff.isEnabled()) {
-
- IPath path= getPath(diff);
- if (pm != null)
- pm.subTask(path.toString());
-
- IFile file= singleFile != null
- ? singleFile
- : createPath(container, path);
-
- List failed= new ArrayList();
- List result= null;
-
- int type= diff.getType();
- switch (type) {
- case Differencer.ADDITION:
- // patch it and collect rejected hunks
- result= apply(diff, file, true, failed);
- store(createString(result), file, new SubProgressMonitor(pm, workTicks));
- workTicks-= WORK_UNIT;
- break;
- case Differencer.DELETION:
- file.delete(true, true, new SubProgressMonitor(pm, workTicks));
- workTicks-= WORK_UNIT;
- break;
- case Differencer.CHANGE:
- // patch it and collect rejected hunks
- result= apply(diff, file, false, failed);
- store(createString(result), file, new SubProgressMonitor(pm, workTicks));
- workTicks-= WORK_UNIT;
- break;
- }
-
- if (failed.size() > 0) {
- IPath pp= null;
- if (path.segmentCount() > 1) {
- pp= path.removeLastSegments(1);
- pp= pp.append(path.lastSegment() + REJECT_FILE_EXTENSION);
- } else
- pp= new Path(path.lastSegment() + REJECT_FILE_EXTENSION);
- file= createPath(container, pp);
- if (file != null) {
- store(getRejected(failed), file, pm);
- try {
- IMarker marker= file.createMarker(MARKER_TYPE);
- marker.setAttribute(IMarker.MESSAGE, PatchMessages.getString("Patcher.Marker.message")); //$NON-NLS-1$
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
- }
-
- if (pm != null) {
- if (pm.isCanceled())
- break;
- if (workTicks > 0)
- pm.worked(workTicks);
- }
- }
- }
-
- /**
- * Reads the contents from the given file and returns them as
- * a List of lines.
- */
- List load(IFile file, boolean create) {
- List lines= null;
- if (!create && file != null) {
- // read current contents
- InputStream is= null;
- try {
- is= file.getContents();
-
- Reader streamReader= null;
- try {
- streamReader= new InputStreamReader(is, Utilities.getCharset(file));
- } catch (UnsupportedEncodingException x) {
- // use default encoding
- streamReader= new InputStreamReader(is);
- }
-
- BufferedReader reader= new BufferedReader(streamReader);
- LineReader lr= new LineReader(reader);
- if (!"carbon".equals(SWT.getPlatform())) //$NON-NLS-1$
- lr.ignoreSingleCR();
- lines= lr.readLines();
- } catch(CoreException ex) {
- // NeedWork
- } finally {
- if (is != null)
- try {
- is.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- }
-
- if (lines == null)
- lines= new ArrayList();
- return lines;
- }
-
- List apply(Diff diff, IFile file, boolean create, List failedHunks) {
- List lines= load(file, create);
- patch(diff, lines, failedHunks);
- return lines;
- }
-
- /**
- * Converts the string into bytes and stores them in the given file.
- */
- private void store(String contents, IFile file, IProgressMonitor pm) throws CoreException {
-
- byte[] bytes;
- try {
- bytes= contents.getBytes(Utilities.getCharset(file));
- } catch (UnsupportedEncodingException x) {
- // uses default encoding
- bytes= contents.getBytes();
- }
-
- InputStream is= new ByteArrayInputStream(bytes);
- try {
- if (file.exists()) {
- file.setContents(is, false, true, pm);
- } else {
- file.create(is, false, pm);
- }
- } finally {
- if (is != null)
- try {
- is.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- }
-
- /**
- * Concatenates all strings found in the given List.
- */
- private String createString(List lines) {
- StringBuffer sb= new StringBuffer();
- Iterator iter= lines.iterator();
- if (fPreserveLineDelimiters) {
- while (iter.hasNext())
- sb.append((String)iter.next());
- } else {
- String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$
- while (iter.hasNext()) {
- String line= (String)iter.next();
- int l= length(line);
- if (l < line.length()) { // line has delimiter
- sb.append(line.substring(0, l));
- sb.append(lineSeparator);
- } else {
- sb.append(line);
- }
- }
- }
- return sb.toString();
- }
-
- String getRejected(List failedHunks) {
- if (failedHunks.size() <= 0)
- return null;
-
- String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer sb= new StringBuffer();
- Iterator iter= failedHunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- sb.append(hunk.getRejectedDescription());
- sb.append(lineSeparator);
- sb.append(hunk.getContent());
- }
- return sb.toString();
- }
-
- /**
- * Ensures that a file with the given path exists in
- * the given container. Folder are created as necessary.
- */
- private IFile createPath(IContainer container, IPath path) throws CoreException {
- if (path.segmentCount() > 1) {
- IFolder f= container.getFolder(path.uptoSegment(1));
- if (!f.exists())
- f.create(false, true, null);
- return createPath(f, path.removeFirstSegments(1));
- }
- // a leaf
- return container.getFile(path);
- }
-
- /**
- * Returns the given string with all whitespace characters removed.
- * Whitespace is defined by <code>Character.isWhitespace(...)</code>.
- */
- private static String stripWhiteSpace(String s) {
- StringBuffer sb= new StringBuffer();
- int l= s.length();
- for (int i= 0; i < l; i++) {
- char c= s.charAt(i);
- if (!Character.isWhitespace(c))
- sb.append(c);
- }
- return sb.toString();
- }
-
- /**
- * Compares two strings.
- * If fIgnoreWhitespace is true whitespace is ignored.
- */
- private boolean linesMatch(String line1, String line2) {
- if (fIgnoreWhitespace)
- return stripWhiteSpace(line1).equals(stripWhiteSpace(line2));
- if (fIgnoreLineDelimiter) {
- int l1= length(line1);
- int l2= length(line2);
- if (l1 != l2)
- return false;
- return line1.regionMatches(0, line2, 0, l1);
- }
- return line1.equals(line2);
- }
-
- /**
- * Returns the length (exluding a line delimiter CR, LF, CR/LF)
- * of the given string.
- */
- /* package */ static int length(String s) {
- int l= s.length();
- if (l > 0) {
- char c= s.charAt(l-1);
- if (c == '\r')
- return l-1;
- if (c == '\n') {
- if (l > 1 && s.charAt(l-2) == '\r')
- return l-2;
- return l-1;
- }
- }
- return l;
- }
-
- int calculateFuzz(Hunk hunk, List lines, int shift, IProgressMonitor pm, int[] fuzz) {
-
- hunk.fMatches= false;
- if (tryPatch(hunk, lines, shift)) {
- shift+= doPatch(hunk, lines, shift);
- fuzz[0]= 0;
- } else {
- boolean found= false;
- int hugeFuzz= lines.size(); // the maximum we need for this file
- fuzz[0]= -2; // not found
-
- for (int i= 1; i <= hugeFuzz; i++) {
- if (pm.isCanceled()) {
- fuzz[0]= -1;
- return 0;
- }
- if (tryPatch(hunk, lines, shift-i)) {
- fuzz[0]= i;
- if (fAdjustShift)
- shift-= i;
- found= true;
- break;
- }
- }
-
- if (! found) {
- for (int i= 1; i <= hugeFuzz; i++) {
- if (pm.isCanceled()) {
- fuzz[0]= -1;
- return 0;
- }
- if (tryPatch(hunk, lines, shift+i)) {
- fuzz[0]= i;
- if (fAdjustShift)
- shift+= i;
- found= true;
- break;
- }
- }
- }
-
- if (found)
- shift+= doPatch(hunk, lines, shift);
- }
- return shift;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
deleted file mode 100644
index b2b0fdd2a..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
+++ /dev/null
@@ -1,742 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.internal.DiffImage;
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.compare.internal.TimeoutContext;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * Shows the parsed patch file and any mismatches
- * between files, hunks and the currently selected
- * resources.
- */
-/* package */ class PreviewPatchPage extends WizardPage {
-
- static final int GUESS_TIMEOUT= 1500; // show progress after 1.5sec of fuzz factor guessing
-
- /**
- * Used with CompareInput
- */
- static class HunkInput implements ITypedElement, IEncodedStreamContentAccessor {
- static final String UTF_16= "UTF-16"; //$NON-NLS-1$
- String fContent;
- String fType;
-
- HunkInput(String type, String s) {
- fType= type;
- fContent= s;
- }
- public Image getImage() {
- return null;
- }
- public String getName() {
- return PatchMessages.getString("PreviewPatchPage.NoName.text"); //$NON-NLS-1$
- }
- public String getType() {
- return fType;
- }
- public InputStream getContents() {
- return new ByteArrayInputStream(Utilities.getBytes(fContent, UTF_16));
- }
- public String getCharset() {
- return UTF_16;
- }
- }
-
- private PatchWizard fPatchWizard;
-
- private Tree fTree;
- private Combo fStripPrefixSegments;
- private CompareViewerSwitchingPane fHunkViewer;
- private Button fIgnoreWhitespaceButton;
- private Button fReversePatchButton;
- private Text fFuzzField;
-
- private Image[] fImages= new Image[6];
- private CompareConfiguration fCompareConfiguration;
-
-
- /* package */ PreviewPatchPage(PatchWizard pw) {
- super("PreviewPatchPage", //$NON-NLS-1$
- PatchMessages.getString("PreviewPatchPage.title"), null); //$NON-NLS-1$
-
- setMessage(PatchMessages.getString("PreviewPatchPage.message")); //$NON-NLS-1$
-
- fPatchWizard= pw;
- //setPageComplete(false);
-
- int w= 16;
-
- ImageDescriptor addId= CompareUIPlugin.getImageDescriptor("ovr16/add_ov.gif"); //$NON-NLS-1$
- ImageDescriptor delId= CompareUIPlugin.getImageDescriptor("ovr16/del_ov.gif"); //$NON-NLS-1$
-
- ImageDescriptor errId= CompareUIPlugin.getImageDescriptor("ovr16/error_ov.gif"); //$NON-NLS-1$
- Image errIm= errId.createImage();
-
- fImages[0]= new DiffImage(null, null, w).createImage();
- fImages[1]= new DiffImage(null, addId, w).createImage();
- fImages[2]= new DiffImage(null, delId, w).createImage();
-
- fImages[3]= new DiffImage(errIm, null, w).createImage();
- fImages[4]= new DiffImage(errIm, addId, w).createImage();
- fImages[5]= new DiffImage(errIm, delId, w).createImage();
-
- fCompareConfiguration= new CompareConfiguration();
-
- fCompareConfiguration.setLeftEditable(false);
- fCompareConfiguration.setLeftLabel(PatchMessages.getString("PreviewPatchPage.Left.title")); //$NON-NLS-1$
-
- fCompareConfiguration.setRightEditable(false);
- fCompareConfiguration.setRightLabel(PatchMessages.getString("PreviewPatchPage.Right.title")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared in WizardPage
- */
- public void setVisible(boolean visible) {
- if (visible)
- buildTree();
- super.setVisible(visible);
- }
-
- Image getImage(Diff diff) {
- if (diff.fMatches) {
- switch (diff.getType()) {
- case Differencer.ADDITION:
- return fImages[1];
- case Differencer.DELETION:
- return fImages[2];
- }
- return fImages[0];
- }
- switch (diff.getType()) {
- case Differencer.ADDITION:
- return fImages[4];
- case Differencer.DELETION:
- return fImages[5];
- }
- return fImages[3];
- }
-
- Image getImage(Hunk hunk) {
- if (hunk.fMatches)
- return fImages[0];
- return fImages[3];
- }
-
- public void createControl(Composite parent) {
-
- Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- WorkbenchHelp.setHelp(composite, ICompareContextIds.PATCH_PREVIEW_WIZARD_PAGE);
-
- setControl(composite);
-
- buildPatchOptionsGroup(composite);
-
- Splitter splitter= new Splitter(composite, SWT.VERTICAL);
- splitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-
-
- // top pane showing diffs and hunks in a check box tree
- fTree= new Tree(splitter, SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData gd= new GridData();
- gd.verticalAlignment= GridData.FILL;
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.grabExcessVerticalSpace= true;
- fTree.setLayoutData(gd);
-
- // bottom pane showing hunks in compare viewer
- fHunkViewer= new CompareViewerSwitchingPane(splitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUI.findContentViewer(oldViewer, (ICompareInput)input, this, fCompareConfiguration);
- }
- };
- gd= new GridData();
- gd.verticalAlignment= GridData.FILL;
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.grabExcessVerticalSpace= true;
- fHunkViewer.setLayoutData(gd);
-
- // register listeners
-
- fTree.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TreeItem ti= (TreeItem) e.item;
- Object data= e.item.getData();
- if (e.detail == SWT.CHECK) {
- boolean checked= ti.getChecked();
- if (data instanceof Hunk) {
- Hunk hunk= (Hunk) data;
- checked= checked && hunk.fMatches;
- //hunk.setEnabled(checked);
- ti.setChecked(checked);
- updateGrayedState(ti);
- } else if (data instanceof Diff) {
- updateCheckedState(ti);
- }
- } else {
- if (data instanceof Hunk)
- PreviewPatchPage.this.fHunkViewer.setInput(createInput((Hunk)data));
- else
- PreviewPatchPage.this.fHunkViewer.setInput(null);
- }
- }
- }
- );
- fTree.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fImages != null) {
- for (int i= 0; i < fImages.length; i++) {
- if (fImages[i] == null)
- fImages[i].dispose();
- }
- fImages= null;
- }
- }
- });
- // creating tree's content
- buildTree();
- Dialog.applyDialogFont(composite);
- }
-
- /**
- * Create the group for setting various patch options
- */
- private void buildPatchOptionsGroup(Composite parent) {
-
- GridLayout gl;
- GridData gd;
- Label l;
-
- final Patcher patcher= fPatchWizard.getPatcher();
-
- Group group= new Group(parent, SWT.NONE);
- group.setText(PatchMessages.getString("PreviewPatchPage.PatchOptions.title")); //$NON-NLS-1$
- gl= new GridLayout(); gl.numColumns= 4; gl.marginHeight= 0;
- group.setLayout(gl);
- group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // 1st row
-
- Composite pair= new Composite(group, SWT.NONE);
- gl= new GridLayout(); gl.numColumns= 2; gl.marginHeight= gl.marginWidth= 0;
- pair.setLayout(gl);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- pair.setLayoutData(gd);
-
- l= new Label(pair, SWT.NONE);
- l.setText(PatchMessages.getString("PreviewPatchPage.IgnoreSegments.text")); //$NON-NLS-1$
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);
- l.setLayoutData(gd);
-
- fStripPrefixSegments= new Combo(pair, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.SIMPLE);
- int prefixCnt= patcher.getStripPrefixSegments();
- String prefix= Integer.toString(prefixCnt);
- fStripPrefixSegments.add(prefix);
- fStripPrefixSegments.setText(prefix);
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_END);
- fStripPrefixSegments.setLayoutData(gd);
-
- addSpacer(group);
-
- fReversePatchButton= new Button(group, SWT.CHECK);
- fReversePatchButton.setText(PatchMessages.getString("PreviewPatchPage.ReversePatch.text")); //$NON-NLS-1$
-
- addSpacer(group);
-
- // 2nd row
- pair= new Composite(group, SWT.NONE);
- gl= new GridLayout(); gl.numColumns= 3; gl.marginHeight= gl.marginWidth= 0;
- pair.setLayout(gl);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- pair.setLayoutData(gd);
-
- l= new Label(pair, SWT.NONE);
- l.setText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.text")); //$NON-NLS-1$
- l.setToolTipText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);
- l.setLayoutData(gd);
-
- fFuzzField= new Text(pair, SWT.BORDER);
- fFuzzField.setText("2"); //$NON-NLS-1$
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_END); gd.widthHint= 30;
- fFuzzField.setLayoutData(gd);
-
- Button b= new Button(pair, SWT.PUSH);
- b.setText(PatchMessages.getString("PreviewPatchPage.GuessFuzz.text")); //$NON-NLS-1$
- b.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int fuzz= guessFuzzFactor(patcher);
- if (fuzz >= 0)
- fFuzzField.setText(Integer.toString(fuzz));
- }
- }
- );
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER);
- b.setLayoutData(gd);
-
- addSpacer(group);
-
- fIgnoreWhitespaceButton= new Button(group, SWT.CHECK);
- fIgnoreWhitespaceButton.setText(PatchMessages.getString("PreviewPatchPage.IgnoreWhitespace.text")); //$NON-NLS-1$
-
- addSpacer(group);
-
- // register listeners
-
- if (fStripPrefixSegments != null)
- fStripPrefixSegments.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (patcher.setStripPrefixSegments(getStripPrefixSegments()))
- updateTree();
- }
- }
- );
- fReversePatchButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (patcher.setReversed(fReversePatchButton.getSelection()))
- updateTree();
- }
- }
- );
- fIgnoreWhitespaceButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (patcher.setIgnoreWhitespace(fIgnoreWhitespaceButton.getSelection()))
- updateTree();
- }
- }
- );
-
- fFuzzField.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (patcher.setFuzz(getFuzzFactor()))
- updateTree();
- }
- }
- );
- }
-
- private int guessFuzzFactor(final Patcher patcher) {
- final int strip= getStripPrefixSegments();
- final int[] result= new int[1];
- try {
- TimeoutContext.run(true, GUESS_TIMEOUT, getControl().getShell(),
- new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- result[0]= guess(patcher, monitor, strip);
- }
- }
- );
- return result[0];
- } catch (InvocationTargetException ex) {
- // NeedWork
- } catch (InterruptedException ex) {
- // NeedWork
- }
- return -1;
- }
-
- private int guess(Patcher patcher, IProgressMonitor pm, int strip) {
-
- Diff[] diffs= patcher.getDiffs();
- if (diffs == null || diffs.length <= 0)
- return -1;
-
- // now collect files and determine "work"
- IFile[] files= new IFile[diffs.length];
- int work= 0;
- for (int i= 0; i < diffs.length; i++) {
- Diff diff= diffs[i];
- if (diff == null)
- continue;
- if (diff.getType() != Differencer.ADDITION) {
- IPath p= diff.fOldPath;
- if (strip > 0 && strip < p.segmentCount())
- p= p.removeFirstSegments(strip);
- IFile file= existsInSelection(p);
- if (file != null) {
- files[i]= file;
- work+= diff.fHunks.size();
- }
- }
- }
-
- // do the "work"
- int[] fuzzRef= new int[1];
- String format= PatchMessages.getString("PreviewPatchPage.GuessFuzzProgress.format"); //$NON-NLS-1$
- pm.beginTask(PatchMessages.getString("PreviewPatchPage.GuessFuzzProgress.text"), work); //$NON-NLS-1$
- try {
- int fuzz= 0;
- for (int i= 0; i < diffs.length; i++) {
- Diff d= diffs[i];
- IFile file= files[i];
- if (d != null && file != null) {
- List lines= patcher.load(file, false);
- String name= d.getPath().lastSegment();
- Iterator iter= d.fHunks.iterator();
- int shift= 0;
- for (int hcnt= 1; iter.hasNext(); hcnt++) {
- pm.subTask(MessageFormat.format(format, new String[] { name, Integer.toString(hcnt) } ));
- Hunk h= (Hunk) iter.next();
- shift= patcher.calculateFuzz(h, lines, shift, pm, fuzzRef);
- int f= fuzzRef[0];
- if (f == -1) // cancel
- return -1;
- if (f > fuzz)
- fuzz= f;
- pm.worked(1);
- }
- }
- }
- return fuzz;
- } finally {
- pm.done();
- }
- }
-
- ICompareInput createInput(Hunk hunk) {
-
- String[] lines= hunk.fLines;
- StringBuffer left= new StringBuffer();
- StringBuffer right= new StringBuffer();
-
- for (int i= 0; i < lines.length; i++) {
- String line= lines[i];
- String rest= line.substring(1);
- switch (line.charAt(0)) {
- case ' ':
- left.append(rest);
- right.append(rest);
- break;
- case '-':
- left.append(rest);
- break;
- case '+':
- right.append(rest);
- break;
- }
- }
-
- Diff diff= hunk.fParent;
- IPath path= diff.getPath();
- String type= path.getFileExtension();
-
- return new DiffNode(new HunkInput(type, left.toString()), new HunkInput(type, right.toString()));
- }
-
- /**
- * Builds a tree from list of Diffs.
- * As a side effect it calculates the maximum number of segments
- * in all paths.
- */
- private void buildTree() {
- setPageComplete(true);
- if (fTree != null && !fTree.isDisposed()) {
- fTree.removeAll();
- fHunkViewer.setInput(null);
-
- int length= 99;
-
- Diff[] diffs= fPatchWizard.getPatcher().getDiffs();
- if (diffs != null) {
- for (int i= 0; i < diffs.length; i++) {
- Diff diff= diffs[i];
- TreeItem d= new TreeItem(fTree, SWT.NULL);
- d.setData(diff);
- d.setImage(getImage(diff));
-
- if (diff.fOldPath != null)
- length= Math.min(length, diff.fOldPath.segmentCount());
- if (diff.fNewPath != null)
- length= Math.min(length, diff.fNewPath.segmentCount());
-
- java.util.List hunks= diff.fHunks;
- java.util.Iterator iter= hunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- TreeItem h= new TreeItem(d, SWT.NULL);
- h.setData(hunk);
- h.setText(hunk.getDescription());
- }
- }
- }
- if (fStripPrefixSegments != null && length != 99)
- for (int i= 1; i < length; i++)
- fStripPrefixSegments.add(Integer.toString(i));
- }
-
- updateTree();
- }
-
- private IFile existsInSelection(IPath path) {
- IResource target= fPatchWizard.getTarget();
- if (target instanceof IFile) { // special case
- IFile file= (IFile) target;
- if (matches(file.getFullPath(), path))
- return file;
- } else if (target instanceof IContainer) {
- IContainer c= (IContainer) target;
- if (c.exists(path))
- return c.getFile(path);
- }
- return null;
- }
-
- /**
- * Returns true if path completely matches the end of fullpath
- */
- private boolean matches(IPath fullpath, IPath path) {
-
- for (IPath p= fullpath; path.segmentCount() <= p.segmentCount();
- p= p.removeFirstSegments(1)) {
- if (p.equals(path))
- return true;
- }
- return false;
- }
-
- /**
- * Updates label and checked state of tree items.
- */
- private void updateTree() {
- if (fTree == null || fTree.isDisposed())
- return;
- int strip= getStripPrefixSegments();
- TreeItem[] children= fTree.getItems();
- for (int i= 0; i < children.length; i++) {
- TreeItem item= children[i];
- Diff diff= (Diff) item.getData();
- diff.fMatches= false;
- String error= null;
-
- boolean create= false;
- IFile file= null;
- if (diff.getType() == Differencer.ADDITION) {
- IPath p= diff.fNewPath;
- if (strip > 0 && strip < p.segmentCount())
- p= p.removeFirstSegments(strip);
- file= existsInSelection(p);
- if (file == null) {
- diff.fMatches= true;
- } else {
- // file already exists
- error= PatchMessages.getString("PreviewPatchPage.FileExists.error"); //$NON-NLS-1$
- }
- create= true;
- } else {
- IPath p= diff.fOldPath;
- if (strip > 0 && strip < p.segmentCount())
- p= p.removeFirstSegments(strip);
- file= existsInSelection(p);
- diff.fMatches= false;
- if (file != null) {
- if (file.isReadOnly()) {
- // file is readonly
- error= PatchMessages.getString("PreviewPatchPage.FileIsReadOnly.error"); //$NON-NLS-1$
- file= null;
- } else {
- diff.fMatches= true;
- }
- } else {
- // file doesn't exist
- error= PatchMessages.getString("PreviewPatchPage.FileDoesNotExist.error"); //$NON-NLS-1$
- }
- }
-
- ArrayList failedHunks= new ArrayList();
- Patcher patcher= fPatchWizard.getPatcher();
- patcher.setFuzz(getFuzzFactor());
- patcher.apply(diff, file, create, failedHunks);
-
- if (failedHunks.size() > 0)
- diff.fRejected= fPatchWizard.getPatcher().getRejected(failedHunks);
-
- int checkedSubs= 0; // counts checked hunk items
- TreeItem[] hunkItems= item.getItems();
- for (int h= 0; h < hunkItems.length; h++) {
- Hunk hunk= (Hunk) hunkItems[h].getData();
- boolean failed= failedHunks.contains(hunk);
- String hunkError= null;
- if (failed)
- hunkError= PatchMessages.getString("PreviewPatchPage.NoMatch.error"); //$NON-NLS-1$
-
- boolean check= !failed;
- hunkItems[h].setChecked(check);
- if (check)
- checkedSubs++;
-
- String hunkLabel= hunk.getDescription();
- if (hunkError != null)
- hunkLabel+= " " + hunkError; //$NON-NLS-1$
- hunkItems[h].setText(hunkLabel);
- hunkItems[h].setImage(getImage(hunk));
- }
-
- String label= diff.getDescription(strip);
- if (error != null)
- label+= " " + error; //$NON-NLS-1$
- item.setText(label);
- item.setImage(getImage(diff));
- item.setChecked(checkedSubs > 0);
- boolean gray= (checkedSubs > 0 && checkedSubs < hunkItems.length);
- item.setGrayed(gray);
- item.setExpanded(gray);
- }
- setPageComplete(updateModel());
- }
-
- /**
- * Updates the gray state of the given diff and the checked state of its children.
- */
- private void updateCheckedState(TreeItem diffItem) {
- boolean checked= diffItem.getChecked();
- // check whether we can enable all hunks
- TreeItem[] hunks= diffItem.getItems();
- int checkedCount= 0;
- for (int i= 0; i < hunks.length; i++) {
- Hunk hunk= (Hunk) hunks[i].getData();
- if (checked) {
- if (hunk.fMatches) {
- hunks[i].setChecked(true);
- checkedCount++;
- }
- } else {
- hunks[i].setChecked(false);
- }
- }
- diffItem.setGrayed(checkedCount > 0 && checkedCount < hunks.length);
- diffItem.setChecked(checkedCount > 0);
-
- setPageComplete(updateModel());
- }
-
- /**
- * Updates the gray state of the given items parent.
- */
- private void updateGrayedState(TreeItem hunk) {
- TreeItem diff= hunk.getParentItem();
- TreeItem[] hunks= diff.getItems();
- int checked= 0;
- for (int i= 0; i < hunks.length; i++)
- if (hunks[i].getChecked())
- checked++;
- diff.setChecked(checked > 0);
- diff.setGrayed(checked > 0 && checked < hunks.length);
-
- setPageComplete(updateModel());
- }
-
- private void addSpacer(Composite parent) {
- Label label= new Label(parent, SWT.NONE);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint= 20;
- label.setLayoutData(gd);
- }
-
- private int getStripPrefixSegments() {
- int stripPrefixSegments= 0;
- if (fStripPrefixSegments != null) {
- String s= fStripPrefixSegments.getText();
- try {
- stripPrefixSegments= Integer.parseInt(s);
- } catch(NumberFormatException ex) {
- // silently ignored
- }
- }
- return stripPrefixSegments;
- }
-
- private int getFuzzFactor() {
- int fuzzFactor= 0;
- if (fFuzzField != null) {
- String s= fFuzzField.getText();
- try {
- fuzzFactor= Integer.parseInt(s);
- } catch(NumberFormatException ex) {
- // silently ignored
- }
- }
- return fuzzFactor;
- }
-
- public boolean updateModel() {
- boolean atLeastOneIsEnabled= false;
- if (fTree != null && !fTree.isDisposed()) {
- TreeItem [] diffItems= fTree.getItems();
- for (int i= 0; i < diffItems.length; i++) {
- TreeItem diffItem= diffItems[i];
- Object data= diffItem.getData();
- if (data instanceof Diff) {
- Diff diff= (Diff) data;
- boolean b= diffItem.getChecked();
- diff.setEnabled(b);
- if (b) {
- TreeItem [] hunkItems= diffItem.getItems();
- for (int j= 0; j < hunkItems.length; j++) {
- TreeItem hunkItem= hunkItems[j];
- data= hunkItem.getData();
- if (data instanceof Hunk) {
- Hunk hunk= (Hunk) data;
- b= hunkItem.getChecked();
- hunk.setEnabled(b);
- if (b) {
- atLeastOneIsEnabled= true;
- }
- }
- }
- }
- }
- }
- }
- return atLeastOneIsEnabled;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/package.html b/bundles/org.eclipse.compare/compare/org/eclipse/compare/package.html
deleted file mode 100644
index 1963dd462..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/package.html
+++ /dev/null
@@ -1,99 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for performing structural and textual
-compare operations on arbitrary data and displaying the results.
-<h2>
-Package Specification</h2>
-
-The class <b>CompareUI</b> defines the entry point to initiate a configurable
-compare operation on arbitrary resources. The result of the compare is
-opened into a compare editor where the details can be browsed and edited
-in dynamically selected structure and content viewers.
-<p>
-
-A compare operation must be implemented as a subclass of <b>CompareEditorInput</b>.
-A <b>CompareEditorInput</b> runs a (potentially lengthy) compare operation
-under progress monitor control, creates a UI for drilling-down into the
-compare results, tracks the dirty state of the result in case of merge,
-and saves any changes that occured during a merge.
-<p>
-
-The <b>NavigationAction</b> is used to navigate (step) through the individual
-differences of a <b>CompareEditorInput</b>.
-<p>
-
-An instance of <b>CompareConfiguration</b> configures various UI aspects
-of compare/merge viewers like title labels and images, or whether a side
-of a merge viewer is editable. It is passed to the <b>CompareEditorInput</b>
-on creation.
-<p>
-
-When implementing a hierarchical compare operation as a subclass of
-<b>CompareEditorInput</b> clients have to provide a tree of objects where each
-node implements the interface
-<b>org.eclipse.compare.structuremergeviewer.IStructureComparator</b>.
-This interface is used by the hierarchical differencing engine
-(<b>org.eclipse.compare.structuremergeviewer.Differencer</b>) to walk the tree.
-<br>
-In addition every leaf of the tree must implement the <b>IStreamContentAccessor</b>
-interface in order to give the differencing engine access to its stream content.
-<p>
-
-The abstract class <b>BufferedContent</b> provides a default implementation
-for the <b>IStreamContentAccessor</b> and <b>IContentChangeNotifier</b> interfaces.
-Its subclass <b>ResourceNode</b> adds an implementation for the
-<b>IStructureComparator</b> and <b>ITypedElement</b> interfaces
-based on Eclipse workbench resources (org.eclipse.core.resources.IResource).
-It can be used without modification as the input to the differencing engine.
-<p>
-
-The <b>ZipFileStructureCreator</b> is an implementation of the
-<b>org.eclipse.compare.structuremergeviewer.IStructureCreator</b> interface
-and makes the contents of a zip archive available as a
-hierarchical structure of <b>IStructureComparator</b>s which can be easily compared
-by the differencing engine (<b>org.eclipse.compare.structuremergeviewer.Differencer</b>).
-It is a good example for how to make structured files available to the hierarchical
-compare functionality of the Compare plugin.
-<p>
-
-The <b>EditionSelectionDialog</b> is a simple selection dialog where
-one input element can be compared against a list of historic variants (<i>editions</i>)
-of the same input element. The dialog can be used to implement functions
-like <i>"Replace with Version"</i> or <i>"Replace with Edition"</i> on workbench resources.
-<p>
-
-In addition it is possible to specify a subsection of the input element
-(e.g. a method in a Java source file) by means of a <i>path</i>. In this
-case the dialog compares only the subsection (as specified by the path)
-with the corresponding subsection in the list of editions. This functionality
-can be used to implement <i>"Replace with Method Edition"</i> for the Java
-language.
-<p>
-
-The <b>EditionSelectionDialog</b> requires that the editions implement
-the <b>IStreamContentAccessor</b> and <b>IModificationDate</b> interfaces.
-The <b>HistoryItem</b> is a convenience class that implements these interfaces
-for <b>IFileState</b> objects.
-<p>
-
-
-The <b>CompareViewerPane</b> is a convenience class which provides
-a label and local toolbar for a compare viewer (or any other subclass of a
-JFace <b>Viewer</b>).
-<br>
-Its abstract subclass <b>CompareViewerSwitchingPane</b> supports <i>dynamic
-viewer switching</i>, that is the viewer installed in the pane is dynamically
-determined by the pane's input object.
-Both classes are useful if you want to use compare viewers outside the context of
-a compare editor, for example in a dialog or wizard.
-
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java
deleted file mode 100644
index 3c4be7f87..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A custom iterator to iterate over a List of <code>RangeDifferences</code>.
- * It is used internally by the <code>RangeDifferencer</code>.
- */
-/* package */ class DifferencesIterator {
-
- List fRange;
- int fIndex;
- RangeDifference[] fArray;
- RangeDifference fDifference;
-
- /**
- * Creates a differences iterator on an array of <code>RangeDifference</code>s.
- */
- DifferencesIterator(RangeDifference[] differenceRanges) {
-
- fArray= differenceRanges;
- fIndex= 0;
- fRange= new ArrayList();
- if (fIndex < fArray.length)
- fDifference= fArray[fIndex++];
- else
- fDifference= null;
- }
-
- /**
- * Returns the number of RangeDifferences
- */
- int getCount() {
- return fRange.size();
- }
-
- /**
- * Appends the edit to its list and moves to the next <code>RangeDifference</code>.
- */
- void next() {
- fRange.add(fDifference);
- if (fDifference != null) {
- if (fIndex < fArray.length)
- fDifference= fArray[fIndex++];
- else
- fDifference= null;
- }
- }
-
- /**
- * Difference iterators are used in pairs.
- * This method returns the other iterator.
- */
- DifferencesIterator other(DifferencesIterator right, DifferencesIterator left) {
- if (this == right)
- return left;
- return right;
- }
-
- /**
- * Removes all <code>RangeDifference</code>s
- */
- void removeAll() {
- fRange.clear();
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java
deleted file mode 100644
index 70bd1d5e0..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-/**
- * For breaking an object to compare into a sequence of comparable entities.
- * <p>
- * It is used by <code>RangeDifferencer</code> to find longest sequences of
- * matching and non-matching ranges.
- * <p>
- * For example, to compare two text documents and find longest common sequences
- * of matching and non-matching lines, the implementation must break the document
- * into lines. <code>getRangeCount</code> would return the number of lines in the
- * document, and <code>rangesEqual</code> would compare a specified line given
- * with one in another <code>IRangeComparator</code>.
- * </p>
- * <p>
- * Clients should implement this interface; there is no standard implementation.
- * </p>
- */
-public interface IRangeComparator {
-
- /**
- * Returns the number of comparable entities.
- *
- * @return the number of comparable entities
- */
- int getRangeCount();
-
- /**
- * Returns whether the comparable entity given by the first index
- * matches an entity specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the index of the comparable entity within this <code>IRangeComparator</code>
- * @param other the IRangeComparator to compare this with
- * @param otherIndex the index of the comparable entity within the other <code>IRangeComparator</code>
- * @return <code>true</code> if the comparable entities are equal
- */
- boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex);
-
- /**
- * Returns whether a comparison should be skipped because it would be too costly (or lengthy).
- *
- * @param length a number on which to base the decision whether to return
- * <code>true</code> or <code>false</code>
- * @param maxLength another number on which to base the decision whether to return
- * <code>true</code> or <code>false</code>
- * @param other the other <code>IRangeComparator</code> to compare with
- * @return <code>true</code> to avoid a too lengthy range comparison
- */
- boolean skipRangeComparison(int length, int maxLength, IRangeComparator other);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java
deleted file mode 100644
index cd9ef08e7..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-/* package */ class LinkedRangeDifference extends RangeDifference {
-
- static final int INSERT= 0;
- static final int DELETE= 1;
-
- LinkedRangeDifference fNext;
-
- /**
- * Creates a LinkedRangeDifference an initializes it to the error state
- */
- LinkedRangeDifference() {
- super(ERROR);
- fNext= null;
- }
-
- /**
- * Constructs and links a LinkeRangeDifference to another LinkedRangeDifference
- */
- LinkedRangeDifference(LinkedRangeDifference next, int operation) {
- super(operation);
- fNext= next;
- }
-
- /**
- * Follows the next link
- */
- LinkedRangeDifference getNext() {
- return fNext;
- }
-
- boolean isDelete() {
- return kind() == DELETE;
- }
-
- boolean isInsert() {
- return kind() == INSERT;
- }
-
- /**
- * Sets the next link of this LinkedRangeDifference
- */
- void setNext(LinkedRangeDifference next) {
- fNext= next;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java
deleted file mode 100644
index 9a8b15d50..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-/**
- * Description of a change between two or three ranges of comparable entities.
- * <p>
- * <code>RangeDifference</code> objects are the elements of a compare result returned from
- * the <code>RangeDifferencer</code> <code>find* </code> methods.
- * Clients use these objects as they are returned from the differencer.
- * This class is not intended to be instantiated or subclassed.
- * <p>
- * Note: A range in the <code>RangeDifference</code> object is given as a start index
- * and length in terms of comparable entities. However, these entity indices and counts
- * are not necessarily character positions. For example, if an entity represents a line
- * in a document, the start index would be a line number and the count would be in lines.
- * </p>
- *
- * @see RangeDifferencer
- */
-public class RangeDifference {
-
- /** Two-way change constant indicating no change. */
- public final static int NOCHANGE= 0;
- /** Two-way change constant indicating two-way change (same as <code>RIGHT</code>) */
- public final static int CHANGE= 2;
-
- /** Three-way change constant indicating a change in both right and left. */
- public final static int CONFLICT= 1;
- /** Three-way change constant indicating a change in right. */
- public final static int RIGHT= 2;
- /** Three-way change constant indicating a change in left. */
- public final static int LEFT= 3;
- /**
- * Three-way change constant indicating the same change in both right and left,
- * that is only the ancestor is different.
- */
- public final static int ANCESTOR= 4;
-
- /** Constant indicating an unknown change kind. */
- public final static int ERROR= 5;
-
- /** the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR */
- int fKind;
-
- int fLeftStart;
- int fLeftLength;
- int fRightStart;
- int fRightLength;
- int lAncestorStart;
- int lAncestorLength;
-
- /**
- * Creates a new range difference with the given change kind.
- *
- * @param changeKind the kind of change
- */
- /* package */ RangeDifference(int changeKind) {
- fKind= changeKind;
- }
-
- /**
- * Creates a new <code>RangeDifference</code> with the given change kind
- * and left and right ranges.
- *
- * @param changeKind the kind of change
- * @param rightStart start index of entity on right side
- * @param rightLength number of entities on right side
- * @param leftStart start index of entity on left side
- * @param leftLength number of entities on left side
- */
- /* package */ RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength) {
- fKind= kind;
- fRightStart= rightStart;
- fRightLength= rightLength;
- fLeftStart= leftStart;
- fLeftLength= leftLength;
- }
-
- /**
- * Creates a new <code>RangeDifference</code> with the given change kind
- * and left, right, and ancestor ranges.
- *
- * @param changeKind the kind of change
- * @param rightStart start index of entity on right side
- * @param rightLength number of entities on right side
- * @param leftStart start index of entity on left side
- * @param leftLength number of entities on left side
- * @param ancestorStart start index of entity on ancestor side
- * @param ancestorLength number of entities on ancestor side
- */
- /* package */ RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength,
- int ancestorStart, int ancestorLength) {
- this(kind, rightStart, rightLength, leftStart, leftLength);
- lAncestorStart= ancestorStart;
- lAncestorLength= ancestorLength;
- }
-
- /**
- * Returns the kind of difference.
- *
- * @return the kind of difference, one of
- * <code>NOCHANGE</code>, <code>CHANGE</code>, <code>LEFT</code>, <code>RIGHT</code>,
- * <code>ANCESTOR</code>, <code>CONFLICT</code>, <code>ERROR</code>
- */
- public int kind() {
- return fKind;
- }
-
- /**
- * Returns the start index of the entity range on the ancestor side.
- *
- * @return the start index of the entity range on the ancestor side
- */
- public int ancestorStart() {
- return lAncestorStart;
- }
-
- /**
- * Returns the number of entities on the ancestor side.
- *
- * @return the number of entities on the ancestor side
- */
- public int ancestorLength() {
- return lAncestorLength;
- }
-
- /**
- * Returns the end index of the entity range on the ancestor side.
- *
- * @return the end index of the entity range on the ancestor side
- */
- public int ancestorEnd() {
- return lAncestorStart + lAncestorLength;
- }
-
- /**
- * Returns the start index of the entity range on the right side.
- *
- * @return the start index of the entity range on the right side
- */
- public int rightStart() {
- return fRightStart;
- }
-
- /**
- * Returns the number of entities on the right side.
- *
- * @return the number of entities on the right side
- */
- public int rightLength() {
- return fRightLength;
- }
-
- /**
- * Returns the end index of the entity range on the right side.
- *
- * @return the end index of the entity range on the right side
- */
- public int rightEnd() {
- return fRightStart + fRightLength;
- }
-
- /**
- * Returns the start index of the entity range on the left side.
- *
- * @return the start index of the entity range on the left side
- */
- public int leftStart() {
- return fLeftStart;
- }
-
- /**
- * Returns the number of entities on the left side.
- *
- * @return the number of entities on the left side
- */
- public int leftLength() {
- return fLeftLength;
- }
-
- /**
- * Returns the end index of the entity range on the left side.
- *
- * @return the end index of the entity range on the left side
- */
- public int leftEnd() {
- return fLeftStart + fLeftLength;
- }
-
- /**
- * Returns the maximum number of entities in the left, right, and ancestor sides of this range.
- *
- * @return the maximum number of entities in the left, right, and ancestor sides of this range
- */
- public int maxLength() {
- return Math.max(fRightLength, Math.max(fLeftLength, lAncestorLength));
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
deleted file mode 100644
index 5c0b051b3..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A <code>RangeDifferencer</code> finds the differences between two or three <code>IRangeComparator</code>s.
- * <p>
- * To use the differencer, clients provide an <code>IRangeComparator</code>
- * that breaks their input data into a sequence of comparable entities. The differencer
- * returns the differences among these sequences as an array of <code>RangeDifference</code> objects
- * (<code>findDifferences</code> methods).
- * Every <code>RangeDifference</code> represents a single kind of difference
- * and the corresponding ranges of the underlying comparable entities in the
- * left, right, and optionally ancestor sides.
- * <p>
- * Alternatively, the <code>findRanges</code> methods not only return objects for
- * the differing ranges but for non-differing ranges too.
- * <p>
- * The algorithm used is an objectified version of one described in:
- * <it>A File Comparison Program,</it> by Webb Miller and Eugene W. Myers,
- * Software Practice and Experience, Vol. 15, Nov. 1985.
- *
- * @see IRangeComparator
- * @see RangeDifference
- */
-public final class RangeDifferencer {
-
- private static final RangeDifference[] EMPTY_RESULT= new RangeDifference[0];
-
- /* (non Javadoc)
- * Non instantiatiable!
- */
- private RangeDifferencer() {
- }
-
- /**
- * Finds the differences between two <code>IRangeComparator</code>s.
- * The differences are returned as an array of <code>RangeDifference</code>s.
- * If no differences are detected an empty array is returned.
- *
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- */
- public static RangeDifference[] findDifferences(IRangeComparator left, IRangeComparator right) {
- return findDifferences((IProgressMonitor)null, left, right);
- }
-
- /**
- * Finds the differences between two <code>IRangeComparator</code>s.
- * The differences are returned as an array of <code>RangeDifference</code>s.
- * If no differences are detected an empty array is returned.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- * @since 2.0
- */
- public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) {
-
- // assert that both IRangeComparators are of the same class
- Assert.isTrue(right.getClass().equals(left.getClass()));
-
- int rightSize= right.getRangeCount();
- int leftSize= left.getRangeCount();
- //
- // Differences matrix:
- // only the last d of each diagonal is stored, i.e., lastDiagonal[k] = row of d
- //
- int diagLen= 2 * Math.max(rightSize, leftSize); // bound on the size of edit script
- int maxDiagonal= diagLen;
- int lastDiagonal[]= new int[diagLen + 1]; // the row containing the last d
- // on diagonal k (lastDiagonal[k] = row)
- int origin= diagLen / 2; // origin of diagonal 0
-
- // script corresponding to d[k]
- LinkedRangeDifference script[]= new LinkedRangeDifference[diagLen + 1];
- int row, col;
-
- // find common prefix
- for (row= 0; row < rightSize && row < leftSize && rangesEqual(right, row, left, row) == true; ++row)
- ;
-
- lastDiagonal[origin]= row;
- script[origin]= null;
- int lower= (row == rightSize) ? origin + 1 : origin - 1;
- int upper= (row == leftSize) ? origin - 1 : origin + 1;
-
- if (lower > upper)
- return EMPTY_RESULT;
-
- //System.out.println("findDifferences: " + maxDiagonal + " " + lower + " " + upper);
-
- // for each value of the edit distance
- for (int d= 1; d <= maxDiagonal; ++d) { // d is the current edit distance
-
- if (pm != null)
- pm.worked(1);
-
- if (right.skipRangeComparison(d, maxDiagonal, left))
- return EMPTY_RESULT; // should be something we already found
-
- // for each relevant diagonal (-d, -d+2 ..., d-2, d)
- for (int k= lower; k <= upper; k += 2) { // k is the current diagonal
- LinkedRangeDifference edit;
-
- if (pm != null && pm.isCanceled())
- return EMPTY_RESULT;
-
- if (k == origin - d || k != origin + d && lastDiagonal[k + 1] >= lastDiagonal[k - 1]) {
- //
- // move down
- //
- row= lastDiagonal[k + 1] + 1;
- edit= new LinkedRangeDifference(script[k + 1], LinkedRangeDifference.DELETE);
- } else {
- //
- // move right
- //
- row= lastDiagonal[k - 1];
- edit= new LinkedRangeDifference(script[k - 1], LinkedRangeDifference.INSERT);
- }
- col= row + k - origin;
- edit.fRightStart= row;
- edit.fLeftStart= col;
- Assert.isTrue(k >= 0 && k <= maxDiagonal);
- script[k]= edit;
-
- // slide down the diagonal as far as possible
- while (row < rightSize && col < leftSize && rangesEqual(right, row, left, col) == true) {
- ++row;
- ++col;
- }
-
- Assert.isTrue(k >= 0 && k <= maxDiagonal); // Unreasonable value for diagonal index
- lastDiagonal[k]= row;
-
- if (row == rightSize && col == leftSize) {
- //showScript(script[k], right, left);
- return createDifferencesRanges(script[k]);
- }
- if (row == rightSize)
- lower= k + 2;
- if (col == leftSize)
- upper= k - 2;
- }
- --lower;
- ++upper;
- }
- // too many differences
- Assert.isTrue(false);
- return null;
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * The differences are returned as a list of <code>RangeDifference</code>s.
- * If no differences are detected an empty list is returned.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- */
- public static RangeDifference[] findDifferences(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
- return findDifferences(null, ancestor, left, right);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * The differences are returned as a list of <code>RangeDifference</code>s.
- * If no differences are detected an empty list is returned.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- * @since 2.0
- */
- public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
-
- if (ancestor == null)
- return findDifferences(pm, left, right);
-
- RangeDifference[] leftAncestorScript= null;
- RangeDifference[] rightAncestorScript= findDifferences(pm, ancestor, right);
- if (rightAncestorScript != null)
- leftAncestorScript= findDifferences(pm, ancestor, left);
- if (rightAncestorScript == null || leftAncestorScript == null)
- return null;
-
- DifferencesIterator myIter= new DifferencesIterator(rightAncestorScript);
- DifferencesIterator yourIter= new DifferencesIterator(leftAncestorScript);
-
- List diff3= new ArrayList();
- diff3.add(new RangeDifference(RangeDifference.ERROR)); // add a sentinel
-
- int changeRangeStart= 0;
- int changeRangeEnd= 0;
- //
- // Combine the two two-way edit scripts into one
- //
- while (myIter.fDifference != null || yourIter.fDifference != null) {
-
- DifferencesIterator startThread;
- myIter.removeAll();
- yourIter.removeAll();
- //
- // take the next diff that is closer to the start
- //
- if (myIter.fDifference == null)
- startThread= yourIter;
- else if (yourIter.fDifference == null)
- startThread= myIter;
- else { // not at end of both scripts take the lowest range
- if (myIter.fDifference.fLeftStart <= yourIter.fDifference.fLeftStart) // 2 -> common (Ancestor) change range
- startThread= myIter;
- else
- startThread= yourIter;
- }
- changeRangeStart= startThread.fDifference.fLeftStart;
- changeRangeEnd= startThread.fDifference.leftEnd();
-
- startThread.next();
- //
- // check for overlapping changes with other thread
- // merge overlapping changes with this range
- //
- DifferencesIterator other= startThread.other(myIter, yourIter);
- while (other.fDifference != null && other.fDifference.fLeftStart <= changeRangeEnd) {
- int newMax= other.fDifference.leftEnd();
- other.next();
- if (newMax >= changeRangeEnd) {
- changeRangeEnd= newMax;
- other= other.other(myIter, yourIter);
- }
- }
- diff3.add(createRangeDifference3(myIter, yourIter, diff3, right, left, changeRangeStart, changeRangeEnd));
- }
-
- // remove sentinel
- diff3.remove(0);
- return (RangeDifference[]) diff3.toArray(EMPTY_RESULT);
- }
-
- /**
- * Finds the differences among two <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- *
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- */
- public static RangeDifference[] findRanges(IRangeComparator left, IRangeComparator right) {
- return findRanges((IProgressMonitor)null, left, right);
- }
-
- /**
- * Finds the differences among two <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- * @since 2.0
- */
- public static RangeDifference[] findRanges(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) {
- RangeDifference[] in= findDifferences(pm, left, right);
- List out= new ArrayList();
-
- RangeDifference rd;
-
- int mstart= 0;
- int ystart= 0;
-
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart);
- if (rd.maxLength() != 0)
- out.add(rd);
-
- out.add(es);
-
- mstart= es.rightEnd();
- ystart= es.leftEnd();
- }
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- return (RangeDifference[]) out.toArray(EMPTY_RESULT);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- */
- public static RangeDifference[] findRanges(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
- return findRanges(null, ancestor, left, right);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- * @since 2.0
- */
- public static RangeDifference[] findRanges(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
-
- if (ancestor == null)
- return findRanges(pm, left, right);
-
- RangeDifference[] in= findDifferences(pm, ancestor, left, right);
- List out= new ArrayList();
-
- RangeDifference rd;
-
- int mstart= 0;
- int ystart= 0;
- int astart= 0;
-
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart, astart, es.ancestorStart() - astart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- out.add(es);
-
- mstart= es.rightEnd();
- ystart= es.leftEnd();
- astart= es.ancestorEnd();
- }
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart, astart, ancestor.getRangeCount() - astart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- return (RangeDifference[]) out.toArray(EMPTY_RESULT);
- }
-
- //---- private methods
-
- /**
- * Creates a Vector of DifferencesRanges out of the LinkedRangeDifference.
- * It coalesces adjacent changes.
- * In addition, indices are changed such that the ranges are 1) open, i.e,
- * the end of the range is not included, and 2) are zero based.
- */
- private static RangeDifference[] createDifferencesRanges(LinkedRangeDifference start) {
-
- LinkedRangeDifference ep= reverseDifferences(start);
- ArrayList result= new ArrayList();
- RangeDifference es= null;
-
- while (ep != null) {
- es= new RangeDifference(RangeDifference.CHANGE);
-
- if (ep.isInsert()) {
- es.fRightStart= ep.fRightStart + 1;
- es.fLeftStart= ep.fLeftStart;
- RangeDifference b= ep;
- do {
- ep= ep.getNext();
- es.fLeftLength++;
- } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart);
- } else {
- es.fRightStart= ep.fRightStart;
- es.fLeftStart= ep.fLeftStart;
-
- RangeDifference a= ep;
- //
- // deleted lines
- //
- do {
- a= ep;
- ep= ep.getNext();
- es.fRightLength++;
- } while (ep != null && ep.isDelete() && ep.fRightStart == a.fRightStart + 1);
-
- boolean change= (ep != null && ep.isInsert() && ep.fRightStart == a.fRightStart);
-
- if (change) {
- RangeDifference b= ep;
- //
- // replacement lines
- //
- do {
- ep= ep.getNext();
- es.fLeftLength++;
- } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart);
- } else {
- es.fLeftLength= 0;
- }
- es.fLeftStart++; // meaning of range changes from "insert after", to "replace with"
-
- }
- //
- // the script commands are 1 based, subtract one to make them zero based
- //
- es.fRightStart--;
- es.fLeftStart--;
- result.add(es);
- }
- return (RangeDifference[]) result.toArray(EMPTY_RESULT);
- }
-
- /**
- * Creates a <code>RangeDifference3</code> given the
- * state of two DifferenceIterators.
- */
- private static RangeDifference createRangeDifference3(
- DifferencesIterator myIter,
- DifferencesIterator yourIter,
- List diff3,
- IRangeComparator right,
- IRangeComparator left,
- int changeRangeStart,
- int changeRangeEnd) {
-
- int rightStart, rightEnd;
- int leftStart, leftEnd;
- int kind= RangeDifference.ERROR;
- RangeDifference last= (RangeDifference) diff3.get(diff3.size() - 1);
-
- Assert.isTrue((myIter.getCount() != 0 || yourIter.getCount() != 0)); // At least one range array must be non-empty
- //
- // find corresponding lines to fChangeRangeStart/End in right and left
- //
- if (myIter.getCount() == 0) { // only left changed
- rightStart= changeRangeStart - last.ancestorEnd() + last.rightEnd();
- rightEnd= changeRangeEnd - last.ancestorEnd() + last.rightEnd();
- kind= RangeDifference.LEFT;
- } else {
- RangeDifference f= (RangeDifference) myIter.fRange.get(0);
- RangeDifference l= (RangeDifference) myIter.fRange.get(myIter.fRange.size() - 1);
- rightStart= changeRangeStart - f.fLeftStart + f.fRightStart;
- rightEnd= changeRangeEnd - l.leftEnd() + l.rightEnd();
- }
-
- if (yourIter.getCount() == 0) { // only right changed
- leftStart= changeRangeStart - last.ancestorEnd() + last.leftEnd();
- leftEnd= changeRangeEnd - last.ancestorEnd() + last.leftEnd();
- kind= RangeDifference.RIGHT;
- } else {
- RangeDifference f= (RangeDifference) yourIter.fRange.get(0);
- RangeDifference l= (RangeDifference) yourIter.fRange.get(yourIter.fRange.size() - 1);
- leftStart= changeRangeStart - f.fLeftStart + f.fRightStart;
- leftEnd= changeRangeEnd - l.leftEnd() + l.rightEnd();
- }
-
- if (kind == RangeDifference.ERROR) { // overlapping change (conflict) -> compare the changed ranges
- if (rangeSpansEqual(right, rightStart, rightEnd - rightStart, left, leftStart, leftEnd - leftStart))
- kind= RangeDifference.ANCESTOR;
- else
- kind= RangeDifference.CONFLICT;
- }
- return new RangeDifference(kind, rightStart, rightEnd - rightStart, leftStart, leftEnd - leftStart, changeRangeStart, changeRangeEnd - changeRangeStart);
- }
-
- /**
- * Tests if two ranges are equal
- */
- private static boolean rangesEqual(IRangeComparator a, int ai, IRangeComparator b, int bi) {
- return a.rangesEqual(ai, b, bi);
- }
-
- /**
- * Tests whether <code>right</code> and <code>left</left> changed in the same way
- */
- private static boolean rangeSpansEqual(IRangeComparator right, int rightStart, int rightLen, IRangeComparator left, int leftStart, int leftLen) {
- if (rightLen == leftLen) {
- int i= 0;
- for (i= 0; i < rightLen; i++) {
- if (!rangesEqual(right, rightStart + i, left, leftStart + i))
- break;
- }
- if (i == rightLen)
- return true;
- }
- return false;
- }
-
- /**
- * Reverses the range differences
- */
- private static LinkedRangeDifference reverseDifferences(LinkedRangeDifference start) {
- LinkedRangeDifference ep, behind, ahead;
-
- ahead= start;
- ep= null;
- while (ahead != null) {
- behind= ep;
- ep= ahead;
- ahead= ahead.getNext();
- ep.setNext(behind);
- }
- return ep;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html
deleted file mode 100644
index 368068b3b..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html
+++ /dev/null
@@ -1,44 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for finding the differences between
-two or three sequences of comparable entities.
-<h2>
-Package Specification</h2>
-
-The class <b>RangeDifferencer</b> finds longest sequences of matching and
-non-matching comparable entities. Its implementation is based on
-an objectified version of the algorithm described in:
-<i>A File Comparison Program,</i> by Webb Miller and Eugene W. Myers,
-Software Practice and Experience, Vol. 15, Nov. 1985.
-<p>
-
-Clients must supply the input to the differencer as an implementation
-of the <b>IRangeComparator</b> interface.
-An <b>IRangeComparator</b> breaks the input data into a sequence
-of entities and provides a method for comparing
-one entity with the entity in another <b>IRangeComparator</b>.
-<p>
-
-For example, to compare two text documents and find longest common
-sequences of matching and non-matching lines,
-the implementation of <b>IRangeComparator</b>
-must break the document into lines and provide a method for testing
-whether two lines are considered equal.
-See <b>org.eclipse.compare.internal.DocLineComparator</b> for how this can be done.
-<p>
-
-The differencer returns the differences among these sequences as an
-array of <b>RangeDifference</b> objects.
-Every single <b>RangeDifference</b> describes the kind of difference
-(no change, change, addition, deletion) and the corresponding ranges
-of the underlying comparable entities in the two or three inputs.
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
deleted file mode 100644
index 4a3d44c4c..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.util.ArrayList;
-
-/**
- * The standard implementation of a diff container element.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- */
-public abstract class DiffContainer extends DiffElement implements IDiffContainer {
-
- private static IDiffElement[] fgEmptyArray= new IDiffElement[0];
- private ArrayList fChildren;
-
- /**
- * Creates a new container with the specified kind under the given parent.
- *
- * @param parent under which the new container is added as a child or <code>null</code>.
- * @param name of the container
- * @param kind of difference (defined in <code>Differencer</code>).
- */
- public DiffContainer(IDiffContainer parent, int kind) {
- super(parent, kind);
- }
-
- /**
- * Tries to find the child with the given name.
- * Returns <code>null</code> if no such child exists.
- *
- * @param name of the child to find
- * @return the first element with a matching name
- */
- public IDiffElement findChild(String name) {
- Object[] children= getChildren();
- for (int i= 0; i < children.length; i++) {
- IDiffElement child= (IDiffElement) children[i];
- if (name.equals(child.getName()))
- return child;
- }
- return null;
- }
-
- /* (non Javadoc)
- * see IDiffContainer.add
- */
- public void add(IDiffElement diff) {
- if (fChildren == null)
- fChildren= new ArrayList();
- fChildren.add(diff);
- diff.setParent(this);
- }
-
- /**
- * Removes the given child from this container.
- * If the container becomes empty it is removed from its container.
- */
- /* (non Javadoc)
- * see IDiffContainer.removeToRoot
- */
- public void removeToRoot(IDiffElement child) {
- if (fChildren != null) {
- fChildren.remove(child);
- child.setParent(null);
- if (fChildren.size() == 0) {
- IDiffContainer p= getParent();
- if (p != null)
- p.removeToRoot(this);
- }
- }
- }
-
- /**
- * Removes the given child (non-recursively) from this container.
- *
- * @param child to remove
- */
- public void remove(IDiffElement child) {
- if (fChildren != null) {
- fChildren.remove(child);
- child.setParent(null);
- }
- }
-
- /* (non Javadoc)
- * see IDiffContainer.hasChildren
- */
- public boolean hasChildren() {
- return fChildren != null && fChildren.size() > 0;
- }
-
- /* (non Javadoc)
- * see IDiffContainer.getChildren
- */
- public IDiffElement[] getChildren() {
- if (fChildren != null)
- return (IDiffElement[]) fChildren.toArray(fgEmptyArray);
- return fgEmptyArray;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java
deleted file mode 100644
index 82472ff92..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.compare.ITypedElement;
-
-/**
- * An abstract base implementation of the <code>IDiffElement</code> interface.
- * <p>
- * Subclasses may add behavior and state, and may override <code>getImage</code>
- * and <code>getType</code> to suit.
- * </p>
- */
-public abstract class DiffElement implements IDiffElement {
-
- private int fKind;
- private IDiffContainer fParent;
-
- /**
- * Creates a new <code>DiffElement</code> as a child of the given parent.
- * If parent is not <code>null</code> the new element is added to the parent.
- *
- * @param parent the parent of this child; if not <code>null</code> this element is automatically added as a child
- * @param kind the kind of change
- */
- public DiffElement(IDiffContainer parent, int kind) {
- fParent= parent;
- fKind= kind;
- if (parent != null)
- parent.add(this);
- }
-
- /**
- * The <code>DiffElement</code> implementation of this <code>ITypedInput</code>
- * method returns <code>null</code>. Subclasses may re-implement to provide
- * an image for this element.
- */
- public Image getImage() {
- return null;
- }
-
- /**
- * The <code>DiffElement</code> implementation of this <code>ITypedElement</code>
- * method returns <code>ITypedElement.UNKNOWN_TYPE</code>. Subclasses may
- * re-implement to provide a type for this element.
- */
- public String getType() {
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- /**
- * Sets the kind of difference for this element.
- *
- * @param kind set the kind of difference this element represents
- * @see Differencer
- */
- public void setKind(int kind) {
- fKind= kind;
- }
-
- /* (non Javadoc)
- * see IDiffElement.getKind
- */
- public int getKind() {
- return fKind;
- }
-
- /* (non Javadoc)
- * see IDiffElement.getParent
- */
- public IDiffContainer getParent() {
- return fParent;
- }
-
- /* (non Javadoc)
- * see IDiffElement.setParent
- */
- public void setParent(IDiffContainer parent) {
- fParent= parent;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
deleted file mode 100644
index 7c73a6cc2..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.text.MessageFormat;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.util.ListenerList;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.Utilities;
-
-/**
- * Diff node are used as the compare result of the differencing engine.
- * Since it implements the <code>ITypedElement</code> and <code>ICompareInput</code>
- * interfaces it can be used directly to display the
- * compare result in a <code>DiffTreeViewer</code> and as the input to any other
- * compare/merge viewer.
- * <p>
- * <code>DiffNode</code>s are typically created as the result of performing
- * a compare with the <code>Differencer</code>.
- * <p>
- * Clients typically use this class as is, but may subclass if required.
- *
- * @see DiffTreeViewer
- * @see Differencer
- */
-public class DiffNode extends DiffContainer implements ITypedElement, ICompareInput {
-
- private ITypedElement fAncestor;
- private ITypedElement fLeft;
- private ITypedElement fRight;
- private boolean fDontExpand;
- private ListenerList fListener;
- private boolean fSwapSides;
-
-
- /**
- * Creates a new <code>DiffNode</code> and initializes with the given values.
- *
- * @param parent under which the new container is added as a child or <code>null</code>
- * @param kind of difference (defined in <code>Differencer</code>)
- * @param ancestor the common ancestor input to a compare
- * @param left the left input to a compare
- * @param right the right input to a compare
- */
- public DiffNode(IDiffContainer parent, int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- this(parent, kind);
- fAncestor= ancestor;
- fLeft= left;
- fRight= right;
- }
-
- /**
- * Creates a new <code>DiffNode</code> with diff kind <code>Differencer.CHANGE</code>
- * and initializes with the given values.
- *
- * @param left the left input to a compare
- * @param right the right input to a compare
- */
- public DiffNode(ITypedElement left, ITypedElement right) {
- this(null, Differencer.CHANGE, null, left, right);
- }
-
- /**
- * Creates a new <code>DiffNode</code> and initializes with the given values.
- *
- * @param kind of difference (defined in <code>Differencer</code>)
- * @param ancestor the common ancestor input to a compare
- * @param left the left input to a compare
- * @param right the right input to a compare
- */
- public DiffNode(int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- this(null, kind, ancestor, left, right);
- }
-
- /**
- * Creates a new <code>DiffNode</code> with the given diff kind.
- *
- * @param kind of difference (defined in <code>Differencer</code>)
- */
- public DiffNode(int kind) {
- super(null, kind);
- }
-
- /**
- * Creates a new <code>DiffNode</code> and initializes with the given values.
- *
- * @param parent under which the new container is added as a child or <code>null</code>
- * @param kind of difference (defined in <code>Differencer</code>)
- */
- public DiffNode(IDiffContainer parent, int kind) {
- super(parent, kind);
- }
-
- /**
- * Registers a listener for changes of this <code>ICompareInput</code>.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to add
- */
- public void addCompareInputChangeListener(ICompareInputChangeListener listener) {
- if (fListener == null)
- fListener= new ListenerList();
- fListener.add(listener);
- }
-
- /**
- * Unregisters a <code>ICompareInput</code> listener.
- * Has no effect if listener is not registered.
- *
- * @param listener the listener to remove
- */
- public void removeCompareInputChangeListener(ICompareInputChangeListener listener) {
- if (fListener != null) {
- fListener.remove(listener);
- if (fListener.isEmpty())
- fListener= null;
- }
- }
-
- /**
- * Sends out notification that a change has occured on the <code>ICompareInput</code>.
- */
- protected void fireChange() {
- if (fListener != null) {
- Object[] listeners= fListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((ICompareInputChangeListener) listeners[i]).compareInputChanged(this);
- }
- }
-
- //---- getters & setters
-
- /**
- * Returns <code>true</code> if this node shouldn't automatically be expanded in
- * a </code>DiffTreeViewer</code>.
- *
- * @return <code>true</code> if node shouldn't automatically be expanded
- */
- public boolean dontExpand() {
- return fDontExpand;
- }
-
- /**
- * Controls whether this node is not automatically expanded when displayed in
- * a </code>DiffTreeViewer</code>.
- *
- * @param dontExpand if <code>true</code> this node is not automatically expanded in </code>DiffTreeViewer</code>
- */
- public void setDontExpand(boolean dontExpand) {
- fDontExpand= dontExpand;
- }
-
- /**
- * Returns the first not-<code>null</code> input of this node.
- * Method checks the three inputs in the order: ancestor, right, left.
- *
- * @return the first not-<code>null</code> input of this node
- */
- public ITypedElement getId() {
- if (fAncestor != null)
- return fAncestor;
- if (fRight != null)
- return fRight;
- return fLeft;
- }
-
- /**
- * Returns the (non-<code>null</code>) name of the left or right side if they are identical.
- * Otherwise both names are concatenated (separated with a slash ('/')).
- * <p>
- * Subclasses may re-implement to provide a different name for this node.
- */
- /* (non Javadoc)
- * see ITypedElement.getName
- */
- public String getName() {
- String right= null;
- if (fRight != null)
- right= fRight.getName();
-
- String left= null;
- if (fLeft != null)
- left= fLeft.getName();
-
- if (right == null && left == null) {
- if (fAncestor != null)
- return fAncestor.getName();
- return Utilities.getString("DiffNode.noName"); //$NON-NLS-1$
- }
-
- if (right == null)
- return left;
- if (left == null)
- return right;
-
- if (right.equals(left))
- return right;
-
- String s1;
- String s2;
-
- if (fSwapSides) {
- s1= left;
- s2= right;
- } else {
- s1= right;
- s2= left;
- }
-
- String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
- return MessageFormat.format(fmt, new String[] { s1, s2 });
- }
-
- void swapSides(boolean swap) {
- fSwapSides= swap;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getImage
- */
- public Image getImage() {
- ITypedElement id= getId();
- if (id != null)
- return id.getImage();
- return null;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getType
- */
- public String getType() {
- ITypedElement id= getId();
- if (id != null)
- return id.getType();
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- /* (non Javadoc)
- * see ICompareInput.getAncestor
- */
- public ITypedElement getAncestor() {
- return fAncestor;
- }
-
- /**
- * Sets the left input to the given value.
- *
- * @param left the new value for the left input
- */
- public void setLeft(ITypedElement left) {
- fLeft= left;
- }
-
- /* (non Javadoc)
- * see ICompareInput.getLeft
- */
- public ITypedElement getLeft() {
- return fLeft;
- }
-
- /**
- * Sets the right input to the given value.
- *
- * @param right the new value for the right input
- */
- public void setRight(ITypedElement right) {
- fRight= right;
- }
-
- /* (non Javadoc)
- * see ICompareInput.getRight
- */
- public ITypedElement getRight() {
- return fRight;
- }
-
- /* (non Javadoc)
- * see ICompareInput.copy
- */
- public void copy(boolean leftToRight) {
- //System.out.println("DiffNode.copy: " + leftToRight);
-
- IDiffContainer pa= getParent();
- if (pa instanceof ICompareInput) {
- ICompareInput parent= (ICompareInput) pa;
- Object dstParent= leftToRight ? parent.getRight() : parent.getLeft();
-
- if (dstParent instanceof IEditableContent) {
- ITypedElement dst= leftToRight ? getRight() : getLeft();
- ITypedElement src= leftToRight ? getLeft() : getRight();
- dst= ((IEditableContent)dstParent).replace(dst, src);
- if (leftToRight)
- setRight(dst);
- else
- setLeft(dst);
-
- //setKind(Differencer.NO_CHANGE);
-
- fireChange();
- }
- }
- }
-
- /* (non Javadoc)
- * see Object.hashCode
- */
- public int hashCode() {
- String[] path= getPath(this, 0);
- int hashCode= 1;
- for (int i= 0; i < path.length; i++) {
- String s= path[i];
- hashCode= (31*hashCode) + (s != null ? s.hashCode() : 0);
- }
- return hashCode;
- }
-
- /* (non Javadoc)
- * see Object.equals
- */
- public boolean equals(Object other) {
- if (other != null && getClass() == other.getClass()) {
- String[] path1= getPath(this, 0);
- String[] path2= getPath((DiffNode) other, 0);
- if (path1.length != path2.length)
- return false;
- for (int i= 0; i < path1.length; i++)
- if (! path1[i].equals(path2[i]))
- return false;
- return true;
- }
- return super.equals(other);
- }
-
- private static String[] getPath(ITypedElement el, int level) {
- String[] path= null;
- if (el instanceof IDiffContainer) {
- IDiffContainer parent= ((IDiffContainer)el).getParent();
- if (parent instanceof ITypedElement)
- path= getPath(parent, level+1);
- }
- if (path == null)
- path= new String[level+1];
- path[(path.length-1)-level]= el.getName();
- return path;
- }
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
deleted file mode 100644
index 9cccaa478..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ /dev/null
@@ -1,719 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.util.Iterator;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.*;
-
-/**
- * A tree viewer that works on objects implementing
- * the <code>IDiffContainer</code> and <code>IDiffElement</code> interfaces.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed outside
- * this package.
- * </p>
- *
- * @see IDiffContainer
- * @see IDiffElement
- */
-public class DiffTreeViewer extends TreeViewer {
-
- static class DiffViewerSorter extends ViewerSorter {
-
- public boolean isSorterProperty(Object element, Object property) {
- return false;
- }
-
- public int category(Object node) {
- if (node instanceof DiffNode) {
- Object o= ((DiffNode) node).getId();
- if (o instanceof DocumentRangeNode)
- return ((DocumentRangeNode) o).getTypeCode();
- }
- return 0;
- }
- }
-
- class DiffViewerContentProvider implements ITreeContentProvider {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public boolean isDeleted(Object element) {
- return false;
- }
-
- public void dispose() {
- inputChanged(DiffTreeViewer.this, getInput(), null);
- }
-
- public Object getParent(Object element) {
- if (element instanceof IDiffElement)
- return ((IDiffElement)element).getParent();
- return null;
- }
-
- public final boolean hasChildren(Object element) {
- if (element instanceof IDiffContainer)
- return ((IDiffContainer)element).hasChildren();
- return false;
- }
-
- public final Object[] getChildren(Object element) {
- if (element instanceof IDiffContainer)
- return ((IDiffContainer)element).getChildren();
- return new Object[0];
- }
-
- public Object[] getElements(Object element) {
- return getChildren(element);
- }
- }
-
- /*
- * Takes care of swapping left and right if fLeftIsLocal
- * is true.
- */
- class DiffViewerLabelProvider extends LabelProvider {
-
- public String getText(Object element) {
-
- if (element instanceof IDiffElement)
- return ((IDiffElement)element).getName();
-
- return Utilities.getString(fBundle, "defaultLabel"); //$NON-NLS-1$
- }
-
- public Image getImage(Object element) {
- if (element instanceof IDiffElement) {
- IDiffElement input= (IDiffElement) element;
-
- int kind= input.getKind();
- if (fLeftIsLocal) {
- switch (kind & Differencer.DIRECTION_MASK) {
- case Differencer.LEFT:
- kind= (kind &~ Differencer.LEFT) | Differencer.RIGHT;
- break;
- case Differencer.RIGHT:
- kind= (kind &~ Differencer.RIGHT) | Differencer.LEFT;
- break;
- }
- }
-
- return fCompareConfiguration.getImage(input.getImage(), kind);
- }
- return null;
- }
- }
-
- static class FilterSame extends ViewerFilter {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IDiffElement)
- return (((IDiffElement)element).getKind() & Differencer.PSEUDO_CONFLICT) == 0;
- return true;
- }
- public boolean isFilterProperty(Object element, Object property) {
- return false;
- }
- }
-
- private ResourceBundle fBundle;
- private CompareConfiguration fCompareConfiguration;
- /* package */ boolean fLeftIsLocal;
- private IPropertyChangeListener fPropertyChangeListener;
-
- private Action fCopyLeftToRightAction;
- private Action fCopyRightToLeftAction;
- private Action fEmptyMenuAction;
- private Action fExpandAllAction;
-
- /**
- * Creates a new viewer for the given SWT tree control with the specified configuration.
- *
- * @param tree the tree control
- * @param configuration the configuration for this viewer
- */
- public DiffTreeViewer(Tree tree, CompareConfiguration configuration) {
- super(tree);
- initialize(configuration);
- }
-
- /**
- * Creates a new viewer under the given SWT parent and with the specified configuration.
- *
- * @param parent the SWT control under which to create the viewer
- * @param configuration the configuration for this viewer
- */
- public DiffTreeViewer(Composite parent, CompareConfiguration configuration) {
- super(new Tree(parent, SWT.MULTI));
- initialize(configuration);
- }
-
- private void initialize(CompareConfiguration configuration) {
-
- Control tree= getControl();
-
- INavigatable nav= new INavigatable() {
- public boolean gotoDifference(boolean next) {
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- return internalNavigate(next, true);
- }
- };
- tree.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- IOpenable openable= new IOpenable() {
- public void openSelected() {
- internalOpen();
- }
- };
- tree.setData(IOpenable.OPENABLE_PROPERTY, openable);
-
- fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
-
- tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
-
- Composite parent= tree.getParent();
-
- fBundle= ResourceBundle.getBundle("org.eclipse.compare.structuremergeviewer.DiffTreeViewerResources"); //$NON-NLS-1$
-
- // register for notification with the CompareConfiguration
- fCompareConfiguration= configuration;
- if (fCompareConfiguration != null) {
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- DiffTreeViewer.this.propertyChange(event);
- }
- };
- fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- setContentProvider(new DiffViewerContentProvider());
- setLabelProvider(new DiffViewerLabelProvider());
-
- addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent se) {
- updateActions();
- }
- }
- );
-
- setSorter(new DiffViewerSorter());
-
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
-
- tbm.add(new Separator("merge")); //$NON-NLS-1$
- tbm.add(new Separator("modes")); //$NON-NLS-1$
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
-
- createToolItems(tbm);
- updateActions();
-
- tbm.update(true);
- }
-
- MenuManager mm= new MenuManager();
- mm.setRemoveAllWhenShown(true);
- mm.addMenuListener(
- new IMenuListener() {
- public void menuAboutToShow(IMenuManager mm2) {
- fillContextMenu(mm2);
- if (mm2.isEmpty()) {
- if (fEmptyMenuAction == null) {
- fEmptyMenuAction=
- new Action(Utilities.getString(fBundle, "emptyMenuItem")) {}; //$NON-NLS-1$
- fEmptyMenuAction.setEnabled(false);
- }
- mm2.add(fEmptyMenuAction);
- }
- }
- }
- );
- tree.setMenu(mm.createContextMenu(tree));
- }
-
- /**
- * Returns the viewer's name.
- *
- * @return the viewer's name
- */
- public String getTitle() {
- String title= Utilities.getString(fBundle, "title", null); //$NON-NLS-1$
- if (title == null)
- title= Utilities.getString("DiffTreeViewer.title"); //$NON-NLS-1$
- return title;
- }
-
- /**
- * Returns the resource bundle.
- *
- * @return the viewer's resource bundle
- */
- protected ResourceBundle getBundle() {
- return fBundle;
- }
-
- /**
- * Returns the compare configuration of this viewer.
- *
- * @return the compare configuration of this viewer
- */
- public CompareConfiguration getCompareConfiguration() {
- return fCompareConfiguration;
- }
-
- /**
- * Called on the viewer disposal.
- * Unregisters from the compare configuration.
- * Clients may extend if they have to do additional cleanup.
- */
- protected void handleDispose(DisposeEvent event) {
-
- if (fCompareConfiguration != null) {
- if (fPropertyChangeListener != null)
- fCompareConfiguration.removePropertyChangeListener(fPropertyChangeListener);
- fCompareConfiguration= null;
- }
- fPropertyChangeListener= null;
-
- super.handleDispose(event);
- }
-
- /**
- * Tracks property changes of the configuration object.
- * Clients may extend to track their own property changes.
- */
- protected void propertyChange(PropertyChangeEvent event) {
- }
-
- protected void inputChanged(Object in, Object oldInput) {
- super.inputChanged(in, oldInput);
-
- if (in != oldInput) {
- initialSelection();
- updateActions();
- }
- }
-
- /**
- * This hook method is called from within <code>inputChanged</code>
- * after a new input has been set but before any controls are updated.
- * This default implementation calls <code>navigate(true)</code>
- * to select and expand the first leaf node.
- * Clients can override this method and are free to decide whether
- * they want to call the inherited method.
- *
- * @since 2.0
- */
- protected void initialSelection() {
- navigate(true);
- }
-
- /**
- * Overridden to avoid expanding <code>DiffNode</code>s that shouldn't expand.
- */
- protected void internalExpandToLevel(Widget node, int level) {
-
- Object data= node.getData();
-
- if (dontExpand(data))
- return;
-
- super.internalExpandToLevel(node, level);
- }
-
- /**
- * This hook method is called from within <code>internalExpandToLevel</code>
- * to control whether a given model node should be expanded or not.
- * This default implementation checks whether the object is a <code>DiffNode</code> and
- * calls <code>dontExpand()</code> on it.
- * Clients can override this method and are free to decide whether
- * they want to call the inherited method.
- *
- * @param o the model object to be expanded
- * @return <code>false</code> if a node should be expanded, <code>true</code> to prevent expanding
- * @since 2.0
- */
- protected boolean dontExpand(Object o) {
- return o instanceof DiffNode && ((DiffNode)o).dontExpand();
- }
-
- //---- merge action support
-
- /**
- * This factory method is called after the viewer's controls have been created.
- * It installs four actions in the given <code>ToolBarManager</code>. Two actions
- * allow for copying one side of a <code>DiffNode</code> to the other side.
- * Two other actions are for navigating from one node to the next (previous).
- * <p>
- * Clients can override this method and are free to decide whether they want to call
- * the inherited method.
- *
- * @param toolbarManager the toolbar manager for which to add the actions
- */
- protected void createToolItems(ToolBarManager toolbarManager) {
-
-// fCopyLeftToRightAction= new Action() {
-// public void run() {
-// copySelected(true);
-// }
-// };
-// Utilities.initAction(fCopyLeftToRightAction, fBundle, "action.TakeLeft.");
-// toolbarManager.appendToGroup("merge", fCopyLeftToRightAction);
-
-// fCopyRightToLeftAction= new Action() {
-// public void run() {
-// copySelected(false);
-// }
-// };
-// Utilities.initAction(fCopyRightToLeftAction, fBundle, "action.TakeRight.");
-// toolbarManager.appendToGroup("merge", fCopyRightToLeftAction);
-
-// fNextAction= new Action() {
-// public void run() {
-// navigate(true);
-// }
-// };
-// Utilities.initAction(fNextAction, fBundle, "action.NextDiff."); //$NON-NLS-1$
-// toolbarManager.appendToGroup("navigation", fNextAction); //$NON-NLS-1$
-
-// fPreviousAction= new Action() {
-// public void run() {
-// navigate(false);
-// }
-// };
-// Utilities.initAction(fPreviousAction, fBundle, "action.PrevDiff."); //$NON-NLS-1$
-// toolbarManager.appendToGroup("navigation", fPreviousAction); //$NON-NLS-1$
- }
-
- /**
- * This method is called to add actions to the viewer's context menu.
- * It installs actions for expanding tree nodes, copying one side of a <code>DiffNode</code> to the other side.
- * Clients can override this method and are free to decide whether they want to call
- * the inherited method.
- *
- * @param manager the menu manager for which to add the actions
- */
- protected void fillContextMenu(IMenuManager manager) {
- if (fExpandAllAction == null) {
- fExpandAllAction= new Action() {
- public void run() {
- expandSelection();
- }
- };
- Utilities.initAction(fExpandAllAction, fBundle, "action.ExpandAll."); //$NON-NLS-1$
- }
-
- boolean enable= false;
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements= ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object element= elements.next();
- if (element instanceof IDiffContainer) {
- if (((IDiffContainer)element).hasChildren()) {
- enable= true;
- break;
- }
- }
- }
- }
- fExpandAllAction.setEnabled(enable);
-
- manager.add(fExpandAllAction);
-
- if (fCopyLeftToRightAction != null)
- manager.add(fCopyLeftToRightAction);
- if (fCopyRightToLeftAction != null)
- manager.add(fCopyRightToLeftAction);
- }
-
- /**
- * Expands to infinity all items in the selection.
- *
- * @since 2.0
- */
- 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);
- }
- }
- }
-
- /**
- * Copies one side of all <code>DiffNode</code>s in the current selection to the other side.
- * Called from the (internal) actions for copying the sides of a <code>DiffNode</code>.
- * Clients may override.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- protected void copySelected(boolean leftToRight) {
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator e= ((IStructuredSelection) selection).iterator();
- while (e.hasNext()) {
- Object element= e.next();
- if (element instanceof ICompareInput)
- copyOne((ICompareInput) element, leftToRight);
- }
- }
- }
-
- /**
- * Called to copy one side of the given node to the other.
- * This default implementation delegates the call to <code>ICompareInput.copy(...)</code>.
- * Clients may override.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- protected void copyOne(ICompareInput node, boolean leftToRight) {
-
- node.copy(leftToRight);
-
- // update node's image
- update(new Object[] { node }, null);
- }
-
- /**
- * 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
- */
- protected void navigate(boolean next) {
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- internalNavigate(next, false);
- }
-
- //---- private
-
- /**
- * 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));
- }
- }
- }
- }
-
- private final boolean isEditable(Object element, boolean left) {
- if (element instanceof ICompareInput) {
- ICompareInput diff= (ICompareInput) element;
- Object side= left ? diff.getLeft() : diff.getRight();
- if (side == null && diff instanceof IDiffElement) {
- IDiffContainer container= ((IDiffElement)diff).getParent();
- if (container instanceof ICompareInput) {
- ICompareInput parent= (ICompareInput) container;
- side= left ? parent.getLeft() : parent.getRight();
- }
- }
- if (side instanceof IEditableContent)
- return ((IEditableContent) side).isEditable();
- }
- return false;
- }
-
- private void updateActions() {
- int leftToRight= 0;
- int rightToLeft= 0;
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) selection;
- Iterator e= ss.iterator();
- while (e.hasNext()) {
- Object element= e.next();
- if (element instanceof ICompareInput) {
- if (isEditable(element, false))
- leftToRight++;
- if (isEditable(element, true))
- rightToLeft++;
- if (leftToRight > 0 && rightToLeft > 0)
- break;
- }
- }
- if (fExpandAllAction != null)
- fExpandAllAction.setEnabled(selection.isEmpty());
- }
- if (fCopyLeftToRightAction != null)
- fCopyLeftToRightAction.setEnabled(leftToRight > 0);
- if (fCopyRightToLeftAction != null)
- fCopyRightToLeftAction.setEnabled(rightToLeft > 0);
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private void internalOpen() {
- ISelection selection= getSelection();
- if (selection != null && !selection.isEmpty()) {
- fireOpen(new OpenEvent(this, selection));
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
deleted file mode 100644
index fd835c45e..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# @(#)DiffTreeViewerResources.properties
-#
-# Resource strings for DiffTreeViewer.java
-
-title= Structure Compare
-defaultLabel= <no name>
-
-#####################################################
-# Dummy menu item for empty context menu
-#####################################################
-
-emptyMenuItem= <Empty Menu>
-
-#####################################################
-# Actions
-#####################################################
-
-action.Smart.label=Smart
-action.Smart.tooltip=Guess Similar Elements
-action.Smart.image=smartmode_co.gif
-
-action.ExpandAll.label=Expand All
-action.ExpandAll.tooltip=Expand All Nodes
-
-action.CompareContents.label= Show Content Comparison
-action.CompareContents.tooltip= Show content comparison
-
-action.NextDiff.label=Next
-action.NextDiff.tooltip=Select Next Change
-action.NextDiff.image=next_nav.gif
-
-action.PrevDiff.label=Previous
-action.PrevDiff.tooltip=Select Previous Change
-action.PrevDiff.image=prev_nav.gif
-
-action.TakeLeft.label=Copy Left to Right
-action.TakeLeft.tooltip=Copy Selected Nodes from Left to Right
-action.TakeLeft.image=copycont_r_co.gif
-
-action.TakeRight.label=Copy Right to Left
-action.TakeRight.tooltip=Copy Selected Nodes from Right to Left
-action.TakeRight.image=copycont_l_co.gif
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
deleted file mode 100644
index 047bb2c3d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.io.*;
-import java.util.*;
-import java.text.MessageFormat;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.Utilities;
-
-
-/**
- * A generic two-way or three-way differencing engine.
- * <p>
- * The engine is used by calling one of the <code>findDifferences</code> methods and passing
- * in the objects to compare.
- * The engine calls the following methods on the input objects to perform the compare:
- * <UL>
- * <LI><code>getChildren</code>: for enumerating the children of an object (if any),
- * <LI><code>contentsEqual</code>: for comparing the content of leaf objects, that is, objects without children,
- * <LI><code>visit</code>: for every pair of compared object the compare result is passed in.
- * </UL>
- * Clients may use as is, or subclass to provide a custom implementation for the three hooks.
- * However the default implementation already deals with the typical case:
- * <UL>
- * <LI><code>getChildren</code>: tries to apply the <code>IStructureComparator</code>
- * interface to enumerate the children,
- * <LI><code>contentsEqual</code>: tries to apply the <code>IStreamContentAccessor</code> interface
- * to perform a byte-wise content comparison,
- * <LI><code>visit</code>: creates a <code>DiffNode</code> for any detected difference between the compared objects and
- * links it under a parent node effectively creating a tree of differences.
- * </UL>
- * The different kind of changes detected by the engine are decoded as follows:
- * In the two-way case only NO_CHANGE, ADDITION, DELETION, and CHANGE are used.
- * In the three-way case these constants are bitwise ORed with one of directional constants
- * LEFT, RIGHT, and CONFLICTING.
- */
-public class Differencer {
-
- // The kind of differences.
- /**
- * Difference constant (value 0) indicating no difference.
- */
- public static final int NO_CHANGE= 0;
- /**
- * Difference constant (value 1) indicating one side was added.
- */
- public static final int ADDITION= 1;
- /**
- * Difference constant (value 2) indicating one side was removed.
- */
- public static final int DELETION= 2;
- /**
- * Difference constant (value 3) indicating side changed.
- */
- public static final int CHANGE= 3;
-
- /**
- * Bit mask (value 3) for extracting the kind of difference.
- */
- public static final int CHANGE_TYPE_MASK= 3;
-
- // The direction of a three-way change.
- /**
- * Three-way change constant (value 4) indicating a change on left side.
- */
- public static final int LEFT= 4;
-
- /**
- * Three-way change constant (value 8) indicating a change on right side.
- */
- public static final int RIGHT= 8;
-
- /**
- * Three-way change constant (value 12) indicating a change on left and
- * right sides.
- */
- public static final int CONFLICTING= 12;
-
- /**
- * Bit mask (value 12) for extracting the direction of a three-way change.
- */
- public static final int DIRECTION_MASK= 12;
-
- /**
- * Constant (value 16) indicating a change on left and
- * right side (with respect to ancestor) but left and right are identical.
- */
- public static final int PSEUDO_CONFLICT= 16;
-
-
- static class Node {
- List fChildren;
- int fCode;
- Object fAncestor;
- Object fLeft;
- Object fRight;
-
- Node() {
- }
- Node(Node parent, Object ancestor, Object left, Object right) {
- parent.add(this);
- fAncestor= ancestor;
- fLeft= left;
- fRight= right;
- }
- void add(Node child) {
- if (fChildren == null)
- fChildren= new ArrayList();
- fChildren.add(child);
- }
- Object visit(Differencer d, Object parent, int level) {
- if (fCode == NO_CHANGE)
- return null;
- //dump(level);
- Object data= d.visit(parent, fCode, fAncestor, fLeft, fRight);
- if (fChildren != null) {
- Iterator i= fChildren.iterator();
- while (i.hasNext()) {
- Node n= (Node) i.next();
- n.visit(d, data, level+1);
- }
- }
- return data;
- }
-// private void dump(int level) {
-// String name= null;
-// if (fAncestor instanceof ITypedElement)
-// name= ((ITypedElement)fAncestor).getName();
-// if (name == null && fLeft instanceof ITypedElement)
-// name= ((ITypedElement)fLeft).getName();
-// if (name == null && fRight instanceof ITypedElement)
-// name= ((ITypedElement)fRight).getName();
-// if (name == null)
-// name= "???"; //$NON-NLS-1$
-//
-// for (int i= 0; i < level; i++)
-// System.out.print(" "); //$NON-NLS-1$
-//
-// System.out.println(getDiffType(fCode) + name);
-// }
-
-// private String getDiffType(int code) {
-// String dir= " "; //$NON-NLS-1$
-// switch (code & DIRECTION_MASK) {
-// case LEFT:
-// dir= ">"; //$NON-NLS-1$
-// break;
-// case RIGHT:
-// dir= "<"; //$NON-NLS-1$
-// break;
-// case CONFLICTING:
-// dir= "!"; //$NON-NLS-1$
-// break;
-// }
-// String change= "="; //$NON-NLS-1$
-// switch (code & CHANGE_TYPE_MASK) {
-// case ADDITION:
-// change= "+"; //$NON-NLS-1$
-// break;
-// case DELETION:
-// change= "-"; //$NON-NLS-1$
-// break;
-// case CHANGE:
-// change= "#"; //$NON-NLS-1$
-// break;
-// }
-// return dir + change + " "; //$NON-NLS-1$
-// }
- }
-
- /**
- * Creates a new differencing engine.
- */
- public Differencer() {
- }
-
- /**
- * Starts the differencing engine on the three input objects. If threeWay is <code>true</code> a
- * three-way comparison is performed, otherwise a two-way compare (in the latter case the ancestor argument is ignored).
- * The progress monitor is passed to the method <code>updateProgress</code> which is called for every node or
- * leaf compare. The method returns the object that was returned from the top-most call to method <code>visit</code>.
- * At most two of the ancestor, left, and right parameters are allowed to be <code>null</code>.
- *
- * @param threeWay if <code>true</code> a three-way comparison is performed, otherwise a two-way compare
- * @param pm a progress monitor which is passed to method <code>updateProgress</code>
- * @param data a client data that is passed to the top-level call to <code>visit</code>
- * @param ancestor the ancestor object of the compare (may be <code>null</code>)
- * @param left the left object of the compare
- * @param right the right object of the compare
- * @return the object returned from the top most call to method <code>visit</code>,
- * possibly <code>null</code>
- */
- public Object findDifferences(boolean threeWay, IProgressMonitor pm, Object data, Object ancestor, Object left, Object right) {
-
- Node root= new Node();
-
- int code= traverse(threeWay, root, pm, threeWay ? ancestor : null, left, right);
-
- if (code != NO_CHANGE) {
- List l= root.fChildren;
- if (l.size() > 0) {
- Node first= (Node)l.get(0);
- return first.visit(this, data, 0);
- }
- }
- return null;
- }
-
- /**
- * Traverse tree in postorder.
- */
- private int traverse(boolean threeWay, Node parent, IProgressMonitor pm, Object ancestor, Object left, Object right) {
-
- Object[] ancestorChildren= getChildren(ancestor);
- Object[] rightChildren= getChildren(right);
- Object[] leftChildren= getChildren(left);
-
- int code= NO_CHANGE;
-
- Node node= new Node(parent, ancestor, left, right);
-
- boolean content= true; // we reset this if we have at least one child
-
- if (((threeWay && ancestorChildren != null) || !threeWay)
- && rightChildren != null && leftChildren != null) {
- // we only recurse down if no leg is null
- // a node
-
- Set allSet= new HashSet(20);
- Map ancestorSet= null;
- Map rightSet= null;
- Map leftSet= null;
-
- if (ancestorChildren != null) {
- ancestorSet= new HashMap(10);
- for (int i= 0; i < ancestorChildren.length; i++) {
- Object ancestorChild= ancestorChildren[i];
- ancestorSet.put(ancestorChild, ancestorChild);
- allSet.add(ancestorChild);
- }
- }
-
- if (rightChildren != null) {
- rightSet= new HashMap(10);
- for (int i= 0; i < rightChildren.length; i++) {
- Object rightChild= rightChildren[i];
- rightSet.put(rightChild, rightChild);
- allSet.add(rightChild);
- }
- }
-
- if (leftChildren != null) {
- leftSet= new HashMap(10);
- for (int i= 0; i < leftChildren.length; i++) {
- Object leftChild= leftChildren[i];
- leftSet.put(leftChild, leftChild);
- allSet.add(leftChild);
- }
- }
-
- Iterator e= allSet.iterator();
- while (e.hasNext()) {
- Object keyChild= e.next();
-
- content= false;
-
- if (pm != null) {
-
- if (pm.isCanceled())
- throw new OperationCanceledException();
-
- updateProgress(pm, keyChild);
- }
-
- Object ancestorChild= ancestorSet != null ? ancestorSet.get(keyChild) : null;
- Object leftChild= leftSet != null ? leftSet.get(keyChild) : null;
- Object rightChild= rightSet != null ? rightSet.get(keyChild) : null;
-
- int c= traverse(threeWay, node, pm, ancestorChild, leftChild, rightChild);
-
- if ((c & CHANGE_TYPE_MASK) != NO_CHANGE) {
- code|= CHANGE; // deletions and additions of child result in a change of the container
- code|= (c & DIRECTION_MASK); // incoming & outgoing are just ored
- }
- }
- }
-
- if (content) // a leaf
- code= compare(threeWay, ancestor, left, right);
-
- node.fCode= code;
-
- return code;
- }
-
- /**
- * Called for every node or leaf comparison.
- * The differencing engine passes in the input objects of the compare and the result of the compare.
- * The data object is the value returned from a call to the <code>visit</code> method on the parent input.
- * It can be considered the "parent" reference and is useful when building a tree.
- * <p>
- * The <code>Differencer</code> implementation returns a new
- * <code>DiffNode</code> which is initialized with the corresponding values.
- * Subclasses may override.
- *
- * @param data object returned from parent call to <code>visit</code>,
- * possibly <code>null</code>
- * @param result the result of the compare operation performed on the three inputs
- * @param ancestor the compare ancestor of the left and right inputs
- * @param left the left input to the compare
- * @param right the right input to the compare
- * @return the result, possibly <code>null</code>
- */
- protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
-
- /**
- * Performs a 2-way or 3-way compare of the given leaf elements and returns an integer
- * describing the kind of difference.
- */
- private int compare(boolean threeway, Object ancestor, Object left, Object right) {
-
- int description= NO_CHANGE;
-
- if (threeway) {
- if (ancestor == null) {
- if (left == null) {
- if (right == null) {
- Assert.isTrue(false);
- // shouldn't happen
- } else {
- description= RIGHT | ADDITION;
- }
- } else {
- if (right == null) {
- description= LEFT | ADDITION;
- } else {
- description= CONFLICTING | ADDITION;
- if (contentsEqual(left, right))
- description|= PSEUDO_CONFLICT;
- }
- }
- } else {
- if (left == null) {
- if (right == null) {
- description= CONFLICTING | DELETION | PSEUDO_CONFLICT;
- } else {
- if (contentsEqual(ancestor, right))
- description= LEFT | DELETION;
- else
- description= CONFLICTING | CHANGE;
- }
- } else {
- if (right == null) {
- if (contentsEqual(ancestor, left))
- description= RIGHT | DELETION;
- else
- description= CONFLICTING | CHANGE;
- } else {
- boolean ay= contentsEqual(ancestor, left);
- boolean am= contentsEqual(ancestor, right);
-
- if (ay && am)
- ;
- else if (ay && !am) {
- description= RIGHT | CHANGE;
- } else if (!ay && am) {
- description= LEFT | CHANGE;
- } else {
- description= CONFLICTING | CHANGE;
- if (contentsEqual(left, right))
- description|= PSEUDO_CONFLICT;
- }
- }
- }
- }
- } else { // two way compare ignores ancestor
- if (left == null) {
- if (right == null) {
- Assert.isTrue(false);
- // shouldn't happen
- } else {
- description= ADDITION;
- }
- } else {
- if (right == null) {
- description= DELETION;
- } else {
- if (! contentsEqual(left, right))
- description= CHANGE;
- }
- }
- }
-
- return description;
- }
-
- /**
- * Performs a content compare on the two given inputs.
- * <p>
- * The <code>Differencer</code> implementation
- * returns <code>true</code> if both inputs implement <code>IStreamContentAccessor</code>
- * and their byte contents is identical. Subclasses may override to implement
- * a different content compare on the given inputs.
- * </p>
- *
- * @param input1 first input to contents compare
- * @param input2 second input to contents compare
- * @return <code>true</code> if content is equal
- */
- protected boolean contentsEqual(Object input1, Object input2) {
-
- if (input1 == input2)
- return true;
-
- InputStream is1= getStream(input1);
- InputStream is2= getStream(input2);
-
- if (is1 == null && is2 == null) // no byte contents
- return true;
-
- try {
- if (is1 == null || is2 == null) // only one has contents
- return false;
-
- while (true) {
- int c1= is1.read();
- int c2= is2.read();
- if (c1 == -1 && c2 == -1)
- return true;
- if (c1 != c2)
- break;
-
- }
- } catch (IOException ex) {
- // NeedWork
- } finally {
- if (is1 != null) {
- try {
- is1.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- if (is2 != null) {
- try {
- is2.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- }
- return false;
- }
-
- /**
- * Tries to return an InputStream for the given object.
- * Returns <code>null</code> if the object not an IStreamContentAccessor
- * or an error occured.
- */
- private InputStream getStream(Object o) {
- if (o instanceof IStreamContentAccessor) {
- try {
- return ((IStreamContentAccessor)o).getContents();
- } catch(CoreException ex) {
- // NeedWork
- }
- }
- return null;
- }
-
- /**
- * Returns the children of the given input or <code>null</code> if there are no children.
- * <p>
- * The <code>Differencer</code> implementation checks whether the input
- * implements the <code>IStructureComparator</code> interface. If yes it is used
- * to return an array containing all children. Otherwise <code>null</code> is returned.
- * Subclasses may override to implement a different strategy to enumerate children.
- * </p>
- *
- * @param input the object for which to return children
- */
- protected Object[] getChildren(Object input) {
- if (input instanceof IStructureComparator)
- return ((IStructureComparator)input).getChildren();
- return null;
- }
-
- /**
- * Called for every leaf or node compare to update progress information.
- * <p>
- * The <code>Differencer</code> implementation shows the name of the input object
- * as a subtask. Subclasses may override.
- * </p>
- *
- * @param progressMonitor the progress monitor for reporting progress
- * @param node the currently processed non-<code>null</code> node
- */
- protected void updateProgress(IProgressMonitor progressMonitor, Object node) {
- if (node instanceof ITypedElement) {
- String name= ((ITypedElement)node).getName();
- String fmt= Utilities.getString("Differencer.progressFormat"); //$NON-NLS-1$
- String msg= MessageFormat.format(fmt, new String[] { name });
- progressMonitor.subTask(msg);
- //progressMonitor.worked(1);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
deleted file mode 100644
index de2c54f44..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import org.eclipse.jface.text.*;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.contentmergeviewer.IDocumentRange;
-
-
-/**
- * A document range node represents a structural element
- * when performing a structure compare of documents.
- * <code>DocumentRangeNodes</code> are created while parsing the document and represent
- * a semantic entity (e.g. a Java class or method).
- * As a consequence of the parsing a <code>DocumentRangeNode</code> maps to a range
- * of characters in the document.
- * <p>
- * Since a <code>DocumentRangeNode</code> implements the <code>IStructureComparator</code>
- * and <code>IStreamContentAccessor</code> interfaces it can be used as input to the
- * differencing engine. This makes it possible to perform
- * a structural diff on a document and have the nodes and leaves of the compare easily map
- * to character ranges within the document.
- * <p>
- * Subclasses may add additional state collected while parsing the document.
- * </p>
- * @see Differencer
- */
-public class DocumentRangeNode
- implements IDocumentRange, IStructureComparator, IEditableContent, IEncodedStreamContentAccessor {
-
- private static final boolean POS_UPDATE= true;
- private static final String UTF_16= "UTF-16"; //$NON-NLS-1$
-
- private IDocument fBaseDocument;
- private Position fRange; // the range in the base document
- private int fTypeCode;
- private String fID;
- private Position fAppendPosition; // a position where to insert a child textually
- private ArrayList fChildren;
-
- /**
- * Creates a new <code>DocumentRangeNode</code> for the given range within the specified
- * document. The <code>typeCode</code> is uninterpreted client data. The ID is used when comparing
- * two nodes with each other: i.e. the differencing engine performs a content compare
- * on two nodes if their IDs are equal.
- *
- * @param typeCode a type code for this node
- * @param id an identifier for this node
- * @param document document on which this node is based on
- * @param start start position of range within document
- * @param length length of range
- */
- public DocumentRangeNode(int typeCode, String id, IDocument document, int start, int length) {
-
- fTypeCode= typeCode;
- fID= id;
-
- fBaseDocument= document;
- fBaseDocument.addPositionCategory(RANGE_CATEGORY);
- fRange= new Position(start, length);
-
- if (POS_UPDATE) {
- try {
- document.addPosition(RANGE_CATEGORY, fRange);
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- } catch (BadLocationException ex) {
- // silently ignored
- }
- }
- }
-
- /* (non Javadoc)
- * see IDocumentRange.getDocument
- */
- public IDocument getDocument() {
- return fBaseDocument;
- }
-
- /* (non Javadoc)
- * see IDocumentRange.getRange
- */
- public Position getRange() {
- return fRange;
- }
-
- /**
- * Returns the type code of this node.
- * The type code is uninterpreted client data which can be set in the constructor.
- *
- * @return the type code of this node
- */
- public int getTypeCode() {
- return fTypeCode;
- }
-
- /**
- * Returns this node's id.
- * It is used in <code>equals</code> and <code>hashcode</code>.
- *
- * @return the node's id
- */
- public String getId() {
- return fID;
- }
-
- /**
- * Sets this node's id.
- * It is used in <code>equals</code> and <code>hashcode</code>.
- *
- * @param id the new id for this node
- */
- public void setId(String id) {
- fID= id;
- }
-
- /**
- * Adds the given node as a child.
- *
- * @param node the node to add as a child
- */
- public void addChild(DocumentRangeNode node) {
- if (fChildren == null)
- fChildren= new ArrayList();
- fChildren.add(node);
- }
-
- /* (non Javadoc)
- * see IStructureComparator.getChildren
- */
- public Object[] getChildren() {
- if (fChildren != null)
- return fChildren.toArray();
- return new Object[0];
- }
-
- /**
- * Sets the length of the range of this node.
- *
- * @param length the length of the range
- */
- public void setLength(int length) {
- getRange().setLength(length);
- }
-
- /**
- * Sets a position within the document range that can be used to (legally) insert
- * text without breaking the syntax of the document.
- * <p>
- * E.g. when parsing a Java document the "append position" of a <code>DocumentRangeNode</code>
- * representating a Java class could be the character position just before the closing bracket.
- * Inserting the text of a new method there would not disturb the syntax of the class.
- *
- * @param pos the character position within the underlying document where text can be legally inserted
- */
- public void setAppendPosition(int pos) {
- if (POS_UPDATE) {
- fBaseDocument.removePosition(fAppendPosition);
- try {
- Position p= new Position(pos);
- fBaseDocument.addPosition(RANGE_CATEGORY, p);
- fAppendPosition= p;
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- } catch (BadLocationException ex) {
- // silently ignored
- }
- } else {
- fAppendPosition= new Position(pos);
- }
- }
-
- /**
- * Returns the position that has been set with <code>setAppendPosition</code>.
- * If <code>setAppendPosition</code> hasn't been called, the position after the last character
- * of this range is returned.
- *
- * @return a position where text can be legally inserted
- */
- public Position getAppendPosition() {
- if (fAppendPosition == null) {
- if (POS_UPDATE) {
- try {
- Position p= new Position(fBaseDocument.getLength());
- fBaseDocument.addPosition(RANGE_CATEGORY, p);
- fAppendPosition= p;
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- } catch (BadLocationException ex) {
- // silently ignored
- }
- } else {
- fAppendPosition= new Position(fBaseDocument.getLength());
- }
- }
- return fAppendPosition;
- }
-
- /**
- * Implementation based on <code>getID</code>.
- */
- public boolean equals(Object other) {
- if (other != null && other.getClass() == getClass()) {
- DocumentRangeNode tn= (DocumentRangeNode) other;
- return fTypeCode == tn.fTypeCode && fID.equals(tn.fID);
- }
- return super.equals(other);
- }
-
- /**
- * Implementation based on <code>getID</code>.
- */
- public int hashCode() {
- return fID.hashCode();
- }
-
- /**
- * Find corresponding position
- */
- private Position findCorrespondingPosition(DocumentRangeNode otherParent, DocumentRangeNode child) {
-
- // we try to find a predecessor of left Node which exists on the right side
-
- if (child != null && fChildren != null) {
- int ix= otherParent.fChildren.indexOf(child);
- if (ix >= 0) {
-
- for (int i= ix - 1; i >= 0; i--) {
- DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i);
- int i2= fChildren.indexOf(c1);
- if (i2 >= 0) {
- DocumentRangeNode c= (DocumentRangeNode) fChildren.get(i2);
- //System.out.println(" found corresponding: " + i2 + " " + c);
- Position p= c.fRange;
-
- //try {
- Position po= new Position(p.getOffset() + p.getLength() + 1, 0);
- //c.fBaseDocument.addPosition(RANGE_CATEGORY, po);
- return po;
- //} catch (BadLocationException ex) {
- //}
- //break;
- }
- }
-
- for (int i= ix; i < otherParent.fChildren.size(); i++) {
- DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i);
- int i2= fChildren.indexOf(c1);
- if (i2 >= 0) {
- DocumentRangeNode c= (DocumentRangeNode) fChildren.get(i2);
- //System.out.println(" found corresponding: " + i2 + " " + c);
- Position p= c.fRange;
- //try {
- Position po= new Position(p.getOffset(), 0);
- //c.fBaseDocument.addPosition(RANGE_CATEGORY, po);
- return po;
- //} catch (BadLocationException ex) {
- //}
- //break;
- }
- }
-
- }
- }
- return getAppendPosition();
- }
-
- private void add(String s, DocumentRangeNode parent, DocumentRangeNode child) {
-
- Position p= findCorrespondingPosition(parent, child);
- if (p != null) {
- try {
- fBaseDocument.replace(p.getOffset(), p.getLength(), s);
- } catch (BadLocationException ex) {
- // silently ignored
- }
- }
- }
-
- /* (non Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() {
- String s;
- try {
- s= fBaseDocument.get(fRange.getOffset(), fRange.getLength());
- } catch (BadLocationException ex) {
- s= ""; //$NON-NLS-1$
- }
- return new ByteArrayInputStream(Utilities.getBytes(s, UTF_16));
- }
-
- /* (non Javadoc)
- * see IEditableContent.isEditable
- */
- public boolean isEditable() {
- return true;
- }
-
- /* (non Javadoc)
- * see IEditableContent.replace
- */
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
-
- DocumentRangeNode src= null;
- String srcContents= ""; //$NON-NLS-1$
-
- if (other != null) {
- src= (DocumentRangeNode) child;
-
- if (other instanceof IStreamContentAccessor) {
- try {
- srcContents= Utilities.readString((IStreamContentAccessor)other);
- } catch(CoreException ex) {
- // NeedWork
- }
- }
- }
-
- if (child == null) // no destination: we have to add the contents into the parent
- add(srcContents, null, src);
-
- return child;
- }
-
- /* (non Javadoc)
- * see IEditableContent.setContent
- */
- public void setContent(byte[] content) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IStreamContentAccessor#getEncoding()
- */
- public String getCharset() {
- return UTF_16;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
deleted file mode 100644
index 4d937937f..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface for objects used as input to a two-way or three-way compare viewer.
- * It defines API for accessing the three sides for the compare,
- * and a name and image which is used when displaying the three way input
- * in the UI, for example, in a title bar.
- * <p>
- * Note: at most two sides of an <code>ICompareInput</code> can be <code>null</code>,
- * (as it is normal for additions or deletions) but not all three.
- * <p>
- * <code>ICompareInput</code> provides methods for registering
- * <code>ICompareInputChangeListener</code>s
- * that get informed if one (or more)
- * of the three sides of an <code>ICompareInput</code> object changes its value.
- * <p>
- * For example when accepting an incoming addition
- * the (non-<code>null</code>) left side of an <code>ICompareInput</code>
- * is copied to the right side by means of method <code>copy</code>.
- * This should trigger a call to <code>compareInputChanged</code> of registered
- * <code>ICompareInputChangeListener</code>s.
- * <p>
- * Clients can implement this interface, or use the convenience implementation
- * <code>DiffNode</code>.
- * </p>
- *
- * @see StructureDiffViewer
- * @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer
- * @see DiffNode
- */
-public interface ICompareInput {
-
- /**
- * Returns name of input.
- * This name is displayed when this input is shown in a viewer.
- * In many cases this name is the name of one of the non-<code>null</code> sides or a combination
- * thereof.
- *
- * @return name of input
- */
- String getName();
-
- /**
- * Returns an image representing this input.
- * This image is typically displayed when this input is shown in a viewer.
- * In many cases this image is the image of one of the non-<code>null</code> sides.
- *
- * @return image representing this input, or <code>null</code> if no icon should be shown
- */
- Image getImage();
-
- /**
- * Returns the kind of difference between the
- * three sides ancestor, left and right.
- * This field is only meaningful if the <code>ICompareInput</code>
- * is the result of another compare. In this case it is used
- * together with <code>getImage</code> to compose a icon
- * which reflects the kind of difference between the two or three elements.
- *
- * @return kind of difference (see <code>Differencer</code>)
- */
- int getKind();
-
- /**
- * Returns the ancestor side of this input.
- * Returns <code>null</code> if this input has no ancestor
- * or in the two-way compare case.
- *
- * @return the ancestor of this input, or <code>null</code>
- */
- ITypedElement getAncestor();
-
- /**
- * Returns the left side of this input.
- * Returns <code>null</code> if there is no left side (deletion or addition).
- *
- * @return the left side of this input, or <code>null</code>
- */
- ITypedElement getLeft();
-
- /**
- * Returns the right side of this input.
- * Returns <code>null</code> if there is no right side (deletion or addition).
- *
- * @return the right side of this input, or <code>null</code>
- */
- ITypedElement getRight();
-
- /**
- * Registers the given listener for notification.
- * If the identical listener is already registered the method has no effect.
- *
- * @param listener the listener to register for changes of this input
- */
- void addCompareInputChangeListener(ICompareInputChangeListener listener);
-
- /**
- * Unregisters the given listener.
- * If the identical listener is not registered the method has no effect.
- *
- * @param listener the listener to unregister
- */
- void removeCompareInputChangeListener(ICompareInputChangeListener listener);
-
- /**
- * Copy one side (source) to the other side (destination) depending on the
- * value of <code>leftToRight</code>. This method is called from
- * a merge viewer if a corresponding action ("take left" or "take right")
- * has been pressed.
- * <p>
- * The implementation should handle the following cases:
- * <UL>
- * <LI>
- * if the source side is <code>null</code> the destination must be deleted,
- * <LI>
- * if the destination is <code>null</code> the destination must be created
- * and filled with the contents from the source,
- * <LI>
- * if both sides are non-<code>null</code> the contents of source must be copied to destination.
- * </UL>
- * In addition the implementation should send out notification to the registered
- * <code>ICompareInputChangeListener</code>.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- void copy(boolean leftToRight);
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
deleted file mode 100644
index 461a94ab4..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * Listener that gets informed if one (or more)
- * of the three sides of an <code>ICompareInput</code> object changes its value.
- * <p>
- * For example when accepting an incoming addition
- * the (non-null) left side of an <code>ICompareInput</code>
- * is copied to the right side (which was <code>null</code>).
- * This triggers a call to <code>compareInputChanged</code> of registered
- * <code>ICompareInputChangeListener</code>.
- * <p>
- * Note however, that listener are not informed if the content of one of the sides changes.
- * <p>
- * Clients may implement this interface. It is also implemented by viewers that take
- * an <code>ICompareInput</code> as input.
- * </p>
- */
-public interface ICompareInputChangeListener {
-
- /**
- * Called whenever the value (not the content) of one or more of the three sides
- * of a <code>ICompareInput</code> has changed.
- *
- * @param source the <code>ICompareInput</code> that has changed
- */
- void compareInputChanged(ICompareInput source);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
deleted file mode 100644
index 598996bef..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * <code>IDiffContainer</code> is a <code>IDiffElement</code> with children.
- * <p>
- * <code>IDiffContainer</code> are the inner nodes displayed
- * by the <code>DiffTreeViewer</code>.
- * <code>IDiffContainer</code> are typically created as the result of performing
- * a compare with the <code>Differencer</code>.
- * <p>
- * Clients may implement this interface, or use one of the standard implementations,
- * <code>DiffContainer</code> or <code>DiffNode</code>.
- *
- * @see Differencer
- * @see DiffTreeViewer
- */
-public interface IDiffContainer extends IDiffElement {
-
- /**
- * Returns whether this container has at least one child.
- * In some cases this methods avoids having to call the
- * potential more costly <code>getChildren</code> method.
- *
- * @return <code>true</code> if this container has at least one child
- */
- boolean hasChildren();
-
- /**
- * Returns the children of this container.
- * If this container has no children an empty array is returned (not <code>null</code>).
- *
- * @return the children of this container as an array
- */
- IDiffElement[] getChildren();
-
- /**
- * Adds the given child to this container.
- * If the child is already contained in this container, this method has no effect.
- *
- * @param child the child to be added to this container
- */
- void add(IDiffElement child);
-
- /**
- * Removes the given child from this container.
- * If the container becomes empty it is removed from its container.
- * If the child is not contained in this container, this method has no effect.
- *
- * @param child the child to be removed from this container
- */
- void removeToRoot(IDiffElement child);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
deleted file mode 100644
index f09742a1d..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.compare.ITypedElement;
-
-/**
- * An <code>IDiffElement</code> is used in the <code>DiffTreeViewer</code>
- * to display the kind of change detected as the result of a two-way or three-way compare.
- * <p>
- * The base interface <code>ITypedElement</code> provides a name, a type, and an image.
- * <code>IDiffElement</code> adds API for maintaining a parent relationship.
- * <p>
- * <code>DiffTreeViewer</code> works on a tree of <code>IDiffElements</code>.
- * Leaf elements must implement the
- * <code>IDiffElement</code> interface, inner nodes the <code>IDiffContainer</code> interface.
- * <p>
- * <code>IDiffElement</code>s are typically created as the result of performing
- * a compare with the <code>Differencer</code>.
- * <p>
- * Clients may implement this interface, or use one of the standard implementations,
- * <code>DiffElement</code>, <code>DiffContainer</code>, or <code>DiffNode</code>.
- *
- * @see DiffTreeViewer
- * @see DiffElement
- * @see DiffContainer
- * @see DiffNode
- */
-public interface IDiffElement extends ITypedElement {
-
- /**
- * Returns the kind of difference as defined in <code>Differencer</code>.
- *
- * @return the kind of difference as defined in <code>Differencer</code>
- */
- int getKind();
-
- /**
- * Returns the parent of this element.
- * If the object is the root of a hierarchy <code>null</code> is returned.
- *
- * @return the parent of this element, or <code>null</code> if the element has no parent
- */
- IDiffContainer getParent();
-
- /**
- * Sets the parent of this element.
- *
- * @param parent the new parent of this element, or <code>null</code> if this
- * element is to have no parent
- */
- void setParent(IDiffContainer parent);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
deleted file mode 100644
index b4bb8e0d0..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * Interface used to compare hierarchical structures.
- * It is used by the differencing engine.
- * <p>
- * Clients typically implement this interface in an adaptor class which
- * wrappers the objects to be compared.
- *
- * @see org.eclipse.compare.ResourceNode
- * @see Differencer
- */
-public interface IStructureComparator {
-
- /**
- * Returns an iterator for all children of this object or <code>null</code>
- * if there are no children.
- *
- * @return an array with all children of this object, or an empty array if there are no children
- */
- Object[] getChildren();
-
- /**
- * Returns whether some other object is "equal to" this one
- * with respect to a structural comparison. For example, when comparing
- * Java class methods, <code>equals</code> would return <code>true</code>
- * if two methods have the same signature (the argument names and the
- * method body might differ).
- *
- * @param other the reference object with which to compare
- * @return <code>true</code> if this object is the same as the other argument; <code>false</code> otherwise
- * @see java.lang.Object#equals
- */
- boolean equals(Object other);
-}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
deleted file mode 100644
index 2f2c3916a..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * Interface used to create a hierarchical structure of
- * <code>IStructureComparator</code>s for a given input object.
- * In addition, it provides methods for locating a path in the hierarchical structure
- * and to map a node of this structure back to the corresponding input object.
- * <p>
- * Structure creators are used in the following contexts:
- * <ul>
- * <li>
- * the <code>StructureDiffViewer</code> uses an <code>IStructureCreator</code> to
- * build two (or three) tree structures of its input elements (method <code>getStructure</code>).
- * These trees are then compared with each other by means of the differencing engine and displayed
- * with the <code>DiffTreeViewer</code>,
- * </li>
- * <li>
- * the <code>ReplaceWithEditionDialog</code> uses an <code>IStructureCreator</code>
- * to map a path back to a range of characters in the textual representation.
- * </li>
- * </ul>
- * A <code>IStructureCreator</code> provides methods for rewriting the tree produced by the differencing
- * engine to support "smart" structural differencing. E.g. certain patterns of pairs of "addition"
- * and "deletion" nodes can be detected as renames and merged into a single node.
- * </p>
- * <p>
- * Clients may implement this interface; there is no standard implementation.
- * </p>
- *
- * @see StructureDiffViewer
- * @see org.eclipse.compare.EditionSelectionDialog
- * @see Differencer
- */
-public interface IStructureCreator {
-
- /**
- * Returns a descriptive name which can be used in the UI of the <code>StructureDiffViewer</code>.
- *
- * @return a descriptive name for this <code>IStructureCreator</code>
- */
- String getName();
-
- /**
- * Creates a tree structure consisting of <code>IStructureComparator</code>s
- * from the given object and returns its root object.
- * Implementing this method typically involves parsing the input object.
- * In case of an error (e.g. a parsing error) the value <code>null</code> is returned.
- *
- * @param input the object from which to create the tree of <code>IStructureComparator</code>
- * @return the root node of the structure or <code>null</code> in case of error
- */
- IStructureComparator getStructure(Object input);
-
- /**
- * Creates the single node specified by path from the given input object.
- * In case of an error (e.g. a parsing error) the value <code>null</code> is returned.
- * This method is similar to <code>getStructure</code> but in
- * contrast to <code>getStructure</code> only a single node without any children must be returned.
- * This method is used in the <code>ReplaceWithEditionDialog</code> to locate a sub element
- * (e.g. a method) within an input object (e.g. a file containing source code).
- * <p>
- * One (not optimized) approach to implement this method is calling <code>getStructure(input)</code>
- * to build the full tree, and then finding that node within the tree that is specified
- * by <code>path</code>.
- * <p>
- * The syntax of <code>path</code> is not specified, because it is treated by the compare subsystem
- * as an opaque entity and is not further interpreted. Clients using this functionality
- * will pass a value of <code>path</code> to the <code>selectEdition</code>
- * method of <code>ReplaceWithEditionDialog</code> and will receive this value unchanged
- * as an argument to <code>locate</code>.
- *
- * @param path specifies a sub object within the input object
- * @param input the object from which to create the <code>IStructureComparator</code>
- * @return the single node specified by <code>path</code> or <code>null</code>
- *
- * @see org.eclipse.compare.EditionSelectionDialog#selectEdition
- */
- IStructureComparator locate(Object path, Object input);
-
- /**
- * Returns the contents of the given node as a string for the purpose
- * of performing a content comparison only (that is the string will not be visible in the UI).
- * If <code>ignoreWhitespace</code> is <code>true</code> all character sequences considered
- * whitespace should be removed from the returned string.
- *
- * @param node the node for which to return a string representation
- * @param ignoreWhitespace if <code>true</code> the returned string should not contain whitespace
- * @return the string contents of the given node
- */
- String getContents(Object node, boolean ignoreWhitespace);
-
- /**
- * Called whenever a copy operation has been performed on a tree node.
- *
- * @param node the node for which to save the new content
- * @param input the object from which the structure tree was created in <code>getStructure</code>
- */
- void save(IStructureComparator node, Object input);
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
deleted file mode 100644
index 9b91942ef..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.*;
-
-
-/**
- * A diff tree viewer that can be configured with a <code>IStructureCreator</code>
- * to retrieve a hierarchical structure from the input object (an <code>ICompareInput</code>)
- * and perform a two-way or three-way compare on it.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed outside
- * this package.
- * </p>
- *
- * @see IStructureCreator
- * @see ICompareInput
- */
-public class StructureDiffViewer extends DiffTreeViewer {
-
- private Differencer fDifferencer;
- private boolean fThreeWay= false;
-
- private ITypedElement fAncestorInput;
- private ITypedElement fLeftInput;
- private ITypedElement fRightInput;
-
- private IStructureComparator fAncestorStructure;
- private IStructureComparator fLeftStructure;
- private IStructureComparator fRightStructure;
-
- private IStructureCreator fStructureCreator;
- private IDiffContainer fRoot;
- private IContentChangeListener fContentChangedListener;
- private CompareViewerSwitchingPane fParent;
-
- /**
- * Creates a new viewer for the given SWT tree control with the specified configuration.
- *
- * @param tree the tree control
- * @param configuration the configuration for this viewer
- */
- public StructureDiffViewer(Tree tree, CompareConfiguration configuration) {
- super(tree, configuration);
- Composite c= tree.getParent();
- if (c instanceof CompareViewerSwitchingPane)
- fParent= (CompareViewerSwitchingPane) c;
- initialize();
- }
-
- /**
- * Creates a new viewer under the given SWT parent with the specified configuration.
- *
- * @param parent the SWT control under which to create the viewer
- * @param configuration the configuration for this viewer
- */
- public StructureDiffViewer(Composite parent, CompareConfiguration configuration) {
- super(parent, configuration);
- if (parent instanceof CompareViewerSwitchingPane)
- fParent= (CompareViewerSwitchingPane) parent;
- initialize();
- }
-
- private void initialize() {
-
- setAutoExpandLevel(3);
-
- fContentChangedListener= new IContentChangeListener() {
- public void contentChanged(IContentChangeNotifier changed) {
- StructureDiffViewer.this.contentChanged(changed);
- }
- };
- new ICompareInputChangeListener() {
- public void compareInputChanged(ICompareInput input) {
- StructureDiffViewer.this.compareInputChanged(input);
- }
- };
- }
-
- /**
- * Configures the <code>StructureDiffViewer</code> with a structure creator.
- * The structure creator is used to create a hierarchical structure
- * for each side of the viewer's input element of type <code>ICompareInput</code>.
- *
- * @param structureCreator the new structure creator
- */
- public void setStructureCreator(IStructureCreator structureCreator) {
- if (fStructureCreator != structureCreator) {
- fStructureCreator= structureCreator;
- Control tree= getControl();
- if (tree != null && !tree.isDisposed())
- tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
- }
- }
-
- /**
- * Returns the structure creator or <code>null</code> if no
- * structure creator has been set with <code>setStructureCreator</code>.
- *
- * @return the structure creator or <code>null</code>
- */
- public IStructureCreator getStructureCreator() {
- return fStructureCreator;
- }
-
- /**
- * Reimplemented to get the descriptive title for this viewer from the <code>IStructureCreator</code>.
- */
- public String getTitle() {
- if (fStructureCreator != null)
- return fStructureCreator.getName();
- return super.getTitle();
- }
-
- /**
- * Overridden because the input of this viewer is not identical to the root of the tree.
- * The tree's root is a IDiffContainer that was returned from the method <code>diff</code>.
- *
- * @return the root of the diff tree produced by method <code>diff</code>
- */
- protected Object getRoot() {
- return fRoot;
- }
-
- /**
- * Overridden to create the comparable structures from the input object
- * and to feed them through the differencing engine. Note: for this viewer
- * the value from <code>getInput</code> is not identical to <code>getRoot</code>.
- */
- protected void inputChanged(Object input, Object oldInput) {
- if (input instanceof ICompareInput) {
- compareInputChanged((ICompareInput) input);
- if (input != oldInput)
- initialSelection();
- }
- }
-
- protected void initialSelection() {
- expandToLevel(2);
- }
-
- /* (non Javadoc)
- * Overridden to unregister all listeners.
- */
- protected void handleDispose(DisposeEvent event) {
-
- compareInputChanged(null);
-
- fContentChangedListener= null;
-
- super.handleDispose(event);
- }
-
- /**
- * Recreates the comparable structures for the input sides.
- */
- protected void compareInputChanged(ICompareInput input) {
- ITypedElement t= null;
- boolean changed= false;
-
- if (input != null)
- t= input.getAncestor();
-
- fThreeWay= (t != null);
-
- if (t != fAncestorInput) {
- if (fAncestorInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener);
- fAncestorInput= t;
- if (fAncestorInput != null) {
- fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- changed= true;
- } else
- fAncestorStructure= null;
- if (fAncestorInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fAncestorInput).addContentChangeListener(fContentChangedListener);
- }
-
- if (input != null)
- t= input.getLeft();
- if (t != fLeftInput) {
- if (fLeftInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fLeftInput).removeContentChangeListener(fContentChangedListener);
- fLeftInput= t;
- if (fLeftInput != null) {
- fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- changed= true;
- } else
- fLeftStructure= null;
- if (fLeftInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fLeftInput).addContentChangeListener(fContentChangedListener);
- }
-
- if (input != null)
- t= input.getRight();
- if (t != fRightInput) {
- if (fRightInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fRightInput).removeContentChangeListener(fContentChangedListener);
- fRightInput= t;
- if (fRightInput != null) {
- fRightStructure= fStructureCreator.getStructure(fRightInput);
- changed= true;
- } else
- fRightStructure= null;
- if (fRightInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fRightInput).addContentChangeListener(fContentChangedListener);
- }
-
- if (changed)
- diff();
- }
-
- /**
- * Calls <code>diff</code> whenever the byte contents changes.
- */
- protected void contentChanged(IContentChangeNotifier changed) {
-
- if (fStructureCreator == null)
- return;
-
- if (changed != null) {
- if (changed == fAncestorInput) {
- fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- } else if (changed == fLeftInput) {
- fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- } else if (changed == fRightInput) {
- fRightStructure= fStructureCreator.getStructure(fRightInput);
- } else
- return;
- } else {
- fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- fRightStructure= fStructureCreator.getStructure(fRightInput);
- }
-
- diff();
- }
-
- /**
- * This method is called from within <code>diff()</code> before the difference
- * tree is being built.
- * Clients may override this method to perform their own pre-processing.
- * This default implementation does nothing.
- * @param ancestor the ancestor input to the differencing operation
- * @param left the left input to the differencing operation
- * @param right the right input to the differencing operation
- * @since 2.0
- */
- protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) {
- // we do nothing here
- }
-
- /**
- * Runs the difference engine and refreshes the tree.
- */
- protected void diff() {
-
- preDiffHook(fAncestorStructure, fLeftStructure, fRightStructure);
-
- String message= null;
-
- if ((fThreeWay && fAncestorStructure == null) || fLeftStructure == null || fRightStructure == null) {
- // could not get structure of one (or more) of the legs
- fRoot= null;
- message= CompareMessages.getString("StructureDiffViewer.StructureError"); //$NON-NLS-1$
-
- } else { // calculate difference of the two (or three) structures
-
- if (fDifferencer == null)
- fDifferencer= new Differencer() {
- protected boolean contentsEqual(Object o1, Object o2) {
- return StructureDiffViewer.this.contentsEqual(o1, o2);
- }
- protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- Object o= super.visit(data, result, ancestor, left, right);
- if (fLeftIsLocal && o instanceof DiffNode)
- ((DiffNode)o).swapSides(fLeftIsLocal);
- return o;
- }
- };
-
- fRoot= (IDiffContainer) fDifferencer.findDifferences(fThreeWay, null, null,
- fAncestorStructure, fLeftStructure, fRightStructure);
-
- if (fRoot == null || fRoot.getChildren().length == 0) {
- message= CompareMessages.getString("StructureDiffViewer.NoStructuralDifferences"); //$NON-NLS-1$
- } else {
- postDiffHook(fDifferencer, fRoot);
- }
- }
- if (fParent != null)
- fParent.setTitleArgument(message);
-
- refresh(getRoot());
- }
-
- /**
- * This method is called from within <code>diff()</code> after the difference
- * tree has been built.
- * Clients may override this method to perform their own post-processing.
- * This default implementation does nothing.
- * @param differencer the differencer used to perform the differencing
- * @param root the non-<code>null</code> root node of the difference tree
- * @since 2.0
- */
- protected void postDiffHook(Differencer differencer, IDiffContainer root) {
- // we do nothing here
- }
-
- /**
- * Performs a byte compare on the given objects.
- * Called from the difference engine.
- * Returns <code>null</code> if no structure creator has been set.
- */
- private boolean contentsEqual(Object o1, Object o2) {
- if (fStructureCreator != null) {
- boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false);
- String s1= fStructureCreator.getContents(o1, ignoreWhiteSpace);
- String s2= fStructureCreator.getContents(o2, ignoreWhiteSpace);
- if (s1 == null || s2 == null)
- return false;
- return s1.equals(s2);
- }
- return false;
- }
-
- /**
- * Tracks property changes of the configuration object.
- * Clients may override to track their own property changes.
- * In this case they must call the inherited method.
- */
- protected void propertyChange(PropertyChangeEvent event) {
- String key= event.getProperty();
- if (key.equals(CompareConfiguration.IGNORE_WHITESPACE))
- diff();
- else
- super.propertyChange(event);
- }
-
- /**
- * Overridden to call the <code>save</code> method on the structure creator after
- * nodes have been copied from one side to the other side of an input object.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- protected void copySelected(boolean leftToRight) {
- super.copySelected(leftToRight);
-
- if (fStructureCreator != null)
- fStructureCreator.save(
- leftToRight ? fRightStructure : fLeftStructure,
- leftToRight ? fRightInput : fLeftInput);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html
deleted file mode 100644
index 60257a4d8..000000000
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html
+++ /dev/null
@@ -1,79 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for finding and displaying the differences
-between hierarchically structured data.
-<h2>
-Package Specification</h2>
-
-The class <b>Differencer</b> is a differencing engine for hierarchically
-structured data. It takes two or three inputs and performs a two-way or
-three-way compare on them.
-<p>
-
-If the input elements to the differencing engine implement the <b>IStructureComparator</b>
-interface the engine recursively applies itself to the children of
-the input element. Leaf elements must implement the <b>org.eclipse.compare.IStreamContentAccessor</b>
-interface so that the differencer can perform a bytewise comparison on their contents.
-<p>
-
-One good example for this is <b>org.eclipse.compare.ResourceNode</b> which implements both interfaces
-(and more) for Eclipse workspace resources (org.eclipse.core.resources.IResource).
-<p>
-
-Another example is the <b>DocumentRangeNode</b> which can be used to compare hierarchical structures
-that are superimposed on a document, that is where nodes and leafs correspond to ranges in a document
-(<b>org.eclipse.compare.contentmergeviewer.IDocumentRange</b>).
-<br>
-Typically <b>DocumentRangeNode</b>s are created while parsing a document and they represent
-the semantic entities of the document (e.g. a Java class, method or field).
-The two subclasses <b>JavaNode</b> (in org.eclipse.jdt.internal.ui.compare)
-and <b>PropertyNode</b> (in org.eclipse.jdt.internal.ui.compare) are good examples for this.
-<p>
-
-By default the differencing engine returns the result of the compare operation
-as a tree of <b>DiffNode</b> objects. However, this can be changed by overriding
-a single method of the engine.
-<p>
-
-Every <b>DiffNode</b> describes the changes among the two or three inputs.
-<p>
-
-A tree of <b>DiffNodes</b> can be displayed in a <b>DiffTreeViewer</b>.
-The <b>DiffTreeViewer</b> requires that inner nodes of the tree implement
-the <b>IDiffContainer</b> interface and leafs the <b>IDiffElement</b> interface.
-<p>
-
-The typical steps to compare hierarchically structured data and to display
-the differences would be to:
-<ul>
-<li>
-map the input data into a tree of <b>IStructureComparator</b> and <b>IStreamContentAccessor</b>s,</li>
-
-<li>
-perform the compare operation by means of the <b>Differencer</b>, and</li>
-
-<li>
-feed the differencing result into the <b>DiffTreeViewer</b>.</li>
-
-</ul>
-
-The <b>StructureDiffViewer</b> is a specialized <b>DiffTreeViewer</b>
-that automates the three steps from above. It takes a single input object
-of type <b>ICompareInput</b> from which it retrieves the two or three
-input elements to compare. Then it uses a <b>IStructureCreator</b> to
-extract a tree of <b>IStructureComparator</b> and <b>IStreamContentAccessor</b>
-from them. These trees are then compared with the differencing engine and
-the result is displayed in the tree viewer.
-<p>
-
-
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif
deleted file mode 100644
index 0088c97c8..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif
deleted file mode 100644
index 6c83c45d9..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif
deleted file mode 100644
index a3a444adf..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif
deleted file mode 100644
index 706dc020e..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif
deleted file mode 100644
index b95e26a1b..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gif b/bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gif
deleted file mode 100644
index 8392f3345..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gif b/bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gif
deleted file mode 100644
index 9b278e6fa..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif
deleted file mode 100644
index c2a47b6a2..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif
deleted file mode 100644
index 3aabbce51..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif b/bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif
deleted file mode 100644
index 2045daedd..000000000
--- a/bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif b/bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif
deleted file mode 100644
index ecde52ea8..000000000
--- a/bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif b/bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif
deleted file mode 100644
index 097ecdda5..000000000
--- a/bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/cview16/compare_view.gif b/bundles/org.eclipse.compare/icons/full/cview16/compare_view.gif
deleted file mode 100644
index 41800a0c9..000000000
--- a/bundles/org.eclipse.compare/icons/full/cview16/compare_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif
deleted file mode 100644
index 6e00deec9..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif
deleted file mode 100644
index cb11ac9f9..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif
deleted file mode 100644
index 202b04139..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif
deleted file mode 100644
index 4e9a3eb98..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif
deleted file mode 100644
index e84103f40..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gif
deleted file mode 100644
index 6cbeced26..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif
deleted file mode 100644
index a3441a062..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif
deleted file mode 100644
index 6f55d908b..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif
deleted file mode 100644
index 2a8541ca8..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif b/bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif
deleted file mode 100644
index ecab86455..000000000
--- a/bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif b/bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif
deleted file mode 100644
index c76fcc707..000000000
--- a/bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif b/bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif
deleted file mode 100644
index 55147cc33..000000000
--- a/bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif
deleted file mode 100644
index 3ce77c8d3..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif
deleted file mode 100644
index d9f5900b6..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif
deleted file mode 100644
index 61289f18f..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif
deleted file mode 100644
index 4fdde615d..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif
deleted file mode 100644
index feb14bf53..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gif b/bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gif
deleted file mode 100644
index 03b7af342..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gif b/bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gif
deleted file mode 100644
index dd65c5235..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif
deleted file mode 100644
index e0a262e03..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif
deleted file mode 100644
index 3e45390ef..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif b/bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif
deleted file mode 100644
index 4c2532296..000000000
--- a/bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gif b/bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gif
deleted file mode 100644
index b4451ec5e..000000000
--- a/bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif b/bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif
deleted file mode 100644
index f816c9e43..000000000
--- a/bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/eview16/compare_view.gif b/bundles/org.eclipse.compare/icons/full/eview16/compare_view.gif
deleted file mode 100644
index 1030b6efc..000000000
--- a/bundles/org.eclipse.compare/icons/full/eview16/compare_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/obj16/day_obj.gif b/bundles/org.eclipse.compare/icons/full/obj16/day_obj.gif
deleted file mode 100644
index 96aae05cb..000000000
--- a/bundles/org.eclipse.compare/icons/full/obj16/day_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif b/bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif
deleted file mode 100644
index d1e679e38..000000000
--- a/bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gif
deleted file mode 100644
index 2a8115602..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gif
deleted file mode 100644
index 67b25c457..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif
deleted file mode 100644
index e049755f2..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif
deleted file mode 100644
index 020fc5438..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif
deleted file mode 100644
index 39ed5115e..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gif
deleted file mode 100644
index 675c20fcc..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gif
deleted file mode 100644
index 95e4db64f..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif
deleted file mode 100644
index 0dc3ea89a..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif
deleted file mode 100644
index f719405c9..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gif
deleted file mode 100644
index 3e107d24d..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif
deleted file mode 100644
index 780da9881..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif
deleted file mode 100644
index 4f6a3168e..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif
deleted file mode 100644
index ab4898167..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif
deleted file mode 100644
index 14ba0119b..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif
deleted file mode 100644
index 0aca3c482..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif
deleted file mode 100644
index c37753736..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif
deleted file mode 100644
index 11c2d5de0..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif
deleted file mode 100644
index 704d70694..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif b/bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif
deleted file mode 100644
index 95ec3012e..000000000
--- a/bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif b/bundles/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif
deleted file mode 100644
index 61a3349f2..000000000
--- a/bundles/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugin.properties
deleted file mode 100644
index 10dcadb36..000000000
--- a/bundles/org.eclipse.compare/plugin.properties
+++ /dev/null
@@ -1,199 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-#
-# Resource strings for Compare Plug-in
-#
-pluginName= Compare Support
-providerName=Eclipse.org
-
-#
-# Extension point names
-#
-structureCreators= Structure Creator
-structureMergeViewers= Structure Merge Viewer
-contentMergeViewers= Content Merge Viewer
-contentViewers= Content Viewer
-
-#
-# CompareUIPlugin
-#
-CompareUIPlugin.dialogTitle=Compare
-CompareUIPlugin.noActiveWorkbenchPage=Can't find active workbench page
-CompareUIPlugin.compareFailed=Compare Failed
-CompareUIPlugin.openEditorError=Problems Opening Editor
-CompareUIPlugin.noDifferences=There are no differences between the selected inputs.
-
-#
-# Compare Editor
-#
-defaultCompareEditor.name= Default Compare Editor
-CompareEditor.saveError.title= Save Error
-CompareEditor.cantSaveError= Can''t save contents ({0})
-CompareEditor.invalidInput=Invalid input: not a CompareEditorInput
-CompareEditor.error.setinput.title=Problem while opening
-CompareEditor.error.setinput.message=Cannot open input:
-
-#
-# Commands
-#
-compareCategory.name= Compare
-compareCategory.description= Compare command category
-
-Command.copyRightToLeft.name= Copy from Right to Left
-Command.copyRightToLeft.description= Copy Current Change from Right to Left
-
-Command.copyLeftToRight.name= Copy from Left to Right
-Command.copyLeftToRight.description= Copy Current Change from Left to Right
-
-Command.copyAllRightToLeft.name= Copy All from Right to Left
-Command.copyAllRightToLeft.description= Copy All Changes from Right to Left
-
-Command.copyAllLeftToRight.name= Copy All from Left to Right
-Command.copyAllLeftToRight.description= Copy All Change from Left to Right
-
-Command.selectNextChange.name= Select Next Change
-Command.selectNextChange.description= Select Next Change
-
-Command.selectPreviousChange.name= Select Previous Change
-Command.selectPreviousChange.description= Select Previous Change
-
-
-#
-# Context menu & actions
-#
-CompareWithMenu.label= Comp&are With
-
-CompareWithEachOtherAction.label= &Each Other
-CompareWithEachOtherAction.tooltip= Compare the Selected Resources
-
-TeamMenu.label= T&eam
-
-CompareWithPatchAction.label= &Apply Patch...
-CompareWithPatchAction.tooltip= Apply a Patch to the Selected Resources
-
-CompareWithHistoryAction.label= &Local History...
-CompareWithHistoryAction.tooltip= Compare the Selected Resource with Local History
-
-ReplaceWithMenu.label= Rep&lace With
-
-ReplaceFromHistoryAction.label= &Local History...
-ReplaceFromHistoryAction.tooltip= Replace the Selected Resource with Local History
-
-ReplaceWithPreviousFromHistoryAction.label= &Previous from Local History
-ReplaceWithPreviousFromHistoryAction.tooltip= Replace the Selected Resource with the Previous from Local History
-
-addFromHistoryAction.label= Restore from Local Histor&y...
-addFromHistoryAction.tooltip= Restore Deleted Files from Local History
-
-#
-# Preference Page
-#
-ComparePreferencePage.name= Compare/Patch
-
-ComparePreferencePage.generalTab.label= &General
-
-ComparePreferencePage.structureCompare.label= &Open structure compare automatically
-ComparePreferencePage.showMoreInfo.label= &Show additional compare information in the status line
-ComparePreferencePage.ignoreWhitespace.label= Ignore &white space
-ComparePreferencePage.saveBeforePatching.label= A&utomatically save dirty editors before patching
-
-ComparePreferencePage.filter.description= Enter member names that should be excluded from 'Compare With Each Other'.\nList is comma separated (e.g. '*.class, .project, bin/')
-ComparePreferencePage.filter.label= &Filtered Members:
-ComparePreferencePage.filter.invalidsegment.error= Filter is invalid: {0}
-
-ComparePreferencePage.textCompareTab.label= &Text Compare
-
-ComparePreferencePage.initiallyShowAncestorPane.label= Initially show a&ncestor pane
-ComparePreferencePage.showPseudoConflicts.label= Show &pseudo conflicts
-ComparePreferencePage.synchronizeScrolling.label= Synchronize &scrolling between panes in compare viewers
-ComparePreferencePage.useSingleLine.label= Connect &ranges with single line
-
-ComparePreferencePage.preview.label= Preview:
-ComparePreferencePage.ancestor.label= Common Ancestor
-ComparePreferencePage.left.label= Local
-ComparePreferencePage.right.label= Remote
-ComparePreferencePage.backgroundColor1.label= Bac&kground Color:
-ComparePreferencePage.backgroundColor2.label= S&ystem Default
-ComparePreferencePage.backgroundColor3.label= C&ustom
-
-# Compare editor contents for Compare preview page
-ComparePreferencePage.previewAncestor= 1\n2\n3\nconflict\n4\n5
-ComparePreferencePage.previewLeft= 1\n2\noutgoing addition\n3\noutgoing change\n4\npseudo conflict\n5
-ComparePreferencePage.previewRight= 1\nincoming addition\nincoming addition\n2\n3\nincoming change\n4\npseudo conflict\n5
-
-compareFontDefiniton.label= Compare Text Font
-compareFontDefiniton.description= The compare text font is used by textual compare/merge editors.
-
-# New UI
-#ComparePreferencePage.useSplines.label= Use splines in center panel
-#ComparePreferencePage.useResolveUI.label= Use new resolve UI
-
-CompareEditorInput.defaultTitle= Compare
-
-#
-# Toolbar actions
-#
-action.IgnoreWhiteSpace.label=Ignore White Space
-action.IgnoreWhiteSpace.tooltip=Ignore White Space Where Applicable
-action.IgnoreWhiteSpace.image=etool16/ignorews_edit.gif
-
-action.Next.label=Next Difference
-action.Next.tooltip=Go to Next Difference
-action.Next.image=elcl16/next_nav.gif
-
-action.Previous.label=Previous Difference
-action.Previous.tooltip=Go to Previous Difference
-action.Previous.image=elcl16/prev_nav.gif
-
-#
-# Built in Structure Creators
-#
-ZipStructureCreator.name=Zip Archive Compare
-
-#
-# Compare Dialog
-#
-CompareDialog.commitAction.label=Commit
-CompareDialog.saveErrorTitle=Save Error
-CompareDialog.saveErrorMessage=Can't save
-
-#
-# Compare With Each Other
-#
-ResourceCompare.taskName=Operation in Progress...
-ResourceCompare.twoWay.title=Compare ({0}-{1})
-ResourceCompare.twoWay.tooltip={0}-{1}
-ResourceCompare.threeWay.title=Compare ({0}-{1}-{2})
-ResourceCompare.threeWay.tooltip={1}-{2}
-
-#
-# DiffTreeViewer & DiffNodes
-#
-DiffTreeViewer.title= Structure Compare
-DiffNode.noName= <no name>
-DiffNode.nameFormat= {0} / {1}
-
-#
-# Differencing engine
-#
-Differencer.progressFormat= Comparing {0}
-
-#
-# Patch: rejected patch markers
-#
-rejectedPatchMarker.name= Rejected Patch
-
-#
-# ValidateEdit
-#
-ValidateEdit.error.unable_to_perform= Operation can\'t be performed.
-ValidateEdit.error.fileModified= File ''{0}'' has been modified since the beginning of the operation.
-ValidateEdit.error.stillReadonly= File ''{0}'' is readonly.
diff --git a/bundles/org.eclipse.compare/plugin.xml b/bundles/org.eclipse.compare/plugin.xml
deleted file mode 100644
index 622776501..000000000
--- a/bundles/org.eclipse.compare/plugin.xml
+++ /dev/null
@@ -1,302 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.compare"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.compare.internal.CompareUIPlugin">
-
- <runtime>
- <library name="compare.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.compare"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.ui.views"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- </requires>
-
-
-<!-- Compare extension point definitions -->
- <extension-point id="structureCreators" name="%structureCreators" schema="schema/structureCreators.exsd"/>
- <extension-point id="structureMergeViewers" name="%structureMergeViewers" schema="schema/structureMergeViewers.exsd"/>
- <extension-point id="contentMergeViewers" name="%contentMergeViewers" schema="schema/contentMergeViewers.exsd"/>
- <extension-point id="contentViewers" name="%contentViewers" schema="schema/contentViewers.exsd"/>
-
-<!-- Extensions -->
- <extension
- point="org.eclipse.ui.fontDefinitions">
- <fontDefinition
- label="%compareFontDefiniton.label"
- defaultsTo="org.eclipse.jface.textfont"
- id="org.eclipse.compare.contentmergeviewer.TextMergeViewer">
- <description>
- %compareFontDefiniton.description
- </description>
- </fontDefinition>
- </extension>
- <extension
- id="rejectedPatchMarker"
- name="%rejectedPatchMarker.name"
- point="org.eclipse.core.resources.markers">
- <super
- type="org.eclipse.core.resources.taskmarker">
- </super>
- <persistent
- value="true">
- </persistent>
- </extension>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="%defaultCompareEditor.name"
- icon="icons/full/cview16/compare_view.gif"
- contributorClass="org.eclipse.compare.internal.CompareEditorContributor"
- class="org.eclipse.compare.internal.CompareEditor"
- id="org.eclipse.compare.CompareEditor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%ComparePreferencePage.name"
- category="org.eclipse.ui.preferencePages.Workbench"
- class="org.eclipse.compare.internal.ComparePreferencePage"
- id="org.eclipse.compare.internal.ComparePreferencePage">
- </page>
- </extension>
-<!-- commands and their bindings -->
- <extension
- point="org.eclipse.ui.commands">
- <category
- name="%compareCategory.name"
- description="%compareCategory.description"
- id="org.eclipse.compare.ui.category.compare">
- </category>
- <command
- name="%Command.copyRightToLeft.name"
- description="%Command.copyRightToLeft.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyRightToLeft">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyRightToLeft"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.copyLeftToRight.name"
- description="%Command.copyLeftToRight.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyLeftToRight">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyLeftToRight"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.copyAllRightToLeft.name"
- description="%Command.copyAllRightToLeft.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyAllRightToLeft">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyAllRightToLeft"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.copyAllLeftToRight.name"
- description="%Command.copyAllLeftToRight.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyAllLeftToRight">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyAllLeftToRight"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.selectNextChange.name"
- description="%Command.selectNextChange.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.selectNextChange">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.selectNextChange"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.selectPreviousChange.name"
- description="%Command.selectPreviousChange.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.selectPreviousChange">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.selectPreviousChange"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- id="org.eclipse.compare.CompareAction">
- <menu
- label="%ReplaceWithMenu.label"
- path="additions"
- id="replaceWithMenu">
- <separator
- name="replaceWithGroup">
- </separator>
- </menu>
- <menu
- label="%CompareWithMenu.label"
- path="additions"
- id="compareWithMenu">
- <separator
- name="compareWithGroup">
- </separator>
- </menu>
- <menu
- label="%TeamMenu.label"
- path="additions"
- id="team.main">
- <separator
- name="group1">
- </separator>
- </menu>
- <action
- label="%CompareWithEachOtherAction.label"
- tooltip="%CompareWithEachOtherAction.tooltip"
- class="org.eclipse.compare.internal.CompareAction"
- menubarPath="compareWithMenu/compareWithGroup"
- enablesFor="2+"
- id="compareWithEachOther">
- </action>
- <action
- label="%CompareWithPatchAction.label"
- tooltip="%CompareWithPatchAction.tooltip"
- class="org.eclipse.compare.internal.patch.CompareWithPatchAction"
- menubarPath="team.main/group1"
- enablesFor="1"
- id="compareWithPatch">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true"
- id="org.eclipse.compare.ReplaceWithEditionAction">
- <menu
- label="%ReplaceWithMenu.label"
- path="additions"
- id="replaceWithMenu">
- <separator
- name="replaceWithGroup">
- </separator>
- </menu>
- <action
- label="%ReplaceFromHistoryAction.label"
- tooltip="%ReplaceFromHistoryAction.tooltip"
- class="org.eclipse.compare.internal.ReplaceWithEditionAction"
- menubarPath="replaceWithMenu/replaceWithGroup"
- enablesFor="1"
- id="replaceFromHistory">
- </action>
- <action
- label="%ReplaceWithPreviousFromHistoryAction.label"
- tooltip="%ReplaceWithPreviousFromHistoryAction.tooltip"
- class="org.eclipse.compare.internal.ReplaceWithPreviousEditionAction"
- menubarPath="replaceWithMenu/replaceWithGroup"
- enablesFor="1"
- id="replaceWithPreviousFromHistory">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true"
- id="org.eclipse.compare.CompareWithEditionAction">
- <menu
- label="%CompareWithMenu.label"
- path="additions"
- id="compareWithMenu">
- <separator
- name="compareWithGroup">
- </separator>
- </menu>
- <action
- label="%CompareWithHistoryAction.label"
- tooltip="%CompareWithHistoryAction.tooltip"
- class="org.eclipse.compare.internal.CompareWithEditionAction"
- menubarPath="compareWithMenu/compareWithGroup"
- enablesFor="1"
- id="compareWithHistory">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IContainer"
- adaptable="true"
- id="org.eclipse.compare.AddFromHistoryAction">
- <action
- label="%addFromHistoryAction.label"
- tooltip="%addFromHistoryAction.tooltip"
- class="org.eclipse.compare.internal.AddFromHistoryAction"
- menubarPath="replaceWithMenu"
- enablesFor="1"
- id="addFromHistoryAction">
- </action>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.compare.structureCreators">
- <structureCreator
- extensions="zip"
- class="org.eclipse.compare.ZipFileStructureCreator"
- id="org.eclipse.compare.ZipFileStructureCreator">
- </structureCreator>
- </extension>
- <extension
- point="org.eclipse.compare.contentMergeViewers">
- <viewer
- extensions="class,exe,dll,binary,zip,jar"
- class="org.eclipse.compare.internal.BinaryCompareViewerCreator"
- id="org.eclipse.compare.BinaryCompareViewerCreator">
- </viewer>
- <viewer
- extensions="txt"
- class="org.eclipse.compare.internal.TextMergeViewerCreator"
- id="org.eclipse.compare.TextMergeViewerCreator">
- </viewer>
- <viewer
- extensions="gif,jpg"
- class="org.eclipse.compare.internal.ImageMergeViewerCreator"
- id="org.eclipse.compare.ImageMergeViewerCreator">
- </viewer>
- </extension>
- <extension
- point="org.eclipse.compare.contentViewers">
- <viewer
- extensions="txt"
- class="org.eclipse.compare.internal.TextViewerCreator"
- id="org.eclipse.compare.TextViewerCreator">
- </viewer>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath
deleted file mode 100644
index 3e86ace7d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="compare"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project
deleted file mode 100644
index f0d1e74ed..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.compare</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.ui.ide</project>
- <project>org.eclipse.ui.views</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html
deleted file mode 100644
index 9db411aab..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties
deleted file mode 100644
index 22bed075e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.compare.jar = compare/
-bin.includes = icons/,\
- plugin.xml,\
- *.jar,\
- plugin.properties,\
- about.html
-src.includes = about.html,\
- schema/
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
deleted file mode 100644
index 655f1078f..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ /dev/null
@@ -1,1454 +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="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <meta name="Author" content="IBM">
- <title>Eclipse Platform Release Notes - Desktop</title>
-</head>
-<body>
-
-<h1>
-Eclipse Platform Build Notes<br>
-Compare</h1>
-Eclipse Build Input March 2th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=42731">#42731</a>: Synchronize horizontal scrolling in compare editor<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2278">#2278</a>: DCR: Would like coupled horizontal scrolling in compare browser (1GEJNHO)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=53368">#53368</a>: Layout problem with focus ring<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 17th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=51593">#51593</a>: ArrayIndexOutOfBoundsException at org.eclipse.compare.internal.patch.PatchWizard.setTargets<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=52055">#52055</a>: Method compare is broken<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 10th 2004 (M7)
-
-<h2>
-API Additions</h2>
-Added new interface IEncodedStreamContentAccessor; deprecated IStreamContentAccessorExtension2<br>
-Added first cut of outline view support.
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 27th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=50565">#50565</a>: [Preferences] Pref page Workbench/Compare/Patch; no mnemonic for "Filtered Members"<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 13th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=49695">#49695</a>: Apply Patch wizard is leaking 7 Images<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=49803">#49803</a>: Replace with local history leaks 2 images<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 6th 2004
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32329">#32329</a>: Support filters for compare<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 18th (M6) 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=47866">#47866</a>: Internal error in synchronize perspective<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=45239">#45239</a>: Show ancestor for incoming and outgoing changes<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=41815">#41815</a>: Internal error comparing with repository<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46709">#46709</a>: PatchWizard should use scheduling rule on project<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 25th 2003
-
-<h2>
-Problem reports fixed</h2>
-removed use of deprecated symbols
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 19th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46805">#46805</a>: prepare Compare for encoding support<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46877">#46877</a>: Remove dependancies on Xerces<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46977">#46977</a>: Comparing/merging two local files screws up the content<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input August 26th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=40727">#40727</a>: Allow navigation workflow control from other view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=39757">#39757</a>: Some compare operations fail on resources that do not exist<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=35380">#35380</a>: Replace with Local History and read-only resources<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input July 15th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38836">#38836</a>: CompareEditorInput clears dirty state too quickly<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input July 1st 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38808">#38808</a>: NPE in log file when restoring files from history.<br>
-fixed minor error in schema files
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 24th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 10th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38713">#38713</a>: Compare with -> Each other is not enabled<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 3rd 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37531">#37531</a>: the javadoc of CompareViewerPane.setImage(Image)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38262">#38262</a>: Apply patch applies unchecked changes<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=36399">#36399</a>: Compare did retrieve entire remote ZIP contents on selection change<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38198">#38198</a>: TVT21: Strings are not externalized<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input Mai 27th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37849">#37849</a>: "Ignore whitespace" ignores also closing brackets?!?<br>
-
-Problem reports closed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37582">#37582</a>: Ignore whitespace option should be a button in the compare editor<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 27th 2003
-
-<h2>
-Problem reports fixed</h2>
-Fixed 5 Javadoc warnings
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 24th 2003
-
-<h2>
-Problem reports fixed</h2>
-Updated schema copyright notices<br>
-updated javadoc
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 19th 2003
-
-<h2>
-Problem reports fixed</h2>
-Fixed wording in properties files<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=35130">#35130</a>: Dialogs do not set the dialog font<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 14th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=34732">#34732</a>: Compare/Patch preference page mnemonic<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=34696">#34696</a>: Title casing issues<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 6th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=27405">#27405</a>: Should consider using the new font propogation support<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24255">#24255</a>: Internal error when invoking "Restore from Local History" in Outline view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32737">#32737</a>: NegativeArraySizeException: Compare/patch preference page<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 4th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32769">#32769</a>: Missing mneumonic in compare preference page<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32798">#32798</a>: No mnemonic for ComparePreferencePage.useSingleLine.label<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=32207">#32207</a>: Wording: "Open with Compare Editor" action in sync view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28190">#28190</a>: Middle area should act like sash<br>
-added required IDs for compare viewers in plugin.xml<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 20th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=20248">#20248</a>: [Compare] Have to perform two actions to see diff<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24165">#24165</a>: Should have menu action for showing compare contents<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13332">#13332</a>: autosave before patching: can i undo?<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24077">#24077</a>: Comparing file named 'platformOption' does not use text editor<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=23958">#23958</a>: NPE in compare with patch<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28402">#28402</a>: CompareConfiguration leaks Images<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13844">#13844</a>: TextMergeViewer should keep track of its posted runnables<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14353">#14353</a>: Cannot perform merge with keyboard accelerators/mnemonics<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 18th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5323">#5323</a>: Compare does not handle correctly conflicts at same location<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=26035">#26035</a>: Local history uses wrong character encoding<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=15654">#15654</a>: Can't maximize Compare with Local History window<br>
-
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 13th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=31136">#31136</a>: Red icon too intrusive<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=31357">#31357</a>: Compare View -- Compare-style option required.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=31633">#31633</a>: Cannot apply patch successfully<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10754">#10754</a>: Compare actions should target source window<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 11th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=25507">#25507</a>: Compare view prevents Ctrl + F6 working<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18571">#18571</a>: patch: scary error dialog when no patch in clipboard<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28840">#28840</a>: Strange behavious applying patch<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 6th 2003 (M5 aka RC0)
-
-<h2>
-API Additions</h2>
-Added new method EditionSelectionDialog.getSelection()
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=30525">#30525</a>: "Team" menu item missing accelerator<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28202">#28202</a>: contentmergeviewers do not work with mixed-case extensions<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19114">#19114</a>: Restore Java Element from Local History should also provide check boxes [compare]<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28436">#28436</a>: Overview rule green only after focus change<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=29793">#29793</a>: Automatically suggest a fuzz factor when applying a patch<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 28th 2003
-
-<h2>
-API Additions</h2>
-Added new method CompareUI.findContentViewer(..., Object input, ...)
-
-<h2>
-Problem reports fixed</h2>
-Remoced doc folder.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=24597">#24597</a>: Compare UI API issues<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=23883">#23883</a>: CompareDialog.commitAction.label string resource name is wrong<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=29791">#29791</a>: Rename 'Compare to Patch' to 'Apply Patch'<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 14th 2003
-
-<h2>
-Problem reports fixed</h2>
-Extension point schema files added.<br>
-Resolve status indicator is only shown if there are incoming changes.
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 7th 2003
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28278">#28278</a>: TextMergeViewer leaks Color objects<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=27864">#27864</a>: Load of CompareUI fails when not triggered in UI thread<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28388">#28388</a>: Illegal Argument Exceptions in compare viewer<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 17th 2002
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28388">#28388</a>: Illegal Argument Exceptions in compare viewer<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 16th 2002
-
-<h2>
-Problem reports fixed</h2>
-Fixed a problem with trim in compare viewer on Mac OS X.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28278">#28278</a>: TextMergeViewer leaks Color objects<br>
-
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 13th 2002
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=28012">#28012</a>: Double-click behaving strangely in Synchronize View<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 10th 2002
-
-<h2>
-What's new in this drop</h2>
-The Textmergeviewer sports a first cut of a new UI for left/right copying,
-showing the 'resolved' status of a change, and uses smooth lines to
-connect the differing ranges in the left and right panes.
-The new UI options are off by default. You can turn them on
-with the three 'experimental' options on the Compare preference page.
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=27993">#27993</a>: Incorrect structure comparison<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 3rd 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API Additions</h3>
-Made internal class Splitter public API.
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#24597</a>: Compare UI API issues<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 26th 2002
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#20975</a>: Compare preference page has no F1 help<br>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 27th 2002
-
-<h2>
-What's new in this drop</h2>
-Updated JavaDoc package.html files
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 25th 2002
-
-<h2>
-What's new in this drop</h2>
-Updated JavaDoc
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 12th 2002
-
-<h2>
-What's new in this drop</h2>
-
-There were several complains that clicking on a zip file in the left pane (structure input pane) feeds all other
-compare panes (see bug 13730). There are cases where this is expensive (for example a large zip file that has
-to be read from a repository). To avoid those situations the left pane now honors single or double click mode as
-set in Preferences->Workbench. So if this preference is set to double click the user has to double click on a file
-in the left pane to actually feed all other compare panes.
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 8th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#18807</a>: Compare with patch fails due to missing LF<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13730">#13730</a>: Entire zipfiles content sent prior when computing synchronization view content<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 7th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13730">#13730</a>: Entire zipfiles content sent prior when computing synchronization view content<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14952">#14952</a>: Diff Browser Opens Too Small / Not Easily Resizable<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 6th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-New constant CompareUI.PLUGIN_ID
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13949">#13949</a>: DBCS: bogus at text compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19013">#19013</a>: backgronud color: is it honored?<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19216">#19216</a>: Accessibility in Workbench > Compare > Text Compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=19371">#19371</a>: Java & Compare editor's Next/Previous toolbar buttons shouldn't be retargetable<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input June 1st 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-Made class NavigationAction public.
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8004">#8004</a>: Ctrl+E beeps every time<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14800">#14800</a>: Compare View eats tabs<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18200">#18200</a>: Both sets of arrows say "Select Next Change"<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18206">#18206</a>: Casing, wording issue on "Last Resource reached" prompt<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16285">#16285</a>: Add from Local History needs a description label<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17431">#17431</a>: Accessibility issues<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18148">#18148</a>: Using combinations of No and Next file button break wrapping<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18151">#18151</a>: Next File button does not ding when on last file<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16570">#16570</a>: Compare refuses to show further differences if not ignoring whitespaces<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10790">#10790</a>: Patch does not apply if file not found locally<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=12643">#12643</a>: Expand all does not disable when there is no selection<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 31st 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18116">#18116</a>: Compare view does not inherit Java editor background color<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13190">#13190</a>: Compare with Patch does not apply Patch, if single file selected<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 30th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17699">#17699</a>: Java Editor: Local Histroy menu entries are enabled for read-only files<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16283">#16283</a>: Add from Local History items are unsorted<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16288">#16288</a>: Add from Local History: list of available editions flashes<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17664">#17664</a>: Applying a patch with deleted package fails<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 29th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14040">#14040</a>: Platform interoperability issue w.r.t. Compare With Patch<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17790">#17790</a>: Missing mnemonics in patch selection dialog<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10917">#10917</a>: Patch support does not use mnemonics<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 28th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17889">#17889</a>: Should not assume type of PropertyChangeEvent values<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17678">#17678</a>: Applying a patch does many compiles<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17536">#17536</a>: NPE in compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17121">#17121</a>: Casing of message when end of changes needs to be sentence style<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=17648">#17648</a>: Can't apply patch w/o ignoring whitespace<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=16936">#16936</a>: Compare with patch requires "Ignore Whitespace" to be turned off<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 18th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14371">#14371</a>: TextMergeViewer.sameDoc() is broken<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14378">#14378</a>: CompareEditorInput never resets dirtyness flag (detailed)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14680">#14680</a>: Compare unreadable in high contrast black<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14952">#14952</a>: Diff Browser Opens Too Small / Not Easily Resizable<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14742">#14742</a>: Ignore whitespace preference<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14624">#14624</a>: No visual cue when compared file wraps<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13606">#13606</a>: Support multiple selection in Add from local history<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input May 16th 2002
-
-<h2>
-What's new in this drop</h2>
-Bumped plugin version number to 2.0.0<br>
-Adapted to new findEditor methods<br>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8373">#8373</a>: Compare With->Patch... missing mnemonic<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=12719">#12719</a>: "Show Pseudo-Conflicts" setting is problematic<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input April 30th 2002
-
-<h2>
-What's new in this drop</h2>
-All strings NLSed.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14515">#14515</a>: java compare uses internal jcore scanner<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=14782">#14782</a>: Add from Local History missing mnemonic<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input April 18th 2002
-
-<h2>
-What's new in this drop</h2>
-All strings NLSed.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13152">#13152</a>: Internal error in "Add from Local History..." on packages<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input April 9th 2002
-
-<h2>
-What's new in this drop</h2>
-New context menu action 'Add From Local History'. Just select any resource container and
-'Add From Local History' presents all files that were deleted from the workspace but are
-still in the local history.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-The new 'Add From Local History' suffers from #12915. It works if the files were deleted
-within the same session. However if you shut down and restart a workspace some deleted
-files are nor listed.
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11578">#11578</a>: Patch: Missing resource on dialog<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11579">#11579</a>: Compare with Patch should be disabled on closed projects<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11907">#11907</a>: clicking in bird's eye view spots does nothing if panes not synched<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11536">#11536</a>: Option to turn off structured comparison<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10682">#10682</a>: Need better UI for recovering deletions from local history<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11446">#11446</a>: provide "add from local history" for compilation units<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8615">#8615</a>: Styled Text widget does not respond to system color change<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9673">#9673</a>: editor background color - no effect on other viewers<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11642">#11642</a>: Compare editors not using default background colors<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10434">#10434</a>: Compare browser fails silently and does not give result<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 18th 2002
-
-<h2>
-What's new in this drop</h2>
-First cut of a birdseyeview for the text compare viewer.<br>
-'Compare which Each other' for Java elements.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3641">#3641</a>: DCR: Can't compare from outliner (1GDHJKK)<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 14th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=11305">#11305</a>: Can't compare a "C" file<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 12th 2002
-
-<h2>
-What's new in this drop</h2>
-Structure Compare viewers are enabled by default.<br>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=10379">#10379</a>: Compare with Local History Dialog: lower pane is missing a bordeer<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9768">#9768</a>: (empty-menu) in compare view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9842">#9842</a>: Expand All action needed in structure compare view<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input March 5th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9869">#9869</a>: Need more support for creating/deleting resources<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 26th 2002
-
-<h2>
-What's new in this drop</h2>
-Patch: for every rejected file a task marker is added<br>
-Compare preference page shows options in a preview<br>
-New preference option for additional compare status line information
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9540">#9540</a>: Compare with patch: it should not be possible to check items that could not be applied<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9532">#9532</a>: Compare with patch: next disabled although clipboard specified<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7681">#7681</a>: Structured results expands import statements<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9572">#9572</a>: Debugging trace left in status bar<br>
-
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 12th 2002
-
-<h2>
-What's new in this drop</h2>
-The patch wizard no longer opens a Compare Editor but applies the
-patch directly to the workspace. This will be the default.
-In the future the old behavior of opening the Compare Editor will be
-an additional option when finishing the wizard.
-<br>
-Patch wizard has a 'Reverse' option for applying a "reversed" patch.
-This option can be used to 'undo' a patch.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9153">#9153</a>: NPE when closing synchronize view<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9331">#9331</a>: NPE during compare with stream version<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6346">#6346</a>: Problems with Patch<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6727">#6727</a>: Patch: *.rej file must be saved in workspace<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7358">#7358</a>: Internal Error in Compare with Patch with new files<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input February 5th 2002
-
-<h2>
-What's new in this drop</h2>
-The structure compare pane opens when a resource is selected.
-In previous version a double click was required.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5063">#5063</a>: Should not have to double-click to open Structure Compare<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2602">#2602</a>: Compare FW accessibility issues (1GK79UB)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2707">#2707</a>: Merge viewer should ask for save before releasing (1GI9JXS)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2772">#2772</a>: DCR: Automatic structure compare (1GJ6EUY)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3829">#3829</a>: Smart rename button enabled when no smartness is available (1GEUVHN)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9089">#9089</a>: Local history - Selecting item in structured compare has no effect<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 29th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6271">#6271</a>: Can't tell which file is which in Compare browser<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2519">#2519</a>: next/prev arrows active when only one difference in compare (1GFIQX3)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8363">#8363</a>: NPE comparing two resources in the navigator.<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2501">#2501</a>: Empty menu in compare browser (1GFBQKE)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2854">#2854</a>: Compare: Save code path problematic (1GJYGAX)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8574">#8574</a>: Not structure compare in compare with local history<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 23th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8089">#8089</a>: Replace from local history: parse error<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 22th 2002
-
-<h2>
-What's new in this drop</h2>
-Fixed an inconsistency in the binary compare viewer:
-info message didn't match +/-icon in the resource compare pane.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3859">#3859</a>: replace from history does not work for elements with error (1GEYIZ6)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6177">#6177</a>: Double click action dangerous in 'Restore from Local History'<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7821">#7821</a>: Team 2.0 CVS synchronze bug 'no-name' dirs..<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2773">#2773</a>: Java structure compare should give better indication when no changes (1GJ6ENE)<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 15th 2002
-
-<h2>
-What's new in this drop</h2>
-Fixed a problem in DiffNode.getName()and the DiffTreeViewer's label provider
-where the left and right half of a DiffNode label would be reversed because
-the "leftIsLocal" property of a CompareConfiguration wasn't obeyed.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=1893">#1893</a>: Compare Viewer doesn't scroll to last line (1GBB34N)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5839">#5839</a>: Usability: Initial diff is sometimes not horizontally aligned<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5325">#5325</a>: Compare always scroll the text pane to the extreme limit<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7048">#7048</a>: First element not selected<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2548">#2548</a>: Project compare should open viewing selected file (1GFMRP6)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2938">#2938</a>: Replace from local history should show busy cursor (1GKU0P3)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7594">#7594</a>: Menu entry "Replace with Previous" shouldn't have a "..."<br>
-Workaround added for:<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7320">#7320</a>: Next diff scrolls when going into current diff<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input January 8th 2002
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-Added methods to CompareUI plugin for adding and removing aliases
-for the file extension to StructureCompareViewer mapping
-(addStructureViewerAlias, removeStructureViewerAlias).
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6828">#6828</a>: Support with replace with previous<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2396">#2396</a>: Save in compare editors needs progress bar (1GEYF58)<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5271">#5271</a>: JARs compared as source in release browser<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5121">#5121</a>: Replace with Previous (from local history)<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 11th 2001
-
-<h2>
-What's new in this drop</h2>
-Keyboard shortcuts for 'Goto next Difference' and 'Goto previous Difference'
-changed to Control-E and Control-Shift-E.<br>
-Better NLS support.<br>
-Updated file "about.html".
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input December 4th 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=4381">#4381</a>: Replace from local histroy - workspace element included <br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse Build Input November 27th 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6298">#6298</a>: Replace with Local History: Workbench -> Workspace<br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5238">#5238</a>: Compare fails if takes more than 20 seconds<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 210, November 12th, 2001
-
-<h2>
-What's new in this drop</h2>
-First cut for 'rejected hunk' support.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-new classes CompareViewerPane and CompareViewerSwitchingPane<br>
-
-<h3>
-Other highlights</h3>
-Improved Patch wizard.<br>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5723">#5723</a>: Apply Patch dialog has no radio selection<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 207, November 1st, 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5334">#5334: Internal errors using patch tool</a><br>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5150">#5150: Compare with patch cannot read VCM's CVS patch file</a><br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 204, October 12th, 2001
-
-<h2>
-What's new in this drop</h2>
-First cut of patch support.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 202, September 27th, 2001
-
-<h2>
-What's new in this drop</h2>
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GKKUA5: ITPUI:WINNT - Severe: memory leak in sync view<br>
-1GKKGGS: ITPJUI:WIN2000 - (136) compares zips as source<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 201, September 21st, 2001
-
-<h2>
-What's new in this drop</h2>
-removed direction icon in TextMergeViewer for two-way compare
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GJURWJ: ITPUI:WIN2000 - Hebrew + Japanese: compare view defaults to binary<br>
-1GK0388: ITPJCORE:WIN2000 - replace with local history: selecting (workspace) deletes source<br>
-1GITG2V: ITPUI:WIN2000 - Comparing html files uses binary compare<br>
-1GJW2TP: ITPJUI:WIN2000 - java compare: why beep every time?<br>
-
-<h2>
-Problem reports closed</h2>
-
-<h1>
-<hr WIDTH="100%"></h1>
-Eclipse SDK Build 200, September 13th, 2001
-
-<h2>
-What's new in this drop</h2>
-If not specified otherwise Compare viewer font is taken from workbench text font<br>
-The shortcut for "Goto Next/Previous Difference" is Ctrl-D/Ctrl-Shift-D
-to avoid a clash with Ctrl-P of the Print command.
-
-<h3>
-API changes</h3>
-
-<h3>
-API Additions</h3>
-new method EditionSelectionDialog.setHideIdenticalEntries(boolean)<br>
-new method EditionSelectionDialog.setTargetIsRight(boolean)<br>
-new method EditionSelectionDialog.setAddMode(boolean)<br>
-new method CompareEditorInput.saveChanges(...)<br>
-new method TextMergeViewer.createLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace)<br>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty<br>
-1GG0ELM: ITPVCM:ALL - Local history displayed some of Today's items as Yesterday<br>
-1GGNKHN: ITPJUI:ALL - No progress during replace with local history<br>
-1GF2JNI: ITPUI:ALL - (minor)Compare failed title should be title case<br>
-1GHBPA1: ITPVCM:WINNT - Compare - next change arrow switches to wrong file<br>
-1GGQQH3: ITPJUI:WINNT - Compare hightlights a non-change instead of the change<br>
-1GI5DN9: ITPUI:WIN2000 - Conflicting token deletions don't show up in text compare viewer<br>
-1GI3KUR: ITPJUI:WIN2000 - Compare: double-click in versions list closes view<br>
-1GFFR4B: ITPUI:WIN98 - local history is misleading<br>
-1GBM0IL: ITPUI:WINNT - CompareEditorInput#save should throw CoreException<br>
-1GI99LE: ITPUI:ALL - Compare viewer does not show last line when horizontal scroll bar is present<br>
-1GBB34N: ITPJUI:WIN2000 - Compare Viewer doesn't scroll to last line<br>
-1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range<br>
-1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files<br>
-1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update<br>
-1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options<br>
-1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()<br>
-1GI3HDZ: ITPJUI:ALL - Compare: conflicts with no ancestor does not show differences<br>
-1GEUX0D: ITPJUI:ALL - not state aware toolbar button in compare<br>
-
-<h2>
-Problem reports closed</h2>
-1GF9Y9C: ITPUI:WIN2000 - DCR: only get ancestor pane contents if pane is visible<br>
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
deleted file mode 100644
index 2c1f7b769..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.internal.Utilities;
-
-/**
- * Abstract implementation for a buffered <code>IStreamContentAccessor</code>.
- * <p>
- * Subclasses must implement the <code>createStream</code> method
- * to connect the buffered content with a streamable source (e.g., a file).
- * <p>
- * As long as the contents of <code>BufferedContent</code> is only retrieved as an input stream
- * (by means of <code>getContents</code>) and the <code>BufferedContent</code> is not modified (with
- * <code>setContent</code>) no buffering takes place.
- * Buffering starts when either method <code>getContent</code> or <code>setContent</code> is called.
- *
- * @see IContentChangeNotifier
- * @see IStreamContentAccessor
- */
-public abstract class BufferedContent implements IContentChangeNotifier, IStreamContentAccessor {
-
- byte[] fContent;
- private ListenerList fListenerList;
-
- /**
- * Creates a buffered stream content accessor.
- */
- protected BufferedContent() {
- }
-
- /* (non-Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() throws CoreException {
- if (fContent != null)
- return new ByteArrayInputStream(fContent);
- return createStream();
- }
-
- /**
- * Creates and returns a stream for reading the contents.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @return the stream from which the content is read
- * @exception CoreException if the contents could not be accessed
- */
- protected abstract InputStream createStream() throws CoreException;
-
- /**
- * Sets the contents. Registered content change listeners are notified.
- *
- * @param contents the new contents
- */
- public void setContent(byte[] contents) {
- fContent= contents;
- fireContentChanged();
- }
-
- /**
- * Returns the contents as an array of bytes.
- *
- * @return the contents as an array of bytes, or <code>null</code> if
- * the contents could not be accessed
- */
- public byte[] getContent() {
- if (fContent == null) {
- try {
- InputStream is= createStream();
- fContent= Utilities.readBytes(is);
- } catch(CoreException ex) {
- // NeedWork
- }
- }
- return fContent;
- }
-
- /**
- * Discards the buffered content.
- */
- public void discardBuffer() {
- fContent= null;
- }
-
- /* (non-Javadoc)
- * see IContentChangeNotifier.addChangeListener
- */
- public void addContentChangeListener(IContentChangeListener listener) {
- if (fListenerList == null)
- fListenerList= new ListenerList();
- fListenerList.add(listener);
- }
-
- /* (non-Javadoc)
- * see IContentChangeNotifier.removeChangeListener
- */
- public void removeContentChangeListener(IContentChangeListener listener) {
- if (fListenerList != null) {
- fListenerList.remove(listener);
- if (fListenerList.isEmpty())
- fListenerList= null;
- }
- }
-
- /**
- * Notifies all registered <code>IContentChangeListener</code>s of a content change.
- */
- protected void fireContentChanged() {
- if (fListenerList != null) {
- Object[] listeners= fListenerList.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IContentChangeListener)listeners[i]).contentChanged(this);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
deleted file mode 100644
index 4894d833a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.HashMap;
-
-import org.eclipse.swt.graphics.*;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-
-/**
- * A <code>CompareConfiguration</code> object
- * controls various UI aspects of compare/merge viewers like
- * title labels and images, or whether a side of a merge viewer is editable.
- * In addition to these fixed properties <code>ICompareConfiguration</code> provides
- * API for an open ended set of properties. Different viewers which share the same
- * configuration can communicate via this mechanism. E.g. if a compare editor
- * has a button for controlling whether compare viewers ignore white space,
- * the button would trigger a change of the boolean <code>IGNORE_WHITESPACE</code> property
- * and all interested viewers would receive notification.
- * <p>
- * Suitable default labels are provided (without images); both the left and right sides
- * are editable.
- * </p>
- * <p>
- * Clients may use this class as is, or subclass to add new state and behavior.
- * </p>
- */
-public class CompareConfiguration {
-
- /**
- * Name of the ignore whitespace property (value <code>"IGNORE_WHITESPACE"</code>).
- */
- public static final String IGNORE_WHITESPACE= "IGNORE_WHITESPACE"; //$NON-NLS-1$
- /**
- * Name of the show pseudo conflicts property (value <code>"SHOW_PSEUDO_CONFLICTS"</code>).
- */
- public static final String SHOW_PSEUDO_CONFLICTS= "SHOW_PSEUDO_CONFLICTS"; //$NON-NLS-1$
- /**
- * Name of the use outline view property (value <code>"USE_OUTLINE_VIEW"</code>).
- * @since 3.0
- */
- public static final String USE_OUTLINE_VIEW= "USE_OUTLINE_VIEW"; //$NON-NLS-1$
-
-
- private static final int WIDTH= 22;
-
- private static ImageDescriptor[] fgImages= new ImageDescriptor[16];
- private static Object fgDummy= new Object();
- private static HashMap fgMap= new HashMap(20);
- private static boolean fLeftIsLocal= true;
-
- static {
- if (fLeftIsLocal) {
- fgImages[Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/del_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/r_inadd_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/r_outadd_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/add_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/r_indel_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/r_outdel_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.LEFT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/r_inchg_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/r_outchg_ov.gif"); //$NON-NLS-1$
- } else {
- fgImages[Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/add_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/inadd_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/outadd_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/del_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.LEFT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/indel_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/outdel_ov.gif"); //$NON-NLS-1$
-
- fgImages[Differencer.LEFT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/inchg_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.RIGHT + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/outchg_ov.gif"); //$NON-NLS-1$
- }
-
- fgImages[Differencer.CONFLICTING + Differencer.ADDITION]= CompareUIPlugin.getImageDescriptor("ovr16/confadd_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.CONFLICTING + Differencer.DELETION]= CompareUIPlugin.getImageDescriptor("ovr16/confdel_ov.gif"); //$NON-NLS-1$
- fgImages[Differencer.CONFLICTING + Differencer.CHANGE]= CompareUIPlugin.getImageDescriptor("ovr16/confchg_ov.gif"); //$NON-NLS-1$
- }
-
- private IPreferenceStore fPreferenceStore;
- private ListenerList fListeners= new ListenerList();
- private HashMap fProperties= new HashMap();
- private boolean fLeftEditable= true;
- private boolean fRightEditable= true;
- private String fAncestorLabel;
- private String fLeftLabel;
- private String fRightLabel;
- private Image fAncestorImage;
- private Image fRightImage;
- private Image fLeftImage;
- private Image[] fImages= new Image[16];
-
- /**
- * Creates a new configuration with editable left and right sides,
- * suitable default labels, and no images.
- * The given preference store is used to connect this configuration
- * with the Compare preference page properties <code>ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE</code>,
- * and <code>CompareConfiguration.IGNORE_WHITESPACE</code>.
- *
- * @param prefStore the preference store which this configuration holds onto.
- * @since 2.0
- */
- public CompareConfiguration(IPreferenceStore prefStore) {
-
- setProperty("LEFT_IS_LOCAL", new Boolean(fLeftIsLocal)); //$NON-NLS-1$
-
- fPreferenceStore= prefStore;
- if (fPreferenceStore != null) {
- boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE);
- setProperty(ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE, new Boolean(b));
-
- b= fPreferenceStore.getBoolean(ComparePreferencePage.IGNORE_WHITESPACE);
- setProperty(CompareConfiguration.IGNORE_WHITESPACE, new Boolean(b));
- }
- }
-
- /**
- * Creates a new configuration with editable left and right sides,
- * suitable default labels, and no images.
- * This configuration uses the preference store of the Compare plugin
- * (<code>CompareUIPlugin.getDefault().getPreferenceStore()</code>).
- */
- public CompareConfiguration() {
- this(CompareUIPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * Returns the preference store of this configuration.
- * @return the preference store of this configuration.
- * @since 2.0
- */
- public IPreferenceStore getPreferenceStore() {
- return fPreferenceStore;
- }
-
- /**
- * Returns an image showing the specified change kind.
- * The different kind of changes are defined in the <code>Differencer</code>.
- * Newly created images are remembered by this class and
- * disposed when the <code>dispose</code> method is called.
- *
- * @param kind the kind of change as defined in <code>Differencer</code>.
- * @return an modification of the base image reflecting the kind of change.
- * @see org.eclipse.compare.structuremergeviewer.Differencer
- * @since 2.0
- */
- public Image getImage(int kind) {
- Image image= fImages[kind & 15];
- if (image == null) {
- ImageDescriptor id= fgImages[kind & 15];
- if (id != null)
- image= id.createImage();
- fImages[kind & 15]= image;
- }
- return image;
- }
-
- /**
- * Returns an image showing the specified change kind applied to a
- * given base image. The different kind of changes are defined in the <code>Differencer</code>.
- * Typically an implementation would build a composite image
- * from the given base image and an image representing the change kind.
- * Newly created images are remembered by this class and
- * disposed when the <code>dispose</code> method is called.
- *
- * @param base the image which is modified to reflect the kind of change
- * @param kind the kind of change as defined in <code>Differencer</code>.
- * @return an modification of the base image reflecting the kind of change.
- * @see org.eclipse.compare.structuremergeviewer.Differencer
- */
- public Image getImage(Image base, int kind) {
-
- Object key= base;
- if (key == null)
- key= fgDummy;
-
- kind &= 15;
-
- Image[] a= (Image[]) fgMap.get(key);
- if (a == null) {
- a= new Image[16];
- fgMap.put(key, a);
- }
- Image b= a[kind];
- if (b == null) {
- b= new DiffImage(base, fgImages[kind], WIDTH, !fLeftIsLocal).createImage();
- CompareUI.disposeOnShutdown(b);
- a[kind]= b;
- }
- return b;
- }
-
- /**
- * Dispose of this compare configuration.
- * This method is called if the compare configuration is no longer used.
- * An implementation must dispose of all resources.
- */
- public void dispose() {
- if (fImages != null) {
- for (int i= 0; i < fImages.length; i++){
- Image image= fImages[i];
- if (image != null && !image.isDisposed())
- image.dispose();
- }
- }
- fImages= null;
- }
-
- /**
- * Fires a <code>PropertyChangeEvent</code> to registered listeners.
- *
- * @param propertyName the name of the property that has changed
- * @param oldValue the property's old value
- * @param newValue the property's new value
- */
- private void fireChange(String propertyName, Object oldValue, Object newValue) {
- PropertyChangeEvent event= null;
- Object[] listeners= fListeners.getListeners();
- if (listeners != null) {
- for (int i= 0; i < listeners.length; i++) {
- IPropertyChangeListener l= (IPropertyChangeListener) listeners[i];
- if (event == null)
- event= new PropertyChangeEvent(this, propertyName, oldValue, newValue);
- l.propertyChange(event);
- }
- }
- }
-
- /* (non javadoc)
- * see IPropertyChangeNotifier.addListener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.add(listener);
- }
-
- /* (non javadoc)
- * see IPropertyChangeNotifier.removeListener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Sets the property with the given name.
- * If the new value differs from the old a <code>PropertyChangeEvent</code>
- * is sent to registered listeners.
- *
- * @param propertyName the name of the property to set
- * @param value the new value of the property
- */
- public void setProperty(String key, Object newValue) {
- Object oldValue= fProperties.get(key);
- fProperties.put(key, newValue);
- if (oldValue == null || !oldValue.equals(newValue))
- fireChange(key, oldValue, newValue);
- }
-
- /**
- * Returns the property with the given name, or <code>null</code>
- * if no such property exists.
- *
- * @param propertyName the name of the property to retrieve
- * @return the property with the given name, or <code>null</code> if not found
- */
- public Object getProperty(String key) {
- return fProperties.get(key);
- }
-
- //---- ancestor
-
- /**
- * Sets the label to use for the ancestor of compare/merge viewers.
- *
- * @param label the new label for the ancestor of compare/merge viewers
- */
- public void setAncestorLabel(String label) {
- fAncestorLabel= label;
- }
-
- /**
- * Returns the label for the ancestor side of compare/merge viewers.
- * This label is typically shown in the title of the ancestor area in a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the label for the ancestor side or <code>null</code>
- */
- public String getAncestorLabel(Object element) {
- return fAncestorLabel;
- }
-
- /**
- * Sets the image to use for the ancestor of compare/merge viewers.
- * The CompareConfiguration does not automatically dispose the old image.
- *
- * @param image the new image for the ancestor of compare/merge viewers
- */
- public void setAncestorImage(Image image) {
- fAncestorImage= image;
- }
-
- /**
- * Returns the image for the ancestor side of compare/merge viewers.
- * This image is typically shown in the title of the ancestor area in a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the image for the ancestor side or <code>null</code>
- */
- public Image getAncestorImage(Object element) {
- return fAncestorImage;
- }
-
- //---- left side
-
- /**
- * Controls whether the left side of a merge viewer is editable.
- *
- * @param editable if the value is <code>true</code> left side is editable
- */
- public void setLeftEditable(boolean editable) {
- fLeftEditable= editable;
- }
-
- /**
- * Returns whether the left hand side of a merge viewer is editable.
- *
- * @return <code>true</code> if the left hand side is editable
- */
- public boolean isLeftEditable() {
- return fLeftEditable;
- }
-
- /**
- * Sets the label to use for the left side of compare/merge viewers.
- *
- * @param label the new label for the left side of compare/merge viewers
- */
- public void setLeftLabel(String label) {
- fLeftLabel= label;
- }
-
- /**
- * Returns the label for the left hand side of compare/merge viewers.
- * This label is typically shown in the title of the left side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the label for the left hand side or <code>null</code>
- */
- public String getLeftLabel(Object element) {
- return fLeftLabel;
- }
-
- /**
- * Sets the image to use for the left side of compare/merge viewers.
- * The compare configuration does not automatically dispose the old image.
- *
- * @param image the new image for the left side of compare/merge viewers
- */
- public void setLeftImage(Image image) {
- fLeftImage= image;
- }
-
- /**
- * Returns the image for the left hand side of compare/merge viewers.
- * This image is typically shown in the title of the left side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the image for the left hand side or <code>null</code>
- */
- public Image getLeftImage(Object element) {
- return fLeftImage;
- }
-
- //---- right side
-
- /**
- * Controls whether the right side of a merge viewer is editable.
- *
- * @param editable if the value is <code>true</code> right side is editable
- */
- public void setRightEditable(boolean editable) {
- fRightEditable= editable;
- }
-
- /**
- * Returns whether the right hand side of a merge viewer is editable.
- *
- * @return <code>true</code> if the right hand side is editable
- */
- public boolean isRightEditable() {
- return fRightEditable;
- }
-
- /**
- * Sets the label to use for the right side of compare/merge viewers.
- *
- * @param label the new label for the right side of compare/merge viewers
- */
- public void setRightLabel(String label) {
- fRightLabel= label;
- }
-
- /**
- * Returns the label for the right hand side of compare/merge viewers.
- * This label is typically shown in the title of the right side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the label for the right hand side or <code>null</code>
- */
- public String getRightLabel(Object element) {
- return fRightLabel;
- }
-
- /**
- * Sets the image to use for the right side of compare/merge viewers.
- * The compare configuration does not automatically dispose the old image.
- *
- * @param image the new image for the right side of compare/merge viewers
- */
- public void setRightImage(Image image) {
- fRightImage= image;
- }
-
- /**
- * Returns the image for the right hand side of compare/merge viewers.
- * This image is typically shown in the title of the right side of a compare viewer.
- *
- * @param element the input object of a compare/merge viewer or <code>null</code>
- * @return the image for the right hand side or <code>null</code>
- */
- public Image getRightImage(Object element) {
- return fRightImage;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
deleted file mode 100644
index 180fbb89e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ /dev/null
@@ -1,791 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.lang.reflect.InvocationTargetException;
-
-import java.util.ArrayList;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.custom.BusyIndicator;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IEditorInput;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * A compare operation which can present its results in a special editor.
- * Running the compare operation and presentating the results in a compare editor
- * are combined in one class because it allows a client to keep the implementation
- * all in one place while separating it from the innards of a specific UI implementation of compare/merge.
- * <p>
- * A <code>CompareEditorInput</code> defines methods for the following sequence steps:
- * <UL>
- * <LI>running a lengthy compare operation under progress monitor control,
- * <LI>creating a UI for displaying the model and initializing the some widgets with the compare result,
- * <LI>tracking the dirty state of the model in case of merge,
- * <LI>saving the model.
- * </UL>
- * The Compare plug-in's <code>openCompareEditor</code> method takes an <code>ICompareEditorInput</code>
- * and starts sequencing through the above steps. If the compare result is not empty a new compare editor
- * is opened and takes over the sequence until eventually closed.
- * <p>
- * The <code>prepareInput</code> method should contain the
- * code of the compare operation. It is executed under control of a progress monitor
- * and can be canceled. If the result of the compare is not empty, that is if there are differences
- * that needs to be presented, the <code>ICompareEditorInput</code> should hold onto them and return them with
- * the <code>getCompareResult</code> method.
- * If the value returned from <code>getCompareResult</code> is not <code>null</code>
- * a compare editor is opened on the <code>ICompareEditorInput</code> with title and title image initialized by the
- * corresponding methods of the <code>ICompareEditorInput</code>.
- * <p>
- * Creation of the editor's SWT controls is delegated to the <code>createContents</code> method.
- * Here the SWT controls must be created and initialized with the result of the compare operation.
- * <p>
- * If merging is allowed, the modification state of the compared constituents must be tracked and the dirty
- * state returned from method <code>isSaveNeeded</code>. The value <code>true</code> triggers a subsequent call
- * to <code>save</code> where the modified resources can be saved.
- * <p>
- * The most important part of this implementation is the setup of the compare/merge UI.
- * The UI uses a simple browser metaphor to present compare results.
- * The top half of the layout shows the structural compare results (e.g. added, deleted, and changed files),
- * the bottom half the content compare results (e.g. textual differences between two files).
- * A selection in the top pane is fed to the bottom pane. If a content viewer is registered
- * for the type of the selected object, this viewer is installed in the pane.
- * In addition if a structure viewer is registered for the selection type the top pane
- * is split horizontally to make room for another pane and the structure viewer is installed
- * in it. When comparing Java files this second structure viewer would show the structural
- * differences within a Java file, e.g. added, deleted or changed methods and fields.
- * <p>
- * Subclasses provide custom setups, e.g. for a Catchup/Release operation
- * by passing a subclass of <code>CompareConfiguration</code> and by implementing the <code>prepareInput</code> method.
- * If a subclass cannot use the <code>DiffTreeViewer</code> which is installed by default in the
- * top left pane, method <code>createDiffViewer</code> can be overridden.
- *
- * @see CompareUI
- * @see CompareEditorInput
- */
-public abstract class CompareEditorInput implements IEditorInput, IPropertyChangeNotifier, IRunnableWithProgress {
-
- private static final boolean DEBUG= false;
-
- /**
- * The name of the "dirty" property (value <code>"DIRTY_STATE"</code>).
- */
- public static final String DIRTY_STATE= "DIRTY_STATE"; //$NON-NLS-1$
-
- private static final String COMPARE_EDITOR_IMAGE_NAME= "cview16/compare_view.gif"; //$NON-NLS-1$
- private static Image fgTitleImage;
-
- private Splitter fComposite;
- private CompareConfiguration fCompareConfiguration;
- private CompareViewerSwitchingPane fStructureInputPane;
- private CompareViewerSwitchingPane fStructurePane1;
- private CompareViewerSwitchingPane fStructurePane2;
- private CompareViewerSwitchingPane fContentInputPane;
- private CompareViewerSwitchingPane fFocusPane;
- private String fMessage;
- private Object fInput;
- private String fTitle;
- private ListenerList fListenerList= new ListenerList();
- private CompareNavigator fNavigator;
- private boolean fDirty= false;
- private ArrayList fDirtyViewers= new ArrayList();
- private IPropertyChangeListener fDirtyStateListener;
-
- private IgnoreWhiteSpaceAction fIgnoreWhitespace;
- private ShowPseudoConflicts fShowPseudoConflicts;
-
- boolean fStructureCompareOnSingleClick= true;
- boolean fUseOutlineView= false;
-
- /**
- * Creates a <code>CompareEditorInput</code> which is initialized with the given
- * compare configuration.
- * The compare configuration is passed to subsequently created viewers.
- *
- * @param configuration the compare configuration
- */
- public CompareEditorInput(CompareConfiguration configuration) {
- fCompareConfiguration= configuration;
- Assert.isNotNull(configuration);
-
- Object object= fCompareConfiguration.getProperty(CompareConfiguration.USE_OUTLINE_VIEW);
- if (object instanceof Boolean)
- fUseOutlineView= ((Boolean) object).booleanValue();
-
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
- fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, configuration);
- fShowPseudoConflicts= new ShowPseudoConflicts(bundle, configuration);
-
- fDirtyStateListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent e) {
- String propertyName= e.getProperty();
- if (CompareEditorInput.DIRTY_STATE.equals(propertyName)) {
- boolean changed= false;
- Object newValue= e.getNewValue();
- if (newValue instanceof Boolean)
- changed= ((Boolean)newValue).booleanValue();
- setDirty(e.getSource(), changed);
- }
- }
- };
-
- IPreferenceStore ps= configuration.getPreferenceStore();
- if (ps != null)
- fStructureCompareOnSingleClick= ps.getBoolean(ComparePreferencePage.OPEN_STRUCTURE_COMPARE);
- }
-
- private boolean structureCompareOnSingleClick() {
- return fStructureCompareOnSingleClick;
- }
-
- /* (non Javadoc)
- * see IAdaptable.getAdapter
- */
- public Object getAdapter(Class adapter) {
- if (ICompareNavigator.class.equals(adapter) || CompareNavigator.class.equals(adapter)) {
- if (fNavigator == null)
- fNavigator= new CompareNavigator(
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
- return fNavigator;
- }
- return null;
- }
-
- /* (non Javadoc)
- * see IEditorInput.getImageDescriptor
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /* (non Javadoc)
- * see IEditorInput.getToolTipText
- */
- public String getToolTipText() {
- return getTitle();
- }
-
- /* (non Javadoc)
- * see IEditorInput.getName
- */
- public String getName() {
- return getTitle();
- }
-
- /**
- * Returns <code>null</code> since this editor cannot be persisted.
- *
- * @return <code>null</code> because this editor cannot be persisted
- */
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /**
- * Returns <code>false</code> to indicate that this input
- * should not appear in the "File Most Recently Used" menu.
- *
- * @return <code>false</code>
- */
- public boolean exists() {
- return false;
- }
-
- /*
- * FIXME!
- */
- protected void setMessage(String message) {
- fMessage= message;
- }
-
- /*
- * FIXME!
- */
- public String getMessage() {
- return fMessage;
- }
-
- /**
- * Returns the title which will be used in the compare editor's title bar.
- * It can be set with <code>setTitle</code>.
- *
- * @return the title
- */
- public String getTitle() {
- if (fTitle == null)
- return Utilities.getString("CompareEditorInput.defaultTitle"); //$NON-NLS-1$
- return fTitle;
- }
-
- /**
- * Sets the title which will be used when presenting the compare result.
- * This method must be called before the editor is opened.
- *
- * @param title the title to use for the CompareEditor
- */
- public void setTitle(String title) {
- fTitle= title;
- }
-
- /**
- * Returns the title image which will be used in the compare editor's title bar.
- * Returns the title image which will be used when presenting the compare result.
- * This implementation returns a generic compare icon.
- * Subclasses can override.
- *
- * @return the title image, or <code>null</code> if none
- */
- public Image getTitleImage() {
- if (fgTitleImage == null) {
- fgTitleImage= CompareUIPlugin.getImageDescriptor(COMPARE_EDITOR_IMAGE_NAME).createImage();
- CompareUI.disposeOnShutdown(fgTitleImage);
- }
- return fgTitleImage;
- }
-
- /**
- * Returns the configuration object for the viewers within the compare editor.
- * Returns the configuration which was passed to the constructor.
- *
- * @return the compare configuration
- */
- public CompareConfiguration getCompareConfiguration() {
- return fCompareConfiguration;
- }
-
- /**
- * Adds standard actions to the given <code>ToolBarManager</code>.
- * <p>
- * Subclasses may override to add their own actions.
- * </p>
- *
- * @param toolBarManager the <code>ToolBarManager</code> to which to contribute
- */
- public void contributeToToolBar(ToolBarManager toolBarManager) {
-
- toolBarManager.add(new Separator());
- toolBarManager.add(fIgnoreWhitespace);
- toolBarManager.add(fShowPseudoConflicts);
- }
-
- /**
- * Runs the compare operation and stores the compare result.
- *
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @exception InvocationTargetException if the <code>prepareInput</code> method must propagate a checked exception,
- * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
- * wrapped in an <code>InvocationTargetException</code> by the calling context
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- */
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- fInput= prepareInput(monitor);
- }
-
- /**
- * Runs the compare operation and returns the compare result.
- * If <code>null</code> is returned no differences were found and no compare editor needs to be opened.
- * Progress should be reported to the given progress monitor.
- * A request to cancel the operation should be honored and acknowledged
- * by throwing <code>InterruptedException</code>.
- * <p>
- * Note: this method is typically called in a modal context thread which doesn't have a Display assigned.
- * Implementors of this method shouldn't therefore allocated any SWT resources in this method.
- * </p>
- *
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @return the result of the compare operation, or <code>null</code> if there are no differences
- * @exception InvocationTargetException if the <code>prepareInput</code> method must propagate a checked exception,
- * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
- * wrapped in an <code>InvocationTargetException</code> by the calling context
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- */
- protected abstract Object prepareInput(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException;
-
- /**
- * Returns the compare result computed by the most recent call to the
- * <code>run</code> method. Returns <code>null</code> if no
- * differences were found.
- *
- * @return the compare result prepared in method <code>prepareInput</code>
- * or <code>null</code> if there were no differences
- */
- public Object getCompareResult() {
- return fInput;
- }
-
- /**
- * Create the SWT controls that are used to display the result of the compare operation.
- * Creates the SWT Controls and sets up the wiring between the individual panes.
- * This implementation creates all four panes but makes only the necessary ones visible.
- * Finally it feeds the compare result into the top left structure viewer
- * and the content viewer.
- * <p>
- * Subclasses may override if they need to change the layout or wiring between panes.
- *
- * @param parent the parent control under which the control must be created
- * @return the SWT control hierarchy for the compare editor
- */
- public Control createContents(Composite parent) {
-
- fComposite= new Splitter(parent, SWT.VERTICAL);
- fComposite.setData(this);
-
- Control outline= null;
- if (!fUseOutlineView)
- outline= createOutlineContents(fComposite, SWT.HORIZONTAL);
-
- fContentInputPane= new CompareViewerSwitchingPane(fComposite, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findContentViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- if (fFocusPane == null)
- fFocusPane= fContentInputPane;
- if (outline != null)
- fComposite.setVisible(outline, false);
- fComposite.setVisible(fContentInputPane, true);
-
- if (fStructureInputPane != null)
- fComposite.setWeights(new int[] { 30, 70 });
-
- fComposite.layout();
-
- if (fStructureInputPane != null && fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
-
- fComposite.setData("Nav", //$NON-NLS-1$
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
-
- return fComposite;
- }
-
- /**
- * @param parent the parent control under which the control must be created
- * @return the SWT control hierarchy for the outline part of the compare editor
- * @since 3.0
- */
- public Control createOutlineContents(Composite parent, int direction) {
- final Splitter h= new Splitter(parent, direction);
-
- fStructureInputPane= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof DiffNode) {
- DiffNode dn= (DiffNode) input;
- if (dn.hasChildren())
- return createDiffViewer(this);
- }
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- fFocusPane= fStructureInputPane;
-
- fStructurePane1= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- h.setVisible(fStructurePane1, false);
-
- fStructurePane2= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- h.setVisible(fStructurePane2, false);
-
- // setup the wiring for top left pane
- fStructureInputPane.addOpenListener(
- new IOpenListener() {
- public void open(OpenEvent oe) {
- feed1(oe.getSelection());
- }
- }
- );
- fStructureInputPane.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- ISelection s= e.getSelection();
- if (s == null || s.isEmpty())
- feed1(s);
- }
- }
- );
- fStructureInputPane.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- feedDefault1(event.getSelection());
- }
- }
- );
-
- fStructurePane1.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feed2(e.getSelection());
- }
- }
- );
-
- fStructurePane2.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feed3(e.getSelection());
- }
- }
- );
-
- if (fUseOutlineView) {
- if (fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
-
- fComposite.setData("Nav", //$NON-NLS-1$
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
- }
-
- return h;
- }
-
- private void feed1(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (selection == null || selection.isEmpty()) {
- Object input= fStructureInputPane.getInput();
- fContentInputPane.setInput(input);
- fStructurePane2.setInput(null); // clear downstream pane
- fStructurePane1.setInput(null);
- } else {
- Object input= getElement(selection);
- fContentInputPane.setInput(input);
- if (structureCompareOnSingleClick())
- fStructurePane1.setInput(input);
- fStructurePane2.setInput(null); // clear downstream pane
- if (fStructurePane1.getInput() != input)
- fStructurePane1.setInput(null);
- }
- }
- }
- );
- }
-
- private void feedDefault1(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (!selection.isEmpty())
- fStructurePane1.setInput(getElement(selection));
- }
- }
- );
- }
-
- private void feed2(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (selection.isEmpty()) {
- Object input= fStructurePane1.getInput();
- fContentInputPane.setInput(input);
- fStructurePane2.setInput(null);
- } else {
- Object input= getElement(selection);
- fContentInputPane.setInput(input);
- fStructurePane2.setInput(input);
- }
- }
- }
- );
- }
-
- private void feed3(final ISelection selection) {
- BusyIndicator.showWhile(fComposite.getDisplay(),
- new Runnable() {
- public void run() {
- if (selection.isEmpty())
- fContentInputPane.setInput(fStructurePane2.getInput());
- else
- fContentInputPane.setInput(getElement(selection));
- }
- }
- );
-
- }
-
- /**
- * Returns the first element of the given selection if the selection
- * is a <code>IStructuredSelection</code> with exactly one element. Returns
- * <code>null</code> otherwise.
- *
- * @param selection the selection
- * @return the first element of the selection, or <code>null</code>
- */
- private static Object getElement(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) selection;
- if (ss.size() == 1)
- return ss.getFirstElement();
- }
- return null;
- }
-
- /**
- * Asks this input to take focus within its container (editor).
- * <p>
- * Clients should not call this method but they may
- * override if they implement a different layout with different visual
- * components. Clients are free to call the inherited method.
- * </p>
- */
- public void setFocus() {
- if (fFocusPane != null) {
- Viewer v= fFocusPane.getViewer();
- if (v != null) {
- Control c= v.getControl();
- if (c != null)
- c.setFocus();
- }
- } else if (fComposite != null)
- fComposite.setFocus();
- }
-
- /**
- * Factory method for creating a differences viewer for the top left pane.
- * It is called from <code>createContents</code> and returns a <code>DiffTreeViewer</code>.
- * <p>
- * Subclasses may override if they need a different viewer.
- * </p>
- *
- * @param parent the SWT parent control under which to create the viewer's SWT controls
- * @return a compare viewer for the top left pane
- */
- public Viewer createDiffViewer(Composite parent) {
- return new DiffTreeViewer(parent, fCompareConfiguration);
- }
-
- /**
- * Implements the dynamic viewer switching for structure viewers.
- * The method must return a compare viewer based on the old (or current) viewer
- * and a new input object. If the old viewer is suitable for showing the new input the old viewer
- * can be returned. Otherwise a new viewer must be created under the given parent composite or
- * <code>null</code> can be returned to indicate that no viewer could be found.
- * <p>
- * This implementation forwards the request to <code>CompareUI.findStructureViewer</code>.
- * <p>
- * Subclasses may override to implement a different strategy.
- * </p>
- *
- * @return a compare viewer which is suitable for the given input object or <code>null</code>
- */
- public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, fCompareConfiguration);
- }
-
- /**
- * Implements the dynamic viewer switching for content viewers.
- * The method must return a compare viewer based on the old (or current) viewer
- * and a new input object. If the old viewer is suitable for showing the new input the old viewer
- * can be returned. Otherwise a new viewer must be created under the given parent composite or
- * <code>null</code> can be returned to indicate that no viewer could be found.
- * <p>
- * This implementation forwards the request to <code>CompareUI.findContentViewer</code>.
- * <p>
- * Subclasses may override to implement a different strategy.
- * </p>
- *
- * @return a compare viewer which is suitable for the given input object or <code>null</code>
- */
- public Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
-
- Viewer newViewer= CompareUIPlugin.findContentViewer(oldViewer, input, parent, fCompareConfiguration);
-
- boolean isNewViewer= newViewer != oldViewer;
- if (DEBUG) System.out.println("CompareEditorInput.findContentViewer: " + isNewViewer); //$NON-NLS-1$
-
- if (isNewViewer && newViewer instanceof IPropertyChangeNotifier) {
- final IPropertyChangeNotifier dsp= (IPropertyChangeNotifier) newViewer;
- dsp.addPropertyChangeListener(fDirtyStateListener);
-
- Control c= newViewer.getControl();
- c.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- dsp.removePropertyChangeListener(fDirtyStateListener);
- }
- }
- );
- }
-
- return newViewer;
- }
-
- /**
- * Returns <code>true</code> if there are unsaved changes.
- * The value returned is the value of the <code>DIRTY_STATE</code> property of this input object.
-
- * Returns <code>true</code> if this input has unsaved changes,
- * that is if <code>setDirty(true)</code> has been called.
- * Subclasses don't have to override if the functionality provided by <doce>setDirty</code>
- * is sufficient.
- *
- * @return <code>true</code> if there are changes that need to be saved
- */
- public boolean isSaveNeeded() {
- return fDirty || fDirtyViewers.size() > 0;
- }
-
- /**
- * Sets the dirty state of this input to the given
- * value and sends out a <code>PropertyChangeEvent</code> if the new value differs from the old value.
- *
- * @param dirty the dirty state for this compare input
- */
- public void setDirty(boolean dirty) {
-
- boolean confirmSave= true;
- Object o= fCompareConfiguration.getProperty(CompareEditor.CONFIRM_SAVE_PROPERTY);
- if (o instanceof Boolean)
- confirmSave= ((Boolean)o).booleanValue();
-
- if (!confirmSave) {
- fDirty= dirty;
- if (!fDirty)
- fDirtyViewers.clear();
- }
- }
-
- private void setDirty(Object source, boolean dirty) {
- Assert.isNotNull(source);
- boolean oldDirty= fDirtyViewers.size() > 0;
- if (dirty)
- fDirtyViewers.add(source);
- else
- fDirtyViewers.remove(source);
- boolean newDirty= fDirtyViewers.size() > 0;
- if (DEBUG) System.out.println("setDirty("+source+", "+dirty+"): " + newDirty); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if (oldDirty != newDirty)
- Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE, new Boolean(oldDirty), new Boolean(newDirty));
- }
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.addListener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (listener != null)
- fListenerList.add(listener);
- }
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.removeListener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (listener != null)
- fListenerList.remove(listener);
- }
-
- /**
- * Save any unsaved changes.
- * Empty implementation.
- * Subclasses must override to save any changes.
- *
- * @param progressMonitor an <code>IProgressMonitor</code> that the implementation of save may use to show progress
- * @deprecated Override method saveChanges instead.
- */
- public void save(IProgressMonitor pm) {
- }
-
- /**
- * Save any unsaved changes.
- * Subclasses must override to save any changes.
- * This implementation tries to flush changes in all viewers by
- * calling <code>ISavable.save</code> on them.
- *
- * @param progressMonitor an <code>IProgressMonitor</code> that the implementation of save may use to show progress
- * @since 2.0
- */
- public void saveChanges(IProgressMonitor pm) throws CoreException {
-
- // flush changes in any dirty viewer
- flushViewer(fStructureInputPane, pm);
- flushViewer(fStructurePane1, pm);
- flushViewer(fStructurePane2, pm);
- flushViewer(fContentInputPane, pm);
-
- save(pm);
- }
-
- private static void flushViewer(CompareViewerSwitchingPane pane, IProgressMonitor pm) throws CoreException {
- if (pane != null) {
- Viewer v= pane.getViewer();
- if (v instanceof ISavable)
- ((ISavable)v).save(pm);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
deleted file mode 100644
index fab93628a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-
-/**
- * The class <code>CompareUI</code> defines the entry point to initiate a configurable
- * compare operation on arbitrary resources. The result of the compare
- * is opened into a compare editor where the details can be browsed and
- * edited in dynamically selected structure and content viewers.
- * <p>
- * The Compare UI provides a registry for content and structure compare viewers,
- * which is initialized from extensions contributed to extension points
- * declared by this plug-in.
- */
-public final class CompareUI {
-
- /**
- * Compare Plug-in ID (value <code>"org.eclipse.compare"</code>).
- * @since 2.0
- */
- public static final String PLUGIN_ID= "org.eclipse.compare"; //$NON-NLS-1$
-
- /**
- * Image descriptor for the disabled icon of the 'Next' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_DTOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.DTOOL_NEXT);
- /**
- * Image descriptor for the normal icon of the 'Next' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_CTOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.CTOOL_NEXT);
- /**
- * Image descriptor for the roll-over icon of the 'Next' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_ETOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.ETOOL_NEXT);
-
- /**
- * Image descriptor for the disabled icon of the 'Previous' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_DTOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.DTOOL_PREV);
- /**
- * Image descriptor for the normal icon of the 'Previous' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_CTOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.CTOOL_PREV);
- /**
- * Image descriptor for the roll-over icon of the 'Previous' tool bar button.
- * @since 2.0
- */
- public static final ImageDescriptor DESC_ETOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.ETOOL_PREV);
-
- /**
- * Name of the title property of a compare viewer.
- * If a property with this name is set
- * on the top level SWT control of a viewer, it is used as a title in the pane's
- * title bar.
- */
- public static final String COMPARE_VIEWER_TITLE= "org.eclipse.compare.CompareUI.CompareViewerTitle"; //$NON-NLS-1$
-
- private CompareUI() {
- }
-
- public static AbstractUIPlugin getPlugin() {
- return CompareUIPlugin.getDefault();
- }
-
- /**
- * Returns this plug-in's resource bundle.
- *
- * @return the plugin's resource bundle
- */
- public static ResourceBundle getResourceBundle() {
- return CompareUIPlugin.getResourceBundle();
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare editor on the result in the currently active workbench page.
- *
- * @param input the input on which to open the compare editor
- */
- public static void openCompareEditor(CompareEditorInput input) {
- openCompareEditorOnPage(input, null);
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare editor on the result in the given workbench page.
- *
- * @param input the input on which to open the compare editor
- * @param page the workbench page in which to open the compare editor
- * @since 2.1
- */
- public static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page) {
- CompareUIPlugin plugin= CompareUIPlugin.getDefault();
- if (plugin != null)
- plugin.openCompareEditor(input, page, null);
- }
-
- /**
- * Performs the comparison described by the given input and
- * shows the result in the given editor.
- *
- * @param input the input on which to open the compare editor
- * @param editor the compare editor to reuse or null to create a new one
- * @since 3.0
- */
- public static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor) {
- CompareUIPlugin plugin= CompareUIPlugin.getDefault();
- if (plugin != null)
- plugin.openCompareEditor(input, null, editor);
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * modal compare dialog on the result.
- *
- * @param input the input on which to open the compare dialog
- */
- public static void openCompareDialog(CompareEditorInput input) {
- CompareUIPlugin plugin= CompareUIPlugin.getDefault();
- if (plugin != null)
- plugin.openCompareDialog(input);
- }
-
- /**
- * Registers an image descriptor for the given type.
- *
- * @param type the type
- * @param descriptor the image descriptor
- */
- public static void registerImageDescriptor(String type, ImageDescriptor descriptor) {
- CompareUIPlugin.registerImageDescriptor(type, descriptor);
- }
-
- /**
- * Returns a shared image for the given type, or a generic image if none
- * has been registered for the given type.
- * <p>
- * Note: Images returned from this method will be automatically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param type the type
- * @return the image
- */
- public static Image getImage(String type) {
- return CompareUIPlugin.getImage(type);
- }
-
- /**
- * 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) {
- CompareUIPlugin.disposeOnShutdown(image);
- }
-
- /**
- * Returns a shared image for the given adaptable.
- * This convenience method queries the given adaptable
- * for its <code>IWorkbenchAdapter.getImageDescriptor</code>, which it
- * uses to create an image if it does not already have one.
- * <p>
- * Note: Images returned from this method will be automatically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param adaptable the adaptable for which to find an image
- * @return an image
- */
- public static Image getImage(IAdaptable adaptable) {
- return CompareUIPlugin.getImage(adaptable);
- }
-
- /**
- * Returns a structure compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input, the old viewer
- * is returned. Otherwise, the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a structure compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a structure viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
- CompareConfiguration configuration) {
-
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, configuration);
- }
-
- /**
- * Returns a content compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input the old viewer
- * is returned. Otherwise the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a content compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a content viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent,
- CompareConfiguration configuration) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
- }
-
- /**
- * Returns a content compare viewer based on an old viewer and an input
- * object. If the old viewer is suitable for showing the input the old
- * viewer is returned. Otherwise the input's type is used to find a viewer
- * descriptor in the registry which in turn is used to create a content
- * compare viewer under the given parent composite. In order to determine
- * the input's type, the input must either implement IStreamContentAccessor
- * and ITypedElement or ICompareInput. If no viewer descriptor can be found
- * <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a content viewer. Must
- * implement either <code>IStreamContentAccessor</code> and<code>
- * ITypedElement</code> or <code>ICompareInput</code>.
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent,
- CompareConfiguration configuration) {
-
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
- }
-
- /**
- * Adds an alias for the given type.
- * Subsequent calls to <code>findStructureViewer</code>
- * treat alias as a synonym for type and return the same viewer.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- * @param type a type name for which a viewer has been registered
- * @param alias a type name which should be treated as a synonym of type
- * @since 2.0
- */
- public static void addStructureViewerAlias(String type, String alias) {
- CompareUIPlugin.addStructureViewerAlias(type, alias);
- }
-
- /**
- * Remove all aliases for the given type. This method does not affect
- * the initial binding between type and viewer. If no aliases exist for the
- * given type this method does nothing.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- * @param type the type name for which all synonymes are removed.
- * @since 2.0
- */
- public static void removeAllStructureViewerAliases(String type) {
- CompareUIPlugin.removeAllStructureViewerAliases(type);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
deleted file mode 100644
index 43033a295..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.action.ToolBarManager;
-
-/**
- * A <code>CompareViewerPane</code> is a convenience class which installs a
- * <code>CLabel</code> and a <code>Toolbar</code> in a <code>ViewForm</code>.
- * <P>
- * Double clicking onto the <code>CompareViewerPane</code>'s title bar maximizes
- * the <code>CompareViewerPane</code> to the size of an enclosing <code>Splitter</code>
- * (if there is one).
- * If more <code>Splitters</code> are nested maximizing walks up and
- * maximizes to the outermost <code>Splitter</code>.
- *
- * @since 2.0
- */
-public class CompareViewerPane extends ViewForm {
-
- private ToolBarManager fToolBarManager;
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public CompareViewerPane(Composite container, int style) {
- super(container, style);
-
- marginWidth= 0;
- marginHeight= 0;
-
- CLabel label= new CLabel(this, SWT.NONE) {
- public Point computeSize(int wHint, int hHint, boolean changed) {
- return super.computeSize(wHint, Math.max(24, hHint), changed);
- }
- };
- setTopLeft(label);
-
- MouseAdapter ml= new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- Control content= getContent();
- if (content != null && content.getBounds().contains(e.x, e.y))
- return;
- Control parent= getParent();
- if (parent instanceof Splitter)
- ((Splitter)parent).setMaximizedControl(CompareViewerPane.this);
- }
- };
-
- addMouseListener(ml);
- label.addMouseListener(ml);
- }
-
- /**
- * Set the pane's title text.
- * The value <code>null</code> clears it.
- *
- * @param text the text to be displayed in the pane or null
- */
- public void setText(String label) {
- CLabel cl= (CLabel) getTopLeft();
- cl.setText(label);
- }
-
- /**
- * Set the pane's title Image.
- * The value <code>null</code> clears it.
- *
- * @param image the image to be displayed in the pane or null
- */
- public void setImage(Image image) {
- CLabel cl= (CLabel) getTopLeft();
- cl.setImage(image);
- }
-
- /**
- * Returns a <code>ToolBarManager</code> if the given parent is a
- * <code>CompareViewerPane</code> or <code>null</code> otherwise.
- *
- * @param parent a <code>Composite</code> or <code>null</code>
- * @return a <code>ToolBarManager</code> if the given parent is a <code>CompareViewerPane</code> otherwise <code>null</code>
- */
- public static ToolBarManager getToolBarManager(Composite parent) {
- if (parent instanceof CompareViewerPane) {
- CompareViewerPane pane= (CompareViewerPane) parent;
- return pane.getToolBarManager();
- }
- return null;
- }
-
- /**
- * Clears tool items in the <code>CompareViewerPane</code>'s control bar.
- *
- * @param parent a <code>Composite</code> or <code>null</code>
- */
- public static void clearToolBar(Composite parent) {
- ToolBarManager tbm= getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
- tbm.update(true);
- }
- }
-
- //---- private stuff
-
- private ToolBarManager getToolBarManager() {
- if (fToolBarManager == null) {
- ToolBar tb= new ToolBar(this, SWT.FLAT);
- setTopCenter(tb);
- fToolBarManager= new ToolBarManager(tb);
- }
- return fToolBarManager;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
deleted file mode 100644
index 0011f2eba..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.text.MessageFormat;
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-
-/**
- * A custom <code>CompareViewerPane</code> that supports dynamic viewer switching.
- *
- * <p>
- * Clients must implement the viewer switching strategy by implementing
- * the <code>getViewer(Viewer, Object)</code> method.
- * <p>
- * If a property with the name <code>CompareUI.COMPARE_VIEWER_TITLE</code> is set
- * on the top level SWT control of a viewer, it is used as a title in the <code>CompareViewerPane</code>'s
- * title bar.
- *
- * @since 2.0
- */
-public abstract class CompareViewerSwitchingPane extends CompareViewerPane
- implements ISelectionChangedListener, ISelectionProvider, IDoubleClickListener {
-
- private Viewer fViewer;
- private Object fInput;
- private ListenerList fSelectionListeners= new ListenerList();
- private ListenerList fDoubleClickListener= new ListenerList();
- private ListenerList fOpenListener= new ListenerList();
- private boolean fControlVisibility= false;
- private String fTitle;
- private String fTitleArgument;
-
- private IOpenListener fOpenHandler= new IOpenListener() {
- public void open(OpenEvent event) {
- Object[] listeners= fOpenListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IOpenListener) listeners[i]).open(event);
- }
- };
-
- /**
- * Creates a <code>CompareViewerSwitchingPane</code> as a child of the given parent and with the
- * specified SWT style bits.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public CompareViewerSwitchingPane(Composite parent, int style) {
- this(parent, style, false);
- }
-
- /**
- * Creates a <code>CompareViewerSwitchingPane</code> as a child of the given parent and with the
- * specified SWT style bits.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- * @param visibility the initial visibility of the CompareViewerSwitchingPane
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public CompareViewerSwitchingPane(Composite parent, int style, boolean visibility) {
- super(parent, style);
-
- fControlVisibility= visibility;
-
- setViewer(new NullViewer(this));
-
- addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).removeSelectionChangedListener(CompareViewerSwitchingPane.this);
- if (fViewer instanceof StructuredViewer) {
- StructuredViewer sv= (StructuredViewer) fViewer;
- sv.removeDoubleClickListener(CompareViewerSwitchingPane.this);
- sv.removeOpenListener(fOpenHandler);
- }
- fViewer= null;
- fInput= null;
- fSelectionListeners= null;
- }
- }
- );
- }
-
- /**
- * Returns the current viewer.
- *
- * @return the current viewer
- */
- public Viewer getViewer() {
- return fViewer;
- }
-
- private void setViewer(Viewer newViewer) {
-
- if (newViewer == fViewer)
- return;
-
- boolean oldEmpty= isEmpty();
-
- if (fViewer != null) {
-
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).removeSelectionChangedListener(this);
-
- if (fViewer instanceof StructuredViewer) {
- StructuredViewer sv= (StructuredViewer) fViewer;
- sv.removeDoubleClickListener(this);
- sv.removeOpenListener(fOpenHandler);
- }
-
- Control content= getContent();
- setContent(null);
-
- fViewer.setInput(null);
-
- if (content != null && !content.isDisposed())
- content.dispose();
-
- } else
- oldEmpty= false;
- setContent(null);
-
- fViewer= newViewer;
-
- if (fViewer != null) {
- // we have to remember and restore the old visibility of the CustomPane
- // since setContent changes the visibility
- boolean old= getVisible();
- setContent(fViewer.getControl());
- setVisible(old); // restore old visibility
-
- boolean newEmpty= isEmpty();
-
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).addSelectionChangedListener(this);
-
- if (fViewer instanceof StructuredViewer) {
- StructuredViewer sv= (StructuredViewer) fViewer;
- sv.addDoubleClickListener(this);
- sv.addOpenListener(fOpenHandler);
- }
-
- if (oldEmpty != newEmpty) { // relayout my container
- Composite parent= getParent();
- if (parent instanceof Splitter)
- ((Splitter)parent).setVisible(this, fControlVisibility ? !newEmpty : true);
- }
-
- layout(true);
- }
- }
-
- /**
- * Returns the optional title argument that has been set with <code>setTitelArgument</code>
- * or <code>null</code> if no optional title argument has been set.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- *
- * @return the optional title argument or <code>null</code>
- */
- public String getTitleArgument() {
- return fTitleArgument;
- }
-
- /**
- * Returns <code>true</code> if no viewer is installed or if the current viewer
- * is a <code>NullViewer</code>.
- *
- * @return <code>true</code> if no viewer is installed or if the current viewer is a <code>NullViewer</code>
- */
- public boolean isEmpty() {
- return fViewer == null || fViewer instanceof NullViewer;
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener l) {
- fSelectionListeners.add(l);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener l) {
- fSelectionListeners.remove(l);
- }
-
- public void addDoubleClickListener(IDoubleClickListener l) {
- fDoubleClickListener.add(l);
- }
-
- public void removeDoubleClickListener(IDoubleClickListener l) {
- fDoubleClickListener.remove(l);
- }
-
- public void addOpenListener(IOpenListener l) {
- fOpenListener.add(l);
- }
-
- public void removeOpenListener(IOpenListener l) {
- fOpenListener.remove(l);
- }
-
- public void doubleClick(DoubleClickEvent event) {
- Object[] listeners= fDoubleClickListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IDoubleClickListener) listeners[i]).doubleClick(event);
- }
-
- public ISelection getSelection() {
- if (fViewer instanceof ISelectionProvider)
- return ((ISelectionProvider) fViewer).getSelection();
- return null;
- }
-
- public void setSelection(ISelection s) {
- if (fViewer instanceof ISelectionProvider)
- ((ISelectionProvider) fViewer).setSelection(s);
- }
-
- public void selectionChanged(SelectionChangedEvent ev) {
- Object[] listeners= fSelectionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((ISelectionChangedListener) listeners[i]).selectionChanged(ev);
- }
-
- private boolean hasFocus2() {
- // do we have focus?
- Display display= getDisplay();
- if (display != null)
- for (Control focus= display.getFocusControl(); focus != null; focus= focus.getParent())
- if (focus == this)
- return true;
- return false;
- }
-
- /**
- * Sets the input object of this pane.
- * For this input object a suitable viewer is determined by calling the abstract
- * method <code>getViewer(Viewer, Object)</code>.
- * If the returned viewer differs from the current one, the old viewer
- * is disposed and the new one installed. Then the input object is fed
- * into the newly installed viewer by calling its <code>setInput(Object)</code> method.
- * If new and old viewer don't differ no new viewer is installed but just
- * <code>setInput(Object)</code> is called.
- * If the input is <code>null</code> the pane is cleared,
- * that is the current viewer is disposed.
- *
- * @param input the new input object or <code>null</code>
- */
- public void setInput(Object input) {
-
- if (fInput == input)
- return;
-
- boolean hadFocus= hasFocus2();
-
- fInput= input;
-
- // viewer switching
- Viewer newViewer= null;
- if (input != null)
- newViewer= getViewer(fViewer, input);
-
- if (newViewer == null) {
- if (fViewer instanceof NullViewer)
- return;
- newViewer= new NullViewer(this);
- }
-
- setViewer(newViewer);
-
- // set input
- fViewer.setInput(input);
-
- Image image= null;
- if (!(fViewer instanceof NullViewer) && input instanceof ICompareInput)
- image= ((ICompareInput)input).getImage();
- setImage(image);
-
- String title= null;
- if (fViewer != null) {
- Control c= fViewer.getControl();
- if (c != null) {
- Object data= c.getData(CompareUI.COMPARE_VIEWER_TITLE);
- if (data instanceof String)
- title= (String) data;
- if (hadFocus)
- c.setFocus();
- }
- }
-
- fTitle= title;
- updateTitle();
- }
-
- /**
- * Sets an additional and optional argument for the pane's title.
- * Note: this method is for internal use only. Clients should not call this method.
- *
- * @param argument an optional argument for the pane's title
- */
- public void setTitleArgument(String argument) {
- fTitleArgument= argument;
- updateTitle();
- }
-
- private void updateTitle() {
- if (fTitle != null) {
- if (fTitleArgument != null) {
- String format= CompareMessages.getString("CompareViewerSwitchingPane.Titleformat"); //$NON-NLS-1$
- String t= MessageFormat.format(format, new String[] { fTitle, fTitleArgument } );
- setText(t);
- } else
- setText(fTitle);
- } else {
- setText(""); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the current input of this pane or null if the pane has no input.
- *
- * @return an <code>Object</code> that is the input to this pane or null if the pane has no input.
- */
- public Object getInput() {
- return fInput;
- }
-
- /**
- * Returns a viewer which is able to display the given input.
- * If no viewer can be found, <code>null</code> is returned.
- * The additional argument oldViewer represents the viewer currently installed
- * in the pane (or <code>null</code> if no viewer is installed).
- * It can be returned from this method if the current viewer can deal with the
- * input (and no new viewer must be created).
- *
- * @param oldViewer the currently installed viewer or <code>null</code>
- * @param input the input object for which a viewer must be determined or <code>null</code>
- * @return a viewer for the given input, or <code>null</code> if no viewer can be determined
- */
- abstract protected Viewer getViewer(Viewer oldViewer, Object input);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
deleted file mode 100644
index 2eb990a18..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ /dev/null
@@ -1,1142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.HashMap;
-import java.util.ResourceBundle;
-import java.util.Date;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.HashSet;
-import java.util.Calendar;
-import java.text.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.dialogs.*;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * A dialog where one input element can be compared against
- * a list of historic variants (editions) of the same input element.
- * The dialog can be used to implement functions like "Compare/Replace with Version" or
- * "Compare/Replace from Local History" on workspace resources.
- * <p>
- * In addition it is possible to specify a subsection of the input element
- * (e.g. a method in a Java source file) by means of a "path".
- * In this case the dialog compares only the subsection (as specified by the path)
- * with the corresponding subsection in the list of editions.
- * Only those editions are shown where the subsection differs from the same subsection in
- * another edition thereby minimizing the number of presented variants.
- * This functionality can be used to implement "Replace from Local History"
- * for the Java language.
- * <p>
- * Subsections of an input element are determined by first finding an
- * <code>IStructureCreator</code> for the input's type.
- * Then the method <code>locate</code> is used to extract the subsection.
- * <p>
- * Each edition (variant in the list of variants) must implement the <code>IModificationDate</code> interface
- * so that the dialog can sort the editions and present them in a tree structure where every
- * node corresponds one day.
- * <p>
- * The functionality is surfaced in a single function <code>selectEdition</code>.
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- *
- * @see IModificationDate
- * @see ITypedElement
- */
-public class EditionSelectionDialog extends ResizableDialog {
-
- /**
- * An item in an underlying edition.
- */
- private static class Pair {
-
- private ITypedElement fEdition;
- private ITypedElement fItem;
- private String fContent;
- private IStructureCreator fStructureCreator;
- private boolean fHasError= false;
-
- Pair(IStructureCreator structureCreator, ITypedElement edition, ITypedElement item) {
- fStructureCreator= structureCreator;
- fEdition= edition;
- fItem= item;
- }
-
- Pair(IStructureCreator structureCreator, ITypedElement edition) {
- this(structureCreator, edition, edition);
- }
-
- ITypedElement getEdition() {
- return fEdition;
- }
-
- ITypedElement getItem() {
- return fItem;
- }
-
- /**
- * The content is lazily loaded
- */
- private String getContent() {
- if (fContent == null) {
- if (fStructureCreator != null)
- fContent= fStructureCreator.getContents(fItem, false);
- else {
- if (fItem instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) fItem;
- try {
- fContent= Utilities.readString(sca);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
- if (fContent == null)
- fContent= ""; //$NON-NLS-1$
- }
- return fContent;
- }
-
- /**
- * Compares content of item.
- */
- public boolean equals(Object other) {
- if (other != null && other.getClass() == getClass()) {
- if (getContent().equals(((Pair)other).getContent()))
- return true;
- }
- return super.equals(other);
- }
- }
-
- // Configuration options
- private CompareConfiguration fCompareConfiguration;
- private ArrayList fArrayList= new ArrayList();
- /** use a side-by-side compare viewer */
- private boolean fCompare= true;
- /** show target on right hand side */
- private boolean fTargetIsRight= false;
- /** hide entries which have identical content */
- private boolean fHideIdentical= true;
- /** add mode if true, otherwise replace mode */
- private boolean fAddMode= false;
- /** compare mode if true, otherwise replace/add mode */
- private boolean fCompareMode= false;
- /** perform structure compare on editions */
- private boolean fStructureCompare= false;
- /** allow for multiple selection */
- private boolean fMultiSelect= false;
-
- /**
- * Maps from members to their corresponding editions.
- * Has only a single entry if dialog is used in "Replace" (and not "Add") mode.
- */
- private HashMap fMemberEditions;
- /**
- * Maps from members to their corresponding selected edition.
- */
- private HashMap fMemberSelection;
- /** The editions of the current selected member */
- private List fCurrentEditions;
- private Thread fThread;
- private Pair fTargetPair;
- /** The selected edition in the edition viewer */
- private ITypedElement fSelectedItem;
- private String fTitleArg;
- private Image fTitleImage;
-
- // SWT controls
- private CompareViewerSwitchingPane fContentPane;
- private Button fCommitButton;
- private Table fMemberTable;
- private CompareViewerPane fMemberPane;
- private Tree fEditionTree;
- private CompareViewerPane fEditionPane;
- private Image fDateImage;
- private Image fTimeImage;
- private CompareViewerSwitchingPane fStructuredComparePane;
-
- /**
- * Creates a new modal, resizable dialog.
- * Various titles, icons, and labels are configured from the given resource bundle.
- * The following resource keys are used:
- * <pre>
- * key type description
- * title String dialog title
- * width Integer initial width of dialog
- * height Integer initial height of dialog
- * treeTitleFormat MessageFormat pane title for edition tree; arg 0 is the target
- * dateIcon String icon for node in edition tree; path relative to plugin
- * timeIcon String icon for leaf in edition tree; path relative to plugin
- * todayFormat MessageFormat format string if date is todays date; arg 0 is date
- * yesterdayFormat MessageFormat format string if date is yesterdays date; arg 0 is date
- * dayFormat MessageFormat format string if date is any other date; arg 0 is date
- * editionLabel String label for editions side of compare viewer; arg 0 is the date
- * targetLabel String label for target side of compare viewer
- * buttonLabel String label for OK button; default is IDialogConstants.OK_LABEL
- * </pre>
- *
- * @param parent if not <code>null</code> the new dialog stays on top of this parent shell
- * @param bundle <code>ResourceBundle</code> to configure the dialog
- */
- public EditionSelectionDialog(Shell parent, ResourceBundle bundle) {
- super(parent, bundle);
- }
-
- private CompareConfiguration getCompareConfiguration() {
- if (fCompareConfiguration == null) {
- fCompareConfiguration= new CompareConfiguration();
- fCompareConfiguration.setLeftEditable(false);
- fCompareConfiguration.setRightEditable(false);
- }
- return fCompareConfiguration;
- }
-
- /**
- * Sets an additional and optional argument for the edition pane's title.
- *
- * @param titleArgument an optional argument for the edition pane's title
- * @since 2.0
- */
- public void setEditionTitleArgument(String titleArgument) {
- fTitleArg= titleArgument;
- }
-
- /**
- * Sets an optional image for the edition pane's title.
- *
- * @param titleImage an optional image for the edition pane's title
- * @since 2.0
- */
- public void setEditionTitleImage(Image titleImage) {
- fTitleImage= titleImage;
- }
-
- /**
- * Select the previous edition (presenting a UI).
- *
- * @param target the input object against which the editions are compared; must not be <code>null</code>
- * @param editions the list of editions (element type: <code>ITypedElement</code>s)
- * @param path If <code>null</code> dialog shows full input; if non <code>null</code> it extracts a subsection
- * @return returns the selected edition or <code>null</code> if error occurred.
- * The returned <code>ITypedElement</code> is one of the original editions
- * if <code>path</code> was <code>null</code>; otherwise
- * it is an <code>ITypedElement</code> returned from <code>IStructureCreator.locate(path, item)</code>
- * @since 2.0
- */
- public ITypedElement selectPreviousEdition(final ITypedElement target, ITypedElement[] inputEditions, Object ppath) {
- Assert.isNotNull(target);
- fTargetPair= new Pair(null, target);
-
- // sort input editions
- final int count= inputEditions.length;
- final IModificationDate[] editions= new IModificationDate[count];
- for (int i= 0; i < count; i++)
- editions[i]= (IModificationDate) inputEditions[i];
- if (count > 1)
- internalSort(editions, 0, count-1);
-
- // find StructureCreator if ppath is not null
- IStructureCreator structureCreator= null;
- if (ppath != null) {
- String type= target.getType();
- IStructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
- if (scd != null)
- structureCreator= scd.createStructureCreator();
- }
-
- if (fAddMode) {
- // does not work in add mode
- return null;
- }
-
- if (structureCreator != null) {
- Pair pair= createPair(structureCreator, ppath, target);
- if (pair != null)
- fTargetPair= pair;
- else
- ppath= null; // couldn't extract item because of error
- }
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++) {
-
- ITypedElement edition= (ITypedElement) editions[i];
- Pair pair= null;
-
- if (structureCreator != null && ppath != null) {
- // extract sub element from edition
- pair= createPair(structureCreator, ppath, edition);
- } else {
- pair= new Pair(null, edition);
- }
-
- if (pair != null && pair.fHasError)
- return null;
-
- if (pair != null && !fTargetPair.equals(pair)) {
- return pair.fItem;
- }
- }
-
- // nothing found
- return null;
- }
-
- /**
- * Presents this modal dialog with the functionality described in the class comment above.
- *
- * @param target the input object against which the editions are compared; must not be <code>null</code>
- * @param editions the list of editions (element type: <code>ITypedElement</code>s)
- * @param path If <code>null</code> dialog shows full input; if non <code>null</code> it extracts a subsection
- * @return returns the selected edition or <code>null</code> if dialog was cancelled.
- * The returned <code>ITypedElement</code> is one of the original editions
- * if <code>path</code> was <code>null</code>; otherwise
- * it is an <code>ITypedElement</code> returned from <code>IStructureCreator.locate(path, item)</code>
- */
- public ITypedElement selectEdition(final ITypedElement target, ITypedElement[] inputEditions, Object ppath) {
-
- Assert.isNotNull(target);
- fTargetPair= new Pair(null, target);
-
- // sort input editions
- final int count= inputEditions.length;
- final IModificationDate[] editions= new IModificationDate[count];
- for (int i= 0; i < count; i++)
- editions[i]= (IModificationDate) inputEditions[i];
- if (count > 1)
- internalSort(editions, 0, count-1);
-
- // find StructureCreator if ppath is not null
- IStructureCreator structureCreator= null;
- if (ppath != null) {
- String type= target.getType();
- IStructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
- if (scd != null)
- structureCreator= scd.createStructureCreator();
- }
-
- if (!fAddMode) {
- // replace mode
-
- if (structureCreator != null) {
- Pair pair= createPair(structureCreator, ppath, target);
- if (pair != null)
- fTargetPair= pair;
- else
- ppath= null; // couldn't extract item because of error
- }
-
- // set the left and right labels for the compare viewer
- String targetLabel= getTargetLabel(target, fTargetPair.getItem());
- if (fTargetIsRight)
- getCompareConfiguration().setRightLabel(targetLabel);
- else
- getCompareConfiguration().setLeftLabel(targetLabel);
-
- if (structureCreator != null && ppath != null) { // extract sub element
-
- final IStructureCreator sc= structureCreator;
- final Object path= ppath;
-
- // construct the comparer thread
- // and perform the background extract
- fThread= new Thread() {
- public void run() {
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++) {
-
- if (fEditionTree == null || fEditionTree.isDisposed())
- break;
- ITypedElement edition= (ITypedElement) editions[i];
-
- // extract sub element from edition
- Pair pair= createPair(sc, path, edition);
- if (pair != null)
- sendPair(pair);
- }
- sendPair(null);
- }
- };
- } else {
- // create tree widget
- create();
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++)
- addMemberEdition(new Pair(null, (ITypedElement) editions[i]));
- }
-
- } else {
- // add mode
- final Object container= ppath;
- Assert.isNotNull(container);
-
- if (structureCreator == null)
- return null; // error
-
- // extract all elements of container
- final HashSet current= new HashSet();
- IStructureComparator sco= structureCreator.locate(container, target);
- if (sco != null) {
- Object[] children= sco.getChildren();
- if (children != null)
- for (int i= 0; i < children.length; i++)
- current.add(children[i]);
- }
-
- final IStructureCreator sc= structureCreator;
-
- // construct the comparer thread
- // and perform the background extract
- fThread= new Thread() {
- public void run() {
-
- // from front (newest) to back (oldest)
- for (int i= 0; i < count; i++) {
-
- if (fEditionTree == null || fEditionTree.isDisposed())
- break;
- ITypedElement edition= (ITypedElement) editions[i];
-
- IStructureComparator sco2= sc.locate(container, edition);
- if (sco2 != null) {
- Object[] children= sco2.getChildren();
- if (children != null) {
- for (int i2= 0; i2 < children.length; i2++) {
- ITypedElement child= (ITypedElement) children[i2];
- if (!current.contains(child))
- sendPair(new Pair(sc, edition, child));
- }
- }
- }
- }
- sendPair(null);
- }
- };
- }
-
- open();
-
- if (getReturnCode() == OK)
- return fSelectedItem;
- return null;
- }
-
- private Pair createPair(IStructureCreator sc, Object path, ITypedElement input) {
- IStructureComparator scmp= sc.locate(path, input);
- if (scmp == null && sc.getStructure(input) == null) { // parse error
- Pair p= new Pair(sc, input);
- p.fHasError= true;
- return p;
- }
- if (scmp instanceof ITypedElement)
- return new Pair(sc, input, (ITypedElement) scmp);
- return null;
- }
-
- /**
- * Controls whether identical entries are shown or not (default).
- * This method must be called before <code>selectEdition</code>.
- *
- * @param hide if true identical entries are hidden; otherwise they are shown.
- * @since 2.0
- */
- public void setHideIdenticalEntries(boolean hide) {
- fHideIdentical= hide;
- }
-
- /**
- * Controls whether workspace target is on the left (the default) or right hand side.
- *
- * @param isRight if true target is shown on right hand side.
- * @since 2.0
- */
- public void setTargetIsRight(boolean isRight) {
- fTargetIsRight= isRight;
- }
-
- /**
- * Controls whether the <code>EditionSelectionDialog</code> is in 'add' mode
- * or 'replace' mode (the default).
- *
- * @param addMode if true dialog is in 'add' mode.
- * @since 2.0
- */
- public void setAddMode(boolean addMode) {
- fAddMode= addMode;
- fMultiSelect= addMode;
- }
-
- /**
- * Controls whether the <code>EditionSelectionDialog</code> is in 'compare' mode
- * or 'add/replace' (the default) mode.
- *
- * @param addMode if true dialog is in 'add' mode.
- * @since 2.0
- */
- public void setCompareMode(boolean compareMode) {
- fCompareMode= compareMode;
- fStructureCompare= fCompareMode && !fAddMode;
- }
-
- /**
- * Returns the input target that has been specified with the most recent call
- * to <code>selectEdition</code>. If a not <code>null</code> path was specified this method
- * returns a subsection of this target (<code>IStructureCreator.locate(path, target)</code>)
- * instead of the input target.
- * <p>
- * For example if the <code>target</code> is a Java compilation unit and <code>path</code> specifies
- * a method, the value returned from <code>getTarget</code> will be the method not the compilation unit.
- *
- * @return the last specified target or a subsection thereof.
- */
- public ITypedElement getTarget() {
- return fTargetPair.getItem();
- }
-
- /**
- * Returns the editions that have been selected with the most
- * recent call to <code>selectEdition</code>.
- *
- * @return the selected editions as an array.
- * @since 2.1
- */
- public ITypedElement[] getSelection() {
- ArrayList result= new ArrayList();
- if (fMemberSelection != null) {
- Iterator iter= fArrayList.iterator();
- for (int i= 0; iter.hasNext(); i++) {
- Object edition= iter.next();
- Object item= fMemberSelection.get(edition);
- if (item != null)
- result.add(item);
- }
- } else if (fSelectedItem != null)
- result.add(fSelectedItem);
- return (ITypedElement[]) result.toArray(new ITypedElement[result.size()]);
- }
-
- /**
- * Returns a label for identifying the target side of a compare viewer.
- * This implementation extracts the value for the key "targetLabel" from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the name of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param target the target element for which a label must be returned
- * @param item if a path has been specified in <code>selectEdition</code> a sub element of the given target; otherwise the same as target
- * @return a label the target side of a compare viewer
- */
- protected String getTargetLabel(ITypedElement target, ITypedElement item) {
- String format= null;
- if (target instanceof ResourceNode)
- format= Utilities.getString(fBundle, "workspaceTargetLabel", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "targetLabel"); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
- return MessageFormat.format(format, new Object[] { target.getName() });
- }
-
- /**
- * Returns a label for identifying the edition side of a compare viewer.
- * This implementation extracts the value for the key "editionLabel" from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the formatted modification date of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param selectedEdition the selected edition for which a label must be returned
- * @param item if a path has been specified in <code>selectEdition</code> a sub element of the given selectedEdition; otherwise the same as selectedEdition
- * @return a label for the edition side of a compare viewer
- */
- protected String getEditionLabel(ITypedElement selectedEdition, ITypedElement item) {
- String format= null;
- if (selectedEdition instanceof ResourceNode)
- format= Utilities.getString(fBundle, "workspaceEditionLabel", null); //$NON-NLS-1$
- else if (selectedEdition instanceof HistoryItem)
- format= Utilities.getString(fBundle, "historyEditionLabel", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "editionLabel"); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
-
- String date= ""; //$NON-NLS-1$
- if (selectedEdition instanceof IModificationDate) {
- long modDate= ((IModificationDate)selectedEdition).getModificationDate();
- date= DateFormat.getDateTimeInstance().format(new Date(modDate));
- }
-
- return MessageFormat.format(format, new Object[] { date });
- }
-
- /**
- * Returns a label for identifying a node in the edition tree viewer.
- * This implementation extracts the value for the key "workspaceTreeFormat" or
- * "treeFormat" (in that order) from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the formatted modification date of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param edition the edition for which a label must be returned
- * @param item if a path has been specified in <code>edition</code> a sub element of the given edition; otherwise the same as edition
- * @return a label of a node in the edition tree viewer
- * @since 2.0
- */
- protected String getShortEditionLabel(ITypedElement edition, ITypedElement item, Date date) {
- String format= null;
- if (edition instanceof ResourceNode)
- format= Utilities.getString(fBundle, "workspaceTreeFormat", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "treeFormat", null); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
- String ds= DateFormat.getTimeInstance().format(date);
- return MessageFormat.format(format, new Object[] { ds });
- }
-
- /**
- * Returns an image for identifying the edition side of a compare viewer.
- * This implementation extracts the value for the key "editionLabel" from the resource bundle
- * and passes it as the format argument to <code>MessageFormat.format</code>.
- * The single format argument for <code>MessageFormat.format</code> ("{0}" in the format string)
- * is the formatted modification date of the given input element.
- * <p>
- * Subclasses may override to create their own label.
- * </p>
- *
- * @param selectedEdition the selected edition for which a label must be returned
- * @param item if a path has been specified in <code>selectEdition</code> a sub element of the given selectedEdition; otherwise the same as selectedEdition
- * @return a label the edition side of a compare viewer
- * @since 2.0
- */
- protected Image getEditionImage(ITypedElement selectedEdition, ITypedElement item) {
- if (selectedEdition instanceof ResourceNode)
- return selectedEdition.getImage();
- if (selectedEdition instanceof HistoryItem) {
- if (fTimeImage == null) {
- String iconName= Utilities.getString(fBundle, "timeIcon", "obj16/resource_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- ImageDescriptor id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fTimeImage= id.createImage();
- }
- return fTimeImage;
- }
- return null;
- }
-
- /* (non Javadoc)
- * Creates SWT control tree.
- */
- protected synchronized Control createDialogArea(Composite parent2) {
-
- Composite parent= (Composite) super.createDialogArea(parent2);
-
- getShell().setText(Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
- Splitter vsplitter= new Splitter(parent, SWT.VERTICAL);
- vsplitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-
- vsplitter.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fCompareConfiguration != null) {
- fCompareConfiguration.dispose();
- fCompareConfiguration= null;
- }
- if (fDateImage != null) {
- fDateImage.dispose();
- fDateImage= null;
- }
- if (fTimeImage != null) {
- fTimeImage.dispose();
- fTimeImage= null;
- }
- }
- }
- );
-
- if (fAddMode) {
- // we need two panes: the left for the elements, the right one for the editions
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- fMemberPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- fMemberPane.setText(Utilities.getString(fBundle, "memberPaneTitle")); //$NON-NLS-1$
-
- int flags= SWT.H_SCROLL + SWT.V_SCROLL;
- if (fMultiSelect)
- flags|= SWT.CHECK;
- fMemberTable= new Table(fMemberPane, flags);
- fMemberTable.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (e.detail == SWT.CHECK) {
- if (e.item instanceof TableItem) {
- TableItem ti= (TableItem) e.item;
- Object data= ti.getData();
- if (ti.getChecked())
- fArrayList.add(data);
- else
- fArrayList.remove(data);
-
- if (fCommitButton != null)
- fCommitButton.setEnabled(fArrayList.size() > 0);
-
- fMemberTable.setSelection(new TableItem[] { ti });
- }
- }
- handleMemberSelect(e.item);
- }
- }
- );
- fMemberPane.setContent(fMemberTable);
- fMemberTable.setFocus();
-
- fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- } else {
- if (fStructureCompare) {
- // we need two panes: the left for the elements, the right one for the structured diff
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- fStructuredComparePane= new CompareViewerSwitchingPane(hsplitter, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return CompareUIPlugin.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration());
- return null;
- }
- };
- fStructuredComparePane.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feedInput2(e.getSelection());
- }
- }
- );
- } else {
- // only a single pane showing the editions
- fEditionPane= new CompareViewerPane(vsplitter, SWT.BORDER | SWT.FLAT);
- }
- if (fTitleArg == null)
- fTitleArg= fTargetPair.getItem().getName();
- String titleFormat= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$
- String title= MessageFormat.format(titleFormat, new String[] { fTitleArg });
- fEditionPane.setText(title);
- if (fTitleImage != null)
- fEditionPane.setImage(fTitleImage);
- }
-
- fEditionTree= new Tree(fEditionPane, SWT.H_SCROLL + SWT.V_SCROLL);
- fEditionTree.addSelectionListener(
- new SelectionAdapter() {
-// public void widgetDefaultSelected(SelectionEvent e) {
-// handleDefaultSelected();
-// }
- public void widgetSelected(SelectionEvent e) {
- feedInput(e.item);
- }
- }
- );
- fEditionPane.setContent(fEditionTree);
-
- // now start the thread (and forget about it)
- if (fThread != null) {
- fThread.start();
- fThread= null;
- }
-
- fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, getCompareConfiguration());
- }
- };
- vsplitter.setWeights(new int[] { 30, 70 });
-
- applyDialogFont(parent);
- return parent;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- String buttonLabel= Utilities.getString(fBundle, "buttonLabel", IDialogConstants.OK_LABEL); //$NON-NLS-1$
- if (fCompareMode) {
- // only a 'Done' button
- createButton(parent, IDialogConstants.CANCEL_ID, buttonLabel, false);
- } else {
- // a 'Cancel' and a 'Add/Replace' button
- fCommitButton= createButton(parent, IDialogConstants.OK_ID, buttonLabel, true);
- fCommitButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- }
-
- /**
- * Overidden to disable dismiss on double click in compare mode.
- * @since 2.0
- */
- protected void okPressed() {
- if (fCompareMode)
- ; // don't dismiss dialog
- else
- super.okPressed();
- }
-
- //---- private stuff ----------------------------------------------------------------------------------------
-
- /**
- * Asynchroneously sends a Pair (or null) to the UI thread.
- */
- private void sendPair(final Pair pair) {
- if (fEditionTree != null && !fEditionTree.isDisposed()) {
- Display display= fEditionTree.getDisplay();
- display.asyncExec(
- new Runnable() {
- public void run() {
- addMemberEdition(pair);
- }
- }
- );
- }
- }
-
- private static void internalSort(IModificationDate[] keys, int left, int right) {
-
- int original_left= left;
- int original_right= right;
-
- IModificationDate mid= keys[(left + right) / 2];
- do {
- while (keys[left].getModificationDate() > mid.getModificationDate())
- left++;
-
- while (mid.getModificationDate() > keys[right].getModificationDate())
- right--;
-
- if (left <= right) {
- IModificationDate tmp= keys[left];
- keys[left]= keys[right];
- keys[right]= tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (original_left < right)
- internalSort(keys, original_left, right);
-
- if (left < original_right)
- internalSort(keys, left, original_right);
- }
-
- /**
- * Adds the given Pair to the member editions.
- * If HIDE_IDENTICAL is true the new Pair is only added if its contents
- * is different from the preceeding Pair.
- * If the argument is <code>null</code> the message "No Editions found" is shown
- * in the member or edition viewer.
- */
- private void addMemberEdition(Pair pair) {
-
- if (pair == null) { // end of list of pairs
- if (fMemberTable != null) {
- if (!fMemberTable.isDisposed() && fMemberTable.getItemCount() == 0) {
- if (fMultiSelect) {
- fMemberTable.dispose();
- fMemberTable= new Table(fMemberPane, SWT.NONE);
- fMemberPane.setContent(fMemberTable);
- }
- TableItem ti= new TableItem(fMemberTable, SWT.NONE);
- ti.setText(Utilities.getString(fBundle, "noAdditionalMembersMessage")); //$NON-NLS-1$
- }
- return;
- }
- if (fEditionTree != null && !fEditionTree.isDisposed() && fEditionTree.getItemCount() == 0) {
- TreeItem ti= new TreeItem(fEditionTree, SWT.NONE);
- ti.setText(Utilities.getString(fBundle, "notFoundInLocalHistoryMessage")); //$NON-NLS-1$
- }
- return;
- }
-
- if (fMemberEditions == null)
- fMemberEditions= new HashMap();
- if (fMultiSelect && fMemberSelection == null)
- fMemberSelection= new HashMap();
-
- ITypedElement item= pair.getItem();
- List editions= (List) fMemberEditions.get(item);
- if (editions == null) {
- editions= new ArrayList();
- fMemberEditions.put(item, editions);
- if (fMemberTable != null && !fMemberTable.isDisposed()) {
- ITypedElement te= item;
- String name= te.getName();
-
- // find position
- TableItem[] items= fMemberTable.getItems();
- int where= items.length;
- for (int i= 0; i < where; i++) {
- String n= items[i].getText();
- if (n.compareTo(name) > 0) {
- where= i;
- break;
- }
- }
-
- TableItem ti= new TableItem(fMemberTable, where, SWT.NULL);
- ti.setImage(te.getImage());
- ti.setText(name);
- ti.setData(editions);
- }
- }
- if (fHideIdentical) {
- Pair last= fTargetPair;
- int size= editions.size();
- if (size > 0)
- last= (Pair) editions.get(size-1);
- if (last != null && last.equals(pair))
- return; // don't add since the new one is equal to old
- }
- editions.add(pair);
-
- if (!fAddMode || editions == fCurrentEditions)
- addEdition(pair);
- }
-
- /**
- * Returns the number of s since Jan 1st, 1970.
- * The given date is converted to GMT and daylight saving is taken into account too.
- */
- private long dayNumber(long date) {
- int ONE_DAY_MS= 24*60*60 * 1000; // one day in milli seconds
-
- Calendar calendar= Calendar.getInstance();
- long localTimeOffset= calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
-
- return (date + localTimeOffset) / ONE_DAY_MS;
- }
-
- /**
- * Adds the given Pair to the edition tree.
- * It takes care of creating tree nodes for different dates.
- */
- private void addEdition(Pair pair) {
- if (fEditionTree == null || fEditionTree.isDisposed())
- return;
-
- // find last day
- TreeItem[] days= fEditionTree.getItems();
- TreeItem lastDay= null;
- if (days.length > 0)
- lastDay= days[days.length-1];
-
- boolean first= lastDay == null;
-
- ITypedElement edition= pair.getEdition();
- ITypedElement item= pair.getItem();
-
- long ldate= ((IModificationDate)edition).getModificationDate();
- long day= dayNumber(ldate);
- Date date= new Date(ldate);
- if (lastDay == null || day != dayNumber(((Date)lastDay.getData()).getTime())) {
- lastDay= new TreeItem(fEditionTree, SWT.NONE);
- if (fDateImage == null) {
- String iconName= Utilities.getString(fBundle, "dateIcon", "obj16/day_obj.gif"); //$NON-NLS-2$ //$NON-NLS-1$
- ImageDescriptor id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fDateImage= id.createImage();
- }
- lastDay.setImage(fDateImage);
- String df= DateFormat.getDateInstance().format(date);
- long today= dayNumber(System.currentTimeMillis());
-
- String formatKey;
- if (day == today)
- formatKey= "todayFormat"; //$NON-NLS-1$
- else if (day == today-1)
- formatKey= "yesterdayFormat"; //$NON-NLS-1$
- else
- formatKey= "dayFormat"; //$NON-NLS-1$
- String pattern= Utilities.getString(fBundle, formatKey);
- if (pattern != null)
- df= MessageFormat.format(pattern, new String[] { df });
- lastDay.setText(df);
- lastDay.setData(date);
- }
- TreeItem ti= new TreeItem(lastDay, SWT.NONE);
- ti.setImage(getEditionImage(edition, item));
-
- String s= getShortEditionLabel(edition, item, date);
- if (pair.fHasError) {
- String pattern= Utilities.getString(fBundle, "parseErrorFormat"); //$NON-NLS-1$
- s= MessageFormat.format(pattern, new String[] { s } );
- }
- ti.setText(s);
-
- ti.setData(pair);
-
- // determine selected TreeItem
- TreeItem selection= first ? ti : null;
- if (fMemberSelection != null) {
- Object selected= fMemberSelection.get(fCurrentEditions);
- if (selected != null) {
- if (selected == pair.getItem())
- selection= ti;
- else
- selection= null;
- }
- }
- if (selection != null) {
- fEditionTree.setSelection(new TreeItem[] { selection });
- if (!fAddMode)
- fEditionTree.setFocus();
- feedInput(selection);
- }
-
- if (first) // expand first node
- lastDay.setExpanded(true);
- }
-
- /**
- * Feeds selection from member viewer to edition viewer.
- */
- private void handleMemberSelect(Widget w) {
- Object data= w.getData();
- if (data instanceof List) {
- List editions= (List) data;
- if (editions != fCurrentEditions) {
- fCurrentEditions= editions;
- fEditionTree.removeAll();
-
- String pattern= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$
- String title= MessageFormat.format(pattern, new Object[] { ((Item)w).getText() });
- fEditionPane.setText(title);
-
- Iterator iter= editions.iterator();
- while (iter.hasNext()) {
- Object item= iter.next();
- if (item instanceof Pair)
- addEdition((Pair) item);
- }
- }
- }
- }
-
- private void setInput(Object input) {
- if (!fCompare && input instanceof ICompareInput) {
- ICompareInput ci= (ICompareInput) input;
- if (fTargetIsRight)
- input= ci.getLeft();
- else
- input= ci.getRight();
- }
- fContentPane.setInput(input);
- if (fStructuredComparePane != null)
- fStructuredComparePane.setInput(input);
- }
-
- /*
- * Feeds selection from edition viewer to content (and structure) viewer.
- */
- private void feedInput(Widget w) {
- Object input= w.getData();
- boolean isOK= false;
- if (input instanceof Pair) {
- Pair pair= (Pair) input;
- fSelectedItem= pair.getItem();
- isOK= !pair.fHasError;
-
- ITypedElement edition= pair.getEdition();
- String editionLabel= getEditionLabel(edition, fSelectedItem);
- Image editionImage= getEditionImage(edition, fSelectedItem);
-
- if (fAddMode) {
- if (fMemberSelection != null)
- fMemberSelection.put(fCurrentEditions, fSelectedItem);
- setInput(fSelectedItem);
- fContentPane.setText(editionLabel);
- fContentPane.setImage(editionImage);
- } else {
- getCompareConfiguration();
- if (fTargetIsRight) {
- fCompareConfiguration.setLeftLabel(editionLabel);
- fCompareConfiguration.setLeftImage(editionImage);
- setInput(new DiffNode(fSelectedItem, fTargetPair.getItem()));
- } else {
- fCompareConfiguration.setRightLabel(editionLabel);
- fCompareConfiguration.setRightImage(editionImage);
- setInput(new DiffNode(fTargetPair.getItem(), fSelectedItem));
- }
- }
- } else {
- fSelectedItem= null;
- setInput(null);
- }
- if (fCommitButton != null) {
- if (fMultiSelect)
- fCommitButton.setEnabled(isOK && fSelectedItem != null && fArrayList.size() > 0);
- else
- fCommitButton.setEnabled(isOK && fSelectedItem != null && fTargetPair.getItem() != fSelectedItem);
- }
- }
-
- /*
- * Feeds selection from structure viewer to content viewer.
- */
- private void feedInput2(ISelection sel) {
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) sel;
- if (ss.size() == 1)
- fContentPane.setInput(ss.getFirstElement());
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
deleted file mode 100644
index 8a348e182..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.core.resources.IFileState;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A combination <code>IFileState</code> and <code>ITypedElement</code> that can be used as
- * an input to a compare viewer or other places where an <code>IStreamContentAccessor</code>
- * is needed.
- * <p>
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- */
-public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate {
-
- private ITypedElement fBase;
- private IFileState fFileState;
-
- /**
- * Creates a <code>HistoryItem</code> object which combines the given <code>IFileState</code>
- * and <code>ITypedElement</code> into an object
- * which is suitable as input for a compare viewer or <code>ReplaceWithEditionDialog</code>.
- *
- * @param base the implementation of the <code>ITypedElement</code> interface delegates to this base <code>ITypedElement</code>
- * @param fileState the <code>IFileState</code> from which the streamable contents and the modification time is derived from
- */
- public HistoryItem(ITypedElement base, IFileState fileState) {
- fBase= base;
- fFileState= fileState;
- }
-
- /* (non-Javadoc)
- * see ITypedElement.getName
- */
- public String getName() {
- return fBase.getName();
- }
-
- /* (non-Javadoc)
- * see ITypedElement.getImage
- */
- public Image getImage() {
- return fBase.getImage();
- }
-
- /* (non-Javadoc)
- * see ITypedElement.getType
- */
- public String getType() {
- return fBase.getType();
- }
-
- /* (non-Javadoc)
- * see IModificationDate.getModificationDate
- */
- public long getModificationDate() {
- return fFileState.getModificationTime();
- }
-
- /* (non-Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() throws CoreException {
- return new BufferedInputStream(fFileState.getContents());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
- */
- public String getCharset() throws CoreException {
- return fFileState.getCharset();
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
deleted file mode 100644
index d0d3e06a1..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * A <code>ICompareNavigator</code> is used to navigate through the individual
- * differences of a <code>CompareEditorInput</code>.
- * <p>
- * Please note: the following might change before the final release of Eclipse 3.0.
- * You can retrieve an object implementing the <code>ICompareNavigator</code> from a
- * <code>CompareEditorInput</code> by calling <code>getAdapter(ICompareNavigator)</code>
- * on the <code>CompareEditorInput</code>.
- * </p>
- * @since 3.0
- */
-public interface ICompareNavigator {
-
- /**
- * Starting from the current selection <code>selectChange</code> selects and reveals the next (previous) change.
- * If the end (or beginning) is reached, the method returns <code>true</code>.
- *
- * @param next if <code>true</code> the next change is selected, otherwise the previous change
- * @return returns <code>true</code> if end (beginning) is reached, <code>false</code> otherwise
- */
- public boolean selectChange(boolean next);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
deleted file mode 100644
index 16aa27c0b..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * An <code>IContentChangeListener</code> is informed about content changes of a
- * <code>IContentChangeNotifier</code>.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IContentChangeNotifier
- */
-public interface IContentChangeListener {
-
- /**
- * Called whenever the content of the given source has changed.
- *
- * @param source the source whose contents has changed
- */
- void contentChanged(IContentChangeNotifier source);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
deleted file mode 100644
index 55641c97d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Interface common to all objects that provide a means for registering
- * for content change notification.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see IContentChangeListener
- */
-public interface IContentChangeNotifier {
-
- /**
- * Adds a content change listener to this notifier.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a content changed listener
- */
- void addContentChangeListener(IContentChangeListener listener);
-
- /**
- * Removes the given content changed listener from this notifier.
- * Has no effect if the listener is not registered.
- *
- * @param listener a content changed listener
- */
- void removeContentChangeListener(IContentChangeListener listener);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
deleted file mode 100644
index a972a0a7d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Common interface for objects with editable contents.
- * Typically it is implemented by objects that also implement
- * the <code>IStreamContentAccessor</code> interface.
- * <p>
- * Clients may implement this interface.
- * <p>
- * Note that implementing <code>IEditableContent</code> does not
- * automatically mean that it is editable. An object is only editable if
- * it implements <code>IEditableContent</code> and the <code>isEditable</code> method returns <code>true</code>.
- *
- * @see IStreamContentAccessor
- */
-public interface IEditableContent {
-
- /**
- * Returns <code>true</code> if this object can be modified.
- * If it returns <code>false</code> the other methods of this API must not be called.
- *
- * @return <code>true</code> if this object can be modified
- */
- boolean isEditable();
-
- /**
- * Replaces the current content with the given new bytes.
- *
- * @param newContent this new contents replaces the old contents
- */
- void setContent(byte[] newContent);
-
- /**
- * This method is called on a parent to add or remove a child,
- * or to copy the contents of a child.
- *
- * What to do is encoded in the two arguments as follows:
- * <TABLE>
- * <TR>
- * <TD>add:</TD>
- * <TD>child == null</TD>
- * <TD>other != null</TD>
- * </TR>
- * <TR>
- * <TD>remove:</TD>
- * <TD>child != null</TD>
- * <TD>other == null</TD>
- * </TR>
- * <TR>
- * <TD>copy:</TD>
- * <TD>child != null</TD>
- * <TD>other != null</TD>
- * </TR>
- * </TABLE>
- */
- ITypedElement replace(ITypedElement child, ITypedElement other);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
deleted file mode 100644
index 1d0f3e261..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Extension for <code>IStreamContentAccessor</code>. Extends the original
- * concept of a <code>IStreamContentAccessor</code> to answer the Charset (encoding) used for the stream.
- * <p>
- * <b>Note</b>: This interface is part of early access API that may well
- * change in incompatible ways until reach their finished form.
- * </p>
- * @since 3.0
- */
-public interface IEncodedStreamContentAccessor extends IStreamContentAccessor {
-
- /**
- * Returns the name of a charset encoding to be used when decoding this
- * stream accessor's contents into characters. Returns <code>null</code> if a proper
- * encoding cannot be determined.
- *
- * @return the name of a charset, or <code>null</code>
- * @exception CoreException if an error happens while determining
- * the charset. See any refinements for more information.
- * @see IStreamContentAccessor#getContents
- * @since 3.0
- */
- String getCharset() throws CoreException;
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
deleted file mode 100644
index 1ddeb2b78..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Common interface for objects with a modification date. The modification date
- * can be used in the UI to give the user a general idea of how old an object is.
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface IModificationDate {
-
- /**
- * Returns the modification time of this object.
- * <p>
- * Note that this value should only be used to give the user a general idea of how
- * old the object is.
- *
- * @return the time of last modification, in milliseconds since January 1, 1970, 00:00:00 GMT
- */
- long getModificationDate();
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
deleted file mode 100644
index f4ed5212c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-/**
- * Interface common to all objects that provide a means for registering
- * for property change notification.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see org.eclipse.jface.util.IPropertyChangeListener
- */
-public interface IPropertyChangeNotifier {
-
- /**
- * Adds a listener for property changes to this notifier.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a property change listener
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Removes the given content change listener from this notifier.
- * Has no effect if the identical listener is not registered.
- *
- * @param listener a property change listener
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java
deleted file mode 100644
index 453bc6a4e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * An <code>IStreamContentAccessor</code> object represents a set of bytes which can be
- * accessed by means of a stream.
- * <p>
- * Clients may implement this interface, or use the standard implementation,
- * <code>BufferedContent</code>.
- *
- * @see BufferedContent
- */
-public interface IStreamContentAccessor {
- /**
- * Returns an open <code>InputStream</code> for this object which can be used to retrieve the object's content.
- * The client is responsible for closing the stream when finished.
- * Returns <code>null</code> if this object has no streamable contents.
- *
- * @return an input stream containing the contents of this object
- * @exception CoreException if the contents of this object could not be accessed
- */
- InputStream getContents() throws CoreException;
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java
deleted file mode 100644
index 4fa9131bc..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessorExtension2.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-/**
- * Extension interface for <code>IStreamContentAccessor</code>. Extends the original
- * concept of a <code>IStreamContentAccessor</code> to answer the Charset (encoding) used for the stream.
- *
- * @deprecated Use <code>IEncodedStreamContentAccessor</code> instead
- */
-public interface IStreamContentAccessorExtension2 extends IEncodedStreamContentAccessor {
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java
deleted file mode 100644
index 6717c8da2..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface for getting the name, image, and type for an object.
- * <p>
- * These methods are typically used to present an input object in the compare UI
- * (<code>getName</code> and <code>getImage</code>)
- * and for finding a viewer for a given input type (<code>getType</code>).
- * <p>
- * Clients may implement this interface.
- */
-public interface ITypedElement {
-
- /**
- * Type for a folder input (value <code>"FOLDER"</code>).
- * Folders are comparison elements that have no contents, only a name and children.
- */
- public static final String FOLDER_TYPE= "FOLDER"; //$NON-NLS-1$
-
- /**
- * Type for an element whose actual type is text (value <code>"txt"</code>).
- */
- public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$
-
- /**
- * Type for an element whose actual type could not
- * be determined. (value <code>"???"</code>).
- */
- public static final String UNKNOWN_TYPE= "???"; //$NON-NLS-1$
-
- /**
- * Returns the name of this object.
- * The name is used when displaying this object in the UI.
- *
- * @return the name of this object
- */
- String getName();
-
- /**
- * Returns an image for this object.
- * This image is used when displaying this object in the UI.
- *
- * @return the image of this object or <code>null</code> if this type of input has no image
- */
- Image getImage();
-
- /**
- * Returns the type of this object. For objects with a file name
- * this is typically the file extension. For folders its the constant
- * <code>FOLDER_TYPE</code>.
- * The type is used for determining a suitable viewer for this object.
- *
- * @return the type of this object
- */
- String getType();
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java
deleted file mode 100644
index 91433c80c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A factory object for <code>Viewer</code>.
- * <p>
- * This interface is only required when creating a <code>Viewer</code> from a plugin.xml file.
- * Since <code>Viewer</code>s have no default constructor they cannot be
- * instantiated directly with <code>Class.forName</code>.
- */
-public interface IViewerCreator {
-
- /**
- * Creates a new viewer under the given SWT parent control.
- *
- * @param parent the SWT parent control under which to create the viewer's SWT control
- * @param config a compare configuration the newly created viewer might want to use
- * @return a new viewer
- */
- Viewer createViewer(Composite parent, CompareConfiguration config);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
deleted file mode 100644
index c3bf5245c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.util.ResourceBundle;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.compare.internal.CompareMessages;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.internal.Utilities;
-
-
-/**
- * A <code>NavigationAction</code> is used to navigate through the individual
- * differences of a <code>CompareEditorInput</code>.
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class NavigationAction extends Action {
-
- private boolean fNext;
- private CompareEditorInput fCompareEditorInput;
-
-
- /**
- * Creates a <code>NavigationAction</code>.
- *
- * @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference.
- */
- public NavigationAction(boolean next) {
- this(CompareUIPlugin.getResourceBundle(), next);
- }
-
- /**
- * Creates a <code>NavigationAction</code> that initializes its attributes
- * from the given <code>ResourceBundle</code>.
- *
- * @param bundle is used to initialize the action
- * @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference.
- */
- public NavigationAction(ResourceBundle bundle, boolean next) {
- Utilities.initAction(this, bundle, next ? "action.Next." : "action.Previous."); //$NON-NLS-2$ //$NON-NLS-1$
- fNext= next;
- }
-
- public void run() {
- if (fCompareEditorInput != null) {
- Object adapter= fCompareEditorInput.getAdapter(ICompareNavigator.class);
- if (adapter instanceof ICompareNavigator) {
- boolean atEnd= ((ICompareNavigator)adapter).selectChange(fNext);
- Shell shell= CompareUIPlugin.getShell();
- if (atEnd && shell != null) {
-
- Display display= shell.getDisplay();
- if (display != null)
- display.beep();
-
- String title;
- String message;
- if (fNext) {
- title= CompareMessages.getString("CompareNavigator.atEnd.title"); //$NON-NLS-1$
- message= CompareMessages.getString("CompareNavigator.atEnd.message"); //$NON-NLS-1$
- } else {
- title= CompareMessages.getString("CompareNavigator.atBeginning.title"); //$NON-NLS-1$
- message= CompareMessages.getString("CompareNavigator.atBeginning.message"); //$NON-NLS-1$
- }
- MessageDialog.openInformation(shell, title, message);
- }
- }
- }
- }
-
- /**
- * Sets the <code>CompareEditorInput</code> on which this action operates.
- *
- * @param input the <code>CompareEditorInput</code> on which this action operates; if <code>null</code> action does nothing
- */
- public void setCompareEditorInput(CompareEditorInput input) {
- fCompareEditorInput= input;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
deleted file mode 100644
index 39a88a93a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.*;
-import java.util.ArrayList;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-
-/**
- * A <code>ResourceNode</code> wrappers an <code>IResources</code> so that it can be used
- * as input for the differencing engine (interfaces <code>IStructureComparator</code> and <code>ITypedElement</code>)
- * and the <code>ReplaceWithEditionDialog</code> (interfaces <code>ITypedElement</code> and <code>IModificationDate</code>).
- * <p>
- * Clients may instantiate this class; it is not intended to be subclassed.
- * </p>
- *
- * @see EditionSelectionDialog
- */
-public class ResourceNode extends BufferedContent
- implements IEncodedStreamContentAccessor, IStructureComparator, ITypedElement,
- IEditableContent, IModificationDate {
-
- private IResource fResource;
- private ArrayList fChildren;
-
-
- /**
- * Creates a <code>ResourceNode</code> for the given resource.
- *
- * @param resource the resource
- */
- public ResourceNode(IResource resource) {
- fResource= resource;
- Assert.isNotNull(resource);
- }
-
- /**
- * Returns the corresponding resource for this object.
- *
- * @return the corresponding resource
- */
- public IResource getResource() {
- return fResource;
- }
-
- /* (non Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() throws CoreException {
- if (fResource instanceof IStorage)
- return super.getContents();
- return null;
- }
-
- /* (non Javadoc)
- * see IModificationDate.getModificationDate
- */
- public long getModificationDate() {
- IPath path= fResource.getLocation();
- File file= path.toFile();
- return file.lastModified();
- }
-
- /* (non Javadoc)
- * see ITypedElement.getName
- */
- public String getName() {
- if (fResource != null)
- return fResource.getName();
- return null;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getType
- */
- public String getType() {
- if (fResource instanceof IContainer)
- return ITypedElement.FOLDER_TYPE;
- if (fResource != null) {
- String s= fResource.getFileExtension();
- if (s != null)
- return s;
- }
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getImage
- */
- public Image getImage() {
- return CompareUI.getImage(fResource);
- }
-
- /**
- * Returns <code>true</code> if the other object is of type <code>ITypedElement</code>
- * and their names are identical. The content is not considered.
- */
- /* (non Javadoc)
- * see IStructureComparator.equals
- */
- public boolean equals(Object other) {
- if (other instanceof ITypedElement) {
- String otherName= ((ITypedElement)other).getName();
- return getName().equals(otherName);
- }
- return super.equals(other);
- }
-
- /**
- * Returns the hash code of the name.
- */
- /* (non Javadoc)
- * see IStructureComparator.hashCode
- */
- public int hashCode() {
- return getName().hashCode();
- }
-
- /* (non Javadoc)
- * see IStructureComparator.getChildren
- */
- public Object[] getChildren() {
- if (fChildren == null) {
- fChildren= new ArrayList();
- if (fResource instanceof IContainer) {
- try {
- IResource members[]= ((IContainer)fResource).members();
- for (int i= 0; i < members.length; i++) {
- IStructureComparator child= createChild(members[i]);
- if (child != null)
- fChildren.add(child);
- }
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
- return fChildren.toArray();
- }
-
- /**
- * This hook method is called from <code>getChildren</code> once for every
- * member of a container resource. This implementation
- * creates a new <code>ResourceNode</code> for the given child resource.
- * Clients may override this method to create a different type of
- * <code>IStructureComparator</code> or to filter children by returning <code>null</code>.
- *
- * @param child the child resource for which a <code>IStructureComparator</code> must be returned
- * @return a <code>ResourceNode</code> for the given child or <code>null</code>
- */
- protected IStructureComparator createChild(IResource child) {
- return new ResourceNode(child);
- }
-
- /**
- * Returns an open stream if the corresponding resource implements the
- * <code>IStorage</code> interface. Otherwise the value <code>null</code> is returned.
- *
- * @return a buffered input stream containing the contents of this storage
- * @exception CoreException if the contents of this storage could not be accessed
- */
- protected InputStream createStream() throws CoreException {
- if (fResource instanceof IStorage) {
- InputStream is= null;
- IStorage storage= (IStorage) fResource;
- try {
- is= storage.getContents();
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- fResource.refreshLocal(IResource.DEPTH_INFINITE, null);
- is= storage.getContents();
- } else
- throw e;
- }
- if (is != null)
- return new BufferedInputStream(is);
- }
- return null;
- }
-
- /* (non Javadoc)
- * see IEditableContent.isEditable
- */
- public boolean isEditable() {
- return true;
- }
-
- /* (non Javadoc)
- * see IEditableContent.replace
- */
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
- return child;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
- */
- public String getCharset() {
- return Utilities.getCharset(fResource);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
deleted file mode 100644
index d6c60c7ff..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.SashForm;
-
-/**
- * The Splitter adds support for nesting to a SashForm.
- * <P>
- * If Splitters are nested directly:
- * <UL>
- * <LI>changing the visibility of a child may propagate upward to the parent Splitter if the child
- * is the last child to become invisible or the first to become visible.</LI>
- * <LI>maximizing a child makes it as large as the topmost enclosing Splitter</LI>
- * </UL>
- *
- * @since 2.1
- */
-public class Splitter extends SashForm {
-
- private static final String VISIBILITY= "org.eclipse.compare.internal.visibility"; //$NON-NLS-1$
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- */
- public Splitter(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * Sets the visibility of the given child in this Splitter. If this change
- * affects the visibility state of the whole Splitter, and if the Splitter
- * is directly nested in one or more Splitters, this method recursively
- * propagates the new state upward.
- *
- * @param child the child control for which the visibility is changed
- * @param visible the new visibility state
- */
- public void setVisible(Control child, boolean visible) {
-
- boolean wasEmpty= isEmpty();
-
- child.setVisible(visible);
- child.setData(VISIBILITY, new Boolean(visible));
-
- if (wasEmpty != isEmpty()) {
- // recursively walk up
- Composite parent= getParent();
- if (parent instanceof Splitter) {
- Splitter sp= (Splitter) parent;
- sp.setVisible(this, visible);
- sp.layout();
- }
- } else {
- layout();
- }
- }
-
- /* (non-Javadoc)
- * Recursively calls setMaximizedControl for all direct parents that are
- * itself Splitters.
- */
- public void setMaximizedControl(Control control) {
- if (control == null || control == getMaximizedControl())
- super.setMaximizedControl(null);
- else
- super.setMaximizedControl(control);
-
- // recursively walk upward
- Composite parent= getParent();
- if (parent instanceof Splitter)
- ((Splitter) parent).setMaximizedControl(this);
- else
- layout(true);
- }
-
- /* (non-Javadoc)
- * Returns true if Splitter has no children or if all children are invisible.
- */
- private boolean isEmpty() {
- Control[] controls= getChildren();
- for (int i= 0; i < controls.length; i++)
- if (isVisible(controls[i]))
- return false;
- return true;
- }
-
- /* (non-Javadoc)
- * Returns the visibility state of the given child control. If the
- * control is a Sash, this method always returns false.
- */
- private boolean isVisible(Control child) {
- if (child instanceof Sash)
- return false;
- Object data= child.getData(VISIBILITY);
- if (data instanceof Boolean)
- return ((Boolean)data).booleanValue();
- return true;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
deleted file mode 100644
index 8f06ebc72..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * This implementation of the <code>IStructureCreator</code> interface
- * makes the contents of a zip archive available as a
- * hierarchical structure of <code>IStructureComparator</code>s.
- * <p>
- * It is used when comparing the internal structure of a zip archive.
- *
- * @since 2.0
- */
-public class ZipFileStructureCreator implements IStructureCreator {
-
- /**
- * Common base class for ZipFolder and ZipFile
- */
- static abstract class ZipResource implements IStructureComparator, ITypedElement {
-
- private String fName;
-
- ZipResource(String name) {
- fName= name;
- }
-
- public String getName() {
- return fName;
- }
-
- public Image getImage() {
- return CompareUI.getImage(getType());
- }
-
- /**
- * Returns true if other is ITypedElement and names are equal.
- * @see IComparator#equals
- */
- public boolean equals(Object other) {
- if (other instanceof ITypedElement)
- return fName.equals(((ITypedElement) other).getName());
- return super.equals(other);
- }
-
- public int hashCode() {
- return fName.hashCode();
- }
- }
-
- static class ZipFolder extends ZipResource {
-
- private HashMap fChildren= new HashMap(10);
-
- ZipFolder(String name) {
- super(name);
- }
-
- public String getType() {
- return ITypedElement.FOLDER_TYPE;
- }
-
- public Object[] getChildren() {
- Object[] children= new Object[fChildren.size()];
- Iterator iter= fChildren.values().iterator();
- for (int i= 0; iter.hasNext(); i++)
- children[i]= iter.next();
- return children;
- }
-
- ZipFile createContainer(String path) {
- String entry= path;
- int pos= path.indexOf('/');
- if (pos < 0)
- pos= path.indexOf('\\');
- if (pos >= 0) {
- entry= path.substring(0, pos);
- path= path.substring(pos + 1);
- } else if (entry.length() > 0) {
- if (CompareUIPlugin.filter(path, false, true))
- return null;
- ZipFile ze= new ZipFile(entry);
- fChildren.put(entry, ze);
- return ze;
- } else
- return null;
-
- ZipFolder folder= null;
- if (fChildren != null) {
- Object o= fChildren.get(entry);
- if (o instanceof ZipFolder)
- folder= (ZipFolder) o;
- }
-
- if (folder == null) {
- if (path.length() > 0 && CompareUIPlugin.filter(path, true, true))
- return null;
- folder= new ZipFolder(entry);
- fChildren.put(entry, folder);
- }
-
- return folder.createContainer(path);
- }
- }
-
- static class ZipFile extends ZipResource implements IStreamContentAccessor {
-
- private byte[] fContents;
-
- ZipFile(String name) {
- super(name);
- }
-
- public String getType() {
- String s= this.getName();
- int pos= s.lastIndexOf('.');
- if (pos >= 0)
- return s.substring(pos + 1);
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- public Object[] getChildren() {
- return null;
- }
-
- public InputStream getContents() {
- if (fContents == null)
- fContents= new byte[0];
- return new ByteArrayInputStream(fContents);
- }
-
- byte[] getBytes() {
- return fContents;
- }
-
- void setBytes(byte[] buffer) {
- fContents= buffer;
- }
-
- void appendBytes(byte[] buffer, int length) {
- if (length > 0) {
- int oldLen= 0;
- if (fContents != null)
- oldLen= fContents.length;
- byte[] newBuf= new byte[oldLen + length];
- if (oldLen > 0)
- System.arraycopy(fContents, 0, newBuf, 0, oldLen);
- System.arraycopy(buffer, 0, newBuf, oldLen, length);
- fContents= newBuf;
- }
- }
- }
-
- private String fTitle;
-
- /**
- * Create a new ZipFileStructureCreator.
- */
- public ZipFileStructureCreator() {
- this(Utilities.getString("ZipStructureCreator.name")); //$NON-NLS-1$
- }
-
- /**
- * Create a new ZipFileStructureCreator with the given title.
- * The title is returned by the method <code>getName()</code>.
- * @param title the title of this strcuture creator
- */
- public ZipFileStructureCreator(String title) {
- fTitle= title;
- }
-
- public String getName() {
- return fTitle;
- }
-
- public IStructureComparator getStructure(Object input) {
-
- InputStream is= null;
-
- if (input instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) input;
- try {
- is= sca.getContents();
- } catch (CoreException ex) {
- // NeedWork
- }
- }
-
- if (is == null)
- return null;
-
- ZipInputStream zip= new ZipInputStream(is);
- ZipFolder root= new ZipFolder(""); //$NON-NLS-1$
- try {
- for (;;) {
- ZipEntry entry= zip.getNextEntry();
- if (entry == null)
- break;
-
- ZipFile ze= root.createContainer(entry.getName());
- if (ze != null) {
- int length= (int) entry.getSize();
- if (length >= 0) {
- byte[] buffer= new byte[length];
- int offset= 0;
-
- do {
- int n= zip.read(buffer, offset, length);
- offset += n;
- length -= n;
- } while (length > 0);
-
- ze.setBytes(buffer);
- } else {
- byte[] buffer= new byte[1024];
- int n;
- do {
- n= zip.read(buffer, 0, 1024);
- ze.appendBytes(buffer, n);
- } while (n >= 0);
- }
- }
- zip.closeEntry();
- }
- } catch (IOException ex) {
- return null;
- } finally {
- try {
- zip.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
-
- if (root.fChildren.size() == 1) {
- Iterator iter= root.fChildren.values().iterator();
- return (IStructureComparator) iter.next();
- }
- return root;
- }
-
- public String getContents(Object o, boolean ignoreWhitespace) {
- if (o instanceof ZipFile) {
- byte[] bytes= ((ZipFile)o).getBytes();
- if (bytes != null)
- return new String(bytes);
- return ""; //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Returns <code>false</code> since we cannot update a zip archive.
- * @return <code>false</code>
- */
- public boolean canSave() {
- return false;
- }
-
- /**
- * Called whenever a copy operation has been performed on a tree node.
- * This implementation throws an <code>AssertionFailedException</code>
- * since we cannot update a zip archive.
- *
- * @param structure the node for which to save the new content
- * @param input the object from which the structure tree was created in <code>getStructure</code>
- */
- public void save(IStructureComparator structure, Object input) {
- Assert.isTrue(false); // Cannot update zip archive
- }
-
- public IStructureComparator locate(Object path, Object source) {
- return null;
- }
-
- /**
- * Returns <code>false</code> since this <code>IStructureCreator</code>
- * cannot rewrite the diff tree in order to fold certain combinations of
- * additons and deletions.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- * @return <code>false</code>
- */
- public boolean canRewriteTree() {
- return false;
- }
-
- /**
- * Empty implementation since this <code>IStructureCreator</code>
- * cannot rewrite the diff tree in order to fold certain combinations of
- * additons and deletions.
- * <p>
- * Note: this method is for internal use only. Clients should not call this method.
- */
- public void rewriteTree(Differencer diff, IDiffContainer root) {
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
deleted file mode 100644
index 846a9ac77..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ /dev/null
@@ -1,978 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.compare.contentmergeviewer;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.ContentViewer;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.compare.internal.*;
-
-/**
- * An abstract compare and merge viewer with two side-by-side content areas
- * and an optional content area for the ancestor. The implementation makes no
- * assumptions about the content type.
- * <p>
- * <code>ContentMergeViewer</code>
- * <ul>
- * <li>implements the overall layout and defines hooks so that subclasses
- * can easily provide an implementation for a specific content type,
- * <li>implements the UI for making the areas resizable,
- * <li>has an action for controlling whether the ancestor area is visible or not,
- * <li>has actions for copying one side of the input to the other side,
- * <li>tracks the dirty state of the left and right sides and send out notification
- * on state changes.
- * </ul>
- * A <code>ContentMergeViewer</code> accesses its
- * model by means of a content provider which must implement the
- * <code>IMergeViewerContentProvider</code> interface.
- * </p>
- * <p>
- * Clients may wish to use the standard concrete subclass <code>TextMergeViewer</code>,
- * or define their own subclass.
- *
- * @see IMergeViewerContentProvider
- * @see TextMergeViewer
- */
-public abstract class ContentMergeViewer extends ContentViewer
- implements IPropertyChangeNotifier, ISavable {
-
- class SaveAction extends MergeViewerAction {
-
- SaveAction(boolean left) {
- super(true, false, false);
- Utilities.initAction(this, getResourceBundle(), "action.save."); //$NON-NLS-1$
- }
-
- public void run() {
- saveContent(getInput());
- }
- }
-
- /**
- * Property names.
- */
- private static final String ANCESTOR_ENABLED= ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE;
-
- /* package */ static final int HORIZONTAL= 1;
- /* package */ static final int VERTICAL= 2;
-
- static final double HSPLIT= 0.5;
- static final double VSPLIT= 0.3;
-
- private class ContentMergeViewerLayout extends Layout {
-
- public Point computeSize(Composite c, int w, int h, boolean force) {
- return new Point(100, 100);
- }
-
- public void layout(Composite composite, boolean force) {
-
- // determine some derived sizes
- int headerHeight= fLeftLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
- Rectangle r= composite.getClientArea();
-
- int centerWidth= getCenterWidth();
- int width1= (int)((r.width-centerWidth)*fHSplit);
- int width2= r.width-width1-centerWidth;
-
- int height1= 0;
- int height2= 0;
- if (fAncestorEnabled && fShowAncestor) {
- height1= (int)((r.height-(2*headerHeight))*fVSplit);
- height2= r.height-(2*headerHeight)-height1;
- } else {
- height1= 0;
- height2= r.height-headerHeight;
- }
-
- int y= 0;
-
- if (fAncestorEnabled && fShowAncestor) {
- fAncestorLabel.setBounds(0, y, r.width, headerHeight);
- fAncestorLabel.setVisible(true);
- y+= headerHeight;
- handleResizeAncestor(0, y, r.width, height1);
- y+= height1;
- } else {
- fAncestorLabel.setVisible(false);
- handleResizeAncestor(0, 0, 0, 0);
- }
-
- fLeftLabel.getSize(); // without this resizing would not always work
-
- if (centerWidth > 3) {
- fLeftLabel.setBounds(0, y, width1+1, headerHeight);
- fDirectionLabel.setVisible(true);
- fDirectionLabel.setBounds(width1+1, y, centerWidth-1, headerHeight);
- fRightLabel.setBounds(width1+centerWidth, y, width2, headerHeight);
- } else {
- fLeftLabel.setBounds(0, y, width1, headerHeight);
- fDirectionLabel.setVisible(false);
- fRightLabel.setBounds(width1, y, r.width-width1, headerHeight);
- }
-
- y+= headerHeight;
-
- if (fCenter != null && !fCenter.isDisposed())
- fCenter.setBounds(width1, y, centerWidth, height2);
-
- handleResizeLeftRight(0, y, width1, centerWidth, width2, height2);
- }
- }
-
- class Resizer extends MouseAdapter implements MouseMoveListener {
-
- Control fControl;
- int fX, fY;
- int fWidth1, fWidth2;
- int fHeight1, fHeight2;
- int fDirection;
- boolean fLiveResize;
- boolean fIsDown;
-
- public Resizer(Control c, int dir) {
- fDirection= dir;
- fControl= c;
- fLiveResize= !(fControl instanceof Sash);
- fControl.addMouseListener(this);
- fControl.addMouseMoveListener(this);
- fControl.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fControl= null;
- }
- }
- );
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- if ((fDirection & HORIZONTAL) != 0)
- fHSplit= HSPLIT;
- if ((fDirection & VERTICAL) != 0)
- fVSplit= VSPLIT;
- fComposite.layout(true);
- }
-
- public void mouseDown(MouseEvent e) {
- Composite parent= fControl.getParent();
-
- Point s= parent.getSize();
- Point as= fAncestorLabel.getSize();
- Point ys= fLeftLabel.getSize();
- Point ms= fRightLabel.getSize();
-
- fWidth1= ys.x;
- fWidth2= ms.x;
- fHeight1= fLeftLabel.getLocation().y-as.y;
- fHeight2= s.y-(fLeftLabel.getLocation().y+ys.y);
-
- fX= e.x;
- fY= e.y;
- fIsDown= true;
- }
-
- public void mouseUp(MouseEvent e) {
- fIsDown= false;
- if (!fLiveResize)
- resize(e);
- }
-
- public void mouseMove(MouseEvent e) {
- if (fIsDown && fLiveResize)
- resize(e);
- }
-
- private void resize(MouseEvent e) {
- int dx= e.x-fX;
- int dy= e.y-fY;
-
- int centerWidth= fCenter.getSize().x;
-
- if (fWidth1 + dx > centerWidth && fWidth2 - dx > centerWidth) {
- fWidth1+= dx;
- fWidth2-= dx;
- if ((fDirection & HORIZONTAL) != 0)
- fHSplit= (double)fWidth1/(double)(fWidth1+fWidth2);
- }
- if (fHeight1 + dy > centerWidth && fHeight2 - dy > centerWidth) {
- fHeight1+= dy;
- fHeight2-= dy;
- if ((fDirection & VERTICAL) != 0)
- fVSplit= (double)fHeight1/(double)(fHeight1+fHeight2);
- }
-
- fComposite.layout(true);
- fControl.getDisplay().update();
- }
- }
-
- /** Style bits for top level composite */
- private int fStyles;
- private ResourceBundle fBundle;
- private CompareConfiguration fCompareConfiguration;
- private IPropertyChangeListener fPropertyChangeListener;
- private ICompareInputChangeListener fCompareInputChangeListener;
- private ListenerList fListenerList;
- boolean fConfirmSave= true;
-
- private double fHSplit= HSPLIT; // width ratio of left and right panes
- private double fVSplit= VSPLIT; // height ratio of ancestor and bottom panes
-
- private boolean fAncestorEnabled= true; // show ancestor in case of conflicts
- /* package */ boolean fShowAncestor= false; // if current input has conflicts
- private boolean fIsThreeWay= false;
- private ActionContributionItem fAncestorItem;
-
- private Action fCopyLeftToRightAction; // copy from left to right
- private Action fCopyRightToLeftAction; // copy from right to left
-
- MergeViewerAction fLeftSaveAction;
- MergeViewerAction fRightSaveAction;
-
- private IKeyBindingService fKeyBindingService;
-
- // SWT widgets
- /* package */ Composite fComposite;
- private CLabel fAncestorLabel;
- private CLabel fLeftLabel;
- private CLabel fRightLabel;
- /* package */ CLabel fDirectionLabel;
- /* package */ Control fCenter;
-
- //---- SWT resources to be disposed
- private Image fRightArrow;
- private Image fLeftArrow;
- private Image fBothArrow;
- //---- end
-
- /**
- * Creates a new content merge viewer and initializes with a resource bundle and a
- * configuration.
- *
- * @param bundle the resource bundle
- * @param cc the configuration object
- */
- protected ContentMergeViewer(int style, ResourceBundle bundle, CompareConfiguration cc) {
- fStyles= style;
- fBundle= bundle;
-
- fAncestorEnabled= Utilities.getBoolean(cc, ANCESTOR_ENABLED, fAncestorEnabled);
- fConfirmSave= Utilities.getBoolean(cc, CompareEditor.CONFIRM_SAVE_PROPERTY, fConfirmSave);
-
- setContentProvider(new MergeViewerContentProvider(cc));
-
- fCompareInputChangeListener= new ICompareInputChangeListener() {
- public void compareInputChanged(ICompareInput input) {
- ContentMergeViewer.this.internalRefresh(input);
- }
- };
-
- fCompareConfiguration= cc;
- if (fCompareConfiguration != null) {
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- ContentMergeViewer.this.propertyChange(event);
- }
- };
- fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- fLeftSaveAction= new SaveAction(true);
- fLeftSaveAction.setEnabled(false);
- fRightSaveAction= new SaveAction(false);
- fRightSaveAction.setEnabled(false);
- }
-
- //---- hooks ---------------------
-
- /**
- * Returns the viewer's name.
- *
- * @return the viewer's name
- */
- public String getTitle() {
- return Utilities.getString(getResourceBundle(), "title"); //$NON-NLS-1$
- }
-
- /**
- * Creates the SWT controls for the ancestor, left, and right
- * content areas of this compare viewer.
- * Implementations typically hold onto the controls
- * so that they can be initialized with the input objects in method
- * <code>updateContent</code>.
- *
- * @param composite the container for the three areas
- */
- abstract protected void createControls(Composite composite);
-
- /**
- * Lays out the ancestor area of the compare viewer.
- * It is called whenever the viewer is resized or when the sashes between
- * the areas are moved to adjust the size of the areas.
- *
- * @param x the horizontal position of the ancestor area within its container
- * @param y the vertical position of the ancestor area within its container
- * @param width the width of the ancestor area
- * @param height the height of the ancestor area
- */
- abstract protected void handleResizeAncestor(int x, int y, int width, int height);
-
- /**
- * Lays out the left and right areas of the compare viewer.
- * It is called whenever the viewer is resized or when the sashes between
- * the areas are moved to adjust the size of the areas.
- *
- * @param x the horizontal position of the left area within its container
- * @param y the vertical position of the left and right area within its container
- * @param leftWidth the width of the left area
- * @param centerWidth the width of the gap between the left and right areas
- * @param rightWidth the width of the right area
- * @param height the height of the left and right areas
- */
- abstract protected void handleResizeLeftRight(int x, int y, int leftWidth, int centerWidth,
- int rightWidth, int height);
-
- /**
- * Contributes items to the given <code>ToolBarManager</code>.
- * It is called when this viewer is installed in its container and if the container
- * has a <code>ToolBarManager</code>.
- * The <code>ContentMergeViewer</code> implementation of this method does nothing.
- * Subclasses may reimplement.
- *
- * @param toolBarManager the toolbar manager to contribute to
- */
- protected void createToolItems(ToolBarManager toolBarManager) {
- }
-
- /**
- * Initializes the controls of the three content areas with the given input objects.
- *
- * @param ancestor the input for the ancestor area
- * @param left the input for the left area
- * @param right the input for the right area
- */
- abstract protected void updateContent(Object ancestor, Object left, Object right);
-
- /**
- * Copies the content of one side to the other side.
- * Called from the (internal) actions for copying the sides of the viewer's input object.
- *
- * @param leftToRight if <code>true</code>, the left side is copied to the right side;
- * if <code>false</code>, the right side is copied to the left side
- */
- abstract protected void copy(boolean leftToRight);
-
- /**
- * Returns the byte contents of the left or right side. If the viewer
- * has no editable content <code>null</code> can be returned.
- *
- * @param left if <code>true</code>, the byte contents of the left area is returned;
- * if <code>false</code>, the byte contents of the right area
- * @return the content as an array of bytes, or <code>null</code>
- */
- abstract protected byte[] getContents(boolean left);
-
- //----------------------------
-
- /**
- * Returns the resource bundle of this viewer.
- *
- * @return the resource bundle
- */
- protected ResourceBundle getResourceBundle() {
- return fBundle;
- }
-
- /**
- * Returns the compare configuration of this viewer,
- * or <code>null</code> if this viewer does not yet have a configuration.
- *
- * @return the compare configuration, or <code>null</code> if none
- */
- protected CompareConfiguration getCompareConfiguration() {
- return fCompareConfiguration;
- }
-
- /**
- * The <code>ContentMergeViewer</code> implementation of this
- * <code>ContentViewer</code> method
- * checks to ensure that the content provider is an <code>IMergeViewerContentProvider</code>.
- */
- public void setContentProvider(IContentProvider contentProvider) {
- Assert.isTrue(contentProvider instanceof IMergeViewerContentProvider);
- super.setContentProvider(contentProvider);
- }
-
- /* package */ IMergeViewerContentProvider getMergeContentProvider() {
- return (IMergeViewerContentProvider) getContentProvider();
- }
-
- /**
- * The <code>ContentMergeViewer</code> implementation of this
- * <code>Viewer</code> method returns the empty selection. Subclasses may override.
- */
- public ISelection getSelection() {
- return new ISelection() {
- public boolean isEmpty() {
- return true;
- }
- };
- }
-
- /**
- * The <code>ContentMergeViewer</code> implementation of this
- * <code>Viewer</code> method does nothing. Subclasses may reimplement.
- */
- public void setSelection(ISelection s, boolean reveal) {
- }
-
- /* package */ void propertyChange(PropertyChangeEvent event) {
-
- String key= event.getProperty();
-
- if (key.equals(ANCESTOR_ENABLED)) {
- fAncestorEnabled= Utilities.getBoolean(getCompareConfiguration(), ANCESTOR_ENABLED, fAncestorEnabled);
- fComposite.layout(true);
- return;
- }
- }
-
- void setAncestorVisibility(boolean visible, boolean enabled) {
- if (fAncestorItem != null) {
- Action action= (Action) fAncestorItem.getAction();
- if (action != null) {
- action.setChecked(visible);
- action.setEnabled(enabled);
- }
- }
- if (fCompareConfiguration != null)
- fCompareConfiguration.setProperty(ANCESTOR_ENABLED, new Boolean(visible));
- }
-
- //---- input
-
- /* package */ boolean isThreeWay() {
- return fIsThreeWay;
- }
-
- /**
- * Internal hook method called when the input to this viewer is
- * initially set or subsequently changed.
- * <p>
- * The <code>ContentMergeViewer</code> implementation of this <code>Viewer</code>
- * method tries to save the old input by calling <code>doSave(...)</code> and
- * then calls <code>internalRefresh(...)</code>.
- *
- * @param input the new input of this viewer, or <code>null</code> if there is no new input
- * @param oldInput the old input element, or <code>null</code> if there was previously no input
- */
- protected final void inputChanged(Object input, Object oldInput) {
-
- if (input != oldInput)
- if (oldInput instanceof ICompareInput)
- ((ICompareInput)oldInput).removeCompareInputChangeListener(fCompareInputChangeListener);
-
- boolean success= doSave(input, oldInput);
-
- if (input != oldInput)
- if (input instanceof ICompareInput)
- ((ICompareInput)input).addCompareInputChangeListener(fCompareInputChangeListener);
-
- if (success) {
- setLeftDirty(false);
- setRightDirty(false);
- }
-
- if (input != oldInput)
- internalRefresh(input);
- }
-
- /**
- * This method is called from the <code>Viewer</code> method <code>inputChanged</code>
- * to save any unsaved changes of the old input.
- * <p>
- * The <code>ContentMergeViewer</code> implementation of this
- * method calls <code>saveContent(...)</code>. If confirmation has been turned on
- * with <code>setConfirmSave(true)</code>, a confirmation alert is posted before saving.
- * </p>
- * Clients can override this method and are free to decide whether
- * they want to call the inherited method.
- * @param newInput the new input of this viewer, or <code>null</code> if there is no new input
- * @param oldInput the old input element, or <code>null</code> if there was previously no input
- * @return <code>true</code> if saving was successful, or if the user didn't want to save (by pressing 'NO' in the confirmation dialog).
- * @since 2.0
- */
- protected boolean doSave(Object newInput, Object oldInput) {
-
- // before setting the new input we have to save the old
- if (fLeftSaveAction.isEnabled() || fRightSaveAction.isEnabled()) {
-
- // post alert
- if (fConfirmSave) {
- Shell shell= fComposite.getShell();
-
- MessageDialog dialog= new MessageDialog(shell,
- Utilities.getString(getResourceBundle(), "saveDialog.title"), //$NON-NLS-1$
- null, // accept the default window icon
- Utilities.getString(getResourceBundle(), "saveDialog.message"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- },
- 0); // default button index
-
- switch (dialog.open()) { // open returns index of pressed button
- case 0:
- saveContent(oldInput);
- break;
- case 1:
- setLeftDirty(false);
- setRightDirty(false);
- break;
- case 2:
- throw new ViewerSwitchingCancelled();
- }
- } else
- saveContent(oldInput);
- return true;
- }
- return false;
- }
-
- /**
- * Controls whether <code>doSave(Object, Object)</code> asks for confirmation before saving
- * the old input with <code>saveContent(Object)</code>.
- * @param enable a value of <code>true</code> enables confirmation
- * @since 2.0
- */
- public void setConfirmSave(boolean enable) {
- fConfirmSave= enable;
- }
-
- /* (non Javadoc)
- * see Viewer.refresh
- */
- public void refresh() {
- internalRefresh(getInput());
- }
-
- private void internalRefresh(Object input) {
-
- IMergeViewerContentProvider content= getMergeContentProvider();
- if (content != null) {
- Object ancestor= content.getAncestorContent(input);
- if (input instanceof ICompareInput)
- fIsThreeWay= (((ICompareInput)input).getKind() & Differencer.DIRECTION_MASK) != 0;
- else
- fIsThreeWay= ancestor != null;
-
- if (fAncestorItem != null)
- fAncestorItem.setVisible(fIsThreeWay);
-
- boolean oldFlag= fShowAncestor;
- fShowAncestor= fIsThreeWay && content.showAncestor(input);
-
- if (fAncestorEnabled && oldFlag != fShowAncestor)
- fComposite.layout(true);
-
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(fComposite.getParent());
- if (tbm != null) {
- updateToolItems();
- tbm.update(true);
- tbm.getControl().getParent().layout(true);
- }
-
- updateHeader();
-
- Object left= content.getLeftContent(input);
- Object right= content.getRightContent(input);
- updateContent(ancestor, left, right);
- }
- }
-
- //---- layout & SWT control creation
-
- /**
- * Builds the SWT controls for the three areas of a compare/merge viewer.
- * <p>
- * Calls the hooks <code>createControls</code> and <code>createToolItems</code>
- * to let subclasses build the specific content areas and to add items to
- * an enclosing toolbar.
- * <p>
- * This method must only be called in the constructor of subclasses.
- *
- * @param parent the parent control
- * @return the new control
- */
- protected final Control buildControl(Composite parent) {
-
- fComposite= new Composite(parent, fStyles) {
- public boolean setFocus() {
- return internalSetFocus();
- }
- };
- fComposite.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
-
- hookControl(fComposite); // hook help & dispose listener
-
- fComposite.setLayout(new ContentMergeViewerLayout());
-
- int style= SWT.SHADOW_OUT;
- fAncestorLabel= new CLabel(fComposite, style);
-
- fLeftLabel= new CLabel(fComposite, style);
- new Resizer(fLeftLabel, VERTICAL);
-
- fDirectionLabel= new CLabel(fComposite, style);
- fDirectionLabel.setAlignment(SWT.CENTER);
- new Resizer(fDirectionLabel, HORIZONTAL | VERTICAL);
-
- fRightLabel= new CLabel(fComposite, style);
- new Resizer(fRightLabel, VERTICAL);
-
- if (fCenter == null || fCenter.isDisposed())
- fCenter= createCenter(fComposite);
-
- createControls(fComposite);
-
- IWorkbenchPartSite ps= Utilities.findSite(fComposite);
- fKeyBindingService= ps != null ? ps.getKeyBindingService() : null;
-
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
-
- // define groups
- tbm.add(new Separator("modes")); //$NON-NLS-1$
- tbm.add(new Separator("merge")); //$NON-NLS-1$
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
-
- CompareConfiguration cc= getCompareConfiguration();
-
- if (cc.isRightEditable()) {
- fCopyLeftToRightAction=
- new Action() {
- public void run() {
- copy(true);
- }
- };
- Utilities.initAction(fCopyLeftToRightAction, getResourceBundle(), "action.CopyLeftToRight."); //$NON-NLS-1$
- tbm.appendToGroup("merge", fCopyLeftToRightAction); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, fCopyLeftToRightAction, "org.eclipse.compare.copyAllLeftToRight"); //$NON-NLS-1$
- }
-
- if (cc.isLeftEditable()) {
- fCopyRightToLeftAction=
- new Action() {
- public void run() {
- copy(false);
- }
- };
- Utilities.initAction(fCopyRightToLeftAction, getResourceBundle(), "action.CopyRightToLeft."); //$NON-NLS-1$
- tbm.appendToGroup("merge", fCopyRightToLeftAction); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, fCopyRightToLeftAction, "org.eclipse.compare.copyAllRightToLeft"); //$NON-NLS-1$
- }
-
- Action a= new ChangePropertyAction(fBundle, fCompareConfiguration, "action.EnableAncestor.", ANCESTOR_ENABLED); //$NON-NLS-1$
- a.setChecked(fAncestorEnabled);
- fAncestorItem= new ActionContributionItem(a);
- fAncestorItem.setVisible(false);
- tbm.appendToGroup("modes", fAncestorItem); //$NON-NLS-1$
-
- createToolItems(tbm);
- updateToolItems();
-
- tbm.update(true);
- }
-
- return fComposite;
- }
-
- /* package */ boolean internalSetFocus() {
- return false;
- }
-
- /* package */ int getCenterWidth() {
- return 3;
- }
-
- /* package */ boolean getAncestorEnabled() {
- return fAncestorEnabled;
- }
-
- /* package */ Control createCenter(Composite parent) {
- Sash sash= new Sash(parent, SWT.VERTICAL);
- new Resizer(sash, HORIZONTAL);
- return sash;
- }
-
- /* package */ Control getCenter() {
- return fCenter;
- }
-
- /*
- * @see Viewer.getControl()
- */
- public Control getControl() {
- return fComposite;
- }
-
- /**
- * Called on the viewer disposal.
- * Unregisters from the compare configuration.
- * Clients may extend if they have to do additional cleanup.
- */
- protected void handleDispose(DisposeEvent event) {
-
- if (fKeyBindingService != null) {
- if (fCopyLeftToRightAction != null)
- fKeyBindingService.unregisterAction(fCopyLeftToRightAction);
- if (fCopyRightToLeftAction != null)
- fKeyBindingService.unregisterAction(fCopyRightToLeftAction);
- fKeyBindingService= null;
- }
-
- Object input= getInput();
- if (input instanceof ICompareInput)
- ((ICompareInput)input).removeCompareInputChangeListener(fCompareInputChangeListener);
-
- if (fCompareConfiguration != null && fPropertyChangeListener != null) {
- fCompareConfiguration.removePropertyChangeListener(fPropertyChangeListener);
- fPropertyChangeListener= null;
- }
-
- fAncestorLabel= null;
- fLeftLabel= null;
- fDirectionLabel= null;
- fRightLabel= null;
- fCenter= null;
-
- if (fRightArrow != null) {
- fRightArrow.dispose();
- fRightArrow= null;
- }
- if (fLeftArrow != null) {
- fLeftArrow.dispose();
- fLeftArrow= null;
- }
- if (fBothArrow != null) {
- fBothArrow.dispose();
- fBothArrow= null;
- }
-
- super.handleDispose(event);
- }
-
- /**
- * Updates the enabled state of the toolbar items.
- * <p>
- * This method is called whenever the state of the items needs updating.
- * <p>
- * Subclasses may extend this method, although this is generally not required.
- */
- protected void updateToolItems() {
-
- IMergeViewerContentProvider content= getMergeContentProvider();
-
- Object input= getInput();
-
- if (fCopyLeftToRightAction != null) {
- boolean enable= content.isRightEditable(input);
-// if (enable && input instanceof ICompareInput) {
-// ITypedElement e= ((ICompareInput) input).getLeft();
-// if (e == null)
-// enable= false;
-// }
- fCopyLeftToRightAction.setEnabled(enable);
- }
-
- if (fCopyRightToLeftAction != null) {
- boolean enable= content.isLeftEditable(input);
-// if (enable && input instanceof ICompareInput) {
-// ITypedElement e= ((ICompareInput) input).getRight();
-// if (e == null)
-// enable= false;
-// }
- fCopyRightToLeftAction.setEnabled(enable);
- }
- }
-
- /**
- * Updates the headers of the three areas
- * by querying the content provider for a name and image for
- * the three sides of the input object.
- * <p>
- * This method is called whenever the header must be updated.
- * <p>
- * Subclasses may extend this method, although this is generally not required.
- */
- protected void updateHeader() {
-
- IMergeViewerContentProvider content= getMergeContentProvider();
- Object input= getInput();
-
- if (fAncestorLabel != null) {
- fAncestorLabel.setImage(content.getAncestorImage(input));
- fAncestorLabel.setText(content.getAncestorLabel(input));
- }
- if (fLeftLabel != null) {
- fLeftLabel.setImage(content.getLeftImage(input));
- fLeftLabel.setText(content.getLeftLabel(input));
- }
- if (fRightLabel != null) {
- fRightLabel.setImage(content.getRightImage(input));
- fRightLabel.setText(content.getRightLabel(input));
- }
- }
-
-// private Image loadImage(String name) {
-// ImageDescriptor id= ImageDescriptor.createFromFile(ContentMergeViewer.class, name);
-// if (id != null)
-// return id.createImage();
-// return null;
-// }
-
- /**
- * Calculates the height of the header.
- */
- /* package */ int getHeaderHeight() {
- int headerHeight= fLeftLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
- headerHeight= Math.max(headerHeight, fDirectionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y);
- return headerHeight;
- }
-
- //---- merge direction
-
- /**
- * Returns true if both sides are editable.
- */
- /* package */ boolean canToggleMergeDirection() {
- IMergeViewerContentProvider content= getMergeContentProvider();
- Object input= getInput();
- return content.isLeftEditable(input) && content.isRightEditable(input);
- }
-
- //---- dirty state & saving state
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.addPropertyChangeListener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fListenerList == null)
- fListenerList= new ListenerList();
- fListenerList.add(listener);
- }
-
- /* (non Javadoc)
- * see IPropertyChangeNotifier.removePropertyChangeListener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fListenerList != null) {
- fListenerList.remove(listener);
- if (fListenerList.isEmpty())
- fListenerList= null;
- }
- }
-
- /* package */ void fireDirtyState(boolean state) {
- Utilities.firePropertyChange(fListenerList, this, CompareEditorInput.DIRTY_STATE, null, new Boolean(state));
- }
-
- /**
- * Sets the dirty state of the left side of this viewer.
- * If the new value differs from the old
- * all registered listener are notified with
- * a <code>PropertyChangeEvent</code> with the
- * property name <code>CompareEditorInput.DIRTY_STATE</code>.
- *
- * @param dirty the state of the left side dirty flag
- */
- protected void setLeftDirty(boolean dirty) {
- if (fLeftSaveAction.isEnabled() != dirty) {
- fLeftSaveAction.setEnabled(dirty);
- fireDirtyState(dirty);
- }
- }
-
- /**
- * Sets the dirty state of the right side of this viewer.
- * If the new value differs from the old
- * all registered listener are notified with
- * a <code>PropertyChangeEvent</code> with the
- * property name <code>CompareEditorInput.DIRTY_STATE</code>.
- *
- * @param dirty the state of the right side dirty flag
- */
- protected void setRightDirty(boolean dirty) {
- if (fRightSaveAction.isEnabled() != dirty) {
- fRightSaveAction.setEnabled(dirty);
- fireDirtyState(dirty);
- }
- }
-
- /**
- * Save the viewers's content.
- * Note: this method is for internal use only. Clients should not call this method.
- * @since 2.0
- */
- public void save(IProgressMonitor pm) throws CoreException {
- saveContent(getInput());
- }
-
- /**
- * Save modified content back to input elements via the content provider.
- */
- /* package */ void saveContent(Object oldInput) {
-
- // write back modified contents
- IMergeViewerContentProvider content= (IMergeViewerContentProvider) getContentProvider();
-
- boolean leftEmpty= content.getLeftContent(oldInput) == null;
- boolean rightEmpty= content.getRightContent(oldInput) == null;
-
- if (fCompareConfiguration.isLeftEditable() && fLeftSaveAction.isEnabled()) {
- byte[] bytes= getContents(true);
- if (leftEmpty && bytes != null && bytes.length == 0)
- bytes= null;
- setLeftDirty(false);
- content.saveLeftContent(oldInput, bytes);
- }
-
- if (fCompareConfiguration.isRightEditable() && fRightSaveAction.isEnabled()) {
- byte[] bytes= getContents(false);
- if (rightEmpty && bytes != null && bytes.length == 0)
- bytes= null;
- setRightDirty(false);
- content.saveRightContent(oldInput, bytes);
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java
deleted file mode 100644
index 7918ba558..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.core.runtime.IProgressMonitor;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-
-
-class DelayedProgressMonitor implements IProgressMonitor {
-
- ProgressMonitorDialog fProgressDialog;
- IProgressMonitor fRealProgressMonitor;
- String fTaskName;
- String fSubTaskName;
- int fTotalWork;
- int fWorked;
- boolean fCancelable;
- Shell fShell;
- int fTime;
-
-
- DelayedProgressMonitor(Shell shell) {
- fShell= shell;
- }
-
- /*
- * @see IProgressMonitor#beginTask(String, int)
- */
- public void beginTask(String name, int totalWork) {
- fTaskName= name;
- fTotalWork= totalWork;
- fTime= 0;
- }
-
- /*
- * @see IProgressMonitor#done()
- */
- public void done() {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.done();
- }
-
- /*
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- if (fRealProgressMonitor != null) {
- fRealProgressMonitor.internalWorked(work);
- }
- }
-
- private void checkTimeout() {
- if (fRealProgressMonitor == null) {
-
- //if (fTime++ < 100)
- // return;
-
- fProgressDialog= new ProgressMonitorDialog(fShell);
- fProgressDialog.setCancelable(true);
- fProgressDialog.open();
- fRealProgressMonitor= fProgressDialog.getProgressMonitor();
- fRealProgressMonitor.beginTask(fTaskName, fTotalWork);
- if (fSubTaskName != null)
- fRealProgressMonitor.subTask(fSubTaskName);
- fRealProgressMonitor.worked(fWorked);
- }
- }
-
- /*
- * @see IProgressMonitor#isCanceled()
- */
- public boolean isCanceled() {
- checkTimeout();
- if (fRealProgressMonitor != null)
- return fRealProgressMonitor.isCanceled();
- return false;
- }
-
- /*
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean value) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.setCanceled(value);
- else
- fCancelable= value;
- }
-
- /*
- * @see IProgressMonitor#setTaskName(String)
- */
- public void setTaskName(String name) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.setTaskName(name);
- else
- fTaskName= name;
- }
-
- /*
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.subTask(name);
- else
- fSubTaskName= name;
- }
-
- /*
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- if (fRealProgressMonitor != null)
- fRealProgressMonitor.internalWorked(work);
- else {
- fWorked+= work;
- checkTimeout();
- }
- }
-
- public static void run(Shell shell, boolean fork, boolean cancelable, IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
-
- DelayedProgressMonitor pm= new DelayedProgressMonitor(shell);
- pm.checkTimeout();
- try {
- ModalContext.run(runnable, fork, pm, shell.getDisplay());
- } finally {
- if (pm.fProgressDialog != null)
- pm.fProgressDialog.close();
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
deleted file mode 100644
index fedb53161..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * Defines a subrange in a document.
- * <p>
- * It is used by text viewers that can work on a subrange of a document. For example,
- * a text viewer for Java compilation units might use this to restrict the view
- * to a single method.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see TextMergeViewer
- * @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode
- */
-public interface IDocumentRange {
-
- /**
- * The position category typically used for an <code>IDocumentRange</code> position
- * (value <code>"DocumentRangeCategory"</code>).
- * @since 2.0
- */
- public static final String RANGE_CATEGORY= "DocumentRangeCategory"; //$NON-NLS-1$
-
- /**
- * Returns the underlying document.
- *
- * @return the underlying document
- */
- IDocument getDocument();
-
- /**
- * Returns a position that specifies a subrange in the underlying document,
- * or <code>null</code> if this document range spans the whole underlying document.
- *
- * @return a position that specifies a subrange in the underlying document, or <code>null</code>
- */
- Position getRange();
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
deleted file mode 100644
index 90e1f0139..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.jface.viewers.IContentProvider;
-
-
-/**
- * A content provider that mediates between a <code>ContentMergeViewer</code>'s model
- * and the viewer itself.
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * @see ContentMergeViewer
- */
-public interface IMergeViewerContentProvider extends IContentProvider {
-
- //---- ancestor side
-
- /**
- * Returns the label for the ancestor side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the label for the ancestor side of a <code>ContentMergeViewer</code>
- */
- String getAncestorLabel(Object input);
-
- /**
- * Returns an optional image for the ancestor side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the image for the ancestor side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Image getAncestorImage(Object input);
-
- /**
- * Returns the contents for the ancestor side of a <code>ContentMergeViewer</code>.
- * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the content for the ancestor side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Object getAncestorContent(Object input);
-
- /**
- * Returns whether the ancestor side of the given input element should be shown.
- *
- * @return <code>true</code> if the ancestor side of the given input element should be shown
- */
- boolean showAncestor(Object input);
-
- //---- left side
-
- /**
- * Returns the label for the left side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the label for the left side of a <code>ContentMergeViewer</code>
- */
- String getLeftLabel(Object input);
-
- /**
- * Returns an optional image for the left side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the image for the left side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Image getLeftImage(Object input);
-
- /**
- * Returns the contents for the left side of a <code>ContentMergeViewer</code>.
- * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the content for the left side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Object getLeftContent(Object input);
-
- /**
- * Returns whether the left side is editable.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return <code>true</code> if the left side of a <code>ContentMergeViewer</code> is editable
- */
- boolean isLeftEditable(Object input);
-
- /**
- * Saves new contents for the left side of the <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @param bytes the new contents to save for the left side
- */
- void saveLeftContent(Object input, byte[] bytes);
-
- //---- right side
-
- /**
- * Returns the label for the right side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the label for the right side of a <code>ContentMergeViewer</code>
- */
- String getRightLabel(Object input);
-
- /**
- * Returns an optional image for the right side of a <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the image for the right side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Image getRightImage(Object input);
-
- /**
- * Returns the contents for the right side of a <code>ContentMergeViewer</code>.
- * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return the content for the right side of a <code>ContentMergeViewer</code>,
- * or <code>null</code> if none
- */
- Object getRightContent(Object input);
-
- /**
- * Returns whether the right side is editable.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @return <code>true</code> if the right side of a <code>ContentMergeViewer</code> is editable
- */
- boolean isRightEditable(Object input);
-
- /**
- * Saves new contents for the right side of the <code>ContentMergeViewer</code>.
- *
- * @param input the input object of the <code>ContentMergeViewer</code>
- * @param bytes the new contents to save for the right side
- */
- void saveRightContent(Object input, byte[] bytes);
-}
-
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
deleted file mode 100644
index 43f03f1f4..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import org.eclipse.compare.rangedifferencer.IRangeComparator;
-
-
-/**
- * For performing a so-called "token compare" on a line of text.
- * This interface extends the <code>IRangeComparator</code> interface
- * so that it can be used by the <code>TextMergeViewer</code>.
- * <p>
- * <code>TextMergeViewer</code> activates the token compare when navigating into
- * a range of differing lines. At first the lines are selected as a block.
- * When navigating into this block the token compare shows for every line
- * the differing token by selecting them.
- * <p>
- * <code>TextMergeViewer</code>'s default token comparator works on characters separated
- * by whitespace. If a different strategy is needed (for example, to use Java tokens in
- * a Java-aware merge viewer), clients may create their own token
- * comparators by implementing this interface (and overriding the
- * <code>TextMergeViewer.createTokenComparator</code> factory method).
- * </p>
- *
- * @see TextMergeViewer
- */
-public interface ITokenComparator extends IRangeComparator {
-
- /**
- * Returns the start character position of the token with the given index.
- * If the index is out of range (but not negative) the character position
- * behind the last character (the length of the input string) is returned.
- *
- * @param index index of the token for which to return the start position
- * @return the start position of the token with the given index
- * @throws java.lang.IndexOutOfBoundsException if index is negative
- */
- int getTokenStart(int index);
-
- /**
- * Returns the character length of the token with the given index.
- * If the index is out of range (but not negative) the value 0 is returned.
- *
- * @param index index of the token for which to return the start position
- * @return the character length of the token with the given index
- * @throws java.lang.IndexOutOfBoundsException if index is negative
- */
- int getTokenLength(int index);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
deleted file mode 100644
index afe0b5051..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ /dev/null
@@ -1,4151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * channingwalton@mac.com - curved line code
- *******************************************************************************/
-package org.eclipse.compare.contentmergeviewer;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ResourceBundle;
-import java.text.MessageFormat;
-
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.compare.internal.MergeSourceViewer;
-import org.eclipse.compare.internal.BufferedCanvas;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.internal.TokenComparator;
-import org.eclipse.compare.internal.DocLineComparator;
-import org.eclipse.compare.internal.ComparePreferencePage;
-import org.eclipse.compare.internal.INavigatable;
-import org.eclipse.compare.internal.CompareNavigator;
-import org.eclipse.compare.internal.TimeoutContext;
-import org.eclipse.compare.internal.DocumentManager;
-import org.eclipse.compare.internal.CompareMessages;
-import org.eclipse.compare.rangedifferencer.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-/**
- * A text merge viewer uses the <code>RangeDifferencer</code> to perform a
- * textual, line-by-line comparison of two (or three) input documents.
- * It is based on the <code>ContentMergeViewer</code> and uses <code>TextViewer</code>s
- * to implement the ancestor, left, and right content areas.
- * <p>
- * In the three-way compare case ranges of differing lines are highlighted and framed
- * with different colors to show whether the difference is an incoming, outgoing, or conflicting change.
- * The <code>TextMergeViewer</code> supports the notion of a current "differing range"
- * and provides toolbar buttons to navigate from one range to the next (or previous).
- * <p>
- * If there is a current "differing range" and the underlying document is editable
- * the <code>TextMergeViewer</code> enables actions in context menu and toolbar to
- * copy a range from one side to the other side, thereby performing a merge operation.
- * <p>
- * In addition to a line-by-line comparison the <code>TextMergeViewer</code>
- * uses a token based compare on differing lines.
- * The token compare is activated when navigating into
- * a range of differing lines. At first the lines are selected as a block.
- * When navigating into this block the token compare shows for every line
- * the differing token by selecting them.
- * <p>
- * The <code>TextMergeViewer</code>'s default token compare works on characters separated
- * by whitespace. If a different strategy is needed (for example, Java tokens in
- * a Java-aware merge viewer), clients can create their own token
- * comparators by implementing the <code>ITokenComparator</code> interface and overriding the
- * <code>TextMergeViewer.createTokenComparator</code> factory method).
- * <p>
- * Access to the <code>TextMergeViewer</code>'s model is by means of an
- * <code>IMergeViewerContentProvider</code>. Its <code>get<it>X</it></code>Content</code> methods must return
- * either an <code>IDocument</code>, an <code>IDocumentRange</code>, or an <code>IStreamContentAccessor</code>.
- * In the <code>IDocumentRange</code> case the <code>TextMergeViewer</code>
- * works on a subrange of a document. In the <code>IStreamContentAccessor</code> case
- * a document is created internally and initialized from the stream.
- * <p>
- * A <code>TextMergeViewer</code> can be used as is. However clients may subclass
- * to customize the behavior. For example a <code>MergeTextViewer</code> for Java would override
- * the <code>configureTextViewer</code> method to configure the <code>TextViewer</code> for Java source code,
- * the <code>createTokenComparator</code> method to create a Java specific tokenizer.
- *
- * @see org.eclipse.compare.rangedifferencer.RangeDifferencer
- * @see org.eclipse.jface.text.TextViewer
- * @see ITokenComparator
- * @see IDocumentRange
- * @see org.eclipse.compare.IStreamContentAccessor
- */
-public class TextMergeViewer extends ContentMergeViewer {
-
- private static final boolean DEBUG= false;
-
- private static final String[] GLOBAL_ACTIONS= {
- ActionFactory.UNDO.getId(),
- ActionFactory.REDO.getId(),
- ActionFactory.CUT.getId(),
- ActionFactory.COPY.getId(),
- ActionFactory.PASTE.getId(),
- ActionFactory.DELETE.getId(),
- ActionFactory.SELECT_ALL.getId(),
- ActionFactory.SAVE.getId()
- };
- private static final String[] TEXT_ACTIONS= {
- MergeSourceViewer.UNDO_ID,
- MergeSourceViewer.REDO_ID,
- MergeSourceViewer.CUT_ID,
- MergeSourceViewer.COPY_ID,
- MergeSourceViewer.PASTE_ID,
- MergeSourceViewer.DELETE_ID,
- MergeSourceViewer.SELECT_ALL_ID,
- MergeSourceViewer.SAVE_ID
- };
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.contentmergeviewer.TextMergeViewerResources"; //$NON-NLS-1$
-
- // constants
- /** Width of left and right vertical bar */
- private static final int MARGIN_WIDTH= 6;
- /** Width of center bar */
- private static final int CENTER_WIDTH= 34;
- /** Width of birds eye view */
- private static final int BIRDS_EYE_VIEW_WIDTH= 12;
- /** Width of birds eye view */
- private static final int BIRDS_EYE_VIEW_INSET= 2;
- /** */
- private static final int RESOLVE_SIZE= 5;
- /** if true copying conflicts from one side to other concatenates both sides */
- private static final boolean APPEND_CONFLICT= true;
-
- /** line width of change borders */
- private static final int LW= 1;
- /** Selects between smartTokenDiff and mergingTokenDiff */
- private static final boolean USE_MERGING_TOKEN_DIFF= false;
- /** When calculating differences show Progress after this timeout (in milliseconds) */
- private static final int TIMEOUT= 2000;
-
- // determines whether a change between left and right is considered incoming or outgoing
- private boolean fLeftIsLocal;
- private boolean fShowCurrentOnly= false;
- private boolean fShowCurrentOnly2= false;
- private int fMarginWidth= MARGIN_WIDTH;
- private int fTopInset;
-
- // Colors
- private RGB fBackground;
- private RGB fForeground;
- private boolean fPollSystemForeground= true;
- private boolean fPollSystemBackground= true;
-
- private RGB SELECTED_INCOMING;
- private RGB INCOMING;
- private RGB INCOMING_FILL;
-
- private RGB SELECTED_CONFLICT;
- private RGB CONFLICT;
- private RGB CONFLICT_FILL;
-
- private RGB SELECTED_OUTGOING;
- private RGB OUTGOING;
- private RGB OUTGOING_FILL;
-
- private RGB RESOLVED;
-
- private boolean fEndOfDocReached;
- private IDocumentListener fDocumentListener;
-
- private IPreferenceStore fPreferenceStore;
- private IPropertyChangeListener fPreferenceChangeListener;
-
- /** All diffs for calculating scrolling position (includes line ranges without changes) */
- private ArrayList fAllDiffs;
- /** Subset of above: just real differences. */
- private ArrayList fChangeDiffs;
- /** The current diff */
- private Diff fCurrentDiff;
-
- private HashMap fNewAncestorRanges= new HashMap();
- private HashMap fNewLeftRanges= new HashMap();
- private HashMap fNewRightRanges= new HashMap();
-
- private MergeSourceViewer fAncestor;
- private MergeSourceViewer fLeft;
- private MergeSourceViewer fRight;
-
- private int fLeftLineCount;
- private int fRightLineCount;
-
- private boolean fInScrolling;
-
- private int fPts[]= new int[8]; // scratch area for polygon drawing
-
- private boolean fIgnoreAncestor= false;
- private ActionContributionItem fIgnoreAncestorItem;
- private boolean fHiglightRanges;
-
- private boolean fShowPseudoConflicts= false;
-
- private boolean fUseSplines= true;
- private boolean fUseSingleLine= true;
- private boolean fUseResolveUI= fUseSingleLine; // resolve UI only for single lines private boolean fShowSummeryIcon;
-
- private String fSymbolicFontName;
-
- private ActionContributionItem fNextItem; // goto next difference
- private ActionContributionItem fPreviousItem; // goto previous difference
- private ActionContributionItem fCopyDiffLeftToRightItem;
- private ActionContributionItem fCopyDiffRightToLeftItem;
-
- private IKeyBindingService fKeyBindingService;
-
- private boolean fSynchronizedScrolling= true;
- private boolean fShowMoreInfo= false;
-
- private MergeSourceViewer fFocusPart;
-
- private boolean fSubDoc= true;
- private IPositionUpdater fPositionUpdater;
- private boolean fIsMotif;
- private boolean fIsCarbon;
-
-
- // SWT widgets
- private BufferedCanvas fAncestorCanvas;
- private BufferedCanvas fLeftCanvas;
- private BufferedCanvas fRightCanvas;
- private Canvas fScrollCanvas;
- private ScrollBar fVScrollBar;
- private Canvas fBirdsEyeCanvas;
- private Canvas fSummaryHeader;
- private HeaderPainter fHeaderPainter;
-
- // SWT resources to be disposed
- private Map fColors;
- private Cursor fBirdsEyeCursor;
-
- // points for center curves
- private double[] fBasicCenterCurve;
-
- private Button fCenterButton;
- private Diff fButtonDiff;
-
- class HeaderPainter implements PaintListener {
-
- private static final int INSET= BIRDS_EYE_VIEW_INSET;
-
- private RGB fIndicatorColor;
- private Color fSeparatorColor;
-
- public HeaderPainter() {
- fSeparatorColor= getColor(fSummaryHeader.getDisplay(), ViewForm.borderInsideRGB);
- }
-
- /**
- * Returns true on color change
- */
- public boolean setColor(RGB color) {
- RGB oldColor= fIndicatorColor;
- fIndicatorColor= color;
- if (color == null)
- return oldColor != null;
- if (oldColor != null)
- return !color.equals(oldColor);
- return true;
- }
-
- private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) {
- gc.setForeground(topLeft);
- gc.drawLine(x, y, x + w -1, y);
- gc.drawLine(x, y, x, y + h -1);
-
- gc.setForeground(bottomRight);
- gc.drawLine(x + w, y, x + w, y + h);
- gc.drawLine(x, y + h, x + w, y + h);
- }
-
- public void paintControl(PaintEvent e) {
-
- Point s= fSummaryHeader.getSize();
-
- if (fIndicatorColor != null) {
- Display d= fSummaryHeader.getDisplay();
- e.gc.setBackground(getColor(d, fIndicatorColor));
- int min= Math.min(s.x, s.y)-2*INSET;
- Rectangle r= new Rectangle((s.x-min)/2, (s.y-min)/2, min, min);
- e.gc.fillRectangle(r);
- if (d != null)
- drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
-
- e.gc.setForeground(fSeparatorColor);
- e.gc.setLineWidth(1);
- e.gc.drawLine(0+1, s.y-1, s.x-1-1, s.y-1);
- }
- }
- }
-
- /**
- * The position updater used to adapt the positions representing
- * the child document ranges to changes of the parent document.
- */
- class ChildPositionUpdater extends DefaultPositionUpdater {
-
- /**
- * Creates the position updated.
- */
- protected ChildPositionUpdater(String category) {
- super(category);
- }
-
- /**
- * Child document ranges cannot be deleted other then by calling
- * freeChildDocument.
- */
- protected boolean notDeleted() {
- return true;
- }
-
- /**
- * If an insertion happens at a child document's start offset, the
- * position is extended rather than shifted. Also, if something is added
- * right behind the end of the position, the position is extended rather
- * than kept stable.
- */
- protected void adaptToInsert() {
-
- if (fPosition == fLeft.getRegion() || fPosition == fRight.getRegion()) {
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length;
- myEnd= Math.max(myStart, myEnd);
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fReplaceLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart)
- return;
-
- if (myStart <= yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
- } else {
- super.adaptToInsert();
- }
- }
- }
-
- /**
- * A Diff represents synchronized character ranges in two or three Documents.
- * The MergeTextViewer uses Diffs to find differences in line and token ranges.
- */
- /* package */ class Diff {
- /** character range in ancestor document */
- Position fAncestorPos;
- /** character range in left document */
- Position fLeftPos;
- /** character range in right document */
- Position fRightPos;
- /** if this is a TokenDiff fParent points to the enclosing LineDiff */
- Diff fParent;
- /** if Diff has been resolved */
- boolean fResolved;
- int fDirection;
- boolean fIsToken= false;
- /** child token diffs */
- ArrayList fDiffs;
- boolean fIsWhitespace= false;
-
- /**
- * Create Diff from two ranges and an optional parent diff.
- */
- Diff(Diff parent, int dir, IDocument ancestorDoc, Position aRange, int ancestorStart, int ancestorEnd,
- IDocument leftDoc, Position lRange, int leftStart, int leftEnd,
- IDocument rightDoc, Position rRange, int rightStart, int rightEnd) {
- fParent= parent != null ? parent : this;
- fDirection= dir;
-
- fLeftPos= createPosition(leftDoc, lRange, leftStart, leftEnd);
- fRightPos= createPosition(rightDoc, rRange, rightStart, rightEnd);
- if (ancestorDoc != null)
- fAncestorPos= createPosition(ancestorDoc, aRange, ancestorStart, ancestorEnd);
- }
-
- Position getPosition(char type) {
- switch (type) {
- case 'A':
- return fAncestorPos;
- case 'L':
- return fLeftPos;
- case 'R':
- return fRightPos;
- }
- return null;
- }
-
- boolean isInRange(char type, int pos) {
- Position p= getPosition(type);
- return (pos >= p.offset) && (pos < (p.offset+p.length));
- }
-
- String changeType() {
- boolean leftEmpty= fLeftPos.length == 0;
- boolean rightEmpty= fRightPos.length == 0;
-
- if (fDirection == RangeDifference.LEFT) {
- if (!leftEmpty && rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.addition"); //$NON-NLS-1$
- if (leftEmpty && !rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.deletion"); //$NON-NLS-1$
- } else {
- if (leftEmpty && !rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.addition"); //$NON-NLS-1$
- if (!leftEmpty && rightEmpty)
- return CompareMessages.getString("TextMergeViewer.changeType.deletion"); //$NON-NLS-1$
- }
- return CompareMessages.getString("TextMergeViewer.changeType.change"); //$NON-NLS-1$
- }
-
- Image getImage() {
- int code= Differencer.CHANGE;
- switch (fDirection) {
- case RangeDifference.RIGHT:
- code+= Differencer.LEFT;
- break;
- case RangeDifference.LEFT:
- code+= Differencer.RIGHT;
- break;
- case RangeDifference.ANCESTOR:
- case RangeDifference.CONFLICT:
- code+= Differencer.CONFLICTING;
- break;
- }
- if (code != 0)
- return getCompareConfiguration().getImage(code);
- return null;
- }
-
- Position createPosition(IDocument doc, Position range, int start, int end) {
- try {
- int l= end-start;
- if (range != null) {
- int dl= range.length;
- if (l > dl)
- l= dl;
- } else {
- int dl= doc.getLength();
- if (start+l > dl)
- l= dl-start;
- }
-
- Position p= null;
- try {
- p= new Position(start, l);
- } catch (RuntimeException ex) {
- // silently ignored
- }
-
- try {
- doc.addPosition(IDocumentRange.RANGE_CATEGORY, p);
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- }
- return p;
- } catch (BadLocationException ee) {
- // silently ignored
- }
- return null;
- }
-
- void add(Diff d) {
- if (fDiffs == null)
- fDiffs= new ArrayList();
- fDiffs.add(d);
- }
-
- boolean isDeleted() {
- if (fAncestorPos != null && fAncestorPos.isDeleted())
- return true;
- return fLeftPos.isDeleted() || fRightPos.isDeleted();
- }
-
- void setResolved(boolean r) {
- fResolved= r;
- if (r)
- fDiffs= null;
- }
-
- boolean isResolved() {
- if (!fResolved && fDiffs != null) {
- Iterator e= fDiffs.iterator();
- while (e.hasNext()) {
- Diff d= (Diff) e.next();
- if (!d.isResolved())
- return false;
- }
- return true;
- }
- return fResolved;
- }
-
-// private boolean isIncoming() {
-// switch (fDirection) {
-// case RangeDifference.RIGHT:
-// if (fLeftIsLocal)
-// return true;
-// break;
-// case RangeDifference.LEFT:
-// if (!fLeftIsLocal)
-// return true;
-// break;
-// }
-// return false;
-// }
-
- private boolean isIncomingOrConflicting() {
- switch (fDirection) {
- case RangeDifference.RIGHT:
- if (fLeftIsLocal)
- return true;
- break;
- case RangeDifference.LEFT:
- if (!fLeftIsLocal)
- return true;
- break;
- case RangeDifference.CONFLICT:
- return true;
- }
- return false;
- }
-
-// private boolean isUnresolvedIncoming() {
-// if (fResolved)
-// return false;
-// return isIncoming();
-// }
-
- private boolean isUnresolvedIncomingOrConflicting() {
- if (fResolved)
- return false;
- return isIncomingOrConflicting();
- }
-
- Position getPosition(MergeSourceViewer w) {
- if (w == fLeft)
- return fLeftPos;
- if (w == fRight)
- return fRightPos;
- if (w == fAncestor)
- return fAncestorPos;
- return null;
- }
-
- /**
- * Returns true if given character range overlaps with this Diff.
- */
- boolean contains(MergeSourceViewer w, int start, int end) {
- Position h= getPosition(w);
- if (h != null) {
- int offset= h.getOffset();
- if (start >= offset) {
- int endPos= offset+h.getLength();
- if (end < endPos)
- return true;
- if (endPos == w.getDocument().getLength())
- return true;
- }
- }
- return false;
- }
-
- int getMaxDiffHeight(boolean withAncestor) {
- Point region= new Point(0, 0);
- int h= fLeft.getLineRange(fLeftPos, region).y;
- if (withAncestor)
- h= Math.max(h, fAncestor.getLineRange(fAncestorPos, region).y);
- return Math.max(h, fRight.getLineRange(fRightPos, region).y);
- }
-
- int getAncestorHeight() {
- Point region= new Point(0, 0);
- return fAncestor.getLineRange(fAncestorPos, region).y;
- }
-
- int getLeftHeight() {
- Point region= new Point(0, 0);
- return fLeft.getLineRange(fLeftPos, region).y;
- }
-
- int getRightHeight() {
- Point region= new Point(0, 0);
- return fRight.getLineRange(fRightPos, region).y;
- }
- }
-
- //---- MergeTextViewer
-
- /**
- * Creates a text merge viewer under the given parent control.
- *
- * @param parent the parent control
- * @param configuration the configuration object
- */
- public TextMergeViewer(Composite parent, CompareConfiguration configuration) {
- this(parent, SWT.NULL, configuration);
- }
-
- /**
- * Creates a text merge viewer under the given parent control.
- *
- * @param parent the parent control
- * @param style SWT style bits for top level composite of this viewer
- * @param configuration the configuration object
- */
- public TextMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
- super(style, ResourceBundle.getBundle(BUNDLE_NAME), configuration);
-
- fSymbolicFontName= getClass().getName();
-
- String platform= SWT.getPlatform();
- fIsMotif= "motif".equals(platform); //$NON-NLS-1$
- fIsCarbon= "carbon".equals(platform); //$NON-NLS-1$
-
- if (fIsMotif)
- fMarginWidth= 0;
-
- Display display= parent.getDisplay();
-
- fPreferenceChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- TextMergeViewer.this.propertyChange(event);
- }
- };
-
- fPreferenceStore= configuration.getPreferenceStore();
- if (fPreferenceStore != null) {
- fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
-
- checkForColorUpdate(display);
-
- fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
- fSynchronizedScrolling= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
- fShowMoreInfo= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_MORE_INFO);
- fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
- //fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
- fUseSingleLine= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
- fUseResolveUI= fUseSingleLine;
- //fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
- }
-
- fDocumentListener= new IDocumentListener() {
-
- public void documentAboutToBeChanged(DocumentEvent e) {
- }
-
- public void documentChanged(DocumentEvent e) {
- TextMergeViewer.this.documentChanged(e);
- }
- };
-
- buildControl(parent);
-
- INavigatable nav= new INavigatable() {
- public boolean gotoDifference(boolean next) {
- return navigate(next, false, false);
- }
- };
- fComposite.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
- fBirdsEyeCursor= new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
-
- JFaceResources.getFontRegistry().addListener(fPreferenceChangeListener);
- updateFont();
- }
-
- private void updateFont() {
- Font f= JFaceResources.getFont(fSymbolicFontName);
- if (f != null) {
- if (fAncestor != null)
- fAncestor.setFont(f);
- if (fLeft != null)
- fLeft.setFont(f);
- if (fRight != null)
- fRight.setFont(f);
- }
- }
-
- private void checkForColorUpdate(Display display) {
- if (fPollSystemForeground) {
- RGB fg= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
- if (fForeground == null || !fg.equals(fForeground)) {
- fForeground= fg;
- updateColors(display);
- }
- }
- if (fPollSystemBackground) {
- RGB bg= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
- if (fBackground == null || !bg.equals(fBackground)) {
- fBackground= bg;
- updateColors(display);
- }
- }
- }
-
- /**
- * Sets the viewer's background color to the given RGB value.
- * If the value is <code>null</code> the system's default background color is used.
- * @param background the background color or <code>null</code> to use the system's default background color
- * @since 2.0
- */
- public void setBackgroundColor(RGB background) {
- fPollSystemBackground= (background == null);
- fBackground= background;
- updateColors(null);
- }
-
- private RGB getBackground(Display display) {
- if (fBackground != null)
- return fBackground;
- if (display == null)
- display= fComposite.getDisplay();
- return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
- }
-
- /**
- * Sets the viewer's foreground color to the given RGB value.
- * If the value is <code>null</code> the system's default foreground color is used.
- * @param foreground the foreground color or <code>null</code> to use the system's default foreground color
- * @since 2.0
- */
- public void setForegroundColor(RGB foreground) {
- fPollSystemForeground= (foreground == null);
- fForeground= foreground;
- updateColors(null);
- }
-
- private RGB getForeground(Display display) {
- if (fForeground != null)
- return fForeground;
- if (display == null)
- display= fComposite.getDisplay();
- return display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
- }
-
- private void updateColors(Display display) {
-
- if (display == null)
- display= fComposite.getDisplay();
-
- Color color= null;
- if (fBackground != null)
- color= getColor(display, fBackground);
-
- if (fAncestor != null)
- fAncestor.setBackgroundColor(color);
- if (fLeft != null)
- fLeft.setBackgroundColor(color);
- if (fRight != null)
- fRight.setBackgroundColor(color);
-
- RGB bg= getBackground(display);
- SELECTED_INCOMING= new RGB(0, 0, 255);
- INCOMING= interpolate(SELECTED_INCOMING, bg, 0.6);
- INCOMING_FILL= interpolate(SELECTED_INCOMING, bg, 0.97);
-
- SELECTED_CONFLICT= new RGB(255, 0, 0);
- CONFLICT= interpolate(SELECTED_CONFLICT, bg, 0.6);
- CONFLICT_FILL= interpolate(SELECTED_CONFLICT, bg, 0.97);
-
- SELECTED_OUTGOING= getForeground(display);
- OUTGOING= interpolate(SELECTED_OUTGOING, bg, 0.6);
- OUTGOING_FILL= interpolate(SELECTED_OUTGOING, bg, 0.97);
-
- RESOLVED= new RGB(0, 255, 0);
-
- refreshBirdsEyeView();
- invalidateLines();
-
- updateAllDiffBackgrounds(display);
- }
-
- /**
- * Invalidates the current presentation by invalidating the three text viewers.
- * @since 2.0
- */
- public void invalidateTextPresentation() {
- if (fAncestor != null)
- fAncestor.invalidateTextPresentation();
- if (fLeft != null)
- fLeft.invalidateTextPresentation();
- if (fRight != null)
- fRight.invalidateTextPresentation();
- }
-
- /**
- * Configures the passed text viewer.
- * This method is called after the three text viewers have been created for the
- * content areas.
- * The <code>TextMergeViewer</code> implementation of this method does nothing.
- * Subclasses may reimplement to provide a specific configuration for the text viewer.
- *
- * @param textViewer the text viewer to configure
- */
- protected void configureTextViewer(TextViewer textViewer) {
- }
-
- /**
- * Creates an <code>ITokenComparator</code> which is used to show the
- * intra line differences.
- * The <code>TextMergeViewer</code> implementation of this method returns a
- * tokenizer that breaks a line into words separated by whitespace.
- * Subclasses may reimplement to provide a specific tokenizer.
- *
- * @return a ITokenComparator which is used for a second level token compare.
- */
- protected ITokenComparator createTokenComparator(String s) {
- return new TokenComparator(s);
- }
-
- /**
- * Returns a document partitioner which is suitable for the underlying content type.
- * This method is only called if the input provided by the content provider is a
- * <code>IStreamContentAccessor</code> and an internal document must be created. This
- * document is initialized with the partitioner returned from this method.
- * <p>
- * The <code>TextMergeViewer</code> implementation of this method returns
- * <code>null</code>. Subclasses may reimplement to create a partitioner for a
- * specific content type.
- *
- * @return a document partitioner, or <code>null</code>
- */
- protected IDocumentPartitioner getDocumentPartitioner() {
- return null;
- }
-
- /**
- * Called on the viewer disposal.
- * Unregisters from the compare configuration.
- * Clients may extend if they have to do additional cleanup.
- */
- protected void handleDispose(DisposeEvent event) {
-
- if (fKeyBindingService != null) {
- IAction a;
- if (fNextItem != null) {
- a= fNextItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- if (fPreviousItem != null) {
- a= fPreviousItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- if (fCopyDiffLeftToRightItem != null) {
- a= fCopyDiffLeftToRightItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- if (fCopyDiffRightToLeftItem != null) {
- a= fCopyDiffRightToLeftItem.getAction();
- if (a != null)
- fKeyBindingService.unregisterAction(a);
- }
- fKeyBindingService= null;
- }
-
- Object input= getInput();
- DocumentManager.remove(getDocument2('A', input));
- DocumentManager.remove(getDocument2('L', input));
- DocumentManager.remove(getDocument2('R', input));
-
- if (DEBUG)
- DocumentManager.dump();
-
- if (fPreferenceChangeListener != null) {
- JFaceResources.getFontRegistry().removeListener(fPreferenceChangeListener);
- if (fPreferenceStore != null)
- fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener);
- fPreferenceChangeListener= null;
- }
-
- fLeftCanvas= null;
- fRightCanvas= null;
- fVScrollBar= null;
- fBirdsEyeCanvas= null;
- fSummaryHeader= null;
-
- unsetDocument(fAncestor);
- unsetDocument(fLeft);
- unsetDocument(fRight);
-
- if (fColors != null) {
- Iterator i= fColors.values().iterator();
- while (i.hasNext()) {
- Color color= (Color) i.next();
- if (!color.isDisposed())
- color.dispose();
- }
- fColors= null;
- }
-
- if (fBirdsEyeCursor != null) {
- fBirdsEyeCursor.dispose();
- fBirdsEyeCursor= null;
- }
-
- super.handleDispose(event);
- }
-
- //-------------------------------------------------------------------------------------------------------------
- //--- internal ------------------------------------------------------------------------------------------------
- //-------------------------------------------------------------------------------------------------------------
-
- /**
- * Creates the specific SWT controls for the content areas.
- * Clients must not call or override this method.
- */
- protected void createControls(Composite composite) {
-
- WorkbenchHelp.setHelp(composite, ICompareContextIds.TEXT_MERGE_VIEW);
-
- // 1st row
- if (fMarginWidth > 0) {
- fAncestorCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintSides(gc, fAncestor, fAncestorCanvas, false);
- }
- };
- fAncestorCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handleMouseInSides(fAncestorCanvas, fAncestor, e.y), false);
- }
- }
- );
- }
-
- fAncestor= createPart(composite);
- fAncestor.setEditable(false);
-
- fSummaryHeader= new Canvas(composite, SWT.NONE);
- fHeaderPainter= new HeaderPainter();
- fSummaryHeader.addPaintListener(fHeaderPainter);
- updateResolveStatus();
-
- // 2nd row
- if (fMarginWidth > 0) {
- fLeftCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintSides(gc, fLeft, fLeftCanvas, false);
- }
- };
- fLeftCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handleMouseInSides(fLeftCanvas, fLeft, e.y), false);
- }
- }
- );
- }
-
- fLeft= createPart(composite);
- fLeft.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- fLeft.addAction(MergeSourceViewer.SAVE_ID, fLeftSaveAction);
-
- fRight= createPart(composite);
- fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- fRight.addAction(MergeSourceViewer.SAVE_ID, fRightSaveAction);
-
- hsynchViewport(fLeft, fRight);
- hsynchViewport(fRight, fLeft);
-
- if (fMarginWidth > 0) {
- fRightCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintSides(gc, fRight, fRightCanvas, fSynchronizedScrolling);
- }
- };
- fRightCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handleMouseInSides(fRightCanvas, fRight, e.y), false);
- }
- }
- );
- }
-
- fScrollCanvas= new Canvas(composite, SWT.V_SCROLL);
- //Rectangle trim= fScrollCanvas.computeTrim(0, 0, 0, 0);
- Rectangle trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- fTopInset= trim.y;
-
- fVScrollBar= fScrollCanvas.getVerticalBar();
- fVScrollBar.setIncrement(1);
- fVScrollBar.setVisible(true);
- fVScrollBar.addListener(SWT.Selection,
- new Listener() {
- public void handleEvent(Event e) {
- int vpos= ((ScrollBar)e.widget).getSelection();
- scrollVertical(vpos, vpos, vpos, null);
- }
- }
- );
-
- fBirdsEyeCanvas= new BufferedCanvas(composite, SWT.NONE) {
- public void doPaint(GC gc) {
- paintBirdsEyeView(this, gc);
- }
- };
- //fBirdsEyeCanvas.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
- fBirdsEyeCanvas.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- setCurrentDiff2(handlemouseInBirdsEyeView(fBirdsEyeCanvas, e.y), true);
- }
- }
- );
- fBirdsEyeCanvas.addMouseMoveListener(
- new MouseMoveListener() {
-
- private Cursor fLastCursor;
-
- public void mouseMove(MouseEvent e) {
- Cursor cursor= null;
- Diff diff= handlemouseInBirdsEyeView(fBirdsEyeCanvas, e.y);
- if (diff != null && diff.fDirection != Differencer.NO_CHANGE)
- cursor= fBirdsEyeCursor;
- if (fLastCursor != cursor) {
- fBirdsEyeCanvas.setCursor(cursor);
- fLastCursor= cursor;
- }
- }
- }
- );
- }
-
- private void hsynchViewport(final TextViewer tv1, final TextViewer tv2) {
- final StyledText st1= tv1.getTextWidget();
- final StyledText st2= tv2.getTextWidget();
- final ScrollBar sb1= st1.getHorizontalBar();
- final ScrollBar sb2= st2.getHorizontalBar();
- sb1.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int max= sb1.getMaximum()-sb1.getThumb();
- double v= 0.0;
- if (max > 0)
- v= (float)sb1.getSelection() / (float)max;
- max= sb2.getMaximum()-sb2.getThumb();
- st2.setHorizontalPixel((int)(max * v));
- }
- });
- }
-
- private void setCurrentDiff2(Diff diff, boolean reveal) {
- if (diff != null && diff.fDirection != Differencer.NO_CHANGE) {
- //fCurrentDiff= null;
- setCurrentDiff(diff, reveal);
- }
- }
-
- private Diff handleMouseInSides(Canvas canvas, MergeSourceViewer tp, int my) {
-
- int lineHeight= tp.getTextWidget().getLineHeight();
- int visibleHeight= tp.getViewportHeight();
-
- if (! fHiglightRanges)
- return null;
-
- if (fChangeDiffs != null) {
- int shift= tp.getVerticalScrollOffset() + (2-LW);
-
- Point region= new Point(0, 0);
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- tp.getLineRange(diff.getPosition(tp), region);
- int y= (region.x * lineHeight) + shift;
- int h= region.y * lineHeight;
-
- if (y+h < 0)
- continue;
- if (y >= visibleHeight)
- break;
-
- if (my >= y && my < y+h)
- return diff;
- }
- }
- return null;
- }
-
- private Diff getDiffUnderMouse(Canvas canvas, int mx, int my, Rectangle r) {
-
- if (! fSynchronizedScrolling)
- return null;
-
- int lineHeight= fLeft.getTextWidget().getLineHeight();
- int visibleHeight= fRight.getViewportHeight();
-
- Point size= canvas.getSize();
- int w= size.x;
-
- if (! fHiglightRanges)
- return null;
-
- if (fChangeDiffs != null) {
- int lshift= fLeft.getVerticalScrollOffset();
- int rshift= fRight.getVerticalScrollOffset();
-
- Point region= new Point(0, 0);
-
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- fLeft.getLineRange(diff.fLeftPos, region);
- int ly= (region.x * lineHeight) + lshift;
- int lh= region.y * lineHeight;
-
- fRight.getLineRange(diff.fRightPos, region);
- int ry= (region.x * lineHeight) + rshift;
- int rh= region.y * lineHeight;
-
- if (Math.max(ly+lh, ry+rh) < 0)
- continue;
- if (Math.min(ly, ry) >= visibleHeight)
- break;
-
- int cx= (w-RESOLVE_SIZE)/2;
- int cy= ((ly+lh/2) + (ry+rh/2) - RESOLVE_SIZE)/2;
- if (my >= cy && my < cy+RESOLVE_SIZE && mx >= cx && mx < cx+RESOLVE_SIZE) {
- if (r != null) {
- r.x= cx+RESOLVE_SIZE/2-10;
- r.y= cy+RESOLVE_SIZE/2-10;
- r.width= 20;
- r.height= 20;
- }
- return diff;
- }
- }
- }
- return null;
- }
-
- private Diff handlemouseInBirdsEyeView(Canvas canvas, int my) {
- int yy, hh;
-
- Point size= canvas.getSize();
-
- int virtualHeight= fSynchronizedScrolling ? getVirtualHeight() : getRightHeight();
- if (virtualHeight < getViewportHeight())
- return null;
-
- int y= 0;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- int h= fSynchronizedScrolling ? diff.getMaxDiffHeight(fShowAncestor)
- : diff.getRightHeight();
- if (useChange(diff.fDirection) && !diff.fIsWhitespace) {
-
- yy= (y*size.y)/virtualHeight;
- hh= (h*size.y)/virtualHeight;
- if (hh < 3)
- hh= 3;
-
- if (my >= yy && my < yy+hh)
- return diff;
- }
- y+= h;
- }
- }
- return null;
- }
-
- private void paintBirdsEyeView(Canvas canvas, GC gc) {
-
- Color c;
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int yy, hh;
-
- Point size= canvas.getSize();
-
- int virtualHeight= fSynchronizedScrolling ? getVirtualHeight() : getRightHeight();
- if (virtualHeight < getViewportHeight())
- return;
-
- Display display= canvas.getDisplay();
- int y= 0;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- int h= fSynchronizedScrolling ? diff.getMaxDiffHeight(fShowAncestor)
- : diff.getRightHeight();
-
- if (useChange(diff.fDirection) && !diff.fIsWhitespace) {
-
- yy= (y*size.y)/virtualHeight;
- hh= (h*size.y)/virtualHeight;
- if (hh < 3)
- hh= 3;
-
- c= getColor(display, getFillColor(diff));
- if (c != null) {
- gc.setBackground(c);
- gc.fillRectangle(BIRDS_EYE_VIEW_INSET, yy, size.x-(2*BIRDS_EYE_VIEW_INSET),hh);
- }
- c= getColor(display, getStrokeColor(diff));
- if (c != null) {
- gc.setForeground(c);
- r.x= BIRDS_EYE_VIEW_INSET;
- r.y= yy;
- r.width= size.x-(2*BIRDS_EYE_VIEW_INSET)-1;
- r.height= hh;
- if (diff == fCurrentDiff ||
- (fCurrentDiff != null && diff == fCurrentDiff.fParent)) {
- gc.setLineWidth(2);
- r.x++;
- r.y++;
- r.width--;
- r.height--;
- } else {
- gc.setLineWidth(1);
- }
- gc.drawRectangle(r);
- }
- }
-
- y+= h;
- }
- }
- }
-
- private void refreshBirdsEyeView() {
- if (fBirdsEyeCanvas != null)
- fBirdsEyeCanvas.redraw();
- }
-
- /**
- * Called whenever setFocus() is called on the ContentViewer's top level SWT Composite.
- * This implementation sets the focus to the first enabled text widget.
- */
- /* package */ boolean internalSetFocus() {
- if (fFocusPart == null) {
- if (fLeft != null && fLeft.getEnabled()) {
- fFocusPart= fLeft;
- } else if (fRight != null && fRight.getEnabled()) {
- fFocusPart= fRight;
- } else if (fAncestor != null && fAncestor.getEnabled()) {
- fFocusPart= fAncestor;
- }
- }
- if (fFocusPart != null) {
- StyledText st= fFocusPart.getTextWidget();
- if (st != null)
- return st.setFocus();
- }
- return false; // could not set focus
- }
-
-
- class HoverResizer extends Resizer {
- Canvas fCanvas;
- public HoverResizer(Canvas c, int dir) {
- super(c, dir);
- fCanvas= c;
- }
- public void mouseMove(MouseEvent e) {
- if (!fIsDown && showResolveUI() && handleMouseMoveOverCenter(fCanvas, e.x, e.y))
- return;
- super.mouseMove(e);
- }
- }
-
- /**
- * Creates the central Canvas.
- * Called from ContentMergeViewer.
- */
- /* package */ Control createCenter(Composite parent) {
- if (fSynchronizedScrolling) {
- final Canvas canvas= new BufferedCanvas(parent, SWT.NONE) {
- public void doPaint(GC gc) {
- paintCenter(this, gc);
- }
- };
- if (!fUseResolveUI) {
- new Resizer(canvas, HORIZONTAL);
- } else {
-
- new HoverResizer(canvas, HORIZONTAL);
-
- fCenterButton= new Button(canvas, "carbon".equals(SWT.getPlatform()) ? SWT.FLAT : SWT.PUSH); //$NON-NLS-1$
- fCenterButton.setText("<"); //$NON-NLS-1$
- fCenterButton.pack();
- fCenterButton.setVisible(false);
- fCenterButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fCenterButton.setVisible(false);
- if (fButtonDiff != null) {
- setCurrentDiff(fButtonDiff, false);
- copy(fCurrentDiff, false, fCurrentDiff.fDirection == RangeDifference.CONFLICT);
- }
- }
- }
- );
- }
-
- return canvas;
- }
- return super.createCenter(parent);
- }
-
- private boolean handleMouseMoveOverCenter(Canvas canvas, int x, int y) {
- Rectangle r= new Rectangle(0, 0, 0, 0);
- Diff diff= getDiffUnderMouse(canvas, x, y, r);
- if (diff != null && !diff.isUnresolvedIncomingOrConflicting())
- diff= null;
- if (diff != fButtonDiff) {
- if (diff != null) {
- if (fLeft.isEditable()) {
- fButtonDiff= diff;
- fCenterButton.setText("<"); //$NON-NLS-1$
- String tt= fCopyDiffRightToLeftItem.getAction().getToolTipText();
- fCenterButton.setToolTipText(tt);
- fCenterButton.setBounds(r);
- fCenterButton.setVisible(true);
- } else if (fRight.isEditable()) {
- fButtonDiff= diff;
- fCenterButton.setText(">"); //$NON-NLS-1$
- String tt= fCopyDiffLeftToRightItem.getAction().getToolTipText();
- fCenterButton.setToolTipText(tt);
- fCenterButton.setBounds(r);
- fCenterButton.setVisible(true);
- } else
- fButtonDiff= null;
- } else {
- fCenterButton.setVisible(false);
- fButtonDiff= null;
- }
- }
- return fButtonDiff != null;
- }
-
- /**
- * Returns width of central canvas.
- * Overridden from ContentMergeViewer.
- */
- /* package */ int getCenterWidth() {
- if (fSynchronizedScrolling)
- return CENTER_WIDTH;
- return super.getCenterWidth();
- }
-
- /**
- * Creates and initializes a text part.
- */
- private MergeSourceViewer createPart(Composite parent) {
-
- final MergeSourceViewer part= new MergeSourceViewer(parent, getResourceBundle());
- final StyledText te= part.getTextWidget();
-
- if (!fConfirmSave)
- part.hideSaveAction();
-
- te.addPaintListener(
- new PaintListener() {
- public void paintControl(PaintEvent e) {
- paint(e, part);
- }
- }
- );
- te.addKeyListener(
- new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleSelectionChanged(part);
- }
- }
- );
- te.addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- //syncViewport(part);
- handleSelectionChanged(part);
- }
- }
- );
-
- te.addFocusListener(
- new FocusAdapter() {
- public void focusGained(FocusEvent fe) {
- fFocusPart= part;
- connectGlobalActions(fFocusPart);
- }
- public void focusLost(FocusEvent fe) {
- connectGlobalActions(null);
- }
- }
- );
-
- part.addViewportListener(
- new IViewportListener() {
- public void viewportChanged(int verticalPosition) {
- syncViewport(part);
- }
- }
- );
-
- Font font= JFaceResources.getFont(fSymbolicFontName);
- if (font != null)
- te.setFont(font);
-
- if (fBackground != null) // not default
- te.setBackground(getColor(parent.getDisplay(), fBackground));
-
- configureTextViewer(part);
-
- return part;
- }
-
- private void connectGlobalActions(MergeSourceViewer part) {
- IActionBars actionBars= Utilities.findActionBars(fComposite);
- if (actionBars != null) {
- for (int i= 0; i < GLOBAL_ACTIONS.length; i++) {
- IAction action= null;
- if (part != null) {
- action= part.getAction(TEXT_ACTIONS[i]);
- if (action == null && TEXT_ACTIONS[i].equals(MergeSourceViewer.SAVE_ID)) {
- if (part == fLeft)
- action= fLeftSaveAction;
- else
- action= fRightSaveAction;
- }
- }
- actionBars.setGlobalActionHandler(GLOBAL_ACTIONS[i], action);
- }
- actionBars.updateActionBars();
- }
- }
-
- ITypedElement getLeg(char type, Object input) {
- if (input instanceof ICompareInput) {
- switch (type) {
- case 'A':
- return ((ICompareInput)input).getAncestor();
- case 'L':
- return ((ICompareInput)input).getLeft();
- case 'R':
- return ((ICompareInput)input).getRight();
- }
- }
- return null;
- }
-
- IDocument getDocument(char type, Object input) {
- ITypedElement te= getLeg(type, input);
- if (te instanceof IDocument)
- return (IDocument) te;
- if (te instanceof IDocumentRange)
- return ((IDocumentRange) te).getDocument();
- if (te instanceof IStreamContentAccessor)
- return DocumentManager.get(te);
- return null;
- }
-
- IDocument getDocument2(char type, Object input) {
- IDocument doc= getDocument(type, input);
- if (doc != null)
- return doc;
-
- if (input instanceof IDiffElement) {
- IDiffContainer parent= ((IDiffElement)input).getParent();
- return getDocument(type, parent);
- }
- return null;
- }
-
- /**
- * Returns true if the given inputs map to the same documents
- */
- boolean sameDoc(char type, Object newInput, Object oldInput) {
- IDocument newDoc= getDocument2(type, newInput);
- IDocument oldDoc= getDocument2(type, oldInput);
- return newDoc == oldDoc;
- }
-
- /**
- * Overridden to prevent save confirmation if new input is sub document of current input.
- * @param newInput the new input of this viewer, or <code>null</code> if there is no new input
- * @param oldInput the old input element, or <code>null</code> if there was previously no input
- * @return <code>true</code> if saving was successful, or if the user didn't want to save (by pressing 'NO' in the confirmation dialog).
- * @since 2.0
- */
- protected boolean doSave(Object newInput, Object oldInput) {
-
- if (oldInput != null && newInput != null) {
- // check whether underlying documents have changed.
- if (sameDoc('A', newInput, oldInput) &&
- sameDoc('L', newInput, oldInput) &&
- sameDoc('R', newInput, oldInput)) {
- if (DEBUG) System.out.println("----- Same docs !!!!"); //$NON-NLS-1$
- return false;
- }
- }
-
- if (DEBUG) System.out.println("***** New docs !!!!"); //$NON-NLS-1$
-
- IDocument aDoc= getDocument2('A', oldInput);
- DocumentManager.remove(aDoc);
- IDocument lDoc= getDocument2('L', oldInput);
- DocumentManager.remove(lDoc);
- IDocument rDoc= getDocument2('R', oldInput);
- DocumentManager.remove(rDoc);
-
- if (DEBUG)
- DocumentManager.dump();
-
- return super.doSave(newInput, oldInput);
- }
-
- private ITypedElement getParent(char type) {
- Object input= getInput();
- if (input instanceof IDiffElement) {
- IDiffContainer parent= ((IDiffElement)input).getParent();
- return getLeg(type, parent);
- }
- return null;
- }
-
- /**
- * Initializes the text viewers of the three content areas with the given input objects.
- * Subclasses may extend.
- */
- protected void updateContent(Object ancestor, Object left, Object right) {
-
- boolean emptyInput= (ancestor == null && left == null && right == null);
-
- int n= 0;
- if (left != null)
- n++;
- if (right != null)
- n++;
- fHiglightRanges= n > 1;
-
- // clear stuff
- fCurrentDiff= null;
- fChangeDiffs= null;
- fAllDiffs= null;
- fEndOfDocReached= false;
-
- CompareConfiguration cc= getCompareConfiguration();
- IMergeViewerContentProvider cp= getMergeContentProvider();
-
- boolean rightEditable= cc.isRightEditable() && cp.isRightEditable(getInput());
- boolean leftEditable= cc.isLeftEditable() && cp.isLeftEditable(getInput());
-
- fRight.setEditable(rightEditable);
- fLeft.setEditable(leftEditable);
-
- // set new documents
- setDocument(fLeft, 'L', left);
- fLeftLineCount= fLeft.getLineCount();
- setDocument(fRight, 'R', right);
- fRightLineCount= fRight.getLineCount();
-
- setDocument(fAncestor, 'A', ancestor);
-
- doDiff();
-
- invalidateLines();
- updateVScrollBar();
- refreshBirdsEyeView();
-
- if (!emptyInput && !fComposite.isDisposed()) {
- if (true) { // see #13844
- selectFirstDiff();
- } else {
- // delay so that StyledText widget gets a chance to resize itself
- // (otherwise selectFirstDiff would not know its visible area)
- fComposite.getDisplay().asyncExec(
- new Runnable() {
- public void run() {
- selectFirstDiff();
- }
- }
- );
- }
- }
- }
-
- private void updateDiffBackground(Diff diff) {
-
- if (! fHiglightRanges)
- return;
-
- if (diff == null || diff.fIsToken)
- return;
-
- if (fShowCurrentOnly && !isCurrentDiff(diff))
- return;
-
- Color c= getColor(null, getFillColor(diff));
- if (c == null)
- return;
-
- if (isThreeWay())
- fAncestor.setLineBackground(diff.fAncestorPos, c);
- fLeft.setLineBackground(diff.fLeftPos, c);
- fRight.setLineBackground(diff.fRightPos, c);
- }
-
- private void updateAllDiffBackgrounds(Display display) {
- if (fChangeDiffs != null) {
- boolean threeWay= isThreeWay();
- Iterator iter= fChangeDiffs.iterator();
- while (iter.hasNext()) {
- Diff diff= (Diff) iter.next();
- Color c= getColor(display, getFillColor(diff));
- if (threeWay)
- fAncestor.setLineBackground(diff.fAncestorPos, c);
- fLeft.setLineBackground(diff.fLeftPos, c);
- fRight.setLineBackground(diff.fRightPos, c);
- }
- }
- }
-
- boolean isCurrentDiff(Diff diff) {
- if (diff == null)
- return false;
- if (diff == fCurrentDiff)
- return true;
- if (fCurrentDiff != null && fCurrentDiff.fParent == diff)
- return true;
- return false;
- }
-
- /**
- * Called whenver one of the documents changes.
- * Sets the dirty state of this viewer and updates the lines.
- * Implements IDocumentListener.
- */
- private void documentChanged(DocumentEvent e) {
-
- IDocument doc= e.getDocument();
-
- if (doc == fLeft.getDocument()) {
- setLeftDirty(true);
- } else if (doc == fRight.getDocument()) {
- setRightDirty(true);
- }
-
- updateLines(doc);
- }
-
-// private static ITypedElement getLeg(ICompareInput input, char type) {
-// switch (type) {
-// case 'A':
-// return input.getAncestor();
-// case 'L':
-// return input.getLeft();
-// case 'R':
-// return input.getRight();
-// }
-// return null;
-// }
-
- /**
- * This method is called if a range of text on one side is copied into an empty subdocument
- * on the other side. The method returns the position where the subdocument is placed into the base document.
- * This default implementation determines the position by using the text range differencer.
- * However this position is not always optimal for specific types of text.
- * So subclasses (which are awrae of the type of text they are dealing with)
- * may override this method to find a better position where to insert a newly added
- * piece of text.
- * @param type the side for which the insertion position should be determined: 'A' for ancestor, 'L' for left hand side, 'R' for right hand side.
- * @param input the current input object of this viewer
- * @since 2.0
- */
- protected int findInsertionPosition(char type, ICompareInput input) {
-
- ITypedElement other= null;
- char otherType= 0;
-
- switch (type) {
- case 'A':
- other= input.getLeft();
- otherType= 'L';
- if (other == null) {
- other= input.getRight();
- otherType= 'R';
- }
- break;
- case 'L':
- other= input.getRight();
- otherType= 'R';
- if (other == null) {
- other= input.getAncestor();
- otherType= 'A';
- }
- break;
- case 'R':
- other= input.getLeft();
- otherType= 'L';
- if (other == null) {
- other= input.getAncestor();
- otherType= 'A';
- }
- break;
- }
-
- if (other instanceof IDocumentRange) {
- IDocumentRange dr= (IDocumentRange) other;
- Position p= dr.getRange();
- Diff diff= findDiff(otherType, p.offset);
- if (diff != null) {
- switch (type) {
- case 'A':
- if (diff.fAncestorPos != null)
- return diff.fAncestorPos.offset;
- break;
- case 'L':
- if (diff.fLeftPos != null)
- return diff.fLeftPos.offset;
- break;
- case 'R':
- if (diff.fRightPos != null)
- return diff.fRightPos.offset;
- break;
- }
- }
- }
- return 0;
- }
-
- /**
- * Returns true if a new Document could be installed.
- */
- private boolean setDocument(MergeSourceViewer tp, char type, Object o) {
-
- if (tp == null)
- return false;
-
- IDocument newDoc= null;
- Position range= null;
-
- if (o instanceof IDocumentRange) {
- newDoc= ((IDocumentRange)o).getDocument();
- range= ((IDocumentRange)o).getRange();
-
- } else if (o instanceof IDocument) {
- newDoc= (IDocument) o;
-
- } else if (o instanceof IStreamContentAccessor) {
-
- newDoc= DocumentManager.get(o);
- if (newDoc == null) {
- IStreamContentAccessor sca= (IStreamContentAccessor) o;
- String s= null;
-
- try {
- s= Utilities.readString(sca);
- } catch (CoreException ex) {
- // NeedWork
- }
-
- newDoc= new Document(s != null ? s : ""); //$NON-NLS-1$
- DocumentManager.put(o, newDoc);
- IDocumentPartitioner partitioner= getDocumentPartitioner();
- if (partitioner != null) {
- newDoc.setDocumentPartitioner(partitioner);
- partitioner.connect(newDoc);
- }
- }
- } else if (o == null) { // deletion on one side
-
- ITypedElement parent= getParent(type); // we try to find an insertion position within the deletion's parent
-
- if (parent instanceof IDocumentRange) {
- newDoc= ((IDocumentRange)parent).getDocument();
- newDoc.addPositionCategory(IDocumentRange.RANGE_CATEGORY);
- Object input= getInput();
- range= getNewRange(type, input);
- if (range == null) {
- int pos= 0;
- if (input instanceof ICompareInput)
- pos= findInsertionPosition(type, (ICompareInput)input);
- range= new Position(pos, 0);
- try {
- newDoc.addPosition(IDocumentRange.RANGE_CATEGORY, range);
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- if (DEBUG) System.out.println("BadPositionCategoryException: " + ex); //$NON-NLS-1$
- } catch (BadLocationException ex) {
- // silently ignored
- if (DEBUG) System.out.println("BadLocationException: " + ex); //$NON-NLS-1$
- }
- addNewRange(type, input, range);
- }
- } else if (parent instanceof IDocument) {
- newDoc= ((IDocumentRange)o).getDocument();
- }
- }
-
- boolean enabled= true;
- if (newDoc == null) {
- //System.out.println("setDocument: create new Document");
- newDoc= new Document(""); //$NON-NLS-1$
- enabled= false;
- }
-
- IDocument oldDoc= tp.getDocument();
-
- if (newDoc != oldDoc) {
-
- // got a new document
-
- unsetDocument(tp);
-
- if (newDoc != null) {
- newDoc.addPositionCategory(IDocumentRange.RANGE_CATEGORY);
- if (fPositionUpdater == null)
- fPositionUpdater= new ChildPositionUpdater(IDocumentRange.RANGE_CATEGORY);
- else
- newDoc.removePositionUpdater(fPositionUpdater);
- newDoc.addPositionUpdater(fPositionUpdater);
- }
-
- // install new document
- if (newDoc != null) {
-
- tp.setRegion(range);
- if (fSubDoc) {
- if (range != null) {
- IRegion r= normalizeDocumentRegion(newDoc, toRegion(range));
- tp.setDocument(newDoc, r.getOffset(), r.getLength());
- } else
- tp.setDocument(newDoc);
- } else
- tp.setDocument(newDoc);
-
- newDoc.addDocumentListener(fDocumentListener);
- }
-
- } else { // same document but different range
-
- tp.setRegion(range);
- if (fSubDoc) {
- if (range != null) {
- IRegion r= normalizeDocumentRegion(newDoc, toRegion(range));
- tp.setVisibleRegion(r.getOffset(), r.getLength());
- } else
- tp.resetVisibleRegion();
- } else
- tp.resetVisibleRegion();
- }
-
- tp.setEnabled(enabled);
-
- return enabled;
- }
-
- private Position getNewRange(char type, Object input) {
- switch (type) {
- case 'A':
- return (Position) fNewAncestorRanges.get(input);
- case 'L':
- return (Position) fNewLeftRanges.get(input);
- case 'R':
- return (Position) fNewRightRanges.get(input);
- }
- return null;
- }
-
- private void addNewRange(char type, Object input, Position range) {
- switch (type) {
- case 'A':
- fNewAncestorRanges.put(input, range);
- break;
- case 'L':
- fNewLeftRanges.put(input, range);
- break;
- case 'R':
- fNewRightRanges.put(input, range);
- break;
- }
- }
-
- private void unsetDocument(MergeSourceViewer tp) {
- IDocument oldDoc= tp.getDocument();
- if (oldDoc != null) {
- // deinstall old positions
- if (fPositionUpdater != null)
- oldDoc.removePositionUpdater(fPositionUpdater);
- try {
- oldDoc.removePositionCategory(IDocumentRange.RANGE_CATEGORY);
- } catch (BadPositionCategoryException ex) {
- // NeedWork
- }
-
- oldDoc.removeDocumentListener(fDocumentListener);
- }
- }
-
- /**
- * Returns the contents of the underlying document as an array of bytes.
- *
- * @param left if <code>true</code> the contents of the left side is returned; otherwise the right side
- * @return the contents of the left or right document or null
- */
- protected byte[] getContents(boolean left) {
- MergeSourceViewer v= left ? fLeft : fRight;
- if (v != null) {
- IDocument d= v.getDocument();
- if (d != null) {
- String contents= d.get();
- if (contents != null) {
- byte[] bytes;
- try {
- bytes= contents.getBytes(ResourcesPlugin.getEncoding());
- } catch(UnsupportedEncodingException ex) {
- // use default encoding
- bytes= contents.getBytes();
- }
- return bytes;
- }
- }
- }
- return null;
- }
-
- private IRegion normalizeDocumentRegion(IDocument doc, IRegion region) {
-
- if (region == null || doc == null)
- return region;
-
- int maxLength= doc.getLength();
-
- int start= region.getOffset();
- if (start < 0)
- start= 0;
- else if (start > maxLength)
- start= maxLength;
-
- int length= region.getLength();
- if (length < 0)
- length= 0;
- else if (start + length > maxLength)
- length= maxLength - start;
-
- return new Region(start, length);
- }
-
- protected final void handleResizeAncestor(int x, int y, int width, int height) {
- if (width > 0) {
- Rectangle trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height;
- if (Utilities.okToUse(fAncestorCanvas))
- fAncestorCanvas.setVisible(true);
- if (fAncestor.isControlOkToUse())
- fAncestor.getTextWidget().setVisible(true);
-
- if (fAncestorCanvas != null) {
- fAncestorCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- x+= fMarginWidth;
- width-= fMarginWidth;
- }
- fAncestor.getTextWidget().setBounds(x, y, width, height);
- } else {
- if (Utilities.okToUse(fAncestorCanvas))
- fAncestorCanvas.setVisible(false);
- if (fAncestor.isControlOkToUse()) {
- StyledText t= fAncestor.getTextWidget();
- t.setVisible(false);
- t.setBounds(0, 0, 0, 0);
- if (fFocusPart == fAncestor) {
- fFocusPart= fLeft;
- fFocusPart.getTextWidget().setFocus();
- }
- }
- }
- }
-
- /**
- * Lays out everything.
- */
- protected final void handleResizeLeftRight(int x, int y, int width1, int centerWidth, int width2, int height) {
-
- if (fBirdsEyeCanvas != null)
- width2-= BIRDS_EYE_VIEW_WIDTH;
-
- Rectangle trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height + trim.x;
-
- Composite composite= (Composite) getControl();
-
- int leftTextWidth= width1;
- if (fLeftCanvas != null) {
- fLeftCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- x+= fMarginWidth;
- leftTextWidth-= fMarginWidth;
- }
-
- fLeft.getTextWidget().setBounds(x, y, leftTextWidth, height);
- x+= leftTextWidth;
-
- if (fCenter == null || fCenter.isDisposed())
- fCenter= createCenter(composite);
- fCenter.setBounds(x, y, centerWidth, height-scrollbarHeight);
- x+= centerWidth;
-
- if (!fSynchronizedScrolling) { // canvas is to the left of text
- if (fRightCanvas != null) {
- fRightCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- fRightCanvas.redraw();
- x+= fMarginWidth;
- }
- // we draw the canvas to the left of the text widget
- }
-
- int scrollbarWidth= 0;
- if (fSynchronizedScrolling && fScrollCanvas != null) {
- trim= fLeft.getTextWidget().computeTrim(0, 0, 0, 0);
- scrollbarWidth= trim.width + 2*trim.x;
- }
- int rightTextWidth= width2-scrollbarWidth;
- if (fRightCanvas != null)
- rightTextWidth-= fMarginWidth;
- fRight.getTextWidget().setBounds(x, y, rightTextWidth, height);
- x+= rightTextWidth;
-
- if (fSynchronizedScrolling) {
- if (fRightCanvas != null) { // canvas is to the right of the text
- fRightCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
- x+= fMarginWidth;
- }
- if (fScrollCanvas != null)
- fScrollCanvas.setBounds(x, y, scrollbarWidth, height-scrollbarHeight);
- }
-
- if (fBirdsEyeCanvas != null) {
- int verticalScrollbarButtonHeight= scrollbarWidth;
- int horizontalScrollbarButtonHeight= scrollbarHeight;
- if (fIsCarbon) {
- verticalScrollbarButtonHeight+= 2;
- horizontalScrollbarButtonHeight= 18;
- }
- if (fSummaryHeader != null)
- fSummaryHeader.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, verticalScrollbarButtonHeight);
- y+= verticalScrollbarButtonHeight;
- fBirdsEyeCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, height-(2*verticalScrollbarButtonHeight+horizontalScrollbarButtonHeight));
- }
-
- // doesn't work since TextEditors don't have their correct size yet.
- updateVScrollBar();
- refreshBirdsEyeView();
- }
-
- /**
- * Track selection changes to update the current Diff.
- */
- private void handleSelectionChanged(MergeSourceViewer tw) {
- Point p= tw.getSelectedRange();
- Diff d= findDiff(tw, p.x, p.x+p.y);
- updateStatus(d);
- setCurrentDiff(d, false); // don't select or reveal
- }
-
- private static IRegion toRegion(Position position) {
- if (position != null)
- return new Region(position.getOffset(), position.getLength());
- return null;
- }
-
- //---- the differencing
-
- private static int maxWork(IRangeComparator a, IRangeComparator l, IRangeComparator r) {
- int ln= l.getRangeCount();
- int rn= r.getRangeCount();
- if (a != null) {
- int an= a.getRangeCount();
- return (2 * Math.max(an, ln)) + (2 * Math.max(an, rn));
- }
- return 2 * Math.max(ln, rn);
- }
-
- /**
- * Perform a two level 2- or 3-way diff.
- * The first level is based on line comparison, the second level on token comparison.
- */
- private void doDiff() {
-
- fAllDiffs= new ArrayList();
- fChangeDiffs= new ArrayList();
- fCurrentDiff= null;
-
- IDocument aDoc= null;
- IDocument lDoc= fLeft.getDocument();
- IDocument rDoc= fRight.getDocument();
- if (lDoc == null || rDoc == null)
- return;
-
- Position aRegion= null;
- Position lRegion= fLeft.getRegion();
- Position rRegion= fRight.getRegion();
-
- boolean threeWay= isThreeWay();
-
- if (threeWay && !fIgnoreAncestor) {
- aDoc= fAncestor.getDocument();
- aRegion= fAncestor.getRegion();
- }
-
- fAncestor.resetLineBackground();
- fLeft.resetLineBackground();
- fRight.resetLineBackground();
-
- boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false);
-
- DocLineComparator sright= new DocLineComparator(rDoc, toRegion(rRegion), ignoreWhiteSpace);
- DocLineComparator sleft= new DocLineComparator(lDoc, toRegion(lRegion), ignoreWhiteSpace);
- DocLineComparator sancestor= null;
- if (aDoc != null)
- sancestor= new DocLineComparator(aDoc, toRegion(aRegion), ignoreWhiteSpace);
-
- if (!fSubDoc && rRegion != null && lRegion != null) {
- // we have to add a diff for the ignored lines
-
- int astart= 0;
- int as= 0;
- if (aRegion != null) {
- astart= aRegion.getOffset();
- as= Math.max(0, astart-1);
- }
- int ys= Math.max(0, lRegion.getOffset()-1);
- int ms= Math.max(0, rRegion.getOffset()-1);
-
- if (as > 0 || ys > 0 || ms > 0) {
- Diff diff= new Diff(null, RangeDifference.NOCHANGE,
- aDoc, aRegion, 0, astart,
- lDoc, lRegion, 0, lRegion.getOffset(),
- rDoc, rRegion, 0, rRegion.getOffset());
- fAllDiffs.add(diff);
- }
- }
-
- final ResourceBundle bundle= getResourceBundle();
-
- final Object[] result= new Object[1];
- final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- String progressTitle= Utilities.getString(bundle, "compareProgressTask.title"); //$NON-NLS-1$
- monitor.beginTask(progressTitle, maxWork(sa, sl, sr));
- try {
- result[0]= RangeDifferencer.findRanges(monitor, sa, sl, sr);
- } catch (OutOfMemoryError ex) {
- System.gc();
- throw new InvocationTargetException(ex);
- }
- if (monitor.isCanceled()) { // cancelled
- throw new InterruptedException();
- }
- monitor.done();
- }
- };
-
- RangeDifference[] e= null;
- try {
- TimeoutContext.run(true, TIMEOUT, getControl().getShell(), runnable);
- e= (RangeDifference[]) result[0];
- } catch (InvocationTargetException ex) {
- String title= Utilities.getString(bundle, "tooComplexError.title"); //$NON-NLS-1$
- String format= Utilities.getString(bundle, "tooComplexError.format"); //$NON-NLS-1$
- String msg= MessageFormat.format(format, new Object[] { Integer.toString(TIMEOUT/1000) } );
- MessageDialog.openError(fComposite.getShell(), title, msg);
- e= null;
- } catch (InterruptedException ex) {
- //
- }
-
- if (e == null) {
- // we create a NOCHANGE range for the whole document
- Diff diff= new Diff(null, RangeDifference.NOCHANGE,
- aDoc, aRegion, 0, aDoc != null ? aDoc.getLength() : 0,
- lDoc, lRegion, 0, lDoc.getLength(),
- rDoc, rRegion, 0, rDoc.getLength());
-
- fAllDiffs.add(diff);
- } else {
- for (int i= 0; i < e.length; i++) {
- String a= null, s= null, d= null;
- RangeDifference es= e[i];
-
- int kind= es.kind();
-
- int ancestorStart= 0;
- int ancestorEnd= 0;
- if (sancestor != null) {
- ancestorStart= sancestor.getTokenStart(es.ancestorStart());
- ancestorEnd= getTokenEnd2(sancestor, es.ancestorStart(), es.ancestorLength());
- }
-
- int leftStart= sleft.getTokenStart(es.leftStart());
- int leftEnd= getTokenEnd2(sleft, es.leftStart(), es.leftLength());
-
- int rightStart= sright.getTokenStart(es.rightStart());
- int rightEnd= getTokenEnd2(sright, es.rightStart(), es.rightLength());
-
- Diff diff= new Diff(null, kind,
- aDoc, aRegion, ancestorStart, ancestorEnd,
- lDoc, lRegion, leftStart, leftEnd,
- rDoc, rRegion, rightStart, rightEnd);
-
- fAllDiffs.add(diff); // remember all range diffs for scrolling
-
- if (ignoreWhiteSpace) {
- if (sancestor != null)
- a= extract2(aDoc, sancestor, es.ancestorStart(), es.ancestorLength());
- s= extract2(lDoc, sleft, es.leftStart(), es.leftLength());
- d= extract2(rDoc, sright, es.rightStart(), es.rightLength());
-
- if ((a == null || a.trim().length() == 0) && s.trim().length() == 0 && d.trim().length() == 0) {
- diff.fIsWhitespace= true;
- continue;
- }
- }
-
- if (useChange(kind)) {
- fChangeDiffs.add(diff); // here we remember only the real diffs
- updateDiffBackground(diff);
-
- if (s == null)
- s= extract2(lDoc, sleft, es.leftStart(), es.leftLength());
- if (d == null)
- d= extract2(rDoc, sright, es.rightStart(), es.rightLength());
-
- if (s.length() > 0 && d.length() > 0) {
- if (a == null && sancestor != null)
- a= extract2(aDoc, sancestor, es.ancestorStart(), es.ancestorLength());
- if (USE_MERGING_TOKEN_DIFF)
- mergingTokenDiff(diff, aDoc, a, rDoc, d, lDoc, s);
- else
- simpleTokenDiff(diff, aDoc, a, rDoc, d, lDoc, s);
- }
- }
- }
- }
-
- if (!fSubDoc && rRegion != null && lRegion != null) {
- // we have to add a diff for the ignored lines
-
- int aEnd= 0;
- int aLen= 0;
- if (aRegion != null && aDoc != null) {
- aEnd= aRegion.getOffset()+aRegion.getLength();
- aLen= aDoc.getLength();
- }
- Diff diff= new Diff(null, RangeDifference.NOCHANGE,
- aDoc, aRegion, aEnd, aLen,
- lDoc, lRegion, lRegion.getOffset()+lRegion.getLength(), lDoc.getLength(),
- rDoc, rRegion, rRegion.getOffset()+rRegion.getLength(), rDoc.getLength());
- fAllDiffs.add(diff);
- }
- }
-
- private Diff findDiff(char type, int pos) {
-
- IDocument aDoc= null;
- IDocument lDoc= fLeft.getDocument();
- IDocument rDoc= fRight.getDocument();
- if (lDoc == null || rDoc == null)
- return null;
-
- Position aRegion= null;
- Position lRegion= null;
- Position rRegion= null;
-
- boolean threeWay= isThreeWay();
-
- if (threeWay && !fIgnoreAncestor)
- aDoc= fAncestor.getDocument();
-
- boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false);
-
- DocLineComparator sright= new DocLineComparator(rDoc, toRegion(rRegion), ignoreWhiteSpace);
- DocLineComparator sleft= new DocLineComparator(lDoc, toRegion(lRegion), ignoreWhiteSpace);
- DocLineComparator sancestor= null;
- if (aDoc != null)
- sancestor= new DocLineComparator(aDoc, toRegion(aRegion), ignoreWhiteSpace);
-
- final ResourceBundle bundle= getResourceBundle();
-
- final Object[] result= new Object[1];
- final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- String progressTitle= Utilities.getString(bundle, "compareProgressTask.title"); //$NON-NLS-1$
- monitor.beginTask(progressTitle, maxWork(sa, sl, sr));
- try {
- result[0]= RangeDifferencer.findRanges(monitor, sa, sl, sr);
- } catch (OutOfMemoryError ex) {
- System.gc();
- throw new InvocationTargetException(ex);
- }
- if (monitor.isCanceled()) { // cancelled
- throw new InterruptedException();
- }
- monitor.done();
- }
- };
-
- RangeDifference[] e= null;
- try {
- TimeoutContext.run(true, TIMEOUT, getControl().getShell(), runnable);
- e= (RangeDifference[]) result[0];
- } catch (InvocationTargetException ex) {
- String title= Utilities.getString(bundle, "tooComplexError.title"); //$NON-NLS-1$
- String format= Utilities.getString(bundle, "tooComplexError.format"); //$NON-NLS-1$
- String msg= MessageFormat.format(format, new Object[] { Integer.toString(TIMEOUT/1000) } );
- MessageDialog.openError(fComposite.getShell(), title, msg);
- e= null;
- } catch (InterruptedException ex) {
- //
- }
-
- if (e != null) {
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
-
- int kind= es.kind();
-
- int ancestorStart= 0;
- int ancestorEnd= 0;
- if (sancestor != null) {
- ancestorStart= sancestor.getTokenStart(es.ancestorStart());
- ancestorEnd= getTokenEnd2(sancestor, es.ancestorStart(), es.ancestorLength());
- }
-
- int leftStart= sleft.getTokenStart(es.leftStart());
- int leftEnd= getTokenEnd2(sleft, es.leftStart(), es.leftLength());
-
- int rightStart= sright.getTokenStart(es.rightStart());
- int rightEnd= getTokenEnd2(sright, es.rightStart(), es.rightLength());
-
- Diff diff= new Diff(null, kind,
- aDoc, aRegion, ancestorStart, ancestorEnd,
- lDoc, lRegion, leftStart, leftEnd,
- rDoc, rRegion, rightStart, rightEnd);
-
- if (diff.isInRange(type, pos))
- return diff;
- }
- }
-
- return null;
- }
-
- /**
- * Returns true if kind of change should be shown.
- */
- private boolean useChange(int kind) {
- if (kind == RangeDifference.NOCHANGE)
- return false;
- if (kind == RangeDifference.ANCESTOR)
- return fShowPseudoConflicts;
- return true;
- }
-
- private int getTokenEnd(ITokenComparator tc, int start, int count) {
- if (count <= 0)
- return tc.getTokenStart(start);
- int index= start + count - 1;
- return tc.getTokenStart(index) + tc.getTokenLength(index);
- }
-
- private static int getTokenEnd2(ITokenComparator tc, int start, int length) {
- return tc.getTokenStart(start + length);
- }
-
- /**
- * Returns the content of lines in the specified range as a String.
- * This includes the line separators.
- *
- * @param doc the document from which to extract the characters
- * @param start index of first line
- * @param length number of lines
- * @return the contents of the specified line range as a String
- */
- private String extract2(IDocument doc, ITokenComparator tc, int start, int length) {
- int count= tc.getRangeCount();
- if (length > 0 && count > 0) {
-
-//
-// int startPos= tc.getTokenStart(start);
-// int endPos= startPos;
-//
-// if (length > 1)
-// endPos= tc.getTokenStart(start + (length-1));
-// endPos+= tc.getTokenLength(start + (length-1));
-//
-
- int startPos= tc.getTokenStart(start);
- int endPos;
-
- if (length == 1) {
- endPos= startPos + tc.getTokenLength(start);
- } else {
- endPos= tc.getTokenStart(start + length);
- }
-
- try {
- return doc.get(startPos, endPos - startPos);
- } catch (BadLocationException e) {
- // silently ignored
- }
-
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Performs a token based 3-way diff on the character range specified by the given baseDiff.
- */
- private void simpleTokenDiff(final Diff baseDiff,
- IDocument ancestorDoc, String a,
- IDocument rightDoc, String d,
- IDocument leftDoc, String s) {
-
- int ancestorStart= 0;
- ITokenComparator sa= null;
- if (ancestorDoc != null) {
- ancestorStart= baseDiff.fAncestorPos.getOffset();
- sa= createTokenComparator(a);
- }
-
- int rightStart= baseDiff.fRightPos.getOffset();
- ITokenComparator sm= createTokenComparator(d);
-
- int leftStart= baseDiff.fLeftPos.getOffset();
- ITokenComparator sy= createTokenComparator(s);
-
- RangeDifference[] e= RangeDifferencer.findRanges(sa, sy, sm);
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
- int kind= es.kind();
- if (kind != RangeDifference.NOCHANGE) {
-
- int ancestorStart2= ancestorStart;
- int ancestorEnd2= ancestorStart;
- if (ancestorDoc != null) {
- ancestorStart2 += sa.getTokenStart(es.ancestorStart());
- ancestorEnd2 += getTokenEnd(sa, es.ancestorStart(), es.ancestorLength());
- }
-
- int leftStart2= leftStart + sy.getTokenStart(es.leftStart());
- int leftEnd2= leftStart + getTokenEnd(sy, es.leftStart(), es.leftLength());
-
- int rightStart2= rightStart + sm.getTokenStart(es.rightStart());
- int rightEnd2= rightStart + getTokenEnd(sm, es.rightStart(), es.rightLength());
-
- Diff diff= new Diff(baseDiff, kind,
- ancestorDoc, null, ancestorStart2, ancestorEnd2,
- leftDoc, null, leftStart2, leftEnd2,
- rightDoc, null, rightStart2, rightEnd2);
-
- // ensure that token diff is smaller than basediff
- int leftS= baseDiff.fLeftPos.offset;
- int leftE= baseDiff.fLeftPos.offset+baseDiff.fLeftPos.length;
- int rightS= baseDiff.fRightPos.offset;
- int rightE= baseDiff.fRightPos.offset+baseDiff.fRightPos.length;
- if (leftS != leftStart2 || leftE != leftEnd2 ||
- rightS != rightStart2 || rightE != rightEnd2) {
- diff.fIsToken= true;
- // add to base Diff
- baseDiff.add(diff);
- }
- }
- }
- }
-
- /**
- * Performs a "smart" token based 3-way diff on the character range specified by the given baseDiff.
- * It is "smart" because it tries to minimize the number of token diffs by merging them.
- */
- private void mergingTokenDiff(Diff baseDiff,
- IDocument ancestorDoc, String a,
- IDocument rightDoc, String d,
- IDocument leftDoc, String s) {
- ITokenComparator sa= null;
- int ancestorStart= 0;
- if (ancestorDoc != null) {
- sa= createTokenComparator(a);
- ancestorStart= baseDiff.fAncestorPos.getOffset();
- }
-
- int rightStart= baseDiff.fRightPos.getOffset();
- ITokenComparator sm= createTokenComparator(d);
-
- int leftStart= baseDiff.fLeftPos.getOffset();
- ITokenComparator sy= createTokenComparator(s);
-
- RangeDifference[] r= RangeDifferencer.findRanges(sa, sy, sm);
- for (int i= 0; i < r.length; i++) {
- RangeDifference es= r[i];
- // determine range of diffs in one line
- int start= i;
- int leftLine= -1;
- int rightLine= -1;
- try {
- leftLine= leftDoc.getLineOfOffset(leftStart+sy.getTokenStart(es.leftStart()));
- rightLine= rightDoc.getLineOfOffset(rightStart+sm.getTokenStart(es.rightStart()));
- } catch (BadLocationException e) {
- // silently ignored
- }
- i++;
- for (; i < r.length; i++) {
- es= r[i];
- try {
- if (leftLine != leftDoc.getLineOfOffset(leftStart+sy.getTokenStart(es.leftStart())))
- break;
- if (rightLine != rightDoc.getLineOfOffset(rightStart+sm.getTokenStart(es.rightStart())))
- break;
- } catch (BadLocationException e) {
- // silently ignored
- }
- }
- int end= i;
-
- // find first diff from left
- RangeDifference first= null;
- for (int ii= start; ii < end; ii++) {
- es= r[ii];
- if (useChange(es.kind())) {
- first= es;
- break;
- }
- }
-
- // find first diff from mine
- RangeDifference last= null;
- for (int ii= end-1; ii >= start; ii--) {
- es= r[ii];
- if (useChange(es.kind())) {
- last= es;
- break;
- }
- }
-
- if (first != null && last != null) {
-
- int ancestorStart2= 0;
- int ancestorEnd2= 0;
- if (ancestorDoc != null) {
- ancestorStart2= ancestorStart+sa.getTokenStart(first.ancestorStart());
- ancestorEnd2= ancestorStart+getTokenEnd(sa, last.ancestorStart(), last.ancestorLength());
- }
-
- int leftStart2= leftStart+sy.getTokenStart(first.leftStart());
- int leftEnd2= leftStart+getTokenEnd(sy, last.leftStart(), last.leftLength());
-
- int rightStart2= rightStart+sm.getTokenStart(first.rightStart());
- int rightEnd2= rightStart+getTokenEnd(sm, last.rightStart(), last.rightLength());
- Diff diff= new Diff(baseDiff, first.kind(),
- ancestorDoc, null, ancestorStart2, ancestorEnd2+1,
- leftDoc, null, leftStart2, leftEnd2+1,
- rightDoc, null, rightStart2, rightEnd2+1);
- diff.fIsToken= true;
- baseDiff.add(diff);
- }
- }
- }
-
- //---- update UI stuff
-
- private void updateControls() {
-
- boolean leftToRight= false;
- boolean rightToLeft= false;
-
- updateStatus(fCurrentDiff);
- updateResolveStatus();
-
- if (fCurrentDiff != null) {
- IMergeViewerContentProvider cp= getMergeContentProvider();
- if (cp != null) {
- rightToLeft= cp.isLeftEditable(getInput());
- leftToRight= cp.isRightEditable(getInput());
- }
- }
-
- if (fDirectionLabel != null) {
- if (fHiglightRanges && fCurrentDiff != null && isThreeWay() && !fIgnoreAncestor) {
- fDirectionLabel.setImage(fCurrentDiff.getImage());
- } else {
- fDirectionLabel.setImage(null);
- }
- }
-
- if (fCopyDiffLeftToRightItem != null)
- ((Action)fCopyDiffLeftToRightItem.getAction()).setEnabled(leftToRight);
- if (fCopyDiffRightToLeftItem != null)
- ((Action)fCopyDiffRightToLeftItem.getAction()).setEnabled(rightToLeft);
-
- boolean enableNavigation= false;
- if (fCurrentDiff == null && fChangeDiffs != null && fChangeDiffs.size() > 0)
- enableNavigation= true;
- else if (fChangeDiffs != null && fChangeDiffs.size() > 1)
- enableNavigation= true;
- else if (fCurrentDiff != null && fCurrentDiff.fDiffs != null)
- enableNavigation= true;
- else if (fCurrentDiff != null && fCurrentDiff.fIsToken)
- enableNavigation= true;
-
- if (fNextItem != null) {
- IAction a= fNextItem.getAction();
- a.setEnabled(enableNavigation);
- }
- if (fPreviousItem != null) {
- IAction a= fPreviousItem.getAction();
- a.setEnabled(enableNavigation);
- }
- }
-
- private void updateResolveStatus() {
-
- RGB rgb= null;
-
- if (showResolveUI()) {
- // we only show red or green if there is at least one incoming or conflicting change
- int incomingOrConflicting= 0;
- int unresolvedIncoming= 0;
- int unresolvedConflicting= 0;
-
- if (fChangeDiffs != null) {
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff d= (Diff) e.next();
- if (d.isIncomingOrConflicting() /* && useChange(d.fDirection) && !d.fIsWhitespace */) {
- incomingOrConflicting++;
- if (!d.fResolved) {
- if (d.fDirection == RangeDifference.CONFLICT) {
- unresolvedConflicting++;
- break; // we can stop here because a conflict has the maximum priority
- } else {
- unresolvedIncoming++;
- }
- }
- }
- }
- }
-
- if (incomingOrConflicting > 0) {
- if (unresolvedConflicting > 0)
- rgb= SELECTED_CONFLICT;
- else if (unresolvedIncoming > 0)
- rgb= SELECTED_INCOMING;
- else
- rgb= RESOLVED;
- }
- }
-
- if (fHeaderPainter.setColor(rgb))
- fSummaryHeader.redraw();
- }
-
- private void updateStatus(Diff diff) {
-
- if (! fShowMoreInfo)
- return;
-
- IActionBars bars= Utilities.findActionBars(fComposite);
- if (bars == null)
- return;
- IStatusLineManager slm= bars.getStatusLineManager();
- if (slm == null)
- return;
-
- String diffDescription;
-
- if (diff == null) {
- diffDescription= CompareMessages.getString("TextMergeViewer.diffDescription.noDiff.format"); //$NON-NLS-1$
- } else {
-
- if (diff.fIsToken) // we don't show special info for token diffs
- diff= diff.fParent;
-
- String format= CompareMessages.getString("TextMergeViewer.diffDescription.diff.format"); //$NON-NLS-1$
- diffDescription= MessageFormat.format(format,
- new String[] {
- getDiffType(diff), // 0: diff type
- getDiffNumber(diff), // 1: diff number
- getDiffRange(fLeft, diff.fLeftPos), // 2: left start line
- getDiffRange(fRight, diff.fRightPos) // 3: left end line
- }
- );
- }
-
- String format= CompareMessages.getString("TextMergeViewer.statusLine.format"); //$NON-NLS-1$
- String s= MessageFormat.format(format,
- new String[] {
- getCursorPosition(fLeft), // 0: left column
- getCursorPosition(fRight), // 1: right column
- diffDescription // 2: diff description
- }
- );
-
- slm.setMessage(s);
- }
-
- private void clearStatus() {
-
- IActionBars bars= Utilities.findActionBars(fComposite);
- if (bars == null)
- return;
- IStatusLineManager slm= bars.getStatusLineManager();
- if (slm == null)
- return;
-
- slm.setMessage(null);
- }
-
- private String getDiffType(Diff diff) {
- String s= ""; //$NON-NLS-1$
- switch(diff.fDirection) {
- case RangeDifference.LEFT:
- s= CompareMessages.getString("TextMergeViewer.direction.outgoing"); //$NON-NLS-1$
- break;
- case RangeDifference.RIGHT:
- s= CompareMessages.getString("TextMergeViewer.direction.incoming"); //$NON-NLS-1$
- break;
- case RangeDifference.CONFLICT:
- s= CompareMessages.getString("TextMergeViewer.direction.conflicting"); //$NON-NLS-1$
- break;
- }
- String format= CompareMessages.getString("TextMergeViewer.diffType.format"); //$NON-NLS-1$
- return MessageFormat.format(format, new String[] { s, diff.changeType() } );
- }
-
- private String getDiffNumber(Diff diff) {
- // find the diff's number
- int diffNumber= 0;
- if (fChangeDiffs != null) {
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff d= (Diff) e.next();
- diffNumber++;
- if (d == diff)
- break;
- }
- }
- return Integer.toString(diffNumber);
- }
-
- private String getDiffRange(MergeSourceViewer v, Position pos) {
- Point p= v.getLineRange(pos, new Point(0, 0));
- int startLine= p.x+1;
- int endLine= p.x+p.y;
-
- String format;
- if (endLine < startLine)
- format= CompareMessages.getString("TextMergeViewer.beforeLine.format"); //$NON-NLS-1$
- else
- format= CompareMessages.getString("TextMergeViewer.range.format"); //$NON-NLS-1$
- return MessageFormat.format(format,
- new String[] { Integer.toString(startLine),
- Integer.toString(endLine) } );
- }
-
- /**
- * Returns a description of the cursor position.
- *
- * @return a description of the cursor position
- */
- private String getCursorPosition(MergeSourceViewer v) {
- if (v != null) {
- StyledText styledText= v.getTextWidget();
-
- IDocument document= v.getDocument();
- if (document != null) {
- int offset= v.getVisibleRegion().getOffset();
- int caret= offset + styledText.getCaretOffset();
-
- try {
-
- int line=document.getLineOfOffset(caret);
-
- int lineOffset= document.getLineOffset(line);
- int occurrences= 0;
- for (int i= lineOffset; i < caret; i++)
- if ('\t' == document.getChar(i))
- ++ occurrences;
-
- int tabWidth= styledText.getTabs();
- int column= caret - lineOffset + (tabWidth -1) * occurrences;
-
- String format= CompareMessages.getString("TextMergeViewer.cursorPosition.format"); //$NON-NLS-1$
- return MessageFormat.format(format,
- new String[] { Integer.toString(line + 1), Integer.toString(column + 1) } );
-
- } catch (BadLocationException x) {
- // silently ignored
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- protected void updateHeader() {
-
- super.updateHeader();
-
- updateControls();
- }
-
- /**
- * Creates the two items for copying a difference range from one side to the other
- * and adds them to the given toolbar manager.
- */
- protected void createToolItems(ToolBarManager tbm) {
-
- IWorkbenchPartSite ps= Utilities.findSite(fComposite);
- fKeyBindingService= ps != null ? ps.getKeyBindingService() : null;
-
- final String ignoreAncestorActionKey= "action.IgnoreAncestor."; //$NON-NLS-1$
- Action ignoreAncestorAction= new Action() {
- public void run() {
- setIgnoreAncestor(! fIgnoreAncestor);
- Utilities.initToggleAction(this, getResourceBundle(), ignoreAncestorActionKey, fIgnoreAncestor);
- }
- };
- ignoreAncestorAction.setChecked(fIgnoreAncestor);
- Utilities.initAction(ignoreAncestorAction, getResourceBundle(), ignoreAncestorActionKey);
- Utilities.initToggleAction(ignoreAncestorAction, getResourceBundle(), ignoreAncestorActionKey, fIgnoreAncestor);
-
- fIgnoreAncestorItem= new ActionContributionItem(ignoreAncestorAction);
- fIgnoreAncestorItem.setVisible(false);
- tbm.appendToGroup("modes", fIgnoreAncestorItem); //$NON-NLS-1$
-
- tbm.add(new Separator());
-
- Action a= new Action() {
- public void run() {
- navigate(true, true, true);
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.NextDiff."); //$NON-NLS-1$
- fNextItem= new ActionContributionItem(a);
- tbm.appendToGroup("navigation", fNextItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.selectNextChange"); //$NON-NLS-1$
-
- a= new Action() {
- public void run() {
- navigate(false, true, true);
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.PrevDiff."); //$NON-NLS-1$
- fPreviousItem= new ActionContributionItem(a);
- tbm.appendToGroup("navigation", fPreviousItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.selectPreviousChange"); //$NON-NLS-1$
-
-
- CompareConfiguration cc= getCompareConfiguration();
-
- if (cc.isRightEditable()) {
- a= new Action() {
- public void run() {
- copyDiffLeftToRight();
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.CopyDiffLeftToRight."); //$NON-NLS-1$
- fCopyDiffLeftToRightItem= new ActionContributionItem(a);
- fCopyDiffLeftToRightItem.setVisible(true);
- tbm.appendToGroup("merge", fCopyDiffLeftToRightItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.copyLeftToRight"); //$NON-NLS-1$
- }
-
- if (cc.isLeftEditable()) {
- a= new Action() {
- public void run() {
- copyDiffRightToLeft();
- }
- };
- Utilities.initAction(a, getResourceBundle(), "action.CopyDiffRightToLeft."); //$NON-NLS-1$
- fCopyDiffRightToLeftItem= new ActionContributionItem(a);
- fCopyDiffRightToLeftItem.setVisible(true);
- tbm.appendToGroup("merge", fCopyDiffRightToLeftItem); //$NON-NLS-1$
- Utilities.registerAction(fKeyBindingService, a, "org.eclipse.compare.copyRightToLeft"); //$NON-NLS-1$
- }
- }
-
- /* package */ void propertyChange(PropertyChangeEvent event) {
-
- String key= event.getProperty();
-
- if (key.equals(CompareConfiguration.IGNORE_WHITESPACE)
- || key.equals(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS)) {
-
- fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
-
- // clear stuff
- fCurrentDiff= null;
- fChangeDiffs= null;
- fAllDiffs= null;
-
- doDiff();
-
- updateControls();
- invalidateLines();
- updateVScrollBar();
- refreshBirdsEyeView();
-
- selectFirstDiff();
-
-// } else if (key.equals(ComparePreferencePage.USE_SPLINES)) {
-// fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
-// invalidateLines();
-
- } else if (key.equals(ComparePreferencePage.USE_SINGLE_LINE)) {
- fUseSingleLine= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
- fUseResolveUI= fUseSingleLine;
- fBasicCenterCurve= null;
- updateResolveStatus();
- invalidateLines();
-
-// } else if (key.equals(ComparePreferencePage.USE_RESOLVE_UI)) {
-// fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
-// updateResolveStatus();
-// invalidateLines();
-
- } else if (key.equals(fSymbolicFontName)) {
- updateFont();
- invalidateLines();
-
- } else if (key.equals(ComparePreferencePage.SYNCHRONIZE_SCROLLING)) {
-
- boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
- if (b != fSynchronizedScrolling)
- toggleSynchMode();
-
- } else if (key.equals(ComparePreferencePage.SHOW_MORE_INFO)) {
-
- boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_MORE_INFO);
- if (b != fShowMoreInfo) {
- fShowMoreInfo= b;
- if (fShowMoreInfo)
- updateStatus(fCurrentDiff);
- else
- clearStatus();
- }
-
- } else
- super.propertyChange(event);
- }
-
- private void setIgnoreAncestor(boolean ignore) {
- if (ignore != fIgnoreAncestor) {
- fIgnoreAncestor= ignore;
- setAncestorVisibility(false, !fIgnoreAncestor);
-
- // clear stuff
- fCurrentDiff= null;
- fChangeDiffs= null;
- fAllDiffs= null;
-
- doDiff();
-
- invalidateLines();
- updateVScrollBar();
- refreshBirdsEyeView();
-
- selectFirstDiff();
- }
- }
-
- private void selectFirstDiff() {
-
- if (fLeft == null || fRight == null) {
- return;
- }
- if (fLeft.getDocument() == null || fRight.getDocument() == null) {
- return;
- }
-
- Diff firstDiff= null;
- if (CompareNavigator.getDirection(fComposite))
- firstDiff= findNext(fRight, fChangeDiffs, -1, -1, false);
- else
- firstDiff= findPrev(fRight, fChangeDiffs, 9999999, 9999999, false);
- setCurrentDiff(firstDiff, true);
- }
-
- private void toggleSynchMode() {
- fSynchronizedScrolling= ! fSynchronizedScrolling;
-
- scrollVertical(0, 0, 0, null);
-
- // throw away central control (Sash or Canvas)
- Control center= getCenter();
- if (center != null && !center.isDisposed())
- center.dispose();
-
- fLeft.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
-
- fComposite.layout(true);
- }
-
- protected void updateToolItems() {
-
- if (fIgnoreAncestorItem != null)
- fIgnoreAncestorItem.setVisible(isThreeWay());
-
- super.updateToolItems();
- }
-
- //---- painting lines
-
- /**
- *
- */
- private void updateLines(IDocument d) {
-
- boolean left= false;
- boolean right= false;
-
- // FIXME: this optimization is incorrect because
- // it doesn't take replace operations into account where
- // the old and new line count does not differ
- if (d == fLeft.getDocument()) {
- int l= fLeft.getLineCount();
- left= fLeftLineCount != l;
- fLeftLineCount= l;
- } else if (d == fRight.getDocument()) {
- int l= fRight.getLineCount();
- right= fRightLineCount != l;
- fRightLineCount= l;
- }
-
- if (left || right) {
-
- if (left) {
- if (fLeftCanvas != null)
- fLeftCanvas.redraw();
- } else {
- if (fRightCanvas != null)
- fRightCanvas.redraw();
- }
- Control center= getCenter();
- if (center != null)
- center.redraw();
-
- updateVScrollBar();
- refreshBirdsEyeView();
- }
- }
-
- private void invalidateLines() {
- if (isThreeWay()) {
- if (Utilities.okToUse(fAncestorCanvas))
- fAncestorCanvas.redraw();
- if (fAncestor != null && fAncestor.isControlOkToUse())
- fAncestor.getTextWidget().redraw();
- }
-
- if (Utilities.okToUse(fLeftCanvas))
- fLeftCanvas.redraw();
-
- if (fLeft != null && fLeft.isControlOkToUse())
- fLeft.getTextWidget().redraw();
-
- if (Utilities.okToUse(getCenter()))
- getCenter().redraw();
-
- if (fRight != null && fRight.isControlOkToUse())
- fRight.getTextWidget().redraw();
-
- if (Utilities.okToUse(fRightCanvas))
- fRightCanvas.redraw();
- }
-
- private boolean showResolveUI() {
- if (!fUseResolveUI || !isThreeWay() || fIgnoreAncestor)
- return false;
- CompareConfiguration cc= getCompareConfiguration();
- if (cc == null)
- return false;
- // we only enable the new resolve ui if exactly one side is editable
- boolean l= cc.isLeftEditable();
- boolean r= cc.isRightEditable();
- //return (l && !r) || (r && !l);
- return l || r;
- }
-
- private void paintCenter(Canvas canvas, GC g) {
-
- Display display= canvas.getDisplay();
-
- checkForColorUpdate(display);
-
- if (! fSynchronizedScrolling)
- return;
-
- int lineHeight= fLeft.getTextWidget().getLineHeight();
- int visibleHeight= fRight.getViewportHeight();
-
- Point size= canvas.getSize();
- int x= 0;
- int w= size.x;
-
- g.setBackground(canvas.getBackground());
- g.fillRectangle(x+1, 0, w-2, size.y);
-
- if (!fIsMotif) {
- // draw thin line between center ruler and both texts
- g.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- g.fillRectangle(0, 0, 1, size.y);
- g.fillRectangle(w-1, 0, 1, size.y);
- }
-
- if (! fHiglightRanges)
- return;
-
- boolean showResolveUI= showResolveUI();
-
- if (fChangeDiffs != null) {
- int lshift= fLeft.getVerticalScrollOffset();
- int rshift= fRight.getVerticalScrollOffset();
-
- Point region= new Point(0, 0);
-
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- fLeft.getLineRange(diff.fLeftPos, region);
- int ly= (region.x * lineHeight) + lshift;
- int lh= region.y * lineHeight;
-
- fRight.getLineRange(diff.fRightPos, region);
- int ry= (region.x * lineHeight) + rshift;
- int rh= region.y * lineHeight;
-
- if (Math.max(ly+lh, ry+rh) < 0)
- continue;
- if (Math.min(ly, ry) >= visibleHeight)
- break;
-
- fPts[0]= x; fPts[1]= ly; fPts[2]= w; fPts[3]= ry;
- fPts[6]= x; fPts[7]= ly+lh; fPts[4]= w; fPts[5]= ry+rh;
-
- Color fillColor= getColor(display, getFillColor(diff));
- Color strokeColor= getColor(display, getStrokeColor(diff));
-
- if (fUseSingleLine) {
- int w2= 3;
-
- g.setBackground(fillColor);
- g.fillRectangle(0, ly, w2, lh); // left
- g.fillRectangle(w-w2, ry, w2, rh); // right
-
- g.setLineWidth(LW);
- g.setForeground(strokeColor);
- g.drawRectangle(0-1, ly, w2, lh); // left
- g.drawRectangle(w-w2, ry, w2, rh); // right
-
- if (fUseSplines) {
- int[] points= getCenterCurvePoints(w2, ly+lh/2, w-w2, ry+rh/2);
- for (int i= 1; i < points.length; i++)
- g.drawLine(w2+i-1, points[i-1], w2+i, points[i]);
- } else {
- g.drawLine(w2, ly+lh/2, w-w2, ry+rh/2);
- }
- } else {
- // two lines
- if (fUseSplines) {
- g.setBackground(fillColor);
-
- g.setLineWidth(LW);
- g.setForeground(strokeColor);
-
- int[] topPoints= getCenterCurvePoints(fPts[0], fPts[1], fPts[2], fPts[3]);
- int[] bottomPoints= getCenterCurvePoints(fPts[6], fPts[7], fPts[4], fPts[5]);
- g.setForeground(fillColor);
- g.drawLine(0, bottomPoints[0], 0, topPoints[0]);
- for (int i= 1; i < bottomPoints.length; i++) {
- g.setForeground(fillColor);
- g.drawLine(i, bottomPoints[i], i, topPoints[i]);
- g.setForeground(strokeColor);
- g.drawLine(i-1, topPoints[i-1], i, topPoints[i]);
- g.drawLine(i-1, bottomPoints[i-1], i, bottomPoints[i]);
- }
- } else {
- g.setBackground(fillColor);
- g.fillPolygon(fPts);
-
- g.setLineWidth(LW);
- g.setForeground(strokeColor);
- g.drawLine(fPts[0], fPts[1], fPts[2], fPts[3]);
- g.drawLine(fPts[6], fPts[7], fPts[4], fPts[5]);
- }
- }
-
- if (showResolveUI && diff.isUnresolvedIncomingOrConflicting()) {
- // draw resolve state
- int cx= (w-RESOLVE_SIZE)/2;
- int cy= ((ly+lh/2) + (ry+rh/2) - RESOLVE_SIZE)/2;
-
- g.setBackground(fillColor);
- g.fillRectangle(cx, cy, RESOLVE_SIZE, RESOLVE_SIZE);
-
- g.setForeground(strokeColor);
- g.drawRectangle(cx, cy, RESOLVE_SIZE, RESOLVE_SIZE);
- }
- }
- }
- }
-
- private int[] getCenterCurvePoints(int startx, int starty, int endx, int endy) {
- if (fBasicCenterCurve == null)
- buildBaseCenterCurve(endx-startx);
- double height= endy - starty;
- height= height/2;
- int width= endx-startx;
- int[] points= new int[width];
- for (int i= 0; i < width; i++) {
- points[i]= (int) (-height * fBasicCenterCurve[i] + height + starty);
- }
- return points;
- }
-
- private void buildBaseCenterCurve(int w) {
- double width= w;
- fBasicCenterCurve= new double[getCenterWidth()];
- for (int i= 0; i < getCenterWidth(); i++) {
- double r= i / width;
- fBasicCenterCurve[i]= Math.cos(Math.PI * r);
- }
- }
-
- private void paintSides(GC g, MergeSourceViewer tp, Canvas canvas, boolean right) {
-
- Display display= canvas.getDisplay();
-
- int lineHeight= tp.getTextWidget().getLineHeight();
- int visibleHeight= tp.getViewportHeight();
-
- Point size= canvas.getSize();
- int x= 0;
- int w= fMarginWidth;
- int w2= w/2;
-
- g.setBackground(canvas.getBackground());
- g.fillRectangle(x, 0, w, size.y);
-
- if (!fIsMotif) {
- // draw thin line between ruler and text
- g.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- if (right)
- g.fillRectangle(0, 0, 1, size.y);
- else
- g.fillRectangle(size.x-1, 0, 1, size.y);
- }
-
- if (! fHiglightRanges)
- return;
-
- if (fChangeDiffs != null) {
- int shift= tp.getVerticalScrollOffset() + (2-LW);
-
- Point region= new Point(0, 0);
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly2 && !isCurrentDiff(diff))
- continue;
-
- tp.getLineRange(diff.getPosition(tp), region);
- int y= (region.x * lineHeight) + shift;
- int h= region.y * lineHeight;
-
- if (y+h < 0)
- continue;
- if (y >= visibleHeight)
- break;
-
- g.setBackground(getColor(display, getFillColor(diff)));
- if (right)
- g.fillRectangle(x, y, w2, h);
- else
- g.fillRectangle(x+w2, y, w2, h);
-
- g.setLineWidth(LW);
- g.setForeground(getColor(display, getStrokeColor(diff)));
- if (right)
- g.drawRectangle(x-1, y-1, w2, h);
- else
- g.drawRectangle(x+w2, y-1, w2, h);
- }
- }
- }
-
- private void paint(PaintEvent event, MergeSourceViewer tp) {
-
- if (! fHiglightRanges)
- return;
- if (fChangeDiffs == null)
- return;
-
- Control canvas= (Control) event.widget;
- GC g= event.gc;
-
- Display display= canvas.getDisplay();
-
- int lineHeight= tp.getTextWidget().getLineHeight();
- int w= canvas.getSize().x;
- int shift= tp.getVerticalScrollOffset() + (2-LW);
- int maxh= event.y+event.height; // visibleHeight
-
- //if (fIsMotif)
- shift+= fTopInset;
-
- Point range= new Point(0, 0);
-
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.isDeleted())
- continue;
-
- if (fShowCurrentOnly && !isCurrentDiff(diff))
- continue;
-
- tp.getLineRange(diff.getPosition(tp), range);
- int y= (range.x * lineHeight) + shift;
- int h= range.y * lineHeight;
-
- if (y+h < event.y)
- continue;
- if (y > maxh)
- break;
-
- g.setBackground(getColor(display, getStrokeColor(diff)));
- g.fillRectangle(0, y-1, w, LW);
- g.fillRectangle(0, y+h-1, w, LW);
- }
- }
-
- private RGB getFillColor(Diff diff) {
- boolean selected= fCurrentDiff != null && fCurrentDiff.fParent == diff;
-
- RGB selected_fill= getBackground(null);
-
- if (isThreeWay() && !fIgnoreAncestor) {
- switch (diff.fDirection) {
- case RangeDifference.RIGHT:
- if (fLeftIsLocal)
- return selected ? selected_fill : INCOMING_FILL;
- return selected ? selected_fill : OUTGOING_FILL;
- case RangeDifference.ANCESTOR:
- return selected ? selected_fill : CONFLICT_FILL;
- case RangeDifference.LEFT:
- if (fLeftIsLocal)
- return selected ? selected_fill : OUTGOING_FILL;
- return selected ? selected_fill : INCOMING_FILL;
- case RangeDifference.CONFLICT:
- return selected ? selected_fill : CONFLICT_FILL;
- }
- return null;
- }
- return selected ? selected_fill : OUTGOING_FILL;
- }
-
- private RGB getStrokeColor(Diff diff) {
- boolean selected= fCurrentDiff != null && fCurrentDiff.fParent == diff;
-
- if (isThreeWay() && !fIgnoreAncestor) {
- switch (diff.fDirection) {
- case RangeDifference.RIGHT:
- if (fLeftIsLocal)
- return selected ? SELECTED_INCOMING : INCOMING;
- return selected ? SELECTED_OUTGOING : OUTGOING;
- case RangeDifference.ANCESTOR:
- return selected ? SELECTED_CONFLICT : CONFLICT;
- case RangeDifference.LEFT:
- if (fLeftIsLocal)
- return selected ? SELECTED_OUTGOING : OUTGOING;
- return selected ? SELECTED_INCOMING : INCOMING;
- case RangeDifference.CONFLICT:
- return selected ? SELECTED_CONFLICT : CONFLICT;
- }
- return null;
- }
- return selected ? SELECTED_OUTGOING : OUTGOING;
- }
-
- private Color getColor(Display display, RGB rgb) {
- if (rgb == null)
- return null;
- if (fColors == null)
- fColors= new HashMap(20);
- Color c= (Color) fColors.get(rgb);
- if (c == null) {
- c= new Color(display, rgb);
- fColors.put(rgb, c);
- }
- return c;
- }
-
- static RGB interpolate(RGB fg, RGB bg, double scale) {
- return new RGB(
- (int)((1.0-scale) * fg.red + scale * bg.red),
- (int)((1.0-scale) * fg.green + scale * bg.green),
- (int)((1.0-scale) * fg.blue + scale * bg.blue)
- );
- }
-
- //---- Navigating and resolving Diffs
-
- /**
- * Returns true if end (or beginning) of document reached.
- */
- private boolean navigate(boolean down, boolean wrap, boolean deep) {
-
- Diff diff= null;
-
- for (;;) {
-
- if (fChangeDiffs != null) {
- MergeSourceViewer part= fFocusPart;
- if (part == null)
- part= fRight;
-
- if (part != null) {
- Point s= part.getSelectedRange();
- if (down)
- diff= findNext(part, fChangeDiffs, s.x, s.x+s.y, deep);
- else
- diff= findPrev(part, fChangeDiffs, s.x, s.x+s.y, deep);
- }
- }
-
- if (diff == null) { // at end or beginning
- if (wrap) {
- if (!fEndOfDocReached) {
- fEndOfDocReached= true;
- if (! endOfDocumentReached(down))
- return true;
- }
- fEndOfDocReached= false;
- if (fChangeDiffs != null && fChangeDiffs.size() > 0) {
- if (down)
- diff= (Diff) fChangeDiffs.get(0);
- else
- diff= (Diff) fChangeDiffs.get(fChangeDiffs.size()-1);
- }
- } else {
- fEndOfDocReached= false;
- return true;
- }
- }
-
- setCurrentDiff(diff, true);
-
- if (diff != null && diff.fDirection == RangeDifference.ANCESTOR
- && !getAncestorEnabled())
- continue;
-
- break;
- }
-
- return false;
- }
-
- private boolean endOfDocumentReached(boolean down) {
- Control c= getControl();
- if (Utilities.okToUse(c)) {
-
- c.getDisplay().beep();
-
- String key= down ? "atEnd" : "atBeginning"; //$NON-NLS-1$ //$NON-NLS-2$
- return MessageDialog.openQuestion(c.getShell(),
- CompareMessages.getString("TextMergeViewer."+key+".title"), //$NON-NLS-1$ //$NON-NLS-2$
- CompareMessages.getString("TextMergeViewer."+key+".message")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return false;
- }
-
- /**
- * Find the Diff that overlaps with the given TextPart's text range.
- * If the range doesn't overlap with any range <code>null</code>
- * is returned.
- */
- private Diff findDiff(MergeSourceViewer tp, int rangeStart, int rangeEnd) {
- if (fChangeDiffs != null) {
- Iterator e= fChangeDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- if (diff.contains(tp, rangeStart, rangeEnd))
- return diff;
- }
- }
- return null;
- }
-
- private static Diff findNext(MergeSourceViewer tp, List v, int start, int end, boolean deep) {
- for (int i= 0; i < v.size(); i++) {
- Diff diff= (Diff) v.get(i);
- Position p= diff.getPosition(tp);
- if (p != null) {
- int startOffset= p.getOffset();
- if (end < startOffset) // <=
- return diff;
- if (deep && diff.fDiffs != null) {
- Diff d= null;
- int endOffset= startOffset + p.getLength();
- if (start == startOffset && (end == endOffset || end == endOffset-1)) {
- d= findNext(tp, diff.fDiffs, start-1, start-1, deep);
- } else if (end < endOffset) {
- d= findNext(tp, diff.fDiffs, start, end, deep);
- }
- if (d != null)
- return d;
- }
- }
- }
- return null;
- }
-
- private static Diff findPrev(MergeSourceViewer tp, List v, int start, int end, boolean deep) {
- for (int i= v.size()-1; i >= 0; i--) {
- Diff diff= (Diff) v.get(i);
- Position p= diff.getPosition(tp);
- if (p != null) {
- int startOffset= p.getOffset();
- int endOffset= startOffset + p.getLength();
- if (start > endOffset)
- return diff;
- if (deep && diff.fDiffs != null) {
- Diff d= null;
- if (start == startOffset && end == endOffset) {
- d= findPrev(tp, diff.fDiffs, end, end, deep);
- } else if (start >= startOffset) {
- d= findPrev(tp, diff.fDiffs, start, end, deep);
- }
- if (d != null)
- return d;
- }
- }
- }
- return null;
- }
-
- /*
- * Set the currently active Diff and update the toolbars controls and lines.
- * If <code>revealAndSelect</code> is <code>true</code> the Diff is revealed and
- * selected in both TextParts.
- */
- private void setCurrentDiff(Diff d, boolean revealAndSelect) {
-
-// if (d == fCurrentDiff)
-// return;
-
- if (fCenterButton != null)
- fCenterButton.setVisible(false);
-
- fEndOfDocReached= false;
-
- Diff oldDiff= fCurrentDiff;
-
- if (d != null && revealAndSelect) {
-
- // before we set fCurrentDiff we change the selection
- // so that the paint code uses the old background colors
- // otherwise selection isn't drawn correctly
- if (isThreeWay() && !fIgnoreAncestor)
- fAncestor.setSelection(d.fAncestorPos);
- fLeft.setSelection(d.fLeftPos);
- fRight.setSelection(d.fRightPos);
-
- // now switch diffs
- fCurrentDiff= d;
- revealDiff(d, d.fIsToken);
- } else {
- fCurrentDiff= d;
- }
-
- Diff d1= oldDiff != null ? oldDiff.fParent : null;
- Diff d2= fCurrentDiff != null ? fCurrentDiff.fParent : null;
- if (d1 != d2) {
- updateDiffBackground(d1);
- updateDiffBackground(d2);
- }
-
- updateControls();
- invalidateLines();
- refreshBirdsEyeView();
- }
-
- /**
- * Smart determines whether
- */
- private void revealDiff(Diff d, boolean smart) {
-
- boolean ancestorIsVisible= false;
- boolean leftIsVisible= false;
- boolean rightIsVisible= false;
-
- if (smart) {
- Point region= new Point(0, 0);
- // find the starting line of the diff in all text widgets
- int ls= fLeft.getLineRange(d.fLeftPos, region).x;
- int rs= fRight.getLineRange(d.fRightPos, region).x;
-
- if (isThreeWay() && !fIgnoreAncestor) {
- int as= fAncestor.getLineRange(d.fAncestorPos, region).x;
- if (as >= fAncestor.getTopIndex() && as <= fAncestor.getBottomIndex())
- ancestorIsVisible= true;
- }
-
- if (ls >= fLeft.getTopIndex() && ls <= fLeft.getBottomIndex())
- leftIsVisible= true;
-
- if (rs >= fRight.getTopIndex() && rs <= fRight.getBottomIndex())
- rightIsVisible= true;
- }
-
- // vertical scrolling
- if (!leftIsVisible || !rightIsVisible) {
- int avpos= 0, lvpos= 0, rvpos= 0;
-
- MergeSourceViewer allButThis= null;
- if (leftIsVisible) {
- avpos= lvpos= rvpos= realToVirtualPosition(fLeft, fLeft.getTopIndex());
- allButThis= fLeft;
- } else if (rightIsVisible) {
- avpos= lvpos= rvpos= realToVirtualPosition(fRight, fRight.getTopIndex());
- allButThis= fRight;
- } else if (ancestorIsVisible) {
- avpos= lvpos= rvpos= realToVirtualPosition(fAncestor, fAncestor.getTopIndex());
- allButThis= fAncestor;
- } else {
- if (fAllDiffs != null) {
- int vpos= 0;
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- if (diff == d)
- break;
- if (fSynchronizedScrolling) {
- vpos+= diff.getMaxDiffHeight(fShowAncestor);
- } else {
- avpos+= diff.getAncestorHeight();
- lvpos+= diff.getLeftHeight();
- rvpos+= diff.getRightHeight();
- }
- }
- if (fSynchronizedScrolling)
- avpos= lvpos= rvpos= vpos;
- }
- int delta= fRight.getViewportLines()/4;
- avpos-= delta;
- if (avpos < 0)
- avpos= 0;
- lvpos-= delta;
- if (lvpos < 0)
- lvpos= 0;
- rvpos-= delta;
- if (rvpos < 0)
- rvpos= 0;
- }
-
- scrollVertical(avpos, lvpos, rvpos, allButThis);
-
- if (fVScrollBar != null)
- fVScrollBar.setSelection(avpos);
- }
-
- // horizontal scrolling
- if (d.fIsToken) {
- // we only scroll horizontally for token diffs
- reveal(fAncestor, d.fAncestorPos);
- reveal(fLeft, d.fLeftPos);
- reveal(fRight, d.fRightPos);
- } else {
- // in all other cases we reset the horizontal offset
- hscroll(fAncestor);
- hscroll(fLeft);
- hscroll(fRight);
- }
- }
-
- private static void reveal(MergeSourceViewer v, Position p) {
- if (v != null && p != null) {
- StyledText st= v.getTextWidget();
- if (st != null) {
- Rectangle r= st.getClientArea();
- if (!r.isEmpty()) // workaround for #7320: Next diff scrolls when going into current diff
- v.revealRange(p.offset, p.length);
- }
- }
- }
-
- private static void hscroll(MergeSourceViewer v) {
- if (v != null) {
- StyledText st= v.getTextWidget();
- if (st != null)
- st.setHorizontalIndex(0);
- }
- }
-
- //--------------------------------------------------------------------------------
-
- void copyAllUnresolved(boolean leftToRight) {
- if (fChangeDiffs != null && isThreeWay() && !fIgnoreAncestor) {
- IRewriteTarget target= leftToRight ? fRight.getRewriteTarget() : fLeft.getRewriteTarget();
- boolean compoundChangeStarted= false;
- Iterator e= fChangeDiffs.iterator();
- try {
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- switch (diff.fDirection) {
- case RangeDifference.LEFT:
- if (leftToRight) {
- if (!compoundChangeStarted) {
- target.beginCompoundChange();
- compoundChangeStarted= true;
- }
- copy(diff, leftToRight);
- }
- break;
- case RangeDifference.RIGHT:
- if (!leftToRight) {
- if (!compoundChangeStarted) {
- target.beginCompoundChange();
- compoundChangeStarted= true;
- }
- copy(diff, leftToRight);
- }
- break;
- default:
- continue;
- }
- }
- } finally {
- if (compoundChangeStarted) {
- target.endCompoundChange();
- }
- }
- }
- }
-
- /*
- * Copy whole document from one side to the other.
- */
- protected void copy(boolean leftToRight) {
-
- if (showResolveUI()) {
- copyAllUnresolved(leftToRight);
- invalidateLines();
- return;
- }
-
- if (leftToRight) {
- if (fLeft.getEnabled()) {
- // copy text
- String text= fLeft.getTextWidget().getText();
- fRight.getTextWidget().setText(text);
- fRight.setEnabled(true);
- } else {
- // delete
- fRight.getTextWidget().setText(""); //$NON-NLS-1$
- fRight.setEnabled(false);
- }
- fRightLineCount= fRight.getLineCount();
- setRightDirty(true);
- } else {
- if (fRight.getEnabled()) {
- // copy text
- String text= fRight.getTextWidget().getText();
- fLeft.getTextWidget().setText(text);
- fLeft.setEnabled(true);
- } else {
- // delete
- fLeft.getTextWidget().setText(""); //$NON-NLS-1$
- fLeft.setEnabled(false);
- }
- fLeftLineCount= fLeft.getLineCount();
- setLeftDirty(true);
- }
- doDiff();
- invalidateLines();
- updateVScrollBar();
- selectFirstDiff();
- refreshBirdsEyeView();
- }
-
- private void copyDiffLeftToRight() {
- copy(fCurrentDiff, true, false);
- }
-
- private void copyDiffRightToLeft() {
- copy(fCurrentDiff, false, false);
- }
-
- /*
- * Copy the contents of the given diff from one side to the other.
- */
- private void copy(Diff diff, boolean leftToRight, boolean gotoNext) {
- if (copy(diff, leftToRight)) {
- if (gotoNext) {
- navigate(true, true, true);
- } else {
- revealDiff(diff, true);
- updateControls();
- }
- }
- }
-
- /*
- * Copy the contents of the given diff from one side to the other but
- * doesn't reveal anything.
- * Returns true if copy was succesful.
- */
- private boolean copy(Diff diff, boolean leftToRight) {
-
- if (diff != null && !diff.isResolved()) {
-
- Position fromPos= null;
- Position toPos= null;
- IDocument fromDoc= null;
- IDocument toDoc= null;
-
- if (leftToRight) {
- fRight.setEnabled(true);
- fromPos= diff.fLeftPos;
- toPos= diff.fRightPos;
- fromDoc= fLeft.getDocument();
- toDoc= fRight.getDocument();
- } else {
- fLeft.setEnabled(true);
- fromPos= diff.fRightPos;
- toPos= diff.fLeftPos;
- fromDoc= fRight.getDocument();
- toDoc= fLeft.getDocument();
- }
-
- if (fromDoc != null) {
-
- int fromStart= fromPos.getOffset();
- int fromLen= fromPos.getLength();
-
- int toStart= toPos.getOffset();
- int toLen= toPos.getLength();
-
- try {
- String s= null;
-
- switch (diff.fDirection) {
- case RangeDifference.RIGHT:
- case RangeDifference.LEFT:
- s= fromDoc.get(fromStart, fromLen);
- break;
- case RangeDifference.ANCESTOR:
- break;
- case RangeDifference.CONFLICT:
- if (APPEND_CONFLICT) {
- s= toDoc.get(toStart, toLen);
- s+= fromDoc.get(fromStart, fromLen);
- } else
- s= fromDoc.get(fromStart, fromLen);
- break;
- }
- if (s != null) {
- toDoc.replace(toStart, toLen, s);
- toPos.setOffset(toStart);
- toPos.setLength(s.length());
- }
-
- } catch (BadLocationException e) {
- // silently ignored
- }
- }
-
- diff.setResolved(true);
- updateResolveStatus();
-
- return true;
- }
- return false;
- }
-
- //---- scrolling
-
- /**
- * Calculates virtual height (in lines) of views by adding the maximum of corresponding diffs.
- */
- private int getVirtualHeight() {
- int h= 1;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- h+= diff.getMaxDiffHeight(fShowAncestor);
- }
- }
- return h;
- }
-
- /**
- * Calculates height (in lines) of right view by adding the height of the right diffs.
- */
- private int getRightHeight() {
- int h= 1;
- if (fAllDiffs != null) {
- Iterator e= fAllDiffs.iterator();
- for (int i= 0; e.hasNext(); i++) {
- Diff diff= (Diff) e.next();
- h+= diff.getRightHeight();
- }
- }
- return h;
- }
-
- /**
- * The height of the TextEditors in lines.
- */
- private int getViewportHeight() {
- StyledText te= fLeft.getTextWidget();
-
- int vh= te.getClientArea().height;
- if (vh == 0) {
- Rectangle trim= te.computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height;
-
- int headerHeight= getHeaderHeight();
-
- Composite composite= (Composite) getControl();
- Rectangle r= composite.getClientArea();
-
- vh= r.height-headerHeight-scrollbarHeight;
- }
-
- return vh / te.getLineHeight();
- }
-
- /**
- * Returns the virtual position for the given view position.
- */
- private int realToVirtualPosition(MergeSourceViewer w, int vpos) {
-
- if (! fSynchronizedScrolling || fAllDiffs == null)
- return vpos;
-
- int viewPos= 0; // real view position
- int virtualPos= 0; // virtual position
- Point region= new Point(0, 0);
-
- Iterator e= fAllDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- Position pos= diff.getPosition(w);
- w.getLineRange(pos, region);
- int realHeight= region.y;
- int virtualHeight= diff.getMaxDiffHeight(fShowAncestor);
- if (vpos <= viewPos + realHeight) { // OK, found!
- vpos-= viewPos; // make relative to this slot
- // now scale position within this slot to virtual slot
- if (realHeight <= 0)
- vpos= 0;
- else
- vpos= (vpos*virtualHeight)/realHeight;
- return virtualPos+vpos;
- }
- viewPos+= realHeight;
- virtualPos+= virtualHeight;
- }
- return virtualPos;
- }
-
- private void scrollVertical(int avpos, int lvpos, int rvpos, MergeSourceViewer allBut) {
-
- int s= 0;
-
- if (fSynchronizedScrolling) {
- s= getVirtualHeight() - rvpos;
- int height= fRight.getViewportLines()/4;
- if (s < 0)
- s= 0;
- if (s > height)
- s= height;
- }
-
- fInScrolling= true;
-
- if (isThreeWay() && allBut != fAncestor) {
- if (fSynchronizedScrolling || allBut == null) {
- int y= virtualToRealPosition(fAncestor, avpos+s)-s;
- fAncestor.vscroll(y);
- }
- }
-
- if (allBut != fLeft) {
- if (fSynchronizedScrolling || allBut == null) {
- int y= virtualToRealPosition(fLeft, lvpos+s)-s;
- fLeft.vscroll(y);
- }
- }
-
- if (allBut != fRight) {
- if (fSynchronizedScrolling || allBut == null) {
- int y= virtualToRealPosition(fRight, rvpos+s)-s;
- fRight.vscroll(y);
- }
- }
-
- fInScrolling= false;
-
- if (isThreeWay() && fAncestorCanvas != null)
- fAncestorCanvas.repaint();
-
- if (fLeftCanvas != null)
- fLeftCanvas.repaint();
-
- Control center= getCenter();
- if (center instanceof BufferedCanvas)
- ((BufferedCanvas)center).repaint();
-
- if (fRightCanvas != null)
- fRightCanvas.repaint();
- }
-
- /**
- * Updates Scrollbars with viewports.
- */
- private void syncViewport(MergeSourceViewer w) {
-
- if (fInScrolling)
- return;
-
- int ix= w.getTopIndex();
- int ix2= w.getDocumentRegionOffset();
-
- int viewPosition= realToVirtualPosition(w, ix-ix2);
-
- scrollVertical(viewPosition, viewPosition, viewPosition, w); // scroll all but the given views
-
- if (fVScrollBar != null) {
- int value= Math.max(0, Math.min(viewPosition, getVirtualHeight() - getViewportHeight()));
- fVScrollBar.setSelection(value);
- //refreshBirdEyeView();
- }
- }
-
- /**
- */
- private void updateVScrollBar() {
-
- if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
- int virtualHeight= getVirtualHeight();
- int viewPortHeight= getViewportHeight();
- int pageIncrement= viewPortHeight-1;
- int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
-
- fVScrollBar.setPageIncrement(pageIncrement);
- fVScrollBar.setMaximum(virtualHeight);
- fVScrollBar.setThumb(thumb);
- }
- }
-
- /**
- * maps given virtual position into a real view position of this view.
- */
- private int virtualToRealPosition(MergeSourceViewer part, int v) {
-
- if (! fSynchronizedScrolling || fAllDiffs == null)
- return v;
-
- int virtualPos= 0;
- int viewPos= 0;
- Point region= new Point(0, 0);
-
- Iterator e= fAllDiffs.iterator();
- while (e.hasNext()) {
- Diff diff= (Diff) e.next();
- Position pos= diff.getPosition(part);
- int viewHeight= part.getLineRange(pos, region).y;
- int virtualHeight= diff.getMaxDiffHeight(fShowAncestor);
- if (v < (virtualPos + virtualHeight)) {
- v-= virtualPos; // make relative to this slot
- if (viewHeight <= 0) {
- v= 0;
- } else {
- v= (v*viewHeight)/virtualHeight;
- }
- return viewPos+v;
- }
- virtualPos+= virtualHeight;
- viewPos+= viewHeight;
- }
- return viewPos;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties
deleted file mode 100644
index 491657991..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties
+++ /dev/null
@@ -1,98 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# @(#)TextMergeViewerResources.properties
-#
-# Resource strings for TextMergeViewer.java
-
-title= Text Compare
-
-saveDialog.title= Save Resource
-saveDialog.message= Resource has been modified. Save changes?
-
-compareProgressTask.title= Computing Differences...
-
-tooComplexError.title= Error
-tooComplexError.format= Too many differences. Turn on the ''Ignore White Space'' option or do a structure compare first.
-
-#####################################################
-# Toolbar actions
-#####################################################
-
-action.CopyLeftToRight.label=Copy Left to Right
-action.CopyLeftToRight.tooltip=Copy All from Left to Right
-action.CopyLeftToRight.image=copy_r_co.gif
-
-action.CopyRightToLeft.label=Copy Right to Left
-action.CopyRightToLeft.tooltip=Copy All Non-Conflicting Changes from Right to Left
-action.CopyRightToLeft.image=copy_l_co.gif
-
-action.CopyDiffLeftToRight.label=Copy Current Diff
-action.CopyDiffLeftToRight.tooltip=Copy Current Change from Left to Right
-action.CopyDiffLeftToRight.image=copycont_r_co.gif
-
-action.CopyDiffRightToLeft.label=Copy Current Diff
-action.CopyDiffRightToLeft.tooltip=Copy Current Change from Right to Left
-action.CopyDiffRightToLeft.image=copycont_l_co.gif
-
-action.NextDiff.label=Next
-action.NextDiff.tooltip=Select Next Change
-action.NextDiff.image=next_nav.gif
-
-action.PrevDiff.label=Previous
-action.PrevDiff.tooltip=Select Previous Change
-action.PrevDiff.image=prev_nav.gif
-
-action.EnableAncestor.label=Enable Ancestor Pane
-action.EnableAncestor.tooltip.unchecked=Show Ancestor Pane
-action.EnableAncestor.tooltip.checked=Hide Ancestor Pane
-action.EnableAncestor.description.unchecked=Show Ancestor Pane
-action.EnableAncestor.description.checked=Hide Ancestor Pane
-action.EnableAncestor.image=ancestorpane_co.gif
-
-action.IgnoreAncestor.label=Ignore Ancestor
-action.IgnoreAncestor.tooltip.unchecked=Two-Way Compare (Ignore Ancestor)
-action.IgnoreAncestor.tooltip.checked=Three-Way Compare
-action.IgnoreAncestor.description.unchecked=Two-Way Compare (Ignore Ancestor)
-action.IgnoreAncestor.description.checked=Three-Way Compare
-action.IgnoreAncestor.image=twowaycompare_co.gif
-
-
-#####################################################
-# Context menu actions
-#####################################################
-
-action.undo.label=Undo@Ctrl+Z
-action.undo.tooltip=Undo Last Operation
-
-action.redo.label=Redo@Ctrl+Y
-action.redo.tooltip=Redo Last Operation
-
-action.cut.label=Cut@Ctrl+X
-action.cut.tooltip=Cut Text Selection to Clipboard
-
-action.copy.label=Copy@Ctrl+C
-action.copy.tooltip=Copy Text Selection to Clipboard
-
-action.paste.label=Paste@Ctrl+V
-action.paste.tooltip=Replace Text Selection with Clipboard
-
-action.delete.label=Delete
-action.delete.tooltip=Delete Current Text Selection
-
-action.find.label=Find...@Ctrl+F
-action.find.tooltip=Find Occurrence
-
-action.selectAll.label=Select All@Ctrl+A
-action.selectAll.tooltip=Select All Changes
-
-action.save.label=Save@Ctrl+S
-action.save.tooltip=Save Changes
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html
deleted file mode 100644
index 9f606fb95..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html
+++ /dev/null
@@ -1,45 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Support for compare and merge viewers which show the
-content side-by-side.
-<h2>
-Package Specification</h2>
-
-The <b>ContentMergeViewer</b> is an abstract compare and merge viewer
-with two side-by-side content areas and an optional content area for a
-common ancestor (for three-way compare). Because the implementation makes
-no assumptions about the content type it is a subclass responsibility to
-deal with a specific type. Its subclass <b>ImageMergeViewer</b> in
-package org.eclipse.compare.internal shows how to base a simple
-mergeviewer for images on <b>ContentMergeViewer</b>.
-<p>
-
-A <b>ContentMergeViewer</b> accesses its model by means of a content
-provider which must implement the <b>IMergeViewerContentProvider</b> interface.
-<p>
-
-The <b>TextMergeViewer</b> is the standard concrete subclass of
-<b>ContentMergeViewer</b> for comparing and merging text content.
-<br>
-A text merge viewer uses the <b>org.eclipse.compare.rangedifferencer.RangeDifferencer</b>
-to perform a textual, line-by-line comparison of two (or three) input documents.
-For text lines that differ the <b>TextMergeViewer</b> uses an <b>ITokenComparator</b>
-to find longest sequences of matching and non-matching tokens.
-The <b>TextMergeViewer</b>'s
-default token compare works on characters separated by whitespace. If a
-different strategy is needed (for example, Java tokens in a Java-aware
-merge viewer), clients can create their own token comparators by implementing
-the <b>ITokenComparator</b> interface.
-<p>The <b>TextMergeViewer</b> not only works on whole documents but on
-subranges of documents too. In this case the viewer's input must be an
-<b>IDocumentRange</b> instead of an <b>IDocument</b>.
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
deleted file mode 100644
index d6c202174..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.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.compare.internal;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.Viewer;
-
-
-public abstract class AbstractViewer extends Viewer {
-
- public void setInput(Object input) {
- }
-
- public Object getInput() {
- return null;
- }
-
- public ISelection getSelection() {
- return null;
- }
-
- public void setSelection(ISelection s, boolean reveal) {
- }
-
- public void refresh() {
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
deleted file mode 100644
index 51892e496..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.util.ResourceBundle;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-
-public class AddFromHistoryAction extends BaseCompareAction {
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.internal.AddFromHistoryAction"; //$NON-NLS-1$
-
- public AddFromHistoryAction() {
- }
-
- protected boolean isEnabled(ISelection selection) {
- return Utilities.getResources(selection).length == 1;
- }
-
- protected void run(ISelection selection) {
-
- ResourceBundle bundle= ResourceBundle.getBundle(BUNDLE_NAME);
- String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
- Shell parentShell= CompareUIPlugin.getShell();
- AddFromHistoryDialog dialog= null;
-
- Object[] s= Utilities.getResources(selection);
-
- for (int i= 0; i < s.length; i++) {
- Object o= s[i];
- if (o instanceof IContainer) {
- IContainer container= (IContainer) o;
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(parentShell);
- IProgressMonitor pm= pmdialog.getProgressMonitor();
- IFile[] states= null;
- try {
- states= container.findDeletedMembersWithHistory(IResource.DEPTH_INFINITE, pm);
- } catch (CoreException ex) {
- pm.done();
- }
-
- if (states == null || states.length <= 0) {
- String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
- MessageDialog.openInformation(parentShell, title, msg);
- return;
- }
-
- if (dialog == null) {
- dialog= new AddFromHistoryDialog(parentShell, bundle);
- dialog.setHelpContextId(ICompareContextIds.ADD_FROM_HISTORY_DIALOG);
- }
-
- if (dialog.select(container, states)) {
-
- AddFromHistoryDialog.HistoryInput[] selected= dialog.getSelected();
-
- if (selected != null && selected.length > 0) {
- try {
- updateWorkspace(bundle, parentShell, selected);
-
- } catch (InterruptedException x) {
- // Do nothing. Operation has been canceled by user.
-
- } catch (InvocationTargetException x) {
- String reason= x.getTargetException().getMessage();
- MessageDialog.openError(parentShell, title, Utilities.getFormattedString(bundle, "replaceError", reason)); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
-
- void createContainers(IResource resource) throws CoreException {
- IContainer container= resource.getParent();
- if (container instanceof IFolder) {
- IFolder parent= (IFolder) container;
- if (parent != null && !parent.exists()) {
- createContainers(parent);
- parent.create(false, true, null);
- }
- }
- }
-
- private void updateWorkspace(final ResourceBundle bundle, Shell shell,
- final AddFromHistoryDialog.HistoryInput[] selected)
- throws InvocationTargetException, InterruptedException {
-
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws InvocationTargetException {
- try {
- String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
- pm.beginTask(taskName, selected.length);
-
- for (int i= 0; i < selected.length; i++) {
- IFile file= selected[i].fFile;
- IFileState fileState= selected[i].fFileState;
- createContainers(file);
-
- SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 1);
- try {
- file.create(fileState.getContents(), false, subMonitor);
- } finally {
- subMonitor.done();
- }
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- pm.done();
- }
- }
- };
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties
deleted file mode 100644
index e25207118..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties
+++ /dev/null
@@ -1,45 +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
-###############################################################################
-
-# @(#)AddFromHistoryAction.properties
-#
-# Resources for AddFromHistoryAction.java
-
-title= Restore from Local History
-
-memberPaneTitle= {0} - Available Files in Local History:
-
-treeTitleFormat= Local History of ''{0}''
-dateIcon= obj16/day_obj.gif
-timeIcon= obj16/resource_obj.gif
-
-memberDescription= Check files to restore from the local history:
-editionDescription= Select an edition of a file:
-
-treeFormat= {0}
-workspaceTreeFormat= {0} (Workspace File)
-parseErrorFormat= {0} (Parse Error)
-
-editionLabel= Local History ({0})
-workspaceEditionLabel= Workspace File
-
-targetLabel= {0}
-
-todayFormat= Today ({0})
-yesterdayFormat= Yesterday ({0})
-dayFormat= {0}
-
-buttonLabel= Restore
-
-noLocalHistoryError= No deleted resources in local history for selected container.
-replaceError=Can''t replace resource (reason: {0}).
-
-taskName=Restoring \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
deleted file mode 100644
index 3d323f541..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
+++ /dev/null
@@ -1,475 +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.compare.internal;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.compare.*;
-
-
-public class AddFromHistoryDialog extends ResizableDialog {
-
- static class HistoryInput implements ITypedElement, IEncodedStreamContentAccessor, IModificationDate {
- IFile fFile;
- IFileState fFileState;
-
- HistoryInput(IFile file, IFileState fileState) {
- fFile= file;
- fFileState= fileState;
- }
- public InputStream getContents() throws CoreException {
- return new BufferedInputStream(fFileState.getContents());
- }
- public String getCharset() {
- String charset= null;
- try {
- charset= fFileState.getCharset();
- } catch (CoreException e) {
- // fall through
- }
- if (charset == null)
- charset= Utilities.getCharset(fFile);
- return charset;
- }
- public String getName() {
- return fFile.getName();
- }
- public String getType() {
- return fFile.getFileExtension();
- }
- public Image getImage() {
- return CompareUI.getImage(fFile);
- }
- public long getModificationDate() {
- return fFileState.getModificationTime();
- }
- }
-
- static class FileHistory {
- private IFile fFile;
- private IFileState[] fStates;
- private int fSelected;
-
- FileHistory(IFile file) {
- fFile= file;
- }
-
- IFile getFile() {
- return fFile;
- }
-
- IFileState[] getStates() {
- if (fStates == null) {
- try {
- fStates= fFile.getHistory(new NullProgressMonitor());
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- return fStates;
- }
-
- IFileState getSelectedState() {
- return getStates()[fSelected];
- }
-
- void setSelected(IFileState state) {
- for (int i= 0; i < fStates.length; i++) {
- if (fStates[i] == state) {
- fSelected= i;
- return;
- }
- }
- }
-
- HistoryInput getHistoryInput() {
- return new HistoryInput(fFile, getSelectedState());
- }
-
- boolean isSelected(int index) {
- return index == fSelected;
- }
- }
-
- private CompareConfiguration fCompareConfiguration;
- private ArrayList fArrayList= new ArrayList();
- private FileHistory fCurrentFileHistory;
-
- // SWT controls
- private CompareViewerSwitchingPane fContentPane;
- private Button fCommitButton;
- private Table fMemberTable;
- private CompareViewerPane fMemberPane;
- private Tree fEditionTree;
- private CompareViewerPane fEditionPane;
- private Image fDateImage;
- private Image fTimeImage;
-
-
- public AddFromHistoryDialog(Shell parent, ResourceBundle bundle) {
- super(parent, bundle);
-
- String iconName= Utilities.getString(fBundle, "dateIcon", "obj16/day_obj.gif"); //$NON-NLS-2$ //$NON-NLS-1$
- ImageDescriptor id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fDateImage= id.createImage();
- iconName= Utilities.getString(fBundle, "timeIcon", "obj16/resource_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- id= CompareUIPlugin.getImageDescriptor(iconName);
- if (id != null)
- fTimeImage= id.createImage();
- }
-
- public boolean select(IContainer root, IFile[] inputFiles) {
-
- create(); // create widgets
-
- String format= Utilities.getString(fBundle, "memberPaneTitle"); //$NON-NLS-1$
- String title= MessageFormat.format(format, new Object[] { root.getName() });
- fMemberPane.setImage(CompareUI.getImage(root));
- fMemberPane.setText(title);
-
- // sort input files
- final int count= inputFiles.length;
- final IFile[] files= new IFile[count];
- for (int i= 0; i < count; i++)
- files[i]= inputFiles[i];
- if (count > 1)
- internalSort(files, 0, count-1);
-
-
- String prefix= root.getFullPath().toString();
-
- if (fMemberTable != null && !fMemberTable.isDisposed()) {
- for (int i= 0; i < files.length; i++) {
- IFile file= files[i];
- String path= file.getFullPath().toString();
- if (path.startsWith(prefix))
- path= path.substring(prefix.length()+1);
- TableItem ti= new TableItem(fMemberTable, SWT.NONE);
- ti.setImage(CompareUI.getImage(file));
- ti.setText(path);
- ti.setData(new FileHistory(file));
- }
- }
-
- open();
-
- return (getReturnCode() == OK) && (fArrayList.size() > 0);
- }
-
- HistoryInput[] getSelected() {
- HistoryInput[] selected= new HistoryInput[fArrayList.size()];
- Iterator iter= fArrayList.iterator();
- for (int i= 0; iter.hasNext(); i++) {
- FileHistory h= (FileHistory) iter.next();
- selected[i]= h.getHistoryInput();
- }
- return selected;
- }
-
- protected synchronized Control createDialogArea(Composite parent2) {
-
- Composite parent= (Composite) super.createDialogArea(parent2);
-
- getShell().setText(Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
- org.eclipse.compare.Splitter vsplitter= new org.eclipse.compare.Splitter(parent, SWT.VERTICAL);
- vsplitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-
- vsplitter.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fDateImage != null)
- fDateImage.dispose();
- if (fTimeImage != null)
- fTimeImage.dispose();
- }
- }
- );
-
- // we need two panes: the left for the elements, the right one for the editions
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- Composite c= new Composite(hsplitter, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 2;
- layout.verticalSpacing= 2;
- layout.numColumns= 1;
- c.setLayout(layout);
- Label l1= new Label(c, SWT.NONE);
- l1.setText(Utilities.getString(fBundle, "memberDescription")); //$NON-NLS-1$
- fMemberPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- fMemberPane.setLayoutData(gd);
-
- fMemberTable= new Table(fMemberPane, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL);
- fMemberTable.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (e.detail == SWT.CHECK) {
- if (e.item instanceof TableItem) {
- TableItem ti= (TableItem) e.item;
- if (ti.getChecked())
- fArrayList.add(ti.getData());
- else
- fArrayList.remove(ti.getData());
-
- if (fCommitButton != null)
- fCommitButton.setEnabled(fArrayList.size() > 0);
- }
- } else {
- handleMemberSelect(e.item);
- }
- }
- }
- );
-
- fMemberPane.setContent(fMemberTable);
-
- c= new Composite(hsplitter, SWT.NONE);
- layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 2;
- layout.verticalSpacing= 2;
- layout.numColumns= 1;
- c.setLayout(layout);
- Label l2= new Label(c, SWT.NONE);
- l2.setText(Utilities.getString(fBundle, "editionDescription")); //$NON-NLS-1$
- fEditionPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT);
- gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- fEditionPane.setLayoutData(gd);
-
- fEditionTree= new Tree(fEditionPane, SWT.H_SCROLL | SWT.V_SCROLL);
- fEditionTree.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- feedContent(e.item);
- }
- }
- );
- fEditionPane.setContent(fEditionTree);
-
- applyDialogFont(parent); // to avoid applying font to compare viewer
- fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, fCompareConfiguration);
- }
- };
- vsplitter.setWeights(new int[] { 30, 70 });
-
- return parent;
- }
-
- /**
- * Feeds selection from member viewer to edition viewer.
- */
- private void handleMemberSelect(Widget w) {
- Object data= null;
- if (w != null)
- data= w.getData();
- if (data instanceof FileHistory) {
-
- FileHistory h= (FileHistory) data;
- fCurrentFileHistory= h;
-
- IFile file= h.getFile();
- IFileState[] states= h.getStates();
-
- fEditionPane.setImage(CompareUI.getImage(file));
- String pattern= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$
- String title= MessageFormat.format(pattern, new Object[] { file.getName() });
- fEditionPane.setText(title);
-
- if (fEditionTree != null) {
- fEditionTree.setRedraw(false);
- fEditionTree.removeAll();
- for (int i= 0; i < states.length; i++) {
- addEdition(new HistoryInput(file, states[i]), h.isSelected(i));
- }
- fEditionTree.setRedraw(true);
- }
- } else
- fCurrentFileHistory= null;
- }
-
- /**
- * Adds the given Pair to the edition tree.
- * It takes care of creating tree nodes for different dates.
- */
- private void addEdition(HistoryInput input, boolean isSelected) {
- if (fEditionTree == null || fEditionTree.isDisposed())
- return;
-
- IFileState state= input.fFileState;
-
- // find last day
- TreeItem[] days= fEditionTree.getItems();
- TreeItem lastDay= null;
- if (days.length > 0)
- lastDay= days[days.length-1];
-
- long ldate= state.getModificationTime();
- long day= dayNumber(ldate);
- Date date= new Date(ldate);
- if (lastDay == null || day != dayNumber(((Date)lastDay.getData()).getTime())) {
- lastDay= new TreeItem(fEditionTree, SWT.NONE);
- lastDay.setImage(fDateImage);
- String df= DateFormat.getDateInstance().format(date);
- long today= dayNumber(System.currentTimeMillis());
-
- String formatKey;
- if (day == today)
- formatKey= "todayFormat"; //$NON-NLS-1$
- else if (day == today-1)
- formatKey= "yesterdayFormat"; //$NON-NLS-1$
- else
- formatKey= "dayFormat"; //$NON-NLS-1$
- String pattern= Utilities.getString(fBundle, formatKey);
- if (pattern != null)
- df= MessageFormat.format(pattern, new String[] { df });
- lastDay.setText(df);
- lastDay.setData(date);
- }
- TreeItem ti= new TreeItem(lastDay, SWT.NONE);
- ti.setImage(fTimeImage);
- ti.setText(DateFormat.getTimeInstance().format(date));
- ti.setData(input);
-
- if (isSelected) {
- lastDay.setExpanded(true);
- fEditionTree.setSelection(new TreeItem[] { ti });
- feedContent(ti);
- }
- }
-
- /**
- * Returns the number of s since Jan 1st, 1970.
- * The given date is converted to GMT and daylight saving is taken into account too.
- */
- private long dayNumber(long date) {
- int ONE_DAY_MS= 24*60*60 * 1000; // one day in milli seconds
-
- Calendar calendar= Calendar.getInstance();
- long localTimeOffset= calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
-
- return (date + localTimeOffset) / ONE_DAY_MS;
- }
-
- /**
- * Feeds the tree viewer's selection to the contentviewer
- */
- private void feedContent(Widget w) {
- if (fContentPane != null && !fContentPane.isDisposed()) {
- Object o= w.getData();
- if (o instanceof HistoryInput) {
- HistoryInput selected= (HistoryInput) o;
- fContentPane.setInput(selected);
- fContentPane.setText(getEditionLabel(selected));
- fContentPane.setImage(fTimeImage);
-
- if (fCurrentFileHistory != null)
- fCurrentFileHistory.setSelected(selected.fFileState);
- } else {
- fContentPane.setInput(null);
- }
- }
- }
-
- protected String getEditionLabel(HistoryInput input) {
- String format= Utilities.getString(fBundle, "historyEditionLabel", null); //$NON-NLS-1$
- if (format == null)
- format= Utilities.getString(fBundle, "editionLabel"); //$NON-NLS-1$
- if (format == null)
- format= "x{0}"; //$NON-NLS-1$
-
- long modDate= input.getModificationDate();
- String date= DateFormat.getDateTimeInstance().format(new Date(modDate));
-
- return MessageFormat.format(format, new Object[] { date });
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- String buttonLabel= Utilities.getString(fBundle, "buttonLabel", IDialogConstants.OK_LABEL); //$NON-NLS-1$
- // a 'Cancel' and a 'Add' button
- fCommitButton= createButton(parent, IDialogConstants.OK_ID, buttonLabel, true);
- fCommitButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- * Returns true if the pathname of f1 comes after f2
- */
- private static boolean greaterThan(IFile f1, IFile f2) {
- String[] ss1= f1.getFullPath().segments();
- String[] ss2= f2.getFullPath().segments();
- int l1= ss1.length;
- int l2= ss2.length;
- int n= Math.max(l1, l2);
-
- for (int i= 0; i < n; i++) {
- String s1= i < l1 ? ss1[i] : ""; //$NON-NLS-1$
- String s2= i < l2 ? ss2[i] : ""; //$NON-NLS-1$
- int rc= s1.compareToIgnoreCase(s2);
- if (rc != 0)
- return rc < 0;
- }
- return false;
- }
-
- private static void internalSort(IFile[] keys, int left, int right) {
-
- int original_left= left;
- int original_right= right;
-
- IFile mid= keys[(left + right) / 2];
- do {
- while (greaterThan(keys[left], mid))
- left++;
-
- while (greaterThan(mid, keys[right]))
- right--;
-
- if (left <= right) {
- IFile tmp= keys[left];
- keys[left]= keys[right];
- keys[right]= tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (original_left < right)
- internalSort(keys, original_left, right);
-
- if (left < original_right)
- internalSort(keys, left, original_right);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
deleted file mode 100644
index 7771b93d3..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
+++ /dev/null
@@ -1,43 +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.compare.internal;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IActionDelegate;
-
-
-public abstract class BaseCompareAction implements IActionDelegate {
-
- private ISelection fSelection;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- final public void run(IAction action) {
- run(fSelection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- final public void selectionChanged(IAction action, ISelection selection) {
- fSelection= selection;
- if (action != null)
- action.setEnabled(isEnabled(fSelection));
- }
-
- protected boolean isEnabled(ISelection selection) {
- return false;
- }
-
- abstract protected void run(ISelection selection);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
deleted file mode 100644
index 41b23e86d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.io.*;
-import java.util.ResourceBundle;
-import java.text.MessageFormat;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-/**
- * A simple compare viewer for binary files.
- * Shows the position of the first non-matching byte.
- */
-public class BinaryCompareViewer extends AbstractViewer {
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.internal.BinaryCompareViewerResources"; //$NON-NLS-1$
-
- private static final int EOF= -1;
- private Text fControl;
- private ICompareInput fInput;
- private ResourceBundle fBundle;
- private boolean fLeftIsLocal;
-
-
- public BinaryCompareViewer(Composite parent, CompareConfiguration cc) {
-
- WorkbenchHelp.setHelp(parent, ICompareContextIds.BINARY_COMPARE_VIEW);
-
- fBundle= ResourceBundle.getBundle(BUNDLE_NAME);
-
- fControl= new Text(parent, SWT.NONE);
- fControl.setEditable(false);
- fControl.setData(CompareUI.COMPARE_VIEWER_TITLE, Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
- fLeftIsLocal= Utilities.getBoolean(cc, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
- }
-
- public Control getControl() {
- return fControl;
- }
-
- public void setInput(Object input) {
- if (fControl != null && input instanceof ICompareInput) {
- fInput= (ICompareInput) input;
-
- InputStream left= null;
- InputStream right= null;
-
- String message= null;
- try {
- left= getStream(fInput.getLeft());
- right= getStream(fInput.getRight());
-
- if (left != null && right != null) {
- int pos= 0;
- while (true) {
- int l= left.read();
- int r= right.read();
- if (l != r) {
- String format= Utilities.getString(fBundle, "diffMessageFormat"); //$NON-NLS-1$
- message= MessageFormat.format(format, new String[] { Integer.toString(pos) } );
- break;
- }
- if (l == EOF)
- break;
- pos++;
- }
- } else if (left == null && right == null) {
- message= Utilities.getString(fBundle, "deleteConflictMessage"); //$NON-NLS-1$
- } else if (left == null) {
- if (fLeftIsLocal)
- message= Utilities.getString(fBundle, "deletedMessage"); //$NON-NLS-1$
- else
- message= Utilities.getString(fBundle, "addedMessage"); //$NON-NLS-1$
- } else if (right == null) {
- if (fLeftIsLocal)
- message= Utilities.getString(fBundle, "addedMessage"); //$NON-NLS-1$
- else
- message= Utilities.getString(fBundle, "deletedMessage"); //$NON-NLS-1$
- }
- } catch (CoreException ex) {
- message= Utilities.getString(fBundle, "errorMessage"); //$NON-NLS-1$
- } catch (IOException ex) {
- message= Utilities.getString(fBundle, "errorMessage"); //$NON-NLS-1$
- } finally {
- if (left != null) {
- try {
- left.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- if (right != null) {
- try {
- right.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- if (message != null)
- fControl.setText(message);
- }
- }
-
- public Object getInput() {
- return fInput;
- }
-
- private InputStream getStream(ITypedElement input) throws CoreException {
- if (input instanceof IStreamContentAccessor)
- return ((IStreamContentAccessor)input).getContents();
- return null;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java
deleted file mode 100644
index 8c98ec6ff..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.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.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-
-/**
- * A factory object for the <code>BinaryCompareViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class BinaryCompareViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new BinaryCompareViewer(parent, mp);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties
deleted file mode 100644
index dbfc7d70e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties
+++ /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
-###############################################################################
-
-# @(#)BinaryCompareViewerResources.properties
-#
-# Resource strings for BinaryCompareViewer.java
-
-title= Binary Compare
-
-diffMessageFormat= First bytes differ at position {0}
-deleteConflictMessage= Delete Conflict
-addedMessage= Added Resource
-deletedMessage= Removed Resource
-errorMessage= Internal Error
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
deleted file mode 100644
index 79b34255d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
+++ /dev/null
@@ -1,98 +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.compare.internal;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-
-/**
- * A Canvas which reduces flicker by drawing in an off screen buffer.
- */
-public abstract class BufferedCanvas extends Canvas {
-
- //private static final boolean USE_DOUBLE_BUFFER= !"carbon".equals(SWT.getPlatform()); //$NON-NLS-1$
- private static final boolean USE_DOUBLE_BUFFER= true;
-
- /** The drawable for double buffering */
- Image fBuffer;
-
- public BufferedCanvas(Composite parent, int flags) {
- super(parent, flags + SWT.NO_BACKGROUND);
-
- addPaintListener(
- new PaintListener() {
- public void paintControl(PaintEvent event) {
- doubleBufferPaint(event.gc);
- }
- }
- );
-
- addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fBuffer != null) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- }
- );
- }
-
- public void repaint() {
- if (!isDisposed()) {
- GC gc= new GC(this);
- doubleBufferPaint(gc);
- gc.dispose();
- }
- }
-
- /**
- * Double buffer drawing.
- */
- void doubleBufferPaint(GC dest) {
-
- if (!USE_DOUBLE_BUFFER) {
- doPaint(dest);
- return;
- }
-
- Point size= getSize();
-
- if (size.x <= 1 || size.y <= 1) // we test for <= 1 because on X11 controls have initial size 1,1
- return;
-
- if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
- if (r.width != size.x || r.height != size.y) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- if (fBuffer == null)
- fBuffer= new Image(getDisplay(), size.x, size.y);
-
- GC gc= new GC(fBuffer);
- try {
- gc.setBackground(getBackground());
- gc.fillRectangle(0, 0, size.x, size.y);
- doPaint(gc);
- } finally {
- gc.dispose();
- }
-
- dest.drawImage(fBuffer, 0, 0);
- }
-
- abstract public void doPaint(GC gc);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
deleted file mode 100644
index 80d36bfb0..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
+++ /dev/null
@@ -1,133 +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.compare.internal;
-
-import java.io.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-
-/**
- * A buffer for a workspace resource.
- */
-public class BufferedResourceNode extends ResourceNode {
-
- private boolean fDirty= false;
- private IFile fDeleteFile;
-
- /**
- * Creates a <code>ResourceNode</code> for the given resource.
- *
- * @param resource the resource
- */
- public BufferedResourceNode(IResource resource) {
- super(resource);
- }
-
- protected IStructureComparator createChild(IResource child) {
- return new BufferedResourceNode(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) {
-
- byte[] bytes= getContent();
- /*
- String enc1= getEncoding();
- String enc2= Utilities.getCharset((IFile)resource);
- if (! enc1.equals(enc2)) {
- try {
- String content= new String(bytes, enc1);
- bytes= content.getBytes(enc2);
- } catch (UnsupportedEncodingException e) {
- // ignore
- }
- }
- */
- ByteArrayInputStream is= new ByteArrayInputStream(bytes);
- 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) {
- // Silently ignored
- }
- }
- }
- }
- }
-
- 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= Utilities.readBytes(is);
- if (bytes != null)
- dst.setContent(bytes);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- return child;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
deleted file mode 100644
index 824ed3e1c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.compare.CompareConfiguration;
-
-/**
- * Toggles a boolean property of an <code>ICompareConfiguration</code>.
- */
-public class ChangePropertyAction extends Action {
-
- private CompareConfiguration fCompareConfiguration;
- private String fPropertyKey;
- private ResourceBundle fBundle;
- private String fPrefix;
-
-
- public ChangePropertyAction(ResourceBundle bundle, CompareConfiguration cc, String rkey, String pkey) {
- fPropertyKey= pkey;
- fBundle= bundle;
- fPrefix= rkey;
- Utilities.initAction(this, fBundle, fPrefix);
- setCompareConfiguration(cc);
- }
-
- public void run() {
- boolean b= !Utilities.getBoolean(fCompareConfiguration, fPropertyKey, false);
- setChecked(b);
- if (fCompareConfiguration != null)
- fCompareConfiguration.setProperty(fPropertyKey, new Boolean(b));
- }
-
- public void setChecked(boolean state) {
- super.setChecked(state);
- Utilities.initToggleAction(this, fBundle, fPrefix, state);
- }
-
- public void setCompareConfiguration(CompareConfiguration cc) {
- fCompareConfiguration= cc;
- setChecked(Utilities.getBoolean(fCompareConfiguration, fPropertyKey, false));
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java
deleted file mode 100644
index 787c3fb26..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.ColorDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.resource.JFaceResources;
-
-/**
- * A "button" of a certain color determined by the color picker.
- */
-public class ColorEditor {
-
- private Point fExtent;
- private Image fImage;
- private RGB fColorValue;
- private Color fColor;
- private Button fButton;
-
- public ColorEditor(Composite parent) {
-
- fButton= new Button(parent, SWT.PUSH);
- fExtent= computeImageSize(parent);
- fImage= new Image(parent.getDisplay(), fExtent.x, fExtent.y);
-
- GC gc= new GC(fImage);
- gc.setBackground(fButton.getBackground());
- gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
- gc.dispose();
-
- fButton.setImage(fImage);
- fButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- ColorDialog colorDialog= new ColorDialog(fButton.getShell());
- colorDialog.setRGB(fColorValue);
- RGB newColor = colorDialog.open();
- if (newColor != null) {
- fColorValue= newColor;
- updateColorImage();
- }
- }
- });
-
- fButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- if (fImage != null) {
- fImage.dispose();
- fImage= null;
- }
- if (fColor != null) {
- fColor.dispose();
- fColor= null;
- }
- }
- });
- }
-
- public RGB getColorValue() {
- return fColorValue;
- }
-
- public void setColorValue(RGB rgb) {
- fColorValue= rgb;
- updateColorImage();
- }
-
- public Button getButton() {
- return fButton;
- }
-
- protected void updateColorImage() {
-
- Display display= fButton.getDisplay();
-
- GC gc= new GC(fImage);
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
-
- if (fColor != null)
- fColor.dispose();
-
- fColor= new Color(display, fColorValue);
- gc.setBackground(fColor);
- gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
- gc.dispose();
-
- fButton.setImage(fImage);
- }
-
- protected Point computeImageSize(Control window) {
- GC gc= new GC(window);
- Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
- gc.setFont(f);
- int height= gc.getFontMetrics().getHeight();
- gc.dispose();
- Point p= new Point(height * 3 - 6, height);
- return p;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
deleted file mode 100644
index d0f4d805a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.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.compare.internal;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-
-
-/*
- * The "Compare with each other" action
- */
-public class CompareAction extends BaseCompareAction implements IObjectActionDelegate {
-
- private ResourceCompareInput fInput;
- private IWorkbenchPage fWorkbenchPage;
-
-
- public void run(ISelection selection) {
- if (fInput != null) {
- fInput.setSelection(selection);
- fInput.initializeCompareConfiguration();
- CompareUI.openCompareEditorOnPage(fInput, fWorkbenchPage);
- fInput= null; // don't reuse this input!
- }
- }
-
- protected boolean isEnabled(ISelection selection) {
- if (fInput == null) {
- CompareConfiguration cc= new CompareConfiguration();
- // buffered merge mode: don't ask for confirmation
- // when switching between modified resources
- cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false));
-
- // uncomment following line to have separate outline view
- //cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, new Boolean(true));
-
- fInput= new ResourceCompareInput(cc);
- }
- return fInput.isEnabled(selection);
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- fWorkbenchPage= targetPart.getSite().getPage();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
deleted file mode 100644
index 3116aca44..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.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.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-
-public class CompareDialog extends ResizableDialog implements IPropertyChangeListener {
-
- private CompareEditorInput fCompareEditorInput;
- private Button fCommitButton;
-
-
- CompareDialog(Shell shell, CompareEditorInput input) {
- super(shell, null);
-
- Assert.isNotNull(input);
- fCompareEditorInput= input;
- fCompareEditorInput.addPropertyChangeListener(this);
- setHelpContextId(ICompareContextIds.COMPARE_DIALOG);
- }
-
- public boolean close() {
- if (super.close()) {
- if (fCompareEditorInput != null)
- fCompareEditorInput.addPropertyChangeListener(this);
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- fCommitButton= createButton(parent, IDialogConstants.OK_ID, Utilities.getString("CompareDialog.commitAction.label"), true); //$NON-NLS-1$
- fCommitButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (fCommitButton != null && fCompareEditorInput != null)
- fCommitButton.setEnabled(fCompareEditorInput.isSaveNeeded());
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent2) {
-
- Composite parent= (Composite) super.createDialogArea(parent2);
-
- Control c= fCompareEditorInput.createContents(parent);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Shell shell= c.getShell();
- shell.setText(fCompareEditorInput.getTitle());
- shell.setImage(fCompareEditorInput.getTitleImage());
- applyDialogFont(parent);
- return parent;
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- public int open() {
-
- int rc= super.open();
-
- if (rc == OK && fCompareEditorInput.isSaveNeeded()) {
-
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws CoreException {
- fCompareEditorInput.saveChanges(pm);
- }
- };
-
- Shell shell= getParentShell();
- ProgressMonitorDialog pmd= new ProgressMonitorDialog(shell);
- try {
- operation.run(pmd.getProgressMonitor());
-
- } catch (InterruptedException x) {
- // NeedWork
- } catch (OperationCanceledException x) {
- // NeedWork
- } catch (InvocationTargetException x) {
- String title= Utilities.getString("CompareDialog.saveErrorTitle"); //$NON-NLS-1$
- String msg= Utilities.getString("CompareDialog.saveErrorMessage"); //$NON-NLS-1$
- MessageDialog.openError(shell, title, msg + x.getTargetException().getMessage());
- }
- }
-
- return rc;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
deleted file mode 100644
index d7caece31..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.compare.*;
-
-
-/**
- * A CompareEditor takes a ICompareEditorInput as input.
- * Most functionality is delegated to the ICompareEditorInput.
- */
-public class CompareEditor extends EditorPart implements IReusableEditor {
-
- /**
- * Internal property change listener for handling changes in the editor's input.
- */
- class PropertyChangeListener implements IPropertyChangeListener {
- /*
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- CompareEditor.this.propertyChange(event);
- }
- }
-
- public final static String CONFIRM_SAVE_PROPERTY= "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY"; //$NON-NLS-1$
-
- private IActionBars fActionBars;
- /** The editor's property change listener. */
- private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
- /** the SWT control */
- private Control fControl;
- /** the outline page */
- private CompareOutlinePage fOutlinePage;
- /** enable outline */
-
-
- public CompareEditor() {
- }
-
- /** (non-Javadoc)
- * Method declared on IAdaptable
- */
- public Object getAdapter(Class key) {
-
- if (key.equals(IContentOutlinePage.class)) {
- Object object= getCompareConfiguration().getProperty(CompareConfiguration.USE_OUTLINE_VIEW);
- if (object instanceof Boolean && ((Boolean)object).booleanValue()) {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput) {
- fOutlinePage= new CompareOutlinePage((CompareEditorInput) input);
- return fOutlinePage;
- }
- }
- }
- return super.getAdapter(key);
- }
-
- /* package */ CompareConfiguration getCompareConfiguration() {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput)
- return ((CompareEditorInput)input).getCompareConfiguration();
- return null;
- }
-
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
-
- if (!(input instanceof CompareEditorInput))
- throw new PartInitException(Utilities.getString("CompareEditor.invalidInput")); //$NON-NLS-1$
-
- setSite(site);
- setInput(input);
- }
-
- public void setInput(IEditorInput input) {
- try {
- doSetInput(input);
- } catch (CoreException x) {
- String title= Utilities.getString("CompareEditor.error.setinput.title"); //$NON-NLS-1$
- String msg= Utilities.getString("CompareEditor.error.setinput.message"); //$NON-NLS-1$
- ErrorDialog.openError(getSite().getShell(), title, msg, x.getStatus());
- }
- }
-
- public void doSetInput(IEditorInput input) throws CoreException {
-
- if (!(input instanceof CompareEditorInput)) {
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, Utilities.getString("CompareEditor.invalidInput"), null); //$NON-NLS-1$
- throw new CoreException(s);
- }
-
- IEditorInput oldInput= getEditorInput();
- if (oldInput instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
-
- super.setInput(input);
-
- CompareEditorInput cei= (CompareEditorInput) input;
-
- setTitleImage(cei.getTitleImage());
- setTitle(cei.getTitle());
-
- if (input instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).addPropertyChangeListener(fPropertyChangeListener);
-
- if (oldInput != null) {
- if (fControl != null && !fControl.isDisposed()) {
- Point oldSize= fControl.getSize();
- Composite parent= fControl.getParent();
- fControl.dispose();
- createPartControl(parent);
- if (fControl != null)
- fControl.setSize(oldSize);
- }
- }
- }
-
- public IActionBars getActionBars() {
- return fActionBars;
- }
-
- public void setActionBars(IActionBars actionBars) {
- fActionBars= actionBars;
- }
-
- /*
- * @see IDesktopPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- parent.setData(this);
-
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput) {
- fControl= ((CompareEditorInput) input).createContents(parent);
- WorkbenchHelp.setHelp(fControl, ICompareContextIds.COMPARE_EDITOR);
- }
- }
-
- /*
- * @see DesktopPart#dispose
- */
- public void dispose() {
-
- IEditorInput input= getEditorInput();
- if (input instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
-
- super.dispose();
-
- fPropertyChangeListener= null;
- }
-
- /*
- * @see IDesktopPart#setFocus
- */
- public void setFocus() {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput)
- ((CompareEditorInput)input).setFocus();
- }
-
- /**
- * Returns false because the editor doesn't support "Save As...".
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- public void gotoMarker(IMarker marker) {
- }
-
- /**
- * Always throws an AssertionFailedException.
- */
- /*
- * @see IEditorPart#doSaveAs()
- */
- public void doSaveAs() {
- Assert.isTrue(false); // Save As not supported for CompareEditor
- }
-
- /*
- * @see IEditorPart#doSave()
- */
- public void doSave(IProgressMonitor progressMonitor) {
-
- final IEditorInput input= getEditorInput();
-
- 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(progressMonitor);
-
- firePropertyChange(PROP_DIRTY);
-
- } catch (InterruptedException x) {
- // NeedWork
- } catch (OperationCanceledException x) {
- // NeedWork
- } catch (InvocationTargetException x) {
- String title= Utilities.getString("CompareEditor.saveError.title"); //$NON-NLS-1$
- String reason= x.getTargetException().getMessage();
- MessageDialog.openError(shell, title, Utilities.getFormattedString("CompareEditor.cantSaveError", reason)); //$NON-NLS-1$
- }
- }
-
- /*
- * @see IEditorPart#isDirty()
- */
- public boolean isDirty() {
- IEditorInput input= getEditorInput();
- if (input instanceof CompareEditorInput)
- return ((CompareEditorInput)input).isSaveNeeded();
- return false;
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- Object old_value= event.getOldValue();
- Object new_value= event.getNewValue();
- if (old_value == null || new_value == null || !old_value.equals(new_value))
- firePropertyChange(PROP_DIRTY);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
deleted file mode 100644
index 254d0d395..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
+++ /dev/null
@@ -1,105 +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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-import org.eclipse.compare.*;
-
-
-public class CompareEditorContributor extends EditorActionBarContributor {
-
- private IEditorPart fActiveEditorPart= null;
-
- private IgnoreWhiteSpaceAction fIgnoreWhitespace;
- private NavigationAction fNext;
- private NavigationAction fPrevious;
-
- private NavigationAction fToolbarNext;
- private NavigationAction fToolbarPrevious;
-
-
- public CompareEditorContributor() {
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
-
- fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, null);
- WorkbenchHelp.setHelp(fIgnoreWhitespace, ICompareContextIds.IGNORE_WHITESPACE_ACTION);
-
- fNext= new NavigationAction(bundle, true);
- WorkbenchHelp.setHelp(fNext, ICompareContextIds.GLOBAL_NEXT_DIFF_ACTION);
-
- fPrevious= new NavigationAction(bundle, false);
- WorkbenchHelp.setHelp(fPrevious, ICompareContextIds.GLOBAL_PREVIOUS_DIFF_ACTION);
-
- fToolbarNext= new NavigationAction(bundle, true);
- WorkbenchHelp.setHelp(fToolbarNext, ICompareContextIds.NEXT_DIFF_ACTION);
-
- fToolbarPrevious= new NavigationAction(bundle, false);
- WorkbenchHelp.setHelp(fToolbarPrevious, ICompareContextIds.PREVIOUS_DIFF_ACTION);
- }
-
- /*
- * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager)
- */
- public void contributeToToolBar(IToolBarManager tbm) {
- tbm.add(new Separator());
- tbm.add(fIgnoreWhitespace);
- tbm.add(fToolbarNext);
- tbm.add(fToolbarPrevious);
- }
-
- /*
- * @see EditorActionBarContributor#contributeToMenu(IMenuManager)
- */
- public void contributeToMenu(IMenuManager menuManager) {
- }
-
- public void setActiveEditor(IEditorPart targetEditor) {
-
- if (fActiveEditorPart == targetEditor)
- return;
-
- fActiveEditorPart= targetEditor;
-
- if (fActiveEditorPart != null) {
- IEditorInput input= fActiveEditorPart.getEditorInput();
- if (input instanceof CompareEditorInput) {
- CompareEditorInput compareInput= (CompareEditorInput) input;
- fNext.setCompareEditorInput(compareInput);
- fPrevious.setCompareEditorInput(compareInput);
- // Begin fix http://bugs.eclipse.org/bugs/show_bug.cgi?id=20105
- fToolbarNext.setCompareEditorInput(compareInput);
- fToolbarPrevious.setCompareEditorInput(compareInput);
- // End fix http://bugs.eclipse.org/bugs/show_bug.cgi?id=20105
- }
- }
-
- if (targetEditor instanceof CompareEditor) {
- IActionBars actionBars= getActionBars();
-
- CompareEditor editor= (CompareEditor) targetEditor;
- editor.setActionBars(actionBars);
-
- actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNext);
- actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPrevious);
-
- CompareConfiguration cc= editor.getCompareConfiguration();
- fIgnoreWhitespace.setCompareConfiguration(cc);
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
deleted file mode 100644
index 5d1b1ae91..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.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.compare.internal;
-
-import java.text.MessageFormat;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IStatus;
-
-
-public class CompareFilter {
- private static final char[][] NO_CHAR_CHAR= new char[0][];
-
- private char[][] fExtraResourceFileFilters;
- private String[] fExtraResourceFolderFilters;
-
-
- public CompareFilter() {
- }
-
- public boolean filter(String path0, boolean folder, boolean isArchive) {
- if (!folder && fExtraResourceFileFilters != null) {
- char[] name= path0.toCharArray();
- for (int i= 0, l= fExtraResourceFileFilters.length; i < l; i++)
- if (match(fExtraResourceFileFilters[i], name, true))
- return true;
- }
- if (folder && fExtraResourceFolderFilters != null) {
- for (int i= 0, l= fExtraResourceFolderFilters.length; i < l; i++)
- if (fExtraResourceFolderFilters[0].equals(path0))
- return true;
- }
- return false;
- }
-
- public static String validateResourceFilters(String text) {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- String[] filters= getTokens(text, ","); //$NON-NLS-1$
- for (int i= 0; i < filters.length; i++) {
- String fileName= filters[i].replace('*', 'x');
- int resourceType= IResource.FILE;
- int lastCharacter= fileName.length() - 1;
- if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
- fileName= fileName.substring(0, lastCharacter);
- resourceType= IResource.FOLDER;
- }
- IStatus status= workspace.validateName(fileName, resourceType);
- if (status.matches(IStatus.ERROR)) {
- String format= Utilities.getString("ComparePreferencePage.filter.invalidsegment.error"); //$NON-NLS-1$
- return MessageFormat.format(format, new String[] { status.getMessage() } );
- }
- }
- return null;
- }
-
- public void setFilters(String filterSequence) {
- char[][] filters= filterSequence != null && filterSequence.length() > 0
- ? splitAndTrimOn(',', filterSequence.toCharArray())
- : null;
- if (filters == null) {
- fExtraResourceFileFilters= null;
- fExtraResourceFolderFilters= null;
- } else {
- int fileCount= 0, folderCount= 0;
- for (int i= 0, l= filters.length; i < l; i++) {
- char[] f= filters[i];
- if (f.length == 0)
- continue;
- if (f[f.length - 1] == '/')
- folderCount++;
- else
- fileCount++;
- }
- fExtraResourceFileFilters= new char[fileCount][];
- fExtraResourceFolderFilters= new String[folderCount];
- for (int i= 0, l= filters.length; i < l; i++) {
- char[] f= filters[i];
- if (f.length == 0)
- continue;
- if (f[f.length - 1] == '/')
- fExtraResourceFolderFilters[--folderCount]= new String(subarray(f, 0, f.length - 1));
- else
- fExtraResourceFileFilters[--fileCount]= f;
- }
- }
- }
-
- /////////
-
- private static String[] getTokens(String text, String separator) {
- StringTokenizer tok= new StringTokenizer(text, separator); //$NON-NLS-1$
- int nTokens= tok.countTokens();
- String[] res= new String[nTokens];
- for (int i= 0; i < res.length; i++)
- res[i]= tok.nextToken().trim();
- return res;
- }
-
- /**
- * Answers true if the pattern matches the given name, false otherwise.
- * This char[] pattern matching accepts wild-cards '*' and '?'.
- *
- * When not case sensitive, the pattern is assumed to already be
- * lowercased, the name will be lowercased character per character as
- * comparing. If name is null, the answer is false. If pattern is null, the
- * answer is true if name is not null. <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => true
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '?' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * pattern = { 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param pattern
- * the given pattern
- * @param name
- * the given name
- * @param isCaseSensitive
- * flag to know whether or not the matching should be case
- * sensitive
- * @return true if the pattern matches the given name, false otherwise
- */
- private boolean match(char[] pattern, char[] name, boolean isCaseSensitive) {
- if (name == null)
- return false; // null name cannot match
- if (pattern == null)
- return true; // null pattern is equivalent to '*'
- return match(pattern, 0, pattern.length, name, 0, name.length, isCaseSensitive);
- }
-
- /**
- * Answers true if the a sub-pattern matches the subpart of the given name,
- * false otherwise. char[] pattern matching, accepting wild-cards '*' and
- * '?'. Can match only subset of name/pattern. end positions are
- * non-inclusive. The subpattern is defined by the patternStart and
- * pattternEnd positions. When not case sensitive, the pattern is assumed
- * to already be lowercased, the name will be lowercased character per
- * character as comparing. <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 3 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 4 isCaseSensitive = true result => true
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 2 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 2 isCaseSensitive = true result => false
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param pattern
- * the given pattern
- * @param patternStart
- * the given pattern start
- * @param patternEnd
- * the given pattern end
- * @param name
- * the given name
- * @param nameStart
- * the given name start
- * @param nameEnd
- * the given name end
- * @param isCaseSensitive
- * flag to know if the matching should be case sensitive
- * @return true if the a sub-pattern matches the subpart of the given name,
- * false otherwise
- */
- private boolean match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd,
- boolean isCaseSensitive) {
- if (name == null)
- return false; // null name cannot match
- if (pattern == null)
- return true; // null pattern is equivalent to '*'
- int iPattern= patternStart;
- int iName= nameStart;
- if (patternEnd < 0)
- patternEnd= pattern.length;
- if (nameEnd < 0)
- nameEnd= name.length;
- /* check first segment */
- char patternChar= 0;
- while ((iPattern < patternEnd) && (patternChar= pattern[iPattern]) != '*') {
- if (iName == nameEnd)
- return false;
- if (patternChar != (isCaseSensitive ? name[iName] : Character.toLowerCase(name[iName])) && patternChar != '?') {
- return false;
- }
- iName++;
- iPattern++;
- }
- /* check sequence of star+segment */
- int segmentStart;
- if (patternChar == '*') {
- segmentStart= ++iPattern; // skip star
- } else {
- segmentStart= 0; // force iName check
- }
- int prefixStart= iName;
- checkSegment : while (iName < nameEnd) {
- if (iPattern == patternEnd) {
- iPattern= segmentStart; // mismatch - restart current segment
- iName= ++prefixStart;
- continue checkSegment;
- }
- /* segment is ending */
- if ((patternChar= pattern[iPattern]) == '*') {
- segmentStart= ++iPattern; // skip start
- if (segmentStart == patternEnd) {
- return true;
- }
- prefixStart= iName;
- continue checkSegment;
- }
- /* check current name character */
- if ((isCaseSensitive ? name[iName] : Character.toLowerCase(name[iName])) != patternChar && patternChar != '?') {
- iPattern= segmentStart; // mismatch - restart current segment
- iName= ++prefixStart;
- continue checkSegment;
- }
- iName++;
- iPattern++;
- }
- return (segmentStart == patternEnd) || (iName == nameEnd && iPattern == patternEnd)
- || (iPattern == patternEnd - 1 && pattern[iPattern] == '*');
- }
-
- /**
- * Return a new array which is the split of the given array using the given
- * divider and triming each subarray to remove whitespaces equals to ' '.
- * <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * divider = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * divider = 'b' array = { 'a' , ' ', 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * divider = 'c' array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param divider
- * the given divider
- * @param array
- * the given array
- * @return a new array which is the split of the given array using the
- * given divider and triming each subarray to remove whitespaces
- * equals to ' '
- */
- private char[][] splitAndTrimOn(char divider, char[] array) {
- int length= array == null ? 0 : array.length;
- if (length == 0)
- return NO_CHAR_CHAR;
- int wordCount= 1;
- for (int i= 0; i < length; i++)
- if (array[i] == divider)
- wordCount++;
- char[][] split= new char[wordCount][];
- int last= 0, currentWord= 0;
- for (int i= 0; i < length; i++) {
- if (array[i] == divider) {
- int start= last, end= i - 1;
- while (start < i && array[start] == ' ')
- start++;
- while (end > start && array[end] == ' ')
- end--;
- split[currentWord]= new char[end - start + 1];
- System.arraycopy(array, start, split[currentWord++], 0, end - start + 1);
- last= i + 1;
- }
- }
- int start= last, end= length - 1;
- while (start < length && array[start] == ' ')
- start++;
- while (end > start && array[end] == ' ')
- end--;
- split[currentWord]= new char[end - start + 1];
- System.arraycopy(array, start, split[currentWord++], 0, end - start + 1);
- return split;
- }
-
- /**
- * Answers a new array which is a copy of the given array starting at the
- * given start and ending at the given end. The given start is inclusive
- * and the given end is exclusive. Answers null if start is greater than
- * end, if start is lower than 0 or if end is greater than the length of
- * the given array. If end equals -1, it is converted to the array length.
- * <br><br>For example:
- * <ol>
- * <li>
- *
- * <pre>
- * array = { 'a' , 'b' } start = 0 end = 1 result => { 'a' }
- * </pre>
- *
- *
- * </li>
- * <li>
- *
- * <pre>
- * array = { 'a', 'b' } start = 0 end = -1 result => { 'a' , 'b' }
- * </pre>
- *
- *
- * </li>
- * </ol>
- *
- * @param array
- * the given array
- * @param start
- * the given starting index
- * @param end
- * the given ending index
- * @return a new array which is a copy of the given array starting at the
- * given start and ending at the given end
- * @exception NullPointerException
- * if the given array is null
- */
- private char[] subarray(char[] array, int start, int end) {
- if (end == -1)
- end= array.length;
- if (start > end)
- return null;
- if (start < 0)
- return null;
- if (end > array.length)
- return null;
- char[] result= new char[end - start];
- System.arraycopy(array, start, result, 0, end - start);
- return result;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java
deleted file mode 100644
index b6fb85fd5..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class CompareMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.compare.internal.CompareMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private CompareMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
deleted file mode 100644
index e29774d71..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
+++ /dev/null
@@ -1,58 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-ComparePlugin.internal_error= Internal Error
-ExceptionDialog.seeErrorLogMessage= See error log for more details.
-
-#
-# Title format for CompareViewerSwitchingPane
-#
-CompareViewerSwitchingPane.Titleformat= {0} ({1})
-
-#
-# Title message for StructureDiffViewer if no structural differences could be found
-#
-StructureDiffViewer.NoStructuralDifferences= No Structural Differences
-StructureDiffViewer.StructureError= Can't Compare Structures
-
-#
-# TextMergeViewer
-#
-TextMergeViewer.cursorPosition.format= {0} : {1}
-
-TextMergeViewer.beforeLine.format= before line {0}
-TextMergeViewer.range.format= {0} : {1}
-
-TextMergeViewer.changeType.addition= addition
-TextMergeViewer.changeType.deletion= deletion
-TextMergeViewer.changeType.change= change
-
-TextMergeViewer.direction.outgoing= outgoing
-TextMergeViewer.direction.incoming= incoming
-TextMergeViewer.direction.conflicting= conflicting
-
-TextMergeViewer.diffType.format= {0} {1}
-
-TextMergeViewer.diffDescription.noDiff.format= no diff
-TextMergeViewer.diffDescription.diff.format= {0} #{1} (Left: {2}, Right: {3})
-TextMergeViewer.statusLine.format= Left: {0}, Right: {1}, {2}
-
-TextMergeViewer.atEnd.title= Go to Next Difference
-TextMergeViewer.atEnd.message= End of document reached. Continue at beginning?
-
-TextMergeViewer.atBeginning.title= Go to Previous Difference
-TextMergeViewer.atBeginning.message= Beginning of document reached. Continue at end?
-
-CompareNavigator.atEnd.title= Go to Next Difference
-CompareNavigator.atEnd.message= Last difference reached.
-
-CompareNavigator.atBeginning.title= Go to Previous Difference
-CompareNavigator.atBeginning.message= First difference reached.
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java
deleted file mode 100644
index a5f28495c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.*;
-
-/**
- * Supports cross-pane navigation through differences.
- * XXX: Design is as it is because the feature had to be added without touching API.
- */
-public class CompareNavigator implements ICompareNavigator {
-
- private boolean fLastDirection= true;
- private CompareViewerSwitchingPane[] fPanes;
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- private boolean fNextFirstTime= true;
-
- public CompareNavigator(CompareViewerSwitchingPane[] panes) {
- fPanes= panes;
- }
-
- public CompareViewerSwitchingPane[] getPanes() {
- return fPanes;
- }
-
- public boolean selectChange(boolean next) {
-
- fLastDirection= next;
-
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- if (next && fNextFirstTime && mustOpen()) {
- fNextFirstTime= false;
- openElement();
- }
-
- // find most down stream CompareViewerPane
- int n= 0;
- INavigatable[] navigators= new INavigatable[4];
- for (int i= 0; i < fPanes.length; i++) {
- navigators[n]= getNavigator(fPanes[i]);
- if (navigators[n] != null)
- n++;
- }
-
- while (n > 0) {
- n--;
- if (navigators[n].gotoDifference(next)) {
- // at end of this navigator
- continue;
- } else // not at end
- return false;
- }
-
- return true;
- }
-
- private static INavigatable getNavigator(CompareViewerSwitchingPane pane) {
- if (pane == null)
- return null;
- if (pane.isEmpty())
- return null;
- Viewer viewer= pane.getViewer();
- if (viewer == null)
- return null;
- Control control= viewer.getControl();
- if (control == null)
- return null;
- Object data= control.getData(INavigatable.NAVIGATOR_PROPERTY);
- if (data instanceof INavigatable)
- return (INavigatable) data;
- return null;
- }
-
- private static CompareNavigator findNavigator(Control c) {
- while (c != null && !c.isDisposed()) { // PR 1GEUVV2
- Object data= c.getData();
- if (data instanceof CompareEditorInput) {
- CompareEditorInput cei= (CompareEditorInput) data;
- Object adapter= cei.getAdapter(CompareNavigator.class);
- if (adapter instanceof CompareNavigator)
- return (CompareNavigator)adapter;
- }
- c= c.getParent();
- }
- return null;
- }
-
- private boolean resetDirection() {
- boolean last= fLastDirection;
- fLastDirection= true;
- return last;
- }
-
- public static boolean getDirection(Control c) {
- CompareNavigator nav= findNavigator(c);
- if (nav != null)
- return nav.resetDirection();
- return true;
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private boolean mustOpen() {
- if (fPanes == null || fPanes.length == 0)
- return false;
- for (int i= 1; i < fPanes.length; i++) {
- CompareViewerSwitchingPane pane= fPanes[i];
- if (pane != null && pane.getInput() != null)
- return false;
- }
- return true;
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private void openElement() {
- if (fPanes == null || fPanes.length == 0)
- return;
- IOpenable openable= getOpenable(fPanes[0]);
- if (openable != null) {
- openable.openSelected();
- }
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private static IOpenable getOpenable(CompareViewerSwitchingPane pane) {
- if (pane == null)
- return null;
- if (pane.isEmpty())
- return null;
- Viewer viewer= pane.getViewer();
- if (viewer == null)
- return null;
- Control control= viewer.getControl();
- if (control == null)
- return null;
- Object data= control.getData(IOpenable.OPENABLE_PROPERTY);
- if (data instanceof IOpenable)
- return (IOpenable) data;
- return null;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
deleted file mode 100644
index bc599075d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.CompareEditorInput;
-
-/**
- */
-public class CompareOutlinePage implements IContentOutlinePage {
-
- private Control fControl;
- private ListenerList fListeners= new ListenerList();
- private ISelection fSelection;
- //private IActionBars fActionBars;
- private CompareEditorInput fCompareEditorInput;
-
- CompareOutlinePage(CompareEditorInput input) {
- fCompareEditorInput= input;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- if (fCompareEditorInput != null) {
- fControl= fCompareEditorInput.createOutlineContents(parent, SWT.VERTICAL);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#dispose()
- */
- public void dispose() {
- if (fControl != null)
- fControl.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#getControl()
- */
- public Control getControl() {
- return fControl;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- //fActionBars= actionBars;
- //if (fControl != null)
- // fControl.setData("actionBars", actionBars);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setFocus()
- */
- public void setFocus() {
- if (fControl != null)
- fControl.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return fSelection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- fListeners.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection) {
- fSelection= selection;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
deleted file mode 100644
index 116874914..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
+++ /dev/null
@@ -1,384 +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.compare.internal;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-public class ComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- class FakeInput implements ITypedElement, IEncodedStreamContentAccessor {
- static final String UTF_16= "UTF-16"; //$NON-NLS-1$
- String fContent;
-
- FakeInput(String name) {
- fContent= loadPreviewContentFromFile(name);
- }
- public Image getImage() {
- return null;
- }
- public String getName() {
- return "no name"; //$NON-NLS-1$
- }
- public String getType() {
- return "no type"; //$NON-NLS-1$
- }
- public InputStream getContents() {
- return new ByteArrayInputStream(Utilities.getBytes(fContent, UTF_16));
- }
- public String getCharset() {
- return UTF_16;
- }
- }
-
- private static final String PREFIX= CompareUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
- public static final String OPEN_STRUCTURE_COMPARE= PREFIX + "OpenStructureCompare"; //$NON-NLS-1$
- public static final String SYNCHRONIZE_SCROLLING= PREFIX + "SynchronizeScrolling"; //$NON-NLS-1$
- public static final String SHOW_PSEUDO_CONFLICTS= PREFIX + "ShowPseudoConflicts"; //$NON-NLS-1$
- public static final String INITIALLY_SHOW_ANCESTOR_PANE= PREFIX + "InitiallyShowAncestorPane"; //$NON-NLS-1$
- public static final String PREF_SAVE_ALL_EDITORS= PREFIX + "SaveAllEditors"; //$NON-NLS-1$
- public static final String SHOW_MORE_INFO= PREFIX + "ShowMoreInfo"; //$NON-NLS-1$
- public static final String IGNORE_WHITESPACE= PREFIX + "IgnoreWhitespace"; //$NON-NLS-1$
- //public static final String USE_SPLINES= PREFIX + "UseSplines"; //$NON-NLS-1$
- public static final String USE_SINGLE_LINE= PREFIX + "UseSingleLine"; //$NON-NLS-1$
- //public static final String USE_RESOLVE_UI= PREFIX + "UseResolveUI"; //$NON-NLS-1$
- public static final String PATH_FILTER= PREFIX + "PathFilter"; //$NON-NLS-1$
-
-
- private TextMergeViewer fPreviewViewer;
- private IPropertyChangeListener fPreferenceChangeListener;
- private CompareConfiguration fCompareConfiguration;
- private OverlayPreferenceStore fOverlayStore;
- private Map fCheckBoxes= new HashMap();
- private SelectionListener fCheckBoxListener;
-
-
- public final OverlayPreferenceStore.OverlayKey[] fKeys= new OverlayPreferenceStore.OverlayKey[] {
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, OPEN_STRUCTURE_COMPARE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SYNCHRONIZE_SCROLLING),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_PSEUDO_CONFLICTS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, INITIALLY_SHOW_ANCESTOR_PANE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_MORE_INFO),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PREF_SAVE_ALL_EDITORS),
-
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT),
-
- //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SPLINES),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SINGLE_LINE),
- //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_RESOLVE_UI),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PATH_FILTER),
- };
-
-
- public static void initDefaults(IPreferenceStore store) {
- store.setDefault(OPEN_STRUCTURE_COMPARE, true);
- store.setDefault(SYNCHRONIZE_SCROLLING, true);
- store.setDefault(SHOW_PSEUDO_CONFLICTS, false);
- store.setDefault(INITIALLY_SHOW_ANCESTOR_PANE, false);
- store.setDefault(SHOW_MORE_INFO, false);
- store.setDefault(IGNORE_WHITESPACE, false);
- store.setDefault(PREF_SAVE_ALL_EDITORS, false);
- //store.setDefault(USE_SPLINES, false);
- store.setDefault(USE_SINGLE_LINE, true);
- //store.setDefault(USE_RESOLVE_UI, false);
- store.setDefault(PATH_FILTER, ""); //$NON-NLS-1$
-
- store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true);
- }
-
- public ComparePreferencePage() {
-
- //setDescription(Utilities.getString("ComparePreferencePage.description")); //$NON-NLS-1$
-
- setPreferenceStore(CompareUIPlugin.getDefault().getPreferenceStore());
-
- fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), fKeys);
- fPreferenceChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String key= event.getProperty();
- if (key.equals(INITIALLY_SHOW_ANCESTOR_PANE)) {
- boolean b= fOverlayStore.getBoolean(INITIALLY_SHOW_ANCESTOR_PANE);
- if (fCompareConfiguration != null) {
- fCompareConfiguration.setProperty(INITIALLY_SHOW_ANCESTOR_PANE, new Boolean(b));
- }
- }
- }
- };
- fOverlayStore.addPropertyChangeListener(fPreferenceChangeListener);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init()
- */
- public void init(IWorkbench workbench) {
- }
-
- /*
- * @see PreferencePage#performOk()
- */
- public boolean performOk() {
- fOverlayStore.propagate();
- return true;
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
-
- fOverlayStore.loadDefaults();
- initializeFields();
-
- super.performDefaults();
- }
-
- /*
- * @see DialogPage#dispose()
- */
- public void dispose() {
-
- if (fOverlayStore != null) {
- if (fPreferenceChangeListener != null) {
- fOverlayStore.removePropertyChangeListener(fPreferenceChangeListener);
- fPreferenceChangeListener= null;
- }
- fOverlayStore.stop();
- fOverlayStore= null;
- }
-
- super.dispose();
- }
-
- static public boolean getSaveAllEditors() {
- IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(PREF_SAVE_ALL_EDITORS);
- }
-
- static public void setSaveAllEditors(boolean value) {
- IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
- store.setValue(PREF_SAVE_ALL_EDITORS, value);
- }
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- WorkbenchHelp.setHelp(parent, ICompareContextIds.COMPARE_PREFERENCE_PAGE);
-
- fOverlayStore.load();
- fOverlayStore.start();
-
- TabFolder folder= new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem item= new TabItem(folder, SWT.NONE);
- item.setText(Utilities.getString("ComparePreferencePage.generalTab.label")); //$NON-NLS-1$
- //item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
- item.setControl(createGeneralPage(folder));
-
- item= new TabItem(folder, SWT.NONE);
- item.setText(Utilities.getString("ComparePreferencePage.textCompareTab.label")); //$NON-NLS-1$
- //item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
- item.setControl(createTextComparePage(folder));
-
- initializeFields();
- Dialog.applyDialogFont(folder);
- return folder;
- }
-
- private Control createGeneralPage(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 1;
- composite.setLayout(layout);
-
- addCheckBox(composite, "ComparePreferencePage.structureCompare.label", OPEN_STRUCTURE_COMPARE, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.showMoreInfo.label", SHOW_MORE_INFO, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.ignoreWhitespace.label", IGNORE_WHITESPACE, 0); //$NON-NLS-1$
-
- // a spacer
- new Label(composite, SWT.NONE);
-
- addCheckBox(composite, "ComparePreferencePage.saveBeforePatching.label", PREF_SAVE_ALL_EDITORS, 0); //$NON-NLS-1$
-
- // a spacer
- new Label(composite, SWT.NONE);
-
- Label l= new Label(composite, SWT.WRAP);
- l.setText(Utilities.getString("ComparePreferencePage.filter.description")); //$NON-NLS-1$
-
- Composite c2= new Composite(composite, SWT.NONE);
- c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- layout= new GridLayout(2, false);
- layout.marginWidth= 0;
- c2.setLayout(layout);
-
- l= new Label(c2, SWT.NONE);
- l.setText(Utilities.getString("ComparePreferencePage.filter.label")); //$NON-NLS-1$
-
- final Text t= new Text(c2, SWT.BORDER);
- t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- t.setText(fOverlayStore.getString(PATH_FILTER));
- t.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- String filters= t.getText();
- String message= CompareFilter.validateResourceFilters(filters);
- setValid(message == null);
- setMessage(null);
- setErrorMessage(message);
- fOverlayStore.setValue(PATH_FILTER, filters);
- }
- }
- );
-
- return composite;
- }
-
- private Control createTextComparePage(Composite parent) {
-
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 1;
- composite.setLayout(layout);
-
- addCheckBox(composite, "ComparePreferencePage.synchronizeScrolling.label", SYNCHRONIZE_SCROLLING, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.initiallyShowAncestorPane.label", INITIALLY_SHOW_ANCESTOR_PANE, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.showPseudoConflicts.label", SHOW_PSEUDO_CONFLICTS, 0); //$NON-NLS-1$
-
- //addCheckBox(composite, "ComparePreferencePage.useSplines.label", USE_SPLINES, 0); //$NON-NLS-1$
- addCheckBox(composite, "ComparePreferencePage.useSingleLine.label", USE_SINGLE_LINE, 0); //$NON-NLS-1$
- //addCheckBox(composite, "ComparePreferencePage.useResolveUI.label", USE_RESOLVE_UI, 0); //$NON-NLS-1$
-
- // a spacer
- new Label(composite, SWT.NONE);
-
- Label previewLabel= new Label(composite, SWT.NULL);
- previewLabel.setText(Utilities.getString("ComparePreferencePage.preview.label")); //$NON-NLS-1$
-
- Control previewer= createPreviewer(composite);
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.widthHint= convertWidthInCharsToPixels(60);
- gd.heightHint= convertHeightInCharsToPixels(13);
- previewer.setLayoutData(gd);
-
- return composite;
- }
-
- private Control createPreviewer(Composite parent) {
-
- fCompareConfiguration= new CompareConfiguration(fOverlayStore);
- fCompareConfiguration.setAncestorLabel(Utilities.getString("ComparePreferencePage.ancestor.label")); //$NON-NLS-1$
-
- fCompareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.left.label")); //$NON-NLS-1$
- fCompareConfiguration.setLeftEditable(false);
-
- fCompareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$
- fCompareConfiguration.setRightEditable(false);
-
- fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration);
-
- fPreviewViewer.setInput(
- new DiffNode(Differencer.CONFLICTING,
- new FakeInput("ComparePreferencePage.previewAncestor"), //$NON-NLS-1$
- new FakeInput("ComparePreferencePage.previewLeft"), //$NON-NLS-1$
- new FakeInput("ComparePreferencePage.previewRight") //$NON-NLS-1$
- )
- );
-
- Control c= fPreviewViewer.getControl();
- c.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fCompareConfiguration != null)
- fCompareConfiguration.dispose();
- }
- });
-
- return c;
- }
-
- private void initializeFields() {
-
- Iterator e= fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b= (Button) e.next();
- String key= (String) fCheckBoxes.get(b);
- b.setSelection(fOverlayStore.getBoolean(key));
- }
- }
-
- // overlay stuff
-
- private Button addCheckBox(Composite parent, String labelKey, String key, int indentation) {
-
- String label= Utilities.getString(labelKey);
-
- Button checkBox= new Button(parent, SWT.CHECK);
- checkBox.setText(label);
-
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent= indentation;
- gd.horizontalSpan= 2;
- checkBox.setLayoutData(gd);
-
- if (fCheckBoxListener == null) {
- fCheckBoxListener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button= (Button) e.widget;
- fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
- }
- };
- }
- checkBox.addSelectionListener(fCheckBoxListener);
-
- fCheckBoxes.put(checkBox, key);
-
- return checkBox;
- }
-
- private String loadPreviewContentFromFile(String key) {
-
- String preview= Utilities.getString(key);
- String separator= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer buffer= new StringBuffer();
- for (int i= 0; i < preview.length(); i++) {
- char c= preview.charAt(i);
- if (c == '\n')
- buffer.append(separator);
- else
- buffer.append(c);
- }
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
deleted file mode 100644
index 54c544022..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ /dev/null
@@ -1,913 +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.compare.internal;
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.net.*;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * The Compare UI plug-in defines the entry point to initiate a configurable
- * compare operation on arbitrary resources. The result of the compare
- * is opened into a compare editor where the details can be browsed and
- * edited in dynamically selected structure and content viewers.
- * <p>
- * The Compare UI provides a registry for content and structure compare viewers,
- * which is initialized from extensions contributed to extension points
- * declared by this plug-in.
- * <p>
- * This class is the plug-in runtime class for the
- * <code>"org.eclipse.compare"</code> plug-in.
- * </p>
- */
-public final class CompareUIPlugin extends AbstractUIPlugin {
-
- public static final String DTOOL_NEXT= "dlcl16/next_nav.gif"; //$NON-NLS-1$
- public static final String CTOOL_NEXT= "clcl16/next_nav.gif"; //$NON-NLS-1$
- public static final String ETOOL_NEXT= "elcl16/next_nav.gif"; //$NON-NLS-1$
-
- public static final String DTOOL_PREV= "dlcl16/prev_nav.gif"; //$NON-NLS-1$
- public static final String CTOOL_PREV= "clcl16/prev_nav.gif"; //$NON-NLS-1$
- public static final String ETOOL_PREV= "elcl16/prev_nav.gif"; //$NON-NLS-1$
-
- /** Status code describing an internal error */
- public static final int INTERNAL_ERROR= 1;
-
- private static boolean NORMALIZE_CASE= true;
-
- private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private final static String EXTENSIONS_ATTRIBUTE= "extensions"; //$NON-NLS-1$
-
- public static final String PLUGIN_ID= "org.eclipse.compare"; //$NON-NLS-1$
-
- private static final String STRUCTURE_CREATOR_EXTENSION_POINT= "structureCreators"; //$NON-NLS-1$
- private static final String STRUCTURE_MERGEVIEWER_EXTENSION_POINT= "structureMergeViewers"; //$NON-NLS-1$
- private static final String CONTENT_MERGEVIEWER_EXTENSION_POINT= "contentMergeViewers"; //$NON-NLS-1$
- private static final String CONTENT_VIEWER_EXTENSION_POINT= "contentViewers"; //$NON-NLS-1$
-
- private static final String COMPARE_EDITOR= PLUGIN_ID + ".CompareEditor"; //$NON-NLS-1$
-
- private static final String STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME= "StructureViewerAliases"; //$NON-NLS-1$
-
- /** Maps type to icons */
- private static Map fgImages= new Hashtable(10);
- /** Maps type to ImageDescriptors */
- private static Map fgImageDescriptors= new Hashtable(10);
- /** Maps ImageDescriptors to Images */
- private static Map fgImages2= new Hashtable(10);
-
- private static Map fgStructureCreators= new Hashtable(10);
- private static Map fgStructureViewerDescriptors= new Hashtable(10);
- private static Map fgStructureViewerAliases= new Hashtable(10);
- private static Map fgContentViewerDescriptors= new Hashtable(10);
- private static Map fgContentMergeViewerDescriptors= new Hashtable(10);
-
- private static List fgDisposeOnShutdownImages= new ArrayList();
-
- private static ResourceBundle fgResourceBundle;
-
- private static CompareUIPlugin fgComparePlugin;
-
- private CompareFilter fFilter;
- private IPropertyChangeListener fPropertyChangeListener;
-
- /**
- * Creates the <code>CompareUIPlugin</code> object and registers all
- * structure creators, content merge viewers, and structure merge viewers
- * contributed to this plug-in's extension points.
- * <p>
- * Note that instances of plug-in runtime classes are automatically created
- * by the platform in the course of plug-in activation.
- * </p>
- *
- * @param descriptor the plug-in descriptor
- */
- public CompareUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
-
- fgComparePlugin= this;
-
- fgResourceBundle= descriptor.getResourceBundle();
-
- registerExtensions();
-
- initPreferenceStore();
- }
-
- /**
- * @see AbstractUIPlugin#initializeDefaultPreferences
- */
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- super.initializeDefaultPreferences(store);
-
- ComparePreferencePage.initDefaults(store);
- }
-
- /**
- * Registers all structure creators, content merge viewers, and structure merge viewers
- * that are found in the XML plugin files.
- */
- private void registerExtensions() {
- IPluginRegistry registry= Platform.getPluginRegistry();
-
- // collect all IStructureCreators
- IConfigurationElement[] elements= registry.getConfigurationElementsFor(PLUGIN_ID, STRUCTURE_CREATOR_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- final IConfigurationElement conf= elements[i];
- String extensions= conf.getAttribute(EXTENSIONS_ATTRIBUTE);
- registerStructureCreator(extensions,
- new IStructureCreatorDescriptor() {
- public IStructureCreator createStructureCreator() {
- try {
- return (IStructureCreator) conf.createExecutableExtension(CLASS_ATTRIBUTE);
- } catch (CoreException ex) {
- // NeedWork
- }
- return null;
- }
- }
- );
- }
-
- // collect all viewers which define the structure mergeviewer extension point
- elements= registry.getConfigurationElementsFor(PLUGIN_ID, STRUCTURE_MERGEVIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ViewerDescriptor desc= new ViewerDescriptor(elements[i]);
- String ext= desc.getExtension();
- if (ext != null)
- registerStructureViewerDescriptor(desc.getExtension(), desc);
- }
-
- // collect all viewers which define the content mergeviewer extension point
- elements= registry.getConfigurationElementsFor(PLUGIN_ID, CONTENT_MERGEVIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ViewerDescriptor desc= new ViewerDescriptor(elements[i]);
- String ext= desc.getExtension();
- if (ext != null)
- registerContentMergeViewerDescriptor(desc.getExtension(), desc);
- }
-
- // collect all viewers which define the content viewer extension point
- elements= registry.getConfigurationElementsFor(PLUGIN_ID, CONTENT_VIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ViewerDescriptor desc= new ViewerDescriptor(elements[i]);
- String ext= desc.getExtension();
- if (ext != null)
- registerContentViewerDescriptor(desc.getExtension(), desc);
- }
- }
-
- /**
- * Returns the singleton instance of this plug-in runtime class.
- *
- * @return the compare plug-in instance
- */
- public static CompareUIPlugin getDefault() {
- return fgComparePlugin;
- }
-
- /**
- * Returns this plug-in's resource bundle.
- *
- * @return the plugin's resource bundle
- */
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
- public static IWorkbench getActiveWorkbench() {
- CompareUIPlugin plugin= getDefault();
- if (plugin == null)
- return null;
- return plugin.getWorkbench();
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- IWorkbench workbench= getActiveWorkbench();
- if (workbench == null)
- return null;
- return workbench.getActiveWorkbenchWindow();
- }
-
- /**
- * Returns the active workkbench page or <code>null</code> if
- * no active workkbench page can be determined.
- *
- * @return the active workkbench page or <code>null</code> if
- * no active workkbench page can be determined
- */
- private static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window == null)
- return null;
- return window.getActivePage();
- }
-
- /**
- * Returns the SWT Shell of the active workbench window or <code>null</code> if
- * no workbench window is active.
- *
- * @return the SWT Shell of the active workbench window, or <code>null</code> if
- * no workbench window is active
- */
- public static Shell getShell() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window == null)
- return null;
- return window.getShell();
- }
-
- /**
- * 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)
- fgDisposeOnShutdownImages.add(image);
- }
-
- /* (non-Javadoc)
- * Method declared on Plugin.
- * Frees all resources of the compare plug-in.
- */
- public void shutdown() throws CoreException {
-
- /*
- * Converts the aliases into a single string before they are stored
- * in the preference store.
- * The format is:
- * <key> '.' <alias> ' ' <key> '.' <alias> ...
- */
- IPreferenceStore ps= getPreferenceStore();
- if (ps != null) {
- StringBuffer sb= new StringBuffer();
- Iterator iter= fgStructureViewerAliases.keySet().iterator();
- while (iter.hasNext()) {
- String key= (String) iter.next();
- String alias= (String) fgStructureViewerAliases.get(key);
- sb.append(key);
- sb.append('.');
- sb.append(alias);
- sb.append(' ');
- }
- ps.setValue(STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME, sb.toString());
-
- if (fPropertyChangeListener != null) {
- ps.removePropertyChangeListener(fPropertyChangeListener);
- fPropertyChangeListener= null;
- }
- }
-
- super.shutdown();
-
- if (fgDisposeOnShutdownImages != null) {
- Iterator i= fgDisposeOnShutdownImages.iterator();
- while (i.hasNext()) {
- Image img= (Image) i.next();
- if (!img.isDisposed())
- img.dispose();
- }
- fgImages= null;
- }
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare editor on the result.
- *
- * @param input the input on which to open the compare editor
- * @param page the workbench page on which to create a new compare editor
- * @param editor if not null the input is opened in this editor
- * @see CompareEditorInput
- */
- public void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, IReusableEditor editor) {
-
- if (compareResultOK(input)) {
-
- if (editor != null) { // reuse the given editor
- editor.setInput(input);
- return;
- }
-
- if (page == null)
- page= getActivePage();
- if (page != null) {
- // open new CompareEditor on page
- try {
- page.openEditor(input, COMPARE_EDITOR);
- } catch (PartInitException e) {
- MessageDialog.openError(getShell(), Utilities.getString("CompareUIPlugin.openEditorError"), e.getMessage()); //$NON-NLS-1$
- }
- } else {
- MessageDialog.openError(getShell(),
- Utilities.getString("CompareUIPlugin.openEditorError"), //$NON-NLS-1$
- Utilities.getString("CompareUIPlugin.noActiveWorkbenchPage")); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Performs the comparison described by the given input and opens a
- * compare dialog on the result.
- *
- * @param input the input on which to open the compare editor
- * @see CompareEditorInput
- */
- public void openCompareDialog(final CompareEditorInput input) {
-
- if (compareResultOK(input)) {
- CompareDialog dialog= new CompareDialog(getShell(), input);
- dialog.open();
- }
- }
-
- /**
- * @return <code>true</code> if compare result is OK to show, <code>false</code> otherwise
- */
- private boolean compareResultOK(CompareEditorInput input) {
- final Shell shell= getShell();
- try {
-
- // run operation in separate thread and make it canceable
- new ProgressMonitorDialog(shell).run(true, true, input);
-
- String message= input.getMessage();
- if (message != null) {
- MessageDialog.openError(shell, Utilities.getString("CompareUIPlugin.compareFailed"), message); //$NON-NLS-1$
- return false;
- }
-
- if (input.getCompareResult() == null) {
- MessageDialog.openInformation(shell, Utilities.getString("CompareUIPlugin.dialogTitle"), Utilities.getString("CompareUIPlugin.noDifferences")); //$NON-NLS-2$ //$NON-NLS-1$
- return false;
- }
-
- return true;
-
- } catch (InterruptedException x) {
- // cancelled by user
- } catch (InvocationTargetException x) {
- MessageDialog.openError(shell, Utilities.getString("CompareUIPlugin.compareFailed"), x.getTargetException().getMessage()); //$NON-NLS-1$
- }
- return false;
- }
-
- /**
- * Registers an image for the given type.
- */
- private static void registerImage(String type, Image image, boolean dispose) {
- fgImages.put(normalizeCase(type), image);
- if (image != null && dispose) {
- fgDisposeOnShutdownImages.add(image);
- }
- }
-
- /**
- * Registers an image descriptor for the given type.
- *
- * @param type the type
- * @param descriptor the image descriptor
- */
- public static void registerImageDescriptor(String type, ImageDescriptor descriptor) {
- fgImageDescriptors.put(normalizeCase(type), descriptor);
- }
-
- public static ImageDescriptor getImageDescriptor(String relativePath) {
-
- URL installURL= null;
- if (fgComparePlugin != null)
- installURL= fgComparePlugin.getDescriptor().getInstallURL();
-
- if (installURL != null) {
- try {
- URL url= new URL(installURL, Utilities.getIconPath(null) + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- Assert.isTrue(false);
- }
- }
- return null;
- }
-
- /**
- * Returns a shared image for the given type, or a generic image if none
- * has been registered for the given type.
- * <p>
- * Note: Images returned from this method will be automitically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param type the type
- * @return the image
- */
- public static Image getImage(String type) {
-
- type= normalizeCase(type);
-
- boolean dispose= false;
- Image image= null;
- if (type != null)
- image= (Image) fgImages.get(type);
- if (image == null) {
- ImageDescriptor id= (ImageDescriptor) fgImageDescriptors.get(type);
- if (id != null) {
- image= id.createImage();
- dispose= true;
- }
-
- if (image == null) {
- if (fgComparePlugin != null) {
- if (ITypedElement.FOLDER_TYPE.equals(type)) {
- image= getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- //image= SharedImages.getImage(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- image= createWorkbenchImage(type);
- dispose= true;
- }
- } else {
- id= (ImageDescriptor) fgImageDescriptors.get(normalizeCase("file")); //$NON-NLS-1$
- image= id.createImage();
- dispose= true;
- }
- }
- if (image != null)
- registerImage(type, image, dispose);
- }
- return image;
- }
-
- /**
- * Returns a shared image for the given adaptable.
- * This convenience method queries the given adaptable
- * for its <code>IWorkbenchAdapter.getImageDescriptor</code>, which it
- * uses to create an image if it does not already have one.
- * <p>
- * Note: Images returned from this method will be automitically disposed
- * of when this plug-in shuts down. Callers must not dispose of these
- * images themselves.
- * </p>
- *
- * @param adaptable the adaptable for which to find an image
- * @return an image
- */
- public static Image getImage(IAdaptable adaptable) {
- if (adaptable != null) {
- Object o= adaptable.getAdapter(IWorkbenchAdapter.class);
- if (o instanceof IWorkbenchAdapter) {
- ImageDescriptor id= ((IWorkbenchAdapter) o).getImageDescriptor(adaptable);
- if (id != null) {
- Image image= (Image)fgImages2.get(id);
- if (image == null) {
- image= id.createImage();
- try {
- fgImages2.put(id, image);
- } catch (NullPointerException ex) {
- // NeedWork
- }
- fgDisposeOnShutdownImages.add(image);
-
- }
- return image;
- }
- }
- }
- return null;
- }
-
- private static Image createWorkbenchImage(String type) {
- IEditorRegistry er= getDefault().getWorkbench().getEditorRegistry();
- ImageDescriptor id= er.getImageDescriptor("foo." + type); //$NON-NLS-1$
- return id.createImage();
- }
-
- /**
- * Registers the given structure creator descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param descriptor the descriptor to register
- */
- public static void registerStructureCreator(String types, IStructureCreatorDescriptor descriptor) {
- if (types != null) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgStructureCreators.put(normalizeCase(extension), descriptor);
- }
- }
- }
-
- /**
- * Returns an structure creator descriptor for the given type.
- *
- * @param type the type for which to find a descriptor
- * @return a descriptor for the given type, or <code>null</code> if no
- * descriptor has been registered
- */
- public static IStructureCreatorDescriptor getStructureCreator(String type) {
- return (IStructureCreatorDescriptor) fgStructureCreators.get(normalizeCase(type));
- }
-
- /**
- * Registers the given structure viewer descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param the descriptor to register
- */
- public static void registerStructureViewerDescriptor(String types, IViewerDescriptor descriptor) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgStructureViewerDescriptors.put(normalizeCase(extension), descriptor);
- }
- }
-
- /**
- * Registers the given content merge viewer descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param descriptor the descriptor to register
- */
- public static void registerContentMergeViewerDescriptor(String types, IViewerDescriptor descriptor) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgContentMergeViewerDescriptors.put(normalizeCase(extension), descriptor);
- }
- }
-
- /**
- * Registers the given content viewer descriptor for one or more types.
- *
- * @param types one or more types separated by commas and whitespace
- * @param descriptor the descriptor to register
- */
- public static void registerContentViewerDescriptor(String types, IViewerDescriptor descriptor) {
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String extension= tokenizer.nextToken().trim();
- fgContentViewerDescriptors.put(normalizeCase(extension), descriptor);
- }
- }
-
- /**
- * Returns a structure compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input, the old viewer
- * is returned. Otherwise, the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a structure compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a structure viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
- CompareConfiguration configuration) {
-
- if (input.getLeft() == null || input.getRight() == null) // we don't show the structure of additions or deletions
- return null;
-
- String[] types= getTypes(input);
- if (!isHomogenous(types))
- return null;
- String type= types[0];
-
- type= normalizeCase(type);
-
- IViewerDescriptor vd= (IViewerDescriptor) fgStructureViewerDescriptors.get(type);
- if (vd == null) {
- String alias= (String) fgStructureViewerAliases.get(type);
- if (alias != null)
- vd= (IViewerDescriptor) fgStructureViewerDescriptors.get(alias);
- }
- if (vd != null)
- return vd.createViewer(oldViewer, parent, configuration);
-
- IStructureCreatorDescriptor scc= getStructureCreator(type);
- if (scc != null) {
- IStructureCreator sc= scc.createStructureCreator();
- if (sc != null) {
- StructureDiffViewer sdv= new StructureDiffViewer(parent, configuration);
- sdv.setStructureCreator(sc);
- return sdv;
- }
- }
- return null;
- }
-
- /**
- * Returns a content compare viewer based on an old viewer and an input object.
- * If the old viewer is suitable for showing the input the old viewer
- * is returned. Otherwise the input's type is used to find a viewer descriptor in the registry
- * which in turn is used to create a content compare viewer under the given parent composite.
- * If no viewer descriptor can be found <code>null</code> is returned.
- *
- * @param oldViewer a new viewer is only created if this old viewer cannot show the given input
- * @param input the input object for which to find a content viewer
- * @param parent the SWT parent composite under which the new viewer is created
- * @param configuration a configuration which is passed to a newly created viewer
- * @return the compare viewer which is suitable for the given input object or <code>null</code>
- */
- public static Viewer findContentViewer(Viewer oldViewer, Object in, Composite parent, CompareConfiguration cc) {
-
- if (in instanceof IStreamContentAccessor) {
- String type= ITypedElement.TEXT_TYPE;
-
- if (in instanceof ITypedElement) {
- ITypedElement tin= (ITypedElement) in;
- String ty= tin.getType();
- if (ty != null)
- type= ty;
- }
- type= normalizeCase(type);
-
- IViewerDescriptor vd= (IViewerDescriptor) fgContentViewerDescriptors.get(type);
- Viewer viewer= null;
- if (vd != null) {
- viewer= vd.createViewer(oldViewer, parent, cc);
- if (viewer != null)
- return viewer;
- }
- // fallback
- return new SimpleTextViewer(parent);
- }
-
- if (!(in instanceof ICompareInput))
- return null;
-
- ICompareInput input= (ICompareInput) in;
- String[] types= getTypes(input);
- String type= null;
- if (isHomogenous(types))
- type= types[0];
-
- if (ITypedElement.FOLDER_TYPE.equals(type))
- return null;
-
- if (type == null) {
- int n= 0;
- for (int i= 0; i < types.length; i++)
- if (!ITypedElement.UNKNOWN_TYPE.equals(types[i])) {
- n++;
- if (type == null)
- type= types[i]; // remember the first known type
- }
- if (n > 1) // don't use the type if there were more than one
- type= null;
- }
-
- if (type != null) {
- IViewerDescriptor vd= (IViewerDescriptor) fgContentMergeViewerDescriptors.get(type);
- Viewer viewer= null;
- if (vd != null) {
- viewer= vd.createViewer(oldViewer, parent, cc);
- if (viewer != null)
- return viewer;
- }
- }
-
- // fallback
- String leftType= guessType(input.getLeft());
- String rightType= guessType(input.getRight());
-
- if (leftType != null || rightType != null) {
- boolean right_text= rightType != null && ITypedElement.TEXT_TYPE.equals(rightType);
- boolean left_text= leftType != null && ITypedElement.TEXT_TYPE.equals(leftType);
- if ((leftType == null && right_text) || (left_text && rightType == null) || (left_text && right_text))
- type= ITypedElement.TEXT_TYPE;
- else
- type= "binary"; //$NON-NLS-1$
-
- IViewerDescriptor vd= (IViewerDescriptor) fgContentMergeViewerDescriptors.get(normalizeCase(type));
- if (vd != null)
- return vd.createViewer(oldViewer, parent, cc);
- }
- return null;
- }
-
- private static String[] getTypes(ICompareInput input) {
- ITypedElement ancestor= input.getAncestor();
- ITypedElement left= input.getLeft();
- ITypedElement right= input.getRight();
-
- String[] types= new String[3];
- int cnt= 0;
-
- if (ancestor != null) {
- String type= ancestor.getType();
- if (type != null)
- types[cnt++]= normalizeCase(type);
- }
- if (left != null) {
- String type= left.getType();
- if (type != null)
- types[cnt++]= normalizeCase(type);
- }
- if (right != null) {
- String type= right.getType();
- if (type != null)
- types[cnt++]= normalizeCase(type);
- }
-
- String[] result= new String[cnt];
- for (int i= 0; i < cnt; i++)
- result[i]= types[i];
- return result;
- }
-
- /**
- * Determines the type of the given threeway input by analyzing
- * the types (file extension) of the individual parts.
- * Returns null if no type can be determined.
- */
- private static boolean isHomogenous(String[] types) {
- switch (types.length) {
- case 1:
- return true;
- case 2:
- return types[0].equals(types[1]);
- case 3:
- return types[0].equals(types[1]) && types[1].equals(types[2]);
- }
- return false;
- }
-
- /**
- * Guesses the file type of the given input.
- * Returns ITypedElement.TEXT_TYPE if none of the first 10 lines is longer than 1000 bytes.
- * Returns ITypedElement.UNKNOWN_TYPE otherwise.
- * Returns <code>null</code> if the input isn't an <code>IStreamContentAccessor</code>.
- */
- private static String guessType(ITypedElement input) {
- if (input instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) input;
- InputStream is= null;
- try {
- is= sca.getContents();
- if (is == null)
- return null;
- int lineLength= 0;
- int lines= 0;
- while (lines < 10) {
- int c= is.read();
- if (c == -1) // EOF
- break;
- if (c == '\n' || c == '\r') { // reset line length
- lineLength= 0;
- lines++;
- } else
- lineLength++;
- if (lineLength > 1000)
- return ITypedElement.UNKNOWN_TYPE;
- }
- return ITypedElement.TEXT_TYPE;
- } catch (CoreException ex) {
- // be silent and return UNKNOWN_TYPE
- } catch (IOException ex) {
- // be silent and return UNKNOWN_TYPE
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- return ITypedElement.UNKNOWN_TYPE;
- }
- return null;
- }
-
- private static String normalizeCase(String s) {
- if (NORMALIZE_CASE && s != null)
- return s.toUpperCase();
- return s;
- }
-
- //---- alias mgmt
-
- private void initPreferenceStore() {
- //System.out.println("initPreferenceStore");
- final IPreferenceStore ps= getPreferenceStore();
- if (ps != null) {
- String aliases= ps.getString(STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME);
- //System.out.println(" <" + aliases + ">");
- if (aliases != null && aliases.length() > 0) {
- StringTokenizer st= new StringTokenizer(aliases, " "); //$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String pair= st.nextToken();
- int pos= pair.indexOf('.');
- if (pos > 0) {
- String key= pair.substring(0, pos);
- String alias= pair.substring(pos+1);
- fgStructureViewerAliases.put(key, alias);
- //System.out.println("<" + key + "><" + alias + ">");
- }
- }
- }
- fFilter= new CompareFilter();
- fFilter.setFilters(ps.getString(ComparePreferencePage.PATH_FILTER));
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (ComparePreferencePage.PATH_FILTER.equals(event.getProperty()))
- fFilter.setFilters(ps.getString(ComparePreferencePage.PATH_FILTER));
- }
- };
- ps.addPropertyChangeListener(fPropertyChangeListener);
- }
- }
-
- public static void addStructureViewerAlias(String type, String alias) {
- //System.out.println("addStructureViewerAlias: " + type + " " + alias);
- fgStructureViewerAliases.put(normalizeCase(alias), normalizeCase(type));
- }
-
- public static void removeAllStructureViewerAliases(String type) {
- String t= normalizeCase(type);
- Set entrySet= fgStructureViewerAliases.entrySet();
- for (Iterator iter= entrySet.iterator(); iter.hasNext(); ) {
- Map.Entry entry= (Map.Entry)iter.next();
- if (entry.getValue().equals(t))
- iter.remove();
- }
- }
-
- /**
- * Returns an array of all editors that have an unsaved content. If the identical content is
- * presented in more than one editor, only one of those editor parts is part of the result.
- *
- * @return an array of all dirty editor parts.
- */
- public static IEditorPart[] getDirtyEditors() {
- Set inputs= new HashSet();
- List result= new ArrayList(0);
- IWorkbench workbench= getDefault().getWorkbench();
- IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
- for (int i= 0; i < windows.length; i++) {
- IWorkbenchPage[] pages= windows[i].getPages();
- for (int x= 0; x < pages.length; x++) {
- IEditorPart[] editors= pages[x].getDirtyEditors();
- for (int z= 0; z < editors.length; z++) {
- IEditorPart ep= editors[z];
- IEditorInput input= ep.getEditorInput();
- if (!inputs.contains(input)) {
- inputs.add(input);
- result.add(ep);
- }
- }
- }
- }
- return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, CompareMessages.getString("ComparePlugin.internal_error"), e)); //$NON-NLS-1$
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static String getPluginId() {
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static boolean filter(String name, boolean isFolder, boolean isArchive) {
- CompareFilter f= getDefault().fFilter;
- return f.filter(name, isFolder, isArchive);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
deleted file mode 100644
index f8cef54d1..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-public class CompareWithEditionAction extends EditionAction {
-
- public CompareWithEditionAction() {
- super(false, "org.eclipse.compare.internal.CompareWithEditionAction"); //$NON-NLS-1$
- this.fHelpContextId= ICompareContextIds.COMPARE_WITH_EDITION_DIALOG;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties
deleted file mode 100644
index 154531afa..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties
+++ /dev/null
@@ -1,38 +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
-###############################################################################
-
-# @(#)CompareWithEditionAction.properties
-#
-# Resources for CompareWithEditionAction.java
-
-title= Compare with Local History
-
-treeTitleFormat= Local History of ''{0}''
-dateIcon= obj16/day_obj.gif
-timeIcon= obj16/resource_obj.gif
-
-treeFormat= {0}
-workspaceTreeFormat= {0} (Workspace File)
-parseErrorFormat= {0} (Parse Error)
-
-editionLabel= Local History ({0})
-workspaceEditionLabel= Workspace File
-
-targetLabel= Editor Buffer
-workspaceTargetLabel= Workspace File
-
-todayFormat= Today ({0})
-yesterdayFormat= Yesterday ({0})
-dayFormat= {0}
-
-closeButton.label=Close
-
-noLocalHistoryError= No local history available for selected resource.
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java
deleted file mode 100644
index 1c17ded85..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.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.compare.internal;
-
-import org.eclipse.swt.graphics.*;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Combines an image with an overlay.
- */
-public class DiffImage extends CompositeImageDescriptor {
-
- static final int HEIGHT= 16;
-
- private Image fBaseImage;
- private ImageDescriptor fOverlayImage;
- private int fWidth;
- private boolean fLeft= true;
-
- public DiffImage(Image base, ImageDescriptor overlay, int w) {
- fBaseImage= base;
- fOverlayImage= overlay;
- fWidth= w;
- }
-
- public DiffImage(Image base, ImageDescriptor overlay, int w, boolean onLeft) {
- fBaseImage= base;
- fOverlayImage= overlay;
- fWidth= w;
- fLeft= onLeft;
- }
-
- protected Point getSize() {
- return new Point(fWidth, HEIGHT);
- }
-
- protected void drawCompositeImage(int width, int height) {
- if (fLeft) {
- if (fBaseImage != null) {
- ImageData base= fBaseImage.getImageData();
- if (base == null)
- base= DEFAULT_IMAGE_DATA;
- drawImage(base, fWidth - base.width, 0);
- }
-
- if (fOverlayImage != null) {
- ImageData overlay= fOverlayImage.getImageData();
- if (overlay == null)
- overlay= DEFAULT_IMAGE_DATA;
- drawImage(overlay, 0, (HEIGHT - overlay.height) / 2);
- }
- } else {
- if (fBaseImage != null) {
- ImageData base= fBaseImage.getImageData();
- if (base == null)
- base= DEFAULT_IMAGE_DATA;
- drawImage(base, 0, 0);
- }
-
- if (fOverlayImage != null) {
- ImageData overlay= fOverlayImage.getImageData();
- if (overlay == null)
- overlay= DEFAULT_IMAGE_DATA;
- drawImage(overlay, fWidth - overlay.width, (HEIGHT - overlay.height) / 2);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
deleted file mode 100644
index 20dc15a3b..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
+++ /dev/null
@@ -1,197 +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.compare.internal;
-
-import org.eclipse.jface.text.*;
-import org.eclipse.compare.contentmergeviewer.ITokenComparator;
-import org.eclipse.compare.rangedifferencer.IRangeComparator;
-
-/**
- * Implements the <code>IRangeComparator</code> interface for lines in a document.
- * A <code>DocLineComparator</code> is used as the input for the <code>RangeDifferencer</code>
- * engine to perform a line oriented compare on documents.
- * <p>
- * A <code>DocLineComparator</code> doesn't know anything about line separators because
- * its notion of lines is solely defined in the underlying <code>IDocument</code>.
- */
-public class DocLineComparator implements ITokenComparator {
-
- private IDocument fDocument;
- private int fLineOffset;
- private int fLineCount;
- private int fLength;
- private boolean fIgnoreWhiteSpace;
-
- /**
- * Creates a <code>DocLineComparator</code> for the given document range.
- * ignoreWhiteSpace controls whether comparing lines (in method
- * <code>rangesEqual<code>) should ignore whitespace.
- *
- * @param document the document from which the lines are taken
- * @param region if non-<code>null</code> only lines within this range are taken
- * @param ignoreWhiteSpace if <code>true</code> white space is ignored when comparing lines
- */
- public DocLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace) {
-
- fDocument= document;
- fIgnoreWhiteSpace= ignoreWhiteSpace;
-
- fLineOffset= 0;
- if (region != null) {
- fLength= region.getLength();
- int start= region.getOffset();
- try {
- fLineOffset= fDocument.getLineOfOffset(start);
- } catch (BadLocationException ex) {
- // silently ignored
- }
-
- if (fLength == 0)
- fLineCount= 0;
- else {
- int endLine= fDocument.getNumberOfLines();
- try {
- endLine= fDocument.getLineOfOffset(start + fLength);
- } catch (BadLocationException ex) {
- // silently ignored
- }
- fLineCount= endLine - fLineOffset + 1;
- }
-
- } else {
- fLength= document.getLength();
- fLineCount= fDocument.getNumberOfLines();
- }
- }
-
- /**
- * Returns the number of lines in the document.
- *
- * @return number of lines
- */
- public int getRangeCount() {
- return fLineCount;
- }
-
- /* (non Javadoc)
- * see ITokenComparator.getTokenStart
- */
- public int getTokenStart(int line) {
- try {
- IRegion r= fDocument.getLineInformation(fLineOffset + line);
- return r.getOffset();
- } catch (BadLocationException ex) {
- return fDocument.getLength();
- }
- }
-
- /* (non Javadoc)
- * Returns the length of the given line.
- * see ITokenComparator.getTokenLength
- */
- public int getTokenLength(int line) {
- return getTokenStart(line+1) - getTokenStart(line);
- }
-
- /**
- * Returns <code>true</code> if a line given by the first index
- * matches a line specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the number of the line within this range comparator
- * @param other the range comparator to compare this with
- * @param otherIndex the number of the line within the other comparator
- * @return <code>true</code> if the lines are equal
- */
- public boolean rangesEqual(int thisIndex, IRangeComparator other0, int otherIndex) {
-
- if (other0 != null && other0.getClass() == getClass()) {
- DocLineComparator other= (DocLineComparator) other0;
-
- if (fIgnoreWhiteSpace) {
- String s1= extract(thisIndex);
- String s2= other.extract(otherIndex);
- return compare(s1, s2);
- }
-
- int tlen= getTokenLength(thisIndex);
- int olen= other.getTokenLength(otherIndex);
- if (tlen == olen) {
- String s1= extract(thisIndex);
- String s2= other.extract(otherIndex);
- return s1.equals(s2);
- }
- }
- return false;
- }
-
- /**
- * Aborts the comparison if the number of tokens is too large.
- *
- * @return <code>true</code> to abort a token comparison
- */
- public boolean skipRangeComparison(int length, int max, IRangeComparator other) {
- return false;
- }
-
- //---- private methods
-
- /**
- * Extract a single line from the underlying document without the line separator.
- *
- * @param line the number of the line to extract
- * @return the contents of the line as a String
- */
- private String extract(int line) {
- if (line < fLineCount) {
- try {
- IRegion r= fDocument.getLineInformation(fLineOffset + line);
- return fDocument.get(r.getOffset(), r.getLength());
- } catch(BadLocationException e) {
- // silently ignored
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- private boolean compare(String s1, String s2) {
- int l1= s1.length();
- int l2= s2.length();
- int c1= 0, c2= 0;
- int i1= 0, i2= 0;
-
- while (c1 != -1) {
-
- c1= -1;
- while (i1 < l1) {
- char c= s1.charAt(i1++);
- if (! Character.isWhitespace(c)) {
- c1= c;
- break;
- }
- }
-
- c2= -1;
- while (i2 < l2) {
- char c= s2.charAt(i2++);
- if (! Character.isWhitespace(c)) {
- c2= c;
- break;
- }
- }
-
- if (c1 != c2)
- return false;
- }
- return true;
- }
-
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
deleted file mode 100644
index b2db19190..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.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.compare.internal;
-
-import java.util.*;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- * No API yet.
- */
-public class DocumentManager {
-
- private static final boolean DEBUG= false;
-
- private static ArrayList fgKeys= new ArrayList();
- private static ArrayList fgValues= new ArrayList();
-
- public static IDocument get(Object o) {
-
- for (int i= 0; i < fgKeys.size(); i++) {
- if (fgKeys.get(i) == o)
- return (IDocument) fgValues.get(i);
- }
- return null;
- }
-
- public static void put(Object o, IDocument document) {
- if (DEBUG) System.out.println("DocumentManager.put: " + document); //$NON-NLS-1$
- for (int i= 0; i < fgKeys.size(); i++) {
- if (fgKeys.get(i) == o) {
- fgValues.set(i, document);
- return;
- }
- }
- fgKeys.add(o);
- fgValues.add(document);
- }
-
- public static void remove(IDocument document) {
- if (document != null) {
- if (DEBUG) System.out.println("DocumentManager.remove: " + document); //$NON-NLS-1$
- for (int i= 0; i < fgValues.size(); i++) {
- if (fgValues.get(i) == document) {
- fgKeys.remove(i);
- fgValues.remove(i);
- return;
- }
- }
- if (DEBUG) System.out.println("DocumentManager.remove: not found"); //$NON-NLS-1$
- }
- }
-
- public static void dump() {
- if (DEBUG) System.out.println("DocumentManager: managed docs:" + fgValues.size()); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
deleted file mode 100644
index da39a3484..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
+++ /dev/null
@@ -1,237 +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.compare.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ResourceBundle;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.BadLocationException;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.IStreamContentAccessor;
-
-
-public class EditionAction extends BaseCompareAction {
-
- /**
- * Implements the IStreamContentAccessor and ITypedElement protocols
- * for a Document.
- */
- class DocumentBufferNode implements ITypedElement, IEncodedStreamContentAccessor {
- private static final String UTF_16= "UTF-16"; //$NON-NLS-1$
- private IDocument fDocument;
- private IFile fFile;
-
- DocumentBufferNode(IDocument document, IFile file) {
- fDocument= document;
- fFile= file;
- }
-
- public String getName() {
- return fFile.getName();
- }
-
- public String getType() {
- return fFile.getFileExtension();
- }
-
- public Image getImage() {
- return null;
- }
-
- public InputStream getContents() {
- return new ByteArrayInputStream(Utilities.getBytes(fDocument.get(), UTF_16));
- }
-
- public String getCharset() {
- return UTF_16;
- }
- }
-
- private String fBundleName;
- private boolean fReplaceMode;
- protected boolean fPrevious= false;
- protected String fHelpContextId;
-
- EditionAction(boolean replaceMode, String bundleName) {
- fReplaceMode= replaceMode;
- fBundleName= bundleName;
- }
-
- protected boolean isEnabled(ISelection selection) {
- return Utilities.getFiles(selection).length == 1; // we don't support multiple selection for now
- }
-
- protected void run(ISelection selection) {
- IFile[] files= Utilities.getFiles(selection);
- for (int i= 0; i < files.length; i++)
- doFromHistory(files[i]);
- }
-
- private void doFromHistory(final IFile file) {
-
- ResourceBundle bundle= ResourceBundle.getBundle(fBundleName);
- String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
- Shell parentShell= CompareUIPlugin.getShell();
-
- IFileState states[]= null;
- try {
- states= file.getHistory(null);
- } catch (CoreException ex) {
- MessageDialog.openError(parentShell, title, ex.getMessage());
- return;
- }
-
- if (states == null || states.length <= 0) {
- String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
- MessageDialog.openInformation(parentShell, title, msg);
- return;
- }
-
- ITypedElement base= new ResourceNode(file);
-
- IDocument document= getDocument(file);
- ITypedElement target= base;
- if (document != null)
- target= new DocumentBufferNode(document, file);
-
- ITypedElement[] editions= new ITypedElement[states.length+1];
- editions[0]= base;
- for (int i= 0; i < states.length; i++)
- editions[i+1]= new HistoryItem(base, states[i]);
-
- EditionSelectionDialog d= new EditionSelectionDialog(parentShell, bundle);
- d.setEditionTitleArgument(file.getName());
- d.setEditionTitleImage(CompareUIPlugin.getImage(file));
- //d.setHideIdenticalEntries(false);
- if (fHelpContextId != null)
- d.setHelpContextId(fHelpContextId);
-
- if (fReplaceMode) {
-
- ITypedElement ti= null;
- if (fPrevious)
- ti= d.selectPreviousEdition(target, editions, null);
- else
- ti= d.selectEdition(target, editions, null);
-
- if (ti instanceof IStreamContentAccessor) {
- IStreamContentAccessor sa= (IStreamContentAccessor)ti;
-
- if (Utilities.validateResource(file, parentShell, title)) {
- try {
-
- if (document != null)
- updateDocument(document, sa);
- else
- updateWorkspace(bundle, parentShell, sa, file);
-
- } catch (InterruptedException x) {
- // Do nothing. Operation has been canceled by user.
-
- } catch (InvocationTargetException x) {
- String reason= x.getTargetException().getMessage();
- MessageDialog.openError(parentShell, title, Utilities.getFormattedString(bundle, "replaceError", reason)); //$NON-NLS-1$
- }
- }
- }
- } else {
- d.setCompareMode(true);
-
- d.selectEdition(target, editions, null);
- }
- }
-
- private void updateWorkspace(final ResourceBundle bundle, Shell shell,
- final IStreamContentAccessor sa, final IFile file)
- throws InvocationTargetException, InterruptedException {
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws InvocationTargetException {
- try {
- String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
- pm.beginTask(taskName, IProgressMonitor.UNKNOWN);
- file.setContents(sa.getContents(), false, true, pm);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- pm.done();
- }
- }
- };
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
- }
-
- private void updateDocument(IDocument document, IStreamContentAccessor sa) throws InvocationTargetException {
- try {
- String text= Utilities.readString(sa);
- document.replace(0, document.getLength(), text);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (BadLocationException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- private IDocument getDocument(IFile file) {
- IWorkbench wb= PlatformUI.getWorkbench();
- if (wb == null)
- return null;
- IWorkbenchWindow[] ws= wb.getWorkbenchWindows();
- if (ws == null)
- return null;
-
- FileEditorInput test= new FileEditorInput(file);
-
- for (int i= 0; i < ws.length; i++) {
- IWorkbenchWindow w= ws[i];
- IWorkbenchPage[] wps= w.getPages();
- if (wps != null) {
- for (int j= 0; j < wps.length; j++) {
- IWorkbenchPage wp= wps[j];
- IEditorPart ep= wp.findEditor(test);
- if (ep instanceof ITextEditor) {
- ITextEditor te= (ITextEditor) ep;
- IDocumentProvider dp= te.getDocumentProvider();
- if (dp != null) {
- IDocument doc= dp.getDocument(ep);
- if (doc != null)
- return doc;
- }
- }
- }
- }
- }
- return null;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
deleted file mode 100644
index 3ea3ba5f8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
+++ /dev/null
@@ -1,133 +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.compare.internal;
-
-import java.io.StringWriter;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-/**
- * The default exception handler shows an error dialog when one of its handle methods
- * is called. If the passed exception is a <code>CoreException</code> an error dialog
- * pops up showing the exception's status information. For a <code>InvocationTargetException</code>
- * a normal message dialog pops up showing the exception's message. Additionally the exception
- * is written to the platform log.
- */
-public class ExceptionHandler {
-
- private static ExceptionHandler fgInstance= new ExceptionHandler();
-
- /**
- * Logs the given exception using the platform's logging mechanism. The exception is
- * logged as an error with the error code <code>JavaStatusConstants.INTERNAL_ERROR</code>.
- */
- public static void log(Throwable t, String message) {
- CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(),
- CompareUIPlugin.INTERNAL_ERROR, message, t));
- }
-
- /**
- * Handles the given <code>CoreException</code>. The workbench shell is used as a parent
- * for the dialog window.
- *
- * @param e the <code>CoreException</code> to be handled
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(CoreException e, String title, String message) {
- handle(e, CompareUIPlugin.getShell(), title, message);
- }
-
- /**
- * Handles the given <code>CoreException</code>.
- *
- * @param e the <code>CoreException</code> to be handled
- * @param parent the dialog window's parent shell
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(CoreException e, Shell parent, String title, String message) {
- fgInstance.perform(e, parent, title, message);
- }
-
- /**
- * Handles the given <code>InvocationTargetException</code>. The workbench shell is used
- * as a parent for the dialog window.
- *
- * @param e the <code>InvocationTargetException</code> to be handled
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(InvocationTargetException e, String title, String message) {
- handle(e, CompareUIPlugin.getShell(), title, message);
- }
-
- /**
- * Handles the given <code>InvocationTargetException</code>.
- *
- * @param e the <code>InvocationTargetException</code> to be handled
- * @param parent the dialog window's parent shell
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(InvocationTargetException e, Shell parent, String title, String message) {
- fgInstance.perform(e, parent, title, message);
- }
-
- //---- Hooks for subclasses to control exception handling ------------------------------------
-
- protected void perform(CoreException e, Shell shell, String title, String message) {
- CompareUIPlugin.log(e);
- IStatus status= e.getStatus();
- if (status != null) {
- ErrorDialog.openError(shell, title, message, status);
- } else {
- displayMessageDialog(e, e.getMessage(), shell, title, message);
- }
- }
-
- protected void perform(InvocationTargetException e, Shell shell, String title, String message) {
- Throwable target= e.getTargetException();
- if (target instanceof CoreException) {
- perform((CoreException)target, shell, title, message);
- } else {
- CompareUIPlugin.log(e);
- if (e.getMessage() != null && e.getMessage().length() > 0) {
- displayMessageDialog(e, e.getMessage(), shell, title, message);
- } else {
- displayMessageDialog(e, target.getMessage(), shell, title, message);
- }
- }
- }
-
- //---- Helper methods -----------------------------------------------------------------------
-
- private void displayMessageDialog(Throwable t, String exceptionMessage, Shell shell, String title, String message) {
- StringWriter msg= new StringWriter();
- if (message != null) {
- msg.write(message);
- msg.write("\n\n"); //$NON-NLS-1$
- }
- if (exceptionMessage == null || exceptionMessage.length() == 0)
- msg.write(CompareMessages.getString("ExceptionDialog.seeErrorLogMessage")); //$NON-NLS-1$
- else
- msg.write(exceptionMessage);
- MessageDialog.openError(shell, title, msg.toString());
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
deleted file mode 100644
index a6df241e4..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.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.compare.internal;
-
-import org.eclipse.compare.CompareUI;
-
-/**
- * Help context ids for the Compare UI.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-public interface ICompareContextIds {
-
- public static final String PREFIX= CompareUI.PLUGIN_ID + '.';
-
- // Dialogs
- public static final String EDITION_DIALOG= PREFIX + "edition_dialog_context"; //$NON-NLS-1$
-
- public static final String COMPARE_EDITOR= PREFIX + "compare_editor_context"; //$NON-NLS-1$
- public static final String PATCH_INPUT_WIZARD_PAGE= PREFIX + "patch_input_wizard_page_context"; //$NON-NLS-1$
- public static final String PATCH_PREVIEW_WIZARD_PAGE= PREFIX + "patch_preview_wizard_page_context"; //$NON-NLS-1$
- public static final String ADD_FROM_HISTORY_DIALOG= PREFIX + "add_from_history_dialog_context"; //$NON-NLS-1$
- public static final String COMPARE_DIALOG= PREFIX + "compare_dialog_context"; //$NON-NLS-1$
- public static final String COMPARE_WITH_EDITION_DIALOG= PREFIX + "compare_with_edition_dialog_context"; //$NON-NLS-1$
- public static final String REPLACE_WITH_EDITION_DIALOG= PREFIX + "replace_with_edition_dialog_context"; //$NON-NLS-1$
-
- // Viewer
- public static final String TEXT_MERGE_VIEW= PREFIX + "text_merge_view_context"; //$NON-NLS-1$
- public static final String IMAGE_COMPARE_VIEW= PREFIX + "image_compare_view_context"; //$NON-NLS-1$
- public static final String BINARY_COMPARE_VIEW= PREFIX + "binary_compare_view_context"; //$NON-NLS-1$
- public static final String DIFF_VIEW= PREFIX + "diff_view_context"; //$NON-NLS-1$
-
- // Actions
- public static final String GLOBAL_NEXT_DIFF_ACTION= PREFIX + "global_next_diff_action_context"; //$NON-NLS-1$
- public static final String GLOBAL_PREVIOUS_DIFF_ACTION= PREFIX + "global_previous_diff_action_context"; //$NON-NLS-1$
- public static final String NEXT_DIFF_ACTION= PREFIX + "next_diff_action_context"; //$NON-NLS-1$
- public static final String PREVIOUS_DIFF_ACTION= PREFIX + "previous_diff_action_context"; //$NON-NLS-1$
- public static final String IGNORE_WHITESPACE_ACTION= PREFIX + "ignore_whitespace_action_context"; //$NON-NLS-1$
-
- // Preference page
- public static final String COMPARE_PREFERENCE_PAGE= PREFIX + "compare_preference_page_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java
deleted file mode 100644
index 3e64e2e9c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java
+++ /dev/null
@@ -1,21 +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.compare.internal;
-
-public interface INavigatable {
-
- static final String NAVIGATOR_PROPERTY= "org.eclipse.compare.internal.Navigator"; //$NON-NLS-1$
-
- /**
- * Returns true if at end or beginning.
- */
- boolean gotoDifference(boolean next);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java
deleted file mode 100644
index 013885909..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java
+++ /dev/null
@@ -1,24 +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.compare.internal;
-
-/*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
-public interface IOpenable {
-
- static final String OPENABLE_PROPERTY= "org.eclipse.compare.internal.Openable"; //$NON-NLS-1$
-
- /**
- * Opens the selected element
- */
- void openSelected();
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java
deleted file mode 100644
index a15db7c68..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java
+++ /dev/null
@@ -1,19 +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.compare.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-public interface ISavable {
-
- void save(IProgressMonitor pm) throws CoreException;
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java
deleted file mode 100644
index f5a845e80..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.compare.structuremergeviewer.IStructureCreator;
-
-/**
- * A factory object for creating <code>IStructureCreator</code>s from a descriptor.
- * <p>
- * It is used when registering <code>IStructureCreator</code> for types
- * in <code>CompareUIPlugin.registerStructureCreator</code>.
- * </p>
- *
- * @see IStructureCreator
- * @see CompareUIPlugin
- */
-public interface IStructureCreatorDescriptor {
-
- /**
- * Creates a new structure creator.
- *
- * @return a newly created structure creator
- */
- IStructureCreator createStructureCreator();
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java
deleted file mode 100644
index 2dda66e0d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.compare.CompareConfiguration;
-
-/**
- * A factory object for creating a <code>Viewer</code>s from a descriptor.
- * <p>
- * It is used when registering a viewer for a specific type
- * in <code>CompareUIPlugin.registerContentViewerDescriptor</code> and
- * in <code>CompareUIPlugin.registerStructureViewerDescriptor</code>.
- *
- * @see org.eclipse.compare.structuremergeviewer.IStructureCreator
- * @see CompareUIPlugin
- */
-public interface IViewerDescriptor {
-
- /**
- * Creates a new viewer from this descriptor under the given STW parent control.
- * If the current viewer has the same type as a new viewer
- * the implementation of this method is free to return the current viewer instead.
- *
- * @param currentViewer the current viewer which is going to be replaced with a new viewer.
- * @param parent the SWT parent control under which the new viewer has to be created.
- * @param config a compare configuration the new viewer might be interested in.
- * @return a new viewer or the current viewer.
- */
- Viewer createViewer(Viewer currentViewer, Composite parent, CompareConfiguration config);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java
deleted file mode 100644
index b6b0fa14d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.compare.*;
-
-/**
- * Toggles the <code>ICompareConfiguration.IGNORE_WS</code> property of an
- * <code>ICompareConfiguration</code>.
- */
-public class IgnoreWhiteSpaceAction extends ChangePropertyAction {
-
- public IgnoreWhiteSpaceAction(ResourceBundle bundle, CompareConfiguration cc) {
- super(bundle, cc, "action.IgnoreWhiteSpace.", CompareConfiguration.IGNORE_WHITESPACE); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java
deleted file mode 100644
index f598f89b8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A <code>Canvas</code> showing a single centered SWT <code>Image</code>.
- * If the <code>Image</code> is larger than the <code>Canvas<code>,
- * <code>Scrollbars</code> will appear.
- */
-class ImageCanvas extends Canvas {
-
- private Image fImage;
-
- /**
- * Create a new ImageCanvas with the given SWT stylebits.
- * (SWT.H_SCROLL and SWT.V_SCROLL are automtically added).
- */
- public ImageCanvas(Composite parent, int style) {
- super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL);
-
- ScrollBar sb= getHorizontalBar();
- sb.setIncrement(20);
- sb.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- repaint();
- }
- });
-
- sb= getVerticalBar();
- sb.setIncrement(20);
- sb.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- repaint();
- }
- });
-
- addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event e) {
- updateScrollbars();
- }
- });
-
- addListener(SWT.Paint, new Listener() {
- public void handleEvent(Event event) {
- paint(event.gc);
- }
- });
- }
-
- /**
- * Set the SWT Image to use as the ImageCanvas contents.
- */
- public void setImage(Image img) {
- fImage= img;
-
- if (!isDisposed()) {
- getHorizontalBar().setSelection(0);
- getVerticalBar().setSelection(0);
- updateScrollbars();
- getParent().layout();
- redraw();
- }
- }
-
- public void repaint() {
- if (!isDisposed()) {
- GC gc= new GC(this);
- paint(gc);
- gc.dispose();
- }
- }
-
- /**
- * @private
- */
- void paint(GC gc) {
- if (fImage != null) {
- Rectangle bounds= fImage.getBounds();
- Rectangle clientArea= getClientArea();
-
- int x;
- if (bounds.width < clientArea.width)
- x= (clientArea.width - bounds.width) / 2;
- else
- x= -getHorizontalBar().getSelection();
-
- int y;
- if (bounds.height < clientArea.height)
- y= (clientArea.height - bounds.height) / 2;
- else
- y= -getVerticalBar().getSelection();
-
- gc.drawImage(fImage, x, y);
- }
- }
-
- /**
- * @private
- */
- void updateScrollbars() {
- Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0);
- Point size= getSize();
- Rectangle clientArea= getClientArea();
-
- ScrollBar horizontal= getHorizontalBar();
- if (bounds.width <= clientArea.width) {
- horizontal.setVisible(false);
- horizontal.setSelection(0);
- } else {
- horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
- int max= bounds.width + (size.x - clientArea.width);
- horizontal.setMaximum(max);
- horizontal.setThumb(size.x > max ? max : size.x);
- horizontal.setVisible(true);
- }
-
- ScrollBar vertical= getVerticalBar();
- if (bounds.height <= clientArea.height) {
- vertical.setVisible(false);
- vertical.setSelection(0);
- } else {
- vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
- int max= bounds.height + (size.y - clientArea.height);
- vertical.setMaximum(max);
- vertical.setThumb(size.y > max ? max : size.y);
- vertical.setVisible(true);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
deleted file mode 100644
index d205e2fd1..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
+++ /dev/null
@@ -1,145 +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.compare.internal;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
-
-/**
- */
-public class ImageMergeViewer extends ContentMergeViewer {
-
- private static final String BUNDLE_NAME= "org.eclipse.compare.internal.ImageMergeViewerResources"; //$NON-NLS-1$
-
- private Object fLeftImage;
- private Object fRightImage;
-
- private ImageCanvas fAncestor;
- private ImageCanvas fLeft;
- private ImageCanvas fRight;
-
-
- public ImageMergeViewer(Composite parent, int styles, CompareConfiguration mp) {
- super(styles, ResourceBundle.getBundle(BUNDLE_NAME), mp);
-
- WorkbenchHelp.setHelp(parent, ICompareContextIds.IMAGE_COMPARE_VIEW);
-
- buildControl(parent);
- String title= Utilities.getString(getResourceBundle(), "title"); //$NON-NLS-1$
- getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, title);
- }
-
- protected void updateContent(Object ancestor, Object left, Object right) {
-
- setInput(fAncestor, ancestor);
-
- fLeftImage= left;
- setInput(fLeft, left);
-
- fRightImage= right;
- setInput(fRight, right);
- }
-
- /**
- * We can't modify the contents of either side we just return null.
- */
- protected byte[] getContents(boolean left) {
- return null;
- }
-
- public void createControls(Composite composite) {
- fAncestor= new ImageCanvas(composite, SWT.NO_FOCUS);
- fLeft= new ImageCanvas(composite, SWT.NO_FOCUS);
- fRight= new ImageCanvas(composite, SWT.NO_FOCUS);
- }
-
- private static void setInput(ImageCanvas canvas, Object input) {
- if (canvas != null) {
-
- InputStream stream= null;
- if (input instanceof IStreamContentAccessor) {
- IStreamContentAccessor sca= (IStreamContentAccessor) input;
- if (sca != null) {
- try {
- stream= sca.getContents();
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
-
- Image image= null;
- Display display= canvas.getDisplay();
- if (stream != null) {
- try {
- image= new Image(display, stream);
- } catch (SWTException ex) {
- // silently ignored
- }
- }
-
- canvas.setImage(image);
- if (image != null) {
- canvas.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- } else {
- canvas.setBackground(null);
- }
-
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- }
-
- protected void handleResizeAncestor(int x, int y, int width, int height) {
- if (width > 0) {
- fAncestor.setVisible(true);
- fAncestor.setBounds(x, y, width, height);
- } else {
- fAncestor.setVisible(false);
- }
- }
-
- protected void handleResizeLeftRight(int x, int y, int width1, int centerWidth, int width2, int height) {
- fLeft.setBounds(x, y, width1, height);
- fRight.setBounds(x+width1+centerWidth, y, width2, height);
- }
-
- protected void copy(boolean leftToRight) {
- if (leftToRight) {
- fRightImage= fLeftImage;
- setInput(fRight, fRightImage);
- setRightDirty(true);
- } else {
- fLeftImage= fRightImage;
- setInput(fLeft, fLeftImage);
- setLeftDirty(true);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java
deleted file mode 100644
index ae0ab7813..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java
+++ /dev/null
@@ -1,30 +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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.compare.*;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A factory object for the <code>ImageMergeViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class ImageMergeViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new ImageMergeViewer(parent, SWT.NULL, mp);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties
deleted file mode 100644
index cb23466b0..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# @(#)ImageMergeViewerResources.properties
-#
-# Resource strings for ImageMergeViewer.java
-
-title= Image Compare
-
-#####################################################
-# Actions
-#####################################################
-
-action.CopyLeftToRight.label= Copy Left to Right
-action.CopyLeftToRight.tooltip= Copy Image from Left to Right
-action.CopyLeftToRight.image= elcl16/copy_r_co.gif
-
-action.CopyRightToLeft.label= Copy Right to Left
-action.CopyRightToLeft.tooltip= Copy Image from Right to Left
-action.CopyRightToLeft.image= elcl16/copy_l_co.gif
-
-action.EnableAncestor.label= Enable Ancestor Pane
-action.EnableAncestor.tooltip= Control Visibility of Ancestor Pane
-action.EnableAncestor.image= elcl16/ancestorpane_co.gif
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
deleted file mode 100644
index b39150c19..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A specialized content provider to show a list of editor parts.
- */
-public class ListContentProvider implements IStructuredContentProvider {
- List fContents;
-
- public ListContentProvider() {
- }
-
- public Object[] getElements(Object input) {
- if (fContents != null && fContents == input)
- return fContents.toArray();
- return new Object[0];
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof List)
- fContents= (List)newInput;
- else
- fContents= null;
- // we use a fixed set.
- }
-
- public void dispose() {
- }
-
- public boolean isDeleted(Object o) {
- return fContents != null && !fContents.contains(o);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java
deleted file mode 100644
index 5df991bc3..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java
+++ /dev/null
@@ -1,90 +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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-public class ListDialog extends SelectionDialog {
-
- private IStructuredContentProvider fContentProvider;
- private ILabelProvider fLabelProvider;
- private Object fInput;
- private TableViewer fTableViewer;
- private boolean fAddCancelButton;
-
- public ListDialog(Shell parent) {
- super(parent);
- fAddCancelButton= false;
- }
-
- public void setInput(Object input) {
- fInput= input;
- }
-
- public void setContentProvider(IStructuredContentProvider sp){
- fContentProvider= sp;
- }
-
- public void setLabelProvider(ILabelProvider lp){
- fLabelProvider= lp;
- }
-
- public void setAddCancelButton(boolean addCancelButton) {
- fAddCancelButton= addCancelButton;
- }
-
- public TableViewer getTableViewer(){
- return fTableViewer;
- }
-
- public boolean hasFilters(){
- return fTableViewer.getFilters() != null && fTableViewer.getFilters().length != 0;
- }
-
- public void create() {
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE);
- super.create();
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- if (! fAddCancelButton)
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- else
- super.createButtonsForButtonBar(parent);
- }
-
- protected Control createDialogArea(Composite container) {
- Composite parent= (Composite) super.createDialogArea(container);
- createMessageArea(parent);
- fTableViewer= new TableViewer(parent, getTableStyle());
- fTableViewer.setContentProvider(fContentProvider);
- Table table= fTableViewer.getTable();
- fTableViewer.setLabelProvider(fLabelProvider);
- fTableViewer.setInput(fInput);
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= convertHeightInCharsToPixels(15);
- gd.widthHint= convertWidthInCharsToPixels(55);
- table.setLayoutData(gd);
- applyDialogFont(parent);
- return parent;
- }
-
- protected int getTableStyle() {
- return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
deleted file mode 100644
index 707b2f1ef..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
+++ /dev/null
@@ -1,398 +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.compare.internal;
-
-import java.util.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.graphics.Font;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.*;
-
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-/**
- * Extends the JFace SourceViewer with some convenience methods.
- */
-public class MergeSourceViewer extends SourceViewer
- implements ISelectionChangedListener, ITextListener, IMenuListener {
-
- public static final String UNDO_ID= "undo"; //$NON-NLS-1$
- public static final String REDO_ID= "redo"; //$NON-NLS-1$
- public static final String CUT_ID= "cut"; //$NON-NLS-1$
- public static final String COPY_ID= "copy"; //$NON-NLS-1$
- public static final String PASTE_ID= "paste"; //$NON-NLS-1$
- public static final String DELETE_ID= "delete"; //$NON-NLS-1$
- public static final String SELECT_ALL_ID= "selectAll"; //$NON-NLS-1$
- public static final String SAVE_ID= "save"; //$NON-NLS-1$
-
- class TextOperationAction extends MergeViewerAction {
-
- private int fOperationCode;
-
- TextOperationAction(int operationCode, boolean mutable, boolean selection, boolean content) {
- super(mutable, selection, content);
- fOperationCode= operationCode;
- update();
- }
-
- public void run() {
- if (isEnabled())
- doOperation(fOperationCode);
- }
-
- public boolean isEnabled() {
- return fOperationCode != -1 && canDoOperation(fOperationCode);
- }
-
- public void update() {
- this.setEnabled(isEnabled());
- }
- }
-
- private ResourceBundle fResourceBundle;
- private Position fRegion;
- private boolean fEnabled= true;
- private HashMap fActions= new HashMap();
-
- private boolean fAddSaveAction= true;
-
-
- public MergeSourceViewer(Composite parent, ResourceBundle bundle) {
- super(parent, null, SWT.H_SCROLL + SWT.V_SCROLL);
-
- fResourceBundle= bundle;
-
- MenuManager menu= new MenuManager();
- menu.setRemoveAllWhenShown(true);
- menu.addMenuListener(this);
- StyledText te= getTextWidget();
- te.setMenu(menu.createContextMenu(te));
- }
-
- public void hideSaveAction() {
- fAddSaveAction= false;
- }
-
- public void setFont(Font font) {
- StyledText te= getTextWidget();
- if (te != null)
- te.setFont(font);
- }
-
- public void setBackgroundColor(Color color) {
- StyledText te= getTextWidget();
- if (te != null)
- te.setBackground(color);
- }
-
- public void setEnabled(boolean enabled) {
- if (enabled != fEnabled) {
- fEnabled= enabled;
- StyledText c= getTextWidget();
- if (c != null) {
- c.setEnabled(enabled);
- Display d= c.getDisplay();
- c.setBackground(enabled ? d.getSystemColor(SWT.COLOR_LIST_BACKGROUND) : null);
- }
- }
- }
-
- public boolean getEnabled() {
- return fEnabled;
- }
-
- public void setRegion(Position region) {
- fRegion= region;
- }
-
- public Position getRegion() {
- return fRegion;
- }
-
- public boolean isControlOkToUse() {
- StyledText t= getTextWidget();
- return t != null && !t.isDisposed();
- }
-
- public void setSelection(Position position) {
- if (position != null)
- setSelectedRange(position.getOffset(), position.getLength());
- }
-
- public void setLineBackground(Position position, Color c) {
- StyledText t= getTextWidget();
- if (t != null && !t.isDisposed()) {
- Point region= new Point(0, 0);
- getLineRange(position, region);
-
- region.x-= getDocumentRegionOffset();
-
- try {
- t.setLineBackground(region.x, region.y, c);
- } catch (IllegalArgumentException ex) {
- // silently ignored
- }
- }
- }
-
- public void resetLineBackground() {
- StyledText t= getTextWidget();
- if (t != null && !t.isDisposed()) {
- int lines= getLineCount();
- t.setLineBackground(0, lines, null);
- }
- }
-
- /**
- * Returns number of lines in document region.
- */
- public int getLineCount() {
- IRegion region= getVisibleRegion();
-
- int length= region.getLength();
- if (length == 0)
- return 0;
-
- IDocument doc= getDocument();
- int startLine= 0;
- int endLine= 0;
-
- int start= region.getOffset();
- try {
- startLine= doc.getLineOfOffset(start);
- } catch(BadLocationException ex) {
- // silently ignored
- }
- try {
- endLine= doc.getLineOfOffset(start+length);
- } catch(BadLocationException ex) {
- // silently ignored
- }
-
- return endLine-startLine+1;
- }
-
- public int getViewportLines() {
- StyledText te= getTextWidget();
- Rectangle clArea= te.getClientArea();
- if (!clArea.isEmpty())
- return clArea.height / te.getLineHeight();
- return 0;
- }
-
- public int getViewportHeight() {
- StyledText te= getTextWidget();
- Rectangle clArea= te.getClientArea();
- if (!clArea.isEmpty())
- return clArea.height;
- return 0;
- }
-
- /**
- * Returns lines
- */
- public int getDocumentRegionOffset() {
- int start= getVisibleRegion().getOffset();
- IDocument doc= getDocument();
- if (doc != null) {
- try {
- return doc.getLineOfOffset(start);
- } catch(BadLocationException ex) {
- // silently ignored
- }
- }
- return 0;
- }
-
- public int getVerticalScrollOffset() {
- StyledText st= getTextWidget();
- int lineHeight= st.getLineHeight();
- return getTopInset() - ((getDocumentRegionOffset()*lineHeight) + st.getTopPixel());
- }
-
- /**
- * Returns the start line and the number of lines which correspond to the given position.
- * Starting line number is 0 based.
- */
- public Point getLineRange(Position p, Point region) {
-
- IDocument doc= getDocument();
-
- if (p == null || doc == null) {
- region.x= 0;
- region.y= 0;
- return region;
- }
-
- int start= p.getOffset();
- int length= p.getLength();
-
- int startLine= 0;
- try {
- startLine= doc.getLineOfOffset(start);
- } catch (BadLocationException e) {
- // silently ignored
- }
-
- int lineCount= 0;
-
- if (length == 0) {
-// // if range length is 0 and if range starts a new line
-// try {
-// if (start == doc.getLineStartOffset(startLine)) {
-// lines--;
-// }
-// } catch (BadLocationException e) {
-// lines--;
-// }
-
- } else {
- int endLine= 0;
- try {
- endLine= doc.getLineOfOffset(start + length - 1); // why -1?
- } catch (BadLocationException e) {
- // silently ignored
- }
- lineCount= endLine-startLine+1;
- }
-
- region.x= startLine;
- region.y= lineCount;
- return region;
- }
-
- /**
- * Scroll TextPart to the given line.
- */
- public void vscroll(int line) {
-
- int srcViewSize= getLineCount();
- int srcExtentSize= getViewportLines();
-
- if (srcViewSize > srcExtentSize) {
-
- if (line < 0)
- line= 0;
-
- int cp= getTopIndex();
- if (cp != line)
- setTopIndex(line + getDocumentRegionOffset());
- }
- }
-
- public void addAction(String actionId, MergeViewerAction action) {
- fActions.put(actionId, action);
- }
-
- public MergeViewerAction getAction(String actionId) {
- MergeViewerAction action= (MergeViewerAction) fActions.get(actionId);
- if (action == null) {
- action= createAction(actionId);
- if (action == null)
- return null;
-
- if (action.isContentDependent())
- addTextListener(this);
- if (action.isSelectionDependent())
- addSelectionChangedListener(this);
-
- Utilities.initAction(action, fResourceBundle, "action." + actionId + "."); //$NON-NLS-1$ //$NON-NLS-2$
- fActions.put(actionId, action);
- }
- if (action.isEditableDependent() && !isEditable())
- return null;
- return action;
- }
-
- protected MergeViewerAction createAction(String actionId) {
- if (UNDO_ID.equals(actionId))
- return new TextOperationAction(UNDO, true, false, true);
- if (REDO_ID.equals(actionId))
- return new TextOperationAction(REDO, true, false, true);
- if (CUT_ID.equals(actionId))
- return new TextOperationAction(CUT, true, true, false);
- if (COPY_ID.equals(actionId))
- return new TextOperationAction(COPY, false, true, false);
- if (PASTE_ID.equals(actionId))
- return new TextOperationAction(PASTE, true, false, false);
- if (DELETE_ID.equals(actionId))
- return new TextOperationAction(DELETE, true, false, false);
- if (SELECT_ALL_ID.equals(actionId))
- return new TextOperationAction(SELECT_ALL, false, false, false);
- return null;
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- Iterator e= fActions.values().iterator();
- while (e.hasNext()) {
- MergeViewerAction action= (MergeViewerAction) e.next();
- if (action.isSelectionDependent())
- action.update();
- }
- }
-
- public void textChanged(TextEvent event) {
- Iterator e= fActions.values().iterator();
- while (e.hasNext()) {
- MergeViewerAction action= (MergeViewerAction) e.next();
- if (action.isContentDependent())
- action.update();
- }
- }
-
- /**
- * Allows the viewer to add menus and/or tools to the context menu.
- */
- public void menuAboutToShow(IMenuManager menu) {
-
- menu.add(new Separator("undo")); //$NON-NLS-1$
- addMenu(menu, UNDO_ID);
- addMenu(menu, REDO_ID);
-
- menu.add(new Separator("ccp")); //$NON-NLS-1$
- addMenu(menu, CUT_ID);
- addMenu(menu, COPY_ID);
- addMenu(menu, PASTE_ID);
- addMenu(menu, DELETE_ID);
- addMenu(menu, SELECT_ALL_ID);
-
- menu.add(new Separator("edit")); //$NON-NLS-1$
- menu.add(new Separator("find")); //$NON-NLS-1$
- //addMenu(menu, FIND_ID);
-
- menu.add(new Separator("save")); //$NON-NLS-1$
- if (fAddSaveAction)
- addMenu(menu, SAVE_ID);
-
- menu.add(new Separator("rest")); //$NON-NLS-1$
- }
-
- private void addMenu(IMenuManager menu, String actionId) {
- IAction action= getAction(actionId);
- if (action != null)
- menu.add(action);
- }
-
- protected void handleDispose() {
-
- removeTextListener(this);
- removeSelectionChangedListener(this);
-
- super.handleDispose();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
deleted file mode 100644
index 590ab8696..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
+++ /dev/null
@@ -1,43 +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.compare.internal;
-
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.jface.action.Action;
-
-
-public abstract class MergeViewerAction extends Action implements IUpdate {
-
- private boolean fMutable;
- private boolean fSelection;
- private boolean fContent;
-
- public MergeViewerAction(boolean mutable, boolean selection, boolean content) {
- fMutable= mutable;
- fSelection= selection;
- fContent= content;
- }
-
- public boolean isSelectionDependent() {
- return fSelection;
- }
-
- public boolean isContentDependent() {
- return fContent;
- }
-
- public boolean isEditableDependent() {
- return fMutable;
- }
-
- public void update() {
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
deleted file mode 100644
index a21e6a4cd..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
+++ /dev/null
@@ -1,163 +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.compare.internal;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
-
-/**
- * Adapts any <code>ContentMergeViewer</code> to work on an <code>ICompareInput</code>
- * e.g. a <code>DiffNode</code>.
- */
-public class MergeViewerContentProvider implements IMergeViewerContentProvider {
-
- private CompareConfiguration fCompareConfiguration;
-
- public MergeViewerContentProvider(CompareConfiguration cc) {
- fCompareConfiguration= cc;
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer v, Object o1, Object o2) {
- // we are not interested since we have no state
- }
-
- //---- ancestor
-
- public String getAncestorLabel(Object element) {
- return fCompareConfiguration.getAncestorLabel(element);
- }
-
- public Image getAncestorImage(Object element) {
- return fCompareConfiguration.getAncestorImage(element);
- }
-
- public Object getAncestorContent(Object element) {
- if (element instanceof ICompareInput)
- return ((ICompareInput) element).getAncestor();
- return null;
- }
-
- public boolean showAncestor(Object element) {
- if (element instanceof ICompareInput)
- return true; // fix for #45239: Show ancestor for incoming and outgoing changes
- //return (((ICompareInput)element).getKind() & Differencer.DIRECTION_MASK) == Differencer.CONFLICTING;
- return false;
- }
-
- //---- left
-
- public String getLeftLabel(Object element) {
- return fCompareConfiguration.getLeftLabel(element);
- }
-
- public Image getLeftImage(Object element) {
- return fCompareConfiguration.getLeftImage(element);
- }
-
- public Object getLeftContent(Object element) {
- if (element instanceof ICompareInput)
- return ((ICompareInput) element).getLeft();
- return null;
- }
-
- public boolean isLeftEditable(Object element) {
- if (element instanceof ICompareInput) {
- Object left= ((ICompareInput) element).getLeft();
- if (left == null) {
- IDiffElement parent= ((IDiffElement)element).getParent();
- if (parent instanceof ICompareInput)
- left= ((ICompareInput) parent).getLeft();
- }
- if (left instanceof IEditableContent)
- return ((IEditableContent)left).isEditable();
- }
- return false;
- }
-
- public void saveLeftContent(Object element, byte[] bytes) {
- if (element instanceof ICompareInput) {
- ICompareInput node= (ICompareInput) element;
- if (bytes != null) {
- ITypedElement left= node.getLeft();
- // #9869: problem if left is null (because no resource exists yet) nothing is done!
- if (left == null) {
- node.copy(false);
- left= node.getLeft();
- }
- if (left instanceof IEditableContent)
- ((IEditableContent)left).setContent(bytes);
- if (node instanceof ResourceCompareInput.MyDiffNode)
- ((ResourceCompareInput.MyDiffNode)node).fireChange();
- } else {
- node.copy(false);
- }
- }
- }
-
- //---- right
-
- public String getRightLabel(Object element) {
- return fCompareConfiguration.getRightLabel(element);
- }
-
- public Image getRightImage(Object element) {
- return fCompareConfiguration.getRightImage(element);
- }
-
- public Object getRightContent(Object element) {
- if (element instanceof ICompareInput)
- return ((ICompareInput) element).getRight();
- return null;
- }
-
- public boolean isRightEditable(Object element) {
- if (element instanceof ICompareInput) {
- Object right= ((ICompareInput) element).getRight();
- if (right == null) {
- IDiffContainer parent= ((IDiffElement)element).getParent();
- if (parent instanceof ICompareInput)
- right= ((ICompareInput) parent).getRight();
- }
- if (right instanceof IEditableContent)
- return ((IEditableContent)right).isEditable();
- }
- return false;
- }
-
- public void saveRightContent(Object element, byte[] bytes) {
- if (element instanceof ICompareInput) {
- ICompareInput node= (ICompareInput) element;
- if (bytes != null) {
- ITypedElement right= node.getRight();
- // #9869: problem if right is null (because no resource exists yet) nothing is done!
- if (right == null) {
- node.copy(true);
- right= node.getRight();
- }
- if (right instanceof IEditableContent)
- ((IEditableContent)right).setContent(bytes);
- if (node instanceof ResourceCompareInput.MyDiffNode)
- ((ResourceCompareInput.MyDiffNode)node).fireChange();
- } else {
- node.copy(true);
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java
deleted file mode 100644
index 495a8cf28..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.compare.CompareViewerPane;
-
-/**
- * Used whenever the input is null or no viewer can be found.
- */
-public class NullViewer extends AbstractViewer {
-
- private Control fDummy;
-
- public NullViewer(Composite parent) {
-
- fDummy= new Tree(parent, SWT.NULL);
-
- CompareViewerPane.clearToolBar(parent);
- }
-
- public Control getControl() {
- return fDummy;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
deleted file mode 100644
index 9fd741dad..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
+++ /dev/null
@@ -1,451 +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.compare.internal;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * An overlaying preference store.
- */
-public class OverlayPreferenceStore implements IPreferenceStore {
-
-
- public static final class TypeDescriptor {
- private TypeDescriptor() {
- }
- }
-
- public static final TypeDescriptor BOOLEAN= new TypeDescriptor();
- public static final TypeDescriptor DOUBLE= new TypeDescriptor();
- public static final TypeDescriptor FLOAT= new TypeDescriptor();
- public static final TypeDescriptor INT= new TypeDescriptor();
- public static final TypeDescriptor LONG= new TypeDescriptor();
- public static final TypeDescriptor STRING= new TypeDescriptor();
-
- public static class OverlayKey {
-
- TypeDescriptor fDescriptor;
- String fKey;
-
- public OverlayKey(TypeDescriptor descriptor, String key) {
- fDescriptor= descriptor;
- fKey= key;
- }
- }
-
- private class PropertyListener implements IPropertyChangeListener {
-
- /*
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- OverlayKey key= findOverlayKey(event.getProperty());
- if (key != null)
- propagateProperty(fParent, key, fStore);
- }
- }
-
-
- private IPreferenceStore fParent;
- private IPreferenceStore fStore;
- private OverlayKey[] fOverlayKeys;
-
- private PropertyListener fPropertyListener;
-
-
- public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
- fParent= parent;
- fOverlayKeys= overlayKeys;
- fStore= new PreferenceStore();
- }
-
- private OverlayKey findOverlayKey(String key) {
- for (int i= 0; i < fOverlayKeys.length; i++) {
- if (fOverlayKeys[i].fKey.equals(key))
- return fOverlayKeys[i];
- }
- return null;
- }
-
- private boolean covers(String key) {
- return (findOverlayKey(key) != null);
- }
-
- private void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
-
- if (orgin.isDefault(key.fKey)) {
- if (!target.isDefault(key.fKey))
- target.setToDefault(key.fKey);
- return;
- }
-
- TypeDescriptor d= key.fDescriptor;
- if (BOOLEAN == d) {
-
- boolean originValue= orgin.getBoolean(key.fKey);
- boolean targetValue= target.getBoolean(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (DOUBLE == d) {
-
- double originValue= orgin.getDouble(key.fKey);
- double targetValue= target.getDouble(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (FLOAT == d) {
-
- float originValue= orgin.getFloat(key.fKey);
- float targetValue= target.getFloat(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (INT == d) {
-
- int originValue= orgin.getInt(key.fKey);
- int targetValue= target.getInt(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (LONG == d) {
-
- long originValue= orgin.getLong(key.fKey);
- long targetValue= target.getLong(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (STRING == d) {
-
- String originValue= orgin.getString(key.fKey);
- String targetValue= target.getString(key.fKey);
- if (targetValue != null && originValue != null && !targetValue.equals(originValue))
- target.setValue(key.fKey, originValue);
-
- }
- }
-
- public void propagate() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- propagateProperty(fStore, fOverlayKeys[i], fParent);
- }
-
- private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
- TypeDescriptor d= key.fDescriptor;
- if (BOOLEAN == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, true);
- target.setValue(key.fKey, orgin.getBoolean(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
-
- } else if (DOUBLE == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0D);
- target.setValue(key.fKey, orgin.getDouble(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
-
- } else if (FLOAT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0F);
- target.setValue(key.fKey, orgin.getFloat(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
-
- } else if (INT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1);
- target.setValue(key.fKey, orgin.getInt(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
-
- } else if (LONG == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1L);
- target.setValue(key.fKey, orgin.getLong(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
-
- } else if (STRING == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, "1"); //$NON-NLS-1$
- target.setValue(key.fKey, orgin.getString(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
-
- }
- }
-
- public void load() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- loadProperty(fParent, fOverlayKeys[i], fStore, true);
- }
-
- public void loadDefaults() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- setToDefault(fOverlayKeys[i].fKey);
- }
-
- public void start() {
- if (fPropertyListener == null) {
- fPropertyListener= new PropertyListener();
- fParent.addPropertyChangeListener(fPropertyListener);
- }
- }
-
- public void stop() {
- if (fPropertyListener != null) {
- fParent.removePropertyChangeListener(fPropertyListener);
- fPropertyListener= null;
- }
- }
-
- /*
- * @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fStore.addPropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fStore.removePropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- fStore.firePropertyChangeEvent(name, oldValue, newValue);
- }
-
- /*
- * @see IPreferenceStore#contains(String)
- */
- public boolean contains(String name) {
- return fStore.contains(name);
- }
-
- /*
- * @see IPreferenceStore#getBoolean(String)
- */
- public boolean getBoolean(String name) {
- return fStore.getBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultBoolean(String)
- */
- public boolean getDefaultBoolean(String name) {
- return fStore.getDefaultBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultDouble(String)
- */
- public double getDefaultDouble(String name) {
- return fStore.getDefaultDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultFloat(String)
- */
- public float getDefaultFloat(String name) {
- return fStore.getDefaultFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultInt(String)
- */
- public int getDefaultInt(String name) {
- return fStore.getDefaultInt(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultLong(String)
- */
- public long getDefaultLong(String name) {
- return fStore.getDefaultLong(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultString(String)
- */
- public String getDefaultString(String name) {
- return fStore.getDefaultString(name);
- }
-
- /*
- * @see IPreferenceStore#getDouble(String)
- */
- public double getDouble(String name) {
- return fStore.getDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getFloat(String)
- */
- public float getFloat(String name) {
- return fStore.getFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getInt(String)
- */
- public int getInt(String name) {
- return fStore.getInt(name);
- }
-
- /*
- * @see IPreferenceStore#getLong(String)
- */
- public long getLong(String name) {
- return fStore.getLong(name);
- }
-
- /*
- * @see IPreferenceStore#getString(String)
- */
- public String getString(String name) {
- return fStore.getString(name);
- }
-
- /*
- * @see IPreferenceStore#isDefault(String)
- */
- public boolean isDefault(String name) {
- return fStore.isDefault(name);
- }
-
- /*
- * @see IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return fStore.needsSaving();
- }
-
- /*
- * @see IPreferenceStore#putValue(String, String)
- */
- public void putValue(String name, String value) {
- if (covers(name))
- fStore.putValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, double)
- */
- public void setDefault(String name, double value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, float)
- */
- public void setDefault(String name, float value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, int)
- */
- public void setDefault(String name, int value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, long)
- */
- public void setDefault(String name, long value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, String)
- */
- public void setDefault(String name, String value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, boolean)
- */
- public void setDefault(String name, boolean value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setToDefault(String)
- */
- public void setToDefault(String name) {
- fStore.setToDefault(name);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, double)
- */
- public void setValue(String name, double value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, float)
- */
- public void setValue(String name, float value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, int)
- */
- public void setValue(String name, int value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, long)
- */
- public void setValue(String name, long value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, String)
- */
- public void setValue(String name, String value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, boolean)
- */
- public void setValue(String name, boolean value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
deleted file mode 100644
index fdcc7bf68..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-
-public class ReplaceWithEditionAction extends EditionAction {
-
- public ReplaceWithEditionAction() {
- super(true, "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$
- fHelpContextId= ICompareContextIds.REPLACE_WITH_EDITION_DIALOG;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
deleted file mode 100644
index db582dff6..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
+++ /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
-###############################################################################
-
-# @(#)ReplaceWithEditionAction.properties
-#
-# Resources for ReplaceWithEditionAction.java
-
-title= Replace from Local History
-
-treeTitleFormat= Local History of ''{0}''
-dateIcon= obj16/day_obj.gif
-timeIcon= obj16/resource_obj.gif
-
-treeFormat= {0}
-workspaceTreeFormat= {0} (Workspace File)
-parseErrorFormat= {0} (Parse Error)
-
-editionLabel= Local History ({0})
-workspaceEditionLabel= Workspace File
-
-targetLabel= {0}
-
-todayFormat= Today ({0})
-yesterdayFormat= Yesterday ({0})
-dayFormat= {0}
-
-buttonLabel= Replace
-
-noLocalHistoryError= No local history available for selected resource.
-replaceError=Can''t replace resource (reason: {0}).
-
-taskName=Replacing \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
deleted file mode 100644
index 3fa6b07aa..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
+++ /dev/null
@@ -1,21 +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.compare.internal;
-
-
-public class ReplaceWithPreviousEditionAction extends EditionAction {
-
- public ReplaceWithPreviousEditionAction() {
- super(true,
- "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$
- fPrevious= true;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
deleted file mode 100644
index 423ba9711..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.DialogSettings;
-
-
-/**
- * Base class for resizable Dialogs with persistent window bounds.
- */
-public abstract class ResizableDialog extends Dialog {
-
- // dialog store id constants
- private final static String DIALOG_BOUNDS_KEY= "ResizableDialogBounds"; //$NON-NLS-1$
- private static final String X= "x"; //$NON-NLS-1$
- private static final String Y= "y"; //$NON-NLS-1$
- private static final String WIDTH= "width"; //$NON-NLS-1$
- private static final String HEIGHT= "height"; //$NON-NLS-1$
-
- protected ResourceBundle fBundle;
- private Rectangle fNewBounds;
- private IDialogSettings fSettings;
- private String fContextId;
-
-
- public ResizableDialog(Shell parent, ResourceBundle bundle) {
- super(parent);
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
-
- fBundle= bundle;
-
- fSettings= CompareUIPlugin.getDefault().getDialogSettings();
- }
-
- public void setHelpContextId(String contextId) {
- fContextId= contextId;
- }
-
- /*
- * @see org.eclipse.jface.window.Window#configureShell(Shell)
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- if (fContextId != null)
- WorkbenchHelp.setHelp(newShell, fContextId);
- }
-
- protected Point getInitialSize() {
-
- int width= 0;
- int height= 0;
-
- final Shell s= getShell();
- if (s != null) {
- s.addControlListener(
- new ControlListener() {
- public void controlMoved(ControlEvent arg0) {
- fNewBounds= s.getBounds();
- }
- public void controlResized(ControlEvent arg0) {
- fNewBounds= s.getBounds();
- }
- }
- );
- }
-
- IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY); //$NON-NLS-1$
- if (bounds == null) {
- if (fBundle != null) {
- width= Utilities.getInteger(fBundle, WIDTH, 0);
- height= Utilities.getInteger(fBundle, HEIGHT, 0);
- Shell shell= getParentShell();
- if (shell != null) {
- Point parentSize= shell.getSize();
- if (width <= 0)
- width= parentSize.x-300;
- if (height <= 0)
- height= parentSize.y-200;
- }
- } else {
- Shell shell= getParentShell();
- if (shell != null) {
- Point parentSize= shell.getSize();
- width= parentSize.x-100;
- height= parentSize.y-100;
- }
- }
- if (width < 700)
- width= 700;
- if (height < 500)
- height= 500;
- } else {
- try {
- width= bounds.getInt(WIDTH);
- } catch (NumberFormatException e) {
- width= 700;
- }
- try {
- height= bounds.getInt(HEIGHT);
- } catch (NumberFormatException e) {
- height= 500;
- }
- }
-
- return new Point(width, height);
- }
-
- protected Point getInitialLocation(Point initialSize) {
- Point loc= super.getInitialLocation(initialSize);
-
- IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY);
- if (bounds != null) {
- try {
- loc.x= bounds.getInt(X);
- } catch (NumberFormatException e) {
- }
- try {
- loc.y= bounds.getInt(Y);
- } catch (NumberFormatException e) {
- }
- }
- return loc;
- }
-
- public boolean close() {
- boolean closed= super.close();
- if (closed && fNewBounds != null)
- saveBounds(fNewBounds);
- return closed;
- }
-
- private void saveBounds(Rectangle bounds) {
- IDialogSettings dialogBounds= fSettings.getSection(DIALOG_BOUNDS_KEY);
- if (dialogBounds == null) {
- dialogBounds= new DialogSettings(DIALOG_BOUNDS_KEY);
- fSettings.addSection(dialogBounds);
- }
- dialogBounds.put(X, bounds.x);
- dialogBounds.put(Y, bounds.y);
- dialogBounds.put(WIDTH, bounds.width);
- dialogBounds.put(HEIGHT, bounds.height);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
deleted file mode 100644
index fc76172f1..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ /dev/null
@@ -1,375 +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.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * A two-way or three-way compare for arbitrary IResources.
- */
-class ResourceCompareInput extends CompareEditorInput {
-
- private static final boolean NORMALIZE_CASE= true;
-
- private boolean fThreeWay= false;
- private Object fRoot;
- private IStructureComparator fAncestor;
- private IStructureComparator fLeft;
- private IStructureComparator fRight;
- private IResource fAncestorResource;
- private IResource fLeftResource;
- private IResource fRightResource;
- private DiffTreeViewer fDiffViewer;
- private IAction fOpenAction;
-
- class MyDiffNode extends DiffNode {
-
- private boolean fDirty= false;
- private ITypedElement fLastId;
- private String fLastName;
-
-
- public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- super(parent, description, ancestor, left, right);
- }
- public void fireChange() {
- super.fireChange();
- setDirty(true);
- fDirty= true;
- if (fDiffViewer != null)
- fDiffViewer.refresh(this);
- }
- void clearDirty() {
- fDirty= false;
- }
- public String getName() {
- if (fLastName == null)
- fLastName= super.getName();
- if (fDirty)
- return '<' + fLastName + '>';
- return fLastName;
- }
-
- public ITypedElement getId() {
- ITypedElement id= super.getId();
- if (id == null)
- return fLastId;
- fLastId= id;
- return id;
- }
- }
-
- static class FilteredBufferedResourceNode extends BufferedResourceNode {
- FilteredBufferedResourceNode(IResource resource) {
- super(resource);
- }
- protected IStructureComparator createChild(IResource child) {
- String name= child.getName();
- if (CompareUIPlugin.filter(name, child instanceof IContainer, false))
- return null;
- return new FilteredBufferedResourceNode(child);
- }
- }
-
- /**
- * Creates an compare editor input for the given selection.
- */
- ResourceCompareInput(CompareConfiguration config) {
- super(config);
- }
-
- public Viewer createDiffViewer(Composite parent) {
- fDiffViewer= new DiffTreeViewer(parent, getCompareConfiguration()) {
- protected void fillContextMenu(IMenuManager manager) {
-
- if (fOpenAction == null) {
- fOpenAction= new Action() {
- public void run() {
- handleOpen(null);
- }
- };
- Utilities.initAction(fOpenAction, getBundle(), "action.CompareContents."); //$NON-NLS-1$
- }
-
- boolean enable= false;
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection)selection;
- if (ss.size() == 1) {
- Object element= ss.getFirstElement();
- if (element instanceof MyDiffNode) {
- ITypedElement te= ((MyDiffNode) element).getId();
- if (te != null)
- enable= !ITypedElement.FOLDER_TYPE.equals(te.getType());
- } else
- enable= true;
- }
- }
- fOpenAction.setEnabled(enable);
-
- manager.add(fOpenAction);
-
- super.fillContextMenu(manager);
- }
- };
- return fDiffViewer;
- }
-
- void setSelection(ISelection s) {
-
- IResource[] selection= Utilities.getResources(s);
-
- fThreeWay= selection.length == 3;
-
- fAncestorResource= null;
- fLeftResource= selection[0];
- fRightResource= selection[1];
- if (fThreeWay) {
- fLeftResource= selection[1];
- fRightResource= selection[2];
- }
-
- fAncestor= null;
- fLeft= getStructure(fLeftResource);
- fRight= getStructure(fRightResource);
-
- if (fThreeWay) {
- fAncestorResource= selection[0];
- fAncestor= getStructure(fAncestorResource);
- }
- }
-
- /**
- * Returns true if compare can be executed for the given selection.
- */
- public boolean isEnabled(ISelection s) {
-
- IResource[] selection= Utilities.getResources(s);
- if (selection.length < 2 || selection.length > 3)
- return false;
-
- fThreeWay= selection.length == 3;
-
- fLeftResource= selection[0];
- fRightResource= selection[1];
- if (fThreeWay) {
- fLeftResource= selection[1];
- fRightResource= selection[2];
- }
-
- if (!comparable(fLeftResource, fRightResource))
- return false;
-
- if (fThreeWay) {
- fAncestorResource= selection[0];
-
- if (!comparable(fLeftResource, fRightResource))
- return false;
- }
-
- return true;
- }
-
- /**
- * Initializes the images in the compare configuration.
- */
- void initializeCompareConfiguration() {
- CompareConfiguration cc= getCompareConfiguration();
- if (fLeftResource != null) {
- cc.setLeftLabel(buildLabel(fLeftResource));
- cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource));
- }
- if (fRightResource != null) {
- cc.setRightLabel(buildLabel(fRightResource));
- cc.setRightImage(CompareUIPlugin.getImage(fRightResource));
- }
- if (fThreeWay && fAncestorResource != null) {
- cc.setAncestorLabel(buildLabel(fAncestorResource));
- cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource));
- }
- }
-
- /**
- * Returns true if both resources are either structured or unstructured.
- */
- private boolean comparable(IResource c1, IResource c2) {
- return hasStructure(c1) == hasStructure(c2);
- }
-
- /**
- * Returns true if the given argument has a structure.
- */
- private boolean hasStructure(IResource input) {
-
- if (input instanceof IContainer)
- return true;
-
- if (input instanceof IFile) {
- IFile file= (IFile) input;
- String type= file.getFileExtension();
- if (type != null) {
- type= normalizeCase(type);
- return "JAR".equals(type) || "ZIP".equals(type); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- return false;
- }
-
- /**
- * Creates a <code>IStructureComparator</code> for the given input.
- * Returns <code>null</code> if no <code>IStructureComparator</code>
- * can be found for the <code>IResource</code>.
- */
- private IStructureComparator getStructure(IResource input) {
-
- if (input instanceof IContainer)
- return new FilteredBufferedResourceNode(input);
-
- if (input instanceof IFile) {
- IStructureComparator rn= new FilteredBufferedResourceNode(input);
- IFile file= (IFile) input;
- String type= normalizeCase(file.getFileExtension());
- if ("JAR".equals(type) || "ZIP".equals(type)) //$NON-NLS-2$ //$NON-NLS-1$
- return new ZipFileStructureCreator().getStructure(rn);
- return rn;
- }
- return null;
- }
-
- /**
- * Performs a two-way or three-way diff on the current selection.
- */
- public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException {
-
- try {
- // fix for PR 1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty
- fLeftResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- fRightResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- if (fThreeWay && fAncestorResource != null)
- fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- // end fix
-
- pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
-
- String leftLabel= fLeftResource.getName();
- String rightLabel= fRightResource.getName();
-
- String title;
- if (fThreeWay) {
- String format= Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$
- String ancestorLabel= fAncestorResource.getName();
- title= MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel});
- } else {
- String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$
- title= MessageFormat.format(format, new String[] {leftLabel, rightLabel});
- }
- setTitle(title);
-
- Differencer d= new Differencer() {
- protected Object visit(Object parent, int description, Object ancestor, Object left, Object right) {
- return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
- };
-
- fRoot= d.findDifferences(fThreeWay, pm, null, fAncestor, fLeft, fRight);
- return fRoot;
-
- } catch (CoreException ex) {
- throw new InvocationTargetException(ex);
- } finally {
- pm.done();
- }
- }
-
- public String getToolTipText() {
- if (fLeftResource != null && fRightResource != null) {
- String leftLabel= fLeftResource.getFullPath().makeRelative().toString();
- String rightLabel= fRightResource.getFullPath().makeRelative().toString();
- if (fThreeWay) {
- String format= Utilities.getString("ResourceCompare.threeWay.tooltip"); //$NON-NLS-1$
- String ancestorLabel= fAncestorResource.getFullPath().makeRelative().toString();
- return MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel});
- } else {
- String format= Utilities.getString("ResourceCompare.twoWay.tooltip"); //$NON-NLS-1$
- return MessageFormat.format(format, new String[] {leftLabel, rightLabel});
- }
- }
- // fall back
- return super.getToolTipText();
- }
-
- private String buildLabel(IResource r) {
- String n= r.getFullPath().toString();
- if (n.charAt(0) == IPath.SEPARATOR)
- return n.substring(1);
- return n;
- }
-
- public void saveChanges(IProgressMonitor pm) throws CoreException {
- super.saveChanges(pm);
- if (fRoot instanceof DiffNode) {
- try {
- commit(pm, (DiffNode) fRoot);
- } finally {
- if (fDiffViewer != null)
- fDiffViewer.refresh();
- setDirty(false);
- }
- }
- }
-
- /*
- * Recursively walks the diff tree and commits all changes.
- */
- private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException {
-
- if (node instanceof MyDiffNode)
- ((MyDiffNode)node).clearDirty();
-
- ITypedElement left= node.getLeft();
- if (left instanceof BufferedResourceNode)
- ((BufferedResourceNode) left).commit(pm);
-
- ITypedElement right= node.getRight();
- if (right instanceof BufferedResourceNode)
- ((BufferedResourceNode) right).commit(pm);
-
- IDiffElement[] children= node.getChildren();
- if (children != null) {
- for (int i= 0; i < children.length; i++) {
- IDiffElement element= children[i];
- if (element instanceof DiffNode)
- commit(pm, (DiffNode) element);
- }
- }
- }
-
- private static String normalizeCase(String s) {
- if (NORMALIZE_CASE && s != null)
- return s.toUpperCase();
- return s;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java
deleted file mode 100644
index 581527039..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.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.compare.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.compare.*;
-
-/**
- * Toggles the <code>ICompareConfiguration.SHOW_PSEUDO_CONFLICTS</code> property of an
- * <code>ICompareConfiguration</code>.
- */
-public class ShowPseudoConflicts extends ChangePropertyAction {
-
- public ShowPseudoConflicts(ResourceBundle bundle, CompareConfiguration cc) {
- super(bundle, cc, "action.ShowPseudoConflicts.", CompareConfiguration.SHOW_PSEUDO_CONFLICTS); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
deleted file mode 100644
index a28339bfb..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.Document;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.*;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-
-
-public class SimpleTextViewer extends AbstractViewer {
-
- private SourceViewer fSourceViewer;
- private ICompareInput fInput;
-
-
- SimpleTextViewer(Composite parent) {
- fSourceViewer= new SourceViewer(parent, null, SWT.H_SCROLL + SWT.V_SCROLL);
- fSourceViewer.setEditable(false);
- }
-
- public Control getControl() {
- return fSourceViewer.getTextWidget();
- }
-
- public void setInput(Object input) {
- if (input instanceof IStreamContentAccessor) {
- fSourceViewer.setDocument(new Document(getString(input)));
- } else if (input instanceof ICompareInput) {
- fInput= (ICompareInput) input;
- ITypedElement left= fInput.getLeft();
- fSourceViewer.setDocument(new Document(getString(left)));
- }
- }
-
- public Object getInput() {
- return fInput;
- }
-
- private String getString(Object input) {
-
- if (input instanceof IStreamContentAccessor) {
- try {
- return Utilities.readString((IStreamContentAccessor) input);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
deleted file mode 100644
index 739b82f0e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.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.compare.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-public class TabFolderLayout extends Layout {
-
- protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control [] children = composite.getChildren ();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
- }
-
- if (wHint != SWT.DEFAULT)
- maxWidth= wHint;
- if (hHint != SWT.DEFAULT)
- maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
- }
-
- protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java
deleted file mode 100644
index 1a5d1d8be..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.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.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
-
-/**
- * A factory object for the <code>TextMergeViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class TextMergeViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new TextMergeViewer(parent, mp);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java
deleted file mode 100644
index 66eaba9f8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IViewerCreator;
-
-
-/**
- * A factory object for the <code>TextMergeViewer</code>.
- * This indirection is necessary because only objects with a default
- * constructor can be created via an extension point
- * (this precludes Viewers).
- */
-public class TextViewerCreator implements IViewerCreator {
-
- public Viewer createViewer(Composite parent, CompareConfiguration mp) {
- return new SimpleTextViewer(parent);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java
deleted file mode 100644
index e8e70af13..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java
+++ /dev/null
@@ -1,385 +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.compare.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * A modal dialog that displays progress during a long running operation.
- */
-public class TimeoutContext {
-
- private static class ModalContextThread extends Thread {
-
- private boolean fWorking;
- private IRunnableWithProgress fRunnable;
- private Throwable fThrowable;
- private IProgressMonitor fProgressMonitor;
- private boolean fContinueEventDispatching= true;
- private Display fDisplay;
-
- private ModalContextThread(IRunnableWithProgress operation, IProgressMonitor monitor) {
- super("TimeoutContext"); //$NON-NLS-1$
- fRunnable= operation;
- fProgressMonitor= monitor;
- }
-
- synchronized boolean timeout(Display display) {
- fDisplay= display;
- return fWorking;
- }
-
- public void run() {
- try {
- fWorking= true;
- if (fRunnable != null)
- fRunnable.run(fProgressMonitor);
- } catch (InvocationTargetException e) {
- fThrowable= e;
- } catch (InterruptedException e) {
- fThrowable= e;
- } catch (RuntimeException e) {
- fThrowable= e;
- } catch (ThreadDeath e) {
- // Make sure to propagate ThreadDeath, or threads will never fully terminate
- throw e;
- } catch (Error e) {
- fThrowable= e;
- } finally {
- fWorking= false;
-
- if (fDisplay != null) {
- // Make sure that all events in the asynchronous event queue
- // are dispatched.
- fDisplay.syncExec(
- new Runnable() {
- public void run() {
- // do nothing
- }
- }
- );
-
- // Stop event dispatching
- fContinueEventDispatching= false;
-
- // Force the event loop to return from sleep () so that
- // it stops event dispatching.
- fDisplay.asyncExec(null);
- }
- }
- }
-
- public void block() {
- while (fContinueEventDispatching)
- if (!fDisplay.readAndDispatch())
- fDisplay.sleep();
- }
- }
-
- static class ProgressMonitorDialog extends org.eclipse.jface.dialogs.Dialog {
-
- protected ProgressIndicator fProgressIndicator;
- protected Label fTaskLabel;
- protected Label fSubTaskLabel;
- protected Button fCancel;
- protected boolean fEnableCancelButton;
- private ProgressMonitor fProgressMonitor;
- private Cursor fArrowCursor;
- private Cursor fWaitCursor;
- private Shell fParentShell;
-
- private ProgressMonitorDialog(Shell parent, boolean cancelable, ProgressMonitor pm) {
- super(parent);
- fProgressMonitor= pm;
- fParentShell= parent;
- fEnableCancelButton= cancelable;
- this.setBlockOnOpen(false);
- setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL); // no close button
- }
-
- public boolean close() {
- if (fCancel != null && !fCancel.isDisposed())
- fCancel.setCursor(null);
- Shell shell= getShell();
- if (shell != null && !shell.isDisposed())
- shell.setCursor(null);
- if (fArrowCursor != null)
- fArrowCursor.dispose();
- if (fWaitCursor != null)
- fWaitCursor.dispose();
- fArrowCursor= null;
- fWaitCursor= null;
- return super.close();
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(JFaceResources.getString("ProgressMonitorDialog.title")); //$NON-NLS-1$
- if (fWaitCursor == null)
- fWaitCursor= new Cursor(shell.getDisplay(),SWT.CURSOR_WAIT);
- shell.setCursor(fWaitCursor);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- // cancel button
- fCancel= createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
- if(fArrowCursor == null)
- fArrowCursor= new Cursor(fCancel.getDisplay(),SWT.CURSOR_ARROW);
- fCancel.setCursor(fArrowCursor);
- fCancel.addListener(SWT.Selection,
- new Listener() {
- public void handleEvent(Event e) {
- if (fCancel != null && !fCancel.isDisposed())
- fCancel.setEnabled(false);
- fProgressMonitor.setCanceled(true);
- }
- }
- );
- fCancel.setEnabled(fEnableCancelButton);
- }
-
- protected Control createDialogArea(Composite parent) {
-
- Composite c= (Composite)super.createDialogArea(parent);
- ((GridLayout)c.getLayout()).numColumns= 2;
-
- // icon
- Label iconLabel= new Label(c, SWT.LEFT);
- GridData gd= new GridData();
- iconLabel.setLayoutData(gd);
- iconLabel.setFont(parent.getFont());
- Image i= JFaceResources.getImageRegistry().get(org.eclipse.jface.dialogs.Dialog.DLG_IMG_INFO);
- if (i != null)
- iconLabel.setImage(i);
- else
- iconLabel.setText(JFaceResources.getString("Image_not_found")); //$NON-NLS-1$
-
- // label on right hand side of icon
- fTaskLabel= new Label(c, SWT.LEFT | SWT.WRAP);
- fTaskLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fTaskLabel.setFont(parent.getFont());
-
- // progress indicator
- fProgressIndicator= new ProgressIndicator(c);
- gd= new GridData();
- gd.heightHint= 15;
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.horizontalSpan= 2;
- fProgressIndicator.setLayoutData(gd);
-
- // label showing current task
- fSubTaskLabel= new Label(c, SWT.LEFT | SWT.WRAP);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint= 35;
- gd.horizontalSpan= 2;
- fSubTaskLabel.setLayoutData(gd);
- fSubTaskLabel.setFont(parent.getFont());
-
- // update with values fProgressMonitor
- String s= fProgressMonitor.fTask;
- if (s == null)
- s= ""; //$NON-NLS-1$
- fTaskLabel.setText(s);
-
- if (fProgressMonitor.fMaxWork == IProgressMonitor.UNKNOWN)
- fProgressIndicator.beginAnimatedTask();
- else
- fProgressIndicator.beginTask(fProgressMonitor.fMaxWork);
-
- if (fProgressMonitor.fSubTask != null)
- fSubTaskLabel.setText(fProgressMonitor.fSubTask);
- fProgressIndicator.worked(fProgressMonitor.fWorked);
-
- fProgressMonitor.activate(this);
- applyDialogFont(c);
- return c;
- }
-
- void beginTask(final String name, final int totalWork) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- fTaskLabel.setText(name);
-
- if (fProgressIndicator != null && fProgressIndicator.isDisposed()) {
- if (totalWork == IProgressMonitor.UNKNOWN)
- fProgressIndicator.beginAnimatedTask();
- else
- fProgressIndicator.beginTask(totalWork);
- }
- }
- }
- );
- }
-
- void setTaskName(final String name) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- if (fTaskLabel != null && fTaskLabel.isDisposed())
- fTaskLabel.setText(name);
- }
- }
- );
- }
-
- void setSubTaskName(final String name) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- String n= (name == null) ? "" : name; //$NON-NLS-1$
- if (fSubTaskLabel != null && !fSubTaskLabel.isDisposed())
- fSubTaskLabel.setText(n);
- }
- }
- );
- }
-
- void done() {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- if (fProgressIndicator != null && !fProgressIndicator.isDisposed()) {
- fProgressIndicator.sendRemainingWork();
- fProgressIndicator.done();
- }
- }
- }
- );
- }
-
- void worked(final double work) {
- fParentShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- if (fProgressIndicator != null && !fProgressIndicator.isDisposed())
- fProgressIndicator.worked(work);
- }
- }
- );
- }
-
- protected Point getInitialSize() {
- return getShell().computeSize(450, SWT.DEFAULT);
- }
- }
-
- private static class ProgressMonitor implements IProgressMonitor {
-
- private int fMaxWork;
- private String fTask;
- private String fSubTask;
- private int fWorked;
- private ProgressMonitorDialog fProgressMonitorDialog;
- private boolean fIsCanceled;
-
- public void beginTask(String name, int totalWork) {
-
- fTask= name;
- fMaxWork= totalWork;
- fWorked= 0;
-
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.beginTask(name, totalWork);
- }
-
- void activate(ProgressMonitorDialog dialog) {
- fProgressMonitorDialog= dialog;
- }
-
- public void done() {
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.done();
- }
-
- public void setTaskName(String name) {
- fTask= name;
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.setTaskName(name);
- }
-
- public boolean isCanceled() {
- return fIsCanceled;
- }
-
- public void setCanceled(boolean b) {
- fIsCanceled= b;
- }
-
- public void subTask(String name) {
- fSubTask= name;
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.setSubTaskName(name);
- }
-
- public void worked(int work) {
- if (fProgressMonitorDialog != null)
- internalWorked(work);
- else
- fWorked+= work;
- }
-
- public void internalWorked(double work) {
- if (fProgressMonitorDialog != null)
- fProgressMonitorDialog.worked(work);
- }
- }
-
- public static void run(boolean cancelable, int timeout, Shell parent, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
-
- Display display= parent.getDisplay();
-
- ProgressMonitor pm= new ProgressMonitor();
-
- ModalContextThread t= new ModalContextThread(runnable, pm);
- t.start(); // start the long running operation
-
- // wait until long operations terminates or timeout
- try {
- t.join(timeout);
- } catch (InterruptedException e) {
- // silently ignored
- }
-
- if (t.timeout(display)) { // timeout
- ProgressMonitorDialog dialog= new ProgressMonitorDialog(parent, cancelable, pm);
- dialog.open();
- t.block();
- dialog.close();
- }
-
- Throwable throwable= t.fThrowable;
- if (throwable != null) {
- if (throwable instanceof InvocationTargetException) {
- throw (InvocationTargetException) throwable;
- } else if (throwable instanceof InterruptedException) {
- throw (InterruptedException) throwable;
- } else if (throwable instanceof OperationCanceledException) {
- throw new InterruptedException(throwable.getMessage());
- } else {
- throw new InvocationTargetException(throwable);
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java
deleted file mode 100644
index e1aca48c9..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java
+++ /dev/null
@@ -1,176 +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.compare.internal;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.compare.rangedifferencer.IRangeComparator;
-import org.eclipse.compare.contentmergeviewer.ITokenComparator;
-
-/**
- * Implements the <code>ITokenComparator</code> interface for words (or tokens)
- * in a string.
- * A <code>TokenComparator</code> is used as the input for the <code>RangeDifferencer</code>
- * engine to perform a token oriented compare on strings.
- */
-public class TokenComparator implements ITokenComparator {
-
- private boolean fShouldEscape= true;
- private String fText;
- private int fCount;
- private int[] fStarts;
- private int[] fLengths;
-
- /**
- * Creates a <code>TokenComparator</code> for the given string.
- *
- * @param string the string that is split into token
- */
- public TokenComparator(String text) {
-
- Assert.isNotNull(text);
-
- fText= text;
-
- int length= fText.length();
- fStarts= new int[length]; // pessimistic assumption!
- fLengths= new int[length];
- fCount= 0;
-
- char lastCategory= 0; // 0: no category
- for (int i= 0; i < length; i++) {
- char c= fText.charAt(i);
-
- char category= '?'; // unspecified category
- if (Character.isWhitespace(c))
- category= ' '; // white space category
- else if (Character.isDigit(c))
- category= '0'; // digits
- else if (Character.isLetter(c))
- category= 'a'; // letters
-
- if (category != lastCategory) {
- // start a new token
- fStarts[fCount++]= i;
- lastCategory= category;
- }
- fLengths[fCount-1]++;
- }
- }
-
- /**
- * Creates a <code>TokenComparator</code> for the given string.
- *
- * @param string the string that is split into token
- * @param shouldEscape
- */
- public TokenComparator(String s, boolean shouldEscape) {
- this(s);
- fShouldEscape= shouldEscape;
- }
-
- /**
- * Returns the number of token in the string.
- *
- * @return number of token in the string
- */
- public int getRangeCount() {
- return fCount;
- }
-
- /* (non Javadoc)
- * see ITokenComparator.getTokenStart
- */
- public int getTokenStart(int index) {
- if (index < fCount)
- return fStarts[index];
- return fText.length();
- }
-
- /* (non Javadoc)
- * see ITokenComparator.getTokenLength
- */
- public int getTokenLength(int index) {
- if (index < fCount)
- return fLengths[index];
- return 0;
- }
-
- /**
- * Returns <code>true</code> if a token given by the first index
- * matches a token specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the number of the token within this range comparator
- * @param other the range comparator to compare this with
- * @param otherIndex the number of the token within the other comparator
- * @return <code>true</code> if the token are equal
- */
- public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) {
- if (other != null && getClass() == other.getClass()) {
- TokenComparator tc= (TokenComparator) other;
- int thisLen= getTokenLength(thisIndex);
- int otherLen= tc.getTokenLength(otherIndex);
- if (thisLen == otherLen)
- return fText.regionMatches(false, getTokenStart(thisIndex), tc.fText, tc.getTokenStart(otherIndex), thisLen);
- }
- return false;
- }
-
- /**
- * Aborts the comparison if the number of tokens is too large.
- *
- * @return <code>true</code> to abort a token comparison
- */
- public boolean skipRangeComparison(int length, int max, IRangeComparator other) {
-
- if (!fShouldEscape)
- return false;
-
- if (getRangeCount() < 50 || other.getRangeCount() < 50)
- return false;
-
- if (max < 100)
- return false;
-
- if (length < 100)
- return false;
-
- if (max > 800)
- return true;
-
- if (length < max / 4)
- return false;
-
- return true;
- }
-
-// public static void main(String args[]) {
-// //String in= "private static boolean isWhitespace(char c) {";
-// //String in= "for (int j= 0; j < l-1; j++) {";
-// String in= "for do i= 123; i++";
-// TokenComparator tc= new TokenComparator(in, false);
-//
-// System.out.println("n: " + tc.getRangeCount());
-// System.out.println(in);
-//
-// int p= 0;
-// for (int i= 0; i < tc.getRangeCount(); i++) {
-// int l= tc.getTokenLength(i);
-// System.out.print("<");
-//
-// for (int j= 0; j < l-1; j++)
-// System.out.print(" ");
-// }
-// System.out.println();
-//
-// //System.out.println("extract: <" + tc.extract(16, 1) + ">");
-// }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
deleted file mode 100644
index 0f986513e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ /dev/null
@@ -1,581 +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.compare.internal;
-
-import java.io.*;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.ui.*;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IEncodedStreamContentAccessor;
-import org.eclipse.compare.IStreamContentAccessor;
-
-/**
- * Convenience and utility methods.
- */
-public class Utilities {
-
- public static void registerAction(IKeyBindingService kbs, IAction a, String id) {
- if (kbs != null) {
- a.setActionDefinitionId(id);
- kbs.registerAction(a);
- }
- }
-
- public static IWorkbenchPartSite findSite(Control c) {
- while (c != null && !c.isDisposed()) {
- Object data= c.getData();
- if (data instanceof IWorkbenchPart)
- return ((IWorkbenchPart)data).getSite();
- c= c.getParent();
- }
- return null;
- }
-
- public static IActionBars findActionBars(Control c) {
- while (c != null && !c.isDisposed()) {
- Object data= c.getData();
- if (data instanceof CompareEditor)
- return ((CompareEditor)data).getActionBars();
-
- // PR 1GDVZV7: ITPVCM:WIN98 - CTRL + C does not work in Java source compare
- if (data instanceof IViewPart)
- return ((IViewPart)data).getViewSite().getActionBars();
- // end PR 1GDVZV7
-
- c= c.getParent();
- }
- return null;
- }
-
- public static void setEnableComposite(Composite composite, boolean enable) {
- Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++)
- children[i].setEnabled(enable);
- }
-
- public static boolean getBoolean(CompareConfiguration cc, String key, boolean dflt) {
- if (cc != null) {
- Object value= cc.getProperty(key);
- if (value instanceof Boolean)
- return ((Boolean) value).booleanValue();
- }
- return dflt;
- }
-
- public static void firePropertyChange(ListenerList ll, Object source, String property, Object old, Object newValue) {
- if (ll != null) {
- PropertyChangeEvent event= null;
- Object[] listeners= ll.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- IPropertyChangeListener l= (IPropertyChangeListener) listeners[i];
- if (event == null)
- event= new PropertyChangeEvent(source, property, old, newValue);
- l.propertyChange(event);
- }
- }
- }
-
- public static boolean okToUse(Widget widget) {
- return widget != null && !widget.isDisposed();
- }
-
- private static ArrayList internalGetResources(ISelection selection, Class type) {
-
- ArrayList tmp= new ArrayList();
-
- if (selection instanceof IStructuredSelection) {
-
- Object[] s= ((IStructuredSelection)selection).toArray();
-
- for (int i= 0; i < s.length; i++) {
-
- IResource resource= null;
-
- Object o= s[i];
- if (type.isInstance(o)) {
- resource= (IResource) o;
-
- } else if (o instanceof IAdaptable) {
- IAdaptable a= (IAdaptable) o;
- Object adapter= a.getAdapter(IResource.class);
- if (type.isInstance(adapter))
- resource= (IResource) adapter;
- }
-
- if (resource != null && resource.isAccessible())
- tmp.add(resource);
- }
- }
-
- return tmp;
- }
-
- /**
- * Convenience method: extract all accessible <code>IResources</code> from given selection.
- * Never returns null.
- */
- public static IResource[] getResources(ISelection selection) {
- ArrayList tmp= internalGetResources(selection, IResource.class);
- return (IResource[]) tmp.toArray(new IResource[tmp.size()]);
- }
-
- /**
- * Convenience method: extract all accessible <code>IFiles</code> from given selection.
- * Never returns null.
- */
- public static IFile[] getFiles(ISelection selection) {
- ArrayList tmp= internalGetResources(selection, IFile.class);
- return (IFile[]) tmp.toArray(new IFile[tmp.size()]);
- }
-
- 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) {
- // silently ignored
- }
- }
- try {
- bos.close();
- } catch (IOException x) {
- // silently ignored
- }
- }
-
- return bos.toByteArray();
- }
-
- public static String getIconPath(Display display) {
- return "icons/full/"; //$NON-NLS-1$
- }
-
- /**
- * Initialize the given Action from a ResourceBundle.
- */
- public static void initAction(IAction a, ResourceBundle bundle, 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;
- }
-
- a.setText(getString(bundle, labelKey, labelKey));
- a.setToolTipText(getString(bundle, tooltipKey, null));
- a.setDescription(getString(bundle, descriptionKey, null));
-
- String relPath= getString(bundle, imageKey, null);
- if (relPath != null && 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= CompareUIPlugin.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87)
- if (id != null)
- a.setDisabledImageDescriptor(id);
- id= CompareUIPlugin.getImageDescriptor(cPath);
- if (id != null)
- a.setHoverImageDescriptor(id);
- id= CompareUIPlugin.getImageDescriptor(ePath);
- if (id != null)
- a.setImageDescriptor(id);
- }
- }
-
- public static void initToggleAction(IAction a, ResourceBundle bundle, String prefix, boolean checked) {
-
- String tooltip= null;
- if (checked)
- tooltip= getString(bundle, prefix + "tooltip.checked", null); //$NON-NLS-1$
- else
- tooltip= getString(bundle, prefix + "tooltip.unchecked", null); //$NON-NLS-1$
- if (tooltip == null)
- tooltip= getString(bundle, prefix + "tooltip", null); //$NON-NLS-1$
-
- if (tooltip != null)
- a.setToolTipText(tooltip);
-
- String description= null;
- if (checked)
- description= getString(bundle, prefix + "description.checked", null); //$NON-NLS-1$
- else
- description= getString(bundle, prefix + "description.unchecked", null); //$NON-NLS-1$
- if (description == null)
- description= getString(bundle, prefix + "description", null); //$NON-NLS-1$
-
- if (description != null)
- a.setDescription(description);
-
- }
-
- public static String getString(ResourceBundle bundle, String key, String dfltValue) {
-
- if (bundle != null) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException x) {
- // NeedWork
- }
- }
- return dfltValue;
- }
-
- public static String getFormattedString(ResourceBundle bundle, String key, String arg) {
-
- if (bundle != null) {
- try {
- return MessageFormat.format(bundle.getString(key), new String[] { arg });
- } catch (MissingResourceException x) {
- // NeedWork
- }
- }
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
-
- public static String getString(String key) {
- try {
- return CompareUIPlugin.getResourceBundle().getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static String getFormattedString(String key, String arg) {
- try{
- return MessageFormat.format(CompareUIPlugin.getResourceBundle().getString(key), new String[] { arg });
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static String getString(ResourceBundle bundle, String key) {
- return getString(bundle, key, key);
- }
-
- public static int getInteger(ResourceBundle bundle, String key, int dfltValue) {
-
- if (bundle != null) {
- try {
- String s= bundle.getString(key);
- if (s != null)
- return Integer.parseInt(s);
- } catch (NumberFormatException x) {
- // NeedWork
- } catch (MissingResourceException x) {
- // NeedWork
- }
- }
- return dfltValue;
- }
-
- /**
- * Answers <code>true</code> if the given selection contains resources that don't
- * have overlapping paths and <code>false</code> otherwise.
- */
- /*
- public static boolean isSelectionNonOverlapping() throws TeamException {
- IResource[] resources = getSelectedResources();
- // allow operation for non-overlapping resource selections
- if(resources.length>0) {
- List validPaths = new ArrayList(2);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
-
- // only allow cvs resources to be selected
- if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
- return false;
- }
-
- // check if this resource overlaps other selections
- IPath resourceFullPath = resource.getFullPath();
- if(!validPaths.isEmpty()) {
- for (Iterator it = validPaths.iterator(); it.hasNext();) {
- IPath path = (IPath) it.next();
- if(path.isPrefixOf(resourceFullPath) ||
- resourceFullPath.isPrefixOf(path)) {
- return false;
- }
- }
- }
- validPaths.add(resourceFullPath);
-
- // ensure that resources are managed
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if(cvsResource.isFolder()) {
- if( ! ((ICVSFolder)cvsResource).isCVSFolder()) return false;
- } else {
- if( ! cvsResource.isManaged()) return false;
- }
- }
- return true;
- }
- return false;
- }
- */
-
- /* validate edit utilities */
-
- /**
- * Status constant indicating that an validateEdit call has changed the
- * content of a file on disk.
- */
- private static final int VALIDATE_EDIT_PROBLEM= 10004;
-
-
- /**
- * Makes the given resources committable. Committable means that all
- * resources are writeable and that the content of the resources hasn't
- * changed by calling <code>validateEdit</code> for a given file on
- * <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param shell the Shell passed to <code>validateEdit</code> as a context
- * @return returns <code>true</code> if all resources are committable, <code>false</code> otherwise
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- public static boolean validateResource(IResource resource, Shell shell, String title) {
- return validateResources(new IResource[] { resource }, shell, title);
- }
-
- /**
- * Makes the given resources committable. Committable means that all
- * resources are writeable and that the content of the resources hasn't
- * changed by calling <code>validateEdit</code> for a given file on
- * <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param shell the Shell passed to <code>validateEdit</code> as a context
- * @return returns <code>true</code> if all resources are committable, <code>false</code> otherwise
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- public static boolean validateResources(List resources, Shell shell, String title) {
- IResource r[]= (IResource[]) resources.toArray(new IResource[resources.size()]);
- return validateResources(r, shell, title);
- }
-
- /**
- * Makes the given resources committable. Committable means that all
- * resources are writeable and that the content of the resources hasn't
- * changed by calling <code>validateEdit</code> for a given file on
- * <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param shell the Shell passed to <code>validateEdit</code> as a context
- * @return returns <code>true</code> if all resources are committable, <code>false</code> otherwise
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- public static boolean validateResources(IResource[] resources, Shell shell, String title) {
-
- // get all readonly files
- List readOnlyFiles= getReadonlyFiles(resources);
- if (readOnlyFiles.size() == 0)
- return true;
-
- // get timestamps of readonly files before validateEdit
- Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
-
- IFile[] files= (IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]);
- IStatus status= ResourcesPlugin.getWorkspace().validateEdit(files, shell);
- if (! status.isOK()) {
- String message= getString("ValidateEdit.error.unable_to_perform"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, message, status); //$NON-NLS-1$
- return false;
- }
-
- IStatus modified= null;
- Map newTimeStamps= createModificationStampMap(readOnlyFiles);
- for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
- IFile file= (IFile) iter.next();
- if (file.isReadOnly()) {
- IStatus entry= new Status(IStatus.ERROR,
- CompareUIPlugin.getPluginId(),
- VALIDATE_EDIT_PROBLEM,
- getFormattedString("ValidateEdit.error.stillReadonly", file.getFullPath().toString()), //$NON-NLS-1$
- null);
- modified= addStatus(modified, entry);
- } else if (! oldTimeStamps.get(file).equals(newTimeStamps.get(file))) {
- IStatus entry= new Status(IStatus.ERROR,
- CompareUIPlugin.getPluginId(),
- VALIDATE_EDIT_PROBLEM,
- getFormattedString("ValidateEdit.error.fileModified", file.getFullPath().toString()), //$NON-NLS-1$
- null);
- modified= addStatus(modified, entry);
- }
- }
- if (modified != null) {
- String message= getString("ValidateEdit.error.unable_to_perform"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, message, modified);
- return false;
- }
- return true;
- }
-
- private static List getReadonlyFiles(IResource[] resources) {
- List readOnlyFiles= new ArrayList();
- for (int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (resource.getType() == IResource.FILE && resource.isReadOnly())
- readOnlyFiles.add(resource);
- }
- return readOnlyFiles;
- }
-
- private static Map createModificationStampMap(List files) {
- Map map= new HashMap();
- for (Iterator iter= files.iterator(); iter.hasNext(); ) {
- IFile file= (IFile)iter.next();
- map.put(file, new Long(file.getModificationStamp()));
- }
- return map;
- }
-
- private static IStatus addStatus(IStatus status, IStatus entry) {
-
- if (status == null)
- return entry;
-
- if (status.isMultiStatus()) {
- ((MultiStatus)status).add(entry);
- return status;
- }
-
- MultiStatus result= new MultiStatus(CompareUIPlugin.getPluginId(),
- VALIDATE_EDIT_PROBLEM,
- getString("ValidateEdit.error.unable_to_perform"), null); //$NON-NLS-1$
- result.add(status);
- result.add(entry);
- return result;
- }
-
- // encoding
-
- /**
- * Returns null if an error occurred.
- */
- public static String readString(InputStream is, String encoding) {
- if (is == null)
- return null;
- BufferedReader reader= null;
- try {
- StringBuffer buffer= new StringBuffer();
- char[] part= new char[2048];
- int read= 0;
- reader= new BufferedReader(new InputStreamReader(is, encoding));
-
- while ((read= reader.read(part)) != -1)
- buffer.append(part, 0, read);
-
- return buffer.toString();
-
- } catch (IOException ex) {
- // NeedWork
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- }
- return null;
- }
-
- public static String getCharset(IResource resource) {
- if (resource instanceof IEncodedStreamContentAccessor) {
- try {
- return ((IEncodedStreamContentAccessor)resource).getCharset();
- } catch (CoreException ex) {
- // fall through
- }
- }
- return ResourcesPlugin.getEncoding();
- }
-
- public static byte[] getBytes(String s, String encoding) {
- byte[] bytes= null;
- if (s != null) {
- try {
- bytes= s.getBytes(encoding); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- bytes= s.getBytes();
- }
- }
- return bytes;
- }
-
- public static String readString(IStreamContentAccessor sa) throws CoreException {
- InputStream is= sa.getContents();
- String encoding= null;
- if (sa instanceof IEncodedStreamContentAccessor)
- encoding= ((IEncodedStreamContentAccessor)sa).getCharset();
- if (encoding == null)
- encoding= ResourcesPlugin.getEncoding();
- return Utilities.readString(is, encoding);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
deleted file mode 100644
index 3d5dbcc6f..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.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.compare.internal;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.compare.*;
-
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Creates <code>Viewer</code>s from an <code>IConfigurationElement</code>.
- */
-public class ViewerDescriptor implements IViewerDescriptor {
-
- private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private final static String EXTENSIONS_ATTRIBUTE= "extensions"; //$NON-NLS-1$
-
- private IConfigurationElement fConfiguration;
- private IViewerCreator fViewerCreator;
- private Class fViewerClass;
-
- public ViewerDescriptor(IConfigurationElement config) {
- fConfiguration= config;
- }
-
- public Viewer createViewer(Viewer currentViewer, Composite parent, CompareConfiguration mp) {
-
- if (currentViewer != null && currentViewer.getClass() == fViewerClass) {
- //System.out.println("reused viewer: " + currentViewer.getClass().getName());
- return currentViewer;
- }
-
- if (fViewerCreator == null) {
- try {
- fViewerCreator= (IViewerCreator) fConfiguration.createExecutableExtension(CLASS_ATTRIBUTE);
- } catch (CoreException e) {
- // NeedWork
- }
- }
-
- if (fViewerCreator != null) {
- Viewer viewer= fViewerCreator.createViewer(parent, mp);
- if (viewer != null)
- fViewerClass= viewer.getClass();
- return viewer;
- }
-
- return null;
- }
-
- public String getExtension() {
- return fConfiguration.getAttribute(EXTENSIONS_ATTRIBUTE);
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java
deleted file mode 100644
index 27e580c5e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java
+++ /dev/null
@@ -1,17 +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.compare.internal;
-
-
-public class ViewerSwitchingCancelled extends Error {
-
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java
deleted file mode 100644
index d52929878..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-/* package */ class LineReader {
-
- private boolean fHaveChar= false;
- private int fLastChar;
- private boolean fSawEOF= false;
- private BufferedReader fReader;
- private boolean fIgnoreSingleCR= false;
-
-
- /* package */ LineReader(BufferedReader reader) {
- fReader= reader;
- Assert.isNotNull(reader);
- }
-
- void ignoreSingleCR() {
- fIgnoreSingleCR= true;
- }
-
- /**
- * Reads a line of text. A line is considered to be terminated by any one
- * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
- * followed immediately by a linefeed.
- * @return A string containing the contents of the line including
- * the line-termination characters, or <code>null</code> if the end of the
- * stream has been reached
- * @exception IOException If an I/O error occurs
- */
- /* package */ String readLine() throws IOException {
- StringBuffer sb= null;
-
- while (!fSawEOF) {
- int c= readChar();
- if (c == -1) {
- fSawEOF= true;
- break;
- }
- if (sb == null)
- sb= new StringBuffer();
- sb.append((char)c);
- if (c == '\n')
- break;
- if (c == '\r') {
- c= readChar();
- if (c == -1) {
- fSawEOF= true;
- break; // EOF
- }
- if (c != '\n') {
- if (fIgnoreSingleCR) {
- sb.append((char)c);
- continue;
- } else {
- fHaveChar= true;
- fLastChar= c;
- }
- } else
- sb.append((char)c);
- break;
- }
- }
-
- if (sb != null)
- return sb.toString();
- return null;
- }
-
- /* package */ void close() {
- try {
- fReader.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
-
- /* package */ List readLines() {
- try {
- List lines= new ArrayList();
- String line;
- while ((line= readLine()) != null)
- lines.add(line);
- return lines;
- } catch (IOException ex) {
- // NeedWork
- //System.out.println("error while reading file: " + fileName + "(" + ex + ")");
- } finally {
- close();
- }
- return null;
- }
- /**
- * Returns the number of characters in the given string without
- * counting a trailing line separator.
- */
- /* package */ int lineContentLength(String line) {
- if (line == null)
- return 0;
- int length= line.length();
- for (int i= length-1; i >= 0; i--) {
- char c= line.charAt(i);
- if (c =='\n' || c == '\r')
- length--;
- else
- break;
- }
- return length;
- }
-
- //---- private
-
- private int readChar() throws IOException {
- if (fHaveChar) {
- fHaveChar= false;
- return fLastChar;
- }
- return fReader.read();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java
deleted file mode 100644
index 08b7b9556..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.ui.IEditorPart;
-
-import org.eclipse.compare.internal.*;
-
-
-public class CompareWithPatchAction extends BaseCompareAction {
-
- static class PatchWizardDialog extends WizardDialog {
-
- PatchWizardDialog(Shell parent, IWizard wizard) {
- super(parent, wizard);
-
- setShellStyle(getShellStyle() | SWT.RESIZE);
- setMinimumPageSize(700, 500);
- }
- }
-
- protected boolean isEnabled(ISelection selection) {
- return Utilities.getResources(selection).length == 1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.internal.BaseCompareAction#run(org.eclipse.jface.viewers.ISelection)
- */
- protected void run(ISelection selection) {
- PatchWizard wizard= new PatchWizard(selection);
-
- if (areAllEditorsSaved()) {
- PatchWizardDialog dialog= new PatchWizardDialog(CompareUIPlugin.getShell(), wizard);
- dialog.open();
- }
- }
-
- private boolean areAllEditorsSaved(){
- if (CompareUIPlugin.getDirtyEditors().length == 0)
- return true;
- if (! saveAllDirtyEditors())
- return false;
- Shell shell= CompareUIPlugin.getShell();
- try {
- // Save isn't cancelable.
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceDescription description= workspace.getDescription();
- boolean autoBuild= description.isAutoBuilding();
- description.setAutoBuilding(false);
- workspace.setDescription(description);
- try {
- new ProgressMonitorDialog(shell).run(false, false, createRunnable());
- } finally {
- description.setAutoBuilding(autoBuild);
- workspace.setDescription(description);
- }
- return true;
- } catch (InvocationTargetException e) {
- ExceptionHandler.handle(e, shell, PatchMessages.getString("PatchAction.ExceptionTitle"), PatchMessages.getString("Exception")); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- } catch (CoreException e) {
- ExceptionHandler.handle(e, shell, PatchMessages.getString("PatchAction.ExceptionTitle"), PatchMessages.getString("Exception")); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- } catch (InterruptedException e) {
- Assert.isTrue(false); // Can't happen. Operation isn't cancelable.
- return false;
- }
- }
-
- private IRunnableWithProgress createRunnable() {
- return new IRunnableWithProgress() {
- public void run(IProgressMonitor pm) {
- IEditorPart[] editorsToSave= CompareUIPlugin.getDirtyEditors();
- pm.beginTask(PatchMessages.getString("PatchAction.SavingDirtyEditorsTask"), editorsToSave.length); //$NON-NLS-1$
- for (int i= 0; i < editorsToSave.length; i++) {
- editorsToSave[i].doSave(new SubProgressMonitor(pm, 1));
- pm.worked(1);
- }
- pm.done();
- }
- };
- }
-
- private boolean saveAllDirtyEditors() {
- if (ComparePreferencePage.getSaveAllEditors()) //must save everything
- return true;
- ListDialog dialog= new ListDialog(CompareUIPlugin.getShell()) {
- protected Control createDialogArea(Composite parent) {
- Composite result= (Composite) super.createDialogArea(parent);
- final Button check= new Button(result, SWT.CHECK);
- check.setText(PatchMessages.getString("PatchAction.AlwaysSaveQuestion")); //$NON-NLS-1$
- check.setSelection(ComparePreferencePage.getSaveAllEditors());
- check.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ComparePreferencePage.setSaveAllEditors(check.getSelection());
- }
- }
- );
- applyDialogFont(result);
- return result;
- }
- };
- dialog.setTitle(PatchMessages.getString("PatchAction.SaveAllQuestion")); //$NON-NLS-1$
- dialog.setAddCancelButton(true);
- dialog.setLabelProvider(createDialogLabelProvider());
- dialog.setMessage(PatchMessages.getString("PatchAction.SaveAllDescription")); //$NON-NLS-1$
- dialog.setContentProvider(new ListContentProvider());
- dialog.setInput(Arrays.asList(CompareUIPlugin.getDirtyEditors()));
- return dialog.open() == Window.OK;
- }
-
- private ILabelProvider createDialogLabelProvider() {
- return new LabelProvider() {
- public Image getImage(Object element) {
- return ((IEditorPart) element).getTitleImage();
- }
- public String getText(Object element) {
- return ((IEditorPart) element).getTitle();
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java
deleted file mode 100644
index ad5899bbe..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-
-
-/* package */ class Diff {
-
- IPath fOldPath, fNewPath;
- long fOldDate, fNewDate; // if 0: no file
- List fHunks= new ArrayList();
- boolean fMatches= false;
- private boolean fIsEnabled2= true;
- String fRejected;
-
-
- /* package */ Diff(IPath oldPath, long oldDate, IPath newPath, long newDate) {
- fOldPath= oldPath;
- fOldDate= oldPath == null ? 0 : oldDate;
- fNewPath= newPath;
- fNewDate= newPath == null ? 0 : newDate;
- }
-
- boolean isEnabled() {
- return fIsEnabled2;
- }
-
- void setEnabled(boolean b) {
- fIsEnabled2= b;
- }
-
- void reverse() {
- IPath tp= fOldPath;
- fOldPath= fNewPath;
- fNewPath= tp;
-
- long t= fOldDate;
- fOldDate= fNewDate;
- fNewDate= t;
-
- Iterator iter= fHunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- hunk.reverse();
- }
- }
-
- Hunk[] getHunks() {
- return (Hunk[]) fHunks.toArray(new Hunk[fHunks.size()]);
- }
-
- IPath getPath() {
- if (fOldPath != null)
- return fOldPath;
- return fNewPath;
- }
-
- void finish() {
- if (fHunks.size() == 1) {
- Hunk h= (Hunk) fHunks.get(0);
- if (h.fNewLength == 0) {
- fNewDate= 0;
- fNewPath= fOldPath;
- }
- }
- }
-
- /* package */ void add(Hunk hunk) {
- fHunks.add(hunk);
- }
-
- /* package */ int getType() {
- if (fOldDate == 0)
- return Differencer.ADDITION;
- if (fNewDate == 0)
- return Differencer.DELETION;
- return Differencer.CHANGE;
- }
-
- /* package */ String getDescription(int strip) {
- IPath path= fOldPath;
- if (fOldDate == 0)
- path= fNewPath;
- if (strip > 0 && strip < path.segmentCount())
- path= path.removeFirstSegments(strip);
- return path.toOSString();
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java
deleted file mode 100644
index 9efd347da..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.util.List;
-
-/**
- * A Hunk describes a range of changed lines and some context lines.
- */
-/* package */ class Hunk {
-
- Diff fParent;
- int fOldStart, fOldLength;
- int fNewStart, fNewLength;
- String[] fLines;
- boolean fMatches= false;
- private boolean fIsEnabled= true;
-
-
- /* package */ Hunk(Diff parent, int[] oldRange, int[] newRange, List lines) {
-
- fParent= parent;
- if (fParent != null)
- fParent.add(this);
-
- if (oldRange[0] > 0)
- fOldStart= oldRange[0]-1; // line number start at 0!
- else
- fOldStart= 0;
- fOldLength= oldRange[1];
- if (newRange[0] > 0)
- fNewStart= newRange[0]-1; // line number start at 0!
- else
- fNewStart= 0;
- fNewLength= newRange[1];
-
- fLines= (String[]) lines.toArray(new String[lines.size()]);
- }
-
- boolean isEnabled() {
- return fIsEnabled;
- }
-
- void setEnabled(boolean enable) {
- fIsEnabled= enable;
- }
-
- void reverse() {
- int t= fOldStart;
- fOldStart= fNewStart;
- fNewStart= t;
-
- t= fOldLength;
- fOldLength= fNewLength;
- fNewLength= t;
-
- for (int i= 0; i < fLines.length; i++) {
- String line= fLines[i];
- char c= line.charAt(0);
- switch (c) {
- case '+':
- fLines[i]= '-' + line.substring(1);
- break;
- case '-':
- fLines[i]= '+' + line.substring(1);
- break;
- default:
- break;
- }
- }
- }
-
- /**
- * Returns the contents of this hunk.
- * Each line starts with a control character. Their meaning is as follows:
- * <ul>
- * <li>
- * '+': add the line
- * <li>
- * '-': delete the line
- * <li>
- * ' ': no change, context line
- * </ul>
- */
- String getContent() {
- StringBuffer sb= new StringBuffer();
- for (int i= 0; i < fLines.length; i++) {
- String line= fLines[i];
- sb.append(line.substring(0, Patcher.length(line)));
- sb.append('\n');
- }
- return sb.toString();
- }
-
- /**
- * Returns a descriptive String for this hunk.
- * It is in the form old_start,old_length -> new_start,new_length.
- */
- String getDescription() {
- StringBuffer sb= new StringBuffer();
- sb.append(Integer.toString(fOldStart));
- sb.append(',');
- sb.append(Integer.toString(fOldLength));
- sb.append(" -> "); //$NON-NLS-1$
- sb.append(Integer.toString(fNewStart));
- sb.append(',');
- sb.append(Integer.toString(fNewLength));
- return sb.toString();
- }
-
- String getRejectedDescription() {
- StringBuffer sb= new StringBuffer();
- sb.append("@@ -"); //$NON-NLS-1$
- sb.append(Integer.toString(fOldStart));
- sb.append(',');
- sb.append(Integer.toString(fOldLength));
- sb.append(" +"); //$NON-NLS-1$
- sb.append(Integer.toString(fNewStart));
- sb.append(',');
- sb.append(Integer.toString(fNewLength));
- sb.append(" @@"); //$NON-NLS-1$
- return sb.toString();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
deleted file mode 100644
index 1aaaf2a75..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
+++ /dev/null
@@ -1,524 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.text.MessageFormat;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.model.*;
-
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-
-/* package */ class InputPatchPage extends WizardPage {
-
- // constants
- protected static final int SIZING_TEXT_FIELD_WIDTH= 250;
- protected static final int COMBO_HISTORY_LENGTH= 5;
-
- // dialog store id constants
- private final static String PAGE_NAME= "PatchWizardPage1"; //$NON-NLS-1$
- private final static String STORE_PATCH_FILES_ID= PAGE_NAME + ".PATCH_FILES"; //$NON-NLS-1$
- private final static String STORE_USE_CLIPBOARD_ID= PAGE_NAME + ".USE_CLIPBOARD"; //$NON-NLS-1$
-
- private boolean fShowError= false;
-
- // SWT widgets
- private Button fUseClipboardButton;
- private Combo fPatchFileNameField;
- private Button fPatchFileBrowseButton;
- private Button fUsePatchFileButton;
- private Group fPatchFileGroup;
- private CheckboxTreeViewer fPatchTargets;
- private PatchWizard fPatchWizard;
-
-
- InputPatchPage(PatchWizard pw) {
- super("InputPatchPage", PatchMessages.getString("InputPatchPage.title"), null); //$NON-NLS-1$ //$NON-NLS-2$
- fPatchWizard= pw;
- setMessage(PatchMessages.getString("InputPatchPage.message")); //$NON-NLS-1$
- }
-
- /**
- * Get a path from the supplied text widget.
- * @return org.eclipse.core.runtime.IPath
- */
- protected IPath getPathFromText(Text textField) {
- return (new Path(textField.getText())).makeAbsolute();
- }
-
- /* package */ String getPatchName() {
- if (getUseClipboard())
- return PatchMessages.getString("InputPatchPage.Clipboard"); //$NON-NLS-1$
- return getPatchFilePath();
- }
-
- public void createControl(Composite parent) {
-
- Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(/* GridData.VERTICAL_ALIGN_FILL | */ GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- Label l= new Label(composite, SWT.NONE); // a spacer
- l.setText(PatchMessages.getString("InputPatchPage.SelectInput")); //$NON-NLS-1$
- buildInputGroup(composite);
-
- new Label(composite, SWT.NONE); // a spacer
-
- buildPatchFileGroup(composite);
-
- restoreWidgetValues();
-
- updateWidgetEnablements();
- //updatePageCompletion();
-
- Dialog.applyDialogFont(composite);
- WorkbenchHelp.setHelp(composite, ICompareContextIds.PATCH_INPUT_WIZARD_PAGE);
- }
-
- /* (non-JavaDoc)
- * Method declared in IWizardPage.
- */
- public IWizardPage getNextPage() {
-
- Patcher patcher= ((PatchWizard) getWizard()).getPatcher();
-
- String source;
- // Create a reader for the input
- Reader reader= null;
- if (getUseClipboard()) {
- Control c= getControl();
- if (c != null) {
- Clipboard clipboard= new Clipboard(c.getDisplay());
- Object o= clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- if (o instanceof String)
- reader= new StringReader((String)o);
- }
- source= PatchMessages.getString("InputPatchPage.Clipboard.title"); //$NON-NLS-1$
- } else {
- String patchFilePath= getPatchFilePath();
- if (patchFilePath != null) {
- try {
- reader= new FileReader(patchFilePath);
- } catch (FileNotFoundException ex) {
- MessageDialog.openError(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), //$NON-NLS-1$
- PatchMessages.getString("InputPatchPage.PatchFileNotFound.message")); //$NON-NLS-1$
- }
- }
- source= PatchMessages.getString("InputPatchPage.PatchFile.title"); //$NON-NLS-1$
- }
-
- // parse the input
- if (reader != null) {
- try {
- patcher.parse(new BufferedReader(reader));
- } catch (IOException ex) {
- MessageDialog.openError(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), //$NON-NLS-1$
- PatchMessages.getString("InputPatchPage.ParseError.message")); //$NON-NLS-1$
- }
-
- try {
- reader.close();
- } catch (IOException x) {
- // silently ignored
- }
- }
-
- Diff[] diffs= patcher.getDiffs();
- if (diffs == null || diffs.length == 0) {
- String format= PatchMessages.getString("InputPatchPage.NoDiffsFound.format"); //$NON-NLS-1$
- String message= MessageFormat.format(format, new String[] { source });
- MessageDialog.openInformation(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), message); //$NON-NLS-1$
- return this;
- }
-
- // if selected target is file ensure that patch file
- // contains only a patch for a single file
- IResource target= fPatchWizard.getTarget();
- if (target instanceof IFile && diffs.length > 1) {
- String format= PatchMessages.getString("InputPatchPage.SingleFileError.format"); //$NON-NLS-1$
- String message= MessageFormat.format(format, new String[] { source });
- MessageDialog.openInformation(null,
- PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), message); //$NON-NLS-1$
- return this;
- }
-
- // guess prefix count
- int guess= 0; // guessPrefix(diffs);
- patcher.setStripPrefixSegments(guess);
-
- return super.getNextPage();
- }
-
- /* (non-JavaDoc)
- * Method declared in IWizardPage.
- */
- public boolean canFlipToNextPage() {
- // we can't call getNextPage to determine if flipping is allowed since computing
- // the next page is quite expensive. So we say yes if the page is complete.
- return isPageComplete();
- }
-
- private void setEnablePatchFile(boolean enable) {
- fPatchFileNameField.setEnabled(enable);
- fPatchFileBrowseButton.setEnabled(enable);
- }
-
- /**
- * Create the group for selecting the patch file
- */
- private void buildPatchFileGroup(Composite parent) {
-
- fPatchFileGroup= new Group(parent, SWT.NONE);
- fPatchFileGroup.setText(PatchMessages.getString("InputPatchPage.SelectPatch.title")); //$NON-NLS-1$
- GridLayout layout= new GridLayout();
- layout.numColumns= 3;
- fPatchFileGroup.setLayout(layout);
- fPatchFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // 1st row
- fUsePatchFileButton= new Button(fPatchFileGroup, SWT.RADIO);
- fUsePatchFileButton.setText(PatchMessages.getString("InputPatchPage.FileButton.text")); //$NON-NLS-1$
-
- fPatchFileNameField= new Combo(fPatchFileGroup, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- //gd.horizontalIndent= 8;
- gd.widthHint= SIZING_TEXT_FIELD_WIDTH;
- fPatchFileNameField.setLayoutData(gd);
-
- fPatchFileBrowseButton= new Button(fPatchFileGroup, SWT.PUSH);
- fPatchFileBrowseButton.setText(PatchMessages.getString("InputPatchPage.ChooseFileButton.text")); //$NON-NLS-1$
- fPatchFileBrowseButton.setLayoutData(new GridData());
-
- // 2nd row
- fUseClipboardButton= new Button(fPatchFileGroup, SWT.RADIO);
- fUseClipboardButton.setText(PatchMessages.getString("InputPatchPage.UseClipboardButton.text")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan= 2;
- fUseClipboardButton.setLayoutData(gd);
-
-
- // Add listeners
- fUsePatchFileButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fShowError= true;
- setEnablePatchFile(!getUseClipboard());
- updateWidgetEnablements();
- }
- }
- );
- fPatchFileNameField.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setSourceName(fPatchFileNameField.getText());
- updateWidgetEnablements();
- }
- }
- );
- fPatchFileNameField.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- fShowError= true;
- updateWidgetEnablements();
- }
- }
- );
- fPatchFileBrowseButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handlePatchFileBrowseButtonPressed();
- updateWidgetEnablements();
- }
- }
- );
-
- //fPatchFileNameField.setFocus();
- }
-
- private void buildInputGroup(Composite parent) {
-
- PatchWizard pw= (PatchWizard) getWizard();
- IResource target= pw.getTarget();
- IWorkspace workspace= target.getWorkspace();
- IWorkspaceRoot root= workspace.getRoot();
-
- Tree tree= new Tree(parent, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint= 200;
- tree.setLayoutData(gd);
-
- fPatchTargets= new CheckboxTreeViewer(tree);
- fPatchTargets.setLabelProvider(new WorkbenchLabelProvider());
- fPatchTargets.setContentProvider(new WorkbenchContentProvider());
- fPatchTargets.setSorter(new WorkbenchViewerSorter());
- fPatchTargets.setInput(root);
- if (target != null) {
- fPatchTargets.expandToLevel(target, 0);
- fPatchTargets.setSelection(new StructuredSelection(target));
- }
-
- // register listeners
- fPatchTargets.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fPatchWizard.setTargets(Utilities.getResources(event.getSelection()));
- updateWidgetEnablements();
- }
- }
- );
- }
-
- /**
- * Updates the enable state of this page's controls.
- */
- private void updateWidgetEnablements() {
-
- String error= null;
-
- ISelection selection= fPatchTargets.getSelection();
- boolean anySelected= selection != null && !selection.isEmpty();
- if (!anySelected)
- error= PatchMessages.getString("InputPatchPage.NothingSelected.message"); //$NON-NLS-1$
-
- boolean gotPatch= false;
- if (getUseClipboard()) {
- Control c= getControl();
- if (c != null) {
- Clipboard clipboard= new Clipboard(c.getDisplay());
- Object o= clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- if (o instanceof String) {
- String s= ((String) o).trim();
- if (s.length() > 0)
- gotPatch= true;
- else
- error= PatchMessages.getString("InputPatchPage.ClipboardIsEmpty.message"); //$NON-NLS-1$
- } else
- error= PatchMessages.getString("InputPatchPage.NoTextInClipboard.message"); //$NON-NLS-1$
- } else
- error= PatchMessages.getString("InputPatchPage.CouldNotReadClipboard.message"); //$NON-NLS-1$
- } else {
- String path= fPatchFileNameField.getText();
- if (path != null && path.length() > 0) {
- File file= new File(path);
- gotPatch= file.exists() && file.isFile() && file.length() > 0;
- if (!gotPatch)
- error= PatchMessages.getString("InputPatchPage.CannotLocatePatch.message") + path; //$NON-NLS-1$
- } else {
- error= PatchMessages.getString("InputPatchPage.NoFileName.message"); //$NON-NLS-1$
- }
- }
-
- setPageComplete(anySelected && gotPatch);
- if (fShowError)
- setErrorMessage(error);
- }
-
- protected void handlePatchFileBrowseButtonPressed() {
- FileDialog dialog= new FileDialog(getShell(), SWT.NONE);
- dialog.setText(PatchMessages.getString("InputPatchPage.SelectPatchFileDialog.title")); //$NON-NLS-1$
- dialog.setFilterPath(getPatchFilePath());
- String res= dialog.open();
- if (res == null)
- return;
-
- String patchFilePath= dialog.getFileName();
- IPath filterPath= new Path(dialog.getFilterPath());
- IPath path= filterPath.append(patchFilePath).makeAbsolute();
- patchFilePath= path.toOSString();
- //fDialogSettings.put(IUIConstants.DIALOGSTORE_LASTEXTJAR, filterPath.toOSString());
-
- fPatchFileNameField.setText(patchFilePath);
- //setSourceName(patchFilePath);
- }
-
- /**
- * Sets the source name of the import to be the supplied path.
- * Adds the name of the path to the list of items in the
- * source combo and selects it.
- *
- * @param path the path to be added
- */
- protected void setSourceName(String path) {
-
- if (path.length() > 0) {
-
- String[] currentItems= fPatchFileNameField.getItems();
- int selectionIndex= -1;
- for (int i= 0; i < currentItems.length; i++)
- if (currentItems[i].equals(path))
- selectionIndex= i;
-
- if (selectionIndex < 0) { // not found in history
- int oldLength= currentItems.length;
- String[] newItems= new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength]= path;
- fPatchFileNameField.setItems(newItems);
- selectionIndex= oldLength;
- }
- fPatchFileNameField.select(selectionIndex);
-
- //resetSelection();
- }
- }
-
- /**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If false is returned then the wizard will
- * not close.
- *
- * @return boolean
- */
- public boolean finish() {
-// if (!ensureSourceIsValid())
-// return false;
-
- saveWidgetValues();
-
-// Iterator resourcesEnum = getSelectedResources().iterator();
-// List fileSystemObjects = new ArrayList();
-// while (resourcesEnum.hasNext()) {
-// fileSystemObjects.add(
-// ((FileSystemElement) resourcesEnum.next()).getFileSystemObject());
-// }
-//
-// if (fileSystemObjects.size() > 0)
-// return importResources(fileSystemObjects);
-//
-// MessageDialog
-// .openInformation(
-// getContainer().getShell(),
-// DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
-// DataTransferMessages.getString("FileImport.noneSelected")); //$NON-NLS-1$
-//
-// return false;
-
- return true;
- }
-
- /**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
- private void restoreWidgetValues() {
-
- boolean useClipboard= false;
-
- IDialogSettings settings= getDialogSettings();
- if (settings != null) {
-
- useClipboard= settings.getBoolean(STORE_USE_CLIPBOARD_ID);
-
- // set filenames history
- String[] sourceNames= settings.getArray(STORE_PATCH_FILES_ID);
- if (sourceNames != null)
- for (int i= 0; i < sourceNames.length; i++)
- if (sourceNames[i] != null && sourceNames[i].length() > 0)
- fPatchFileNameField.add(sourceNames[i]);
-
- // set patch file path
- String patchFilePath= settings.get(STORE_PATCH_FILES_ID);
- if (patchFilePath != null)
- setSourceName(patchFilePath);
- }
-
- // set 'Use Clipboard' radio buttons
- setUseClipboard(useClipboard);
- }
-
- /**
- * Since Finish was pressed, write widget values to the dialog store so that they
- * will persist into the next invocation of this wizard page
- */
- void saveWidgetValues() {
- IDialogSettings settings= getDialogSettings();
- if (settings != null) {
-
- settings.put(STORE_USE_CLIPBOARD_ID, getUseClipboard());
- settings.put(STORE_PATCH_FILES_ID, getPatchFilePath());
-
- // update source names history
- String[] sourceNames= settings.getArray(STORE_PATCH_FILES_ID);
- if (sourceNames == null)
- sourceNames= new String[0];
-
- sourceNames= addToHistory(sourceNames, getPatchFilePath());
- settings.put(STORE_PATCH_FILES_ID, sourceNames);
- }
- }
-
- // static helpers
-
- private void setUseClipboard(boolean useClipboard) {
- if (useClipboard)
- fUseClipboardButton.setSelection(true);
- else
- fUsePatchFileButton.setSelection(true);
- setEnablePatchFile(!useClipboard);
- }
-
- private boolean getUseClipboard() {
- if (fUseClipboardButton != null)
- return fUseClipboardButton.getSelection();
- return false;
- }
-
- private String getPatchFilePath() {
- if (fPatchFileNameField != null)
- return fPatchFileNameField.getText();
- return ""; //$NON-NLS-1$
- }
-
- /**
- * 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>COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- protected static String[] addToHistory(String[] history, String newEntry) {
- java.util.ArrayList l= new java.util.ArrayList(java.util.Arrays.asList(history));
-
- l.remove(newEntry);
- l.add(0,newEntry);
-
- // since only one new item was added, we can be over the limit
- // by at most one item
- if (l.size() > COMBO_HISTORY_LENGTH)
- l.remove(COMBO_HISTORY_LENGTH);
-
- return (String[]) l.toArray(new String[l.size()]);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
deleted file mode 100644
index d52929878..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-/* package */ class LineReader {
-
- private boolean fHaveChar= false;
- private int fLastChar;
- private boolean fSawEOF= false;
- private BufferedReader fReader;
- private boolean fIgnoreSingleCR= false;
-
-
- /* package */ LineReader(BufferedReader reader) {
- fReader= reader;
- Assert.isNotNull(reader);
- }
-
- void ignoreSingleCR() {
- fIgnoreSingleCR= true;
- }
-
- /**
- * Reads a line of text. A line is considered to be terminated by any one
- * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
- * followed immediately by a linefeed.
- * @return A string containing the contents of the line including
- * the line-termination characters, or <code>null</code> if the end of the
- * stream has been reached
- * @exception IOException If an I/O error occurs
- */
- /* package */ String readLine() throws IOException {
- StringBuffer sb= null;
-
- while (!fSawEOF) {
- int c= readChar();
- if (c == -1) {
- fSawEOF= true;
- break;
- }
- if (sb == null)
- sb= new StringBuffer();
- sb.append((char)c);
- if (c == '\n')
- break;
- if (c == '\r') {
- c= readChar();
- if (c == -1) {
- fSawEOF= true;
- break; // EOF
- }
- if (c != '\n') {
- if (fIgnoreSingleCR) {
- sb.append((char)c);
- continue;
- } else {
- fHaveChar= true;
- fLastChar= c;
- }
- } else
- sb.append((char)c);
- break;
- }
- }
-
- if (sb != null)
- return sb.toString();
- return null;
- }
-
- /* package */ void close() {
- try {
- fReader.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
-
- /* package */ List readLines() {
- try {
- List lines= new ArrayList();
- String line;
- while ((line= readLine()) != null)
- lines.add(line);
- return lines;
- } catch (IOException ex) {
- // NeedWork
- //System.out.println("error while reading file: " + fileName + "(" + ex + ")");
- } finally {
- close();
- }
- return null;
- }
- /**
- * Returns the number of characters in the given string without
- * counting a trailing line separator.
- */
- /* package */ int lineContentLength(String line) {
- if (line == null)
- return 0;
- int length= line.length();
- for (int i= length-1; i >= 0; i--) {
- char c= line.charAt(i);
- if (c =='\n' || c == '\r')
- length--;
- else
- break;
- }
- return length;
- }
-
- //---- private
-
- private int readChar() throws IOException {
- if (fHaveChar) {
- fHaveChar= false;
- return fLastChar;
- }
- return fReader.read();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
deleted file mode 100644
index 7b1b0a702..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-public class PatchErrorDialog {
-
- private PatchErrorDialog() {
- // no instance.
- }
-
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java
deleted file mode 100644
index fc7520bc8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class PatchMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.compare.internal.patch.PatchMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private PatchMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties
deleted file mode 100644
index 14f0bf2d3..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties
+++ /dev/null
@@ -1,90 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-#
-# 'Compare with Patch' Action
-#
-PatchAction.ExceptionTitle=Saving Resources
-PatchAction.Exception=Unexpected exception. See log for details
-PatchAction.SavingDirtyEditorsTask=Saving dirty editors
-PatchAction.AlwaysSaveQuestion=&Always save all modified resources automatically prior to patching
-PatchAction.SaveAllQuestion=Save all modified resources
-PatchAction.SaveAllDescription=All modified resources have to be saved before this operation.\nClick 'OK' to confirm or click 'Cancel'.
-
-#
-# PatchWizard
-#
-PatchWizard.title=Apply Patch
-PatchWizard.unexpectedException.message= Unexpected exception while applying the patch. See log for a detailed error description.
-
-#
-# InputPatchPage
-#
-InputPatchPage.title= Patch Input Specification
-InputPatchPage.message= Define the resource to patch and the patch to apply
-InputPatchPage.Clipboard=Clipboard
-InputPatchPage.SelectInput=Select a single file or folder to patch:
-InputPatchPage.PatchErrorDialog.title=Patch Error
-InputPatchPage.PatchErrorDialog=Patch Error
-InputPatchPage.SelectPatch.title=Select Patch
-InputPatchPage.FileButton.text=Fil&e
-InputPatchPage.ChooseFileButton.text=&Browse...
-InputPatchPage.UseClipboardButton.text=&Clipboard
-InputPatchPage.NothingSelected.message=Select a file or folder to be patched
-InputPatchPage.ClipboardIsEmpty.message=Clipboard is empty
-InputPatchPage.NoTextInClipboard.message=Clipboard does not contain text
-InputPatchPage.CouldNotReadClipboard.message=Couldn't retrieve clipboard contents
-InputPatchPage.CannotLocatePatch.message=Can't locate patch file:
-InputPatchPage.NoFileName.message=No file name
-InputPatchPage.SelectPatchFileDialog.title=Select Patch File
-InputPatchPage.PatchFileNotFound.message=Patch file not found.
-InputPatchPage.ParseError.message=Error while parsing patch
-InputPatchPage.Clipboard.title=Clipboard
-InputPatchPage.PatchFile.title=Patch file
-InputPatchPage.NoDiffsFound.format={0} does not contain valid patch.
-InputPatchPage.SingleFileError.format={0} contains multiple patches. You cannot apply them to a single file.
-
-#
-# PreviewPatchPage
-#
-PreviewPatchPage.title= Verify Patch
-PreviewPatchPage.message= The tree shows the contents of the patch.\nA checked item indicates that a patch can be applied successfully. To remove an item, clear its checkbox.
-PreviewPatchPage.Left.title= Original
-PreviewPatchPage.Right.title= Result
-PreviewPatchPage.PatchOptions.title=Patch Options
-PreviewPatchPage.IgnoreSegments.text=&Ignore leading path name segments:
-PreviewPatchPage.ReversePatch.text=&Reverse patch
-PreviewPatchPage.FuzzFactor.text=&Maximum fuzz factor:
-PreviewPatchPage.FuzzFactor.tooltip=Allow context to shift this number of lines from the original place
-PreviewPatchPage.IgnoreWhitespace.text=Ignore &white space
-PreviewPatchPage.NoName.text=no name
-PreviewPatchPage.FileExists.error=(file already exists)
-PreviewPatchPage.FileDoesNotExist.error=(file doesn't exist)
-PreviewPatchPage.NoMatch.error=(no match)
-PreviewPatchPage.FileIsReadOnly.error=(file is read only)
-PreviewPatchPage.GuessFuzz.text= &Guess
-PreviewPatchPage.GuessFuzzProgress.text= Guessing Fuzz Factor...
-PreviewPatchPage.GuessFuzzProgress.format= {0} (hunk #{1})
-
-#
-# Patcher
-#
-Patcher.ErrorDialog.title=title
-Patcher.DeleteError.message=Error while deleting resource
-Patcher.UpdateError.message=Error while updating resource
-Patcher.RefreshError.message=Error while refreshing from local
-Patcher.Marker.message=Rejected patch
-Patcher.Task.message=Patching
-
-#
-# PatchCompareInput
-#
-PatchCompareInput.RightTitle.format= Patch: {0}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
deleted file mode 100644
index 1ad13ef1d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.Wizard;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.compare.internal.*;
-
-
-/* package */ class PatchWizard extends Wizard {
-
- // dialog store id constants
- private final static String DIALOG_SETTINGS_KEY= "PatchWizard"; //$NON-NLS-1$
-
- private boolean fHasNewDialogSettings;
-
- private InputPatchPage fPatchWizardPage;
-
- private Patcher fPatcher;
- private IResource fTarget;
-
-
- /**
- * Creates a wizard for applying a patch file to the workspace.
- */
- /* package */ PatchWizard(ISelection selection) {
-
- setDefaultPageImageDescriptor(CompareUIPlugin.getImageDescriptor("wizban/applypatch_wizban.gif")); //$NON-NLS-1$
- setWindowTitle(PatchMessages.getString("PatchWizard.title")); //$NON-NLS-1$
-
- setTargets(Utilities.getResources(selection));
-
- fPatcher= new Patcher();
-
- IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY); //$NON-NLS-1$
- if (section == null)
- fHasNewDialogSettings= true;
- else {
- fHasNewDialogSettings= false;
- setDialogSettings(section);
- }
- }
-
- Patcher getPatcher() {
- return fPatcher;
- }
-
- IResource getTarget() {
- return fTarget;
- }
-
- void setTargets(IResource[] targets) {
- if (targets != null && targets.length > 0)
- fTarget= targets[0]; // right now we can only deal with a single selection
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- super.addPages();
-
- addPage(fPatchWizardPage= new InputPatchPage(this));
- addPage(new PreviewPatchPage(this));
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean needsProgressMonitor() {
- return true;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
-
- fPatcher.setName(fPatchWizardPage.getPatchName());
-
- try {
- WorkspaceModifyOperation op= new WorkspaceModifyOperation(fTarget.getProject()) {
- protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- fPatcher.applyAll(getTarget(), monitor, getShell(), PatchMessages.getString("PatchWizard.title")); //$NON-NLS-1$
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- getContainer().run(true, false, op);
-
- } catch (InvocationTargetException e) {
- ExceptionHandler.handle(e,
- PatchMessages.getString("PatchWizard.title"), //$NON-NLS-1$
- PatchMessages.getString("PatchWizard.unexpectedException.message")); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // cannot happen
- // NeedWork: use assert!
- }
-
- // Save the dialog settings
- if (fHasNewDialogSettings) {
- IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY);
- section= workbenchSettings.addNewSection(DIALOG_SETTINGS_KEY);
- setDialogSettings(section);
- }
-
- fPatchWizardPage.saveWidgetValues();
- //fPreviewPatchPage.saveWidgetValues();
-
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
deleted file mode 100644
index 721db089e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ /dev/null
@@ -1,1080 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.*;
-
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-
-/**
- * A Patcher
- * - knows how to parse various patch file formats into some in-memory structure,
- * - holds onto the parsed data and the options to use when applying the patches,
- * - knows how to apply the patches to files and folders.
- */
-public class Patcher {
-
- private static final boolean DEBUG= false;
-
- private static final String DEV_NULL= "/dev/null"; //$NON-NLS-1$
-
- private static final String REJECT_FILE_EXTENSION= ".rej"; //$NON-NLS-1$
-
- private static final String MARKER_TYPE= "org.eclipse.compare.rejectedPatchMarker"; //$NON-NLS-1$
-
- // diff formats
-// private static final int CONTEXT= 0;
-// private static final int ED= 1;
-// private static final int NORMAL= 2;
-// private static final int UNIFIED= 3;
-
- // we recognize the following date/time formats
- private static DateFormat[] DATE_FORMATS= new DateFormat[] {
- new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy"), //$NON-NLS-1$
- new SimpleDateFormat("yyyy/MM/dd kk:mm:ss"), //$NON-NLS-1$
- new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy", Locale.US) //$NON-NLS-1$
- };
-
- private String fName;
- private Diff[] fDiffs;
- // patch options
- private int fStripPrefixSegments;
- private int fFuzz;
- private boolean fIgnoreWhitespace= false;
- private boolean fIgnoreLineDelimiter= true;
- private boolean fPreserveLineDelimiters= false;
- private boolean fReverse= false;
- private boolean fAdjustShift= true;
-
-
- Patcher() {
- }
-
- //---- options
-
- void setName(String name) {
- fName= name;
- }
-
- String getName() {
- return fName;
- }
-
- /**
- * Returns an array of Diffs after a sucessfull call to <code>parse</code>.
- * If <code>parse</code> hasn't been called returns <code>null</code>.
- */
- Diff[] getDiffs() {
- return fDiffs;
- }
-
- IPath getPath(Diff diff) {
- IPath path= diff.getPath();
- if (fStripPrefixSegments > 0 && fStripPrefixSegments < path.segmentCount())
- path= path.removeFirstSegments(fStripPrefixSegments);
- return path;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setStripPrefixSegments(int strip) {
- if (strip != fStripPrefixSegments) {
- fStripPrefixSegments= strip;
- return true;
- }
- return false;
- }
-
- int getStripPrefixSegments() {
- return fStripPrefixSegments;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setFuzz(int fuzz) {
- if (fuzz != fFuzz) {
- fFuzz= fuzz;
- return true;
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setReversed(boolean reverse) {
- if (fReverse != reverse) {
- fReverse= reverse;
-
- for (int i= 0; i < fDiffs.length; i++)
- fDiffs[i].reverse();
-
- return true;
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if new value differs from old.
- */
- boolean setIgnoreWhitespace(boolean ignoreWhitespace) {
- if (ignoreWhitespace != fIgnoreWhitespace) {
- fIgnoreWhitespace= ignoreWhitespace;
- return true;
- }
- return false;
- }
-
- //---- parsing patch files
-
- /* package */ void parse(BufferedReader reader) throws IOException {
- List diffs= new ArrayList();
- String line= null;
- boolean reread= false;
- String diffArgs= null;
- String fileName= null;
-
- LineReader lr= new LineReader(reader);
- if (!"carbon".equals(SWT.getPlatform())) //$NON-NLS-1$
- lr.ignoreSingleCR();
-
- // read leading garbage
- while (true) {
- if (!reread)
- line= lr.readLine();
- reread= false;
- if (line == null)
- break;
- if (line.length() < 4)
- continue; // too short
-
- // remember some infos
- if (line.startsWith("Index: ")) { //$NON-NLS-1$
- fileName= line.substring(7).trim();
- continue;
- }
- if (line.startsWith("diff")) { //$NON-NLS-1$
- diffArgs= line.substring(4).trim();
- continue;
- }
-
- if (line.startsWith("--- ")) { //$NON-NLS-1$
- line= readUnifiedDiff(diffs, lr, line, diffArgs, fileName);
- diffArgs= fileName= null;
- reread= true;
- } else if (line.startsWith("*** ")) { //$NON-NLS-1$
- line= readContextDiff(diffs, lr, line, diffArgs, fileName);
- diffArgs= fileName= null;
- reread= true;
- }
- }
-
- lr.close();
-
- fDiffs= (Diff[]) diffs.toArray(new Diff[diffs.size()]);
- }
-
- /**
- * Returns the next line that does not belong to this diff
- */
- private String readUnifiedDiff(List diffs, LineReader reader, String line, String args, String fileName) throws IOException {
-
- String[] oldArgs= split(line.substring(4));
-
- // read info about new file
- line= reader.readLine();
- if (line == null || !line.startsWith("+++ ")) //$NON-NLS-1$
- return line;
-
- String[] newArgs= split(line.substring(4));
-
- Diff diff= new Diff(extractPath(oldArgs, 0, fileName), extractDate(oldArgs, 1),
- extractPath(newArgs, 0, fileName), extractDate(newArgs, 1));
- diffs.add(diff);
-
- int[] oldRange= new int[2];
- int[] newRange= new int[2];
- List lines= new ArrayList();
-
- try {
- // read lines of hunk
- while (true) {
-
- line= reader.readLine();
- if (line == null)
- return null;
-
- if (reader.lineContentLength(line) == 0) {
- //System.out.println("Warning: found empty line in hunk; ignored");
- //lines.add(' ' + line);
- continue;
- }
-
- char c= line.charAt(0);
- switch (c) {
- case '@':
- if (line.startsWith("@@ ")) { //$NON-NLS-1$
- // flush old hunk
- if (lines.size() > 0) {
- new Hunk(diff, oldRange, newRange, lines);
- lines.clear();
- }
-
- // format: @@ -oldStart,oldLength +newStart,newLength @@
- extractPair(line, '-', oldRange);
- extractPair(line, '+', newRange);
- continue;
- }
- break;
- case ' ':
- case '+':
- case '-':
- lines.add(line);
- continue;
- case '\\':
- if (line.startsWith("No newline at end of file", 2)) { //$NON-NLS-1$
- int lastIndex= lines.size();
- if (lastIndex > 0) {
- line= (String) lines.get(lastIndex-1);
- int end= line.length()-1;
- char lc= line.charAt(end);
- if (lc == '\n') {
- end--;
- if (end > 0 && line.charAt(end-1) == '\r')
- end--;
- } else if (lc == '\r') {
- end--;
- }
- line= line.substring(0, end);
- lines.set(lastIndex-1, line);
- }
- continue;
- }
- break;
- default:
- if (DEBUG) {
- int a1= c, a2= 0;
- if (line.length() > 1)
- a2= line.charAt(1);
- System.out.println("char: " + a1 + " " + a2); //$NON-NLS-1$ //$NON-NLS-2$
- }
- break;
- }
- return line;
- }
- } finally {
- if (lines.size() > 0)
- new Hunk(diff, oldRange, newRange, lines);
- diff.finish();
- }
- }
-
- /**
- * Returns the next line that does not belong to this diff
- */
- private String readContextDiff(List diffs, LineReader reader, String line, String args, String fileName) throws IOException {
-
- String[] oldArgs= split(line.substring(4));
-
- // read info about new file
- line= reader.readLine();
- if (line == null || !line.startsWith("--- ")) //$NON-NLS-1$
- return line;
-
- String[] newArgs= split(line.substring(4));
-
- Diff diff= new Diff(extractPath(oldArgs, 0, fileName), extractDate(oldArgs, 1),
- extractPath(newArgs, 0, fileName), extractDate(newArgs, 1));
- diffs.add(diff);
-
- int[] oldRange= new int[2];
- int[] newRange= new int[2];
- List oldLines= new ArrayList();
- List newLines= new ArrayList();
- List lines= oldLines;
-
- try {
- // read lines of hunk
- while (true) {
-
- line= reader.readLine();
- if (line == null)
- return line;
-
- int l= line.length();
- if (l == 0)
- continue;
- if (l > 1) {
- switch (line.charAt(0)) {
- case '*':
- if (line.startsWith("***************")) { // new hunk //$NON-NLS-1$
- // flush old hunk
- if (oldLines.size() > 0 || newLines.size() > 0) {
- new Hunk(diff, oldRange, newRange, unifyLines(oldLines, newLines));
- oldLines.clear();
- newLines.clear();
- }
- continue;
- }
- if (line.startsWith("*** ")) { // old range //$NON-NLS-1$
- // format: *** oldStart,oldEnd ***
- extractPair(line, ' ', oldRange);
- oldRange[1]= oldRange[1]-oldRange[0]+1;
- lines= oldLines;
- continue;
- }
- break;
- case ' ': // context line
- case '+': // addition
- case '!': // change
- if (line.charAt(1) == ' ') {
- lines.add(line);
- continue;
- }
- break;
- case '-':
- if (line.charAt(1) == ' ') { // deletion
- lines.add(line);
- continue;
- }
- if (line.startsWith("--- ")) { // new range //$NON-NLS-1$
- // format: *** newStart,newEnd ***
- extractPair(line, ' ', newRange);
- newRange[1]= newRange[1]-newRange[0]+1;
- lines= newLines;
- continue;
- }
- break;
- default:
- break;
- }
- }
- return line;
- }
- } finally {
- // flush last hunk
- if (oldLines.size() > 0 || newLines.size() > 0)
- new Hunk(diff, oldRange, newRange, unifyLines(oldLines, newLines));
- diff.finish();
- }
- }
-
- /**
- * Creates a List of lines in the unified format from
- * two Lists of lines in the 'classic' format.
- */
- private List unifyLines(List oldLines, List newLines) {
- List result= new ArrayList();
-
- String[] ol= (String[]) oldLines.toArray(new String[oldLines.size()]);
- String[] nl= (String[]) newLines.toArray(new String[newLines.size()]);
-
- int oi= 0, ni= 0;
-
- while (true) {
-
- char oc= 0;
- String o= null;
- if (oi < ol.length) {
- o= ol[oi];
- oc= o.charAt(0);
- }
-
- char nc= 0;
- String n= null;
- if (ni < nl.length) {
- n= nl[ni];
- nc= n.charAt(0);
- }
-
- // EOF
- if (oc == 0 && nc == 0)
- break;
-
- // deletion in old
- if (oc == '-') {
- do {
- result.add('-' + o.substring(2));
- oi++;
- if (oi >= ol.length)
- break;
- o= ol[oi];
- } while (o.charAt(0) == '-');
- continue;
- }
-
- // addition in new
- if (nc == '+') {
- do {
- result.add('+' + n.substring(2));
- ni++;
- if (ni >= nl.length)
- break;
- n= nl[ni];
- } while (n.charAt(0) == '+');
- continue;
- }
-
- // differing lines on both sides
- if (oc == '!' && nc == '!') {
- // remove old
- do {
- result.add('-' + o.substring(2));
- oi++;
- if (oi >= ol.length)
- break;
- o= ol[oi];
- } while (o.charAt(0) == '!');
-
- // add new
- do {
- result.add('+' + n.substring(2));
- ni++;
- if (ni >= nl.length)
- break;
- n= nl[ni];
- } while (n.charAt(0) == '!');
-
- continue;
- }
-
- // context lines
- if (oc == ' ' && nc == ' ') {
- do {
- Assert.isTrue(o.equals(n), "non matching context lines"); //$NON-NLS-1$
- result.add(' ' + o.substring(2));
- oi++;
- ni++;
- if (oi >= ol.length || ni >= nl.length)
- break;
- o= ol[oi];
- n= nl[ni];
- } while (o.charAt(0) == ' ' && n.charAt(0) == ' ');
- continue;
- }
-
- if (oc == ' ') {
- do {
- result.add(' ' + o.substring(2));
- oi++;
- if (oi >= ol.length)
- break;
- o= ol[oi];
- } while (o.charAt(0) == ' ');
- continue;
- }
-
- if (nc == ' ') {
- do {
- result.add(' ' + n.substring(2));
- ni++;
- if (ni >= nl.length)
- break;
- n= nl[ni];
- } while (n.charAt(0) == ' ');
- continue;
- }
-
- Assert.isTrue(false, "unexpected char <" + oc + "> <" + nc + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- return result;
- }
-
- /**
- * Breaks the given string into tab separated substrings.
- * Leading and trailing whitespace is removed from each token.
- */
- private String[] split(String line) {
- List l= new ArrayList();
- StringTokenizer st= new StringTokenizer(line, "\t"); //$NON-NLS-1$
- while (st.hasMoreElements()) {
- String token= st.nextToken().trim();
- if (token.length() > 0)
- l.add(token);
- }
- return (String[]) l.toArray(new String[l.size()]);
- }
-
- /**
- * @return the parsed time/date in milliseconds or -1 on error
- */
- private long extractDate(String[] args, int n) {
- if (n < args.length) {
- String line= args[n];
- for (int i= 0; i < DATE_FORMATS.length; i++) {
- DATE_FORMATS[i].setLenient(true);
- try {
- Date date= DATE_FORMATS[i].parse(line);
- return date.getTime();
- } catch (ParseException ex) {
- // silently ignored
- }
- }
- // System.err.println("can't parse date: <" + line + ">");
- }
- return -1;
- }
-
- /**
- * Returns null if file name is "/dev/null".
- */
- private IPath extractPath(String[] args, int n, String path2) {
- if (n < args.length) {
- String path= args[n];
- if (DEV_NULL.equals(path))
- return null;
- int pos= path.lastIndexOf(':');
- if (pos >= 0)
- path= path.substring(0, pos);
- if (path2 != null && !path2.equals(path)) {
- if (DEBUG) System.out.println("path mismatch: " + path2); //$NON-NLS-1$
- path= path2;
- }
- return new Path(path);
- }
- return null;
- }
-
- /**
- * Tries to extract two integers separated by a comma.
- * The parsing of the line starts at the position after
- * the first occurrence of the given character start an ends
- * at the first blank (or the end of the line).
- * If only a single number is found this is assumed to be the length of the range.
- * In this case the start of the range is set to 1.
- * If an error occurs the range -1,-1 is returned.
- */
- private void extractPair(String line, char start, int[] pair) {
- pair[0]= pair[1]= -1;
- int startPos= line.indexOf(start);
- if (startPos < 0) {
- if (DEBUG) System.out.println("parsing error in extractPair: couldn't find \'" + start + "\'"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- line= line.substring(startPos+1);
- int endPos= line.indexOf(' ');
- if (endPos < 0) {
- if (DEBUG) System.out.println("parsing error in extractPair: couldn't find end blank"); //$NON-NLS-1$
- return;
- }
- line= line.substring(0, endPos);
- int comma= line.indexOf(',');
- if (comma >= 0) {
- pair[0]= Integer.parseInt(line.substring(0, comma));
- pair[1]= Integer.parseInt(line.substring(comma+1));
- } else {
- pair[0]= 1;
- pair[1]= Integer.parseInt(line.substring(comma+1));
- }
- }
-
- //---- applying a patch file
-
- /**
- * Tries to patch the given lines with the specified Diff.
- * Any hunk that couldn't be applied is returned in the list failedHunks.
- */
- /* package */ void patch(Diff diff, List lines, List failedHunks) {
-
- int shift= 0;
- Iterator iter= diff.fHunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- hunk.fMatches= false;
- shift= patch(hunk, lines, shift, failedHunks);
- }
- }
-
- /**
- * Tries to apply the specified hunk to the given lines.
- * If the hunk cannot be applied at the original position
- * the methods tries Fuzz lines before and after.
- * If this fails the Hunk is added to the given list of failed hunks.
- */
- private int patch(Hunk hunk, List lines, int shift, List failedHunks) {
- if (tryPatch(hunk, lines, shift)) {
- if (hunk.isEnabled())
- shift+= doPatch(hunk, lines, shift);
- } else {
- boolean found= false;
- int oldShift= shift;
-
- for (int i= 1; i <= fFuzz; i++) {
- if (tryPatch(hunk, lines, shift-i)) {
- if (fAdjustShift)
- shift-= i;
- found= true;
- break;
- }
- }
-
- if (! found) {
- for (int i= 1; i <= fFuzz; i++) {
- if (tryPatch(hunk, lines, shift+i)) {
- if (fAdjustShift)
- shift+= i;
- found= true;
- break;
- }
- }
- }
-
- if (found) {
- if (DEBUG) System.out.println("patched hunk at offset: " + (shift-oldShift)); //$NON-NLS-1$
- shift+= doPatch(hunk, lines, shift);
- } else {
- if (failedHunks != null) {
- if (DEBUG) System.out.println("failed hunk"); //$NON-NLS-1$
- failedHunks.add(hunk);
- }
- }
- }
- return shift;
- }
-
- /**
- * Tries to apply the given hunk on the specified lines.
- * The parameter shift is added to the line numbers given
- * in the hunk.
- */
- private boolean tryPatch(Hunk hunk, List lines, int shift) {
- int pos= hunk.fOldStart + shift;
- int deleteMatches= 0;
- for (int i= 0; i < hunk.fLines.length; i++) {
- String s= hunk.fLines[i];
- Assert.isTrue(s.length() > 0);
- String line= s.substring(1);
- char controlChar= s.charAt(0);
- if (controlChar == ' ') { // context lines
- while (true) {
- if (pos < 0 || pos >= lines.size())
- return false;
- if (linesMatch(line, (String) lines.get(pos))) {
- pos++;
- break;
- }
- return false;
- }
- } else if (controlChar == '-') {
- // deleted lines
- while (true) {
- if (pos < 0 || pos >= lines.size())
- return false;
- if (linesMatch(line, (String) lines.get(pos))) {
- deleteMatches++;
- pos++;
- break;
- }
- if (deleteMatches <= 0)
- return false;
- pos++;
- }
- } else if (controlChar == '+') {
- // added lines
- // we don't have to do anything for a 'try'
- } else
- Assert.isTrue(false, "tryPatch: unknown control character: " + controlChar); //$NON-NLS-1$
- }
- return true;
- }
-
- private int doPatch(Hunk hunk, List lines, int shift) {
- int pos= hunk.fOldStart + shift;
- for (int i= 0; i < hunk.fLines.length; i++) {
- String s= hunk.fLines[i];
- Assert.isTrue(s.length() > 0);
- String line= s.substring(1);
- char controlChar= s.charAt(0);
- if (controlChar == ' ') { // context lines
- while (true) {
- Assert.isTrue(pos < lines.size(), "doPatch: inconsistency in context"); //$NON-NLS-1$
- if (linesMatch(line, (String) lines.get(pos))) {
- pos++;
- break;
- }
- pos++;
- }
- } else if (controlChar == '-') {
- // deleted lines
- while (true) {
- Assert.isTrue(pos < lines.size(), "doPatch: inconsistency in deleted lines"); //$NON-NLS-1$
- if (linesMatch(line, (String) lines.get(pos))) {
- break;
- }
- pos++;
- }
- lines.remove(pos);
- } else if (controlChar == '+') {
- // added lines
- lines.add(pos, line);
- pos++;
- } else
- Assert.isTrue(false, "doPatch: unknown control character: " + controlChar); //$NON-NLS-1$
- }
- hunk.fMatches= true;
- return hunk.fNewLength - hunk.fOldLength;
- }
-
- public void applyAll(IResource target, IProgressMonitor pm, Shell shell, String title) throws CoreException {
-
- final int WORK_UNIT= 10;
-
- int i;
-
- IFile singleFile= null; // file to be patched
- IContainer container= null;
- if (target instanceof IContainer)
- container= (IContainer) target;
- else if (target instanceof IFile) {
- singleFile= (IFile) target;
- container= singleFile.getParent();
- } else {
- Assert.isTrue(false);
- }
-
- // get all files to be modified in order to call validateEdit
- List list= new ArrayList();
- if (singleFile != null)
- list.add(singleFile);
- else {
- for (i= 0; i < fDiffs.length; i++) {
- Diff diff= fDiffs[i];
- if (diff.isEnabled()) {
- switch (diff.getType()) {
- case Differencer.CHANGE:
- list.add(createPath(container, getPath(diff)));
- break;
- }
- }
- }
- }
- if (! Utilities.validateResources(list, shell, title))
- return;
-
- if (pm != null) {
- String message= PatchMessages.getString("Patcher.Task.message"); //$NON-NLS-1$
- pm.beginTask(message, fDiffs.length*WORK_UNIT);
- }
-
- for (i= 0; i < fDiffs.length; i++) {
-
- int workTicks= WORK_UNIT;
-
- Diff diff= fDiffs[i];
- if (diff.isEnabled()) {
-
- IPath path= getPath(diff);
- if (pm != null)
- pm.subTask(path.toString());
-
- IFile file= singleFile != null
- ? singleFile
- : createPath(container, path);
-
- List failed= new ArrayList();
- List result= null;
-
- int type= diff.getType();
- switch (type) {
- case Differencer.ADDITION:
- // patch it and collect rejected hunks
- result= apply(diff, file, true, failed);
- store(createString(result), file, new SubProgressMonitor(pm, workTicks));
- workTicks-= WORK_UNIT;
- break;
- case Differencer.DELETION:
- file.delete(true, true, new SubProgressMonitor(pm, workTicks));
- workTicks-= WORK_UNIT;
- break;
- case Differencer.CHANGE:
- // patch it and collect rejected hunks
- result= apply(diff, file, false, failed);
- store(createString(result), file, new SubProgressMonitor(pm, workTicks));
- workTicks-= WORK_UNIT;
- break;
- }
-
- if (failed.size() > 0) {
- IPath pp= null;
- if (path.segmentCount() > 1) {
- pp= path.removeLastSegments(1);
- pp= pp.append(path.lastSegment() + REJECT_FILE_EXTENSION);
- } else
- pp= new Path(path.lastSegment() + REJECT_FILE_EXTENSION);
- file= createPath(container, pp);
- if (file != null) {
- store(getRejected(failed), file, pm);
- try {
- IMarker marker= file.createMarker(MARKER_TYPE);
- marker.setAttribute(IMarker.MESSAGE, PatchMessages.getString("Patcher.Marker.message")); //$NON-NLS-1$
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
- } catch (CoreException ex) {
- // NeedWork
- }
- }
- }
- }
-
- if (pm != null) {
- if (pm.isCanceled())
- break;
- if (workTicks > 0)
- pm.worked(workTicks);
- }
- }
- }
-
- /**
- * Reads the contents from the given file and returns them as
- * a List of lines.
- */
- List load(IFile file, boolean create) {
- List lines= null;
- if (!create && file != null) {
- // read current contents
- InputStream is= null;
- try {
- is= file.getContents();
-
- Reader streamReader= null;
- try {
- streamReader= new InputStreamReader(is, Utilities.getCharset(file));
- } catch (UnsupportedEncodingException x) {
- // use default encoding
- streamReader= new InputStreamReader(is);
- }
-
- BufferedReader reader= new BufferedReader(streamReader);
- LineReader lr= new LineReader(reader);
- if (!"carbon".equals(SWT.getPlatform())) //$NON-NLS-1$
- lr.ignoreSingleCR();
- lines= lr.readLines();
- } catch(CoreException ex) {
- // NeedWork
- } finally {
- if (is != null)
- try {
- is.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- }
-
- if (lines == null)
- lines= new ArrayList();
- return lines;
- }
-
- List apply(Diff diff, IFile file, boolean create, List failedHunks) {
- List lines= load(file, create);
- patch(diff, lines, failedHunks);
- return lines;
- }
-
- /**
- * Converts the string into bytes and stores them in the given file.
- */
- private void store(String contents, IFile file, IProgressMonitor pm) throws CoreException {
-
- byte[] bytes;
- try {
- bytes= contents.getBytes(Utilities.getCharset(file));
- } catch (UnsupportedEncodingException x) {
- // uses default encoding
- bytes= contents.getBytes();
- }
-
- InputStream is= new ByteArrayInputStream(bytes);
- try {
- if (file.exists()) {
- file.setContents(is, false, true, pm);
- } else {
- file.create(is, false, pm);
- }
- } finally {
- if (is != null)
- try {
- is.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- }
-
- /**
- * Concatenates all strings found in the given List.
- */
- private String createString(List lines) {
- StringBuffer sb= new StringBuffer();
- Iterator iter= lines.iterator();
- if (fPreserveLineDelimiters) {
- while (iter.hasNext())
- sb.append((String)iter.next());
- } else {
- String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$
- while (iter.hasNext()) {
- String line= (String)iter.next();
- int l= length(line);
- if (l < line.length()) { // line has delimiter
- sb.append(line.substring(0, l));
- sb.append(lineSeparator);
- } else {
- sb.append(line);
- }
- }
- }
- return sb.toString();
- }
-
- String getRejected(List failedHunks) {
- if (failedHunks.size() <= 0)
- return null;
-
- String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer sb= new StringBuffer();
- Iterator iter= failedHunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- sb.append(hunk.getRejectedDescription());
- sb.append(lineSeparator);
- sb.append(hunk.getContent());
- }
- return sb.toString();
- }
-
- /**
- * Ensures that a file with the given path exists in
- * the given container. Folder are created as necessary.
- */
- private IFile createPath(IContainer container, IPath path) throws CoreException {
- if (path.segmentCount() > 1) {
- IFolder f= container.getFolder(path.uptoSegment(1));
- if (!f.exists())
- f.create(false, true, null);
- return createPath(f, path.removeFirstSegments(1));
- }
- // a leaf
- return container.getFile(path);
- }
-
- /**
- * Returns the given string with all whitespace characters removed.
- * Whitespace is defined by <code>Character.isWhitespace(...)</code>.
- */
- private static String stripWhiteSpace(String s) {
- StringBuffer sb= new StringBuffer();
- int l= s.length();
- for (int i= 0; i < l; i++) {
- char c= s.charAt(i);
- if (!Character.isWhitespace(c))
- sb.append(c);
- }
- return sb.toString();
- }
-
- /**
- * Compares two strings.
- * If fIgnoreWhitespace is true whitespace is ignored.
- */
- private boolean linesMatch(String line1, String line2) {
- if (fIgnoreWhitespace)
- return stripWhiteSpace(line1).equals(stripWhiteSpace(line2));
- if (fIgnoreLineDelimiter) {
- int l1= length(line1);
- int l2= length(line2);
- if (l1 != l2)
- return false;
- return line1.regionMatches(0, line2, 0, l1);
- }
- return line1.equals(line2);
- }
-
- /**
- * Returns the length (exluding a line delimiter CR, LF, CR/LF)
- * of the given string.
- */
- /* package */ static int length(String s) {
- int l= s.length();
- if (l > 0) {
- char c= s.charAt(l-1);
- if (c == '\r')
- return l-1;
- if (c == '\n') {
- if (l > 1 && s.charAt(l-2) == '\r')
- return l-2;
- return l-1;
- }
- }
- return l;
- }
-
- int calculateFuzz(Hunk hunk, List lines, int shift, IProgressMonitor pm, int[] fuzz) {
-
- hunk.fMatches= false;
- if (tryPatch(hunk, lines, shift)) {
- shift+= doPatch(hunk, lines, shift);
- fuzz[0]= 0;
- } else {
- boolean found= false;
- int hugeFuzz= lines.size(); // the maximum we need for this file
- fuzz[0]= -2; // not found
-
- for (int i= 1; i <= hugeFuzz; i++) {
- if (pm.isCanceled()) {
- fuzz[0]= -1;
- return 0;
- }
- if (tryPatch(hunk, lines, shift-i)) {
- fuzz[0]= i;
- if (fAdjustShift)
- shift-= i;
- found= true;
- break;
- }
- }
-
- if (! found) {
- for (int i= 1; i <= hugeFuzz; i++) {
- if (pm.isCanceled()) {
- fuzz[0]= -1;
- return 0;
- }
- if (tryPatch(hunk, lines, shift+i)) {
- fuzz[0]= i;
- if (fAdjustShift)
- shift+= i;
- found= true;
- break;
- }
- }
- }
-
- if (found)
- shift+= doPatch(hunk, lines, shift);
- }
- return shift;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
deleted file mode 100644
index b2b0fdd2a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
+++ /dev/null
@@ -1,742 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.internal.patch;
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.internal.DiffImage;
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.compare.internal.TimeoutContext;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.*;
-
-
-/**
- * Shows the parsed patch file and any mismatches
- * between files, hunks and the currently selected
- * resources.
- */
-/* package */ class PreviewPatchPage extends WizardPage {
-
- static final int GUESS_TIMEOUT= 1500; // show progress after 1.5sec of fuzz factor guessing
-
- /**
- * Used with CompareInput
- */
- static class HunkInput implements ITypedElement, IEncodedStreamContentAccessor {
- static final String UTF_16= "UTF-16"; //$NON-NLS-1$
- String fContent;
- String fType;
-
- HunkInput(String type, String s) {
- fType= type;
- fContent= s;
- }
- public Image getImage() {
- return null;
- }
- public String getName() {
- return PatchMessages.getString("PreviewPatchPage.NoName.text"); //$NON-NLS-1$
- }
- public String getType() {
- return fType;
- }
- public InputStream getContents() {
- return new ByteArrayInputStream(Utilities.getBytes(fContent, UTF_16));
- }
- public String getCharset() {
- return UTF_16;
- }
- }
-
- private PatchWizard fPatchWizard;
-
- private Tree fTree;
- private Combo fStripPrefixSegments;
- private CompareViewerSwitchingPane fHunkViewer;
- private Button fIgnoreWhitespaceButton;
- private Button fReversePatchButton;
- private Text fFuzzField;
-
- private Image[] fImages= new Image[6];
- private CompareConfiguration fCompareConfiguration;
-
-
- /* package */ PreviewPatchPage(PatchWizard pw) {
- super("PreviewPatchPage", //$NON-NLS-1$
- PatchMessages.getString("PreviewPatchPage.title"), null); //$NON-NLS-1$
-
- setMessage(PatchMessages.getString("PreviewPatchPage.message")); //$NON-NLS-1$
-
- fPatchWizard= pw;
- //setPageComplete(false);
-
- int w= 16;
-
- ImageDescriptor addId= CompareUIPlugin.getImageDescriptor("ovr16/add_ov.gif"); //$NON-NLS-1$
- ImageDescriptor delId= CompareUIPlugin.getImageDescriptor("ovr16/del_ov.gif"); //$NON-NLS-1$
-
- ImageDescriptor errId= CompareUIPlugin.getImageDescriptor("ovr16/error_ov.gif"); //$NON-NLS-1$
- Image errIm= errId.createImage();
-
- fImages[0]= new DiffImage(null, null, w).createImage();
- fImages[1]= new DiffImage(null, addId, w).createImage();
- fImages[2]= new DiffImage(null, delId, w).createImage();
-
- fImages[3]= new DiffImage(errIm, null, w).createImage();
- fImages[4]= new DiffImage(errIm, addId, w).createImage();
- fImages[5]= new DiffImage(errIm, delId, w).createImage();
-
- fCompareConfiguration= new CompareConfiguration();
-
- fCompareConfiguration.setLeftEditable(false);
- fCompareConfiguration.setLeftLabel(PatchMessages.getString("PreviewPatchPage.Left.title")); //$NON-NLS-1$
-
- fCompareConfiguration.setRightEditable(false);
- fCompareConfiguration.setRightLabel(PatchMessages.getString("PreviewPatchPage.Right.title")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared in WizardPage
- */
- public void setVisible(boolean visible) {
- if (visible)
- buildTree();
- super.setVisible(visible);
- }
-
- Image getImage(Diff diff) {
- if (diff.fMatches) {
- switch (diff.getType()) {
- case Differencer.ADDITION:
- return fImages[1];
- case Differencer.DELETION:
- return fImages[2];
- }
- return fImages[0];
- }
- switch (diff.getType()) {
- case Differencer.ADDITION:
- return fImages[4];
- case Differencer.DELETION:
- return fImages[5];
- }
- return fImages[3];
- }
-
- Image getImage(Hunk hunk) {
- if (hunk.fMatches)
- return fImages[0];
- return fImages[3];
- }
-
- public void createControl(Composite parent) {
-
- Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- WorkbenchHelp.setHelp(composite, ICompareContextIds.PATCH_PREVIEW_WIZARD_PAGE);
-
- setControl(composite);
-
- buildPatchOptionsGroup(composite);
-
- Splitter splitter= new Splitter(composite, SWT.VERTICAL);
- splitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-
-
- // top pane showing diffs and hunks in a check box tree
- fTree= new Tree(splitter, SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData gd= new GridData();
- gd.verticalAlignment= GridData.FILL;
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.grabExcessVerticalSpace= true;
- fTree.setLayoutData(gd);
-
- // bottom pane showing hunks in compare viewer
- fHunkViewer= new CompareViewerSwitchingPane(splitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUI.findContentViewer(oldViewer, (ICompareInput)input, this, fCompareConfiguration);
- }
- };
- gd= new GridData();
- gd.verticalAlignment= GridData.FILL;
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.grabExcessVerticalSpace= true;
- fHunkViewer.setLayoutData(gd);
-
- // register listeners
-
- fTree.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TreeItem ti= (TreeItem) e.item;
- Object data= e.item.getData();
- if (e.detail == SWT.CHECK) {
- boolean checked= ti.getChecked();
- if (data instanceof Hunk) {
- Hunk hunk= (Hunk) data;
- checked= checked && hunk.fMatches;
- //hunk.setEnabled(checked);
- ti.setChecked(checked);
- updateGrayedState(ti);
- } else if (data instanceof Diff) {
- updateCheckedState(ti);
- }
- } else {
- if (data instanceof Hunk)
- PreviewPatchPage.this.fHunkViewer.setInput(createInput((Hunk)data));
- else
- PreviewPatchPage.this.fHunkViewer.setInput(null);
- }
- }
- }
- );
- fTree.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fImages != null) {
- for (int i= 0; i < fImages.length; i++) {
- if (fImages[i] == null)
- fImages[i].dispose();
- }
- fImages= null;
- }
- }
- });
- // creating tree's content
- buildTree();
- Dialog.applyDialogFont(composite);
- }
-
- /**
- * Create the group for setting various patch options
- */
- private void buildPatchOptionsGroup(Composite parent) {
-
- GridLayout gl;
- GridData gd;
- Label l;
-
- final Patcher patcher= fPatchWizard.getPatcher();
-
- Group group= new Group(parent, SWT.NONE);
- group.setText(PatchMessages.getString("PreviewPatchPage.PatchOptions.title")); //$NON-NLS-1$
- gl= new GridLayout(); gl.numColumns= 4; gl.marginHeight= 0;
- group.setLayout(gl);
- group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // 1st row
-
- Composite pair= new Composite(group, SWT.NONE);
- gl= new GridLayout(); gl.numColumns= 2; gl.marginHeight= gl.marginWidth= 0;
- pair.setLayout(gl);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- pair.setLayoutData(gd);
-
- l= new Label(pair, SWT.NONE);
- l.setText(PatchMessages.getString("PreviewPatchPage.IgnoreSegments.text")); //$NON-NLS-1$
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);
- l.setLayoutData(gd);
-
- fStripPrefixSegments= new Combo(pair, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.SIMPLE);
- int prefixCnt= patcher.getStripPrefixSegments();
- String prefix= Integer.toString(prefixCnt);
- fStripPrefixSegments.add(prefix);
- fStripPrefixSegments.setText(prefix);
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_END);
- fStripPrefixSegments.setLayoutData(gd);
-
- addSpacer(group);
-
- fReversePatchButton= new Button(group, SWT.CHECK);
- fReversePatchButton.setText(PatchMessages.getString("PreviewPatchPage.ReversePatch.text")); //$NON-NLS-1$
-
- addSpacer(group);
-
- // 2nd row
- pair= new Composite(group, SWT.NONE);
- gl= new GridLayout(); gl.numColumns= 3; gl.marginHeight= gl.marginWidth= 0;
- pair.setLayout(gl);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- pair.setLayoutData(gd);
-
- l= new Label(pair, SWT.NONE);
- l.setText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.text")); //$NON-NLS-1$
- l.setToolTipText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);
- l.setLayoutData(gd);
-
- fFuzzField= new Text(pair, SWT.BORDER);
- fFuzzField.setText("2"); //$NON-NLS-1$
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_END); gd.widthHint= 30;
- fFuzzField.setLayoutData(gd);
-
- Button b= new Button(pair, SWT.PUSH);
- b.setText(PatchMessages.getString("PreviewPatchPage.GuessFuzz.text")); //$NON-NLS-1$
- b.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int fuzz= guessFuzzFactor(patcher);
- if (fuzz >= 0)
- fFuzzField.setText(Integer.toString(fuzz));
- }
- }
- );
- gd= new GridData(GridData.VERTICAL_ALIGN_CENTER);
- b.setLayoutData(gd);
-
- addSpacer(group);
-
- fIgnoreWhitespaceButton= new Button(group, SWT.CHECK);
- fIgnoreWhitespaceButton.setText(PatchMessages.getString("PreviewPatchPage.IgnoreWhitespace.text")); //$NON-NLS-1$
-
- addSpacer(group);
-
- // register listeners
-
- if (fStripPrefixSegments != null)
- fStripPrefixSegments.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (patcher.setStripPrefixSegments(getStripPrefixSegments()))
- updateTree();
- }
- }
- );
- fReversePatchButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (patcher.setReversed(fReversePatchButton.getSelection()))
- updateTree();
- }
- }
- );
- fIgnoreWhitespaceButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (patcher.setIgnoreWhitespace(fIgnoreWhitespaceButton.getSelection()))
- updateTree();
- }
- }
- );
-
- fFuzzField.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (patcher.setFuzz(getFuzzFactor()))
- updateTree();
- }
- }
- );
- }
-
- private int guessFuzzFactor(final Patcher patcher) {
- final int strip= getStripPrefixSegments();
- final int[] result= new int[1];
- try {
- TimeoutContext.run(true, GUESS_TIMEOUT, getControl().getShell(),
- new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- result[0]= guess(patcher, monitor, strip);
- }
- }
- );
- return result[0];
- } catch (InvocationTargetException ex) {
- // NeedWork
- } catch (InterruptedException ex) {
- // NeedWork
- }
- return -1;
- }
-
- private int guess(Patcher patcher, IProgressMonitor pm, int strip) {
-
- Diff[] diffs= patcher.getDiffs();
- if (diffs == null || diffs.length <= 0)
- return -1;
-
- // now collect files and determine "work"
- IFile[] files= new IFile[diffs.length];
- int work= 0;
- for (int i= 0; i < diffs.length; i++) {
- Diff diff= diffs[i];
- if (diff == null)
- continue;
- if (diff.getType() != Differencer.ADDITION) {
- IPath p= diff.fOldPath;
- if (strip > 0 && strip < p.segmentCount())
- p= p.removeFirstSegments(strip);
- IFile file= existsInSelection(p);
- if (file != null) {
- files[i]= file;
- work+= diff.fHunks.size();
- }
- }
- }
-
- // do the "work"
- int[] fuzzRef= new int[1];
- String format= PatchMessages.getString("PreviewPatchPage.GuessFuzzProgress.format"); //$NON-NLS-1$
- pm.beginTask(PatchMessages.getString("PreviewPatchPage.GuessFuzzProgress.text"), work); //$NON-NLS-1$
- try {
- int fuzz= 0;
- for (int i= 0; i < diffs.length; i++) {
- Diff d= diffs[i];
- IFile file= files[i];
- if (d != null && file != null) {
- List lines= patcher.load(file, false);
- String name= d.getPath().lastSegment();
- Iterator iter= d.fHunks.iterator();
- int shift= 0;
- for (int hcnt= 1; iter.hasNext(); hcnt++) {
- pm.subTask(MessageFormat.format(format, new String[] { name, Integer.toString(hcnt) } ));
- Hunk h= (Hunk) iter.next();
- shift= patcher.calculateFuzz(h, lines, shift, pm, fuzzRef);
- int f= fuzzRef[0];
- if (f == -1) // cancel
- return -1;
- if (f > fuzz)
- fuzz= f;
- pm.worked(1);
- }
- }
- }
- return fuzz;
- } finally {
- pm.done();
- }
- }
-
- ICompareInput createInput(Hunk hunk) {
-
- String[] lines= hunk.fLines;
- StringBuffer left= new StringBuffer();
- StringBuffer right= new StringBuffer();
-
- for (int i= 0; i < lines.length; i++) {
- String line= lines[i];
- String rest= line.substring(1);
- switch (line.charAt(0)) {
- case ' ':
- left.append(rest);
- right.append(rest);
- break;
- case '-':
- left.append(rest);
- break;
- case '+':
- right.append(rest);
- break;
- }
- }
-
- Diff diff= hunk.fParent;
- IPath path= diff.getPath();
- String type= path.getFileExtension();
-
- return new DiffNode(new HunkInput(type, left.toString()), new HunkInput(type, right.toString()));
- }
-
- /**
- * Builds a tree from list of Diffs.
- * As a side effect it calculates the maximum number of segments
- * in all paths.
- */
- private void buildTree() {
- setPageComplete(true);
- if (fTree != null && !fTree.isDisposed()) {
- fTree.removeAll();
- fHunkViewer.setInput(null);
-
- int length= 99;
-
- Diff[] diffs= fPatchWizard.getPatcher().getDiffs();
- if (diffs != null) {
- for (int i= 0; i < diffs.length; i++) {
- Diff diff= diffs[i];
- TreeItem d= new TreeItem(fTree, SWT.NULL);
- d.setData(diff);
- d.setImage(getImage(diff));
-
- if (diff.fOldPath != null)
- length= Math.min(length, diff.fOldPath.segmentCount());
- if (diff.fNewPath != null)
- length= Math.min(length, diff.fNewPath.segmentCount());
-
- java.util.List hunks= diff.fHunks;
- java.util.Iterator iter= hunks.iterator();
- while (iter.hasNext()) {
- Hunk hunk= (Hunk) iter.next();
- TreeItem h= new TreeItem(d, SWT.NULL);
- h.setData(hunk);
- h.setText(hunk.getDescription());
- }
- }
- }
- if (fStripPrefixSegments != null && length != 99)
- for (int i= 1; i < length; i++)
- fStripPrefixSegments.add(Integer.toString(i));
- }
-
- updateTree();
- }
-
- private IFile existsInSelection(IPath path) {
- IResource target= fPatchWizard.getTarget();
- if (target instanceof IFile) { // special case
- IFile file= (IFile) target;
- if (matches(file.getFullPath(), path))
- return file;
- } else if (target instanceof IContainer) {
- IContainer c= (IContainer) target;
- if (c.exists(path))
- return c.getFile(path);
- }
- return null;
- }
-
- /**
- * Returns true if path completely matches the end of fullpath
- */
- private boolean matches(IPath fullpath, IPath path) {
-
- for (IPath p= fullpath; path.segmentCount() <= p.segmentCount();
- p= p.removeFirstSegments(1)) {
- if (p.equals(path))
- return true;
- }
- return false;
- }
-
- /**
- * Updates label and checked state of tree items.
- */
- private void updateTree() {
- if (fTree == null || fTree.isDisposed())
- return;
- int strip= getStripPrefixSegments();
- TreeItem[] children= fTree.getItems();
- for (int i= 0; i < children.length; i++) {
- TreeItem item= children[i];
- Diff diff= (Diff) item.getData();
- diff.fMatches= false;
- String error= null;
-
- boolean create= false;
- IFile file= null;
- if (diff.getType() == Differencer.ADDITION) {
- IPath p= diff.fNewPath;
- if (strip > 0 && strip < p.segmentCount())
- p= p.removeFirstSegments(strip);
- file= existsInSelection(p);
- if (file == null) {
- diff.fMatches= true;
- } else {
- // file already exists
- error= PatchMessages.getString("PreviewPatchPage.FileExists.error"); //$NON-NLS-1$
- }
- create= true;
- } else {
- IPath p= diff.fOldPath;
- if (strip > 0 && strip < p.segmentCount())
- p= p.removeFirstSegments(strip);
- file= existsInSelection(p);
- diff.fMatches= false;
- if (file != null) {
- if (file.isReadOnly()) {
- // file is readonly
- error= PatchMessages.getString("PreviewPatchPage.FileIsReadOnly.error"); //$NON-NLS-1$
- file= null;
- } else {
- diff.fMatches= true;
- }
- } else {
- // file doesn't exist
- error= PatchMessages.getString("PreviewPatchPage.FileDoesNotExist.error"); //$NON-NLS-1$
- }
- }
-
- ArrayList failedHunks= new ArrayList();
- Patcher patcher= fPatchWizard.getPatcher();
- patcher.setFuzz(getFuzzFactor());
- patcher.apply(diff, file, create, failedHunks);
-
- if (failedHunks.size() > 0)
- diff.fRejected= fPatchWizard.getPatcher().getRejected(failedHunks);
-
- int checkedSubs= 0; // counts checked hunk items
- TreeItem[] hunkItems= item.getItems();
- for (int h= 0; h < hunkItems.length; h++) {
- Hunk hunk= (Hunk) hunkItems[h].getData();
- boolean failed= failedHunks.contains(hunk);
- String hunkError= null;
- if (failed)
- hunkError= PatchMessages.getString("PreviewPatchPage.NoMatch.error"); //$NON-NLS-1$
-
- boolean check= !failed;
- hunkItems[h].setChecked(check);
- if (check)
- checkedSubs++;
-
- String hunkLabel= hunk.getDescription();
- if (hunkError != null)
- hunkLabel+= " " + hunkError; //$NON-NLS-1$
- hunkItems[h].setText(hunkLabel);
- hunkItems[h].setImage(getImage(hunk));
- }
-
- String label= diff.getDescription(strip);
- if (error != null)
- label+= " " + error; //$NON-NLS-1$
- item.setText(label);
- item.setImage(getImage(diff));
- item.setChecked(checkedSubs > 0);
- boolean gray= (checkedSubs > 0 && checkedSubs < hunkItems.length);
- item.setGrayed(gray);
- item.setExpanded(gray);
- }
- setPageComplete(updateModel());
- }
-
- /**
- * Updates the gray state of the given diff and the checked state of its children.
- */
- private void updateCheckedState(TreeItem diffItem) {
- boolean checked= diffItem.getChecked();
- // check whether we can enable all hunks
- TreeItem[] hunks= diffItem.getItems();
- int checkedCount= 0;
- for (int i= 0; i < hunks.length; i++) {
- Hunk hunk= (Hunk) hunks[i].getData();
- if (checked) {
- if (hunk.fMatches) {
- hunks[i].setChecked(true);
- checkedCount++;
- }
- } else {
- hunks[i].setChecked(false);
- }
- }
- diffItem.setGrayed(checkedCount > 0 && checkedCount < hunks.length);
- diffItem.setChecked(checkedCount > 0);
-
- setPageComplete(updateModel());
- }
-
- /**
- * Updates the gray state of the given items parent.
- */
- private void updateGrayedState(TreeItem hunk) {
- TreeItem diff= hunk.getParentItem();
- TreeItem[] hunks= diff.getItems();
- int checked= 0;
- for (int i= 0; i < hunks.length; i++)
- if (hunks[i].getChecked())
- checked++;
- diff.setChecked(checked > 0);
- diff.setGrayed(checked > 0 && checked < hunks.length);
-
- setPageComplete(updateModel());
- }
-
- private void addSpacer(Composite parent) {
- Label label= new Label(parent, SWT.NONE);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint= 20;
- label.setLayoutData(gd);
- }
-
- private int getStripPrefixSegments() {
- int stripPrefixSegments= 0;
- if (fStripPrefixSegments != null) {
- String s= fStripPrefixSegments.getText();
- try {
- stripPrefixSegments= Integer.parseInt(s);
- } catch(NumberFormatException ex) {
- // silently ignored
- }
- }
- return stripPrefixSegments;
- }
-
- private int getFuzzFactor() {
- int fuzzFactor= 0;
- if (fFuzzField != null) {
- String s= fFuzzField.getText();
- try {
- fuzzFactor= Integer.parseInt(s);
- } catch(NumberFormatException ex) {
- // silently ignored
- }
- }
- return fuzzFactor;
- }
-
- public boolean updateModel() {
- boolean atLeastOneIsEnabled= false;
- if (fTree != null && !fTree.isDisposed()) {
- TreeItem [] diffItems= fTree.getItems();
- for (int i= 0; i < diffItems.length; i++) {
- TreeItem diffItem= diffItems[i];
- Object data= diffItem.getData();
- if (data instanceof Diff) {
- Diff diff= (Diff) data;
- boolean b= diffItem.getChecked();
- diff.setEnabled(b);
- if (b) {
- TreeItem [] hunkItems= diffItem.getItems();
- for (int j= 0; j < hunkItems.length; j++) {
- TreeItem hunkItem= hunkItems[j];
- data= hunkItem.getData();
- if (data instanceof Hunk) {
- Hunk hunk= (Hunk) data;
- b= hunkItem.getChecked();
- hunk.setEnabled(b);
- if (b) {
- atLeastOneIsEnabled= true;
- }
- }
- }
- }
- }
- }
- }
- return atLeastOneIsEnabled;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/package.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/package.html
deleted file mode 100644
index 1963dd462..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/package.html
+++ /dev/null
@@ -1,99 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for performing structural and textual
-compare operations on arbitrary data and displaying the results.
-<h2>
-Package Specification</h2>
-
-The class <b>CompareUI</b> defines the entry point to initiate a configurable
-compare operation on arbitrary resources. The result of the compare is
-opened into a compare editor where the details can be browsed and edited
-in dynamically selected structure and content viewers.
-<p>
-
-A compare operation must be implemented as a subclass of <b>CompareEditorInput</b>.
-A <b>CompareEditorInput</b> runs a (potentially lengthy) compare operation
-under progress monitor control, creates a UI for drilling-down into the
-compare results, tracks the dirty state of the result in case of merge,
-and saves any changes that occured during a merge.
-<p>
-
-The <b>NavigationAction</b> is used to navigate (step) through the individual
-differences of a <b>CompareEditorInput</b>.
-<p>
-
-An instance of <b>CompareConfiguration</b> configures various UI aspects
-of compare/merge viewers like title labels and images, or whether a side
-of a merge viewer is editable. It is passed to the <b>CompareEditorInput</b>
-on creation.
-<p>
-
-When implementing a hierarchical compare operation as a subclass of
-<b>CompareEditorInput</b> clients have to provide a tree of objects where each
-node implements the interface
-<b>org.eclipse.compare.structuremergeviewer.IStructureComparator</b>.
-This interface is used by the hierarchical differencing engine
-(<b>org.eclipse.compare.structuremergeviewer.Differencer</b>) to walk the tree.
-<br>
-In addition every leaf of the tree must implement the <b>IStreamContentAccessor</b>
-interface in order to give the differencing engine access to its stream content.
-<p>
-
-The abstract class <b>BufferedContent</b> provides a default implementation
-for the <b>IStreamContentAccessor</b> and <b>IContentChangeNotifier</b> interfaces.
-Its subclass <b>ResourceNode</b> adds an implementation for the
-<b>IStructureComparator</b> and <b>ITypedElement</b> interfaces
-based on Eclipse workbench resources (org.eclipse.core.resources.IResource).
-It can be used without modification as the input to the differencing engine.
-<p>
-
-The <b>ZipFileStructureCreator</b> is an implementation of the
-<b>org.eclipse.compare.structuremergeviewer.IStructureCreator</b> interface
-and makes the contents of a zip archive available as a
-hierarchical structure of <b>IStructureComparator</b>s which can be easily compared
-by the differencing engine (<b>org.eclipse.compare.structuremergeviewer.Differencer</b>).
-It is a good example for how to make structured files available to the hierarchical
-compare functionality of the Compare plugin.
-<p>
-
-The <b>EditionSelectionDialog</b> is a simple selection dialog where
-one input element can be compared against a list of historic variants (<i>editions</i>)
-of the same input element. The dialog can be used to implement functions
-like <i>"Replace with Version"</i> or <i>"Replace with Edition"</i> on workbench resources.
-<p>
-
-In addition it is possible to specify a subsection of the input element
-(e.g. a method in a Java source file) by means of a <i>path</i>. In this
-case the dialog compares only the subsection (as specified by the path)
-with the corresponding subsection in the list of editions. This functionality
-can be used to implement <i>"Replace with Method Edition"</i> for the Java
-language.
-<p>
-
-The <b>EditionSelectionDialog</b> requires that the editions implement
-the <b>IStreamContentAccessor</b> and <b>IModificationDate</b> interfaces.
-The <b>HistoryItem</b> is a convenience class that implements these interfaces
-for <b>IFileState</b> objects.
-<p>
-
-
-The <b>CompareViewerPane</b> is a convenience class which provides
-a label and local toolbar for a compare viewer (or any other subclass of a
-JFace <b>Viewer</b>).
-<br>
-Its abstract subclass <b>CompareViewerSwitchingPane</b> supports <i>dynamic
-viewer switching</i>, that is the viewer installed in the pane is dynamically
-determined by the pane's input object.
-Both classes are useful if you want to use compare viewers outside the context of
-a compare editor, for example in a dialog or wizard.
-
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java
deleted file mode 100644
index 3c4be7f87..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A custom iterator to iterate over a List of <code>RangeDifferences</code>.
- * It is used internally by the <code>RangeDifferencer</code>.
- */
-/* package */ class DifferencesIterator {
-
- List fRange;
- int fIndex;
- RangeDifference[] fArray;
- RangeDifference fDifference;
-
- /**
- * Creates a differences iterator on an array of <code>RangeDifference</code>s.
- */
- DifferencesIterator(RangeDifference[] differenceRanges) {
-
- fArray= differenceRanges;
- fIndex= 0;
- fRange= new ArrayList();
- if (fIndex < fArray.length)
- fDifference= fArray[fIndex++];
- else
- fDifference= null;
- }
-
- /**
- * Returns the number of RangeDifferences
- */
- int getCount() {
- return fRange.size();
- }
-
- /**
- * Appends the edit to its list and moves to the next <code>RangeDifference</code>.
- */
- void next() {
- fRange.add(fDifference);
- if (fDifference != null) {
- if (fIndex < fArray.length)
- fDifference= fArray[fIndex++];
- else
- fDifference= null;
- }
- }
-
- /**
- * Difference iterators are used in pairs.
- * This method returns the other iterator.
- */
- DifferencesIterator other(DifferencesIterator right, DifferencesIterator left) {
- if (this == right)
- return left;
- return right;
- }
-
- /**
- * Removes all <code>RangeDifference</code>s
- */
- void removeAll() {
- fRange.clear();
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java
deleted file mode 100644
index 70bd1d5e0..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-/**
- * For breaking an object to compare into a sequence of comparable entities.
- * <p>
- * It is used by <code>RangeDifferencer</code> to find longest sequences of
- * matching and non-matching ranges.
- * <p>
- * For example, to compare two text documents and find longest common sequences
- * of matching and non-matching lines, the implementation must break the document
- * into lines. <code>getRangeCount</code> would return the number of lines in the
- * document, and <code>rangesEqual</code> would compare a specified line given
- * with one in another <code>IRangeComparator</code>.
- * </p>
- * <p>
- * Clients should implement this interface; there is no standard implementation.
- * </p>
- */
-public interface IRangeComparator {
-
- /**
- * Returns the number of comparable entities.
- *
- * @return the number of comparable entities
- */
- int getRangeCount();
-
- /**
- * Returns whether the comparable entity given by the first index
- * matches an entity specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the index of the comparable entity within this <code>IRangeComparator</code>
- * @param other the IRangeComparator to compare this with
- * @param otherIndex the index of the comparable entity within the other <code>IRangeComparator</code>
- * @return <code>true</code> if the comparable entities are equal
- */
- boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex);
-
- /**
- * Returns whether a comparison should be skipped because it would be too costly (or lengthy).
- *
- * @param length a number on which to base the decision whether to return
- * <code>true</code> or <code>false</code>
- * @param maxLength another number on which to base the decision whether to return
- * <code>true</code> or <code>false</code>
- * @param other the other <code>IRangeComparator</code> to compare with
- * @return <code>true</code> to avoid a too lengthy range comparison
- */
- boolean skipRangeComparison(int length, int maxLength, IRangeComparator other);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java
deleted file mode 100644
index cd9ef08e7..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-/* package */ class LinkedRangeDifference extends RangeDifference {
-
- static final int INSERT= 0;
- static final int DELETE= 1;
-
- LinkedRangeDifference fNext;
-
- /**
- * Creates a LinkedRangeDifference an initializes it to the error state
- */
- LinkedRangeDifference() {
- super(ERROR);
- fNext= null;
- }
-
- /**
- * Constructs and links a LinkeRangeDifference to another LinkedRangeDifference
- */
- LinkedRangeDifference(LinkedRangeDifference next, int operation) {
- super(operation);
- fNext= next;
- }
-
- /**
- * Follows the next link
- */
- LinkedRangeDifference getNext() {
- return fNext;
- }
-
- boolean isDelete() {
- return kind() == DELETE;
- }
-
- boolean isInsert() {
- return kind() == INSERT;
- }
-
- /**
- * Sets the next link of this LinkedRangeDifference
- */
- void setNext(LinkedRangeDifference next) {
- fNext= next;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java
deleted file mode 100644
index 9a8b15d50..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-/**
- * Description of a change between two or three ranges of comparable entities.
- * <p>
- * <code>RangeDifference</code> objects are the elements of a compare result returned from
- * the <code>RangeDifferencer</code> <code>find* </code> methods.
- * Clients use these objects as they are returned from the differencer.
- * This class is not intended to be instantiated or subclassed.
- * <p>
- * Note: A range in the <code>RangeDifference</code> object is given as a start index
- * and length in terms of comparable entities. However, these entity indices and counts
- * are not necessarily character positions. For example, if an entity represents a line
- * in a document, the start index would be a line number and the count would be in lines.
- * </p>
- *
- * @see RangeDifferencer
- */
-public class RangeDifference {
-
- /** Two-way change constant indicating no change. */
- public final static int NOCHANGE= 0;
- /** Two-way change constant indicating two-way change (same as <code>RIGHT</code>) */
- public final static int CHANGE= 2;
-
- /** Three-way change constant indicating a change in both right and left. */
- public final static int CONFLICT= 1;
- /** Three-way change constant indicating a change in right. */
- public final static int RIGHT= 2;
- /** Three-way change constant indicating a change in left. */
- public final static int LEFT= 3;
- /**
- * Three-way change constant indicating the same change in both right and left,
- * that is only the ancestor is different.
- */
- public final static int ANCESTOR= 4;
-
- /** Constant indicating an unknown change kind. */
- public final static int ERROR= 5;
-
- /** the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR */
- int fKind;
-
- int fLeftStart;
- int fLeftLength;
- int fRightStart;
- int fRightLength;
- int lAncestorStart;
- int lAncestorLength;
-
- /**
- * Creates a new range difference with the given change kind.
- *
- * @param changeKind the kind of change
- */
- /* package */ RangeDifference(int changeKind) {
- fKind= changeKind;
- }
-
- /**
- * Creates a new <code>RangeDifference</code> with the given change kind
- * and left and right ranges.
- *
- * @param changeKind the kind of change
- * @param rightStart start index of entity on right side
- * @param rightLength number of entities on right side
- * @param leftStart start index of entity on left side
- * @param leftLength number of entities on left side
- */
- /* package */ RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength) {
- fKind= kind;
- fRightStart= rightStart;
- fRightLength= rightLength;
- fLeftStart= leftStart;
- fLeftLength= leftLength;
- }
-
- /**
- * Creates a new <code>RangeDifference</code> with the given change kind
- * and left, right, and ancestor ranges.
- *
- * @param changeKind the kind of change
- * @param rightStart start index of entity on right side
- * @param rightLength number of entities on right side
- * @param leftStart start index of entity on left side
- * @param leftLength number of entities on left side
- * @param ancestorStart start index of entity on ancestor side
- * @param ancestorLength number of entities on ancestor side
- */
- /* package */ RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength,
- int ancestorStart, int ancestorLength) {
- this(kind, rightStart, rightLength, leftStart, leftLength);
- lAncestorStart= ancestorStart;
- lAncestorLength= ancestorLength;
- }
-
- /**
- * Returns the kind of difference.
- *
- * @return the kind of difference, one of
- * <code>NOCHANGE</code>, <code>CHANGE</code>, <code>LEFT</code>, <code>RIGHT</code>,
- * <code>ANCESTOR</code>, <code>CONFLICT</code>, <code>ERROR</code>
- */
- public int kind() {
- return fKind;
- }
-
- /**
- * Returns the start index of the entity range on the ancestor side.
- *
- * @return the start index of the entity range on the ancestor side
- */
- public int ancestorStart() {
- return lAncestorStart;
- }
-
- /**
- * Returns the number of entities on the ancestor side.
- *
- * @return the number of entities on the ancestor side
- */
- public int ancestorLength() {
- return lAncestorLength;
- }
-
- /**
- * Returns the end index of the entity range on the ancestor side.
- *
- * @return the end index of the entity range on the ancestor side
- */
- public int ancestorEnd() {
- return lAncestorStart + lAncestorLength;
- }
-
- /**
- * Returns the start index of the entity range on the right side.
- *
- * @return the start index of the entity range on the right side
- */
- public int rightStart() {
- return fRightStart;
- }
-
- /**
- * Returns the number of entities on the right side.
- *
- * @return the number of entities on the right side
- */
- public int rightLength() {
- return fRightLength;
- }
-
- /**
- * Returns the end index of the entity range on the right side.
- *
- * @return the end index of the entity range on the right side
- */
- public int rightEnd() {
- return fRightStart + fRightLength;
- }
-
- /**
- * Returns the start index of the entity range on the left side.
- *
- * @return the start index of the entity range on the left side
- */
- public int leftStart() {
- return fLeftStart;
- }
-
- /**
- * Returns the number of entities on the left side.
- *
- * @return the number of entities on the left side
- */
- public int leftLength() {
- return fLeftLength;
- }
-
- /**
- * Returns the end index of the entity range on the left side.
- *
- * @return the end index of the entity range on the left side
- */
- public int leftEnd() {
- return fLeftStart + fLeftLength;
- }
-
- /**
- * Returns the maximum number of entities in the left, right, and ancestor sides of this range.
- *
- * @return the maximum number of entities in the left, right, and ancestor sides of this range
- */
- public int maxLength() {
- return Math.max(fRightLength, Math.max(fLeftLength, lAncestorLength));
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
deleted file mode 100644
index 5c0b051b3..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.rangedifferencer;
-
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A <code>RangeDifferencer</code> finds the differences between two or three <code>IRangeComparator</code>s.
- * <p>
- * To use the differencer, clients provide an <code>IRangeComparator</code>
- * that breaks their input data into a sequence of comparable entities. The differencer
- * returns the differences among these sequences as an array of <code>RangeDifference</code> objects
- * (<code>findDifferences</code> methods).
- * Every <code>RangeDifference</code> represents a single kind of difference
- * and the corresponding ranges of the underlying comparable entities in the
- * left, right, and optionally ancestor sides.
- * <p>
- * Alternatively, the <code>findRanges</code> methods not only return objects for
- * the differing ranges but for non-differing ranges too.
- * <p>
- * The algorithm used is an objectified version of one described in:
- * <it>A File Comparison Program,</it> by Webb Miller and Eugene W. Myers,
- * Software Practice and Experience, Vol. 15, Nov. 1985.
- *
- * @see IRangeComparator
- * @see RangeDifference
- */
-public final class RangeDifferencer {
-
- private static final RangeDifference[] EMPTY_RESULT= new RangeDifference[0];
-
- /* (non Javadoc)
- * Non instantiatiable!
- */
- private RangeDifferencer() {
- }
-
- /**
- * Finds the differences between two <code>IRangeComparator</code>s.
- * The differences are returned as an array of <code>RangeDifference</code>s.
- * If no differences are detected an empty array is returned.
- *
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- */
- public static RangeDifference[] findDifferences(IRangeComparator left, IRangeComparator right) {
- return findDifferences((IProgressMonitor)null, left, right);
- }
-
- /**
- * Finds the differences between two <code>IRangeComparator</code>s.
- * The differences are returned as an array of <code>RangeDifference</code>s.
- * If no differences are detected an empty array is returned.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- * @since 2.0
- */
- public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) {
-
- // assert that both IRangeComparators are of the same class
- Assert.isTrue(right.getClass().equals(left.getClass()));
-
- int rightSize= right.getRangeCount();
- int leftSize= left.getRangeCount();
- //
- // Differences matrix:
- // only the last d of each diagonal is stored, i.e., lastDiagonal[k] = row of d
- //
- int diagLen= 2 * Math.max(rightSize, leftSize); // bound on the size of edit script
- int maxDiagonal= diagLen;
- int lastDiagonal[]= new int[diagLen + 1]; // the row containing the last d
- // on diagonal k (lastDiagonal[k] = row)
- int origin= diagLen / 2; // origin of diagonal 0
-
- // script corresponding to d[k]
- LinkedRangeDifference script[]= new LinkedRangeDifference[diagLen + 1];
- int row, col;
-
- // find common prefix
- for (row= 0; row < rightSize && row < leftSize && rangesEqual(right, row, left, row) == true; ++row)
- ;
-
- lastDiagonal[origin]= row;
- script[origin]= null;
- int lower= (row == rightSize) ? origin + 1 : origin - 1;
- int upper= (row == leftSize) ? origin - 1 : origin + 1;
-
- if (lower > upper)
- return EMPTY_RESULT;
-
- //System.out.println("findDifferences: " + maxDiagonal + " " + lower + " " + upper);
-
- // for each value of the edit distance
- for (int d= 1; d <= maxDiagonal; ++d) { // d is the current edit distance
-
- if (pm != null)
- pm.worked(1);
-
- if (right.skipRangeComparison(d, maxDiagonal, left))
- return EMPTY_RESULT; // should be something we already found
-
- // for each relevant diagonal (-d, -d+2 ..., d-2, d)
- for (int k= lower; k <= upper; k += 2) { // k is the current diagonal
- LinkedRangeDifference edit;
-
- if (pm != null && pm.isCanceled())
- return EMPTY_RESULT;
-
- if (k == origin - d || k != origin + d && lastDiagonal[k + 1] >= lastDiagonal[k - 1]) {
- //
- // move down
- //
- row= lastDiagonal[k + 1] + 1;
- edit= new LinkedRangeDifference(script[k + 1], LinkedRangeDifference.DELETE);
- } else {
- //
- // move right
- //
- row= lastDiagonal[k - 1];
- edit= new LinkedRangeDifference(script[k - 1], LinkedRangeDifference.INSERT);
- }
- col= row + k - origin;
- edit.fRightStart= row;
- edit.fLeftStart= col;
- Assert.isTrue(k >= 0 && k <= maxDiagonal);
- script[k]= edit;
-
- // slide down the diagonal as far as possible
- while (row < rightSize && col < leftSize && rangesEqual(right, row, left, col) == true) {
- ++row;
- ++col;
- }
-
- Assert.isTrue(k >= 0 && k <= maxDiagonal); // Unreasonable value for diagonal index
- lastDiagonal[k]= row;
-
- if (row == rightSize && col == leftSize) {
- //showScript(script[k], right, left);
- return createDifferencesRanges(script[k]);
- }
- if (row == rightSize)
- lower= k + 2;
- if (col == leftSize)
- upper= k - 2;
- }
- --lower;
- ++upper;
- }
- // too many differences
- Assert.isTrue(false);
- return null;
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * The differences are returned as a list of <code>RangeDifference</code>s.
- * If no differences are detected an empty list is returned.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- */
- public static RangeDifference[] findDifferences(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
- return findDifferences(null, ancestor, left, right);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * The differences are returned as a list of <code>RangeDifference</code>s.
- * If no differences are detected an empty list is returned.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- * @since 2.0
- */
- public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
-
- if (ancestor == null)
- return findDifferences(pm, left, right);
-
- RangeDifference[] leftAncestorScript= null;
- RangeDifference[] rightAncestorScript= findDifferences(pm, ancestor, right);
- if (rightAncestorScript != null)
- leftAncestorScript= findDifferences(pm, ancestor, left);
- if (rightAncestorScript == null || leftAncestorScript == null)
- return null;
-
- DifferencesIterator myIter= new DifferencesIterator(rightAncestorScript);
- DifferencesIterator yourIter= new DifferencesIterator(leftAncestorScript);
-
- List diff3= new ArrayList();
- diff3.add(new RangeDifference(RangeDifference.ERROR)); // add a sentinel
-
- int changeRangeStart= 0;
- int changeRangeEnd= 0;
- //
- // Combine the two two-way edit scripts into one
- //
- while (myIter.fDifference != null || yourIter.fDifference != null) {
-
- DifferencesIterator startThread;
- myIter.removeAll();
- yourIter.removeAll();
- //
- // take the next diff that is closer to the start
- //
- if (myIter.fDifference == null)
- startThread= yourIter;
- else if (yourIter.fDifference == null)
- startThread= myIter;
- else { // not at end of both scripts take the lowest range
- if (myIter.fDifference.fLeftStart <= yourIter.fDifference.fLeftStart) // 2 -> common (Ancestor) change range
- startThread= myIter;
- else
- startThread= yourIter;
- }
- changeRangeStart= startThread.fDifference.fLeftStart;
- changeRangeEnd= startThread.fDifference.leftEnd();
-
- startThread.next();
- //
- // check for overlapping changes with other thread
- // merge overlapping changes with this range
- //
- DifferencesIterator other= startThread.other(myIter, yourIter);
- while (other.fDifference != null && other.fDifference.fLeftStart <= changeRangeEnd) {
- int newMax= other.fDifference.leftEnd();
- other.next();
- if (newMax >= changeRangeEnd) {
- changeRangeEnd= newMax;
- other= other.other(myIter, yourIter);
- }
- }
- diff3.add(createRangeDifference3(myIter, yourIter, diff3, right, left, changeRangeStart, changeRangeEnd));
- }
-
- // remove sentinel
- diff3.remove(0);
- return (RangeDifference[]) diff3.toArray(EMPTY_RESULT);
- }
-
- /**
- * Finds the differences among two <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- *
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- */
- public static RangeDifference[] findRanges(IRangeComparator left, IRangeComparator right) {
- return findRanges((IProgressMonitor)null, left, right);
- }
-
- /**
- * Finds the differences among two <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- * @since 2.0
- */
- public static RangeDifference[] findRanges(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) {
- RangeDifference[] in= findDifferences(pm, left, right);
- List out= new ArrayList();
-
- RangeDifference rd;
-
- int mstart= 0;
- int ystart= 0;
-
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart);
- if (rd.maxLength() != 0)
- out.add(rd);
-
- out.add(es);
-
- mstart= es.rightEnd();
- ystart= es.leftEnd();
- }
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- return (RangeDifference[]) out.toArray(EMPTY_RESULT);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- */
- public static RangeDifference[] findRanges(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
- return findRanges(null, ancestor, left, right);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- * @since 2.0
- */
- public static RangeDifference[] findRanges(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
-
- if (ancestor == null)
- return findRanges(pm, left, right);
-
- RangeDifference[] in= findDifferences(pm, ancestor, left, right);
- List out= new ArrayList();
-
- RangeDifference rd;
-
- int mstart= 0;
- int ystart= 0;
- int astart= 0;
-
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart, astart, es.ancestorStart() - astart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- out.add(es);
-
- mstart= es.rightEnd();
- ystart= es.leftEnd();
- astart= es.ancestorEnd();
- }
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart, astart, ancestor.getRangeCount() - astart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- return (RangeDifference[]) out.toArray(EMPTY_RESULT);
- }
-
- //---- private methods
-
- /**
- * Creates a Vector of DifferencesRanges out of the LinkedRangeDifference.
- * It coalesces adjacent changes.
- * In addition, indices are changed such that the ranges are 1) open, i.e,
- * the end of the range is not included, and 2) are zero based.
- */
- private static RangeDifference[] createDifferencesRanges(LinkedRangeDifference start) {
-
- LinkedRangeDifference ep= reverseDifferences(start);
- ArrayList result= new ArrayList();
- RangeDifference es= null;
-
- while (ep != null) {
- es= new RangeDifference(RangeDifference.CHANGE);
-
- if (ep.isInsert()) {
- es.fRightStart= ep.fRightStart + 1;
- es.fLeftStart= ep.fLeftStart;
- RangeDifference b= ep;
- do {
- ep= ep.getNext();
- es.fLeftLength++;
- } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart);
- } else {
- es.fRightStart= ep.fRightStart;
- es.fLeftStart= ep.fLeftStart;
-
- RangeDifference a= ep;
- //
- // deleted lines
- //
- do {
- a= ep;
- ep= ep.getNext();
- es.fRightLength++;
- } while (ep != null && ep.isDelete() && ep.fRightStart == a.fRightStart + 1);
-
- boolean change= (ep != null && ep.isInsert() && ep.fRightStart == a.fRightStart);
-
- if (change) {
- RangeDifference b= ep;
- //
- // replacement lines
- //
- do {
- ep= ep.getNext();
- es.fLeftLength++;
- } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart);
- } else {
- es.fLeftLength= 0;
- }
- es.fLeftStart++; // meaning of range changes from "insert after", to "replace with"
-
- }
- //
- // the script commands are 1 based, subtract one to make them zero based
- //
- es.fRightStart--;
- es.fLeftStart--;
- result.add(es);
- }
- return (RangeDifference[]) result.toArray(EMPTY_RESULT);
- }
-
- /**
- * Creates a <code>RangeDifference3</code> given the
- * state of two DifferenceIterators.
- */
- private static RangeDifference createRangeDifference3(
- DifferencesIterator myIter,
- DifferencesIterator yourIter,
- List diff3,
- IRangeComparator right,
- IRangeComparator left,
- int changeRangeStart,
- int changeRangeEnd) {
-
- int rightStart, rightEnd;
- int leftStart, leftEnd;
- int kind= RangeDifference.ERROR;
- RangeDifference last= (RangeDifference) diff3.get(diff3.size() - 1);
-
- Assert.isTrue((myIter.getCount() != 0 || yourIter.getCount() != 0)); // At least one range array must be non-empty
- //
- // find corresponding lines to fChangeRangeStart/End in right and left
- //
- if (myIter.getCount() == 0) { // only left changed
- rightStart= changeRangeStart - last.ancestorEnd() + last.rightEnd();
- rightEnd= changeRangeEnd - last.ancestorEnd() + last.rightEnd();
- kind= RangeDifference.LEFT;
- } else {
- RangeDifference f= (RangeDifference) myIter.fRange.get(0);
- RangeDifference l= (RangeDifference) myIter.fRange.get(myIter.fRange.size() - 1);
- rightStart= changeRangeStart - f.fLeftStart + f.fRightStart;
- rightEnd= changeRangeEnd - l.leftEnd() + l.rightEnd();
- }
-
- if (yourIter.getCount() == 0) { // only right changed
- leftStart= changeRangeStart - last.ancestorEnd() + last.leftEnd();
- leftEnd= changeRangeEnd - last.ancestorEnd() + last.leftEnd();
- kind= RangeDifference.RIGHT;
- } else {
- RangeDifference f= (RangeDifference) yourIter.fRange.get(0);
- RangeDifference l= (RangeDifference) yourIter.fRange.get(yourIter.fRange.size() - 1);
- leftStart= changeRangeStart - f.fLeftStart + f.fRightStart;
- leftEnd= changeRangeEnd - l.leftEnd() + l.rightEnd();
- }
-
- if (kind == RangeDifference.ERROR) { // overlapping change (conflict) -> compare the changed ranges
- if (rangeSpansEqual(right, rightStart, rightEnd - rightStart, left, leftStart, leftEnd - leftStart))
- kind= RangeDifference.ANCESTOR;
- else
- kind= RangeDifference.CONFLICT;
- }
- return new RangeDifference(kind, rightStart, rightEnd - rightStart, leftStart, leftEnd - leftStart, changeRangeStart, changeRangeEnd - changeRangeStart);
- }
-
- /**
- * Tests if two ranges are equal
- */
- private static boolean rangesEqual(IRangeComparator a, int ai, IRangeComparator b, int bi) {
- return a.rangesEqual(ai, b, bi);
- }
-
- /**
- * Tests whether <code>right</code> and <code>left</left> changed in the same way
- */
- private static boolean rangeSpansEqual(IRangeComparator right, int rightStart, int rightLen, IRangeComparator left, int leftStart, int leftLen) {
- if (rightLen == leftLen) {
- int i= 0;
- for (i= 0; i < rightLen; i++) {
- if (!rangesEqual(right, rightStart + i, left, leftStart + i))
- break;
- }
- if (i == rightLen)
- return true;
- }
- return false;
- }
-
- /**
- * Reverses the range differences
- */
- private static LinkedRangeDifference reverseDifferences(LinkedRangeDifference start) {
- LinkedRangeDifference ep, behind, ahead;
-
- ahead= start;
- ep= null;
- while (ahead != null) {
- behind= ep;
- ep= ahead;
- ahead= ahead.getNext();
- ep.setNext(behind);
- }
- return ep;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html
deleted file mode 100644
index 368068b3b..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html
+++ /dev/null
@@ -1,44 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for finding the differences between
-two or three sequences of comparable entities.
-<h2>
-Package Specification</h2>
-
-The class <b>RangeDifferencer</b> finds longest sequences of matching and
-non-matching comparable entities. Its implementation is based on
-an objectified version of the algorithm described in:
-<i>A File Comparison Program,</i> by Webb Miller and Eugene W. Myers,
-Software Practice and Experience, Vol. 15, Nov. 1985.
-<p>
-
-Clients must supply the input to the differencer as an implementation
-of the <b>IRangeComparator</b> interface.
-An <b>IRangeComparator</b> breaks the input data into a sequence
-of entities and provides a method for comparing
-one entity with the entity in another <b>IRangeComparator</b>.
-<p>
-
-For example, to compare two text documents and find longest common
-sequences of matching and non-matching lines,
-the implementation of <b>IRangeComparator</b>
-must break the document into lines and provide a method for testing
-whether two lines are considered equal.
-See <b>org.eclipse.compare.internal.DocLineComparator</b> for how this can be done.
-<p>
-
-The differencer returns the differences among these sequences as an
-array of <b>RangeDifference</b> objects.
-Every single <b>RangeDifference</b> describes the kind of difference
-(no change, change, addition, deletion) and the corresponding ranges
-of the underlying comparable entities in the two or three inputs.
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
deleted file mode 100644
index 4a3d44c4c..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.util.ArrayList;
-
-/**
- * The standard implementation of a diff container element.
- * <p>
- * This class may be instantiated, or further subclassed.
- * </p>
- */
-public abstract class DiffContainer extends DiffElement implements IDiffContainer {
-
- private static IDiffElement[] fgEmptyArray= new IDiffElement[0];
- private ArrayList fChildren;
-
- /**
- * Creates a new container with the specified kind under the given parent.
- *
- * @param parent under which the new container is added as a child or <code>null</code>.
- * @param name of the container
- * @param kind of difference (defined in <code>Differencer</code>).
- */
- public DiffContainer(IDiffContainer parent, int kind) {
- super(parent, kind);
- }
-
- /**
- * Tries to find the child with the given name.
- * Returns <code>null</code> if no such child exists.
- *
- * @param name of the child to find
- * @return the first element with a matching name
- */
- public IDiffElement findChild(String name) {
- Object[] children= getChildren();
- for (int i= 0; i < children.length; i++) {
- IDiffElement child= (IDiffElement) children[i];
- if (name.equals(child.getName()))
- return child;
- }
- return null;
- }
-
- /* (non Javadoc)
- * see IDiffContainer.add
- */
- public void add(IDiffElement diff) {
- if (fChildren == null)
- fChildren= new ArrayList();
- fChildren.add(diff);
- diff.setParent(this);
- }
-
- /**
- * Removes the given child from this container.
- * If the container becomes empty it is removed from its container.
- */
- /* (non Javadoc)
- * see IDiffContainer.removeToRoot
- */
- public void removeToRoot(IDiffElement child) {
- if (fChildren != null) {
- fChildren.remove(child);
- child.setParent(null);
- if (fChildren.size() == 0) {
- IDiffContainer p= getParent();
- if (p != null)
- p.removeToRoot(this);
- }
- }
- }
-
- /**
- * Removes the given child (non-recursively) from this container.
- *
- * @param child to remove
- */
- public void remove(IDiffElement child) {
- if (fChildren != null) {
- fChildren.remove(child);
- child.setParent(null);
- }
- }
-
- /* (non Javadoc)
- * see IDiffContainer.hasChildren
- */
- public boolean hasChildren() {
- return fChildren != null && fChildren.size() > 0;
- }
-
- /* (non Javadoc)
- * see IDiffContainer.getChildren
- */
- public IDiffElement[] getChildren() {
- if (fChildren != null)
- return (IDiffElement[]) fChildren.toArray(fgEmptyArray);
- return fgEmptyArray;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java
deleted file mode 100644
index 82472ff92..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.compare.ITypedElement;
-
-/**
- * An abstract base implementation of the <code>IDiffElement</code> interface.
- * <p>
- * Subclasses may add behavior and state, and may override <code>getImage</code>
- * and <code>getType</code> to suit.
- * </p>
- */
-public abstract class DiffElement implements IDiffElement {
-
- private int fKind;
- private IDiffContainer fParent;
-
- /**
- * Creates a new <code>DiffElement</code> as a child of the given parent.
- * If parent is not <code>null</code> the new element is added to the parent.
- *
- * @param parent the parent of this child; if not <code>null</code> this element is automatically added as a child
- * @param kind the kind of change
- */
- public DiffElement(IDiffContainer parent, int kind) {
- fParent= parent;
- fKind= kind;
- if (parent != null)
- parent.add(this);
- }
-
- /**
- * The <code>DiffElement</code> implementation of this <code>ITypedInput</code>
- * method returns <code>null</code>. Subclasses may re-implement to provide
- * an image for this element.
- */
- public Image getImage() {
- return null;
- }
-
- /**
- * The <code>DiffElement</code> implementation of this <code>ITypedElement</code>
- * method returns <code>ITypedElement.UNKNOWN_TYPE</code>. Subclasses may
- * re-implement to provide a type for this element.
- */
- public String getType() {
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- /**
- * Sets the kind of difference for this element.
- *
- * @param kind set the kind of difference this element represents
- * @see Differencer
- */
- public void setKind(int kind) {
- fKind= kind;
- }
-
- /* (non Javadoc)
- * see IDiffElement.getKind
- */
- public int getKind() {
- return fKind;
- }
-
- /* (non Javadoc)
- * see IDiffElement.getParent
- */
- public IDiffContainer getParent() {
- return fParent;
- }
-
- /* (non Javadoc)
- * see IDiffElement.setParent
- */
- public void setParent(IDiffContainer parent) {
- fParent= parent;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
deleted file mode 100644
index 7c73a6cc2..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.text.MessageFormat;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.util.ListenerList;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.Utilities;
-
-/**
- * Diff node are used as the compare result of the differencing engine.
- * Since it implements the <code>ITypedElement</code> and <code>ICompareInput</code>
- * interfaces it can be used directly to display the
- * compare result in a <code>DiffTreeViewer</code> and as the input to any other
- * compare/merge viewer.
- * <p>
- * <code>DiffNode</code>s are typically created as the result of performing
- * a compare with the <code>Differencer</code>.
- * <p>
- * Clients typically use this class as is, but may subclass if required.
- *
- * @see DiffTreeViewer
- * @see Differencer
- */
-public class DiffNode extends DiffContainer implements ITypedElement, ICompareInput {
-
- private ITypedElement fAncestor;
- private ITypedElement fLeft;
- private ITypedElement fRight;
- private boolean fDontExpand;
- private ListenerList fListener;
- private boolean fSwapSides;
-
-
- /**
- * Creates a new <code>DiffNode</code> and initializes with the given values.
- *
- * @param parent under which the new container is added as a child or <code>null</code>
- * @param kind of difference (defined in <code>Differencer</code>)
- * @param ancestor the common ancestor input to a compare
- * @param left the left input to a compare
- * @param right the right input to a compare
- */
- public DiffNode(IDiffContainer parent, int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- this(parent, kind);
- fAncestor= ancestor;
- fLeft= left;
- fRight= right;
- }
-
- /**
- * Creates a new <code>DiffNode</code> with diff kind <code>Differencer.CHANGE</code>
- * and initializes with the given values.
- *
- * @param left the left input to a compare
- * @param right the right input to a compare
- */
- public DiffNode(ITypedElement left, ITypedElement right) {
- this(null, Differencer.CHANGE, null, left, right);
- }
-
- /**
- * Creates a new <code>DiffNode</code> and initializes with the given values.
- *
- * @param kind of difference (defined in <code>Differencer</code>)
- * @param ancestor the common ancestor input to a compare
- * @param left the left input to a compare
- * @param right the right input to a compare
- */
- public DiffNode(int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- this(null, kind, ancestor, left, right);
- }
-
- /**
- * Creates a new <code>DiffNode</code> with the given diff kind.
- *
- * @param kind of difference (defined in <code>Differencer</code>)
- */
- public DiffNode(int kind) {
- super(null, kind);
- }
-
- /**
- * Creates a new <code>DiffNode</code> and initializes with the given values.
- *
- * @param parent under which the new container is added as a child or <code>null</code>
- * @param kind of difference (defined in <code>Differencer</code>)
- */
- public DiffNode(IDiffContainer parent, int kind) {
- super(parent, kind);
- }
-
- /**
- * Registers a listener for changes of this <code>ICompareInput</code>.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to add
- */
- public void addCompareInputChangeListener(ICompareInputChangeListener listener) {
- if (fListener == null)
- fListener= new ListenerList();
- fListener.add(listener);
- }
-
- /**
- * Unregisters a <code>ICompareInput</code> listener.
- * Has no effect if listener is not registered.
- *
- * @param listener the listener to remove
- */
- public void removeCompareInputChangeListener(ICompareInputChangeListener listener) {
- if (fListener != null) {
- fListener.remove(listener);
- if (fListener.isEmpty())
- fListener= null;
- }
- }
-
- /**
- * Sends out notification that a change has occured on the <code>ICompareInput</code>.
- */
- protected void fireChange() {
- if (fListener != null) {
- Object[] listeners= fListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((ICompareInputChangeListener) listeners[i]).compareInputChanged(this);
- }
- }
-
- //---- getters & setters
-
- /**
- * Returns <code>true</code> if this node shouldn't automatically be expanded in
- * a </code>DiffTreeViewer</code>.
- *
- * @return <code>true</code> if node shouldn't automatically be expanded
- */
- public boolean dontExpand() {
- return fDontExpand;
- }
-
- /**
- * Controls whether this node is not automatically expanded when displayed in
- * a </code>DiffTreeViewer</code>.
- *
- * @param dontExpand if <code>true</code> this node is not automatically expanded in </code>DiffTreeViewer</code>
- */
- public void setDontExpand(boolean dontExpand) {
- fDontExpand= dontExpand;
- }
-
- /**
- * Returns the first not-<code>null</code> input of this node.
- * Method checks the three inputs in the order: ancestor, right, left.
- *
- * @return the first not-<code>null</code> input of this node
- */
- public ITypedElement getId() {
- if (fAncestor != null)
- return fAncestor;
- if (fRight != null)
- return fRight;
- return fLeft;
- }
-
- /**
- * Returns the (non-<code>null</code>) name of the left or right side if they are identical.
- * Otherwise both names are concatenated (separated with a slash ('/')).
- * <p>
- * Subclasses may re-implement to provide a different name for this node.
- */
- /* (non Javadoc)
- * see ITypedElement.getName
- */
- public String getName() {
- String right= null;
- if (fRight != null)
- right= fRight.getName();
-
- String left= null;
- if (fLeft != null)
- left= fLeft.getName();
-
- if (right == null && left == null) {
- if (fAncestor != null)
- return fAncestor.getName();
- return Utilities.getString("DiffNode.noName"); //$NON-NLS-1$
- }
-
- if (right == null)
- return left;
- if (left == null)
- return right;
-
- if (right.equals(left))
- return right;
-
- String s1;
- String s2;
-
- if (fSwapSides) {
- s1= left;
- s2= right;
- } else {
- s1= right;
- s2= left;
- }
-
- String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
- return MessageFormat.format(fmt, new String[] { s1, s2 });
- }
-
- void swapSides(boolean swap) {
- fSwapSides= swap;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getImage
- */
- public Image getImage() {
- ITypedElement id= getId();
- if (id != null)
- return id.getImage();
- return null;
- }
-
- /* (non Javadoc)
- * see ITypedElement.getType
- */
- public String getType() {
- ITypedElement id= getId();
- if (id != null)
- return id.getType();
- return ITypedElement.UNKNOWN_TYPE;
- }
-
- /* (non Javadoc)
- * see ICompareInput.getAncestor
- */
- public ITypedElement getAncestor() {
- return fAncestor;
- }
-
- /**
- * Sets the left input to the given value.
- *
- * @param left the new value for the left input
- */
- public void setLeft(ITypedElement left) {
- fLeft= left;
- }
-
- /* (non Javadoc)
- * see ICompareInput.getLeft
- */
- public ITypedElement getLeft() {
- return fLeft;
- }
-
- /**
- * Sets the right input to the given value.
- *
- * @param right the new value for the right input
- */
- public void setRight(ITypedElement right) {
- fRight= right;
- }
-
- /* (non Javadoc)
- * see ICompareInput.getRight
- */
- public ITypedElement getRight() {
- return fRight;
- }
-
- /* (non Javadoc)
- * see ICompareInput.copy
- */
- public void copy(boolean leftToRight) {
- //System.out.println("DiffNode.copy: " + leftToRight);
-
- IDiffContainer pa= getParent();
- if (pa instanceof ICompareInput) {
- ICompareInput parent= (ICompareInput) pa;
- Object dstParent= leftToRight ? parent.getRight() : parent.getLeft();
-
- if (dstParent instanceof IEditableContent) {
- ITypedElement dst= leftToRight ? getRight() : getLeft();
- ITypedElement src= leftToRight ? getLeft() : getRight();
- dst= ((IEditableContent)dstParent).replace(dst, src);
- if (leftToRight)
- setRight(dst);
- else
- setLeft(dst);
-
- //setKind(Differencer.NO_CHANGE);
-
- fireChange();
- }
- }
- }
-
- /* (non Javadoc)
- * see Object.hashCode
- */
- public int hashCode() {
- String[] path= getPath(this, 0);
- int hashCode= 1;
- for (int i= 0; i < path.length; i++) {
- String s= path[i];
- hashCode= (31*hashCode) + (s != null ? s.hashCode() : 0);
- }
- return hashCode;
- }
-
- /* (non Javadoc)
- * see Object.equals
- */
- public boolean equals(Object other) {
- if (other != null && getClass() == other.getClass()) {
- String[] path1= getPath(this, 0);
- String[] path2= getPath((DiffNode) other, 0);
- if (path1.length != path2.length)
- return false;
- for (int i= 0; i < path1.length; i++)
- if (! path1[i].equals(path2[i]))
- return false;
- return true;
- }
- return super.equals(other);
- }
-
- private static String[] getPath(ITypedElement el, int level) {
- String[] path= null;
- if (el instanceof IDiffContainer) {
- IDiffContainer parent= ((IDiffContainer)el).getParent();
- if (parent instanceof ITypedElement)
- path= getPath(parent, level+1);
- }
- if (path == null)
- path= new String[level+1];
- path[(path.length-1)-level]= el.getName();
- return path;
- }
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
deleted file mode 100644
index 9cccaa478..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ /dev/null
@@ -1,719 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.util.Iterator;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.compare.internal.*;
-import org.eclipse.compare.*;
-
-/**
- * A tree viewer that works on objects implementing
- * the <code>IDiffContainer</code> and <code>IDiffElement</code> interfaces.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed outside
- * this package.
- * </p>
- *
- * @see IDiffContainer
- * @see IDiffElement
- */
-public class DiffTreeViewer extends TreeViewer {
-
- static class DiffViewerSorter extends ViewerSorter {
-
- public boolean isSorterProperty(Object element, Object property) {
- return false;
- }
-
- public int category(Object node) {
- if (node instanceof DiffNode) {
- Object o= ((DiffNode) node).getId();
- if (o instanceof DocumentRangeNode)
- return ((DocumentRangeNode) o).getTypeCode();
- }
- return 0;
- }
- }
-
- class DiffViewerContentProvider implements ITreeContentProvider {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public boolean isDeleted(Object element) {
- return false;
- }
-
- public void dispose() {
- inputChanged(DiffTreeViewer.this, getInput(), null);
- }
-
- public Object getParent(Object element) {
- if (element instanceof IDiffElement)
- return ((IDiffElement)element).getParent();
- return null;
- }
-
- public final boolean hasChildren(Object element) {
- if (element instanceof IDiffContainer)
- return ((IDiffContainer)element).hasChildren();
- return false;
- }
-
- public final Object[] getChildren(Object element) {
- if (element instanceof IDiffContainer)
- return ((IDiffContainer)element).getChildren();
- return new Object[0];
- }
-
- public Object[] getElements(Object element) {
- return getChildren(element);
- }
- }
-
- /*
- * Takes care of swapping left and right if fLeftIsLocal
- * is true.
- */
- class DiffViewerLabelProvider extends LabelProvider {
-
- public String getText(Object element) {
-
- if (element instanceof IDiffElement)
- return ((IDiffElement)element).getName();
-
- return Utilities.getString(fBundle, "defaultLabel"); //$NON-NLS-1$
- }
-
- public Image getImage(Object element) {
- if (element instanceof IDiffElement) {
- IDiffElement input= (IDiffElement) element;
-
- int kind= input.getKind();
- if (fLeftIsLocal) {
- switch (kind & Differencer.DIRECTION_MASK) {
- case Differencer.LEFT:
- kind= (kind &~ Differencer.LEFT) | Differencer.RIGHT;
- break;
- case Differencer.RIGHT:
- kind= (kind &~ Differencer.RIGHT) | Differencer.LEFT;
- break;
- }
- }
-
- return fCompareConfiguration.getImage(input.getImage(), kind);
- }
- return null;
- }
- }
-
- static class FilterSame extends ViewerFilter {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IDiffElement)
- return (((IDiffElement)element).getKind() & Differencer.PSEUDO_CONFLICT) == 0;
- return true;
- }
- public boolean isFilterProperty(Object element, Object property) {
- return false;
- }
- }
-
- private ResourceBundle fBundle;
- private CompareConfiguration fCompareConfiguration;
- /* package */ boolean fLeftIsLocal;
- private IPropertyChangeListener fPropertyChangeListener;
-
- private Action fCopyLeftToRightAction;
- private Action fCopyRightToLeftAction;
- private Action fEmptyMenuAction;
- private Action fExpandAllAction;
-
- /**
- * Creates a new viewer for the given SWT tree control with the specified configuration.
- *
- * @param tree the tree control
- * @param configuration the configuration for this viewer
- */
- public DiffTreeViewer(Tree tree, CompareConfiguration configuration) {
- super(tree);
- initialize(configuration);
- }
-
- /**
- * Creates a new viewer under the given SWT parent and with the specified configuration.
- *
- * @param parent the SWT control under which to create the viewer
- * @param configuration the configuration for this viewer
- */
- public DiffTreeViewer(Composite parent, CompareConfiguration configuration) {
- super(new Tree(parent, SWT.MULTI));
- initialize(configuration);
- }
-
- private void initialize(CompareConfiguration configuration) {
-
- Control tree= getControl();
-
- INavigatable nav= new INavigatable() {
- public boolean gotoDifference(boolean next) {
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- return internalNavigate(next, true);
- }
- };
- tree.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- IOpenable openable= new IOpenable() {
- public void openSelected() {
- internalOpen();
- }
- };
- tree.setData(IOpenable.OPENABLE_PROPERTY, openable);
-
- fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
-
- tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
-
- Composite parent= tree.getParent();
-
- fBundle= ResourceBundle.getBundle("org.eclipse.compare.structuremergeviewer.DiffTreeViewerResources"); //$NON-NLS-1$
-
- // register for notification with the CompareConfiguration
- fCompareConfiguration= configuration;
- if (fCompareConfiguration != null) {
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- DiffTreeViewer.this.propertyChange(event);
- }
- };
- fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- setContentProvider(new DiffViewerContentProvider());
- setLabelProvider(new DiffViewerLabelProvider());
-
- addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent se) {
- updateActions();
- }
- }
- );
-
- setSorter(new DiffViewerSorter());
-
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
-
- tbm.add(new Separator("merge")); //$NON-NLS-1$
- tbm.add(new Separator("modes")); //$NON-NLS-1$
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
-
- createToolItems(tbm);
- updateActions();
-
- tbm.update(true);
- }
-
- MenuManager mm= new MenuManager();
- mm.setRemoveAllWhenShown(true);
- mm.addMenuListener(
- new IMenuListener() {
- public void menuAboutToShow(IMenuManager mm2) {
- fillContextMenu(mm2);
- if (mm2.isEmpty()) {
- if (fEmptyMenuAction == null) {
- fEmptyMenuAction=
- new Action(Utilities.getString(fBundle, "emptyMenuItem")) {}; //$NON-NLS-1$
- fEmptyMenuAction.setEnabled(false);
- }
- mm2.add(fEmptyMenuAction);
- }
- }
- }
- );
- tree.setMenu(mm.createContextMenu(tree));
- }
-
- /**
- * Returns the viewer's name.
- *
- * @return the viewer's name
- */
- public String getTitle() {
- String title= Utilities.getString(fBundle, "title", null); //$NON-NLS-1$
- if (title == null)
- title= Utilities.getString("DiffTreeViewer.title"); //$NON-NLS-1$
- return title;
- }
-
- /**
- * Returns the resource bundle.
- *
- * @return the viewer's resource bundle
- */
- protected ResourceBundle getBundle() {
- return fBundle;
- }
-
- /**
- * Returns the compare configuration of this viewer.
- *
- * @return the compare configuration of this viewer
- */
- public CompareConfiguration getCompareConfiguration() {
- return fCompareConfiguration;
- }
-
- /**
- * Called on the viewer disposal.
- * Unregisters from the compare configuration.
- * Clients may extend if they have to do additional cleanup.
- */
- protected void handleDispose(DisposeEvent event) {
-
- if (fCompareConfiguration != null) {
- if (fPropertyChangeListener != null)
- fCompareConfiguration.removePropertyChangeListener(fPropertyChangeListener);
- fCompareConfiguration= null;
- }
- fPropertyChangeListener= null;
-
- super.handleDispose(event);
- }
-
- /**
- * Tracks property changes of the configuration object.
- * Clients may extend to track their own property changes.
- */
- protected void propertyChange(PropertyChangeEvent event) {
- }
-
- protected void inputChanged(Object in, Object oldInput) {
- super.inputChanged(in, oldInput);
-
- if (in != oldInput) {
- initialSelection();
- updateActions();
- }
- }
-
- /**
- * This hook method is called from within <code>inputChanged</code>
- * after a new input has been set but before any controls are updated.
- * This default implementation calls <code>navigate(true)</code>
- * to select and expand the first leaf node.
- * Clients can override this method and are free to decide whether
- * they want to call the inherited method.
- *
- * @since 2.0
- */
- protected void initialSelection() {
- navigate(true);
- }
-
- /**
- * Overridden to avoid expanding <code>DiffNode</code>s that shouldn't expand.
- */
- protected void internalExpandToLevel(Widget node, int level) {
-
- Object data= node.getData();
-
- if (dontExpand(data))
- return;
-
- super.internalExpandToLevel(node, level);
- }
-
- /**
- * This hook method is called from within <code>internalExpandToLevel</code>
- * to control whether a given model node should be expanded or not.
- * This default implementation checks whether the object is a <code>DiffNode</code> and
- * calls <code>dontExpand()</code> on it.
- * Clients can override this method and are free to decide whether
- * they want to call the inherited method.
- *
- * @param o the model object to be expanded
- * @return <code>false</code> if a node should be expanded, <code>true</code> to prevent expanding
- * @since 2.0
- */
- protected boolean dontExpand(Object o) {
- return o instanceof DiffNode && ((DiffNode)o).dontExpand();
- }
-
- //---- merge action support
-
- /**
- * This factory method is called after the viewer's controls have been created.
- * It installs four actions in the given <code>ToolBarManager</code>. Two actions
- * allow for copying one side of a <code>DiffNode</code> to the other side.
- * Two other actions are for navigating from one node to the next (previous).
- * <p>
- * Clients can override this method and are free to decide whether they want to call
- * the inherited method.
- *
- * @param toolbarManager the toolbar manager for which to add the actions
- */
- protected void createToolItems(ToolBarManager toolbarManager) {
-
-// fCopyLeftToRightAction= new Action() {
-// public void run() {
-// copySelected(true);
-// }
-// };
-// Utilities.initAction(fCopyLeftToRightAction, fBundle, "action.TakeLeft.");
-// toolbarManager.appendToGroup("merge", fCopyLeftToRightAction);
-
-// fCopyRightToLeftAction= new Action() {
-// public void run() {
-// copySelected(false);
-// }
-// };
-// Utilities.initAction(fCopyRightToLeftAction, fBundle, "action.TakeRight.");
-// toolbarManager.appendToGroup("merge", fCopyRightToLeftAction);
-
-// fNextAction= new Action() {
-// public void run() {
-// navigate(true);
-// }
-// };
-// Utilities.initAction(fNextAction, fBundle, "action.NextDiff."); //$NON-NLS-1$
-// toolbarManager.appendToGroup("navigation", fNextAction); //$NON-NLS-1$
-
-// fPreviousAction= new Action() {
-// public void run() {
-// navigate(false);
-// }
-// };
-// Utilities.initAction(fPreviousAction, fBundle, "action.PrevDiff."); //$NON-NLS-1$
-// toolbarManager.appendToGroup("navigation", fPreviousAction); //$NON-NLS-1$
- }
-
- /**
- * This method is called to add actions to the viewer's context menu.
- * It installs actions for expanding tree nodes, copying one side of a <code>DiffNode</code> to the other side.
- * Clients can override this method and are free to decide whether they want to call
- * the inherited method.
- *
- * @param manager the menu manager for which to add the actions
- */
- protected void fillContextMenu(IMenuManager manager) {
- if (fExpandAllAction == null) {
- fExpandAllAction= new Action() {
- public void run() {
- expandSelection();
- }
- };
- Utilities.initAction(fExpandAllAction, fBundle, "action.ExpandAll."); //$NON-NLS-1$
- }
-
- boolean enable= false;
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements= ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object element= elements.next();
- if (element instanceof IDiffContainer) {
- if (((IDiffContainer)element).hasChildren()) {
- enable= true;
- break;
- }
- }
- }
- }
- fExpandAllAction.setEnabled(enable);
-
- manager.add(fExpandAllAction);
-
- if (fCopyLeftToRightAction != null)
- manager.add(fCopyLeftToRightAction);
- if (fCopyRightToLeftAction != null)
- manager.add(fCopyRightToLeftAction);
- }
-
- /**
- * Expands to infinity all items in the selection.
- *
- * @since 2.0
- */
- 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);
- }
- }
- }
-
- /**
- * Copies one side of all <code>DiffNode</code>s in the current selection to the other side.
- * Called from the (internal) actions for copying the sides of a <code>DiffNode</code>.
- * Clients may override.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- protected void copySelected(boolean leftToRight) {
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator e= ((IStructuredSelection) selection).iterator();
- while (e.hasNext()) {
- Object element= e.next();
- if (element instanceof ICompareInput)
- copyOne((ICompareInput) element, leftToRight);
- }
- }
- }
-
- /**
- * Called to copy one side of the given node to the other.
- * This default implementation delegates the call to <code>ICompareInput.copy(...)</code>.
- * Clients may override.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- protected void copyOne(ICompareInput node, boolean leftToRight) {
-
- node.copy(leftToRight);
-
- // update node's image
- update(new Object[] { node }, null);
- }
-
- /**
- * 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
- */
- protected void navigate(boolean next) {
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- internalNavigate(next, false);
- }
-
- //---- private
-
- /**
- * 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));
- }
- }
- }
- }
-
- private final boolean isEditable(Object element, boolean left) {
- if (element instanceof ICompareInput) {
- ICompareInput diff= (ICompareInput) element;
- Object side= left ? diff.getLeft() : diff.getRight();
- if (side == null && diff instanceof IDiffElement) {
- IDiffContainer container= ((IDiffElement)diff).getParent();
- if (container instanceof ICompareInput) {
- ICompareInput parent= (ICompareInput) container;
- side= left ? parent.getLeft() : parent.getRight();
- }
- }
- if (side instanceof IEditableContent)
- return ((IEditableContent) side).isEditable();
- }
- return false;
- }
-
- private void updateActions() {
- int leftToRight= 0;
- int rightToLeft= 0;
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) selection;
- Iterator e= ss.iterator();
- while (e.hasNext()) {
- Object element= e.next();
- if (element instanceof ICompareInput) {
- if (isEditable(element, false))
- leftToRight++;
- if (isEditable(element, true))
- rightToLeft++;
- if (leftToRight > 0 && rightToLeft > 0)
- break;
- }
- }
- if (fExpandAllAction != null)
- fExpandAllAction.setEnabled(selection.isEmpty());
- }
- if (fCopyLeftToRightAction != null)
- fCopyLeftToRightAction.setEnabled(leftToRight > 0);
- if (fCopyRightToLeftAction != null)
- fCopyRightToLeftAction.setEnabled(rightToLeft > 0);
- }
-
- /*
- * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- */
- private void internalOpen() {
- ISelection selection= getSelection();
- if (selection != null && !selection.isEmpty()) {
- fireOpen(new OpenEvent(this, selection));
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
deleted file mode 100644
index fd835c45e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# @(#)DiffTreeViewerResources.properties
-#
-# Resource strings for DiffTreeViewer.java
-
-title= Structure Compare
-defaultLabel= <no name>
-
-#####################################################
-# Dummy menu item for empty context menu
-#####################################################
-
-emptyMenuItem= <Empty Menu>
-
-#####################################################
-# Actions
-#####################################################
-
-action.Smart.label=Smart
-action.Smart.tooltip=Guess Similar Elements
-action.Smart.image=smartmode_co.gif
-
-action.ExpandAll.label=Expand All
-action.ExpandAll.tooltip=Expand All Nodes
-
-action.CompareContents.label= Show Content Comparison
-action.CompareContents.tooltip= Show content comparison
-
-action.NextDiff.label=Next
-action.NextDiff.tooltip=Select Next Change
-action.NextDiff.image=next_nav.gif
-
-action.PrevDiff.label=Previous
-action.PrevDiff.tooltip=Select Previous Change
-action.PrevDiff.image=prev_nav.gif
-
-action.TakeLeft.label=Copy Left to Right
-action.TakeLeft.tooltip=Copy Selected Nodes from Left to Right
-action.TakeLeft.image=copycont_r_co.gif
-
-action.TakeRight.label=Copy Right to Left
-action.TakeRight.tooltip=Copy Selected Nodes from Right to Left
-action.TakeRight.image=copycont_l_co.gif
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
deleted file mode 100644
index 047bb2c3d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.io.*;
-import java.util.*;
-import java.text.MessageFormat;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.Utilities;
-
-
-/**
- * A generic two-way or three-way differencing engine.
- * <p>
- * The engine is used by calling one of the <code>findDifferences</code> methods and passing
- * in the objects to compare.
- * The engine calls the following methods on the input objects to perform the compare:
- * <UL>
- * <LI><code>getChildren</code>: for enumerating the children of an object (if any),
- * <LI><code>contentsEqual</code>: for comparing the content of leaf objects, that is, objects without children,
- * <LI><code>visit</code>: for every pair of compared object the compare result is passed in.
- * </UL>
- * Clients may use as is, or subclass to provide a custom implementation for the three hooks.
- * However the default implementation already deals with the typical case:
- * <UL>
- * <LI><code>getChildren</code>: tries to apply the <code>IStructureComparator</code>
- * interface to enumerate the children,
- * <LI><code>contentsEqual</code>: tries to apply the <code>IStreamContentAccessor</code> interface
- * to perform a byte-wise content comparison,
- * <LI><code>visit</code>: creates a <code>DiffNode</code> for any detected difference between the compared objects and
- * links it under a parent node effectively creating a tree of differences.
- * </UL>
- * The different kind of changes detected by the engine are decoded as follows:
- * In the two-way case only NO_CHANGE, ADDITION, DELETION, and CHANGE are used.
- * In the three-way case these constants are bitwise ORed with one of directional constants
- * LEFT, RIGHT, and CONFLICTING.
- */
-public class Differencer {
-
- // The kind of differences.
- /**
- * Difference constant (value 0) indicating no difference.
- */
- public static final int NO_CHANGE= 0;
- /**
- * Difference constant (value 1) indicating one side was added.
- */
- public static final int ADDITION= 1;
- /**
- * Difference constant (value 2) indicating one side was removed.
- */
- public static final int DELETION= 2;
- /**
- * Difference constant (value 3) indicating side changed.
- */
- public static final int CHANGE= 3;
-
- /**
- * Bit mask (value 3) for extracting the kind of difference.
- */
- public static final int CHANGE_TYPE_MASK= 3;
-
- // The direction of a three-way change.
- /**
- * Three-way change constant (value 4) indicating a change on left side.
- */
- public static final int LEFT= 4;
-
- /**
- * Three-way change constant (value 8) indicating a change on right side.
- */
- public static final int RIGHT= 8;
-
- /**
- * Three-way change constant (value 12) indicating a change on left and
- * right sides.
- */
- public static final int CONFLICTING= 12;
-
- /**
- * Bit mask (value 12) for extracting the direction of a three-way change.
- */
- public static final int DIRECTION_MASK= 12;
-
- /**
- * Constant (value 16) indicating a change on left and
- * right side (with respect to ancestor) but left and right are identical.
- */
- public static final int PSEUDO_CONFLICT= 16;
-
-
- static class Node {
- List fChildren;
- int fCode;
- Object fAncestor;
- Object fLeft;
- Object fRight;
-
- Node() {
- }
- Node(Node parent, Object ancestor, Object left, Object right) {
- parent.add(this);
- fAncestor= ancestor;
- fLeft= left;
- fRight= right;
- }
- void add(Node child) {
- if (fChildren == null)
- fChildren= new ArrayList();
- fChildren.add(child);
- }
- Object visit(Differencer d, Object parent, int level) {
- if (fCode == NO_CHANGE)
- return null;
- //dump(level);
- Object data= d.visit(parent, fCode, fAncestor, fLeft, fRight);
- if (fChildren != null) {
- Iterator i= fChildren.iterator();
- while (i.hasNext()) {
- Node n= (Node) i.next();
- n.visit(d, data, level+1);
- }
- }
- return data;
- }
-// private void dump(int level) {
-// String name= null;
-// if (fAncestor instanceof ITypedElement)
-// name= ((ITypedElement)fAncestor).getName();
-// if (name == null && fLeft instanceof ITypedElement)
-// name= ((ITypedElement)fLeft).getName();
-// if (name == null && fRight instanceof ITypedElement)
-// name= ((ITypedElement)fRight).getName();
-// if (name == null)
-// name= "???"; //$NON-NLS-1$
-//
-// for (int i= 0; i < level; i++)
-// System.out.print(" "); //$NON-NLS-1$
-//
-// System.out.println(getDiffType(fCode) + name);
-// }
-
-// private String getDiffType(int code) {
-// String dir= " "; //$NON-NLS-1$
-// switch (code & DIRECTION_MASK) {
-// case LEFT:
-// dir= ">"; //$NON-NLS-1$
-// break;
-// case RIGHT:
-// dir= "<"; //$NON-NLS-1$
-// break;
-// case CONFLICTING:
-// dir= "!"; //$NON-NLS-1$
-// break;
-// }
-// String change= "="; //$NON-NLS-1$
-// switch (code & CHANGE_TYPE_MASK) {
-// case ADDITION:
-// change= "+"; //$NON-NLS-1$
-// break;
-// case DELETION:
-// change= "-"; //$NON-NLS-1$
-// break;
-// case CHANGE:
-// change= "#"; //$NON-NLS-1$
-// break;
-// }
-// return dir + change + " "; //$NON-NLS-1$
-// }
- }
-
- /**
- * Creates a new differencing engine.
- */
- public Differencer() {
- }
-
- /**
- * Starts the differencing engine on the three input objects. If threeWay is <code>true</code> a
- * three-way comparison is performed, otherwise a two-way compare (in the latter case the ancestor argument is ignored).
- * The progress monitor is passed to the method <code>updateProgress</code> which is called for every node or
- * leaf compare. The method returns the object that was returned from the top-most call to method <code>visit</code>.
- * At most two of the ancestor, left, and right parameters are allowed to be <code>null</code>.
- *
- * @param threeWay if <code>true</code> a three-way comparison is performed, otherwise a two-way compare
- * @param pm a progress monitor which is passed to method <code>updateProgress</code>
- * @param data a client data that is passed to the top-level call to <code>visit</code>
- * @param ancestor the ancestor object of the compare (may be <code>null</code>)
- * @param left the left object of the compare
- * @param right the right object of the compare
- * @return the object returned from the top most call to method <code>visit</code>,
- * possibly <code>null</code>
- */
- public Object findDifferences(boolean threeWay, IProgressMonitor pm, Object data, Object ancestor, Object left, Object right) {
-
- Node root= new Node();
-
- int code= traverse(threeWay, root, pm, threeWay ? ancestor : null, left, right);
-
- if (code != NO_CHANGE) {
- List l= root.fChildren;
- if (l.size() > 0) {
- Node first= (Node)l.get(0);
- return first.visit(this, data, 0);
- }
- }
- return null;
- }
-
- /**
- * Traverse tree in postorder.
- */
- private int traverse(boolean threeWay, Node parent, IProgressMonitor pm, Object ancestor, Object left, Object right) {
-
- Object[] ancestorChildren= getChildren(ancestor);
- Object[] rightChildren= getChildren(right);
- Object[] leftChildren= getChildren(left);
-
- int code= NO_CHANGE;
-
- Node node= new Node(parent, ancestor, left, right);
-
- boolean content= true; // we reset this if we have at least one child
-
- if (((threeWay && ancestorChildren != null) || !threeWay)
- && rightChildren != null && leftChildren != null) {
- // we only recurse down if no leg is null
- // a node
-
- Set allSet= new HashSet(20);
- Map ancestorSet= null;
- Map rightSet= null;
- Map leftSet= null;
-
- if (ancestorChildren != null) {
- ancestorSet= new HashMap(10);
- for (int i= 0; i < ancestorChildren.length; i++) {
- Object ancestorChild= ancestorChildren[i];
- ancestorSet.put(ancestorChild, ancestorChild);
- allSet.add(ancestorChild);
- }
- }
-
- if (rightChildren != null) {
- rightSet= new HashMap(10);
- for (int i= 0; i < rightChildren.length; i++) {
- Object rightChild= rightChildren[i];
- rightSet.put(rightChild, rightChild);
- allSet.add(rightChild);
- }
- }
-
- if (leftChildren != null) {
- leftSet= new HashMap(10);
- for (int i= 0; i < leftChildren.length; i++) {
- Object leftChild= leftChildren[i];
- leftSet.put(leftChild, leftChild);
- allSet.add(leftChild);
- }
- }
-
- Iterator e= allSet.iterator();
- while (e.hasNext()) {
- Object keyChild= e.next();
-
- content= false;
-
- if (pm != null) {
-
- if (pm.isCanceled())
- throw new OperationCanceledException();
-
- updateProgress(pm, keyChild);
- }
-
- Object ancestorChild= ancestorSet != null ? ancestorSet.get(keyChild) : null;
- Object leftChild= leftSet != null ? leftSet.get(keyChild) : null;
- Object rightChild= rightSet != null ? rightSet.get(keyChild) : null;
-
- int c= traverse(threeWay, node, pm, ancestorChild, leftChild, rightChild);
-
- if ((c & CHANGE_TYPE_MASK) != NO_CHANGE) {
- code|= CHANGE; // deletions and additions of child result in a change of the container
- code|= (c & DIRECTION_MASK); // incoming & outgoing are just ored
- }
- }
- }
-
- if (content) // a leaf
- code= compare(threeWay, ancestor, left, right);
-
- node.fCode= code;
-
- return code;
- }
-
- /**
- * Called for every node or leaf comparison.
- * The differencing engine passes in the input objects of the compare and the result of the compare.
- * The data object is the value returned from a call to the <code>visit</code> method on the parent input.
- * It can be considered the "parent" reference and is useful when building a tree.
- * <p>
- * The <code>Differencer</code> implementation returns a new
- * <code>DiffNode</code> which is initialized with the corresponding values.
- * Subclasses may override.
- *
- * @param data object returned from parent call to <code>visit</code>,
- * possibly <code>null</code>
- * @param result the result of the compare operation performed on the three inputs
- * @param ancestor the compare ancestor of the left and right inputs
- * @param left the left input to the compare
- * @param right the right input to the compare
- * @return the result, possibly <code>null</code>
- */
- protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
-
- /**
- * Performs a 2-way or 3-way compare of the given leaf elements and returns an integer
- * describing the kind of difference.
- */
- private int compare(boolean threeway, Object ancestor, Object left, Object right) {
-
- int description= NO_CHANGE;
-
- if (threeway) {
- if (ancestor == null) {
- if (left == null) {
- if (right == null) {
- Assert.isTrue(false);
- // shouldn't happen
- } else {
- description= RIGHT | ADDITION;
- }
- } else {
- if (right == null) {
- description= LEFT | ADDITION;
- } else {
- description= CONFLICTING | ADDITION;
- if (contentsEqual(left, right))
- description|= PSEUDO_CONFLICT;
- }
- }
- } else {
- if (left == null) {
- if (right == null) {
- description= CONFLICTING | DELETION | PSEUDO_CONFLICT;
- } else {
- if (contentsEqual(ancestor, right))
- description= LEFT | DELETION;
- else
- description= CONFLICTING | CHANGE;
- }
- } else {
- if (right == null) {
- if (contentsEqual(ancestor, left))
- description= RIGHT | DELETION;
- else
- description= CONFLICTING | CHANGE;
- } else {
- boolean ay= contentsEqual(ancestor, left);
- boolean am= contentsEqual(ancestor, right);
-
- if (ay && am)
- ;
- else if (ay && !am) {
- description= RIGHT | CHANGE;
- } else if (!ay && am) {
- description= LEFT | CHANGE;
- } else {
- description= CONFLICTING | CHANGE;
- if (contentsEqual(left, right))
- description|= PSEUDO_CONFLICT;
- }
- }
- }
- }
- } else { // two way compare ignores ancestor
- if (left == null) {
- if (right == null) {
- Assert.isTrue(false);
- // shouldn't happen
- } else {
- description= ADDITION;
- }
- } else {
- if (right == null) {
- description= DELETION;
- } else {
- if (! contentsEqual(left, right))
- description= CHANGE;
- }
- }
- }
-
- return description;
- }
-
- /**
- * Performs a content compare on the two given inputs.
- * <p>
- * The <code>Differencer</code> implementation
- * returns <code>true</code> if both inputs implement <code>IStreamContentAccessor</code>
- * and their byte contents is identical. Subclasses may override to implement
- * a different content compare on the given inputs.
- * </p>
- *
- * @param input1 first input to contents compare
- * @param input2 second input to contents compare
- * @return <code>true</code> if content is equal
- */
- protected boolean contentsEqual(Object input1, Object input2) {
-
- if (input1 == input2)
- return true;
-
- InputStream is1= getStream(input1);
- InputStream is2= getStream(input2);
-
- if (is1 == null && is2 == null) // no byte contents
- return true;
-
- try {
- if (is1 == null || is2 == null) // only one has contents
- return false;
-
- while (true) {
- int c1= is1.read();
- int c2= is2.read();
- if (c1 == -1 && c2 == -1)
- return true;
- if (c1 != c2)
- break;
-
- }
- } catch (IOException ex) {
- // NeedWork
- } finally {
- if (is1 != null) {
- try {
- is1.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- if (is2 != null) {
- try {
- is2.close();
- } catch(IOException ex) {
- // silently ignored
- }
- }
- }
- return false;
- }
-
- /**
- * Tries to return an InputStream for the given object.
- * Returns <code>null</code> if the object not an IStreamContentAccessor
- * or an error occured.
- */
- private InputStream getStream(Object o) {
- if (o instanceof IStreamContentAccessor) {
- try {
- return ((IStreamContentAccessor)o).getContents();
- } catch(CoreException ex) {
- // NeedWork
- }
- }
- return null;
- }
-
- /**
- * Returns the children of the given input or <code>null</code> if there are no children.
- * <p>
- * The <code>Differencer</code> implementation checks whether the input
- * implements the <code>IStructureComparator</code> interface. If yes it is used
- * to return an array containing all children. Otherwise <code>null</code> is returned.
- * Subclasses may override to implement a different strategy to enumerate children.
- * </p>
- *
- * @param input the object for which to return children
- */
- protected Object[] getChildren(Object input) {
- if (input instanceof IStructureComparator)
- return ((IStructureComparator)input).getChildren();
- return null;
- }
-
- /**
- * Called for every leaf or node compare to update progress information.
- * <p>
- * The <code>Differencer</code> implementation shows the name of the input object
- * as a subtask. Subclasses may override.
- * </p>
- *
- * @param progressMonitor the progress monitor for reporting progress
- * @param node the currently processed non-<code>null</code> node
- */
- protected void updateProgress(IProgressMonitor progressMonitor, Object node) {
- if (node instanceof ITypedElement) {
- String name= ((ITypedElement)node).getName();
- String fmt= Utilities.getString("Differencer.progressFormat"); //$NON-NLS-1$
- String msg= MessageFormat.format(fmt, new String[] { name });
- progressMonitor.subTask(msg);
- //progressMonitor.worked(1);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
deleted file mode 100644
index de2c54f44..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import org.eclipse.jface.text.*;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.contentmergeviewer.IDocumentRange;
-
-
-/**
- * A document range node represents a structural element
- * when performing a structure compare of documents.
- * <code>DocumentRangeNodes</code> are created while parsing the document and represent
- * a semantic entity (e.g. a Java class or method).
- * As a consequence of the parsing a <code>DocumentRangeNode</code> maps to a range
- * of characters in the document.
- * <p>
- * Since a <code>DocumentRangeNode</code> implements the <code>IStructureComparator</code>
- * and <code>IStreamContentAccessor</code> interfaces it can be used as input to the
- * differencing engine. This makes it possible to perform
- * a structural diff on a document and have the nodes and leaves of the compare easily map
- * to character ranges within the document.
- * <p>
- * Subclasses may add additional state collected while parsing the document.
- * </p>
- * @see Differencer
- */
-public class DocumentRangeNode
- implements IDocumentRange, IStructureComparator, IEditableContent, IEncodedStreamContentAccessor {
-
- private static final boolean POS_UPDATE= true;
- private static final String UTF_16= "UTF-16"; //$NON-NLS-1$
-
- private IDocument fBaseDocument;
- private Position fRange; // the range in the base document
- private int fTypeCode;
- private String fID;
- private Position fAppendPosition; // a position where to insert a child textually
- private ArrayList fChildren;
-
- /**
- * Creates a new <code>DocumentRangeNode</code> for the given range within the specified
- * document. The <code>typeCode</code> is uninterpreted client data. The ID is used when comparing
- * two nodes with each other: i.e. the differencing engine performs a content compare
- * on two nodes if their IDs are equal.
- *
- * @param typeCode a type code for this node
- * @param id an identifier for this node
- * @param document document on which this node is based on
- * @param start start position of range within document
- * @param length length of range
- */
- public DocumentRangeNode(int typeCode, String id, IDocument document, int start, int length) {
-
- fTypeCode= typeCode;
- fID= id;
-
- fBaseDocument= document;
- fBaseDocument.addPositionCategory(RANGE_CATEGORY);
- fRange= new Position(start, length);
-
- if (POS_UPDATE) {
- try {
- document.addPosition(RANGE_CATEGORY, fRange);
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- } catch (BadLocationException ex) {
- // silently ignored
- }
- }
- }
-
- /* (non Javadoc)
- * see IDocumentRange.getDocument
- */
- public IDocument getDocument() {
- return fBaseDocument;
- }
-
- /* (non Javadoc)
- * see IDocumentRange.getRange
- */
- public Position getRange() {
- return fRange;
- }
-
- /**
- * Returns the type code of this node.
- * The type code is uninterpreted client data which can be set in the constructor.
- *
- * @return the type code of this node
- */
- public int getTypeCode() {
- return fTypeCode;
- }
-
- /**
- * Returns this node's id.
- * It is used in <code>equals</code> and <code>hashcode</code>.
- *
- * @return the node's id
- */
- public String getId() {
- return fID;
- }
-
- /**
- * Sets this node's id.
- * It is used in <code>equals</code> and <code>hashcode</code>.
- *
- * @param id the new id for this node
- */
- public void setId(String id) {
- fID= id;
- }
-
- /**
- * Adds the given node as a child.
- *
- * @param node the node to add as a child
- */
- public void addChild(DocumentRangeNode node) {
- if (fChildren == null)
- fChildren= new ArrayList();
- fChildren.add(node);
- }
-
- /* (non Javadoc)
- * see IStructureComparator.getChildren
- */
- public Object[] getChildren() {
- if (fChildren != null)
- return fChildren.toArray();
- return new Object[0];
- }
-
- /**
- * Sets the length of the range of this node.
- *
- * @param length the length of the range
- */
- public void setLength(int length) {
- getRange().setLength(length);
- }
-
- /**
- * Sets a position within the document range that can be used to (legally) insert
- * text without breaking the syntax of the document.
- * <p>
- * E.g. when parsing a Java document the "append position" of a <code>DocumentRangeNode</code>
- * representating a Java class could be the character position just before the closing bracket.
- * Inserting the text of a new method there would not disturb the syntax of the class.
- *
- * @param pos the character position within the underlying document where text can be legally inserted
- */
- public void setAppendPosition(int pos) {
- if (POS_UPDATE) {
- fBaseDocument.removePosition(fAppendPosition);
- try {
- Position p= new Position(pos);
- fBaseDocument.addPosition(RANGE_CATEGORY, p);
- fAppendPosition= p;
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- } catch (BadLocationException ex) {
- // silently ignored
- }
- } else {
- fAppendPosition= new Position(pos);
- }
- }
-
- /**
- * Returns the position that has been set with <code>setAppendPosition</code>.
- * If <code>setAppendPosition</code> hasn't been called, the position after the last character
- * of this range is returned.
- *
- * @return a position where text can be legally inserted
- */
- public Position getAppendPosition() {
- if (fAppendPosition == null) {
- if (POS_UPDATE) {
- try {
- Position p= new Position(fBaseDocument.getLength());
- fBaseDocument.addPosition(RANGE_CATEGORY, p);
- fAppendPosition= p;
- } catch (BadPositionCategoryException ex) {
- // silently ignored
- } catch (BadLocationException ex) {
- // silently ignored
- }
- } else {
- fAppendPosition= new Position(fBaseDocument.getLength());
- }
- }
- return fAppendPosition;
- }
-
- /**
- * Implementation based on <code>getID</code>.
- */
- public boolean equals(Object other) {
- if (other != null && other.getClass() == getClass()) {
- DocumentRangeNode tn= (DocumentRangeNode) other;
- return fTypeCode == tn.fTypeCode && fID.equals(tn.fID);
- }
- return super.equals(other);
- }
-
- /**
- * Implementation based on <code>getID</code>.
- */
- public int hashCode() {
- return fID.hashCode();
- }
-
- /**
- * Find corresponding position
- */
- private Position findCorrespondingPosition(DocumentRangeNode otherParent, DocumentRangeNode child) {
-
- // we try to find a predecessor of left Node which exists on the right side
-
- if (child != null && fChildren != null) {
- int ix= otherParent.fChildren.indexOf(child);
- if (ix >= 0) {
-
- for (int i= ix - 1; i >= 0; i--) {
- DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i);
- int i2= fChildren.indexOf(c1);
- if (i2 >= 0) {
- DocumentRangeNode c= (DocumentRangeNode) fChildren.get(i2);
- //System.out.println(" found corresponding: " + i2 + " " + c);
- Position p= c.fRange;
-
- //try {
- Position po= new Position(p.getOffset() + p.getLength() + 1, 0);
- //c.fBaseDocument.addPosition(RANGE_CATEGORY, po);
- return po;
- //} catch (BadLocationException ex) {
- //}
- //break;
- }
- }
-
- for (int i= ix; i < otherParent.fChildren.size(); i++) {
- DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i);
- int i2= fChildren.indexOf(c1);
- if (i2 >= 0) {
- DocumentRangeNode c= (DocumentRangeNode) fChildren.get(i2);
- //System.out.println(" found corresponding: " + i2 + " " + c);
- Position p= c.fRange;
- //try {
- Position po= new Position(p.getOffset(), 0);
- //c.fBaseDocument.addPosition(RANGE_CATEGORY, po);
- return po;
- //} catch (BadLocationException ex) {
- //}
- //break;
- }
- }
-
- }
- }
- return getAppendPosition();
- }
-
- private void add(String s, DocumentRangeNode parent, DocumentRangeNode child) {
-
- Position p= findCorrespondingPosition(parent, child);
- if (p != null) {
- try {
- fBaseDocument.replace(p.getOffset(), p.getLength(), s);
- } catch (BadLocationException ex) {
- // silently ignored
- }
- }
- }
-
- /* (non Javadoc)
- * see IStreamContentAccessor.getContents
- */
- public InputStream getContents() {
- String s;
- try {
- s= fBaseDocument.get(fRange.getOffset(), fRange.getLength());
- } catch (BadLocationException ex) {
- s= ""; //$NON-NLS-1$
- }
- return new ByteArrayInputStream(Utilities.getBytes(s, UTF_16));
- }
-
- /* (non Javadoc)
- * see IEditableContent.isEditable
- */
- public boolean isEditable() {
- return true;
- }
-
- /* (non Javadoc)
- * see IEditableContent.replace
- */
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
-
- DocumentRangeNode src= null;
- String srcContents= ""; //$NON-NLS-1$
-
- if (other != null) {
- src= (DocumentRangeNode) child;
-
- if (other instanceof IStreamContentAccessor) {
- try {
- srcContents= Utilities.readString((IStreamContentAccessor)other);
- } catch(CoreException ex) {
- // NeedWork
- }
- }
- }
-
- if (child == null) // no destination: we have to add the contents into the parent
- add(srcContents, null, src);
-
- return child;
- }
-
- /* (non Javadoc)
- * see IEditableContent.setContent
- */
- public void setContent(byte[] content) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IStreamContentAccessor#getEncoding()
- */
- public String getCharset() {
- return UTF_16;
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
deleted file mode 100644
index 4d937937f..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface for objects used as input to a two-way or three-way compare viewer.
- * It defines API for accessing the three sides for the compare,
- * and a name and image which is used when displaying the three way input
- * in the UI, for example, in a title bar.
- * <p>
- * Note: at most two sides of an <code>ICompareInput</code> can be <code>null</code>,
- * (as it is normal for additions or deletions) but not all three.
- * <p>
- * <code>ICompareInput</code> provides methods for registering
- * <code>ICompareInputChangeListener</code>s
- * that get informed if one (or more)
- * of the three sides of an <code>ICompareInput</code> object changes its value.
- * <p>
- * For example when accepting an incoming addition
- * the (non-<code>null</code>) left side of an <code>ICompareInput</code>
- * is copied to the right side by means of method <code>copy</code>.
- * This should trigger a call to <code>compareInputChanged</code> of registered
- * <code>ICompareInputChangeListener</code>s.
- * <p>
- * Clients can implement this interface, or use the convenience implementation
- * <code>DiffNode</code>.
- * </p>
- *
- * @see StructureDiffViewer
- * @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer
- * @see DiffNode
- */
-public interface ICompareInput {
-
- /**
- * Returns name of input.
- * This name is displayed when this input is shown in a viewer.
- * In many cases this name is the name of one of the non-<code>null</code> sides or a combination
- * thereof.
- *
- * @return name of input
- */
- String getName();
-
- /**
- * Returns an image representing this input.
- * This image is typically displayed when this input is shown in a viewer.
- * In many cases this image is the image of one of the non-<code>null</code> sides.
- *
- * @return image representing this input, or <code>null</code> if no icon should be shown
- */
- Image getImage();
-
- /**
- * Returns the kind of difference between the
- * three sides ancestor, left and right.
- * This field is only meaningful if the <code>ICompareInput</code>
- * is the result of another compare. In this case it is used
- * together with <code>getImage</code> to compose a icon
- * which reflects the kind of difference between the two or three elements.
- *
- * @return kind of difference (see <code>Differencer</code>)
- */
- int getKind();
-
- /**
- * Returns the ancestor side of this input.
- * Returns <code>null</code> if this input has no ancestor
- * or in the two-way compare case.
- *
- * @return the ancestor of this input, or <code>null</code>
- */
- ITypedElement getAncestor();
-
- /**
- * Returns the left side of this input.
- * Returns <code>null</code> if there is no left side (deletion or addition).
- *
- * @return the left side of this input, or <code>null</code>
- */
- ITypedElement getLeft();
-
- /**
- * Returns the right side of this input.
- * Returns <code>null</code> if there is no right side (deletion or addition).
- *
- * @return the right side of this input, or <code>null</code>
- */
- ITypedElement getRight();
-
- /**
- * Registers the given listener for notification.
- * If the identical listener is already registered the method has no effect.
- *
- * @param listener the listener to register for changes of this input
- */
- void addCompareInputChangeListener(ICompareInputChangeListener listener);
-
- /**
- * Unregisters the given listener.
- * If the identical listener is not registered the method has no effect.
- *
- * @param listener the listener to unregister
- */
- void removeCompareInputChangeListener(ICompareInputChangeListener listener);
-
- /**
- * Copy one side (source) to the other side (destination) depending on the
- * value of <code>leftToRight</code>. This method is called from
- * a merge viewer if a corresponding action ("take left" or "take right")
- * has been pressed.
- * <p>
- * The implementation should handle the following cases:
- * <UL>
- * <LI>
- * if the source side is <code>null</code> the destination must be deleted,
- * <LI>
- * if the destination is <code>null</code> the destination must be created
- * and filled with the contents from the source,
- * <LI>
- * if both sides are non-<code>null</code> the contents of source must be copied to destination.
- * </UL>
- * In addition the implementation should send out notification to the registered
- * <code>ICompareInputChangeListener</code>.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- void copy(boolean leftToRight);
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
deleted file mode 100644
index 461a94ab4..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * Listener that gets informed if one (or more)
- * of the three sides of an <code>ICompareInput</code> object changes its value.
- * <p>
- * For example when accepting an incoming addition
- * the (non-null) left side of an <code>ICompareInput</code>
- * is copied to the right side (which was <code>null</code>).
- * This triggers a call to <code>compareInputChanged</code> of registered
- * <code>ICompareInputChangeListener</code>.
- * <p>
- * Note however, that listener are not informed if the content of one of the sides changes.
- * <p>
- * Clients may implement this interface. It is also implemented by viewers that take
- * an <code>ICompareInput</code> as input.
- * </p>
- */
-public interface ICompareInputChangeListener {
-
- /**
- * Called whenever the value (not the content) of one or more of the three sides
- * of a <code>ICompareInput</code> has changed.
- *
- * @param source the <code>ICompareInput</code> that has changed
- */
- void compareInputChanged(ICompareInput source);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
deleted file mode 100644
index 598996bef..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * <code>IDiffContainer</code> is a <code>IDiffElement</code> with children.
- * <p>
- * <code>IDiffContainer</code> are the inner nodes displayed
- * by the <code>DiffTreeViewer</code>.
- * <code>IDiffContainer</code> are typically created as the result of performing
- * a compare with the <code>Differencer</code>.
- * <p>
- * Clients may implement this interface, or use one of the standard implementations,
- * <code>DiffContainer</code> or <code>DiffNode</code>.
- *
- * @see Differencer
- * @see DiffTreeViewer
- */
-public interface IDiffContainer extends IDiffElement {
-
- /**
- * Returns whether this container has at least one child.
- * In some cases this methods avoids having to call the
- * potential more costly <code>getChildren</code> method.
- *
- * @return <code>true</code> if this container has at least one child
- */
- boolean hasChildren();
-
- /**
- * Returns the children of this container.
- * If this container has no children an empty array is returned (not <code>null</code>).
- *
- * @return the children of this container as an array
- */
- IDiffElement[] getChildren();
-
- /**
- * Adds the given child to this container.
- * If the child is already contained in this container, this method has no effect.
- *
- * @param child the child to be added to this container
- */
- void add(IDiffElement child);
-
- /**
- * Removes the given child from this container.
- * If the container becomes empty it is removed from its container.
- * If the child is not contained in this container, this method has no effect.
- *
- * @param child the child to be removed from this container
- */
- void removeToRoot(IDiffElement child);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
deleted file mode 100644
index f09742a1d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.compare.ITypedElement;
-
-/**
- * An <code>IDiffElement</code> is used in the <code>DiffTreeViewer</code>
- * to display the kind of change detected as the result of a two-way or three-way compare.
- * <p>
- * The base interface <code>ITypedElement</code> provides a name, a type, and an image.
- * <code>IDiffElement</code> adds API for maintaining a parent relationship.
- * <p>
- * <code>DiffTreeViewer</code> works on a tree of <code>IDiffElements</code>.
- * Leaf elements must implement the
- * <code>IDiffElement</code> interface, inner nodes the <code>IDiffContainer</code> interface.
- * <p>
- * <code>IDiffElement</code>s are typically created as the result of performing
- * a compare with the <code>Differencer</code>.
- * <p>
- * Clients may implement this interface, or use one of the standard implementations,
- * <code>DiffElement</code>, <code>DiffContainer</code>, or <code>DiffNode</code>.
- *
- * @see DiffTreeViewer
- * @see DiffElement
- * @see DiffContainer
- * @see DiffNode
- */
-public interface IDiffElement extends ITypedElement {
-
- /**
- * Returns the kind of difference as defined in <code>Differencer</code>.
- *
- * @return the kind of difference as defined in <code>Differencer</code>
- */
- int getKind();
-
- /**
- * Returns the parent of this element.
- * If the object is the root of a hierarchy <code>null</code> is returned.
- *
- * @return the parent of this element, or <code>null</code> if the element has no parent
- */
- IDiffContainer getParent();
-
- /**
- * Sets the parent of this element.
- *
- * @param parent the new parent of this element, or <code>null</code> if this
- * element is to have no parent
- */
- void setParent(IDiffContainer parent);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
deleted file mode 100644
index b4bb8e0d0..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * Interface used to compare hierarchical structures.
- * It is used by the differencing engine.
- * <p>
- * Clients typically implement this interface in an adaptor class which
- * wrappers the objects to be compared.
- *
- * @see org.eclipse.compare.ResourceNode
- * @see Differencer
- */
-public interface IStructureComparator {
-
- /**
- * Returns an iterator for all children of this object or <code>null</code>
- * if there are no children.
- *
- * @return an array with all children of this object, or an empty array if there are no children
- */
- Object[] getChildren();
-
- /**
- * Returns whether some other object is "equal to" this one
- * with respect to a structural comparison. For example, when comparing
- * Java class methods, <code>equals</code> would return <code>true</code>
- * if two methods have the same signature (the argument names and the
- * method body might differ).
- *
- * @param other the reference object with which to compare
- * @return <code>true</code> if this object is the same as the other argument; <code>false</code> otherwise
- * @see java.lang.Object#equals
- */
- boolean equals(Object other);
-}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
deleted file mode 100644
index 2f2c3916a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-/**
- * Interface used to create a hierarchical structure of
- * <code>IStructureComparator</code>s for a given input object.
- * In addition, it provides methods for locating a path in the hierarchical structure
- * and to map a node of this structure back to the corresponding input object.
- * <p>
- * Structure creators are used in the following contexts:
- * <ul>
- * <li>
- * the <code>StructureDiffViewer</code> uses an <code>IStructureCreator</code> to
- * build two (or three) tree structures of its input elements (method <code>getStructure</code>).
- * These trees are then compared with each other by means of the differencing engine and displayed
- * with the <code>DiffTreeViewer</code>,
- * </li>
- * <li>
- * the <code>ReplaceWithEditionDialog</code> uses an <code>IStructureCreator</code>
- * to map a path back to a range of characters in the textual representation.
- * </li>
- * </ul>
- * A <code>IStructureCreator</code> provides methods for rewriting the tree produced by the differencing
- * engine to support "smart" structural differencing. E.g. certain patterns of pairs of "addition"
- * and "deletion" nodes can be detected as renames and merged into a single node.
- * </p>
- * <p>
- * Clients may implement this interface; there is no standard implementation.
- * </p>
- *
- * @see StructureDiffViewer
- * @see org.eclipse.compare.EditionSelectionDialog
- * @see Differencer
- */
-public interface IStructureCreator {
-
- /**
- * Returns a descriptive name which can be used in the UI of the <code>StructureDiffViewer</code>.
- *
- * @return a descriptive name for this <code>IStructureCreator</code>
- */
- String getName();
-
- /**
- * Creates a tree structure consisting of <code>IStructureComparator</code>s
- * from the given object and returns its root object.
- * Implementing this method typically involves parsing the input object.
- * In case of an error (e.g. a parsing error) the value <code>null</code> is returned.
- *
- * @param input the object from which to create the tree of <code>IStructureComparator</code>
- * @return the root node of the structure or <code>null</code> in case of error
- */
- IStructureComparator getStructure(Object input);
-
- /**
- * Creates the single node specified by path from the given input object.
- * In case of an error (e.g. a parsing error) the value <code>null</code> is returned.
- * This method is similar to <code>getStructure</code> but in
- * contrast to <code>getStructure</code> only a single node without any children must be returned.
- * This method is used in the <code>ReplaceWithEditionDialog</code> to locate a sub element
- * (e.g. a method) within an input object (e.g. a file containing source code).
- * <p>
- * One (not optimized) approach to implement this method is calling <code>getStructure(input)</code>
- * to build the full tree, and then finding that node within the tree that is specified
- * by <code>path</code>.
- * <p>
- * The syntax of <code>path</code> is not specified, because it is treated by the compare subsystem
- * as an opaque entity and is not further interpreted. Clients using this functionality
- * will pass a value of <code>path</code> to the <code>selectEdition</code>
- * method of <code>ReplaceWithEditionDialog</code> and will receive this value unchanged
- * as an argument to <code>locate</code>.
- *
- * @param path specifies a sub object within the input object
- * @param input the object from which to create the <code>IStructureComparator</code>
- * @return the single node specified by <code>path</code> or <code>null</code>
- *
- * @see org.eclipse.compare.EditionSelectionDialog#selectEdition
- */
- IStructureComparator locate(Object path, Object input);
-
- /**
- * Returns the contents of the given node as a string for the purpose
- * of performing a content comparison only (that is the string will not be visible in the UI).
- * If <code>ignoreWhitespace</code> is <code>true</code> all character sequences considered
- * whitespace should be removed from the returned string.
- *
- * @param node the node for which to return a string representation
- * @param ignoreWhitespace if <code>true</code> the returned string should not contain whitespace
- * @return the string contents of the given node
- */
- String getContents(Object node, boolean ignoreWhitespace);
-
- /**
- * Called whenever a copy operation has been performed on a tree node.
- *
- * @param node the node for which to save the new content
- * @param input the object from which the structure tree was created in <code>getStructure</code>
- */
- void save(IStructureComparator node, Object input);
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
deleted file mode 100644
index 9b91942ef..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.compare.structuremergeviewer;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.*;
-
-
-/**
- * A diff tree viewer that can be configured with a <code>IStructureCreator</code>
- * to retrieve a hierarchical structure from the input object (an <code>ICompareInput</code>)
- * and perform a two-way or three-way compare on it.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed outside
- * this package.
- * </p>
- *
- * @see IStructureCreator
- * @see ICompareInput
- */
-public class StructureDiffViewer extends DiffTreeViewer {
-
- private Differencer fDifferencer;
- private boolean fThreeWay= false;
-
- private ITypedElement fAncestorInput;
- private ITypedElement fLeftInput;
- private ITypedElement fRightInput;
-
- private IStructureComparator fAncestorStructure;
- private IStructureComparator fLeftStructure;
- private IStructureComparator fRightStructure;
-
- private IStructureCreator fStructureCreator;
- private IDiffContainer fRoot;
- private IContentChangeListener fContentChangedListener;
- private CompareViewerSwitchingPane fParent;
-
- /**
- * Creates a new viewer for the given SWT tree control with the specified configuration.
- *
- * @param tree the tree control
- * @param configuration the configuration for this viewer
- */
- public StructureDiffViewer(Tree tree, CompareConfiguration configuration) {
- super(tree, configuration);
- Composite c= tree.getParent();
- if (c instanceof CompareViewerSwitchingPane)
- fParent= (CompareViewerSwitchingPane) c;
- initialize();
- }
-
- /**
- * Creates a new viewer under the given SWT parent with the specified configuration.
- *
- * @param parent the SWT control under which to create the viewer
- * @param configuration the configuration for this viewer
- */
- public StructureDiffViewer(Composite parent, CompareConfiguration configuration) {
- super(parent, configuration);
- if (parent instanceof CompareViewerSwitchingPane)
- fParent= (CompareViewerSwitchingPane) parent;
- initialize();
- }
-
- private void initialize() {
-
- setAutoExpandLevel(3);
-
- fContentChangedListener= new IContentChangeListener() {
- public void contentChanged(IContentChangeNotifier changed) {
- StructureDiffViewer.this.contentChanged(changed);
- }
- };
- new ICompareInputChangeListener() {
- public void compareInputChanged(ICompareInput input) {
- StructureDiffViewer.this.compareInputChanged(input);
- }
- };
- }
-
- /**
- * Configures the <code>StructureDiffViewer</code> with a structure creator.
- * The structure creator is used to create a hierarchical structure
- * for each side of the viewer's input element of type <code>ICompareInput</code>.
- *
- * @param structureCreator the new structure creator
- */
- public void setStructureCreator(IStructureCreator structureCreator) {
- if (fStructureCreator != structureCreator) {
- fStructureCreator= structureCreator;
- Control tree= getControl();
- if (tree != null && !tree.isDisposed())
- tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
- }
- }
-
- /**
- * Returns the structure creator or <code>null</code> if no
- * structure creator has been set with <code>setStructureCreator</code>.
- *
- * @return the structure creator or <code>null</code>
- */
- public IStructureCreator getStructureCreator() {
- return fStructureCreator;
- }
-
- /**
- * Reimplemented to get the descriptive title for this viewer from the <code>IStructureCreator</code>.
- */
- public String getTitle() {
- if (fStructureCreator != null)
- return fStructureCreator.getName();
- return super.getTitle();
- }
-
- /**
- * Overridden because the input of this viewer is not identical to the root of the tree.
- * The tree's root is a IDiffContainer that was returned from the method <code>diff</code>.
- *
- * @return the root of the diff tree produced by method <code>diff</code>
- */
- protected Object getRoot() {
- return fRoot;
- }
-
- /**
- * Overridden to create the comparable structures from the input object
- * and to feed them through the differencing engine. Note: for this viewer
- * the value from <code>getInput</code> is not identical to <code>getRoot</code>.
- */
- protected void inputChanged(Object input, Object oldInput) {
- if (input instanceof ICompareInput) {
- compareInputChanged((ICompareInput) input);
- if (input != oldInput)
- initialSelection();
- }
- }
-
- protected void initialSelection() {
- expandToLevel(2);
- }
-
- /* (non Javadoc)
- * Overridden to unregister all listeners.
- */
- protected void handleDispose(DisposeEvent event) {
-
- compareInputChanged(null);
-
- fContentChangedListener= null;
-
- super.handleDispose(event);
- }
-
- /**
- * Recreates the comparable structures for the input sides.
- */
- protected void compareInputChanged(ICompareInput input) {
- ITypedElement t= null;
- boolean changed= false;
-
- if (input != null)
- t= input.getAncestor();
-
- fThreeWay= (t != null);
-
- if (t != fAncestorInput) {
- if (fAncestorInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener);
- fAncestorInput= t;
- if (fAncestorInput != null) {
- fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- changed= true;
- } else
- fAncestorStructure= null;
- if (fAncestorInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fAncestorInput).addContentChangeListener(fContentChangedListener);
- }
-
- if (input != null)
- t= input.getLeft();
- if (t != fLeftInput) {
- if (fLeftInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fLeftInput).removeContentChangeListener(fContentChangedListener);
- fLeftInput= t;
- if (fLeftInput != null) {
- fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- changed= true;
- } else
- fLeftStructure= null;
- if (fLeftInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fLeftInput).addContentChangeListener(fContentChangedListener);
- }
-
- if (input != null)
- t= input.getRight();
- if (t != fRightInput) {
- if (fRightInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fRightInput).removeContentChangeListener(fContentChangedListener);
- fRightInput= t;
- if (fRightInput != null) {
- fRightStructure= fStructureCreator.getStructure(fRightInput);
- changed= true;
- } else
- fRightStructure= null;
- if (fRightInput instanceof IContentChangeNotifier)
- ((IContentChangeNotifier)fRightInput).addContentChangeListener(fContentChangedListener);
- }
-
- if (changed)
- diff();
- }
-
- /**
- * Calls <code>diff</code> whenever the byte contents changes.
- */
- protected void contentChanged(IContentChangeNotifier changed) {
-
- if (fStructureCreator == null)
- return;
-
- if (changed != null) {
- if (changed == fAncestorInput) {
- fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- } else if (changed == fLeftInput) {
- fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- } else if (changed == fRightInput) {
- fRightStructure= fStructureCreator.getStructure(fRightInput);
- } else
- return;
- } else {
- fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- fRightStructure= fStructureCreator.getStructure(fRightInput);
- }
-
- diff();
- }
-
- /**
- * This method is called from within <code>diff()</code> before the difference
- * tree is being built.
- * Clients may override this method to perform their own pre-processing.
- * This default implementation does nothing.
- * @param ancestor the ancestor input to the differencing operation
- * @param left the left input to the differencing operation
- * @param right the right input to the differencing operation
- * @since 2.0
- */
- protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) {
- // we do nothing here
- }
-
- /**
- * Runs the difference engine and refreshes the tree.
- */
- protected void diff() {
-
- preDiffHook(fAncestorStructure, fLeftStructure, fRightStructure);
-
- String message= null;
-
- if ((fThreeWay && fAncestorStructure == null) || fLeftStructure == null || fRightStructure == null) {
- // could not get structure of one (or more) of the legs
- fRoot= null;
- message= CompareMessages.getString("StructureDiffViewer.StructureError"); //$NON-NLS-1$
-
- } else { // calculate difference of the two (or three) structures
-
- if (fDifferencer == null)
- fDifferencer= new Differencer() {
- protected boolean contentsEqual(Object o1, Object o2) {
- return StructureDiffViewer.this.contentsEqual(o1, o2);
- }
- protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- Object o= super.visit(data, result, ancestor, left, right);
- if (fLeftIsLocal && o instanceof DiffNode)
- ((DiffNode)o).swapSides(fLeftIsLocal);
- return o;
- }
- };
-
- fRoot= (IDiffContainer) fDifferencer.findDifferences(fThreeWay, null, null,
- fAncestorStructure, fLeftStructure, fRightStructure);
-
- if (fRoot == null || fRoot.getChildren().length == 0) {
- message= CompareMessages.getString("StructureDiffViewer.NoStructuralDifferences"); //$NON-NLS-1$
- } else {
- postDiffHook(fDifferencer, fRoot);
- }
- }
- if (fParent != null)
- fParent.setTitleArgument(message);
-
- refresh(getRoot());
- }
-
- /**
- * This method is called from within <code>diff()</code> after the difference
- * tree has been built.
- * Clients may override this method to perform their own post-processing.
- * This default implementation does nothing.
- * @param differencer the differencer used to perform the differencing
- * @param root the non-<code>null</code> root node of the difference tree
- * @since 2.0
- */
- protected void postDiffHook(Differencer differencer, IDiffContainer root) {
- // we do nothing here
- }
-
- /**
- * Performs a byte compare on the given objects.
- * Called from the difference engine.
- * Returns <code>null</code> if no structure creator has been set.
- */
- private boolean contentsEqual(Object o1, Object o2) {
- if (fStructureCreator != null) {
- boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false);
- String s1= fStructureCreator.getContents(o1, ignoreWhiteSpace);
- String s2= fStructureCreator.getContents(o2, ignoreWhiteSpace);
- if (s1 == null || s2 == null)
- return false;
- return s1.equals(s2);
- }
- return false;
- }
-
- /**
- * Tracks property changes of the configuration object.
- * Clients may override to track their own property changes.
- * In this case they must call the inherited method.
- */
- protected void propertyChange(PropertyChangeEvent event) {
- String key= event.getProperty();
- if (key.equals(CompareConfiguration.IGNORE_WHITESPACE))
- diff();
- else
- super.propertyChange(event);
- }
-
- /**
- * Overridden to call the <code>save</code> method on the structure creator after
- * nodes have been copied from one side to the other side of an input object.
- *
- * @param leftToRight if <code>true</code> the left side is copied to the right side.
- * If <code>false</code> the right side is copied to the left side
- */
- protected void copySelected(boolean leftToRight) {
- super.copySelected(leftToRight);
-
- if (fStructureCreator != null)
- fStructureCreator.save(
- leftToRight ? fRightStructure : fLeftStructure,
- leftToRight ? fRightInput : fLeftInput);
- }
-}
-
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html
deleted file mode 100644
index 60257a4d8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html
+++ /dev/null
@@ -1,79 +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">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for finding and displaying the differences
-between hierarchically structured data.
-<h2>
-Package Specification</h2>
-
-The class <b>Differencer</b> is a differencing engine for hierarchically
-structured data. It takes two or three inputs and performs a two-way or
-three-way compare on them.
-<p>
-
-If the input elements to the differencing engine implement the <b>IStructureComparator</b>
-interface the engine recursively applies itself to the children of
-the input element. Leaf elements must implement the <b>org.eclipse.compare.IStreamContentAccessor</b>
-interface so that the differencer can perform a bytewise comparison on their contents.
-<p>
-
-One good example for this is <b>org.eclipse.compare.ResourceNode</b> which implements both interfaces
-(and more) for Eclipse workspace resources (org.eclipse.core.resources.IResource).
-<p>
-
-Another example is the <b>DocumentRangeNode</b> which can be used to compare hierarchical structures
-that are superimposed on a document, that is where nodes and leafs correspond to ranges in a document
-(<b>org.eclipse.compare.contentmergeviewer.IDocumentRange</b>).
-<br>
-Typically <b>DocumentRangeNode</b>s are created while parsing a document and they represent
-the semantic entities of the document (e.g. a Java class, method or field).
-The two subclasses <b>JavaNode</b> (in org.eclipse.jdt.internal.ui.compare)
-and <b>PropertyNode</b> (in org.eclipse.jdt.internal.ui.compare) are good examples for this.
-<p>
-
-By default the differencing engine returns the result of the compare operation
-as a tree of <b>DiffNode</b> objects. However, this can be changed by overriding
-a single method of the engine.
-<p>
-
-Every <b>DiffNode</b> describes the changes among the two or three inputs.
-<p>
-
-A tree of <b>DiffNodes</b> can be displayed in a <b>DiffTreeViewer</b>.
-The <b>DiffTreeViewer</b> requires that inner nodes of the tree implement
-the <b>IDiffContainer</b> interface and leafs the <b>IDiffElement</b> interface.
-<p>
-
-The typical steps to compare hierarchically structured data and to display
-the differences would be to:
-<ul>
-<li>
-map the input data into a tree of <b>IStructureComparator</b> and <b>IStreamContentAccessor</b>s,</li>
-
-<li>
-perform the compare operation by means of the <b>Differencer</b>, and</li>
-
-<li>
-feed the differencing result into the <b>DiffTreeViewer</b>.</li>
-
-</ul>
-
-The <b>StructureDiffViewer</b> is a specialized <b>DiffTreeViewer</b>
-that automates the three steps from above. It takes a single input object
-of type <b>ICompareInput</b> from which it retrieves the two or three
-input elements to compare. Then it uses a <b>IStructureCreator</b> to
-extract a tree of <b>IStructureComparator</b> and <b>IStreamContentAccessor</b>
-from them. These trees are then compared with the differencing engine and
-the result is displayed in the tree viewer.
-<p>
-
-
-
-</body>
-</html>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif
deleted file mode 100644
index 0088c97c8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif
deleted file mode 100644
index 6c83c45d9..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif
deleted file mode 100644
index a3a444adf..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif
deleted file mode 100644
index 706dc020e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif
deleted file mode 100644
index b95e26a1b..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gif
deleted file mode 100644
index 8392f3345..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gif
deleted file mode 100644
index 9b278e6fa..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif
deleted file mode 100644
index c2a47b6a2..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif
deleted file mode 100644
index 3aabbce51..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif
deleted file mode 100644
index 2045daedd..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif
deleted file mode 100644
index ecde52ea8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif
deleted file mode 100644
index 097ecdda5..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gif
deleted file mode 100644
index 41800a0c9..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif
deleted file mode 100644
index 6e00deec9..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif
deleted file mode 100644
index cb11ac9f9..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif
deleted file mode 100644
index 202b04139..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif
deleted file mode 100644
index 4e9a3eb98..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif
deleted file mode 100644
index e84103f40..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gif
deleted file mode 100644
index 6cbeced26..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif
deleted file mode 100644
index a3441a062..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif
deleted file mode 100644
index 6f55d908b..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif
deleted file mode 100644
index 2a8541ca8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif
deleted file mode 100644
index ecab86455..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif
deleted file mode 100644
index c76fcc707..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif
deleted file mode 100644
index 55147cc33..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif
deleted file mode 100644
index 3ce77c8d3..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif
deleted file mode 100644
index d9f5900b6..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif
deleted file mode 100644
index 61289f18f..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif
deleted file mode 100644
index 4fdde615d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif
deleted file mode 100644
index feb14bf53..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gif
deleted file mode 100644
index 03b7af342..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gif
deleted file mode 100644
index dd65c5235..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif
deleted file mode 100644
index e0a262e03..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif
deleted file mode 100644
index 3e45390ef..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif
deleted file mode 100644
index 4c2532296..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gif
deleted file mode 100644
index b4451ec5e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif
deleted file mode 100644
index f816c9e43..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gif
deleted file mode 100644
index 1030b6efc..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gif
deleted file mode 100644
index 96aae05cb..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gif
deleted file mode 100644
index d1e679e38..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gif
deleted file mode 100644
index 2a8115602..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gif
deleted file mode 100644
index 67b25c457..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif
deleted file mode 100644
index e049755f2..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif
deleted file mode 100644
index 020fc5438..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif
deleted file mode 100644
index 39ed5115e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gif
deleted file mode 100644
index 675c20fcc..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gif
deleted file mode 100644
index 95e4db64f..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif
deleted file mode 100644
index 0dc3ea89a..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif
deleted file mode 100644
index f719405c9..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gif
deleted file mode 100644
index 3e107d24d..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif
deleted file mode 100644
index 780da9881..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif
deleted file mode 100644
index 4f6a3168e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif
deleted file mode 100644
index ab4898167..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif
deleted file mode 100644
index 14ba0119b..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif
deleted file mode 100644
index 0aca3c482..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif
deleted file mode 100644
index c37753736..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif
deleted file mode 100644
index 11c2d5de0..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif
deleted file mode 100644
index 704d70694..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif
deleted file mode 100644
index 95ec3012e..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif
deleted file mode 100644
index 61a3349f2..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/wizban/applypatch_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
deleted file mode 100644
index 10dcadb36..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
+++ /dev/null
@@ -1,199 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-#
-# Resource strings for Compare Plug-in
-#
-pluginName= Compare Support
-providerName=Eclipse.org
-
-#
-# Extension point names
-#
-structureCreators= Structure Creator
-structureMergeViewers= Structure Merge Viewer
-contentMergeViewers= Content Merge Viewer
-contentViewers= Content Viewer
-
-#
-# CompareUIPlugin
-#
-CompareUIPlugin.dialogTitle=Compare
-CompareUIPlugin.noActiveWorkbenchPage=Can't find active workbench page
-CompareUIPlugin.compareFailed=Compare Failed
-CompareUIPlugin.openEditorError=Problems Opening Editor
-CompareUIPlugin.noDifferences=There are no differences between the selected inputs.
-
-#
-# Compare Editor
-#
-defaultCompareEditor.name= Default Compare Editor
-CompareEditor.saveError.title= Save Error
-CompareEditor.cantSaveError= Can''t save contents ({0})
-CompareEditor.invalidInput=Invalid input: not a CompareEditorInput
-CompareEditor.error.setinput.title=Problem while opening
-CompareEditor.error.setinput.message=Cannot open input:
-
-#
-# Commands
-#
-compareCategory.name= Compare
-compareCategory.description= Compare command category
-
-Command.copyRightToLeft.name= Copy from Right to Left
-Command.copyRightToLeft.description= Copy Current Change from Right to Left
-
-Command.copyLeftToRight.name= Copy from Left to Right
-Command.copyLeftToRight.description= Copy Current Change from Left to Right
-
-Command.copyAllRightToLeft.name= Copy All from Right to Left
-Command.copyAllRightToLeft.description= Copy All Changes from Right to Left
-
-Command.copyAllLeftToRight.name= Copy All from Left to Right
-Command.copyAllLeftToRight.description= Copy All Change from Left to Right
-
-Command.selectNextChange.name= Select Next Change
-Command.selectNextChange.description= Select Next Change
-
-Command.selectPreviousChange.name= Select Previous Change
-Command.selectPreviousChange.description= Select Previous Change
-
-
-#
-# Context menu & actions
-#
-CompareWithMenu.label= Comp&are With
-
-CompareWithEachOtherAction.label= &Each Other
-CompareWithEachOtherAction.tooltip= Compare the Selected Resources
-
-TeamMenu.label= T&eam
-
-CompareWithPatchAction.label= &Apply Patch...
-CompareWithPatchAction.tooltip= Apply a Patch to the Selected Resources
-
-CompareWithHistoryAction.label= &Local History...
-CompareWithHistoryAction.tooltip= Compare the Selected Resource with Local History
-
-ReplaceWithMenu.label= Rep&lace With
-
-ReplaceFromHistoryAction.label= &Local History...
-ReplaceFromHistoryAction.tooltip= Replace the Selected Resource with Local History
-
-ReplaceWithPreviousFromHistoryAction.label= &Previous from Local History
-ReplaceWithPreviousFromHistoryAction.tooltip= Replace the Selected Resource with the Previous from Local History
-
-addFromHistoryAction.label= Restore from Local Histor&y...
-addFromHistoryAction.tooltip= Restore Deleted Files from Local History
-
-#
-# Preference Page
-#
-ComparePreferencePage.name= Compare/Patch
-
-ComparePreferencePage.generalTab.label= &General
-
-ComparePreferencePage.structureCompare.label= &Open structure compare automatically
-ComparePreferencePage.showMoreInfo.label= &Show additional compare information in the status line
-ComparePreferencePage.ignoreWhitespace.label= Ignore &white space
-ComparePreferencePage.saveBeforePatching.label= A&utomatically save dirty editors before patching
-
-ComparePreferencePage.filter.description= Enter member names that should be excluded from 'Compare With Each Other'.\nList is comma separated (e.g. '*.class, .project, bin/')
-ComparePreferencePage.filter.label= &Filtered Members:
-ComparePreferencePage.filter.invalidsegment.error= Filter is invalid: {0}
-
-ComparePreferencePage.textCompareTab.label= &Text Compare
-
-ComparePreferencePage.initiallyShowAncestorPane.label= Initially show a&ncestor pane
-ComparePreferencePage.showPseudoConflicts.label= Show &pseudo conflicts
-ComparePreferencePage.synchronizeScrolling.label= Synchronize &scrolling between panes in compare viewers
-ComparePreferencePage.useSingleLine.label= Connect &ranges with single line
-
-ComparePreferencePage.preview.label= Preview:
-ComparePreferencePage.ancestor.label= Common Ancestor
-ComparePreferencePage.left.label= Local
-ComparePreferencePage.right.label= Remote
-ComparePreferencePage.backgroundColor1.label= Bac&kground Color:
-ComparePreferencePage.backgroundColor2.label= S&ystem Default
-ComparePreferencePage.backgroundColor3.label= C&ustom
-
-# Compare editor contents for Compare preview page
-ComparePreferencePage.previewAncestor= 1\n2\n3\nconflict\n4\n5
-ComparePreferencePage.previewLeft= 1\n2\noutgoing addition\n3\noutgoing change\n4\npseudo conflict\n5
-ComparePreferencePage.previewRight= 1\nincoming addition\nincoming addition\n2\n3\nincoming change\n4\npseudo conflict\n5
-
-compareFontDefiniton.label= Compare Text Font
-compareFontDefiniton.description= The compare text font is used by textual compare/merge editors.
-
-# New UI
-#ComparePreferencePage.useSplines.label= Use splines in center panel
-#ComparePreferencePage.useResolveUI.label= Use new resolve UI
-
-CompareEditorInput.defaultTitle= Compare
-
-#
-# Toolbar actions
-#
-action.IgnoreWhiteSpace.label=Ignore White Space
-action.IgnoreWhiteSpace.tooltip=Ignore White Space Where Applicable
-action.IgnoreWhiteSpace.image=etool16/ignorews_edit.gif
-
-action.Next.label=Next Difference
-action.Next.tooltip=Go to Next Difference
-action.Next.image=elcl16/next_nav.gif
-
-action.Previous.label=Previous Difference
-action.Previous.tooltip=Go to Previous Difference
-action.Previous.image=elcl16/prev_nav.gif
-
-#
-# Built in Structure Creators
-#
-ZipStructureCreator.name=Zip Archive Compare
-
-#
-# Compare Dialog
-#
-CompareDialog.commitAction.label=Commit
-CompareDialog.saveErrorTitle=Save Error
-CompareDialog.saveErrorMessage=Can't save
-
-#
-# Compare With Each Other
-#
-ResourceCompare.taskName=Operation in Progress...
-ResourceCompare.twoWay.title=Compare ({0}-{1})
-ResourceCompare.twoWay.tooltip={0}-{1}
-ResourceCompare.threeWay.title=Compare ({0}-{1}-{2})
-ResourceCompare.threeWay.tooltip={1}-{2}
-
-#
-# DiffTreeViewer & DiffNodes
-#
-DiffTreeViewer.title= Structure Compare
-DiffNode.noName= <no name>
-DiffNode.nameFormat= {0} / {1}
-
-#
-# Differencing engine
-#
-Differencer.progressFormat= Comparing {0}
-
-#
-# Patch: rejected patch markers
-#
-rejectedPatchMarker.name= Rejected Patch
-
-#
-# ValidateEdit
-#
-ValidateEdit.error.unable_to_perform= Operation can\'t be performed.
-ValidateEdit.error.fileModified= File ''{0}'' has been modified since the beginning of the operation.
-ValidateEdit.error.stillReadonly= File ''{0}'' is readonly.
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
deleted file mode 100644
index 622776501..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
+++ /dev/null
@@ -1,302 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.compare"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.compare.internal.CompareUIPlugin">
-
- <runtime>
- <library name="compare.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.compare"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.ui.views"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- </requires>
-
-
-<!-- Compare extension point definitions -->
- <extension-point id="structureCreators" name="%structureCreators" schema="schema/structureCreators.exsd"/>
- <extension-point id="structureMergeViewers" name="%structureMergeViewers" schema="schema/structureMergeViewers.exsd"/>
- <extension-point id="contentMergeViewers" name="%contentMergeViewers" schema="schema/contentMergeViewers.exsd"/>
- <extension-point id="contentViewers" name="%contentViewers" schema="schema/contentViewers.exsd"/>
-
-<!-- Extensions -->
- <extension
- point="org.eclipse.ui.fontDefinitions">
- <fontDefinition
- label="%compareFontDefiniton.label"
- defaultsTo="org.eclipse.jface.textfont"
- id="org.eclipse.compare.contentmergeviewer.TextMergeViewer">
- <description>
- %compareFontDefiniton.description
- </description>
- </fontDefinition>
- </extension>
- <extension
- id="rejectedPatchMarker"
- name="%rejectedPatchMarker.name"
- point="org.eclipse.core.resources.markers">
- <super
- type="org.eclipse.core.resources.taskmarker">
- </super>
- <persistent
- value="true">
- </persistent>
- </extension>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="%defaultCompareEditor.name"
- icon="icons/full/cview16/compare_view.gif"
- contributorClass="org.eclipse.compare.internal.CompareEditorContributor"
- class="org.eclipse.compare.internal.CompareEditor"
- id="org.eclipse.compare.CompareEditor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%ComparePreferencePage.name"
- category="org.eclipse.ui.preferencePages.Workbench"
- class="org.eclipse.compare.internal.ComparePreferencePage"
- id="org.eclipse.compare.internal.ComparePreferencePage">
- </page>
- </extension>
-<!-- commands and their bindings -->
- <extension
- point="org.eclipse.ui.commands">
- <category
- name="%compareCategory.name"
- description="%compareCategory.description"
- id="org.eclipse.compare.ui.category.compare">
- </category>
- <command
- name="%Command.copyRightToLeft.name"
- description="%Command.copyRightToLeft.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyRightToLeft">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyRightToLeft"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.copyLeftToRight.name"
- description="%Command.copyLeftToRight.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyLeftToRight">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyLeftToRight"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.copyAllRightToLeft.name"
- description="%Command.copyAllRightToLeft.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyAllRightToLeft">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyAllRightToLeft"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.copyAllLeftToRight.name"
- description="%Command.copyAllLeftToRight.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.copyAllLeftToRight">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.copyAllLeftToRight"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.selectNextChange.name"
- description="%Command.selectNextChange.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.selectNextChange">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.selectNextChange"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
- name="%Command.selectPreviousChange.name"
- description="%Command.selectPreviousChange.description"
- category="org.eclipse.compare.ui.category.compare"
- id="org.eclipse.compare.selectPreviousChange">
- </command>
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.compare.selectPreviousChange"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- id="org.eclipse.compare.CompareAction">
- <menu
- label="%ReplaceWithMenu.label"
- path="additions"
- id="replaceWithMenu">
- <separator
- name="replaceWithGroup">
- </separator>
- </menu>
- <menu
- label="%CompareWithMenu.label"
- path="additions"
- id="compareWithMenu">
- <separator
- name="compareWithGroup">
- </separator>
- </menu>
- <menu
- label="%TeamMenu.label"
- path="additions"
- id="team.main">
- <separator
- name="group1">
- </separator>
- </menu>
- <action
- label="%CompareWithEachOtherAction.label"
- tooltip="%CompareWithEachOtherAction.tooltip"
- class="org.eclipse.compare.internal.CompareAction"
- menubarPath="compareWithMenu/compareWithGroup"
- enablesFor="2+"
- id="compareWithEachOther">
- </action>
- <action
- label="%CompareWithPatchAction.label"
- tooltip="%CompareWithPatchAction.tooltip"
- class="org.eclipse.compare.internal.patch.CompareWithPatchAction"
- menubarPath="team.main/group1"
- enablesFor="1"
- id="compareWithPatch">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true"
- id="org.eclipse.compare.ReplaceWithEditionAction">
- <menu
- label="%ReplaceWithMenu.label"
- path="additions"
- id="replaceWithMenu">
- <separator
- name="replaceWithGroup">
- </separator>
- </menu>
- <action
- label="%ReplaceFromHistoryAction.label"
- tooltip="%ReplaceFromHistoryAction.tooltip"
- class="org.eclipse.compare.internal.ReplaceWithEditionAction"
- menubarPath="replaceWithMenu/replaceWithGroup"
- enablesFor="1"
- id="replaceFromHistory">
- </action>
- <action
- label="%ReplaceWithPreviousFromHistoryAction.label"
- tooltip="%ReplaceWithPreviousFromHistoryAction.tooltip"
- class="org.eclipse.compare.internal.ReplaceWithPreviousEditionAction"
- menubarPath="replaceWithMenu/replaceWithGroup"
- enablesFor="1"
- id="replaceWithPreviousFromHistory">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true"
- id="org.eclipse.compare.CompareWithEditionAction">
- <menu
- label="%CompareWithMenu.label"
- path="additions"
- id="compareWithMenu">
- <separator
- name="compareWithGroup">
- </separator>
- </menu>
- <action
- label="%CompareWithHistoryAction.label"
- tooltip="%CompareWithHistoryAction.tooltip"
- class="org.eclipse.compare.internal.CompareWithEditionAction"
- menubarPath="compareWithMenu/compareWithGroup"
- enablesFor="1"
- id="compareWithHistory">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IContainer"
- adaptable="true"
- id="org.eclipse.compare.AddFromHistoryAction">
- <action
- label="%addFromHistoryAction.label"
- tooltip="%addFromHistoryAction.tooltip"
- class="org.eclipse.compare.internal.AddFromHistoryAction"
- menubarPath="replaceWithMenu"
- enablesFor="1"
- id="addFromHistoryAction">
- </action>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.compare.structureCreators">
- <structureCreator
- extensions="zip"
- class="org.eclipse.compare.ZipFileStructureCreator"
- id="org.eclipse.compare.ZipFileStructureCreator">
- </structureCreator>
- </extension>
- <extension
- point="org.eclipse.compare.contentMergeViewers">
- <viewer
- extensions="class,exe,dll,binary,zip,jar"
- class="org.eclipse.compare.internal.BinaryCompareViewerCreator"
- id="org.eclipse.compare.BinaryCompareViewerCreator">
- </viewer>
- <viewer
- extensions="txt"
- class="org.eclipse.compare.internal.TextMergeViewerCreator"
- id="org.eclipse.compare.TextMergeViewerCreator">
- </viewer>
- <viewer
- extensions="gif,jpg"
- class="org.eclipse.compare.internal.ImageMergeViewerCreator"
- id="org.eclipse.compare.ImageMergeViewerCreator">
- </viewer>
- </extension>
- <extension
- point="org.eclipse.compare.contentViewers">
- <viewer
- extensions="txt"
- class="org.eclipse.compare.internal.TextViewerCreator"
- id="org.eclipse.compare.TextViewerCreator">
- </viewer>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd
deleted file mode 100644
index de18bd1df..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="contentMergeViewers" name="ContentMerge Viewers"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register compare/merge
-viewers for specific content types. The viewer is expected to
-extend &lt;samp&gt;org.eclipse.jface.viewers.Viewer&lt;/samp&gt;.
-However, since viewers don&apos;t have a default constructor,
-the extension point must implement the factory interface
-for viewers &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;java, gif&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a compare/merge viewer
-for text files (extension &quot;txt&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.contentMergeViewers&quot;&gt;
- &lt;viewer
- id=&quot;org.eclipse.compare.contentmergeviewer.TextMergeViewer&quot;
- class=&quot;org.eclipse.compare.internal.TextMergeViewerCreator&quot;
- extensions=&quot;txt&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines content viewers for text, binary contents, and images.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd
deleted file mode 100644
index a60291803..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="contentViewers" name="Content Viewers"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register
-viewers for specific content types.
-These viewers are used in the &lt;samp&gt;EditionSelectionDialog&lt;/samp&gt; when presenting an edition of a resource or a subsection thereof. The viewer
-is expected to extend &lt;samp&gt;org.eclipse.jface.viewers.Viewer&lt;/samp&gt;.
-However since viewers don&apos;t have a default constructor the extension point must implement the factory interface for viewers &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements a factory for the
-content merge viewer and implements
-&lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;java, gif&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a viewer for text
-files (extension &quot;txt&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.contentViewers&quot;&gt;
- &lt;viewer
- id=&quot;org.eclipse.compare.internal.TextViewer&quot;
- class=&quot;org.eclipse.compare.internal.TextViewerCreator&quot;
- extensions=&quot;txt&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines content viewers for
-text and images.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd
deleted file mode 100644
index 189463dc4..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="structureCreators" name="Structure Creators"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register a structure creator
-for specific content types. The structure creator is expected to create
-a tree of &lt;samp&gt;IStructureComparator&lt;/samp&gt;s for a given content.
-This tree is used as the input for the structural compare.
-The extension point must implement the interface &lt;samp&gt;org.eclipse.compare.structuremergeviewer.IStructureCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="structureCreator" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="structureCreator">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the structure creator
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements &lt;samp&gt;org.eclipse.compare.structuremergeviewer.IStructureCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.compare.structuremergeviewer.IStructureComparator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;java, properties&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a structure creator for
-java files (extension &quot;java&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.structureCreators&quot;&gt;
- &lt;structureCreator
- id=&quot;org.eclipse.compare.JavaStructureCreator&quot;
- class=&quot;org.eclipse.compare.JavaStructureCreator&quot;
- extensions=&quot;java&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines a structure creator for zip archives.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd
deleted file mode 100644
index 73419fdf8..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="structureMergeViewers" name="StructureMerge Viewers"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register compare/merge
-viewers for structural content types. The viewer is expected to
-extend &lt;samp&gt;org.eclipse.jface.viewers.Viewer&lt;/samp&gt;.
-However, since viewers don&apos;t have a default constructor,
-the extension point must implement the factory interface
-for viewers &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;zip, jar&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of compare/merge viewer
-for zip files (extension &quot;zip&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.structureMergeViewers&quot;&gt;
- &lt;viewer
- id=&quot;org.eclipse.compare.ZipCompareViewer&quot;
- class=&quot;org.eclipse.compare.ZipCompareViewerCreator&quot;
- extensions=&quot;zip&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines a structure compare
-viewer for zip archives.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml
deleted file mode 100644
index 1b479d4f3..000000000
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<project name="org.eclipse.compare" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.compare" />
- <property name="dest" value="${destdir}/${plugin}_3.0.0" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/compare.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- <zip zipfile="${dest}/comparesrc.zip">
- <fileset dir="compare" />
- </zip>
- </target>
-</project>
diff --git a/bundles/org.eclipse.compare/schema/contentMergeViewers.exsd b/bundles/org.eclipse.compare/schema/contentMergeViewers.exsd
deleted file mode 100644
index de18bd1df..000000000
--- a/bundles/org.eclipse.compare/schema/contentMergeViewers.exsd
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="contentMergeViewers" name="ContentMerge Viewers"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register compare/merge
-viewers for specific content types. The viewer is expected to
-extend &lt;samp&gt;org.eclipse.jface.viewers.Viewer&lt;/samp&gt;.
-However, since viewers don&apos;t have a default constructor,
-the extension point must implement the factory interface
-for viewers &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;java, gif&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a compare/merge viewer
-for text files (extension &quot;txt&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.contentMergeViewers&quot;&gt;
- &lt;viewer
- id=&quot;org.eclipse.compare.contentmergeviewer.TextMergeViewer&quot;
- class=&quot;org.eclipse.compare.internal.TextMergeViewerCreator&quot;
- extensions=&quot;txt&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines content viewers for text, binary contents, and images.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/schema/contentViewers.exsd b/bundles/org.eclipse.compare/schema/contentViewers.exsd
deleted file mode 100644
index a60291803..000000000
--- a/bundles/org.eclipse.compare/schema/contentViewers.exsd
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="contentViewers" name="Content Viewers"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register
-viewers for specific content types.
-These viewers are used in the &lt;samp&gt;EditionSelectionDialog&lt;/samp&gt; when presenting an edition of a resource or a subsection thereof. The viewer
-is expected to extend &lt;samp&gt;org.eclipse.jface.viewers.Viewer&lt;/samp&gt;.
-However since viewers don&apos;t have a default constructor the extension point must implement the factory interface for viewers &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements a factory for the
-content merge viewer and implements
-&lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;java, gif&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a viewer for text
-files (extension &quot;txt&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.contentViewers&quot;&gt;
- &lt;viewer
- id=&quot;org.eclipse.compare.internal.TextViewer&quot;
- class=&quot;org.eclipse.compare.internal.TextViewerCreator&quot;
- extensions=&quot;txt&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines content viewers for
-text and images.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/schema/structureCreators.exsd b/bundles/org.eclipse.compare/schema/structureCreators.exsd
deleted file mode 100644
index 189463dc4..000000000
--- a/bundles/org.eclipse.compare/schema/structureCreators.exsd
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="structureCreators" name="Structure Creators"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register a structure creator
-for specific content types. The structure creator is expected to create
-a tree of &lt;samp&gt;IStructureComparator&lt;/samp&gt;s for a given content.
-This tree is used as the input for the structural compare.
-The extension point must implement the interface &lt;samp&gt;org.eclipse.compare.structuremergeviewer.IStructureCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="structureCreator" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="structureCreator">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the structure creator
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements &lt;samp&gt;org.eclipse.compare.structuremergeviewer.IStructureCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.compare.structuremergeviewer.IStructureComparator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;java, properties&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a structure creator for
-java files (extension &quot;java&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.structureCreators&quot;&gt;
- &lt;structureCreator
- id=&quot;org.eclipse.compare.JavaStructureCreator&quot;
- class=&quot;org.eclipse.compare.JavaStructureCreator&quot;
- extensions=&quot;java&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines a structure creator for zip archives.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/schema/structureMergeViewers.exsd b/bundles/org.eclipse.compare/schema/structureMergeViewers.exsd
deleted file mode 100644
index 73419fdf8..000000000
--- a/bundles/org.eclipse.compare/schema/structureMergeViewers.exsd
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.compare">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.compare" id="structureMergeViewers" name="StructureMerge Viewers"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register compare/merge
-viewers for structural content types. The viewer is expected to
-extend &lt;samp&gt;org.eclipse.jface.viewers.Viewer&lt;/samp&gt;.
-However, since viewers don&apos;t have a default constructor,
-the extension point must implement the factory interface
-for viewers &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier that can be used to reference the viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- name of a class that implements &lt;samp&gt;org.eclipse.compare.IViewerCreator&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
- a comma separated list of file extensions e.g. &quot;zip, jar&quot;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of compare/merge viewer
-for zip files (extension &quot;zip&quot;):
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point = &quot;org.eclipse.compare.structureMergeViewers&quot;&gt;
- &lt;viewer
- id=&quot;org.eclipse.compare.ZipCompareViewer&quot;
- class=&quot;org.eclipse.compare.ZipCompareViewerCreator&quot;
- extensions=&quot;zip&quot;
- /&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Compare UI plugin defines a structure compare
-viewer for zip archives.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.compare/scripts/exportplugin.xml b/bundles/org.eclipse.compare/scripts/exportplugin.xml
deleted file mode 100644
index 1b479d4f3..000000000
--- a/bundles/org.eclipse.compare/scripts/exportplugin.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<project name="org.eclipse.compare" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.compare" />
- <property name="dest" value="${destdir}/${plugin}_3.0.0" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/compare.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- <zip zipfile="${dest}/comparesrc.zip">
- <fileset dir="compare" />
- </zip>
- </target>
-</project>
diff --git a/bundles/org.eclipse.team.core/.classpath b/bundles/org.eclipse.team.core/.classpath
deleted file mode 100644
index 065ac06e1..000000000
--- a/bundles/org.eclipse.team.core/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.team.core/.cvsignore b/bundles/org.eclipse.team.core/.cvsignore
deleted file mode 100644
index c5e82d745..000000000
--- a/bundles/org.eclipse.team.core/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/.options b/bundles/org.eclipse.team.core/.options
deleted file mode 100644
index c3440ea1b..000000000
--- a/bundles/org.eclipse.team.core/.options
+++ /dev/null
@@ -1,6 +0,0 @@
-# Debugging options for the org.eclipse.team.core plugin.
-
-# Turn on debugging for the plugin.
-org.eclipse.team.core/debug=false # Shows stream debugging information org.eclipse.team.core/streams=false
-org.eclipse.team.core/refreshjob=false
-org.eclipse.team.core/backgroundevents=false \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/.project b/bundles/org.eclipse.team.core/.project
deleted file mode 100644
index 693d30d67..000000000
--- a/bundles/org.eclipse.team.core/.project
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.team.core</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.team.core/about.html b/bundles/org.eclipse.team.core/about.html
deleted file mode 100644
index 9db411aab..000000000
--- a/bundles/org.eclipse.team.core/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/build.properties b/bundles/org.eclipse.team.core/build.properties
deleted file mode 100644
index 975c3f914..000000000
--- a/bundles/org.eclipse.team.core/build.properties
+++ /dev/null
@@ -1,14 +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
-###############################################################################
-# Eclipse build contribution
-bin.includes = about.html,plugin.xml,plugin.properties,*.jar,.options
-source.team.jar=src/
-src.includes=about.html,schema/
diff --git a/bundles/org.eclipse.team.core/buildnotes_team.html b/bundles/org.eclipse.team.core/buildnotes_team.html
deleted file mode 100644
index 2c2e4a7c0..000000000
--- a/bundles/org.eclipse.team.core/buildnotes_team.html
+++ /dev/null
@@ -1,529 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Eclipse Team Plugin - Build notes</title>
-<meta http-equiv="Content-Type"
-content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="http://dev.eclipse.org/default_style.css" type="text/css">
-</head>
-<body bgcolor="#ffffff" text="#000000">
-
-<table border="0" cellspacing="5" cellpadding="2" width="100%">
- <tbody>
- <tr>
- <td align="left" width="72%"> <font class="indextop"> Eclipse Team</font><br><font class="indexsub"> build notes</font></td>
- </tr>
- </tbody>
-</table>
-
-<table border="0" cellspacing="5" cellpadding="2" width="100%">
- <tbody>
- <tr><td>Here are the build notes for the <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-vcm-home/main.html">Team Plugin</a>
- which includes changes to <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.team.core/">org.eclipse.team.core</a>,
- <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.team.ui/">org.eclipse.team.ui</a>, <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.team.ftp/">org.eclipse.team.ftp</a>, <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.team.examples.filesystem/">org.eclipse.team.examples.filesystem</a>,
- <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.team.webdav/">org.eclipse.team.webdav</a>.
-</td></tr>
-
-<tr><td align="left" valign="top" colspan="2" bgcolor="#0080c0" width="100%"><b><font face="Arial,Helvetica"><font color="#ffffff">3.0 Builds</font></font></b></td>
-</tr><tr>
- <td>
- <!-- ####### START OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <h4><img src="http://dev.eclipse.org/images/Adarrow.gif" nosave="" border=0 height=16 width=16 alt="">September
- 23rd 2003 - 3.0 (I20030923)</h4>
- <h4>Interesting changes</h4>
- <ul>
- <li>More actions have been added to the view: copy/paste/rename/delete.
- <li>The Synchronize View displays a Busy Pointer icon when performing
- work in the background that affects the view.
- <li>A status bar that shows the number of conflicting/incoming/outgoing
- changes is located at the top of the Synchronize View. The numbers
- reflect both the entire changes in the workspace or when a working
- set is enabled, the changes in the working set versus those in the
- workspace. This is a hint that changes in the workspace are being
- filtered out by a working set.
- <li>Conflicts are propagated to the parent folders in the Synchronize
- View. This will make it harder to forget or miss important conflicting
- changes.
- </ul>
- <h4>Breaking API changes</h4>
- <p>None</p>
- <h4>Fixed bugs</h4>
- <p>See <a href="https://bugs.eclipse.org/bugs/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Platform&component=VCM&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfield=resolution&chfieldfrom=2003-08-29&chfieldto=Now&chfieldvalue=&cmdtype=doit&namedcmd=3.0%2BM3%2BFixed&newqueryname=&order=Reuse%2Bsame%2Bsort%2Bas%2Blast%2Btime&field0-0-0=noop&type0-0-0=noop&value0-0-0=">this</a>
- bugzilla query to list all fixed bugs in this build.</p>
- <h4><img src="http://dev.eclipse.org/images/Adarrow.gif" nosave="" border=0 height=16 width=16 alt="">September
- 9th 2003 - 3.0 (I20030909)</h4>
- <h4>Interesting changes</h4>
- <ul>
- <li>The Synchronize View now supports stepping through all differences in step with the compare editor. You can use the
- next/previous arrows to browse all changes.
- </ul>
- <h4>Breaking API changes</h4>
- <p>None</p>
- <h4>Fixed bugs</h4>
- <p>See <a href="https://bugs.eclipse.org/bugs/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Platform&component=VCM&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfield=resolution&chfieldfrom=2003-08-29&chfieldto=Now&chfieldvalue=&cmdtype=doit&namedcmd=3.0%2BM3%2BFixed&newqueryname=&order=Reuse%2Bsame%2Bsort%2Bas%2Blast%2Btime&field0-0-0=noop&type0-0-0=noop&value0-0-0=">this</a>
- bugzilla query to list all fixed bugs in this build.</p>
- <!-- ####### END OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <!-- ####### START OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <h4><img src="http://dev.eclipse.org/images/Adarrow.gif" nosave="" border=0 height=16 width=16 alt="">
- August 26th 2003 - 3.0 (I20030819)</h4>
- <h4>Interesting changes</h4>
- <ul>
- <li>The mode filters in the Synchronize View are saved as user preferences and the preference to use incoming/outgoing mode has been removed.</li>
- </ul>
- <h4>Breaking API changes</h4>
- <p>None</p>
- <h4>Fixed bugs (? fixed)</h4>
- <p>See <a href="https://bugs.eclipse.org/bugs/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Platform&component=VCM&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfield=resolution&chfieldfrom=2003-08-19&chfieldto=Now&chfieldvalue=&cmdtype=doit&namedcmd=3.0%2BM3%2BFixed&newqueryname=&order=Reuse%2Bsame%2Bsort%2Bas%2Blast%2Btime&field0-0-0=noop&type0-0-0=noop&value0-0-0=">this</a>
- bugzilla query to list all fixed bugs in this build.</p>
- <!-- ####### END OF 3.0 BUILD SUBMISSIONS BLOCK --><strong></strong>
- <!-- ####### START OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <h4><img src="http://dev.eclipse.org/images/Adarrow.gif" nosave="" border=0 height=16 width=16 alt="">
- August 19th 2003 - 3.0 (I20030819)</h4>
- <h4>Interesting changes</h4>
- <ul>
- <li>We have received new Synchronize View action icons.</li>
- <li>Cancellation support in the stream classes can be configured. This is to allow certain communications (e.g. logins) to not be interrupted.</li>
- <li>Fixed a couple of bugs with SyncSets not being concurrent safe.</li>
- </ul>
- <h4>Breaking API changes</h4>
- <p>None</p>
- <h4>Fixed bugs (7 fixed)</h4>
- <p>See <a href="https://bugs.eclipse.org/bugs/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Platform&component=VCM&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfield=resolution&chfieldfrom=2003-08-07&chfieldto=Now&chfieldvalue=&cmdtype=doit&namedcmd=3.0%2BM3%2BFixed&newqueryname=&order=Reuse%2Bsame%2Bsort%2Bas%2Blast%2Btime&field0-0-0=noop&type0-0-0=noop&value0-0-0=">this</a>
- bugzilla query to list all fixed bugs in this build.</p>
- <!-- ####### END OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <!-- ####### START OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <h4><img src="http://dev.eclipse.org/images/Adarrow.gif" nosave="" border=0 height=16 width=16 alt="">
- August 6th 2003 - 3.0 (I20030806)</h4>
- <h4>Interesting changes</h4>
- <ul>
- <li>The new Synchronize View now calculates all changes in a separate
- thread. This improves startup times and provides better responsiveness
- when synchronizing resources.</li>
- <li>The Synchronize View API is starting to take shape. For an advanced
- preview look at the <strong>org.eclipse.team.core.subscribers</strong>
- and <strong>org.eclipse.team.ui.sync </strong>packages.</li>
- <li>A Team Synchronize perspective has been created and is the default
- when synchronizing. This can be configured via the Synchronize View
- preferences. </li>
- </ul>
- <h4>Breaking API changes</h4>
- <p>None</p>
- <h4>Fixed bugs (27 fixed)</h4>
- <p>See <a href="https://bugs.eclipse.org/bugs/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Platform&component=VCM&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfield=resolution&chfieldfrom=2003-07-18&chfieldto=Now&chfieldvalue=&cmdtype=doit&namedcmd=3.0%2BM3%2BFixed&newqueryname=&order=Reuse%2Bsame%2Bsort%2Bas%2Blast%2Btime&field0-0-0=noop&type0-0-0=noop&value0-0-0=">this</a>
- bugzilla query to list all fixed bugs in this build.</p>
- <!-- ####### END OF 3.0 BUILD SUBMISSIONS BLOCK -->
- <br>
- <br>
- </td>
- </tr>
-
-<tr><td align="left" valign="top" colspan="2" bgcolor="#0080c0" width="100%"><b><font face="Arial,Helvetica"><font color="#ffffff">
-Archive for 2.0 and 2.1 Builds</font></font></b></td>
-</tr><tr><td>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-<p class="MsoNormal">Team build I20020909 &#8211; September 9, 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020910</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">The ability to export/import target sites has been added along
-with properties pages for target sites and deployed projects.</p>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-<p class="MsoNormal">Team build I20020517 &#8211; May 17 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020517</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">This build introduces Target Management support. Target
-management consists of a set of core API, in combination with one or more
-target providers. Initially, we are providing a WebDAV target provider in
-the plug-in org.eclipse.team.webdav. Target management operations appear
-in the navigator under the "Deploy" sub-menu.</p>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020430 &#8211; April 30 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020430</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">No major changes</p>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020423 &#8211; April 23 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020423</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">Initial release of team project set support. There is
- now an import and export wizard that allows one to create a file containing
- a list (and location) of team shared projects. This file may be imported
-into another workspace, re-creating the entire set of projects.</p>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style=""> </h1>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020418 &#8211; April 18 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020418</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">No significant changes to the core Team support in this
- build.</p>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020409 &#8211; April 9 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020409</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">No significant changes to the core Team support in this
- build.</p>
- <br>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020402 &#8211; April 2 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020402</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal">Team plug-ins are now turned <b>on</b> by default. The
- old VCM plug-ins are still included in the build but are turned off.<br>
- The global ignore and text/binary APIs have changed substantially. The
- facilities are now provided as static methods on the class org.eclipse.team.core.Team.
- See that class's Javadoc for more details.<br>
- <br>
- </p>
-
-<p class="MsoNormal"><br>
- </p>
-
-<div class="Section1">
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020312 &#8211; March 12 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020312</p>
-
-<h2>What's new in this build</h2>
-
-<p class="MsoNormal"></p>
-
-<p class="MsoNormal">Team plug-ins are now turned <b>on</b> by default. The
- old VCM plug-ins are still included in the build but are turned off.</p>
-
-<p class="MsoNormal"><br>
- The Decorations extension point has been removed from org.eclipse.team.ui.
- Please use the generic workbench decoration facility in the future.<br>
- </p>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020305 &#8211; March 5 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020305</p>
-
-<h2>What's new in this drop</h2>
-
-<p class="MsoNormal">No changes to the core team support in this drop.</p>
-
-<p class="MsoNormal"><br>
- All Team plug-ins are turned off by default. If you wish to use Team
- support,</p>
-
-<ol style="margin-top: 0in;" start="1" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.core/plugin.xml.off
- to plugins/org.eclipse.team.core/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off
- to plugins/org.eclipse.team.cvs.core/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ssh/plugin.xml&nbsp;</li>
-
-</ol>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020226 &#8211; February 26, 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020226</p>
-
-<h2>What's new in this drop</h2>
-
-<p class="MsoNormal"></p>
-
-<p class="MsoNormal"></p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
-
-<p class="MsoNormal">No changes in this drop.</p>
-
-<p class="MsoNormal"><br>
- All Team plug-ins are turned off by default. If you wish to use Team
- support,</p>
-
-<ol style="margin-top: 0in;" start="1" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.core/plugin.xml.off
- to plugins/org.eclipse.team.core/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off
- to plugins/org.eclipse.team.cvs.core/plugin.xml&nbsp;</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ssh/plugin.xml&nbsp;</li>
-
-</ol>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build I20020214 &#8211; February 14, 2002<o:p></o:p></p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020214<o:p></o:p></p>
-
-<h2>What's new in this drop<o:p></o:p></h2>
-
-<p class="MsoNormal">Bug fixes:<o:p></o:p></p>
-
-<p class="MsoNormal">Change in semantics to validateEdit (9802)<o:p></o:p></p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">All Team plug-ins are turned off by default. If you
-wish to use Team support,<o:p></o:p></p>
-
-<ol style="margin-top: 0in;" start="1" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml <o:p></o:p></li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml <o:p></o:p></li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.core/plugin.xml.off
- to plugins/org.eclipse.team.core/plugin.xml <o:p></o:p></li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off
- to plugins/org.eclipse.team.cvs.core/plugin.xml <o:p></o:p></li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ssh/plugin.xml <o:p></o:p></li>
-
-</ol>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build V2_0_6 &#8211; February 12, 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020212</p>
-
-<h2>What's new in this drop</h2>
-
-<p class="MsoNormal">48 bugs fixed.</p>
-
-<p class="MsoNormal">Global ignore facility added to the core team support.</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">All Team plug-ins are turned off by default. If you
-wish to use Team support,</p>
-
-<ol style="margin-top: 0in;" start="6" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.core/plugin.xml.off
- to plugins/org.eclipse.team.core/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off
- to plugins/org.eclipse.team.cvs.core/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ssh/plugin.xml</li>
-
-</ol>
-
-<p class="MsoNormal" style="margin-left: 0.25in;"><!--[if !supportEmptyParas]-->
- &nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Please report any problems to the VCM team, and use
-the VCM component for bug tracking.</p>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build V2_0_5 &#8211; February 5, 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020205</p>
-
-<h2>What's new in this drop</h2>
-
-<p class="MsoNormal">41 bugs fixed.</p>
-
-<p class="MsoNormal">CVS operations move from the CVS submenu to the Team
- submenu.</p>
-
-<p class="MsoNormal">Proper plugin.xml files will be included with this build.</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">All Team plug-ins are turned off by default. If you
-wish to use Team support,</p>
-
-<ol style="margin-top: 0in;" start="11" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.core/plugin.xml.off
- to plugins/org.eclipse.team.core/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off
- to plugins/org.eclipse.team.cvs.core/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ssh/plugin.xml</li>
-
-</ol>
-
-<p class="MsoNormal" style="margin-left: 0.25in;"><!--[if !supportEmptyParas]-->
- &nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Please report any problems to the VCM team, and use
-the VCM component for bug tracking.</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Run <a
- href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;resolution=FIXED&amp;email1=&amp;emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;emailtype2=substring&amp;emailreporter2=1&amp;bugidtype=include&amp;bug_id=&amp;changedin=&amp;votes=&amp;chfield=bug_status&amp;chfieldfr%20">
- this</a> query to determine which bugs have been fixed since January
- 29<sup> th</sup>. If you wish to narrow the search, edit the query and
- change the dates.</p>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build V2_0_4 &#8211; January 29, 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020129</p>
-
-<h2>What's new in this drop</h2>
-
-<p class="MsoNormal">Merge support has been added</p>
-
-<p class="MsoNormal">Numerous bug fixes</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">All Team plug-ins are turned off by default. If you
-wish to use Team support,</p>
-
-<ol style="margin-top: 0in;" start="16" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.core/plugin.xml.off
- to plugins/org.eclipse.team.core/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off
- to plugins/org.eclipse.team.cvs.core/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ssh/plugin.xml</li>
-
-</ol>
-
-<p class="MsoNormal" style="margin-left: 0.25in;"><!--[if !supportEmptyParas]-->
- &nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Please report any problems to the VCM team, and use
-the VCM component for bug tracking.</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Run <a
- href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;resolution=FIXED&amp;priority=P1&amp;priority=P2&amp;priority=P3&amp;priority=P4&amp;email1=&amp;emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;emailtype2=substring&amp;emailreporter2=1&amp;bugidtype=include&amp;bug_id%20">
- this</a> query to determine which bugs have been fixed since January
- 15<sup> th</sup>. If you wish to narrow the search, edit the query and
- change the dates.</p>
-
-<h1 style="">Eclipse Platform Build Notes &#8211; Team Support</h1>
-
-<p class="MsoNormal">Team build V2_0_2 &#8211; January 15, 2002</p>
-
-<p class="MsoNormal">Build submission for Integration Build 20020115</p>
-
-<h2>What's new in this drop</h2>
-
-<p class="MsoNormal">This is the initial release for the Team support plug-ins.
- Team support is intended to be an eventual replacement for the VCM codebase.</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">The plug-ins are turned off by default. If you wish
-to use Team support,</p>
-
-<ol style="margin-top: 0in;" start="21" type="1">
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.ui/plugin.xml.off
- to plugins/org.eclipse.team.ui/plugin.xml</li>
- <li class="MsoNormal" style=""> Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off
- to plugins/org.eclipse.team.cvs.ui/plugin.xml</li>
-
-</ol>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Please report any problems to the VCM team, and use
-the VCM component for bug tracking.</p>
-
-<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
-
-<p class="MsoNormal">Run <a
- href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;resolution=FIXED&amp;priority=P1&amp;priority=P2&amp;priority=P3&amp;priority=P4&amp;email1=&amp;emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;emailtype2=substring&amp;emailreporter2=1&amp;bugi%20">
- this</a> query to determine which bugs have been fixed since January
- 7<sup> th</sup>. If you wish to narrow the search, edit the query and
- change the dates.</p>
-
-<h1 style=""><!--[if !supportEmptyParas]--> &nbsp;<!--[endif]--><o:p></o:p></h1>
- </div>
-
-</td>
-</tr>
- </tbody>
-</table>
-</body>
-</html>
diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties
deleted file mode 100644
index 2f89eff07..000000000
--- a/bundles/org.eclipse.team.core/plugin.properties
+++ /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
-###############################################################################
-pluginName=Team Support Core
-providerName=Eclipse.org
-FileTypesRegistry=File Types Registry
-GlobalIgnoreRegistry=Global Ignore Registry
-TeamProjectSets=Team Project Sets
-Targets=Target Provider and Location Factories
-Repository=Repository Providers
-Deployment=Deployment Providers \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
deleted file mode 100644
index bcde56282..000000000
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.team.core"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.team.internal.core.TeamPlugin">
-
- <runtime>
- <library name="team.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.team.core, org.eclipse.team.internal.core"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- </requires>
-
-
- <extension-point id="fileTypes" name="%FileTypesRegistry" schema="schema/fileTypes.exsd"/>
- <extension-point id="ignore" name="%GlobalIgnoreRegistry" schema="schema/ignore.exsd"/>
- <extension-point id="projectSets" name="%TeamProjectSets" schema="schema/projectSets.exsd"/>
- <extension-point id="repository" name="%Repository" schema="schema/repository.exsd"/>
- <extension-point id="deployment" name="%Deployment" schema="schema/deployment.exsd"/>
- <extension-point id="subscriber" name="%Subscriber"/>
-
-<!-- Define common known file types -->
- <extension
- point="org.eclipse.team.core.fileTypes">
- <fileTypes
- type="text"
- extension="txt">
- </fileTypes>
- <fileTypes
- type="text"
- extension="properties">
- </fileTypes>
- <fileTypes
- type="text"
- extension="xml">
- </fileTypes>
- <fileTypes
- type="text"
- extension="xsl">
- </fileTypes>
- <fileTypes
- type="text"
- extension="html">
- </fileTypes>
- <fileTypes
- type="text"
- extension="htm">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="jpg">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="jpeg">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="gif">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="png">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="ico">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="bmp">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="tif">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="tiff">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="doc">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="xls">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="pdf">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="ppt">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="zip">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="exe">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="dll">
- </fileTypes>
- <fileTypes
- type="binary"
- extension="so">
- </fileTypes>
- <fileTypes
- type="text"
- extension="project">
- </fileTypes>
- <fileTypes
- type="text"
- extension="options">
- </fileTypes>
- <fileTypes
- type="text"
- extension="emsd">
- </fileTypes>
- <fileTypes
- type="text"
- extension="mxsd">
- </fileTypes>
- </extension>
- <extension
- id="FileValidator"
- point="org.eclipse.core.resources.fileModificationValidator">
- <fileModificationValidator
- class="org.eclipse.team.internal.core.FileModificationValidatorManager">
- </fileModificationValidator>
- </extension>
- <extension
- id="MoveDeleteHook"
- point="org.eclipse.core.resources.moveDeleteHook">
- <moveDeleteHook
- class="org.eclipse.team.internal.core.MoveDeleteManager">
- </moveDeleteHook>
- </extension>
- <extension
- id="TeamHook"
- point="org.eclipse.core.resources.teamHook">
- <teamHook
- class="org.eclipse.team.internal.core.TeamHookDispatcher">
- </teamHook>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.team.core/schema/fileTypes.exsd b/bundles/org.eclipse.team.core/schema/fileTypes.exsd
deleted file mode 100644
index 317418148..000000000
--- a/bundles/org.eclipse.team.core/schema/fileTypes.exsd
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.core" id="fileTypes" name="File Types"/>
- </appInfo>
- <documentation>
- This extension point is used to register information about whether particular file types should be considered to contain text or binary data.
-This information is important to some repository providers as it affects how the data is stored, compared and transmitted.
-&lt;p&gt;
-Providers may provide an extension for this extension point. No code beyond the XML extension declaration is required.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="fileTypes" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="fileTypes">
- <complexType>
- <attribute name="extension" type="string" use="required">
- <annotation>
- <documentation>
- the file extension being identified by this contribution.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- one of either &quot;text&quot; or &quot;binary&quot;, identifying the contents of files matching the value of extension.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of a fileTypes extension:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.team.core.fileTypes&quot;&gt;
- &lt;fileTypes extension=&quot;txt&quot; type=&quot;text&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2002 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.core/schema/ignore.exsd b/bundles/org.eclipse.team.core/schema/ignore.exsd
deleted file mode 100644
index a8bc4732a..000000000
--- a/bundles/org.eclipse.team.core/schema/ignore.exsd
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.core" id="ignore" name="Ignore"/>
- </appInfo>
- <documentation>
- This extension point is used to register information about whether particular resources should be ignored;
-that is, excluded from version configuration management operations.
-Providers may provide an extension for this extension point. No code beyond the XML extension declaration is required.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="ignore" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="ignore">
- <complexType>
- <attribute name="pattern" type="string" use="required">
- <annotation>
- <documentation>
- the pattern against which resources will be compared.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="enabled" type="boolean" use="required">
- <annotation>
- <documentation>
- one of &quot;true&quot; or &quot;false&quot;, determines whether this ignore pattern is enabled.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of an ignore extension:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.team.core.ignore&quot;&gt;
- &lt;ignore pattern=&quot;*.class&quot; enabled=&quot;true&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2002 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.core/schema/projectSets.exsd b/bundles/org.eclipse.team.core/schema/projectSets.exsd
deleted file mode 100644
index a4b6c51aa..000000000
--- a/bundles/org.eclipse.team.core/schema/projectSets.exsd
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.core" id="projectSets" name="Project Sets"/>
- </appInfo>
- <documentation>
- This extension point is used to register a handler for creating and reading project sets.
-Project sets are lightweight, portable method of sharing a particular lineup of team-shared projects in a workspace.
-A project set file may be used to provide team memebers with a simple way of creating a workspace with a particular lineup of projects form one or more team providers.
-&lt;p&gt;
-Providers may provide an extension for this extension point.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="projectSets" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="projectSets">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- the nature id of the provider for which this handler creates and reads project sets.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the fully qualified name of a class implementing &lt;samp&gt;org.eclipse.team.core.IProjectSerializer&lt;/samp&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.team.core.IProjectSetSerializer"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of a projectSets extension:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.team.core.projectSets&quot;&gt;
- &lt;projectSets
- id=&quot;org.eclipse.team.cvs.core.cvsnature&quot;
- class=&quot;org.eclipse.team.cvs.core.CVSProjectSetSerializer&quot;&gt;
- &lt;/projectSets&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2002 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.core/schema/repository.exsd b/bundles/org.eclipse.team.core/schema/repository.exsd
deleted file mode 100644
index 87f464f03..000000000
--- a/bundles/org.eclipse.team.core/schema/repository.exsd
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.core.org.eclipse.team.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.core.org.eclipse.team.core" id="repository" name="Team Repository Provider"/>
- </appInfo>
- <documentation>
- The Team plugin contains the notion of Repositories. The job of a repository is to provide support for sharing resources between Team members. Repositories are configured on a per-project basis. Only one repository can be mapped to a project at a time.
-&lt;p&gt;
-Repositories that extend this extension point can provide implementations for common repository specific rules for resource modifications, moving and deleting. See the following interfaces for more details &lt;code&gt;IFileModificationValidator&lt;/code&gt; and &lt;code&gt;MoveDeleteHook&lt;/code&gt;.
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="repository"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="repository">
- <complexType>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the fully-qualified name of a subclass of
- &lt;samp&gt;org.eclipse.team.core.RepositoryProvider&lt;/samp&gt;.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 2.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.team.core.repository&quot;&gt;
- &lt;repository
- class=&quot;org.eclipse.myprovider.MyRepositoryProvider&quot;
- id=&quot;org.eclipse.myprovider.myProviderID&quot;&gt;
- &lt;/repository&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The value of the class attribute must represent a subclass of &lt;samp&gt;org.eclipse.team.core.RepositoryProvider&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The provided implementation of RepositoryProvider provides helper methods and common code for mapping and unmapping providers to projects.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2002 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java
deleted file mode 100644
index 4fabc2bda..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.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.core;
-
-/*
- */
-public final class DefaultRepositoryProviderType extends RepositoryProviderType {
-
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java
deleted file mode 100644
index f4e2b9e33..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.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.core;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.core.*;
-import org.eclipse.team.internal.core.registry.DeploymentProviderDescriptor;
-
-/**
- * A deployment provider allows synchronization of workspace resources with a remote location. At a minimum
- * it allows pushing resources in the workspace to a remote location and pulling resources from a
- * remote location into the workspace.
- * <p>
- * The difference between a deployment provider and repository provider is the following:
- * <ul>
- * <li>a deployment provider doesn't have full control of workspace resources whereas the repository
- * provider can hook into the IMoveDeleteHook and IFileModificationValidator.
- * <li>multiple deployment providers can be mapped to the same folder whereas there is only one
- * repository provider per project.
- * <li>a deployment provider can be mapped to any folder
- * whereas the repository provider must be mapped at the project.
- * </ul>
- * </p>
- * <p>
- * Deployment providers can be dfined in the plugin manifest using the following XML.
- * <pre>
- * &gt;extension
- point="org.eclipse.team.core.deployment"&lt;
- &gt;deployment
- name="Example Deployment Provider"
- class="org.eclipse.team.internal.example.DeploymentProviderClass"
- id="org.eclipse.team.example.DeploymentProvider"&lt;
- &gt;/deployment&lt;
- &gt;/extension&lt;
- </pre>
- * @see RepositoryProvider
- * @see IDeploymentProviderManager
- * @since 3.0
- */
-public abstract class DeploymentProvider implements IExecutableExtension, IAdaptable {
-
- private String id;
- private IContainer container;
- private String name;
-
- /**
- * Returns the id of the deployment provider as defined in the plugin manifest
- * @return the id
- */
- public String getID() {
- return id;
- }
-
- /**
- * Returns the name of the deployment provider as defined in the plugin manifest.
- * @return the name
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * Return the container (folder or project) that this provider is mapped to.
- * @return a folder or project
- */
- public IContainer getMappedContainer() {
- return this.container;
- }
-
- /**
- * Method that is invoked when a deployment provider is first mapped to its folder
- * using <code>IDeploymentProviderManager#map</code>.
- * Mappings are persisted accross workbench invocations. However, this method is
- * only invoked when the provider is mapped. The <code>restoreState</code> method
- * is invoked on subsequent workbench invocations.
- */
- abstract public void init();
-
- /**
- * Method that is invoked when a providers is unmapped from a folder using
- * <code>IDeploymentProviderManager#unmap</code>.
- */
- abstract public void dispose();
-
- /**
- * Method that is invoked after a deployment provider is first mapped or recreated on workbench
- * invocation. This method is invoked before <code>init</code> or <code>restoreState</code>.
- * This method is not intended to be called by clients.
- * @param container the container the provider is mapped to
- */
- public final void setContainer(IContainer container) {
- this.container = container;
- }
-
- abstract public void saveState(IMemento memento);
-
- abstract public void restoreState(IMemento memento);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- // TODO: This doesn't work well since the Provider is created programmatically
- // when initially mapped
- this.id = config.getAttribute(DeploymentProviderDescriptor.ATT_ID);
- this.name = config.getAttribute(DeploymentProviderDescriptor.ATT_NAME);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- /**
- * Returns whether a resource can be mapped to multiple deployment providers
- * of this type. Even if this method returns <code>false</code>, a resource can
- * still be mapped to multiple providers whose id differs. By default,
- * multiple mappings are not supported. Subclasses must override this method
- * to change this behavior.
- * @return whether multiple mappings to providers of this type are supported
- */
- public boolean isMultipleMappingsSupported() {
- return false;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java
deleted file mode 100644
index 6591e1c46..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-
-/**
- * Manages deployment providers. Clients can programatically map and unmap deployment
- * providers to containers.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @see RepositoryProvider
- * @see DeploymentProvider
- * @since 3.0
- */
-public interface IDeploymentProviderManager {
- /**
- * Maps a container to the the given provider. Mappings are persisted across
- * workbench sessions.
- *
- * @param container the container to be mapped to the given provider
- * @param provider the provider to be mapped to the container
- * @throws TeamException
- */
- public void map(IContainer container, DeploymentProvider provider) throws TeamException;
-
- /**
- * Unmaps the given provider from the container.
- *
- * @param container the container to be unmapped from the given provider
- * @param provider the provider to unmap from the container
- * @throws TeamException
- */
- public void unmap(IContainer container, DeploymentProvider provider) throws TeamException;
-
- /**
- * Returns the providers associated with the given resource. This loads the providers
- * if not already loaded, and can be long running. To check the existance of
- * a particular mapping call {@link #getMappedTo(IResource, String)} instead.
- * This method returns an empty array if there are no mappings.
- *
- * @param resource the resource whose mappings are to be retreived
- * @return the mappings for the resource
- */
- public DeploymentProvider[] getMappings(IResource resource);
-
- /**
- * Returns the providers with the given id associated with the given resource.
- * This loads the providers if not already loaded, and can be long running.
- * To check the existance of a particular mapping call
- * {@link #getMappedTo(IResource, String)} instead.
- * This method returns an empty array if there are no mappings. This method will
- * only return either an empty array or an array of length 1 if the provider
- * of the given type does not support multiple mappings
- * (@see DeploymentProvider#isMultipleMappingsSupported()).
- * @param resource the resource whose mappings are to be retreived
- * @param id the id of the provider
- * @return the mappings for the resource
- */
- public DeploymentProvider[] getMappings(IResource resource, String id);
-
- /**
- * Returns <code>true</code> if the resource is mapped to the provider with
- * the given id, and <code>false</code> otherwise. This method is fast running
- * and won't load the provider.
- *
- * @param resource the resource for which to check the mapping
- * @param id the id of the provider
- * @return <code>true</code> if the resource is mapped to the provider with
- * the given id, and <code>false</code> otherwise.
- */
- public boolean getMappedTo(IResource resource, String id);
-
- /**
- * Return an array of all the resource roots that are mapped
- * to a deployment providers with the given
- * id. If id is <code>null</code>, the roots of all deployment providers
- * are returned.
- * @param id a deployment provider id or <code>null</code>
- * @return all roots that are mapped to deployment providers with
- * the given id
- */
- public IResource[] getDeploymentProviderRoots(String id);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
deleted file mode 100644
index eaab301ba..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.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.core;
-
-/**
- * A file type info specifies both the file extension and the
- * corresponding file type.
- *
- * @since 2.0
- */
-public interface IFileTypeInfo {
- /**
- * Returns the string specifying the file extension
- *
- * @return the file extension
- */
- public String getExtension();
-
- /**
- * Returns the file type for files ending with the corresponding
- * extension.
- *
- * Valid values are:
- * Team.UNKNOWN
- * Team.TEXT
- * Team.BINARY
- *
- * @return the file type
- */
- public int getType();
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java
deleted file mode 100644
index 86bf1ba9a..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.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.core;
-
-/**
- * An ignore info specifies both the pattern and the enabled state
- * of a globally ignored pattern.
- *
- * @since 2.0
- */
-public interface IIgnoreInfo {
- /**
- * Return the string specifying the pattern of this ignore. The string
- * may include the wildcard characters '*' and '?'. If you wish to
- * include either of these characters verbatim (i.e. you do not wish
- * them to expand to wildcards), you must escape them with a backslash '\'.
- * <p>
- * If you are using string literals in Java to represent the patterns, don't
- * forget escape characters are represented by "\\".
- *
- * @return the pattern represented by this ignore info
- */
- public String getPattern();
- /**
- * Return whether or not this ignore info is enabled. A disabled ignore
- * info remains in the global ignore list, but no attempt is made to match
- * with it to determine resource ignore state.
- *
- * @return whether the ignore info is enabled
- */
- public boolean getEnabled();
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java
deleted file mode 100644
index f088238db..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.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.core;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * IProjectSetSerializer manages the serializing and deserializing
- * of references to projects. Given a project, it can produce a
- * UTF-8 encoded String which can be stored in a file.
- * Given this String, it can create in the workspace an IProject.
- *
- * @since 2.0
- */
-
-public interface IProjectSetSerializer {
-
- /**
- * For every IProject in providerProjects, return an opaque
- * UTF-8 encoded String to act as a reference to that project.
- * The format of the String is specific to the provider.
- * The format of the String must be such that
- * IProjectSetSerializer.addToWorskpace() will be able to
- * consume it and recreate a corresponding project.
- * @see IProjectSetSerializer#addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor)
- *
- * @param providerProjects an array of projects that the serializer should create
- * text references for
- * @param context a UI context object. This object will either be a
- * com.ibm.swt.widgets.Shell or it will be null.
- * @param monitor a progress monitor
- * @return String[] an array of serialized reference strings uniquely identifying the projects
- * @throws TeamException
- */
- public String[] asReference(IProject[] providerProjects, Object context, IProgressMonitor monitor) throws TeamException;
-
- /**
- * For every String in referenceStrings, create in the workspace a
- * corresponding IProject. Return an Array of the resulting IProjects.
- * Result is unspecified in the case where an IProject of that name
- * already exists. In the case of failure, a TeamException must be thrown.
- * The opaque strings in referenceStrings are guaranteed to have been previously
- * produced by IProjectSetSerializer.asReference().
- * @see IProjectSetSerializer#asReference(IProject[] providerProjects, Object context, IProgressMonitor monitor)
- *
- * @param referenceStrings an array of referene strings uniquely identifying the projects
- * @param filename the name of the file that the references were read from. This is included
- * in case the provider needs to deduce relative paths
- * @param context a UI context object. This object will either be a
- * com.ibm.swt.widgets.Shell or it will be null.
- * @param monitor a progress monitor
- * @return IProject[] an array of projects that were created
- * @throws TeamException
- */
- public IProject[] addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor) throws TeamException;
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamStatus.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamStatus.java
deleted file mode 100644
index d1ed783e3..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamStatus.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.core;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Defines the status codes used in the status of exceptions and errors relating to Team.
- */
-public interface ITeamStatus extends IStatus {
-
- /**
- * An error occurred trying to obtain the <code>SyncInfo</code> for a single resource.
- * The error will be cleared when the set is reset or when a sync info is added to
- * the set for the resource for which the error occurred.
- */
- public static final int RESOURCE_SYNC_INFO_ERROR = 1;
-
- /**
- * An error occurred that may effect several resources in a <code>SyncInfoSet</code>.
- * The error will be cleared when the set is reset.
- */
- public static final int SYNC_INFO_SET_ERROR = 2;
-
- /**
- * Return the resource associated with this status.
- * @return Returns the resource.
- */
- public IResource getResource();
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
deleted file mode 100644
index b8a66559e..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * This class represents provisional API. A provider is not required to
- * implement this API. Implementers, and those who reference it, do so with the
- * awareness that this class may be removed or substantially changed at future
- * times without warning.
- * <p>
- * The intention is that this class will eventually replace <code>IProjectSetSerializer</code>.
- * At the current time it only complements this API by providing a notification
- * mechanism for informing repository providers when a project set has been
- * created.
- *
- * @see IProjectSetSerializer
- * @see RepositoryProviderType
- *
- * @since 2.1
- */
-public abstract class ProjectSetCapability {
- /**
- * Notify the provider that a project set has been created at path. Only
- * providers identified as having projects in the project set will be
- * notified. The project set may or may not be created in a workspace
- * project (thus may not be a resource).
- *
- * @param File
- * the project set file that was created
- */
- public void projectSetCreated(File file, Object context, IProgressMonitor monitor) {
- //default is to do nothing
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
deleted file mode 100644
index ec686faa9..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.team.IMoveDeleteHook;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * A concrete subclass of <code>RepositoryProvider</code> is created for each
- * project that is associated with a repository provider. The lifecycle of these
- * instances is is similar to that of the platform's 'nature' mechanism.
- * <p>
- * To create a repository provider and have it registered with the platform, a client
- * must minimally:
- * <ol>
- * <li>extend <code>RepositoryProvider</code>
- * <li>define a repository extension in <code>plugin.xml</code>.
- * Here is an example extension point definition:
- *
- * <code>
- * <br>&lt;extension point="org.eclipse.team.core.repository"&gt;
- * <br>&nbsp;&lt;repository
- * <br>&nbsp;&nbsp;class="org.eclipse.myprovider.MyRepositoryProvider"
- * <br>&nbsp;&nbsp;id="org.eclipse.myprovider.myProviderID"&gt;
- * <br>&nbsp;&lt;/repository&gt;
- * <br>&lt;/extension&gt;
- * </code>
- * </ol></p>
- * <p>
- * Once a repository provider is registered with Team, then you
- * can associate a repository provider with a project by invoking <code>RepositoryProvider.map()</code>.
- * </p>
- * @see RepositoryProvider#map(IProject, String)
- *
- * @since 2.0
- */
-public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
-
- private final static String TEAM_SETID = "org.eclipse.team.repository-provider"; //$NON-NLS-1$
-
- private final static QualifiedName PROVIDER_PROP_KEY =
- new QualifiedName("org.eclipse.team.core", "repository"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private final static List AllProviderTypeIds = initializeAllProviderTypes();
-
- // the project instance that this nature is assigned to
- private IProject project;
-
- // lock to ensure that map/unmap and getProvider support concurrency
- private static final ILock mappingLock = Platform.getJobManager().newLock();
-
- /**
- * Instantiate a new RepositoryProvider with concrete class by given providerID
- * and associate it with project.
- *
- * @param project the project to be mapped
- * @param id the ID of the provider to be mapped to the project
- * @throws TeamException if
- * <ul>
- * <li>There is no provider by that ID.</li>
- * <li>The project is already associated with a repository provider and that provider
- * prevented its unmapping.</li>
- * </ul>
- * @see RepositoryProvider#unmap(IProject)
- */
- public static void map(IProject project, String id) throws TeamException {
- try {
- // Obtain a scheduling rule on the project before obtaining the
- // mappingLock. This is required because a caller of getProvider
- // may hold a scheduling rule before getProvider is invoked but
- // getProvider itself does not (and can not) obtain a scheduling rule.
- // Thus, the locking order is always scheduling rule followed by
- // mappingLock.
- Platform.getJobManager().beginRule(project, null);
- try {
- mappingLock.acquire();
- RepositoryProvider existingProvider = null;
-
- if(project.getPersistentProperty(PROVIDER_PROP_KEY) != null)
- existingProvider = getProvider(project); // get the real one, not the nature one
-
- //if we already have a provider, and its the same ID, we're ok
- //if the ID's differ, unmap the existing.
- if(existingProvider != null) {
- if(existingProvider.getID().equals(id))
- return; //nothing to do
- else
- unmap(project);
- }
-
- // Create the provider as a session property before adding the persistant
- // property to ensure that the provider can be instantiated
- RepositoryProvider provider = mapNewProvider(project, id);
-
- //mark it with the persistent ID for filtering
- try {
- project.setPersistentProperty(PROVIDER_PROP_KEY, id);
- } catch (CoreException outer) {
- // couldn't set the persistant property so clear the session property
- try {
- project.setSessionProperty(PROVIDER_PROP_KEY, null);
- } catch (CoreException inner) {
- // something is seriously wrong
- TeamPlugin.log(IStatus.ERROR, Policy.bind("RepositoryProvider.couldNotClearAfterError", project.getName(), id), inner);//$NON-NLS-1$
- }
- throw outer;
- }
-
- provider.configure(); //xxx not sure if needed since they control with wiz page and can configure all they want
-
- //adding the nature would've caused project description delta, so trigger one
- project.touch(null);
- } finally {
- mappingLock.release();
- }
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- } finally {
- Platform.getJobManager().endRule(project);
- }
- }
-
- /*
- * Instantiate the provider denoted by ID and store it in the session property.
- * Return the new provider instance. If a TeamException is thrown, it is
- * guaranteed that the session property will not be set.
- *
- * @param project
- * @param id
- * @return RepositoryProvider
- * @throws TeamException we can't instantiate the provider, or if the set
- * session property fails from core
- */
- private static RepositoryProvider mapNewProvider(IProject project, String id) throws TeamException {
- RepositoryProvider provider = newProvider(id); // instantiate via extension point
-
- if(provider == null)
- throw new TeamException(Policy.bind("RepositoryProvider.couldNotInstantiateProvider", project.getName(), id)); //$NON-NLS-1$
-
- // validate that either the provider supports linked resources or the project has no linked resources
- if (!provider.canHandleLinkedResources()) {
- try {
- IResource[] members = project.members();
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
- if (resource.isLinked()) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.LINKING_NOT_ALLOWED, Policy.bind("RepositoryProvider.linkedResourcesExist", project.getName(), id), null)); //$NON-NLS-1$
- }
- }
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- }
-
- //store provider instance as session property
- try {
- project.setSessionProperty(PROVIDER_PROP_KEY, provider);
- provider.setProject(project);
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- return provider;
- }
-
- private static RepositoryProvider mapExistingProvider(IProject project, String id) throws TeamException {
- try {
- // Obtain the mapping lock before creating the instance so we can make sure
- // that a disconnect is not happening at the same time
- mappingLock.acquire();
- try {
- // Ensure that the persistant property is still set
- // (i.e. an unmap may have come in since we checked it last
- String currentId = project.getPersistentProperty(PROVIDER_PROP_KEY);
- if (currentId == null) {
- // The provider has been unmapped
- return null;
- }
- if (!currentId.equals(id)) {
- // A provider has been disconnected and another connected
- // Since mapping creates the session property, we
- // can just return it
- return lookupProviderProp(project);
- }
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- }
- return mapNewProvider(project, id);
- } finally {
- mappingLock.release();
- }
- }
- /**
- * Disassoociates project with the repository provider its currently mapped to.
- * @param project
- * @throws TeamException The project isn't associated with any repository provider.
- */
- public static void unmap(IProject project) throws TeamException {
- try{
- // See the map(IProject, String) method for a description of lock ordering
- Platform.getJobManager().beginRule(project, null);
- try {
- mappingLock.acquire();
- String id = project.getPersistentProperty(PROVIDER_PROP_KEY);
-
- //If you tried to remove a non-existant nature it would fail, so we need to as well with the persistent prop
- if(id == null) {
- throw new TeamException(Policy.bind("RepositoryProvider.No_Provider_Registered", project.getName())); //$NON-NLS-1$
- }
-
- //This will instantiate one if it didn't already exist,
- //which is ok since we need to call deconfigure() on it for proper lifecycle
- RepositoryProvider provider = getProvider(project);
- if (provider == null) {
- // There is a persistant property but the provider cannot be obtained.
- // The reason could be that the provider's plugin is no longer available.
- // Better log it just in case this is unexpected.
- TeamPlugin.log(IStatus.ERROR, Policy.bind("RepositoryProvider.couldNotInstantiateProvider", project.getName(), id), null); //$NON-NLS-1$
- }
-
- if (provider != null) provider.deconfigure();
-
- project.setSessionProperty(PROVIDER_PROP_KEY, null);
- project.setPersistentProperty(PROVIDER_PROP_KEY, null);
-
- if (provider != null) provider.deconfigured();
-
- //removing the nature would've caused project description delta, so trigger one
- project.touch(null);
- } finally {
- mappingLock.release();
- }
- } catch (CoreException e) {
- throw TeamPlugin.wrapException(e);
- } finally {
- Platform.getJobManager().endRule(project);
- }
- }
-
- /*
- * Return the provider mapped to project, or null if none;
- */
- private static RepositoryProvider lookupProviderProp(IProject project) throws CoreException {
- return (RepositoryProvider) project.getSessionProperty(PROVIDER_PROP_KEY);
- }
-
-
- /**
- * Default constructor required for the resources plugin to instantiate this class from
- * the nature extension definition.
- */
- public RepositoryProvider() {
- }
-
- /**
- * Configures the provider for the given project. This method is called after <code>setProject</code>.
- * If an exception is generated during configuration
- * of the project, the provider will not be assigned to the project.
- *
- * @throws CoreException if the configuration fails.
- */
- abstract public void configureProject() throws CoreException;
-
- /**
- * Configures the nature for the given project. This is called by <code>RepositoryProvider.map()</code>
- * the first time a provider is mapped to a project. It is not intended to be called by clients.
- *
- * @throws CoreException if this method fails. If the configuration fails the provider will not be
- * associated with the project.
- *
- * @see RepositoryProvider#configureProject()
- */
- final public void configure() throws CoreException {
- try {
- configureProject();
- } catch(CoreException e) {
- try {
- RepositoryProvider.unmap(getProject());
- } catch(TeamException e2) {
- throw new CoreException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("RepositoryProvider_Error_removing_nature_from_project___1") + getID(), e2)); //$NON-NLS-1$
- }
- throw e;
- }
- }
-
- /**
- * Method deconfigured is invoked after a provider has been unmaped. The
- * project will no longer have the provider associated with it when this
- * method is invoked. It is a last chance for the provider to clean up.
- */
- protected void deconfigured() {
- }
-
- /**
- * Answer the id of this provider instance. The id should be the repository provider's
- * id as defined in the provider plugin's plugin.xml.
- *
- * @return the nature id of this provider
- */
- abstract public String getID();
-
- /**
- * Returns an <code>IFileModificationValidator</code> for pre-checking operations
- * that modify the contents of files.
- * Returns <code>null</code> if the provider does not wish to participate in
- * file modification validation.
- *
- * @see org.eclipse.core.resources.IFileModificationValidator
- */
-
- public IFileModificationValidator getFileModificationValidator() {
- return null;
- }
-
- /**
- * Returns an <code>IMoveDeleteHook</code> for handling moves and deletes
- * that occur withing projects managed by the provider. This allows providers
- * to control how moves and deletes occur and includes the ability to prevent them.
- * <p>
- * Returning <code>null</code> signals that the default move and delete behavior is desired.
- *
- * @see org.eclipse.core.resources.team.IMoveDeleteHook
- */
- public IMoveDeleteHook getMoveDeleteHook() {
- return null;
- }
-
- /**
- * Returns a brief description of this provider. The exact details of the
- * representation are unspecified and subject to change, but the following
- * may be regarded as typical:
- *
- * "SampleProject:org.eclipse.team.cvs.provider"
- *
- * @return a string description of this provider
- */
- public String toString() {
- return Policy.bind("RepositoryProvider.toString", getProject().getName(), getID()); //$NON-NLS-1$
- }
-
- /**
- * Returns all known (registered) RepositoryProvider ids.
- *
- * @return an array of registered repository provider ids.
- */
- final public static String[] getAllProviderTypeIds() {
- IProjectNatureDescriptor[] desc = ResourcesPlugin.getWorkspace().getNatureDescriptors();
- Set teamSet = new HashSet();
-
- teamSet.addAll(AllProviderTypeIds); // add in all the ones we know via extension point
-
- //fall back to old method of nature ID to find any for backwards compatibility
- for (int i = 0; i < desc.length; i++) {
- String[] setIds = desc[i].getNatureSetIds();
- for (int j = 0; j < setIds.length; j++) {
- if(setIds[j].equals(TEAM_SETID)) {
- teamSet.add(desc[i].getNatureId());
- }
- }
- }
- return (String[]) teamSet.toArray(new String[teamSet.size()]);
- }
-
- /**
- * Returns the provider for a given IProject or <code>null</code> if a provider is not associated with
- * the project or if the project is closed or does not exist. This method should be called if the caller
- * is looking for <b>any</b> repository provider. Otherwise call <code>getProvider(project, id)</code>
- * to look for a specific repository provider type.
- * </p>
- * @param project the project to query for a provider
- * @return the repository provider associated with the project
- */
- final public static RepositoryProvider getProvider(IProject project) {
- try {
- if(project.isAccessible()) {
-
- //-----------------------------
- //First, look for the session property
- RepositoryProvider provider = lookupProviderProp(project);
- if(provider != null)
- return provider;
-
- // -----------------------------
- //Next, check if it has the ID as a persistent property, if yes then instantiate provider
- String id = project.getPersistentProperty(PROVIDER_PROP_KEY);
- if(id != null)
- return mapExistingProvider(project, id);
-
- //Couldn't find using new method, fall back to lookup using natures for backwards compatibility
- //-----------------------------
- IProjectDescription projectDesc = project.getDescription();
- String[] natureIds = projectDesc.getNatureIds();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // for every nature id on this project, find it's natures sets and check if it is
- // in the team set.
- for (int i = 0; i < natureIds.length; i++) {
- IProjectNatureDescriptor desc = workspace.getNatureDescriptor(natureIds[i]);
- // The descriptor can be null if the nature doesn't exist
- if (desc != null) {
- String[] setIds = desc.getNatureSetIds();
- for (int j = 0; j < setIds.length; j++) {
- if(setIds[j].equals(TEAM_SETID)) {
- return getProvider(project, natureIds[i]);
- }
- }
- }
- }
- }
- } catch(CoreException e) {
- if (!isAcceptableException(e)) {
- TeamPlugin.log(e);
- }
- }
- return null;
- }
-
- /*
- * Return whether the given exception is acceptable during a getProvider().
- * If the exception is acceptable, it is assumed that there is no provider
- * on the project.
- */
- private static boolean isAcceptableException(CoreException e) {
- return e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND;
- }
-
- /**
- * Returns a provider of type with the given id if associated with the given project
- * or <code>null</code> if the project is not associated with a provider of that type
- * or the nature id is that of a non-team repository provider nature.
- *
- * @param project the project to query for a provider
- * @param id the repository provider id
- * @return the repository provider
- */
- final public static RepositoryProvider getProvider(IProject project, String id) {
- try {
- if(project.isAccessible()) {
- String existingID = project.getPersistentProperty(PROVIDER_PROP_KEY);
-
- if(id.equals(existingID)) {
- //if the IDs are the same then they were previously mapped
- //see if we already instantiated one
- RepositoryProvider provider = lookupProviderProp(project); //throws core, we will reuse the catching already here
- if(provider != null)
- return provider;
- //otherwise instantiate and map a new one
- RepositoryProvider newProvider = mapExistingProvider(project, id);
- if (newProvider!= null && newProvider.getID().equals(id)) {
- return newProvider;
- } else {
- // The id changed before we could create the desired provider
- return null;
- }
- }
-
- //couldn't find using new method, fall back to lookup using natures for backwards compatibility
- //-----------------------------
-
- // if the nature id given is not in the team set then return
- // null.
- IProjectNatureDescriptor desc = ResourcesPlugin.getWorkspace().getNatureDescriptor(id);
- if(desc == null) //for backwards compat., may not have any nature by that ID
- return null;
-
- String[] setIds = desc.getNatureSetIds();
- for (int i = 0; i < setIds.length; i++) {
- if(setIds[i].equals(TEAM_SETID)) {
- return (RepositoryProvider)project.getNature(id);
- }
- }
- }
- } catch(CoreException e) {
- if (!isAcceptableException(e)) {
- TeamPlugin.log(e);
- }
- }
- return null;
- }
-
- /**
- * Returns whether the given project is shared or not. This is a lightweight
- * method in that it will not instantiate a provider instance (as
- * <code>getProvider</code> would) if one is not already instantiated.
- *
- * Note that IProject.touch() generates a project description delta. This, in combination
- * with isShared() can be used to be notified of sharing/unsharing of projects.
- *
- * @param project the project being tested.
- * @return boolean
- *
- * @see #getProvider(IProject)
- *
- * @since 2.1
- */
- public static boolean isShared(IProject project) {
- if (!project.isAccessible()) return false;
- try {
- if (lookupProviderProp(project) != null) return true;
- return project.getPersistentProperty(PROVIDER_PROP_KEY) != null;
- } catch (CoreException e) {
- TeamPlugin.log(e);
- return false;
- }
- }
-
- /*
- * @see IProjectNature#getProject()
- */
- public IProject getProject() {
- return project;
- }
-
- /*
- * @see IProjectNature#setProject(IProject)
- */
- public void setProject(IProject project) {
- this.project = project;
- }
-
- private static List initializeAllProviderTypes() {
- List allIDs = new ArrayList();
-
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.REPOSITORY_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
- allIDs.add(extensionId);
- }
- }
- }
- }
- return allIDs;
- }
-
- private static RepositoryProvider newProvider(String id) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.REPOSITORY_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
- if (extensionId != null && extensionId.equals(id)) {
- try {
- return (RepositoryProvider) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- TeamPlugin.log(e);
- } catch (ClassCastException e) {
- String className = configElements[j].getAttribute("class"); //$NON-NLS-1$
- TeamPlugin.log(IStatus.ERROR, Policy.bind("RepositoryProvider.invalidClass", id, className), e); //$NON-NLS-1$
- }
- return null;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Method validateCreateLink is invoked by the Platform Core TeamHook when a
- * linked resource is about to be added to the provider's project. It should
- * not be called by other clients and it should not need to be overridden by
- * subclasses (although it is possible to do so in special cases).
- * Subclasses can indicate that they support linked resources by overridding
- * the <code>canHandleLinkedResources()</code> method.
- *
- * @param resource see <code>org.eclipse.core.resources.team.TeamHook</code>
- * @param updateFlags see <code>org.eclipse.core.resources.team.TeamHook</code>
- * @param location see <code>org.eclipse.core.resources.team.TeamHook</code>
- * @return IStatus see <code>org.eclipse.core.resources.team.TeamHook</code>
- *
- * @see RepositoryProvider#canHandleLinkedResources()
- *
- * @since 2.1
- */
- public IStatus validateCreateLink(IResource resource, int updateFlags, IPath location) {
- if (canHandleLinkedResources()) {
- return Team.OK_STATUS;
- } else {
- return new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.LINKING_NOT_ALLOWED, Policy.bind("RepositoryProvider.linkedResourcesNotSupported", getProject().getName(), getID()), null); //$NON-NLS-1$
- }
- }
-
- /**
- * Method canHandleLinkedResources should be overridden by subclasses who
- * support linked resources. At a minimum, supporting linked resources
- * requires changes to the move/delete hook
- * (see org.eclipe.core.resources.team.IMoveDeleteHook). This method is
- * called after the RepositoryProvider is instantiated but before
- * <code>setProject()</code> is invoked so it will not have access to any
- * state determined from the <code>setProject()</code> method.
- * @return boolean
- *
- * @see org.eclipse.core.resources.team.IMoveDeleteHook
- *
- * @since 2.1
- */
- public boolean canHandleLinkedResources() {
- return false;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
deleted file mode 100644
index cb3afd176..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.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.core;
-
-import java.util.HashMap;
-import java.util.Map;
-
-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.IStatus;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * This class represents provisional API. A provider is not required to implement this API.
- * Implementers, and those who reference it, do so with the awareness that this class may be
- * removed or substantially changed at future times without warning.
- * <p>
- * This class represents things you can ask/do with a type of provider. This
- * is in the absence of a project, as opposed to RepositoryProvider which
- * requires a concrete project in order to be instantiated.
- * <p>
- * A repository provider type class is asscoaited with it's provider ID along with it's
- * corresponding repository provider class. To add a
- * repository provider type and have it registered with the platform, a client
- * must minimally:
- * <ol>
- * <li>extend <code>RepositoryProviderType</code>
- * <li>add the typeClass field to the repository extension in <code>plugin.xml</code>.
- * Here is an example extension point definition:
- *
- * <code>
- * <br>&lt;extension point="org.eclipse.team.core.repository"&gt;
- * <br>&nbsp;&lt;repository
- * <br>&nbsp;&nbsp;class="org.eclipse.myprovider.MyRepositoryProvider"
- * <br>&nbsp;&nbsp;typeClass="org.eclipse.myprovider.MyRepositoryProviderType"
- * <br>&nbsp;&nbsp;id="org.eclipse.myprovider.myProviderID"&gt;
- * <br>&nbsp;&lt;/repository&gt;
- * <br>&lt;/extension&gt;
- * </code>
- * </ol></p>
- *
- * <p>
- * Once a repository provider type is registered with Team, then you
- * can access the singleton instance of the class by invoking <code>RepositoryProviderType.getProviderType()</code>.
- * </p>
- *
- * @see RepositoryProviderType#getProviderType(String)
- *
- * @since 2.1
- */
-
-public abstract class RepositoryProviderType {
- private static Map allProviderTypes = new HashMap();
-
- private String id;
-
- public RepositoryProviderType() {
- }
-
- /**
- * Return the RepositoryProviderType for the given provider ID.
- *
- * @param id the ID of the provider
- * @return RepositoryProviderType
- *
- * @see #getID()
- */
- public static RepositoryProviderType getProviderType(String id) {
- RepositoryProviderType type = (RepositoryProviderType) allProviderTypes.get(id);
-
- if(type != null)
- return type;
-
- //If there isn't one in the table, we'll try to create one from the extension point
- //Its possible that newProviderType() will return null, but in that case it will have also logged the error so just return the result
- return newProviderType(id);
- }
-
- private void setID(String id) {
- this.id = id;
- }
-
- private static RepositoryProviderType newProviderType(String id) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.REPOSITORY_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
-
- if (extensionId != null && extensionId.equals(id)) {
- try {
- RepositoryProviderType providerType;
- //Its ok not to have a typeClass extension. In this case, a default instance will be created.
- if(configElements[j].getAttribute("typeClass") == null) { //$NON-NLS-1$
- providerType = new DefaultRepositoryProviderType();
- } else {
- providerType = (RepositoryProviderType) configElements[j].createExecutableExtension("typeClass"); //$NON-NLS-1$
- }
-
- providerType.setID(id);
- allProviderTypes.put(id, providerType);
- return providerType;
- } catch (CoreException e) {
- TeamPlugin.log(e);
- } catch (ClassCastException e) {
- String className = configElements[j].getAttribute("typeClass"); //$NON-NLS-1$
- TeamPlugin.log(IStatus.ERROR, Policy.bind("RepositoryProviderType.invalidClass", id, className), e); //$NON-NLS-1$
- }
- return null;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Answer the id of this provider type. The id will be the repository
- * provider type's id as defined in the provider plugin's plugin.xml.
- *
- * @return the id of this provider type
- */
- public final String getID() {
- return this.id;
- }
-
- /**
- * Answers the ProjectSetCapability that is intended to implement methods to import and
- * create project sets. If the provider doesn't wish to provide this
- * feature, return null.
- * <p>
- * Note that at the current time, the <code>IProjectSetSerializer</code> is still used to import
- * and export project sets. The <code>ProjectSetCapability</code> only provides a mechanism
- * by which repository providers can be notified when a project set is created and exported.
- * In the future, it is intended that IProjectSetSerializer be replaced by <code>IProjectSetSerializer</code>.
- *
- * @return ProjectSetCapability
- */
-
- public ProjectSetCapability getProjectSetCapability() {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
deleted file mode 100644
index cc8b7416b..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ /dev/null
@@ -1,619 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core;
-
-import java.io.DataInputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.SortedMap;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-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.IStorage;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.internal.core.DeploymentProviderManager;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.StringMatcher;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * The Team class provides a global point of reference for the global ignore set
- * and the text/binary registry.
- *
- * WVCM: how does the IProjectSetSerializer fit into the 3.0 team api?
- *
- * @since 2.0
- */
-public final class Team {
-
- private static final String PREF_TEAM_IGNORES = "ignore_files"; //$NON-NLS-1$
- private static final String PREF_TEAM_TYPES = "file_types"; //$NON-NLS-1$
- private static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
- public static final Status OK_STATUS = new Status(Status.OK, TeamPlugin.ID, Status.OK, Policy.bind("ok"), null); //$NON-NLS-1$
-
- // File type constants
- public static final int UNKNOWN = 0;
- public static final int TEXT = 1;
- public static final int BINARY = 2;
-
- // Keys: file extensions. Values: Integers
- private static SortedMap globalTypes, pluginTypes;
-
- // The ignore list that is read at startup from the persisted file
- private static SortedMap globalIgnore, pluginIgnore;
- private static StringMatcher[] ignoreMatchers;
-
- // Deployment provider manager
- private static IDeploymentProviderManager deploymentManager;
-
- private static class FileTypeInfo implements IFileTypeInfo {
- private String extension;
- private int type;
-
- public FileTypeInfo(String extension, int type) {
- this.extension = extension;
- this.type = type;
- }
- public String getExtension() {
- return extension;
- }
- public int getType() {
- return type;
- }
- }
-
- /**
- * Return the type of the given IStorage.
- *
- * Valid return values are:
- * Team.TEXT
- * Team.BINARY
- * Team.UNKNOWN
- *
- * @param storage the IStorage
- * @return whether the given IStorage is TEXT, BINARY, or UNKNOWN
- */
- public static int getType(IStorage storage) {
- String extension = getFileExtension(storage.getName());
- if (extension == null) return UNKNOWN;
- SortedMap table = getFileTypeTable();
- Integer integer = (Integer)table.get(extension);
- if (integer == null) return UNKNOWN;
- return integer.intValue();
- }
-
- /**
- * Returns whether the given file should be ignored.
- *
- * This method answers true if the file matches one of the global ignore
- * patterns, or if the file is marked as derived.
- *
- * @param file the file
- * @return whether the file should be ignored
- */
- public static boolean isIgnoredHint(IResource resource) {
- if (resource.isDerived()) return true;
- return matchesEnabledIgnore(resource);
- }
-
- /**
- * Returns whether the given file should be ignored.
- * @deprecated use isIgnoredHint(IResource) instead
- */
- public static boolean isIgnoredHint(IFile file) {
- if (file.isDerived()) return true;
- return matchesEnabledIgnore(file);
- }
-
- private static boolean matchesEnabledIgnore(IResource resource) {
- StringMatcher[] matchers = getStringMatchers();
- for (int i = 0; i < matchers.length; i++) {
- if (matchers[i].match(resource.getName())) return true;
- }
- return false;
- }
-
- /**
- * Returns whether the given file should be ignored.
- * @deprecated use isIgnoredHint instead
- */
- public static boolean isIgnored(IFile file) {
- return matchesEnabledIgnore(file);
- }
-
- private static IFileTypeInfo[] getFileTypeInfo(SortedMap map) {
- List result = new ArrayList();
- Iterator e = map.keySet().iterator();
- while (e.hasNext()) {
- String string = (String)e.next();
- int type = ((Integer)map.get(string)).intValue();
- result.add(new FileTypeInfo(string, type));
- }
- return (IFileTypeInfo[])result.toArray(new IFileTypeInfo[result.size()]);
- }
-
- /**
- * Return all known file types.
- *
- * @return all known file types
- */
- public static IFileTypeInfo[] getAllTypes() {
- return getFileTypeInfo(getFileTypeTable());
- }
-
- /**
- * Returns the list of global ignores.
- */
- public synchronized static IIgnoreInfo[] getAllIgnores() {
- if (globalIgnore == null) {
- globalIgnore = new TreeMap();
- pluginIgnore = new TreeMap();
- ignoreMatchers = null;
- try {
- readIgnoreState();
- } catch (TeamException e) {
- TeamPlugin.log(IStatus.ERROR, Policy.bind("Team.Error_loading_ignore_state_from_disk_1"), e); //$NON-NLS-1$
- }
- initializePluginIgnores(pluginIgnore, globalIgnore);
- }
- IIgnoreInfo[] result = getIgnoreInfo(globalIgnore);
- return result;
- }
-
- private static IIgnoreInfo[] getIgnoreInfo(Map gIgnore) {
- IIgnoreInfo[] result = new IIgnoreInfo[gIgnore.size()];
- Iterator e = gIgnore.keySet().iterator();
- int i = 0;
- while (e.hasNext() ) {
- final String pattern = (String)e.next();
- final boolean enabled = ((Boolean)gIgnore.get(pattern)).booleanValue();
- result[i++] = new IIgnoreInfo() {
- private String p = pattern;
- private boolean e = enabled;
- public String getPattern() {
- return p;
- }
- public boolean getEnabled() {
- return e;
- }
- };
- }
- return result;
- }
-
- private synchronized static StringMatcher[] getStringMatchers() {
- if (ignoreMatchers==null) {
- IIgnoreInfo[] ignorePatterns = getAllIgnores();
- Vector matchers = new Vector(ignorePatterns.length);
- for (int i = 0; i < ignorePatterns.length; i++) {
- if (ignorePatterns[i].getEnabled()) {
- matchers.add(new StringMatcher(ignorePatterns[i].getPattern(), true, false));
- }
- }
- ignoreMatchers = new StringMatcher[matchers.size()];
- matchers.copyInto(ignoreMatchers);
- }
- return ignoreMatchers;
- }
-
- private synchronized static SortedMap getFileTypeTable() {
- if (globalTypes == null) loadTextState();
- return globalTypes;
- }
-
- /**
- * Set the file type for the give extension to the given type.
- *
- * Valid types are:
- * Team.TEXT
- * Team.BINARY
- * Team.UNKNOWN
- *
- * @param extension the file extension
- * @param type the file type
- */
- public static void setAllTypes(String[] extensions, int[] types) {
- if (pluginTypes == null) {
- loadTextState();
- }
- globalTypes = new TreeMap();
- for (int i = 0; i < extensions.length; i++) {
- globalTypes.put(extensions[i], new Integer(types[i]));
- }
- // Now set into preferences
- StringBuffer buf = new StringBuffer();
- Iterator e = globalTypes.keySet().iterator();
- while (e.hasNext()) {
- String extension = (String)e.next();
- boolean isCustom = (!pluginTypes.containsKey(extension)) ||
- !((Integer)pluginTypes.get(extension)).equals(pluginTypes.get(extension));
- if (isCustom) {
- buf.append(extension);
- buf.append(PREF_TEAM_SEPARATOR);
- Integer type = (Integer)globalTypes.get(extension);
- buf.append(type);
- buf.append(PREF_TEAM_SEPARATOR);
- }
-
- }
- TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_TYPES, buf.toString());
- }
-
- /**
- * Add patterns to the list of global ignores.
- */
- public static void setAllIgnores(String[] patterns, boolean[] enabled) {
- globalIgnore = new TreeMap();
- ignoreMatchers = null;
- for (int i = 0; i < patterns.length; i++) {
- globalIgnore.put(patterns[i], new Boolean(enabled[i]));
- }
- // Now set into preferences
- StringBuffer buf = new StringBuffer();
- Iterator e = globalIgnore.keySet().iterator();
- while (e.hasNext()) {
- String pattern = (String)e.next();
- boolean isCustom = (!pluginIgnore.containsKey(pattern)) ||
- !((Boolean)pluginIgnore.get(pattern)).equals(globalIgnore.get(pattern));
- if (isCustom) {
- buf.append(pattern);
- buf.append(PREF_TEAM_SEPARATOR);
- boolean en = ((Boolean)globalIgnore.get(pattern)).booleanValue();
- buf.append(en);
- buf.append(PREF_TEAM_SEPARATOR);
- }
-
- }
- TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_IGNORES, buf.toString());
- }
-
- /*
- * TEXT
- *
- * Reads the text patterns currently defined by extensions.
- */
- private static void initializePluginPatterns(Map pTypes, Map fTypes) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.FILE_TYPES_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String ext = configElements[j].getAttribute("extension"); //$NON-NLS-1$
- if (ext != null) {
- String type = configElements[j].getAttribute("type"); //$NON-NLS-1$
- // If the extension doesn't already exist, add it.
- if (!fTypes.containsKey(ext)) {
- if (type.equals("text")) { //$NON-NLS-1$
- pTypes.put(ext, new Integer(TEXT));
- fTypes.put(ext, new Integer(TEXT));
- } else if (type.equals("binary")) { //$NON-NLS-1$
- fTypes.put(ext, new Integer(BINARY));
- pTypes.put(ext, new Integer(BINARY));
- }
- }
- }
- }
- }
- }
- }
- }
-
- /*
- * TEXT
- *
- * Read the saved file type state from the given input stream.
- *
- * @param dis the input stream to read the saved state from
- * @throws IOException if an I/O problem occurs
- */
- private static void readTextState(DataInputStream dis) throws IOException {
- int extensionCount = 0;
- try {
- extensionCount = dis.readInt();
- } catch (EOFException e) {
- // Ignore the exception, it will occur if there are no
- // patterns stored in the state file.
- return;
- }
- for (int i = 0; i < extensionCount; i++) {
- String extension = dis.readUTF();
- int type = dis.readInt();
- globalTypes.put(extension, new Integer(type));
- }
- }
-
- /*
- * TEXT
- *
- * Load the file type registry saved state. This loads the previously saved
- * contents, as well as discovering any values contributed by plug-ins.
- */
- private static void loadTextState() {
- globalTypes = new TreeMap();
- boolean old = loadBackwardCompatibleTextState();
- if (!old) loadTextPreferences();
- pluginTypes = new TreeMap();
- initializePluginPatterns(pluginTypes, globalTypes);
- if (old) TeamPlugin.getPlugin().savePluginPreferences();
- }
-
- private static void loadTextPreferences() {
- Preferences pref = TeamPlugin.getPlugin().getPluginPreferences();
- if (!pref.contains(PREF_TEAM_TYPES)) return;
- String prefTypes = pref.getString(PREF_TEAM_TYPES);
- StringTokenizer tok = new StringTokenizer(prefTypes, PREF_TEAM_SEPARATOR);
- String extension, integer;
- try {
- while (true) {
- extension = tok.nextToken();
- if (extension.length()==0) return;
- integer = tok.nextToken();
- globalTypes.put(extension, Integer.valueOf(integer));
- }
- } catch (NoSuchElementException e) {
- return;
- }
-
- }
- /*
- * If the workspace is an old 2.0 one, read the old file and delete it
- */
- private static boolean loadBackwardCompatibleTextState() {
- // File name of the persisted file type information
- String STATE_FILE = ".fileTypes"; //$NON-NLS-1$
- IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(STATE_FILE);
- File f = pluginStateLocation.toFile();
- if (!f.exists()) return false;
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(f));
- try {
- readTextState(dis);
- } finally {
- dis.close();
- }
- } catch (IOException ex) {
- TeamPlugin.log(Status.ERROR, ex.getMessage(), ex);
- return false;
- }
- f.delete();
- return true;
- }
-
- /*
- * IGNORE
- *
- * Reads the ignores currently defined by extensions.
- */
- private static void initializePluginIgnores(SortedMap pIgnore, SortedMap gIgnore) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.IGNORE_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String pattern = configElements[j].getAttribute("pattern"); //$NON-NLS-1$
- if (pattern != null) {
- String selected = configElements[j].getAttribute("enabled"); //$NON-NLS-1$
- if (selected == null) {
- // Check for selected because this used to be the field name
- selected = configElements[j].getAttribute("selected"); //$NON-NLS-1$
- }
- boolean enabled = selected != null && selected.equalsIgnoreCase("true"); //$NON-NLS-1$
- // if this ignore doesn't already exist, add it to the global list
- pIgnore.put(pattern, new Boolean(enabled));
- if (!gIgnore.containsKey(pattern)) {
- gIgnore.put(pattern, new Boolean(enabled));
- }
- }
- }
- }
- }
- }
- }
-
- /*
- * IGNORE
- *
- * Reads global ignore preferences and populates globalIgnore
- */
- private static void readIgnoreState() throws TeamException {
- if (readBackwardCompatibleIgnoreState()) return;
- Preferences pref = TeamPlugin.getPlugin().getPluginPreferences();
- if (!pref.contains(PREF_TEAM_IGNORES)) return;
- String prefIgnores = pref.getString(PREF_TEAM_IGNORES);
- StringTokenizer tok = new StringTokenizer(prefIgnores, PREF_TEAM_SEPARATOR);
- String pattern, enabled;
- try {
- while (true) {
- pattern = tok.nextToken();
- if (pattern.length()==0) return;
- enabled = tok.nextToken();
- globalIgnore.put(pattern, new Boolean(enabled));
- }
- } catch (NoSuchElementException e) {
- return;
- }
- }
-
- /*
- * For backward compatibility, we still look at if we have .globalIgnores
- */
- private static boolean readBackwardCompatibleIgnoreState() throws TeamException {
- String GLOBALIGNORE_FILE = ".globalIgnores"; //$NON-NLS-1$
- IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(GLOBALIGNORE_FILE);
- File f = pluginStateLocation.toFile();
- if (!f.exists()) return false;
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(f));
- try {
- int ignoreCount = 0;
- try {
- ignoreCount = dis.readInt();
- } catch (EOFException e) {
- // Ignore the exception, it will occur if there are no ignore
- // patterns stored in the provider state file.
- return false;
- }
- for (int i = 0; i < ignoreCount; i++) {
- String pattern = dis.readUTF();
- boolean enabled = dis.readBoolean();
- globalIgnore.put(pattern, new Boolean(enabled));
- }
- } finally {
- dis.close();
- }
- f.delete();
- } catch (FileNotFoundException e) {
- // not a fatal error, there just happens not to be any state to read
- } catch (IOException ex) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("Team.readError"), ex)); //$NON-NLS-1$
- }
- return true;
- }
- /**
- * Initialize the registry, restoring its state.
- *
- * This method is called by the plug-in upon startup, clients should not call this method
- */
- public static void startup() throws CoreException {
- // Register a delta listener that will tell the provider about a project move
- ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta[] projectDeltas = event.getDelta().getAffectedChildren();
- for (int i = 0; i < projectDeltas.length; i++) {
- IResourceDelta delta = projectDeltas[i];
- IResource resource = delta.getResource();
- // Only consider project additions that are moves
- if (delta.getKind() != IResourceDelta.ADDED) continue;
- if ((delta.getFlags() & IResourceDelta.MOVED_FROM) == 0) continue;
- // Only consider projects that have a provider
- if (!RepositoryProvider.isShared(resource.getProject())) continue;
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject());
- if (provider == null) continue;
- // Only consider providers whose project is not mapped properly already
- if (provider.getProject().equals(resource.getProject())) continue;
- // Tell the provider about it's new project
- provider.setProject(resource.getProject());
- }
- }
- }, IResourceChangeEvent.POST_CHANGE);
- ResourcesPlugin.getWorkspace().addResourceChangeListener((DeploymentProviderManager)getDeploymentManager(), IResourceChangeEvent.PRE_AUTO_BUILD);
- }
-
- /**
- * Shut down the registry, persisting its state.
- *
- * This method is called by the plug-in upon shutdown, clients should not call this method
- */
- public static void shutdown() {
- TeamPlugin.getPlugin().savePluginPreferences();
- }
- public static IProjectSetSerializer getProjectSetSerializer(String id) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.PROJECT_SET_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
- if (extensionId != null && extensionId.equals(id)) {
- try {
- return (IProjectSetSerializer)configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- TeamPlugin.log(e);
- return null;
- }
- }
- }
- }
- }
- }
- return null;
- }
- private static TeamException wrapException(String message, CoreException e) {
- MultiStatus status = new MultiStatus(TeamPlugin.ID, 0, message, e);
- status.merge(e.getStatus());
- return new TeamException(status);
- }
-
- private static String getFileExtension(String name) {
- if (name == null) return null;
- int index = name.lastIndexOf('.');
- if (index == -1)
- return null;
- if (index == (name.length() - 1))
- return ""; //$NON-NLS-1$
- return name.substring(index + 1);
- }
-
- /**
- * @return
- */
- public static IIgnoreInfo[] getDefaultIgnores() {
- SortedMap gIgnore = new TreeMap();
- SortedMap pIgnore = new TreeMap();
- initializePluginIgnores(pIgnore, gIgnore);
- return getIgnoreInfo(gIgnore);
- }
-
- /**
- * @return
- */
- public static IFileTypeInfo[] getDefaultTypes() {
- SortedMap gTypes = new TreeMap();
- SortedMap pTypes = new TreeMap();
- initializePluginPatterns(pTypes, gTypes);
- return getFileTypeInfo(gTypes);
- }
-
- /**
- * Returns the deployment manager.
- * @return the deployment manager
- * @since 3.0
- */
- public static IDeploymentProviderManager getDeploymentManager() {
- if(deploymentManager == null) {
- deploymentManager = new DeploymentProviderManager();
- }
- return deploymentManager;
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java
deleted file mode 100644
index 7566126b3..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * This exception is thrown by the team provider API. It represents a failure in an API call.
- * Since some API calls take multiple arguments, the exception is capable of returning multiple
- * statuses. The API definition determinies if the exception represents a single or multiple status
- * response; this can also be tested on the exception instance itself.
- * <p>
- * To determine the exact cause of the failure the caller should look at each status in detail.</p>
- *
- * @since 2.0
- */
-public class TeamException extends CoreException {
-
- // The operation completed successfully.
- public static final int OK = 0;
-
- // The operation failed because the resource is not checked-in.
- public static final int NOT_CHECKED_IN = -1;
-
- // The operation failed because the resource is not checked-out.
- public static final int NOT_CHECKED_OUT = -2;
-
- // The corresponding remote resource no longer exists or was never created.
- public static final int NO_REMOTE_RESOURCE = -3;
-
- // The provider suffered an IO failure, the operation may be retried.
- public static final int IO_FAILED = -4;
-
- // The user is not authorized to execute the attempted operation.
- public static final int NOT_AUTHORIZED = -5;
-
- // The provider was unable to complete the operation for an unspecified reason.
- public static final int UNABLE = -6;
-
- // The operation cannot be performed due to a conflict with other work.
- public static final int CONFLICT = -7;
-
- public TeamException(IStatus status) {
- super(status);
- }
-
- public TeamException(String message, Throwable e) {
- super(new Status(IStatus.ERROR, TeamPlugin.ID, 0, message, e));
- }
-
- public TeamException(String message) {
- this(message, null);
- }
-
- protected TeamException(CoreException e) {
- super(asStatus(e));
- }
-
- private static Status asStatus(CoreException e) {
- IStatus status = e.getStatus();
- return new Status(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), e);
- }
-
- public static TeamException asTeamException(CoreException e) {
- if (e instanceof TeamException) {
- return (TeamException)e;
- }
- return new TeamException(e);
- }
-
- /*
- * Static helper methods for creating exceptions
- */
- public static TeamException asTeamException(InvocationTargetException e) {
- Throwable target = e.getTargetException();
- if (target instanceof TeamException) {
- return (TeamException) target;
- }
- return new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, UNABLE, target.getMessage() != null ? target.getMessage() : "", target)); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java
deleted file mode 100644
index d34799b10..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Status;
-
-public class TeamStatus extends Status implements ITeamStatus {
-
- private IResource resource;
-
- /**
- * Create a new status object.
- * @param severity the severity; one of <code>OK</code>,
- * <code>ERROR</code>, <code>INFO</code>, or <code>WARNING</code>
- * @param pluginId the unique identifier of the relevant plug-in
- * @param code the plug-in-specific status code, or <code>OK</code>
- * @param message a human-readable message, localized to the
- * current locale
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- * @param resource the resource asociated with the exception
- */
- public TeamStatus(int severity, String pluginId, int code, String message, Throwable exception, IResource resource) {
- super(severity, pluginId, code, message, exception);
- if (resource == null) {
- this.resource = ResourcesPlugin.getWorkspace().getRoot();
- } else {
- this.resource = resource;
- }
- }
-
- /**
- * Return the resource associated with this status.
- * @return Returns the resource.
- */
- public IResource getResource() {
- return resource;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html
deleted file mode 100644
index 998490f0d..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html
+++ /dev/null
@@ -1,20 +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 interfaces for defining and working with repository providers.
-<h2>
-Package Specification</h2>
-This package specifies the API for defining repository providers. A repository
-provider supports the sharing of projects in the local Eclipse workspace
-with remote locations managed by a particular type of repository system.
-Additional facilites included in this API exist for the mapping and unmapping of a
-repository provider to a project, the deifnition of a project set serializer for
-sharing workspace setup, and the management of global ignore patterns and content type
-determination for files.
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FilteredSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FilteredSyncInfoCollector.java
deleted file mode 100644
index 7430b54f0..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FilteredSyncInfoCollector.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.subscribers;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * Populates an output <code>SyncInfoSet</code> with the <code>SyncInfo</code> from an
- * input <code>SyncInfoSet</code> which match a <code>SyncInfoFilter</code>. The collector
- * also dynamically updates the output set in reaction to changes in the input set.
- * <p>
- * This class is not intended to be subclassed by clients
- *
- * @see SyncInfoSet
- * @see SyncInfoFilter
- *
- * @since 3.0
- */
-public final class FilteredSyncInfoCollector implements ISyncInfoSetChangeListener {
-
- private SyncInfoSet inputSet;
- private SyncInfoSet outputSet;
- private SyncInfoFilter filter;
-
- /**
- * Create a filtered sync info collector that collects sync info from the input set.
- * @param collector the collector that provides the source set
- * @param inputSet the input set
- * @param outputSet the output set
- * @param filter the filter to be applied to the output set
- */
- public FilteredSyncInfoCollector(SyncInfoSet inputSet, SyncInfoSet outputSet, SyncInfoFilter filter) {
- this.inputSet = inputSet;
- this.outputSet = outputSet;
- this.filter = filter;
- }
-
- /**
- * Start the collector. After this method returns the output <code>SyncInfoSet</code>
- * of the collector will be populated.
- */
- public void start(IProgressMonitor monitor) {
- inputSet.connect(this, monitor);
- }
-
- /**
- * Return the output <code>SyncInfoSet</code> that contains the filtered <code>SyncInfo</code>.
- * @return the output <code>SyncInfoSet</code>
- */
- public SyncInfoSet getSyncInfoSet() {
- return outputSet;
- }
-
- /**
- * Return the filter used by this collector.
- * @return the filter
- */
- public SyncInfoFilter getFilter() {
- return filter;
- }
-
- /**
- * Dispose of the collector. The collector cannot be restarted after it has been disposed.
- */
- public void dispose() {
- if (inputSet == null) return;
- inputSet.removeSyncSetChangedListener(this);
- inputSet = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- SyncInfoSet syncSet = getSyncInfoSet();
- try {
- syncSet.beginInput();
- monitor.beginTask(null, 100);
- syncSet.clear();
- syncSetChanged(set.getSyncInfos(), Policy.subMonitorFor(monitor, 95));
- } finally {
- syncSet.endInput(Policy.subMonitorFor(monitor, 5));
- monitor.done();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoChanged(org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- SyncInfoSet syncSet = getSyncInfoSet();
- try {
- syncSet.beginInput();
- monitor.beginTask(null, 105);
- syncSetChanged(event.getChangedResources(), Policy.subMonitorFor(monitor, 50));
- syncSetChanged(event.getAddedResources(), Policy.subMonitorFor(monitor, 50));
- remove(event.getRemovedResources());
- } finally {
- syncSet.endInput(Policy.subMonitorFor(monitor, 5));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- SyncInfoSet syncSet = getSyncInfoSet();
- try {
- syncSet.beginInput();
- for (int i = 0; i < errors.length; i++) {
- ITeamStatus status = errors[i];
- syncSet.addError(status);
- }
- } finally {
- syncSet.endInput(monitor);
- }
- }
-
- private void remove(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- remove(resources[i]);
- }
- }
-
- private void remove(IResource resource) {
- SyncInfoSet syncSet = getSyncInfoSet();
- SyncInfo oldInfo = syncSet.getSyncInfo(resource);
- if (oldInfo != null) {
- syncSet.remove(resource);
- }
- }
-
- private void syncSetChanged(SyncInfo[] infos, IProgressMonitor monitor) {
- for (int i = 0; i < infos.length; i++) {
- collect(infos[i], monitor);
- }
- }
-
- private void collect(SyncInfo info, IProgressMonitor monitor) {
- SyncInfoSet syncSet = getSyncInfoSet();
- boolean isOutOfSync = filter.select(info, monitor);
- SyncInfo oldInfo = syncSet.getSyncInfo(info.getLocal());
- boolean wasOutOfSync = oldInfo != null;
- if (isOutOfSync) {
- syncSet.add(info);
- } else if (wasOutOfSync) {
- syncSet.remove(info.getLocal());
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeEvent.java
deleted file mode 100644
index 0f644794a..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeEvent.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.core.subscribers;
-import org.eclipse.core.resources.IResource;
-public interface ISubscriberChangeEvent {
- /*====================================================================
- * Constants defining the kinds of team changes to resources:
- *====================================================================*/
- /**
- * Delta kind constant indicating that the resource has not been changed in any way
- * @see IResourceDelta#getKind
- */
- public static final int NO_CHANGE = 0;
- /**
- * Delta kind constant (bit mask) indicating that the synchronization state of a resource has changed.
- */
- public static final int SYNC_CHANGED = 0x1;
- /**
- * Delta kind constant (bit mask) indicating that a team provider has been configured on the resource.
- * @see IResourceDelta#getKind
- */
- public static final int ROOT_ADDED = 0x2;
- /**
- * Delta kind constant (bit mask) indicating that a team provider has been de-configured on the resource.
- * @see IResourceDelta#getKind
- */
- public static final int ROOT_REMOVED = 0x4;
- public abstract int getFlags();
- public abstract IResource getResource();
- public abstract Subscriber getSubscriber();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeListener.java
deleted file mode 100644
index 4360d33f3..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberChangeListener.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.core.subscribers;
-
-
-import java.util.EventListener;
-
-/**
- * A resource state change listener is notified of changes to resources
- * regarding their team state.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see ITeamManager#addResourceStateChangeListener(IResourceStateChangeListener)
- */
-public interface ISubscriberChangeListener extends EventListener{
-
- /**
- * Notifies this listener that some resources' team properties have
- * changed. The changes have already happened. For example, a resource's
- * base revision may have changed. The resource tree is open for modification
- * when this method is invoked, so markers can be created, etc.
- * <p>
- * Note: This method is called by Team core; it is not intended to be
- * called directly by clients.
- * </p>
- *
- * @param deltas detailing the kinds of team changes
- *
- * [Note: The changed state event is purposely vague. For now it is only
- * a hint to listeners that they should query the provider to determine the
- * resources new sync info.]
- */
- public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas);
-}
-
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
deleted file mode 100644
index acafd2105..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.subscribers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.synchronize.IResourceVariantComparator;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * A Subscriber provides synchronization between local resources and a
- * remote location that is used to share those resources.
- * <p>
- * When queried for the <code>SyncInfo</code> corresponding to a local resource using
- * <code>getSyncInfo(IResource)</code>, the subscriber should not contact the server.
- * Server round trips should only occur within the <code>refresh<code>
- * method of the subscriber. Consequently,
- * the implementation of a subscriber must cache enough state information for a remote resource to calculate the
- * synchronization state without contacting the server. During a refresh, the latest remote resource state
- * information should be fetched and cached. For
- * a subscriber that supports three-way compare, the refresh should also fetch the latest base state unless this is
- * available by some other means (e.g. for some repository tools, the base state is persisted on disk with the
- * local resources).
- * </p>
- * <p>
- * After a refresh, the subscriber must notify any listeners of local resources whose corresponding remote resource
- * or base resource changed. The subscriber does not need to notify listeners when the state changes due to a local
- * modification since local changes are available through the <code>IResource</code> delta mechanism. However,
- * the subscriber must
- * cache enough information (e..g the local timestamp of when the file was in-sync with its corresponding remote
- * resource)
- * to determine if the file represents an outgoing change so that <code>SyncInfo</code> obtained
- * after a delta will indicate that the file has an outgoing change. The subscriber must also notify listeners
- * when roots and added
- * or removed. For example, a subscriber for a repository provider would fire a root added event when a project
- * was shared
- * with a repository. No event is required when a root is deleted as this is available through the
- * <code>IResource</code> delta mechanism. It is up to clients to requery the subscriber
- * when the state of a resource changes locally by listening to IResource deltas.
- * </p>
- * <p>
- * The remote and base states can also include the state for resources that do not exist locally (i.e outgoing deletions
- * or incoming additions). When queried for the members of a local resource, the subscriber should include any children
- * for which a remote exists even if the local does not.
- *
- */
-abstract public class Subscriber {
-
- private List listeners = new ArrayList(1);
-
- /**
- * Return the name of this subscription, in a format that is
- * suitable for display to an end user.
- *
- * @return String representing the name of this subscription.
- */
- abstract public String getName();
-
- /**
- * Returns <code>true</code> if this resource is supervised by this
- * subscriber. A supervised resource is one for which this subscriber
- * maintains the synchronization state. Supervised resources are the only
- * resources returned when <code>members(IResource)</code> was invoked with the parent
- * of the resource. Returns <code>false</code> in all
- * other cases.
- *
- * @return <code>true</code> if this resource is supervised, and <code>false</code>
- * otherwise
- */
- abstract public boolean isSupervised(IResource resource) throws TeamException;
-
- /**
- * Returns all non-transient member resources of the given resource. The
- * result will include entries for resources that exist either in the
- * workspace or are implicated in an incoming change. Returns an empty list
- * if the given resource exists neither in the workspace nor in the
- * corresponding team stream, or if the given resource is transient.
- * <p>
- * This is a fast operation; the repository is not contacted.
- * </p>
- * <p>
- * [Issue1 : Is there any filtering on the members? Just the ones that
- * changed in some way, or *every member*? ]
- * </p>
- *
- * @param resource
- * the resource
- * @return a list of member resources
- * @exception TeamException
- * if this request fails. Reasons include:
- */
- abstract public IResource[] members(IResource resource) throws TeamException;
-
- /**
- * Returns the list of root resources this subscriber considers for
- * synchronization. A client should call this method first then can safely
- * call <code>members</code> to navigate the resources managed by this
- * subscriber.
- *
- * @return a list of resources
- * @throws TeamException
- */
- abstract public IResource[] roots();
-
- /**
- * Returns synchronization info for the given resource, or <code>null</code>
- * if there is no synchronization info because the subscriber does not
- * apply to this resource.
- * <p>
- * Note that sync info may be returned for non-existing or for resources
- * which have no corresponding remote resource.
- * </p>
- * <p>
- * This method may take some time; it depends on the comparison criteria
- * that is used to calculate the synchronization state (e.g. using content
- * or only timestamps).
- * </p>
- *
- * @param resource
- * the resource of interest
- * @return sync info
- */
- abstract public SyncInfo getSyncInfo(IResource resource) throws TeamException;
-
- /**
- * Returns the comparison criteria that will be used by the sync info
- * created by this subscriber.
- */
- abstract public IResourceVariantComparator getResourceComparator();
-
- /**
- * Refreshes the resource hierarchy from the given resources and their
- * children (to the specified depth) from the corresponding resources in
- * the remote location. Resources are ignored in the following cases:
- * <ul>
- * <li>if they do not exist either in the workspace or in the
- * corresponding remote location</li>
- * <li>if the given resource is not managed by this subscriber</li>
- * <li>if the given resource is a closed project (they are ineligible for
- * synchronization)</li>
- * <p>
- * Typical synchronization operations use the statuses computed by this
- * method as the basis for determining what to do. It is possible for the
- * actual sync status of the resource to have changed since the current
- * local sync status was refreshed. Operations typically skip resources
- * with stale sync information. The chances of stale information being used
- * can be reduced by running this method (where feasible) before doing
- * other operations. Note that this will of course affect performance.
- * </p>
- * <p>
- * The depth parameter controls whether refreshing is performed on just the
- * given resource (depth= <code>DEPTH_ZERO</code>), the resource and its
- * children (depth= <code>DEPTH_ONE</code>), or recursively to the
- * resource and all its descendents (depth= <code>DEPTH_INFINITE</code>).
- * Use depth <code>DEPTH_ONE</code>, rather than depth <code>DEPTH_ZERO</code>,
- * to ensure that new members of a project or folder are detected.
- * </p>
- * <p>
- * This method might change resources; any changes will be reported in a
- * subsequent resource change event indicating changes to server sync
- * status.
- * </p>
- * <p>
- * This method contacts the server and is therefore long-running; progress
- * and cancellation are provided by the given progress monitor.
- * </p>
- *
- * @param resources
- * the resources
- * @param depth
- * valid values are <code>DEPTH_ZERO</code>,<code>DEPTH_ONE</code>,
- * or <code>DEPTH_INFINITE</code>
- * @param monitor
- * progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return status with code <code>OK</code> if there were no problems;
- * otherwise a description (possibly a multi-status) consisting of
- * low-severity warnings or informational messages.
- * @exception TeamException
- * if this method fails. Reasons include:
- * <ul>
- * <li>The server could not be contacted.</li>
- * </ul>
- */
- abstract public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException;
-
- /**
- * Adds a listener to this team subscriber. Has no effect if an identical
- * listener is already registered.
- * <p>
- * Team resource change listeners are informed about state changes that
- * affect the resources supervised by this subscriber.
- * </p>
- *
- * @param listener
- * a team resource change listener
- */
- public void addListener(ISubscriberChangeListener listener) {
- synchronized (listeners) {
- if (!listeners.contains(listener)) {
- listeners.add(listener);
- }
- }
- }
-
- /**
- * Removes a listener previously registered with this team subscriber. Has
- * no affect if an identical listener is not registered.
- *
- * @param listener
- * a team resource change listener
- */
- public void removeListener(ISubscriberChangeListener listener) {
- synchronized (listeners) {
- listeners.remove(listener);
- }
- }
-
- /**
- * Adds all out-of-sync resources (getKind() != 0) that occur
- * under the given resources to the specified depth. The purpose of this
- * method is to provide subscribers a means of optimizing the determination
- * of all out-of-sync out-of-sync descendants of a set of resources.
- * <p>
- * If any of the directly provided resources are not supervised by the subscriber, then
- * they should be removed from the set.
- * If errors occur while determining the sync info for the resources, they should
- * be added to the set using <code>addError</code>.
- *
- * @param resources the root of the resource subtrees from which out-of-sync sync info should be collected
- * @param depth the depth to which sync info should be collected
- * (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @param set the sync info set to which out-of-sync resources should be added (or removed). Any errors
- * should be added to the set as well.
- * @param monitor a progress monitor
- */
- public void collectOutOfSync(IResource[] resources, int depth, SyncInfoSet set, IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IProgressMonitor subMonitor = Policy.subMonitorFor(monitor, 100);
- subMonitor.beginTask(null, IProgressMonitor.UNKNOWN);
- collect(resource, depth, set, subMonitor);
- subMonitor.done();
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Fires a team resource change event to all registered listeners Only
- * listeners registered at the time this method is called are notified.
- * Listener notification makes use of an ISafeRunnable to ensure that
- * client exceptions do not effect the notification to other clients.
- */
- protected void fireTeamResourceChange(final ISubscriberChangeEvent[] deltas) {
- ISubscriberChangeListener[] allListeners;
- // Copy the listener list so we're not calling client code while synchronized
- synchronized (listeners) {
- allListeners = (ISubscriberChangeListener[]) listeners.toArray(new ISubscriberChangeListener[listeners.size()]);
- }
- // Notify the listeners safely so all will receive notification
- for (int i = 0; i < allListeners.length; i++) {
- final ISubscriberChangeListener listener = allListeners[i];
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // don't log the exception....it is already being logged in
- // Platform#run
- }
- public void run() throws Exception {
- listener.subscriberResourceChanged(deltas);
- }
- });
- }
- }
-
- /*
- * 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,
- SyncInfoSet set,
- IProgressMonitor monitor) {
-
- if (resource.getType() != IResource.FILE
- && depth != IResource.DEPTH_ZERO) {
- try {
- IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- collect(
- members[i],
- depth == IResource.DEPTH_INFINITE
- ? IResource.DEPTH_INFINITE
- : IResource.DEPTH_ZERO,
- set,
- monitor);
- }
- } catch (TeamException e) {
- set.addError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, ITeamStatus.SYNC_INFO_SET_ERROR, Policy.bind("SubscriberEventHandler.8", resource.getFullPath().toString(), e.getMessage()), e, resource)); //$NON-NLS-1$
- }
- }
-
- monitor.subTask(Policy.bind("SubscriberEventHandler.2", resource.getFullPath().toString())); //$NON-NLS-1$
- try {
- SyncInfo info = getSyncInfo(resource);
- if (info == null) {
- // Resource is no longer under the subscriber control.
- // This can occur for the resources past as arguments to collectOutOfSync
- set.remove(resource);
- } else {
- set.add(info);
- }
- } catch (TeamException e) {
- set.addError(new TeamStatus(
- IStatus.ERROR, TeamPlugin.ID, ITeamStatus.RESOURCE_SYNC_INFO_ERROR,
- Policy.bind("SubscriberEventHandler.9", resource.getFullPath().toString(), e.getMessage()), //$NON-NLS-1$
- e, resource));
- }
- // Tick the monitor to give the owner a chance to do something
- monitor.worked(1);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java
deleted file mode 100644
index 13c0de9c4..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.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.core.subscribers;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * A concrete implementation of <code>ISubscriberChangeEvent</code> that can
- * be used by clients.
- *
- * @see IResource
- * @see ITeamProvider
- */
-public class SubscriberChangeEvent implements ISubscriberChangeEvent {
-
- private Subscriber subscriber;
- private int flags;
- private IResource resource;
-
- public SubscriberChangeEvent(Subscriber subscriber, int flags, IResource resource) {
- this.subscriber = subscriber;
- this.flags = flags;
- this.resource = resource;
- }
-
- public int getFlags() {
- return flags;
- }
-
- public IResource getResource() {
- return resource;
- }
-
- public Subscriber getSubscriber() {
- return subscriber;
- }
-
- /**
- * Returns an array of deltas for the resources with SubscriberChangeEvent.SYNC_CHANGED
- * as the change type.
- * @param resources the resources whose sync info has changed
- * @return an array of events
- */
- public static SubscriberChangeEvent[] asSyncChangedDeltas(Subscriber subscriber, IResource[] resources) {
- SubscriberChangeEvent[] deltas = new SubscriberChangeEvent[resources.length];
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- deltas[i] = new SubscriberChangeEvent(subscriber, ISubscriberChangeEvent.SYNC_CHANGED, resource);
- }
- return deltas;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
deleted file mode 100644
index 8597675c0..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.subscribers;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.core.subscribers.*;
-
-/**
- * This collector maintains a {@link SyncInfoSet} for a particular team subscriber keeping
- * it up-to-date with both incoming changes and outgoing changes as they occur for
- * resources in the workspace. The collector can be configured to consider all the subscriber's
- * roots or only a subset.
- * <p>
- * The advantage of this collector is that it processes both resource and team
- * subscriber deltas in a background thread.
- * </p>
- * @since 3.0
- */
-public final class SubscriberSyncInfoCollector implements IResourceChangeListener, ISubscriberChangeListener {
-
- private SyncSetInputFromSubscriber subscriberInput;
- private WorkingSetSyncSetInput workingSetInput;
- private SyncSetInputFromSyncSet filteredInput;
- private SubscriberEventHandler eventHandler;
- private Subscriber subscriber;
- private IResource[] roots;
-
- /**
- * Create a collector on the subscriber that collects out-of-sync resources
- * for all roots of the subscriber. The <code>start()</code> method must be called after creation
- * to prime the collector's sync sets.
- * @param subscriber the Subscriber
- */
- public SubscriberSyncInfoCollector(Subscriber subscriber) {
- this(subscriber, null /* use the subscriber roots */);
- }
-
- /**
- * Create a collector that collects out-of-sync resources that are children of
- * the given roots. If the roots are <code>null</code>, then all out-of-sync resources
- * from the subscriber are collected. An empty array of roots will cause no resources
- * to be collected. The <code>start()</code> method must be called after creation
- * to rpime the collector's sync sets.
- * @param subscriber the Subscriber
- * @param roots the roots of the out-of-sync resources to be collected
- */
- public SubscriberSyncInfoCollector(Subscriber subscriber, IResource[] roots) {
- this.roots = roots;
- this.subscriber = subscriber;
- Assert.isNotNull(subscriber);
- this.eventHandler = new SubscriberEventHandler(subscriber);
- this.subscriberInput = eventHandler.getSyncSetInput();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
- subscriber.addListener(this);
-
- // TODO: optimize and don't use working set if no roots are passed in
- workingSetInput = new WorkingSetSyncSetInput(subscriberInput.getSyncSet(), getEventHandler());
- filteredInput = new SyncSetInputFromSyncSet(workingSetInput.getSyncSet(), getEventHandler());
- filteredInput.setFilter(new SyncInfoFilter() {
- public boolean select(SyncInfo info, IProgressMonitor monitor) {
- return true;
- }
- });
- }
-
- public void setProgressGroup(IProgressMonitor monitor, int ticks) {
- getEventHandler().setProgressGroupHint(monitor, ticks);
- }
-
- /**
- * Start the collector.
- */
- public void start() {
- eventHandler.start();
- }
-
- /**
- * Return the set that provides access to the out-of-sync resources for the collector's
- * subscriber that are descendants of the roots for the collector,
- * are in the collector's working set and match the collectors filter.
- * @see getSubscriberSyncInfoSet()
- * @see getWorkingSetSyncInfoSet()
- * @return a SyncInfoSet containing out-of-sync resources
- */
- public SyncInfoTree getSyncInfoTree() {
- return filteredInput.getSyncSet();
- }
-
- /**
- * This causes the calling thread to wait any background collection of out-of-sync resources
- * to stop before returning.
- * @param monitor a progress monitor
- */
- public void waitForCollector(IProgressMonitor monitor) {
- monitor.worked(1);
- // wait for the event handler to process changes.
- while(eventHandler.getEventHandlerJob().getState() != Job.NONE) {
- monitor.worked(1);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- }
- }
- monitor.worked(1);
- }
-
- /**
- * Clears this collector's sync info sets and causes them to be recreated from the
- * associated <code>Subscriber</code>. The reset will occur in the background. If the
- * caller wishes to wait for the reset to complete, they should call
- * {@link waitForCollector(IProgressMonitor)}.
- */
- public void reset() {
- eventHandler.reset(getRoots());
- }
-
- /**
- * Returns the <code>Subscriber</code> associated with this collector.
- *
- * @return the <code>Subscriber</code> associated with this collector.
- */
- public Subscriber getSubscriber() {
- return subscriber;
- }
-
- /**
- * Disposes of the background job associated with this collector and deregisters
- * all it's listeners. This method must be called when the collector is no longer
- * referenced and could be garbage collected.
- */
- public void dispose() {
- eventHandler.shutdown();
- subscriberInput.disconnect();
- workingSetInput.disconnect();
- if(filteredInput != null) {
- filteredInput.disconnect();
- }
- getSubscriber().removeListener(this);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- }
-
- /**
- * Process the resource delta and posts all necessary events to the background
- * event handler.
- *
- * @param delta the resource delta to analyse
- */
- private void processDelta(IResourceDelta delta) {
- IResource resource = delta.getResource();
- int kind = delta.getKind();
-
- if (resource.getType() == IResource.PROJECT) {
- // Handle a deleted project
- if (((kind & IResourceDelta.REMOVED) != 0)) {
- eventHandler.remove(resource);
- return;
- }
- // Handle a closed project
- if ((delta.getFlags() & IResourceDelta.OPEN) != 0 && !((IProject) resource).isOpen()) {
- eventHandler.remove(resource);
- return;
- }
- // Only interested in projects mapped to the provider
- if (!isAncestorOfRoot(resource)) {
- // If the project has any entries in the sync set, remove them
- if (getSyncInfoTree().hasMembers(resource)) {
- eventHandler.remove(resource);
- }
- return;
- }
- }
-
- boolean visitChildren = false;
- if (isDescendantOfRoot(resource)) {
- visitChildren = true;
- // 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
- if (visitChildren || isAncestorOfRoot(resource)) {
- IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED | IResourceDelta.ADDED);
- for (int i = 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i]);
- }
- }
- }
-
- private boolean isAncestorOfRoot(IResource parent) {
- // Always traverse into projects in case a root was removed
- if (parent.getType() == IResource.ROOT) return true;
- IResource[] roots = getRoots();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
- if (parent.getFullPath().isPrefixOf(resource.getFullPath())) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isDescendantOfRoot(IResource resource) {
- IResource[] roots = getRoots();
- for (int i = 0; i < roots.length; i++) {
- IResource root = roots[i];
- if (root.getFullPath().isPrefixOf(resource.getFullPath())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return the roots that are being considered by this collector.
- * By default, the collector is interested in the roots of its
- * subscriber. However, the set can be reduced using {@link setRoots(IResource)).
- * @return
- */
- public IResource[] getRoots() {
- if (roots == null) {
- return getSubscriber().roots();
- } else {
- return roots;
- }
- }
-
- /*
- * Returns whether the collector is configured to collect for
- * all roots of the subscriber or not
- * @return <code>true</code> if the collector is considering all
- * roots of the subscriber and <code>false</code> otherwise
- */
- private boolean isAllRootsIncluded() {
- return roots == null;
- }
-
- /*
- * (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 subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- for (int i = 0; i < deltas.length; i++) {
- switch (deltas[i].getFlags()) {
- case ISubscriberChangeEvent.SYNC_CHANGED :
- if (isAllRootsIncluded() || isDescendantOfRoot(deltas[i].getResource())) {
- eventHandler.change(deltas[i].getResource(), IResource.DEPTH_ZERO);
- }
- break;
- case ISubscriberChangeEvent.ROOT_REMOVED :
- eventHandler.remove(deltas[i].getResource());
- break;
- case ISubscriberChangeEvent.ROOT_ADDED :
- if (isAllRootsIncluded() || isDescendantOfRoot(deltas[i].getResource())) {
- eventHandler.change(deltas[i].getResource(), IResource.DEPTH_INFINITE);
- }
- break;
- }
- }
- }
-
- /**
- * Set the roots that are to be considered by the collector. The provided
- * resources should be either a subset of the roots of the collector's subscriber
- * or children of those roots. Other resources can be provided but will be ignored.
- * Setting the roots to <code>null</code> will cause the roots of the subscriber
- * to be used
- * @param roots The roots to be considered or <code>null</code>.
- */
- public void setRoots(IResource[] roots) {
- this.roots = roots;
- }
-
- /**
- * Return the event handler that performs the background processing for this collector.
- * The event handler also serves the purpose of serializing the modifications and adjustments
- * to the collector's sync sets in order to ensure that the state of the sets is kept
- * consistent.
- * @return Returns the eventHandler.
- */
- protected SubscriberEventHandler getEventHandler() {
- return eventHandler;
- }
-
- /**
- * Set the working set resources used to filter the output <code>SyncInfoSet</code>.
- * @see getWorkingSetSyncInfoSet()
- * @param resources the working set resources
- */
- public void setWorkingSet(IResource[] resources) {
- workingSetInput.setWorkingSet(resources);
- workingSetInput.reset();
- }
-
- /**
- * Get th working set resources used to filter the output sync info set.
- * @return the working set resources
- */
- public IResource[] getWorkingSet() {
- return workingSetInput.getWorkingSet();
- }
-
- /**
- * Set the filter for this collector. Only elements that match the filter will
- * be in the out sync info set.
- * @see getSyncInfoSet()
- * @param filter the sync info filter
- */
- public void setFilter(SyncInfoFilter filter) {
- filteredInput.setFilter(filter);
- filteredInput.reset();
- }
-
- /**
- * Return the filter that is filtering the output of this collector.
- * @return a sync info filter
- */
- public SyncInfoFilter getFilter() {
- if(filteredInput != null) {
- return filteredInput.getFilter();
- }
- return null;
- }
-
- /**
- * Return a <code>SyncInfoSet</code> that contains the out-of-sync elements
- * from the subsciber sync info set filtered
- * by the working set resources but not the collector's <code>SyncInfoFilter</code>.
- * @see getSubscriberSyncInfoSet()
- * @return a <code>SyncInfoSet</code>
- */
- public SyncInfoSet getWorkingSetSyncInfoSet() {
- return workingSetInput.getSyncSet();
- }
-
- /**
- * Return the <code>SyncInfoSet</code> that contains all the all the out-of-sync resources for the
- * subscriber that are descendants of the roots of this collector. The set will contain only those resources that are children of the roots
- * of the collector unless the roots of the colletor has been set to <code>null</code>
- * in which case all out-of-sync resources from the subscriber are collected.
- * @return the subscriber sync info set
- */
- public SyncInfoSet getSubscriberSyncInfoSet() {
- return subscriberInput.getSyncSet();
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/package.html b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/package.html
deleted file mode 100644
index e590138cb..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/package.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta content="text/html; charset=iso-8859-1"
- http-equiv="Content-Type">
- <meta content="IBM" name="Author">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Application programming interfaces for generating and refreshing
-synchronization state.
-<h2>Package Specification</h2>
-<p>This package specifies the API for Team subscribers. A Subscriber
-provides access to the synchronization state between the local
-workspace resources and a set of variants of those resources, whether
-it be a code repository or some other type of server (e.g. FTP). A
-subscriber is typically associated with only a subset of the resources
-in the local workspace, referred to as the set of resources the
-subscriber supervises. The supervised local resources have a
-corresponding variant state which describes the state of the remote
-resources that correspond to the local resources.</p>
-<p>A Subscriber provides:</p>
-<ul>
- <li>a set of root resources that define the subset of resources in
-the workspace that the subscriber supervises (some children of the
-roots may not be supervised, as indicated by the isSupervised method).</li>
- <li>access to the synchronization state (using SyncInfo) between the
-resources it supervises and their corresponding variant resources.</li>
- <li> the ability to refresh the the remote state</li>
- <li>change notification to registered listeners (of type
-ISubscriberChangeListener) when the variant state changes or when roots
-are added or removed.</li>
-</ul>
-<h3>Implementing a Subscriber </h3>
-<p>An implementation of a subscriber must provide:
-</p>
-<ul>
- <li>a subclass of Subcriber which maintains the synchronization state
-between its local resources and their corresponding variants.</li>
- <li>an implemenation of IResourceVariant which provides access to the
-contents and other state of a variant resource that corresponds to a
-local resource</li>
- <li>an implementation of IResourceVariantComparator which is used by
-SyncInfo to determine the synchronization state of a resource.</li>
-</ul>
-Optionally, a subscriber may provide a subclass of SyncInfo in order to
-customize the algorithm used to
-determine the synchronization state of a resource.
-<p></p>
-<h3>Additional Classes</h3>
-<p>The SubscriberSyncInfoCollector is used to collect the SyncInfo for
-out-of-sync resources from a subscriber into a SyncInfoTree that can be
-used to, for example, display the out-of-sync resources of a subscriber
-to the user. The collector supports filtering by working set and
-SyncInfoFilter (e.g. to select groupings such as incoming-changes or
-conflicts). Even when filtered, the collector still maintains a set of
-all out-of-sync resources from the subscriber in order to provide
-statistics on the number of pre and post filtered out-of-sync resources.</p>
-<p>FilteredSyncInfoCollector: should be generalized</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/CachedResourceVariant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/CachedResourceVariant.java
deleted file mode 100644
index 57c8a538d..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/CachedResourceVariant.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.synchronize;
-
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.*;
-import org.eclipse.team.internal.core.*;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * A resource variant is a partial implementation of a remote resource
- * whose contents and handle are cached locally. It is assumed that a
- * resource varant is an immutable version or revision of a resource.
- * Therefore, once the contents are cached they cannot be replaced.
- * However, the cached handle can be replaced to allow clients to
- * cache addition state or properties for a resource variant.
- * <p>
- * Overriding subclasses need to provide a cache Id for al there resource variants
- * and a cache path for each resource variant that uniquely identifies it. In addition,
- * they must implement <code>fetchContents</code> to retrieve the contents of the
- * resource variant and then call <code>setContents</code> to place these contents in the cache.
- * Subclasses may also call <code>cacheHandle</code> in order to place the handle in the
- * cache so that it can be retrieved later by calling <code>getCachedHandle</code> on any
- * resource variant whose cache path is the same as the cached handle. This allows subclasses to
- * cache additional resource variant properties such as author, comment, etc.
- * </p>
- * <p>
- * The cache in which the resource variants reside will occasionally clear
- * cached entries if they have not been accessed for a certain amount of time.
- * </p>
- */
-public abstract class CachedResourceVariant extends PlatformObject implements IResourceVariant {
-
- // holds the storage instance for this resource variant
- private IStorage storage;
-
- /*
- * Internal class which provides access to the cached contents
- * of this resource variant
- */
- class ResourceVariantStorage implements IStorage {
- public InputStream getContents() throws CoreException {
- if (!isContentsCached()) {
- // The cache may have been cleared if someone held
- // on to the storage too long
- throw new TeamException(Policy.bind("CachedResourceVariant.0", getCachePath())); //$NON-NLS-1$
- }
- return getCachedContents();
- }
- public IPath getFullPath() {
- return getFullPath();
- }
- public String getName() {
- return CachedResourceVariant.this.getName();
- }
- public boolean isReadOnly() {
- return true;
- }
- public Object getAdapter(Class adapter) {
- return CachedResourceVariant.this.getAdapter(adapter);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.IRemoteResource#getStorage(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStorage getStorage(IProgressMonitor monitor) throws TeamException {
- if (isContainer()) return null;
- ensureContentsCached(monitor);
- if (storage == null) {
- storage = new ResourceVariantStorage();
- }
- return storage;
- }
-
- private void ensureContentsCached(IProgressMonitor monitor) throws TeamException {
- // Ensure that the contents are cached from the server
- if (!isContentsCached()) {
- fetchContents(monitor);
- }
- }
-
- /**
- * Method that is invoked when the contents of the resource variant need to
- * be fetched. This method will only be invoked for files (i.e.
- * <code>isContainer()</code> returns <code>false</code>.
- * Subclasses should override this method and invoke <code>setContents</code>
- * with a stream containing the fetched contents.
- * @param monitor a progress monitor
- */
- protected abstract void fetchContents(IProgressMonitor monitor) throws TeamException;
-
- /**
- * This method should be invoked by subclasses from within their <code>fetchContents</code>
- * method in order to cache the contents for this resource variant.
- * @param stream the stream containing the contents of the resource variant
- * @param monitor a progress monitor
- * @throws TeamException
- */
- protected void setContents(InputStream stream, IProgressMonitor monitor) throws TeamException {
- // Ensure that there is a cache entry to receive the contents
- Assert.isTrue(!isContainer());
- if (!isHandleCached()) cacheHandle();
- getCacheEntry().setContents(stream, monitor);
- }
-
- private ResourceVariantCacheEntry getCacheEntry() {
- return getCache().getCacheEntry(this.getCachePath());
- }
-
- /**
- * Return whether there are already contents cached for this resource variant.
- * This method will return <code>false</code> even if the contents are currently
- * being cached by another thread. The consequence of this is that the contents
- * may be fetched twice in the rare case where two threads request the same contents
- * at the same time. For containers, this method will always return <code>false</code>.
- */
- protected boolean isContentsCached() {
- if (isContainer() || !isHandleCached()) {
- return false;
- }
- ResourceVariantCacheEntry entry = getCache().getCacheEntry(getCachePath());
- return entry.getState() == ResourceVariantCacheEntry.READY;
- }
-
- /**
- * Return the cached contents for this resource variant or <code>null</code>
- * if the contents have not been cached.
- * For containers, this method will always return <code>null</code>.
- * @return the cached contents or <code>null</code>
- * @throws TeamException
- */
- protected InputStream getCachedContents() throws TeamException {
- if (isContainer() || !isContentsCached()) return null;
- return getCache().getCacheEntry(getCachePath()).getContents();
- }
-
- /**
- * Return <code>true</code> if the cache contains an entry for this resource
- * variant. It is possible that another instance of this variant is cached.
- * To get the cached instance, call <code>getCachedHandle()</code>. Note that
- * cached contents can be retrieved from any handle to a resource variant whose
- * cache path (as returned by <code>getCachePath()</code>) match but other
- * state information may only be accessible from the cached copy.
- * @return whether the variant is cached
- */
- protected boolean isHandleCached() {
- return (getCache().hasEntry(getCachePath()));
- }
-
- /**
- * Get the path that uniquely identifies the remote resource
- * variant. This path descibes the remote location where
- * the remote resource is stored and also uniquely identifies
- * each resource variant. It is used to uniquely identify this
- * resource variant when it is stored in the resource variant cache.
- * @return the full path of the remote resource variant
- */
- protected abstract String getCachePath();
-
- /**
- * Return the size (in bytes) of the contents of this resource variant.
- * The method will return 0 if the contents have not yet been cached
- * locally.
- * For containers, this method will always return 0.
- */
- public long getSize() {
- if (isContainer() || !isContentsCached()) return 0;
- ResourceVariantCacheEntry entry = getCacheEntry();
- if (entry == null || entry.getState() != ResourceVariantCacheEntry.READY) {
- return 0;
- }
- return entry.getSize();
- }
-
- /*
- * Return the cache that is used to cache this resource variant and its contents.
- * @return Returns the cache.
- */
- private ResourceVariantCache getCache() {
- ResourceVariantCache.enableCaching(getCacheId());
- return ResourceVariantCache.getCache(getCacheId());
- }
-
- /**
- * Return the ID that uniquely identifies the cache in which this resource variant
- * is to be cache. The ID of the plugin that provides the resource variant subclass
- * is a good candidate for this ID. The creation, management and disposal of the cache
- * is managed by Team.
- * @return the cache ID
- */
- protected abstract String getCacheId();
-
- /**
- * Return the cached handle for this resource variant if there is
- * one. If there isn't one, then <code>null</code> is returned.
- * If there is no cached handle and one is desired, then <code>cacheHandle()</code>
- * should be called.
- * @return a cached copy of this resource variant or <code>null</code>
- */
- protected CachedResourceVariant getCachedHandle() {
- ResourceVariantCacheEntry entry = getCacheEntry();
- if (entry == null) return null;
- return entry.getResourceVariant();
- }
-
- /**
- * Cache this handle in the cache, replacing any previously cached handle.
- * Note that caching this handle will replace any state associated with a
- * previously cached handle, if there is one, but the contents will remain.
- * The reason for this is the assumption that the cache path for a resource
- * variant (as returned by <code>getCachePath()</code> identifies an immutable
- * resource version (or revision). The ability to replace the handle itself
- * is provided so that additional state may be cached before or after the contents
- * are fetched.
- */
- protected void cacheHandle() {
- getCache().add(getCachePath(), this);
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
deleted file mode 100644
index 19228a99d..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.synchronize;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A specialized <code>SyncInfoFilter</code> that does not require a progress monitor.
- * This enables these filters to be used when determining menu enablement or other
- * operations that must be short running.
- *
- * @see SyncInfo
- * @see SyncInfoSet
- * @see SyncInfoFilter
- * @since 3.0
- */
-public class FastSyncInfoFilter extends SyncInfoFilter {
-
- /**
- * Selects <code>SyncInfo</code> that match the given change type and direction.
- * @param direction the change direction (<code>SyncInfo.OUTGOING</code>,
- * <code>SyncInfo.INCOMING</code> and <code>SyncInfo.CONFLICTING</code>) that this filter matches
- * @param change the change type (<code>SyncInfo.ADDITION</code>,
- * <code>SyncInfo.DELETION</code> and <code>SyncInfo.CHANGE</code>) that this filter matches
- * @return a <code>FastSyncInfoFilter</code> that selects <code>SyncInfo</code> that match the given
- * change type and direction.
- */
- public static FastSyncInfoFilter getDirectionAndChangeFilter(int direction, int change) {
- return new AndSyncInfoFilter(new FastSyncInfoFilter[]{new SyncInfoDirectionFilter(direction), new SyncInfoChangeTypeFilter(change)});
- }
-
- /**
- * An abstract class whoich contains a set of <code>FastSyncInfoFilter</code> instances.
- * Subclasses must provide the <code>select(SyncInfo)</code> method for determining
- * matches.
- */
- public static abstract class CompoundSyncInfoFilter extends FastSyncInfoFilter {
- protected FastSyncInfoFilter[] filters;
- protected CompoundSyncInfoFilter(FastSyncInfoFilter[] filters) {
- this.filters = filters;
- }
- }
-
- /**
- * Selects SyncInfo which match all child filters.
- */
- public static class AndSyncInfoFilter extends CompoundSyncInfoFilter {
- public AndSyncInfoFilter(FastSyncInfoFilter[] filters) {
- super(filters);
- }
- public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- FastSyncInfoFilter filter = filters[i];
- if (!filter.select(info)) {
- return false;
- }
- }
- return true;
- }
-
- }
-
- /**
- * Selects <code>SyncInfo</code> instances that are auto-mergable.
- */
- public static class AutomergableFilter extends FastSyncInfoFilter {
- public boolean select(SyncInfo info) {
- return (info.getKind() & SyncInfo.AUTOMERGE_CONFLICT) != 0;
- }
- }
-
- /**
- * Selects <code>SyncInfo</code> instances that are pseudo-conflicts.
- */
-
- public static class PseudoConflictFilter extends FastSyncInfoFilter {
- public boolean select(SyncInfo info) {
- return info.getKind() != 0 && (info.getKind() & SyncInfo.PSEUDO_CONFLICT) == 0;
- }
- }
-
- /**
- * Selects <code>SyncInfo</code> that match any of the child filters.
- */
- public static class OrSyncInfoFilter extends CompoundSyncInfoFilter {
- public OrSyncInfoFilter(FastSyncInfoFilter[] filters) {
- super(filters);
- }
- public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- FastSyncInfoFilter filter = filters[i];
- if (filter.select(info)) {
- return true;
- }
- }
- return false;
- }
- }
-
- /**
- * Selects <code>SyncInfo</code> whose change type match those of the filter.
- */
- public static class SyncInfoChangeTypeFilter extends FastSyncInfoFilter {
- private int[] changeFilters = new int[]{SyncInfo.ADDITION, SyncInfo.DELETION, SyncInfo.CHANGE};
- /**
- * Create a filter that will match <code>SyncInfo</code> whose change type
- * match those passed as arguments to this constructor.
- * @param changeFilters the array of change types (<code>SyncInfo.ADDITION</code>,
- * <code>SyncInfo.DELETION</code> and <code>SyncInfo.CHANGE</code>) that this filter match
- */
- public SyncInfoChangeTypeFilter(int[] changeFilters) {
- this.changeFilters = changeFilters;
- }
- /**
- * Create a filter that will match <code>SyncInfo</code> whose change type
- * match that passed as an argument to this constructor.
- * @param change the change type (<code>SyncInfo.ADDITION</code>,
- * <code>SyncInfo.DELETION</code> and <code>SyncInfo.CHANGE</code>) that this filter matches
- */
- public SyncInfoChangeTypeFilter(int change) {
- this(new int[]{change});
- }
- 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;
- }
- }
- /**
- * Selects <code>SyncInfo</code> whose change direction match those of the filter.
- */
- public static class SyncInfoDirectionFilter extends FastSyncInfoFilter {
- int[] directionFilters = new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING};
- /**
- * Create a filter that will match <code>SyncInfo</code> whose change direction
- * match those passed as arguments to this constructor.
- * @param directionFilters the array of change directions (<code>SyncInfo.OUTGOING</code>,
- * <code>SyncInfo.INCOMING</code> and <code>SyncInfo.CONFLICTING</code>) that this filter match
- */
- public SyncInfoDirectionFilter(int[] directionFilters) {
- this.directionFilters = directionFilters;
- }
- /**
- * Create a filter that will match <code>SyncInfo</code> whose change direction
- * match that passed as arguments to this constructor.
- * @param direction the change direction (<code>SyncInfo.OUTGOING</code>,
- * <code>SyncInfo.INCOMING</code> and <code>SyncInfo.CONFLICTING</code>) that this filter matches
- */
- public SyncInfoDirectionFilter(int direction) {
- this(new int[] { direction });
- }
- 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;
- }
- }
-
- /**
- * Return true if the provided <code>SyncInfo</code> matches the filter. The default
- * behavior it to include resources whose syncKind is non-zero.
- *
- * @param info the <code>SyncInfo</code> being tested
- * @return <code>true</code> if the <code>SyncInfo</code> matches the filter
- */
- public boolean select(SyncInfo info) {
- return info.getKind() != 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.SyncInfoFilter#select(org.eclipse.team.core.subscribers.SyncInfo, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final boolean select(SyncInfo info, IProgressMonitor monitor) {
- return select(info);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariant.java
deleted file mode 100644
index 9b1039cbe..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariant.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.core.synchronize;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-
-/**
- * This interface is used by <code>SyncInfo</code> instances
- * to provide access to the base and remote resources that correspond to
- * a local resource.
- *
- * @see SyncInfo
- * @since 3.0
- */
-public interface IResourceVariant {
-
- /**
- * Answers the name of the remote resource. The name may be
- * displayed to the user.
- *
- * @return name of the subscriber resource.
- */
- public String getName();
-
- /**
- * Answers if the remote resource may have children.
- *
- * @return <code>true</code> if the remote element may have children and
- * <code>false</code> otherwise.
- */
- public boolean isContainer();
-
- /**
- * Return an instance of IStorage or <code>null</code> if the remote resource
- * does not have contents (i.e. is a folder). Since the <code>ISorage#getContents()</code>
- * method does not accept an <code>IProgressMonitor</code>, this method must ensure that the contents
- * access by the resulting <code>IStorage</code> is cached locally (hence the <code>IProgressMonitor</code>
- * argument to this method). Implementations of this method should
- * ensure that the resulting <code>IStorage</code> is accessing locally cached contents and is not
- * contacting the server.
- * @return an <code>IStorage</code> that provides access to the contents of
- * the remote resource or <code>null</code> if the remote resource is a container.
- */
- public IStorage getStorage(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Return a content identifier that is used to differentiate versions
- * or revisions of the same resource.
- *
- * @return a String that identifies the version of the subscriber resource
- * @throws TeamException
- */
- public String getContentIdentifier();
-
- /**
- * Returns whether the remote resource is equal to the provided object.
- * @param object the object to be compared
- * @return whether the object is equal to the remote resource
- */
- public boolean equals(Object object);
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariantComparator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariantComparator.java
deleted file mode 100644
index 58673c628..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/IResourceVariantComparator.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.core.synchronize;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * An <code>IResourceVariantComparator</code> is provided by a <code>Subscriber</code>
- * and used by a <code>SyncInfo</code> to calculate the sync
- * state of the workspace resources. Subscribers should provide a criteria
- * best suited for their environment. For example, an FTP subscriber could choose to use file
- * size or file timestamps as comparison criterias whereas a CVS workspace subscriber would
- * use file revision numbers.
- *
- * @see SyncInfo
- * @see Subscriber
- * @since 3.0
- */
-public interface IResourceVariantComparator {
-
- /**
- * Returns <code>true</code> if the local resource
- * matches the remote resource based on this criteria and <code>false</code>
- * otherwise. Comparing should be fast and based on cached information.
- *
- * @param resource the local resource to be compared
- * @param remote the remote resources to be compared
- * @return <code>true</code> if local and remote are equal based on this criteria and <code>false</code>
- * otherwise.
- */
- public boolean compare(IResource local, IResourceVariant remote);
-
- /**
- * Returns <code>true</code> if the base resource
- * matches the remote resource based on this criteria and <code>false</code>
- * otherwise. Comparing should be fast and based on cached information.
- *
- * @param base the base resource to be compared
- * @param remote the remote resources to be compared
- * @return <code>true</code> if base and remote are equal based on this criteria and <code>false</code>
- * otherwise.
- */
- public boolean compare(IResourceVariant base, IResourceVariant remote);
-
- /**
- * Answers <code>true</code> if the base tree is maintained by this
- * subscriber. If the base tree is not considered than the subscriber can
- * be considered as not supported three-way comparisons. Instead
- * comparisons are made between the local and remote only without
- * consideration for the base.
- */
- public boolean isThreeWay();
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeEvent.java
deleted file mode 100644
index c37577479..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeEvent.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.core.synchronize;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * An event generated when a {@link SyncInfoSet} collection is changed. The event contains
- * a description of the changes which include added, changed and removed resources.
- * In some cases, (e.g. when the change is too complicated to be efficiently described
- * using the mechanisms provided by this interface) the event will be a reset. In these
- * cases, the client should ignore any other contents of the event are reclaculate
- * from scratch any state that is derived from the <code>SyncInfoSet</code> from
- * which the event originated.
- * <p>
- * The mix of return types, SyncInfo and IResource, is a result of an optimization
- * included in {@link SyncInfoSet} collections that doesn't maintain SyncInfo objects
- * for in-sync resources.
- *
- * @see SyncInfoSet#addSyncSetChangedListener(ISyncInfoSetChangeListener)
- * @see ISyncInfoSetChangeListener
- * @since 3.0
- */
-public interface ISyncInfoSetChangeEvent {
-
- /**
- * Returns newly added out-of-sync <code>SyncInfo</code> elements.
- *
- * @return newly added <code>SyncInfo</code> elements or an empty list if this event
- * doesn't contain added resources.
- */
- public SyncInfo[] getAddedResources();
-
- /**
- * Returns changed <code>SyncInfo</code> elements. The returned elements
- * are still out-of-sync.
- *
- * @return changed <code>SyncInfo</code> elements or an empty list if this event
- * doesn't contain changes resources.
- */
- public SyncInfo[] getChangedResources();
-
- /**
- * Returns the removed <code>IResource</code> elements for which the set no longer
- * contains on out-of-sync <code>SyncInfo</code>. The returned elements
- * are all in-sync resources.
- *
- * @return removed <code>SyncInfo</code> elements or an empty list if this event
- * doesn't contain removed resources.
- */
- public IResource[] getRemovedResources();
-
- /**
- * Returns the {@link SyncInfoSet} that generated these events.
- *
- * @return the {@link SyncInfoSet} that generated these events.
- */
- public SyncInfoSet getSet();
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeListener.java
deleted file mode 100644
index 2fa4603ec..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSetChangeListener.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.synchronize;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.ITeamStatus;
-
-/**
- * Classes which implement this interface provide methods that deal with the
- * change events that are generated by a {@link SyncInfoSet}.
- * <p>
- * After creating an instance of a class that implements this interface it can
- * be added to a sync info set using the <code>addSyncSetChangedListener</code>
- * method and removed using the <code>removeSyncSetChangedListener</code>
- * method.
- * </p>
- * The originating sync set holds modification locks on the sync info set to ensure
- * that no more changes occur until after the current change event is processed.
- * The implementors of this interface must not modify the set within the scope of
- * the listener's methods. If modiciations are attempted a runtime exception will occur.
- *
- * @see ISyncInfoSetChangeEvent
- * @since 3.0
- */
-public interface ISyncInfoSetChangeListener {
-
- /**
- * Sent when the contents of a {@link SyncInfoSet} have been reset or the
- * listener has been connected to the set for the first time using
- * <code>SyncInfoSet#connect(ISyncInfoSetChangeListener, IProgressMonitor)</code>. Listeners
- * should discard any state they have accumulated from the originating sync info set
- * and re-obtain their state from the sync info set. The originating sync set will be
- * locked for modification when this method is called.
- * Clients should no modify the set within this method and other threads that try to
- * modify the set will be blocked until the reset is processed.
- * @param set the originating {@link SyncInfoSet}
- */
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor);
-
- /**
- * Sent when a {@link SyncInfoSet} changes. For example, when a resource's
- * synchronization state changes. The originating sync set will be
- * locked for modification when this method is called.
- * Clients should no modify the set within this method and other threads that try to
- * modify the set will be blocked until the change is processed.
- * <p>
- * If the originating set is an instance of <code>SyncInfoTree</code> then
- * the event will be an instance of <code>iSyncInfoTreeChangeEvent</code>.
- * Clients can determine this using an instancof check.
- *
- * @param event an event containing information about the change.
- */
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor);
-
- /**
- * This method is called when errors have occurred calculating the <code>SyncInfo</code>
- * for a resource. The resource associated with the error is available from the
- * <code>ITeamStatus</code>. This event only provides the latest errors that occurred.
- * An array of all errors can be retrieved directly from the set.
- * @param set the originating {@link SyncInfoSet}
- * @param errors the errors that occurred during the latest set modifications
- * @param monitor a progress monitor
- */
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor);
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTreeChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTreeChangeEvent.java
deleted file mode 100644
index d9a1940e8..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTreeChangeEvent.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.core.synchronize;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * This is a change event that provides access to changes in subtrees
- * that contain the out-of-sync resources. It is the event type
- * provided by {@link SyncInfoTree} when it notifies listeners
- * of changes.
- */
-public interface ISyncInfoTreeChangeEvent extends ISyncInfoSetChangeEvent {
-
- /**
- * Returns the highest parent resources of all newly added elements available in this event
- * by calling <code>getAddedResources()</code>. In other words, it returns the set of all
- * parent containers that did not previously have descendants in the sync set but are direct
- * children of containers that did previously have descescendants in the set.
- * <p>
- * These roots are provided in order
- * to allow listeners to optimize the reconciliation of hierachical views of
- * the <code>SyncInfoSet</code> contents.
- *
- * @return parents of all newly added elements or an empty list if this event
- * doesn't contain added resources.
- */
- public IResource[] getAddedSubtreeRoots();
-
- /**
- * Returns the highest parent resources of all newly removed elements available in this event
- * by calling <code>getRemovedResources()</code>. In other words, it returns the set of all
- * parent containers that previously had descendants in the sync set but are direct
- * children of containers that still have descescendants in the set.
- * <p>
- * These roots are provided in order
- * to allow listeners to optimize the reconciliation of hierachical views of
- * the <code>SyncInfoSet</code> contents.
- *
- * @return parents of all newly removed elements. or an empty list if this event
- * doesn't contain added resources.
- */
- public IResource[] getRemovedSubtreeRoots();
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java
deleted file mode 100644
index 625c755bf..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.synchronize;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * Describes the relative synchronization of a <b>remote</b>
- * resource and a <b>local</b> resource using a <b>base</b>
- * resource for comparison.
- * <p>
- * Differences between the base and local resources
- * are classified as <b>outgoing changes</b>; if there is
- * a difference, the local resource is considered the
- * <b>outgoing resource</b>.
- * </p>
- * <p>
- * Differences between the base and remote resources
- * are classified as <b>incoming changes</b>; if there is
- * a difference, the remote resource is considered the
- * <b>incoming resource</b>.
- * </p>
- * <p>
- * Differences between the local and remote resources
- * determine the <b>sync status</b>. The sync status does
- * not take into account the common resource.
- * </p>
- * <p>
- * Note that under this parse of the world, a resource
- * can have both incoming and outgoing changes at the
- * same time, but may nevertheless be in sync!
- * <p>
- * [Issue: "Gender changes" are also an interesting aspect...
- * ]
- * </p>
- *
- * @since 3.0
- */
-public class SyncInfo implements IAdaptable {
-
- /*====================================================================
- * Constants defining synchronization types:
- *====================================================================*/
-
- /**
- * Sync constant (value 0) indicating element is in sync.
- */
- public static final int IN_SYNC = 0;
-
- /**
- * Sync constant (value 1) indicating that one side was added.
- */
- public static final int ADDITION = 1;
-
- /**
- * Sync constant (value 2) indicating that one side was deleted.
- */
- public static final int DELETION = 2;
-
- /**
- * Sync constant (value 3) indicating that one side was changed.
- */
- public static final int CHANGE = 3;
-
- /**
- * Bit mask for extracting the change type.
- */
- public static final int CHANGE_MASK = CHANGE;
-
- /*====================================================================
- * Constants defining synchronization direction:
- *====================================================================*/
-
- /**
- * Sync constant (value 4) indicating a change to the local resource.
- */
- public static final int OUTGOING = 4;
-
- /**
- * Sync constant (value 8) indicating a change to the remote resource.
- */
- public static final int INCOMING = 8;
-
- /**
- * Sync constant (value 12) indicating a change to both the remote and local resources.
- */
- public static final int CONFLICTING = 12;
-
- /**
- * Bit mask for extracting the synchronization direction.
- */
- public static final int DIRECTION_MASK = CONFLICTING;
-
- /*====================================================================
- * Constants defining synchronization conflict types:
- *====================================================================*/
-
- /**
- * Sync constant (value 16) indication that both the local and remote resources have changed
- * relative to the base but their contents are the same.
- */
- public static final int PSEUDO_CONFLICT = 16;
-
- /**
- * Sync constant (value 32) indicating that both the local and remote resources have changed
- * relative to the base but their content changes do not conflict (e.g. source file changes on different
- * lines). These conflicts could be merged automatically.
- */
- public static final int AUTOMERGE_CONFLICT = 32;
-
- /**
- * Sync constant (value 64) indicating that both the local and remote resources have changed relative
- * to the base and their content changes conflict (e.g. local and remote resource have changes on
- * same lines). These conflicts can only be correctly resolved by the user.
- */
- public static final int MANUAL_CONFLICT = 64;
-
- /*====================================================================
- * Members:
- *====================================================================*/
- private IResource local;
- private IResourceVariant base;
- private IResourceVariant remote;
- private IResourceVariantComparator comparator;
-
- private int syncKind;
-
- /**
- * Construct a sync info object.
- */
- public SyncInfo(IResource local, IResourceVariant base, IResourceVariant remote, IResourceVariantComparator comparator) {
- this.local = local;
- this.base = base;
- this.remote = remote;
- this.comparator = comparator;
- }
-
- /**
- * Returns the state of the local resource. Note that the
- * resource may or may not exist.
- *
- * @return a resource
- */
- public IResource getLocal() {
- return local;
- }
-
- /**
- * Returns the content identifier for the local resource or <code>null</code> if
- * it doesn't have one. For example, in CVS this would be the revision number.
- *
- * @return String that could be displayed to the user to identify this resource.
- */
- public String getLocalContentIdentifier() {
- return null;
- }
-
- /**
- * Returns the remote resource handle for the base resource,
- * or <code>null</code> if the base resource does not exist.
- * <p>
- * [Note: The type of the common resource may be different from the types
- * of the local and remote resources.
- * ]
- * </p>
- *
- * @return a remote resource handle, or <code>null</code>
- */
- public IResourceVariant getBase() {
- return base;
- }
-
- /**
- * Returns the handle for the remote resource,
- * or <code>null</code> if the remote resource does not exist.
- * <p>
- * [Note: The type of the remote resource may be different from the types
- * of the local and common resources.
- * ]
- * </p>
- *
- * @return a remote resource handle, or <code>null</code>
- */
- public IResourceVariant getRemote() {
- return remote;
- }
-
- /**
- * Returns the subscriber that created and maintains this sync info
- * object.
- */
- public IResourceVariantComparator getComparator() {
- return comparator;
- }
-
- /**
- * Returns the kind of synchronization for this node.
- * @return
- */
- public int getKind() {
- return syncKind;
- }
-
- static public boolean isInSync(int kind) {
- return kind == IN_SYNC;
- }
-
- static public int getDirection(int kind) {
- return kind & DIRECTION_MASK;
- }
-
- static public int getChange(int kind) {
- return kind & CHANGE_MASK;
- }
-
- public boolean equals(Object other) {
- if(other == this) return true;
- if(other instanceof SyncInfo) {
- return equalNodes(this, (SyncInfo)other);
- }
- return false;
- }
-
- private boolean equalNodes(SyncInfo node1, SyncInfo node2) {
- if(node1 == null || node2 == null) {
- return false;
- }
-
- // First, ensure the local resources are equals
- IResource local1 = null;
- if (node1.getLocal() != null)
- local1 = node1.getLocal();
- IResource local2 = null;
- if (node2.getLocal() != null)
- local2 = node2.getLocal();
- if (!equalObjects(local1, local2)) return false;
-
- // Next, ensure the base resources are equal
- IResourceVariant base1 = null;
- if (node1.getBase() != null)
- base1 = node1.getBase();
- IResourceVariant base2 = null;
- if (node2.getBase() != null)
- base2 = node2.getBase();
- if (!equalObjects(base1, base2)) return false;
-
- // Finally, ensure the remote resources are equal
- IResourceVariant remote1 = null;
- if (node1.getRemote() != null)
- remote1 = node1.getRemote();
- IResourceVariant remote2 = null;
- if (node2.getRemote() != null)
- remote2 = node2.getRemote();
- if (!equalObjects(remote1, remote2)) 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 org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IResource.class) {
- return getLocal();
- }
- return null;
- }
-
- public String toString() {
- return getLocal().getName() + " " + kindToString(getKind()); //$NON-NLS-1$
- }
-
- public static String kindToString(int kind) {
- String label = ""; //$NON-NLS-1$
- if(kind==IN_SYNC) {
- label = Policy.bind("RemoteSyncElement.insync"); //$NON-NLS-1$
- } else {
- switch(kind & DIRECTION_MASK) {
- case CONFLICTING: label = Policy.bind("RemoteSyncElement.conflicting"); break; //$NON-NLS-1$
- case OUTGOING: label = Policy.bind("RemoteSyncElement.outgoing"); break; //$NON-NLS-1$
- case INCOMING: label = Policy.bind("RemoteSyncElement.incoming"); break; //$NON-NLS-1$
- }
- switch(kind & CHANGE_MASK) {
- case CHANGE: label = Policy.bind("concatStrings", label, Policy.bind("RemoteSyncElement.change")); break; //$NON-NLS-1$ //$NON-NLS-2$
- case ADDITION: label = Policy.bind("concatStrings", label, Policy.bind("RemoteSyncElement.addition")); break; //$NON-NLS-1$ //$NON-NLS-2$
- case DELETION: label = Policy.bind("concatStrings", label, Policy.bind("RemoteSyncElement.deletion")); break; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if((kind & MANUAL_CONFLICT) != 0) {
- label = Policy.bind("concatStrings", label, Policy.bind("RemoteSyncElement.manual")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if((kind & AUTOMERGE_CONFLICT) != 0) {
- label = Policy.bind("concatStrings", label, Policy.bind("RemoteSyncElement.auto")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return Policy.bind("RemoteSyncElement.delimit", label); //$NON-NLS-1$
- }
-
- /**
- * Method that is invoked after instance creation to initialize the sync kind.
- * This method should only be invoked by the creator of the <code>SyncInfo</code>
- * instance. It is not done from the constructor in order to allow subclasses
- * to calculate the sync kind from any additional state variables they may have.
- * @throws TeamException
- */
- public final void init() throws TeamException {
- syncKind = calculateKind();
- }
-
- /**
- * Method that is invoked from the <code>init()</code> method to calculate
- * the sync kind for this instance of <code>SyncInfo</code>. The result is
- * assigned to an instance variable and is available using <code>getKind()</code>.
- * Subclasses should not invoke this method but may override it in order to customize
- * the sync kind calculation algorithm.
- * @return the sync kind of this <code>SyncInfo</code>
- * @throws TeamException
- */
- protected int calculateKind() throws TeamException {
- int description = IN_SYNC;
-
- boolean localExists = local.exists();
-
- if (comparator.isThreeWay()) {
- if (base == null) {
- if (remote == null) {
- if (!localExists) {
- description = IN_SYNC;
- } else {
- description = OUTGOING | ADDITION;
- }
- } else {
- if (!localExists) {
- description = INCOMING | ADDITION;
- } else {
- description = CONFLICTING | ADDITION;
- if (comparator.compare(local, remote)) {
- description |= PSEUDO_CONFLICT;
- }
- }
- }
- } else {
- if (!localExists) {
- if (remote == null) {
- description = CONFLICTING | DELETION | PSEUDO_CONFLICT;
- } else {
- if (comparator.compare(base, remote))
- description = OUTGOING | DELETION;
- else
- description = CONFLICTING | CHANGE;
- }
- } else {
- if (remote == null) {
- if (comparator.compare(local, base))
- description = INCOMING | DELETION;
- else
- description = CONFLICTING | CHANGE;
- } else {
- boolean ay = comparator.compare(local, base);
- boolean am = comparator.compare(base, remote);
- if (ay && am) {
- // in-sync
- } else if (ay && !am) {
- description = INCOMING | CHANGE;
- } else if (!ay && am) {
- description = OUTGOING | CHANGE;
- } else {
- if(! comparator.compare(local, remote)) {
- description = CONFLICTING | CHANGE;
- }
- }
- }
- }
- }
- } else { // two compare without access to base contents
- if (remote == null) {
- if (!localExists) {
- Assert.isTrue(false);
- // shouldn't happen
- } else {
- description= DELETION;
- }
- } else {
- if (!localExists) {
- description= ADDITION;
- } else {
- if (! comparator.compare(local, remote))
- description= CHANGE;
- }
- }
- }
- return description;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java
deleted file mode 100644
index caa89b17e..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.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.core.synchronize;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.core.subscribers.*;
-
-/**
- * A <code>SyncInfoFilter</code> tests a <code>SyncInfo</code> for inclusion,
- * typically in a <code>SyncInfoSet</code>.
- *
- * @see SyncInfo
- * @see SyncInfoSet
- *
- * @since 3.0
- */
-public abstract class SyncInfoFilter {
-
- /**
- * Selects <code>SyncInfo</code> whose local and remote contents match.
- * This filter makes use of the <code>IStorage</code> provided by
- * an <code>IResourceVariant</code> to obtain the remote contents.
- * This means that the comparison may contact the server unless the contents
- * were cached locally by a previous operation. The caching of remote
- * contents is subscriber specific.
- * <p>
- * For folders, the comparison always returns <code>true</code>.
- */
- public static class ContentComparisonSyncInfoFilter extends SyncInfoFilter {
- ContentComparator criteria = new ContentComparator(false);
- /**
- * Create a filter that does not ignore whitespace.
- */
- public ContentComparisonSyncInfoFilter() {
- this(false);
- }
- /**
- * Create a filter and configure how whitspace is handled.
- * @param ignoreWhitespace whether whitespace should be ignored
- */
- public ContentComparisonSyncInfoFilter(boolean ignoreWhitespace) {
- criteria = new ContentComparator(ignoreWhitespace);
- }
- public boolean select(SyncInfo info, IProgressMonitor monitor) {
- IResourceVariant remote = info.getRemote();
- IResource local = info.getLocal();
- if (local.getType() != IResource.FILE) return true;
- if (remote == null) return !local.exists();
- if (!local.exists()) return false;
- return criteria.compare(local, remote, monitor);
- }
- }
-
- /**
- * Return <code>true</code> if the provided <code>SyncInfo</code> matches the filter.
- *
- * @param info the <code>SyncInfo</code> to be tested
- * @param monitor a progress monitor
- * @return <code>true</code> if the <code>SyncInfo</code> matches the filter
- */
- public abstract boolean select(SyncInfo info, IProgressMonitor monitor);
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
deleted file mode 100644
index 20b05e581..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
+++ /dev/null
@@ -1,594 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.synchronize;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.internal.core.*;
-import org.eclipse.team.internal.core.subscribers.SyncInfoStatistics;
-import org.eclipse.team.internal.core.subscribers.SyncSetChangedEvent;
-
-/**
- * A dynamic collection of {@link SyncInfo} objects that provides
- * change notification to registered listeners. Batching of change notifications
- * can be accomplished using the <code>beginInput/endInput</code> methods or
- * the <code>run</code> method.
- * @see SyncInfoTree
- * @since 3.0
- */
-public class SyncInfoSet {
- // fields used to hold resources of interest
- // {IPath -> SyncInfo}
- private Map resources = Collections.synchronizedMap(new HashMap());
-
- // keep track of number of sync kinds in the set
- private SyncInfoStatistics statistics = new SyncInfoStatistics();
-
- // keep track of errors that occurred while trying to populate the set
- private Map errors = new HashMap();
-
- private boolean lockedForModification;
-
- /**
- * Create an empty set.
- */
- public SyncInfoSet() {
- }
-
- /**
- * Create a <code>SyncInfoSet</code> containing the given <code>SyncInfo</code>
- * instances
- * @param infos the <code>SyncInfo</code> instances to be contained by this set
- */
- public SyncInfoSet(SyncInfo[] infos) {
- this();
- // use the internal add since we can't have listeners at this point anyway
- for (int i = 0; i < infos.length; i++) {
- internalAdd(infos[i]);
- }
- }
-
- /**
- * Return an array of <code>SyncInfo</code> for all out-of-sync resources that are contained by the set.
- * This call is equivalent in function to
- * <code>getSyncInfos(ResourcesPlugin.getWorkspace().getRoot(), IResource.DEPTH_INFINITE)</code>
- * but is optimized to retrieve all contained <code>SyncInfo</code>.
- * @return an array of <code>SyncInfo</code>
- */
- public synchronized SyncInfo[] getSyncInfos() {
- return (SyncInfo[]) resources.values().toArray(new SyncInfo[resources.size()]);
- }
-
- /**
- * Return all out-of-sync resources contained in this set. The default implementation
- * uses <code>getSyncInfos()</code> to determine the resources contained in the set.
- * Subclasses may override to optimize.
- * @return all out-of-sync resources contained in the set
- */
- public IResource[] getResources() {
- SyncInfo[] infos = getSyncInfos();
- List resources = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- resources.add(info.getLocal());
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- /**
- * Return the <code>SyncInfo</code> for the given resource or <code>null</code>
- * if the resource is not contained in the set.
- * @param resource the resource
- * @return the <code>SyncInfo</code> for the resource or <code>null</code>
- */
- public synchronized SyncInfo getSyncInfo(IResource resource) {
- return (SyncInfo)resources.get(resource.getFullPath());
- }
-
- /**
- * Return the number of out-of-sync resources contained in this set.
- * @return the size of the set.
- */
- public synchronized int size() {
- return resources.size();
- }
-
- /**
- * Return the number of out-of-sync resources in the given set whose sync kind
- * matches the given kind and mask (e.g. <code>(SyncInfo#getKind() & mask) == kind</code>).
- * @param kind the sync kind
- * @param mask the sync kind mask
- * @return the number of matching resources in the set.
- */
- public long countFor(int kind, int mask) {
- return statistics.countFor(kind, mask);
- }
-
- /**
- * Returns <code>true</code> if there are any conflicting nodes in the set, and
- * <code>false</code> otherwise.
- */
- public boolean hasConflicts() {
- return countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK) > 0;
- }
-
- /**
- * Return whether the set is empty.
- * @return <code>true</code> if the set is empty
- */
- public synchronized boolean isEmpty() {
- return resources.isEmpty();
- }
-
- /**
- * Add the <code>SyncInfo</code> to the set, replacing any previously existing one.
- * @param info the new <code>SyncInfo</code>
- */
- protected synchronized void internalAdd(SyncInfo info) {
- Assert.isTrue(!lockedForModification);
- IResource local = info.getLocal();
- IPath path = local.getFullPath();
- SyncInfo oldSyncInfo = (SyncInfo)resources.put(path, info);
- if(oldSyncInfo == null) {
- statistics.add(info);
- } else {
- statistics.remove(oldSyncInfo);
- statistics.add(info);
- }
- }
-
- /**
- * Remove the resource from the set, updating all internal data structures.
- * @param resource the resource to be removed
- * @return the <code>SyncInfo</code> that was just removed
- */
- protected synchronized SyncInfo internalRemove(IResource resource) {
- Assert.isTrue(!lockedForModification);
- IPath path = resource.getFullPath();
- SyncInfo info = (SyncInfo)resources.remove(path);
- if (info != null) {
- statistics.remove(info);
- }
- return info;
- }
-
- /**
- * Registers the given listener for sync info set notifications. Has
- * no effect if an identical listener is already registered.
- *
- * @param listener listener to register
- */
- public void addSyncSetChangedListener(ISyncInfoSetChangeListener listener) {
- synchronized(listeners) {
- listeners.add(listener);
- }
- }
-
- /**
- * Deregisters the given listener for participant notifications. Has
- * no effect if listener is not already registered.
- *
- * @param listener listener to deregister
- */
- public void removeSyncSetChangedListener(ISyncInfoSetChangeListener listener) {
- synchronized(listeners) {
- listeners.remove(listener);
- }
- }
-
- /**
- * Reset the sync set so it is empty.
- */
- public void clear() {
- try {
- beginInput();
- errors.clear();
- resources.clear();
- statistics.clear();
- getChangeEvent().reset();
- } finally {
- endInput(null);
- }
- }
-
- /*
- * Run the given runnable. This operation
- * will block other threads from modifying the
- * set and postpone any change notifications until after the runnable
- * has been executed. Mutable subclasses must override.
- * <p>
- * The given runnable may be run in the same thread as the caller or
- * more be run asynchronously in another thread at the discretion of the
- * subclass implementation. However, it is gaurenteed that two invocations
- * of <code>run</code> performed in the same thread will be executed in the
- * same order even if run in different threads.
- *
- * @param runnable a runnable
- * @param progress a progress monitor or <code>null</code>
- */
- private void run(IWorkspaceRunnable runnable, IProgressMonitor monitor) {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- try {
- beginInput();
- runnable.run(Policy.subMonitorFor(monitor, 80));
- } catch (CoreException e) {
- addError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, ITeamStatus.SYNC_INFO_SET_ERROR, e.getMessage(), e, null));
- } finally {
- endInput(Policy.subMonitorFor(monitor, 20));
- }
- }
-
- /**
- * Connect the listener to the sync set in such a fashion that the listener will
- * be connected the the sync set using <code>addChangeListener</code>
- * and issued a reset event. This is done to provide a means of connecting to the
- * sync set and initializing a model based on the sync set without worrying about
- * missing events.
- * <p>
- * The reset event may be done in the context of this method invocation or may be
- * done in another thread at the discretion of the <code>SyncInfoSet</code>
- * implementation.
- * <p>
- * Disconnecting is done by calling <code>removeChangeListener</code>. Once disconnected,
- * a listener can reconnect to be reinitialized.
- * @param listener
- * @param monitor
- */
- public void connect(final ISyncInfoSetChangeListener listener, IProgressMonitor monitor) {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, 100);
- addSyncSetChangedListener(listener);
- listener.syncInfoSetReset(SyncInfoSet.this, Policy.subMonitorFor(monitor, 95));
- } finally {
- monitor.done();
- }
- }
- }, monitor);
- }
-
- private ILock lock = Platform.getJobManager().newLock();
-
- private Set listeners = Collections.synchronizedSet(new HashSet());
-
- private SyncSetChangedEvent changes = createEmptyChangeEvent();
-
- /**
- * Add the given <code>SyncInfo</code> to the set. A change event will
- * be generated unless the call to this method is nested in between calls
- * to <code>beginInput()</code> and <code>endInput(IProgressMonitor)</code>
- * in which case the event for this addition and any other sync set
- * change will be fired in a batched event when <code>endInput</code>
- * is invoked.
- * Invoking this method outside of the above mentioned block will result
- * in the <code>endInput(IProgressMonitor)</code> being invoked with a null
- * progress monitor. If responsiveness is required, the client should always
- * nest sync set modifications.
- * @param info
- */
- public void add(SyncInfo info) {
- try {
- beginInput();
- boolean alreadyExists = getSyncInfo(info.getLocal()) != null;
- internalAdd(info);
- if (alreadyExists) {
- getChangeEvent().changed(info);
- } else {
- getChangeEvent().added(info);
- }
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Add all the syncinfo from the given set to this set.
- * @param set the set whose sync info should be added to this set
- */
- public void addAll(SyncInfoSet set) {
- try {
- beginInput();
- SyncInfo[] infos = set.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- add(infos[i]);
- }
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Remove the given local resource from the set
- * @param resource the local resource to remove
- */
- public synchronized void remove(IResource resource) {
- try {
- beginInput();
- SyncInfo info = internalRemove(resource);
- getChangeEvent().removed(resource, info);
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Remove all the given resources from the set.
- * @param resources the resources to be removed
- */
- public void removeAll(IResource[] resources) {
- try {
- beginInput();
- for (int i = 0; i < resources.length; i++) {
- remove(resources[i]);
- }
- } finally {
- endInput(null);
- }
- }
-
- /**
- * 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));
- }
-
- /**
- * Indicate whether the set has nodes matching the given filter.
- * @param filter a sync info filter
- */
- public boolean hasNodes(FastSyncInfoFilter filter) {
- SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (info != null && filter.select(info)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Removes all nodes from this set that do not match the given filter
- * leaving only those that do match the filter.
- * @param filter a sync info filter
- */
- public void selectNodes(FastSyncInfoFilter filter) {
- try {
- beginInput();
- SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (info == null || !filter.select(info)) {
- remove(info.getLocal());
- }
- }
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Removes all nodes from this set that match the given filter
- * leaving those that do not match the filter.
- * @param filter a sync info filter
- */
- public void rejectNodes(FastSyncInfoFilter filter) {
- try {
- beginInput();
- SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (info != null && filter.select(info)) {
- remove(info.getLocal());
- }
- }
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Return all nodes in this set that match the given filter.
- * @param filter a sync info filter
- */
- public SyncInfo[] getNodes(FastSyncInfoFilter filter) {
- List result = new ArrayList();
- SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (info != null && filter.select(info)) {
- result.add(info);
- }
- }
- return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]);
- }
-
- /**
- * Returns <code>true</code> if this sync set has incoming changes.
- * Note that conflicts are not considered to be incoming changes.
- */
- public boolean hasIncomingChanges() {
- return countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK) > 0;
- }
-
- /**
- * Returns <code>true</code> if this sync set has outgoing changes.
- * Note that conflicts are not considered to be outgoing changes.
- */
- public boolean hasOutgoingChanges() {
- return countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK) > 0;
- }
-
- /**
- * This method is used to obtain a lock on the set which ensures thread safety
- * and batches change notification. If the set is locked by another thread,
- * the calling thread will block until the lock
- * becomes available. This method uses an <code>org.eclipse.core.runtime.jobs.ILock</code>.
- * <p>
- * It is important that the lock is released after it is obtained. Calls to <code>endInput</code>
- * should be done in a finally block as illustrated in the following code snippet.
- * <pre>
- * try {
- * set.beginInput();
- * // do stuff
- * } finally {
- * set.endInput(progress);
- * }
- * </pre>
- * Calls to <code>beginInput</code> and <code>endInput</code> can be nested and must be matched.
- */
- public void beginInput() {
- lock.acquire();
- }
-
- /**
- * This method is used to release the lock on this set. The prgress monitor is needed to allow
- * listeners to perform long-running operations is reponse to the set change. The lock is held
- * while the listeners are notified so listeners must be cautious in order to avoid deadlock.
- */
- public void endInput(IProgressMonitor monitor) {
- if (lock.getDepth() == 1) {
- // Remain locked while firing the events so the handlers
- // can expect the set to remain constant while they process the events
- fireChanges(Policy.monitorFor(monitor));
- }
- lock.release();
- }
-
- protected void resetChanges() {
- changes = createEmptyChangeEvent();
- }
-
- /**
- * Create an empty change event. Subclass may override to provided specialized event types
- * @return an empty change event
- */
- protected SyncSetChangedEvent createEmptyChangeEvent() {
- return new SyncSetChangedEvent(this);
- }
-
- private void fireChanges(final IProgressMonitor monitor) {
- // Use a synchronized block to ensure that the event we send is static
- final SyncSetChangedEvent event;
- synchronized(this) {
- event = getChangeEvent();
- resetChanges();
- }
- // Ensure that the list of listeners is not changed while events are fired.
- // Copy the listeners so that addition/removal is not blocked by event listeners
- if(event.isEmpty() && ! event.isReset()) return;
- ISyncInfoSetChangeListener[] allListeners = getListeners();
- // Fire the events using an ISafeRunnable
- final ITeamStatus[] newErrors = event.getErrors();
- monitor.beginTask(null, 100 + (newErrors.length > 0 ? 50 : 0) * allListeners.length);
- for (int i = 0; i < allListeners.length; i++) {
- final ISyncInfoSetChangeListener listener = allListeners[i];
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // don't log the exception....it is already being logged in Platform#run
- }
- public void run() throws Exception {
- try {
- lockedForModification = true;
- if (event.isReset()) {
- listener.syncInfoSetReset(SyncInfoSet.this, Policy.subMonitorFor(monitor, 100));
- } else {
- listener.syncInfoChanged(event, Policy.subMonitorFor(monitor, 100));
- }
- if (newErrors.length > 0) {
- listener.syncInfoSetErrors(SyncInfoSet.this, newErrors, Policy.subMonitorFor(monitor, 50));
- }
- } finally {
- lockedForModification = false;
- }
- }
- });
- }
- monitor.done();
- }
-
- /**
- * Return a copy of all the listeners registered with this set
- * @return the listeners
- */
- protected ISyncInfoSetChangeListener[] getListeners() {
- ISyncInfoSetChangeListener[] allListeners;
- synchronized(listeners) {
- allListeners = (ISyncInfoSetChangeListener[]) listeners.toArray(new ISyncInfoSetChangeListener[listeners.size()]);
- }
- return allListeners;
- }
-
- /**
- * Return the change event that is accumulating the changes to the set.
- * This can be called by sublasses to access the event.
- * @return Returns the changes.
- */
- protected SyncSetChangedEvent getChangeEvent() {
- return changes;
- }
-
- /**
- * Add the error to the set. Errors should be added to the set when the client
- * populating the set cannot determine the <code>SyncInfo</code> for one
- * or more resources due to an exception or some other problem. Listeners
- * will be notified that an error occurred and can react accordingly.
- * Only one error can be associated with a resource (which is obtained from
- * the <code>ITeamStatus</code>). It is up to the
- * client populating the set to ensure that the error associated with a
- * resource contains all relevent information.
- * The error will remain in the set until the set is reset.
- * @param resource the resource associated with the error or the workspace root
- * @param status the status that describes the error that occurred.
- */
- public void addError(ITeamStatus status) {
- try {
- beginInput();
- errors.put(status.getResource(), status);
- getChangeEvent().errorOccurred(status);
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Return an array of the errors the occurred while populating this set.
- * The errors will remain with the set until it is reset.
- * @return the errors
- */
- public ITeamStatus[] getErrors() {
- return (ITeamStatus[]) errors.values().toArray(new ITeamStatus[errors.size()]);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
deleted file mode 100644
index c56f7465d..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.synchronize;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.core.subscribers.SyncInfoTreeChangeEvent;
-import org.eclipse.team.internal.core.subscribers.SyncSetChangedEvent;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * Provides addition API for accessing the <code>SyncInfo</code> in the set through
- * their resource's hierarchical relationships.
- * <p>
- * Events fired from a <code>SyncInfoTree</code> will be instances of <code>ISyncInfoTreeChangeEvent</code>.
- */
-public class SyncInfoTree extends SyncInfoSet {
-
- protected Map parents = Collections.synchronizedMap(new HashMap());
-
- /**
- * Create an empty sync info tree.
- */
- public SyncInfoTree() {
- super();
- }
-
- /**
- * Create a sync info tree containing the given sync info elements.
- * @param infos the sync info elements
- */
- public SyncInfoTree(SyncInfo[] infos) {
- super(infos);
- }
-
- /**
- * Return wether the given resource has any children in the sync set. The children
- * could be either out-of-sync resources that are contained by the set or containers
- * that are ancestors of out-of-sync resources contained by the set.
- * @param resource the parent resource
- * @return the members of the parent in the set.
- */
- public synchronized boolean hasMembers(IResource resource) {
- if (resource.getType() == IResource.FILE) return false;
- IContainer parent = (IContainer)resource;
- if (parent.getType() == IResource.ROOT) return !isEmpty();
- IPath path = parent.getFullPath();
- Set allDescendants = (Set)parents.get(path);
- return (allDescendants != null && !allDescendants.isEmpty());
- }
-
- /**
- * Return the <code>SyncInfo</code> for each out-of-sync resource in the subtree rooted at the given resource
- * to the depth specified. The depth is one of:
- * <ul>
- * <li><code>IResource.DEPTH_ZERO</code>: the resource only,
- * <li><code>IResource.DEPTH_ONE</code>: the resource or its direct children,
- * <li><code>IResource.DEPTH_INFINITE</code>: the resource and all of it's descendants.
- * <ul>
- * If the given resource is out of sync, it will be included in the result.
- * <p>
- * The default implementation makes use of <code>getSyncInfo(IResource)</code>,
- * <code>members(IResource)</code> and <code>getSyncInfos()</code>
- * to provide the varying depths. Subclasses may override to optimize.
- *
- * @param resource the root of the resource subtree
- * @param depth the depth of the subtree
- * @return the <code>SyncInfo</code> for any out-of-sync resources
- */
- public synchronized SyncInfo[] getSyncInfos(IResource resource, int depth) {
- if (depth == IResource.DEPTH_ZERO || resource.getType() == IResource.FILE) {
- SyncInfo info = getSyncInfo(resource);
- if (info == null) {
- return new SyncInfo[0];
- } else {
- return new SyncInfo[] { info };
- }
- }
- if (depth == IResource.DEPTH_ONE) {
- List result = new ArrayList();
- SyncInfo info = getSyncInfo(resource);
- if (info != null) {
- result.add(info);
- }
- IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
- info = getSyncInfo(member);
- if (info != null) {
- result.add(info);
- }
- }
- return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]);
- }
- // if it's the root then return all out of sync resources.
- if(resource.getType() == IResource.ROOT) {
- return getSyncInfos();
- }
- // for folders return all children deep.
- return internalGetDeepSyncInfo((IContainer)resource);
- }
-
- /*
- * Return the <code>SyncInfo</code> for all out-of-sync resources in the
- * set that are at or below the given resource in the resource hierarchy.
- * @param resource the root resource
- * @return the <code>SyncInfo</code> for all out-of-sync resources at or below the given resource
- */
- private synchronized SyncInfo[] internalGetDeepSyncInfo(IContainer resource) {
- List infos = new ArrayList();
- IResource[] children = internalGetOutOfSyncDescendants((IContainer)resource);
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
- SyncInfo info = getSyncInfo(child);
- if(info != null) {
- infos.add(info);
- } else {
- TeamPlugin.log(IStatus.INFO, Policy.bind("SyncInfoTree.0") + child.getFullPath(), null); //$NON-NLS-1$
- }
- }
- return (SyncInfo[]) infos.toArray(new SyncInfo[infos.size()]);
- }
-
- protected SyncSetChangedEvent createEmptyChangeEvent() {
- return new SyncInfoTreeChangeEvent(this);
- }
-
- /**
- * Add the given <code>SyncInfo</code> to the set. A change event will
- * be generated unless the call to this method is nested in between calls
- * to <code>beginInput()</code> and <code>endInput(IProgressMonitor)</code>
- * in which case the event for this addition and any other sync set
- * change will be fired in a batched event when <code>endInput</code>
- * is invoked.
- * Invoking this method outside of the above mentioned block will result
- * in the <code>endInput(IProgressMonitor)</code> being invoked with a null
- * progress monitor. If responsiveness is required, the client should always
- * nest sync set modifications.
- * @param info
- */
- public void add(SyncInfo info) {
- try {
- beginInput();
- super.add(info);
- IResource local = info.getLocal();
- addToParents(local, local);
- } finally {
- endInput(null);
- }
- }
-
- /**
- * Remove the <code>SyncInfo</code> for the given resource from this set.
- * @param resource the resource to be removed
- */
- public void remove(IResource resource) {
- try {
- beginInput();
- super.remove(resource);
- removeFromParents(resource, resource);
- } finally {
- endInput(null);
- }
-
- }
-
- /**
- * Reset the sync set so it is empty.
- */
- public void clear() {
- try {
- beginInput();
- super.clear();
- synchronized(this) {
- parents.clear();
- }
- } finally {
- endInput(null);
- }
- }
-
- private synchronized 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) {
- internalAddedSubtreeRoot(parent);
- }
- return addedParent;
- }
-
- private synchronized 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) {
- internalRemovedSubtreeRoot(parent);
- }
- return removedParent;
- }
-
- private void internalAddedSubtreeRoot(IResource parent) {
- ((SyncInfoTreeChangeEvent)getChangeEvent()).addedSubtreeRoot(parent);
- }
-
- private void internalRemovedSubtreeRoot(IResource parent) {
- ((SyncInfoTreeChangeEvent)getChangeEvent()).removedSubtreeRoot(parent);
- }
-
- /**
- * Remove from this set the <code>SyncInfo</code> for the given resource and any of its descendants
- * within the specified depth. The depth is one of:
- * <ul>
- * <li><code>IResource.DEPTH_ZERO</code>: the resource only,
- * <li><code>IResource.DEPTH_ONE</code>: the resource or its direct children,
- * <li><code>IResource.DEPTH_INFINITE</code>: the resource and all of it's descendants.
- * <ul>
- * @param resource the root of the resource subtree
- * @param depth the depth of the subtree
- */
- public void remove(IResource resource, int depth) {
- try {
- beginInput();
- if (getSyncInfo(resource) != null) {
- remove(resource);
- }
- if (depth == IResource.DEPTH_ZERO || resource.getType() == IResource.FILE) return;
- if (depth == IResource.DEPTH_ONE) {
- IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
- if (getSyncInfo(member) != null) {
- remove(member);
- }
- }
- } else if (depth == IResource.DEPTH_INFINITE) {
- IResource [] toRemove = internalGetOutOfSyncDescendants((IContainer)resource);
- for (int i = 0; i < toRemove.length; i++) {
- remove(toRemove[i]);
- }
- }
- } finally {
- endInput(null);
- }
- }
-
- protected synchronized IResource[] internalGetOutOfSyncDescendants(IContainer resource) {
- // The parent map contains a set of all out-of-sync children
- Set allChildren = (Set)parents.get(resource.getFullPath());
- if (allChildren == null) return new IResource[0];
- return (IResource[]) allChildren.toArray(new IResource[allChildren.size()]);
- }
-
- private synchronized IResource[] internalMembers(IWorkspaceRoot root) {
- Set possibleChildren = parents.keySet();
- Set children = new HashSet();
- for (Iterator it = possibleChildren.iterator(); it.hasNext();) {
- Object next = it.next();
- IResource element = root.findMember((IPath)next);
- if (element != null) {
- children.add(element.getProject());
- }
- }
- return (IResource[]) children.toArray(new IResource[children.size()]);
- }
-
- /**
- * Return the immediate children of the given resource who are either out-of-sync
- * or contain out-of-sync resources.
- *
- * @param resource the parent resource
- * @return the children of the resource that are either out-of-sync or are ancestors of
- * out-of-sync resources contained in the set
- */
- public synchronized IResource[] members(IResource resource) {
- if (resource.getType() == IResource.FILE) return new IResource[0];
- IContainer parent = (IContainer)resource;
- if (parent.getType() == IResource.ROOT) return internalMembers((IWorkspaceRoot)parent);
- // OPTIMIZE: could 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()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/package.html b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/package.html
deleted file mode 100644
index c21ea5545..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/package.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta content="text/html; charset=iso-8859-1"
- http-equiv="Content-Type">
- <meta content="IBM" name="Author">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Application programming interfaces for managing synchronization state.
-<h2>Package Specification</h2>
-<p>This package specifies the API for managing the synchronization
-state between the local workspace resources and a corresponding
-variants of those resources. The classes in this package can be used by
-Subscribers (see the org.eclipse.team.core.subscribers package) or
-others. The classes are roughly divided into three categories: <br>
-</p>
-<ul>
- <li>describing the synchronization state of a single resource, <br>
- </li>
- <li>describing the synchronization state of a collection of
-resources, and <br>
- </li>
- <li>notifying interested parties of changes in the synchronization
-state.</li>
-</ul>
-<h3>Describing the synchronization state of a single resource</h3>
-<p>The following classes are provided in order to map a local resource
-to its corresponding variant resource and, for the case of a three-way
-compare, base resource.</p>
-<ul>
- <li>SyncInfo: node which maps a local resource to a corresponding
-variant resource (and a base resource for three-way compare) and
-descibes the synchronization state of those resources (e.g. in-sync or
-incoming-change).</li>
- <li>IResourceVariant: interface used by SyncInfo to access
-information about a variant resource, such as it's name, its type (file
-or container) and its contents.</li>
- <li>IResourceVariantComparator: interface used by SyncInfo to
-indicate whether the comparison to be used is two-way or three-way and
-to compare either a local resource with a remote resource or, in the
-case of a three-way compare, two remote resources.</li>
-</ul>
-<h3>Describing the synchronization state of a collection of resources</h3>
-<p>The following classes are provided to accumulate multiple SyncInfo
-and to filter the accumulated set based on some selection criteria.</p>
-<ul>
- <li>SyncInfoSet: a set which contains the out-of-sync SyncInfo for
-multiple local resources.</li>
- <li>SyncInfoTree: a specialized set optimized for hierarchical
-resource based access (e.g. to obtain all out-of-sync children of a
-particular local resource).</li>
-</ul>
-<h3>Notifying interested parties of sync info set changes</h3>
-<p>Interested parties can register with a SyncInfoSet in order to
-receive notification when a set changes.</p>
-<ul>
- <li>ISyncInfoSetChangeListener: implementors of this interface can be
-registered with a SyncInfoSet in order to recieve notification when the
-contents of the set change.</li>
- <li>ISyncInfoSetChangeEvent: the type of the events generated by a
-SyncInfoSet</li>
- <li>ISyncInfoTreeChangeEvent: specialized ISyncInfoSetChangeEvent
-generated by SyncInfoTree which includes notification of resource
-subtree aditions and removals.</li>
-</ul>
-<h3>Additional classes</h3>
-<p>There are also some additional classes provided to help manage
-SyncInfoSets</p>
-<ul>
- <li>SyncInfoFilter: a filter that can be used to test SyncInfo. Long
-running tests are supported via an IProgressMonitor. SyncInfoSet has
-API for selecting and rejecting SyncInfo based on a provided filter.</li>
- <li>FastSyncInfoFilter: a specialized filter that does not support
-the ue of a progress monitor</li>
-</ul>
-<p>Several common filters are provided as inner classes of the two
-filter classes for doing synchronization state tests and filter
-compounding (and, or, not).</p>
-<p>&nbsp;</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java
deleted file mode 100644
index 00689ac0b..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-
-
-public final class Assert {
- public static class AssertionFailedException extends RuntimeException {
- public AssertionFailedException() {
- }
- public AssertionFailedException(String detail) {
- super(Policy.bind("Assert.assertionFailed", detail)); //$NON-NLS-1$
- }
- }
-/* This class is not intended to be instantiated. */
-private Assert() {
-}
-/** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression) {
- return isLegal(expression, ""); //$NON-NLS-1$
-}
-/** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException(message);
- return expression;
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param object the value to test
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object) {
- if (object == null)
- throw new AssertionFailedException("null argument"); //$NON-NLS-1$
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new AssertionFailedException("null argument:" /*non NLS*/ + message); //$NON-NLS-1$
-}
-/** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression) {
- return isTrue(expression, ""/*nonNLS*/); //$NON-NLS-1$
-}
-/** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression, String message) {
- if (!expression)
- throw new AssertionFailedException("assert failed:" /*non NLS*/ + message); //$NON-NLS-1$
- return expression;
-}
-/**
- * Indicates that the caller has not implemented the method.
- * Usually this is a temporary condition.
- */
-public static void notYetImplemented() {
-}
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java
deleted file mode 100644
index 876e6fe64..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.team.core.TeamException;
-
-/**
- * This class provides the infrastucture for processing/dispatching of events using a
- * background job. This is useful in the following situations.
- * <ul>
- * <li>an operation is potentially long running but a resposive UI is desired
- * while the operation is being performed.</li>
- * <li>a change is a POST_CHANGE delta requires further modifications to the workspace
- * which cannot be performed in the delta handler because the workspace is locked.</li>
- * <li>a data structure is not thread safe and requires serialized operations.<li>
- * </ul>
- * </p>
- * @since 3.0
- */
-public abstract class BackgroundEventHandler {
-
- // Events that need to be processed
- private List awaitingProcessing = new ArrayList();
-
- // The job that runs when events need to be processed
- private Job eventHandlerJob;
-
- // Indicate if the event handler has been shutdown
- private boolean shutdown;
-
- // Accumulate exceptions that occur
- private ExceptionCollector errors;
-
- // time the last dispath took
- private long processingEventsDuration = 0L;
-
- // time between event dispatches
- private long DISPATCH_DELAY = 1500;
-
- // time to wait for messages to be queued
- private long WAIT_DELAY = 1000;
-
- private String jobName;
-
- /**
- * Resource event class. The type is specific to subclasses.
- */
- public static class Event {
- IResource resource;
- int type;
- int depth;
- public Event(IResource resource, int type, int depth) {
- this.resource = resource;
- this.type = type;
- this.depth = depth;
- }
- public int getDepth() {
- return depth;
- }
- public IResource getResource() {
- return resource;
- }
- public int getType() {
- return type;
- }
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("resource: "); //$NON-NLS-1$
- buffer.append(resource.getFullPath());
- buffer.append(" type: "); //$NON-NLS-1$
- buffer.append(getTypeString());
- buffer.append(" depth: "); //$NON-NLS-1$
- buffer.append(getDepthString());
- return buffer.toString();
- }
- protected String getDepthString() {
- switch (depth) {
- case IResource.DEPTH_ZERO :
- return "DEPTH_ZERO"; //$NON-NLS-1$
- case IResource.DEPTH_ONE :
- return "DEPTH_ONE"; //$NON-NLS-1$
- case IResource.DEPTH_INFINITE :
- return "DEPTH_INFINITE"; //$NON-NLS-1$
- default :
- return "INVALID"; //$NON-NLS-1$
- }
- }
- protected String getTypeString() {
- return String.valueOf(type);
- }
- }
-
- protected BackgroundEventHandler(String jobName, String errorTitle) {
- this.jobName = jobName;
- errors =
- new ExceptionCollector(
- errorTitle,
- TeamPlugin.ID,
- IStatus.ERROR,
- null /* don't log */
- );
- createEventHandlingJob();
- schedule();
- }
-
- /**
- * Create the job used for processing the events in the queue. The job stops working when
- * the queue is empty.
- */
- protected void createEventHandlingJob() {
- eventHandlerJob = new Job(getName()) {
- public IStatus run(IProgressMonitor monitor) {
- return processEvents(monitor);
- }
- public boolean shouldRun() {
- return ! isQueueEmpty();
- }
- public boolean shouldSchedule() {
- return ! isQueueEmpty();
- }
- };
- eventHandlerJob.addJobChangeListener(new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- jobDone(event);
- }
- });
- eventHandlerJob.setSystem(true);
- eventHandlerJob.setPriority(Job.SHORT);
- }
-
- /**
- * This method is invoked when the processing job completes. The
- * default behavior of the handler is to restart the job if the queue
- * is no longer empty and to clear the queue if the handler was shut down.
- */
- protected void jobDone(IJobChangeEvent event) {
- if (isShutdown()) {
- // The handler has been shutdown. Clean up the queue.
- synchronized(this) {
- awaitingProcessing.clear();
- }
- } else if (! isQueueEmpty()) {
- // An event squeaked in as the job was finishing. Reschedule the job.
- schedule();
- }
- }
-
- /**
- * Schedule the job to process the events now.
- */
- protected void schedule() {
- eventHandlerJob.schedule();
- }
-
- /**
- * Shutdown the event handler. Any events on the queue will be removed from the queue
- * and will not be processed.
- */
- public void shutdown() {
- shutdown = true;
- eventHandlerJob.cancel();
- }
-
- /**
- * Returns whether the handle has been shutdown.
- * @return Returns whether the handle has been shutdown.
- */
- public boolean isShutdown() {
- return shutdown;
- }
-
- /**
- * Queue the event and start the job if it's not already doing work. If the job is
- * already running then notify in case it was waiting.
- * @param event the event to be queued
- */
- protected synchronized void queueEvent(Event event, boolean front) {
- if (Policy.DEBUG_BACKGROUND_EVENTS) {
- System.out.println("Event queued on " + getName() + ":" + event.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (front) {
- awaitingProcessing.add(0, event);
- } else {
- awaitingProcessing.add(event);
- }
- if (!isShutdown() && eventHandlerJob != null) {
- if(eventHandlerJob.getState() == Job.NONE) {
- schedule();
- } else {
- notify();
- }
- }
- }
-
- /**
- * Return the name that is to be associated with the background job.
- * @return the job name
- */
- protected String getName() {
- return jobName;
- }
-
- /*
- * Return the next event that has been queued, removing it from the queue.
- * @return the next event in the queue
- */
- protected synchronized Event nextElement() {
- if (isShutdown() || isQueueEmpty()) {
- return null;
- }
- return (Event) awaitingProcessing.remove(0);
- }
-
- protected synchronized Event peek() {
- if (isShutdown() || isQueueEmpty()) {
- return null;
- }
- return (Event) awaitingProcessing.get(0);
- }
-
- /**
- * Return whether there are unprocessed events on the event queue.
- * @return whether there are unprocessed events on the queue
- */
- protected synchronized boolean isQueueEmpty() {
- return awaitingProcessing.isEmpty();
- }
-
- /**
- * Process events from the events queue and dispatch results. This method does not
- * directly check for or handle cancelation of the provided monitor. However,
- * it does invoke <code>processEvent(Event)</code> which may check for and handle
- * cancelation by shuting down the receiver.
- * <p>
- * The <code>isReadyForDispatch()</code> method is used in conjuntion
- * with the <code>dispatchEvents(IProgressMonitor)</code> to allow
- * the output of the event handler to be batched in order to avoid
- * fine grained UI updating.
- * @param monitor a progress monitor
- */
- protected IStatus processEvents(IProgressMonitor monitor) {
- errors.clear();
- try {
- // It's hard to know how much work is going to happen
- // since the queue can grow. Use the current queue size as a hint to
- // an infinite progress monitor
- monitor.beginTask(null, 100);
- IProgressMonitor subMonitor = Policy.infiniteSubMonitorFor(monitor, 90);
- subMonitor.beginTask(null, 1024);
-
- Event event;
- processingEventsDuration = System.currentTimeMillis();
- while ((event = nextElement()) != null && ! isShutdown()) {
- try {
- processEvent(event, subMonitor);
- if (Policy.DEBUG_BACKGROUND_EVENTS) {
- System.out.println("Event processed on " + getName() + ":" + event.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if(isReadyForDispatch(true /*wait if queue is empty*/)) {
- dispatchEvents(Policy.subMonitorFor(subMonitor, 1));
- eventsDispatched();
- }
- } catch (CoreException e) {
- // handle exception but keep going
- handleException(e);
- }
- }
- } finally {
- monitor.done();
- }
- return errors.getStatus();
- }
-
- protected void eventsDispatched() {
- processingEventsDuration = System.currentTimeMillis();
- }
-
- /**
- * Notify clients of processed events.
- * @param monitor a progress monitor
- */
- protected abstract void dispatchEvents(IProgressMonitor monitor) throws TeamException;
-
- /**
- * Returns <code>true</code> if processed events should be dispatched and
- * <code>false</code> otherwise. Events are dispatched at regular intervals
- * to avoid fine grain events causing the UI to be too jumpy. Also, if the
- * events queue is empty we will wait a small amount of time to allow
- * pending events to be queued. The queueEvent notifies when events are
- * queued.
- * @return <code>true</code> if processed events should be dispatched and
- * <code>false</code> otherwise
- */
- protected boolean isReadyForDispatch(boolean wait) {
- long duration = System.currentTimeMillis() - processingEventsDuration;
- if(duration >= DISPATCH_DELAY) {
- return true;
- }
- synchronized(this) {
- if(! isQueueEmpty() || ! wait) {
- return false;
- }
- try {
- wait(WAIT_DELAY);
- } catch (InterruptedException e) {
- // just continue
- }
- }
- return isQueueEmpty();
- }
-
- /**
- * Handle the exception by recording it in the errors list.
- * @param e
- */
- protected void handleException(CoreException e) {
- errors.handleException(e);
-
- }
-
- /**
- * Process the event in the context of a running background job. Subclasses may
- * (but are not required to) check the provided monitor for cancelation and shut down the
- * receiver by invoking the <code>shutdown()</code> method.
- * <p>
- * In many cases, a background event handler will translate incoming events into outgoing
- * events. If this is the case, the handler should accumulate these events in the
- * <code>proceessEvent</code> method and propogate them from the <code>dispatchEvent</code>
- * method which is invoked periodically in order to batch outgoing events and avoid
- * the UI becoming too jumpy.
- *
- * @param event the <code>Event</code> to be processed
- * @param monitor a progress monitor
- */
- protected abstract void processEvent(Event event, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Return the job from which the <code>processedEvent</code> method is invoked.
- * @return Returns the background event handlig job.
- */
- public Job getEventHandlerJob() {
- return eventHandlerJob;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
deleted file mode 100644
index 90e5c154a..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.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.core;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.Team;
-
-public class DefaultFileModificationValidator implements IFileModificationValidator {
- private static final Status OK = Team.OK_STATUS;
-
- private IStatus getDefaultStatus(IFile file) {
- return
- file.isReadOnly()
- ? new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.READ_ONLY_LOCAL, Policy.bind("FileModificationValidator.fileIsReadOnly", file.getFullPath().toString()), null) //$NON-NLS-1$
- : OK;
- }
-
- /**
- * @see IFileModificationValidator#validateEdit(IFile[], Object)
- */
- public IStatus validateEdit(IFile[] files, Object context) {
- if (files.length == 1) {
- return getDefaultStatus(files[0]);
- }
-
- IStatus[] stati = new Status[files.length];
- boolean allOK = true;
-
- for (int i = 0; i < files.length; i++) {
- stati[i] = getDefaultStatus(files[i]);
- if(! stati[i].isOK())
- allOK = false;
- }
-
- return new MultiStatus(TeamPlugin.ID,
- 0, stati,
- Policy.bind(
- allOK
- ? "FileModificationValidator.ok" //$NON-NLS-1$
- : "FileModificationValidator.someReadOnly" ), //$NON-NLS-1$
- null);
- }
-
- /**
- * @see IFileModificationValidator#validateSave(IFile)
- */
- public IStatus validateSave(IFile file) {
- return getDefaultStatus(file);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java
deleted file mode 100644
index 18dc39d63..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.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.core;
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.team.IMoveDeleteHook;
-import org.eclipse.core.resources.team.IResourceTree;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A class which provides the default behavior for resource deletions and moves.
- * This class can be overridden by providers to change some or all of the behavior
- * related to resources deletions or moves.
- *
- * @see org.eclipse.team.core.ResourceProvider#getMoveDeleteHook()
- */
-
-public class DefaultMoveDeleteHook implements IMoveDeleteHook {
-
- /**
- * @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
- */
- public boolean deleteFile(
- IResourceTree tree,
- IFile file,
- int updateFlags,
- IProgressMonitor monitor) {
- return false;
- }
-
- /**
- * @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
- */
- public boolean deleteFolder(
- IResourceTree tree,
- IFolder folder,
- int updateFlags,
- IProgressMonitor monitor) {
- return false;
- }
-
- /**
- * @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
- */
- public boolean deleteProject(
- IResourceTree tree,
- IProject project,
- int updateFlags,
- IProgressMonitor monitor) {
- return false;
- }
-
- /**
- * @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
- */
- public boolean moveFile(
- IResourceTree tree,
- IFile source,
- IFile destination,
- int updateFlags,
- IProgressMonitor monitor) {
- return false;
- }
-
- /**
- * @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
- */
- public boolean moveFolder(
- IResourceTree tree,
- IFolder source,
- IFolder destination,
- int updateFlags,
- IProgressMonitor monitor) {
- return false;
- }
-
- /**
- * @see IMoveDeleteHook#moveProject(IResourceTree, IProject, IProjectDescription, int, IProgressMonitor)
- */
- public boolean moveProject(
- IResourceTree tree,
- IProject source,
- IProjectDescription description,
- int updateFlags,
- IProgressMonitor monitor) {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java
deleted file mode 100644
index 018c8a860..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.team.core.*;
-import org.eclipse.team.internal.core.registry.DeploymentProviderDescriptor;
-import org.eclipse.team.internal.core.registry.DeploymentProviderRegistry;
-import org.eclipse.team.internal.core.Policy;
-
-public class DeploymentProviderManager implements IDeploymentProviderManager, IResourceChangeListener {
-
- // key for remembering if state has been loaded for a project
- private final static QualifiedName STATE_LOADED_KEY = new QualifiedName("org.eclipse.team.core.deployment", "state_restored_key"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // {project -> list of Mapping}
- private Map mappings = new HashMap(5);
-
- // registry for deployment provider extensions
- private DeploymentProviderRegistry registry;
-
- // lock to ensure that map/unmap and getProvider support concurrency
- private static final ILock mappingLock = Platform.getJobManager().newLock();
-
- // persistence constants
- private final static String CTX_PROVIDERS = "deploymentProviders"; //$NON-NLS-1$
- private final static String CTX_PROVIDER = "provider"; //$NON-NLS-1$
- private final static String CTX_ID = "id"; //$NON-NLS-1$
- private final static String CTX_PATH = "container_path"; //$NON-NLS-1$
- private final static String CTX_PROVIDER_DATA = "data"; //$NON-NLS-1$
- private final static String FILENAME = ".deployments"; //$NON-NLS-1$
-
- static class Mapping {
- private DeploymentProviderDescriptor descriptor;
- private DeploymentProvider provider;
- private IContainer container;
- private IMemento savedState;
-
- Mapping(DeploymentProviderDescriptor descriptor, IContainer container) {
- this.descriptor = descriptor;
- this.container = container;
- }
- public DeploymentProvider getProvider() throws TeamException {
- if(provider == null) {
- try {
- this.provider = descriptor.createProvider();
- this.provider.setContainer(container);
- this.provider.restoreState(savedState);
- this.savedState = null;
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
- return provider;
- }
- public void setProvider(DeploymentProvider provider) {
- this.provider = provider;
- this.savedState = null;
- }
- public IContainer getContainer() {
- return container;
- }
- public DeploymentProviderDescriptor getDescription() {
- return descriptor;
- }
- public void setProviderState(IMemento savedState) {
- this.savedState = savedState;
- }
- }
-
- public DeploymentProviderManager() {
- registry = new DeploymentProviderRegistry();
- }
-
- public void map(IContainer container, DeploymentProvider deploymentProvider) throws TeamException {
- try {
- mappingLock.acquire();
- if (!deploymentProvider.isMultipleMappingsSupported()) {
- // don't allow is overlapping deployment providers of the same type
- checkOverlapping(container, deploymentProvider.getID());
- }
-
- // extension point descriptor must exist
- DeploymentProviderDescriptor descriptor = registry.find(deploymentProvider.getID());
- if(descriptor == null) {
- throw new TeamException(Policy.bind("DeploymentProviderManager.10", deploymentProvider.getID())); //$NON-NLS-1$
- }
-
- // create the new mapping
- Mapping m = internalMap(container, descriptor);
- m.setProvider(deploymentProvider);
- deploymentProvider.setContainer(container);
- deploymentProvider.init();
-
- saveState(container.getProject());
- // TODO: what kind of event is generated when one is mapped?
- } finally {
- mappingLock.release();
- }
- }
-
- public void unmap(IContainer container, DeploymentProvider teamProvider) throws TeamException {
- try {
- mappingLock.acquire();
- IProject project = container.getProject();
- List projectMaps = internalGetMappings(container);
- Mapping[] m = internalGetMappingsFor(container, teamProvider.getID());
- for (int i = 0; i < m.length; i++) {
- Mapping mapping = m[i];
- if (mapping.getProvider() == teamProvider) {
- projectMaps.remove(mapping);
- if(projectMaps.isEmpty()) {
- mappings.remove(project);
- }
- }
- }
-
- // dispose of provider
- teamProvider.dispose();
- saveState(container.getProject());
-
- // TODO: what kind of event is sent when unmapped?
- } finally {
- mappingLock.release();
- }
- }
-
- public DeploymentProvider[] getMappings(IResource resource) {
- List projectMappings = internalGetMappings(resource);
- String fullPath = resource.getFullPath().toString();
- List result = new ArrayList();
- if(projectMappings != null) {
- for (Iterator it = projectMappings.iterator(); it.hasNext();) {
- Mapping m = (Mapping) it.next();
- if(fullPath.startsWith(m.getContainer().getFullPath().toString())) {
- try {
- // lazy initialize of provider must be supported
- // TODO: It is possible that the provider has been unmap concurrently
- result.add(m.getProvider());
- } catch (CoreException e) {
- TeamPlugin.log(e);
- }
- }
- }
- }
- return (DeploymentProvider[]) result.toArray(new DeploymentProvider[result.size()]);
- }
-
- public DeploymentProvider[] getMappings(IResource resource, String id) {
- Mapping[] m = internalGetMappingsFor(resource, id);
- List result = new ArrayList();
- for (int i = 0; i < m.length; i++) {
- Mapping mapping = m[i];
- try {
- // lazy initialize of provider must be supported
- // TODO: It is possible that the provider has been unmap concurrently
- result.add(mapping.getProvider());
- } catch (TeamException e) {
- TeamPlugin.log(e);
- }
- }
-
- DeploymentProvider[] providers = (DeploymentProvider[]) result.toArray(new DeploymentProvider[result.size()]);
- // Ensure that multiple providers are not mapped if it is not supported
- // by the provider type. This could occur if the deployment configuration
- // was loaded from a repository or modified manually
- if (providers.length > 1 && !providers[0].isMultipleMappingsSupported()) {
- // Log and ignore all but one of the mappings
- TeamPlugin.log(IStatus.WARNING, Policy.bind("DeploymentProviderManager.12", resource.getFullPath().toString(), id), null); //$NON-NLS-1$
- return new DeploymentProvider[] { providers[0] };
- }
- return providers;
- }
-
- public boolean getMappedTo(IResource resource, String id) {
- return internalGetMappingsFor(resource, id).length > 0;
- }
-
- private void checkOverlapping(IContainer container, String id) throws TeamException {
- List projectMappings = internalGetMappings(container);
- String fullPath = container.getFullPath().toString();
- if(projectMappings != null) {
- for (Iterator it = projectMappings.iterator(); it.hasNext();) {
- Mapping m = (Mapping) it.next();
- String first = m.getContainer().getFullPath().toString();
- if(fullPath.startsWith(first) || first.startsWith(fullPath)) {
- if (m.getDescription().getId().equals(id)) {
- throw new TeamException(Policy.bind("DeploymentProviderManager.13", container.getFullPath().toString(), m.getDescription().getId())); //$NON-NLS-1$
- }
- }
- }
- }
- }
-
- private Mapping internalMap(IContainer container, DeploymentProviderDescriptor description) {
- Mapping newMapping = new Mapping(description, container);
- return internalMap(container, newMapping);
- }
-
- private Mapping internalMap(IContainer container, Mapping newMapping) {
- IProject project = container.getProject();
- List projectMaps = (List)mappings.get(project);
- if(projectMaps == null) {
- projectMaps = new ArrayList();
- mappings.put(project, projectMaps);
- }
- projectMaps.add(newMapping);
- return newMapping;
- }
-
- /*
- * Loads all the mappings associated with the resource's project.
- */
- private List internalGetMappings(IResource resource) {
- try {
- mappingLock.acquire();
- IProject project = resource.getProject();
- List m = (List)mappings.get(project);
- try {
- if(project.getSessionProperty(STATE_LOADED_KEY) != null) {
- return m;
- }
- Mapping[] projectMappings = loadMappings(project);
- for (int i = 0; i < projectMappings.length; i++) {
- Mapping mapping = projectMappings[i];
- internalMap(mapping.getContainer(), mapping);
- }
-
- project.setSessionProperty(STATE_LOADED_KEY, new Object());
- } catch (TeamException e) {
- } catch (CoreException e) {
- }
- return (List)mappings.get(project);
- } finally {
- mappingLock.release();
- }
- }
-
- private Mapping[] internalGetMappingsFor(IResource resource, String id) {
- List projectMappings = internalGetMappings(resource);
- List result = new ArrayList();
- String fullPath = resource.getFullPath().toString();
- if(projectMappings != null) {
- for (Iterator it = projectMappings.iterator(); it.hasNext();) {
- Mapping m = (Mapping) it.next();
- // mapping can be initialize without having provider loaded yet!
- if(m.getDescription().getId().equals(id) && fullPath.startsWith(m.getContainer().getFullPath().toString())) {
- result.add(m);
- }
- }
- }
- return (Mapping[]) result.toArray(new Mapping[result.size()]);
- }
-
- /**
- * Saves a file containing the list of participant ids that are registered with this
- * manager. Each participant is also given the chance to save it's state.
- */
- private void saveState(IProject project) throws TeamException {
- File file = getNonsharedSettingsFile(project);
- try {
- XMLMemento xmlMemento = XMLMemento.createWriteRoot(CTX_PROVIDERS);
- List providers = (List)mappings.get(project);
- if(providers == null) {
- if (file.exists()) {
- file.delete();
- }
- } else {
- for (Iterator it2 = providers.iterator(); it2.hasNext(); ) {
- Mapping mapping = (Mapping) it2.next();
- IMemento node = xmlMemento.createChild(CTX_PROVIDER);
- node.putString(CTX_ID, mapping.getDescription().getId());
- node.putString(CTX_PATH, mapping.getContainer().getProjectRelativePath().toString());
- mapping.getProvider().saveState(node.createChild(CTX_PROVIDER_DATA));
- }
- Writer writer = new BufferedWriter(new FileWriter(file));
- try {
- xmlMemento.save(writer);
- } finally {
- writer.close();
- }
- }
- } catch (IOException e) {
- throw new TeamException(Policy.bind("DeploymentProviderManager.15", project.getName()), e); //$NON-NLS-1$
- } catch(CoreException ce) {
- throw TeamException.asTeamException(ce);
- }
- }
-
- /**
- * @param project
- * @return
- */
- private File getNonsharedSettingsFile(IProject project) {
- IPath metaPath = project.getPluginWorkingLocation(TeamPlugin.getPlugin().getDescriptor());
- metaPath = metaPath.append(FILENAME);
- File file = metaPath.toFile();
- return file;
- }
-
- /*
- * Load the mappings for the given project and return them.
- */
- private Mapping[] loadMappings(IProject project) throws TeamException, CoreException {
- File file = getNonsharedSettingsFile(project);
- if(! file.exists()) {
- // The file may have been deleted before our delta listener was loaded.
- // If there are any deployments stored in the meta data area, dispose of them
- // TODO: See if there were any before and dispose of them
- return new Mapping[0];
- }
- Reader reader;
- try {
- reader = new BufferedReader(new FileReader(file));
- } catch (FileNotFoundException e) {
- return new Mapping[0];
- }
- return loadMappings(project, reader);
- }
-
- private Mapping[] loadMappings(IProject project, Reader reader) throws TeamException {
- try {
- IMemento memento = XMLMemento.createReadRoot(reader);
- IMemento[] providers = memento.getChildren(CTX_PROVIDER);
- List projectMappings = new ArrayList();
- for (int i = 0; i < providers.length; i++) {
- IMemento memento2 = providers[i];
- String id = memento2.getString(CTX_ID);
- IPath location = new Path(memento2.getString(CTX_PATH));
-
- if(! project.exists(location)) {
- TeamPlugin.log(IStatus.ERROR, Policy.bind("DeploymentProviderManager.16", location.toString(), project.getName()), null); //$NON-NLS-1$
- }
- IResource resource = location.isEmpty() ? (IContainer)project : project.findMember(location);
- if (resource.getType() == IResource.FILE) {
- TeamPlugin.log(IStatus.ERROR, Policy.bind("DeploymentProviderManager.17", location.toString(), project.getName()), null); //$NON-NLS-1$
- }
- IContainer container = (IContainer)resource;
- DeploymentProviderDescriptor desc = registry.find(id);
- if(desc != null) {
- Mapping m = new Mapping(desc, container);
- m.setProviderState(memento2.getChild(CTX_PROVIDER_DATA));
- projectMappings.add(m);
- } else {
- TeamPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.9", id), null); //$NON-NLS-1$
- }
- }
- return (Mapping[]) projectMappings.toArray(new Mapping[projectMappings.size()]);
- } finally {
- try {
- reader.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.IDeploymentProviderManager#getDeploymentProviderRoots(java.lang.String)
- */
- public IResource[] getDeploymentProviderRoots(String id) {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- Set roots = new HashSet();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- List mappings = internalGetMappings(project);
- if (mappings != null) {
- for (Iterator iter = mappings.iterator(); iter.hasNext();) {
- Mapping mapping = (Mapping) iter.next();
- if (id == null || mapping.getDescription().getId().equals(id)) {
- roots.add(mapping.getContainer());
- }
- }
- }
- }
- return (IResource[]) roots.toArray(new IResource[roots.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- processDelta(event.getDelta());
- }
-
- private void processDelta(IResourceDelta delta) {
- IResource resource = delta.getResource();
- int kind = delta.getKind();
-
- if (resource.getType() == IResource.PROJECT) {
- // Handle a deleted project
- if (((kind & IResourceDelta.REMOVED) != 0)) {
- handleProjectRemoval((IProject)resource);
- return;
- }
- // Handle a closed project
- if ((delta.getFlags() & IResourceDelta.OPEN) != 0 && !((IProject) resource).isOpen()) {
- handleProjectClose((IProject)resource);
- return;
- }
- }
-
- if (((kind & IResourceDelta.REMOVED) != 0) && (resource.getType() == IResource.FOLDER)) {
- handleFolderRemoval((IFolder)resource);
- }
-
- // Handle changed children
- IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED | IResourceDelta.ADDED);
- for (int i = 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i]);
- }
- }
-
- private void handleFolderRemoval(IFolder folder) {
- DeploymentProvider[] providers = getMappings(folder);
- for (int i = 0; i < providers.length; i++) {
- DeploymentProvider provider = providers[i];
- try {
- unmap(folder, provider);
- } catch (TeamException e) {
- TeamPlugin.log(e);
- }
- }
- }
-
- private void handleProjectClose(IProject project) {
- mappings.remove(project);
- }
-
- private void handleProjectRemoval(IProject project) {
- mappings.remove(project);
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
deleted file mode 100644
index 8fb182356..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * Collects exceptions and can be configured to ignore duplicates exceptions. Exceptions can be logged
- * and a MultiStatus containing all collected exceptions can be returned.
- *
- * @see org.eclipse.core.runtime.MultiStatus
- * @see org.eclipse.core.runtime.IStatus
- *
- * @since 3.0
- */
-public class ExceptionCollector {
-
- private Map exceptionBucket = new HashMap();
- private List statuses = new ArrayList();
- private String message;
- private String pluginId;
- private int severity;
- private ILog log;
- private boolean ignoreDuplicates = false;
-
- /**
- * Creates a collector and initializes the parameters for the top-level exception
- * that would be returned from <code>getStatus</code> is exceptions are collected.
- *
- * @param message a human-readable message, localized to the current locale
- * @param pluginId the unique identifier of the relevant plug-in
- * @param severity the severity; one of <code>OK</code>,
- * <code>ERROR</code>, <code>INFO</code>, or <code>WARNING</code>
- * @param code the plug-in-specific status code, or <code>OK</code>
- * @param log the log to output the exceptions to, or <code>null</code> if
- * exceptions should not be logged.
- */
- public ExceptionCollector(String message, String pluginId, int severity, ILog log) {
- this.message = message;
- this.pluginId = pluginId;
- this.severity = severity;
- this.log = log;
- }
-
- /**
- * Clears the exceptions collected.
- */
- public void clear() {
- statuses.clear();
- exceptionBucket.clear();
- }
-
- /**
- * Returns a status that represents the exceptions collected. If the collector
- * is empty <code>IStatus.OK</code> is returned. Otherwise a MultiStatus containing
- * all collected exceptions is returned.
- * @return a multistatus containing the exceptions collected or IStatus.OK if
- * the collector is empty.
- */
- public IStatus getStatus() {
- if(statuses.isEmpty()) {
- return Status.OK_STATUS;
- } else {
- MultiStatus multiStatus = new MultiStatus(pluginId, severity, message, null);
- Iterator it = statuses.iterator();
- while (it.hasNext()) {
- IStatus status = (IStatus) it.next();
- multiStatus.merge(status);
- }
- return multiStatus;
- }
- }
-
- /**
- * Returns whether duplicate exceptions are being ignored.
- * @return <code>true</code> if this collector is ignoring duplicate exceptions, and
- * <code>false</code> otherwise.
- */
- public boolean isIgnoreDuplicates() {
- return ignoreDuplicates;
- }
-
- /**
- * Sets whether duplicate exceptions are being ignored.
- * @param ignoreDuplicates <code>true</code> if this collector should ignore duplicate
- * exceptions, and <code>false</code> otherwise.
- */
- public void setIgnoreDuplicates(boolean ignoreDuplicates) {
- this.ignoreDuplicates = ignoreDuplicates;
- }
-
- /**
- * Add this exception to the collector. If a log was specified in the constructor
- * then the exception will be output to the log. You can retreive exceptions
- * using <code>getStatus</code>.
- *
- * @param exception the exception to collect
- */
- public void handleException(Exception e) {
- IStatus status = null;
- if(e instanceof CoreException) {
- status = ((CoreException)e).getStatus();
- }
- if(status != null) {
- logStatus(status);
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- IStatus status2 = children[i];
- logStatus(status2);
- }
- }
- }
-
- /**
- * Log and accumulate exceptions once for each {plugid,code} combination.
- */
- private void logStatus(IStatus status) {
- String pluginId = status.getPlugin();
- List codes = (List)exceptionBucket.get(pluginId);
- Integer code = new Integer(status.getCode());
- if(codes != null) {
- if(codes.contains(code) && isIgnoreDuplicates()) {
- return;
- }
- }
- // collect the status
- statuses.add(status);
-
- // update counts for this exception
- codes = new ArrayList(1);
- codes.add(code);
- exceptionBucket.put(pluginId, codes);
-
- // log if necessary
- if(log != null) {
- log.log(new Status(status.getSeverity(), pluginId, status.getCode(), message, status.getException()));
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java
deleted file mode 100644
index 7ad8a72c9..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFileModificationValidator;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.team.core.RepositoryProvider;
-
-public class FileModificationValidatorManager implements IFileModificationValidator {
- private static final IFileModificationValidator DEFAULT_VALIDATOR =
- new DefaultFileModificationValidator();
-
- /*
- * @see IFileModificationValidator#validateEdit(IFile[], Object)
- * For all files, determine which provider.
- * Ask each provider once for its files.
- * Collect the resulting status' and return a MultiStatus.
- */
- public IStatus validateEdit(IFile[] files, Object context) {
- ArrayList returnStati = new ArrayList();
-
- //map provider to the files under that provider's control
- Map providersToFiles = new HashMap(files.length);
-
- //for each file, determine which provider, map providers to files
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
- RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject());
-
- if (!providersToFiles.containsKey(provider)) {
- providersToFiles.put(provider, new ArrayList());
- }
-
- ((ArrayList)providersToFiles.get(provider)).add(file);
- }
-
- Iterator providersIterator = providersToFiles.keySet().iterator();
-
- boolean allOK = true;
-
- //for each provider, validate its files
- while(providersIterator.hasNext()) {
- RepositoryProvider provider = (RepositoryProvider)providersIterator.next();
- ArrayList filesList = (ArrayList)providersToFiles.get(provider);
- IFile[] filesArray = (IFile[])filesList.toArray(new IFile[filesList.size()]);
- IFileModificationValidator validator = DEFAULT_VALIDATOR;
-
- //if no provider or no validator use the default validator
- if (provider != null) {
- IFileModificationValidator v = provider.getFileModificationValidator();
- if (v != null) validator = v;
- }
-
- IStatus status = validator.validateEdit(filesArray, context);
- if(!status.isOK())
- allOK = false;
-
- returnStati.add(status);
- }
-
- if (returnStati.size() == 1) {
- return (IStatus)returnStati.get(0);
- }
-
- return new MultiStatus(TeamPlugin.ID,
- 0,
- (IStatus[])returnStati.toArray(new IStatus[returnStati.size()]),
- Policy.bind(
- allOK
- ? "FileModificationValidator.ok" //$NON-NLS-1$
- : "FileModificationValidator.editFailed"), //$NON-NLS-1$
- null); //$NON-NLS-1$
- }
-
- /*
- * @see IFileModificationValidator#validateSave(IFile)
- */
- public IStatus validateSave(IFile file) {
- RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject());
- IFileModificationValidator validator = DEFAULT_VALIDATOR;
-
- //if no provider or no validator use the default validator
- if (provider != null) {
- IFileModificationValidator v = provider.getFileModificationValidator();
- if (v != null) validator = v;
- }
-
- return validator.validateSave(file);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IJobListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IJobListener.java
deleted file mode 100644
index 3962d7f1d..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IJobListener.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.internal.core;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * This interface allows interested parties to receive notification
- * when work has started or stopped for a given job type. The <code>started</code>
- * method is invoked when the first job is started for the given <code>jobType</code>.
- * The <code>finish</code> method is called when the last job of a given type stops.
- * Several jobs for the job type may start and stop in the interum without causing
- * notification to the listener.
- */
-public interface IJobListener {
- public void started(QualifiedName jobType);
- public void finished(QualifiedName jobType);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IMemento.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IMemento.java
deleted file mode 100644
index fff33a1b7..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/IMemento.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-/**
- * Interface to a memento used for saving the important state of an object
- * in a form that can be persisted in the file system.
- * <p>
- * Mementos were designed with the following requirements in mind:
- * <ol>
- * <li>Certain objects need to be saved and restored across platform sessions.
- * </li>
- * <li>When an object is restored, an appropriate class for an object might not
- * be available. It must be possible to skip an object in this case.</li>
- * <li>When an object is restored, the appropriate class for the object may be
- * different from the one when the object was originally saved. If so, the
- * new class should still be able to read the old form of the data.</li>
- * </ol>
- * </p>
- * <p>
- * Mementos meet these requirements by providing support for storing a
- * mapping of arbitrary string keys to primitive values, and by allowing
- * mementos to have other mementos as children (arranged into a tree).
- * A robust external storage format based on XML is used.
- * </p><p>
- * The key for an attribute may be any alpha numeric value. However, the
- * value of <code>TAG_ID</code> is reserved for internal use.
- * </p><p>
- * This interface is not intended to be implemented or extended by clients.
- * </p>
- *
- * @see IPersistableElement
- * @see IElementFactory
- */
-public interface IMemento {
- /**
- * Special reserved key used to store the memento id
- * (value <code>"org.eclipse.ui.id"</code>).
- *
- * @see #getID()
- */
- public static final String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$
- /**
- * Creates a new child of this memento with the given type.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @return a new child memento
- * @see #getChild
- * @see #getChildren
- */
- public IMemento createChild(String type);
- /**
- * Creates a new child of this memento with the given type and id.
- * The id is stored in the child memento (using a special reserved
- * key, <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @param id the child id
- * @return a new child memento with the given type and id
- * @see #getID
- */
- public IMemento createChild(String type, String id);
- /**
- * Returns the first child with the given type id.
- *
- * @param type the type id
- * @return the first child with the given type
- */
- public IMemento getChild(String type);
- /**
- * Returns all children with the given type id.
- *
- * @param type the type id
- * @return the list of children with the given type
- */
- public IMemento[] getChildren(String type);
- /**
- * Returns the floating point value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not a floating point number
- */
- public Float getFloat(String key);
- /**
- * Returns the id for this memento.
- *
- * @return the memento id, or <code>null</code> if none
- * @see #createChild(java.lang.String,java.lang.String)
- */
- public String getID();
- /**
- * Returns the integer value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public Integer getInteger(String key);
- /**
- * Returns the string value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found
- */
- public String getString(String key);
- /**
- * Returns the data of the Text node of the memento. Each memento is allowed
- * only one Text node.
- *
- * @return the data of the Text node of the memento, or <code>null</code>
- * if the memento has no Text node.
- * @since 2.0
- */
- public String getTextData();
- /**
- * Sets the value of the given key to the given floating point number.
- *
- * @param key the key
- * @param value the value
- */
- public void putFloat(String key, float value);
- /**
- * Sets the value of the given key to the given integer.
- *
- * @param key the key
- * @param value the value
- */
- public void putInteger(String key, int value);
- /**
- * Copy the attributes and children from <code>memento</code>
- * to the receiver.
- *
- * @param memento the IMemento to be copied.
- */
- public void putMemento(IMemento memento);
- /**
- * Sets the value of the given key to the given string.
- *
- * @param key the key
- * @param value the value
- */
- public void putString(String key, String value);
- /**
- * Sets the memento's Text node to contain the given data. Creates the Text node if
- * none exists. If a Text node does exist, it's current contents are replaced.
- * Each memento is allowed only one text node.
- *
- * @param data the data to be placed on the Text node
- * @since 2.0
- */
- public void putTextData(String data);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java
deleted file mode 100644
index 2f6baacdc..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.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.core;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-/**
- * Provides an infinite progress monitor by subdividing by half repeatedly.
- *
- * The ticks parameter represents the number of ticks shown in the progress dialog
- * (or propogated up to a parent IProgressMonitor). The totalWork parameter provided
- * in actually a hint used to determine how work is translated into ticks.
- * The number of totalWork that can actually be worked is n*totalWork/2 where
- * 2^n = totalWork. What this means is that if you provide a totalWork of 32 (2^5) than
- * the maximum number of ticks is 5*32/2 = 80.
- *
- */
-public class InfiniteSubProgressMonitor extends SubProgressMonitor {
-
- int totalWork;
- int halfWay;
- int currentIncrement;
- int nextProgress;
- int worked;
-
- /**
- * Constructor for InfiniteSubProgressMonitor.
- * @param monitor
- * @param ticks
- */
- public InfiniteSubProgressMonitor(IProgressMonitor monitor, int ticks) {
- this(monitor, ticks, 0);
- }
-
- /**
- * Constructor for InfiniteSubProgressMonitor.
- * @param monitor
- * @param ticks
- * @param style
- */
- public InfiniteSubProgressMonitor(IProgressMonitor monitor, int ticks, int style) {
- super(monitor, ticks, style);
- }
-
- public void beginTask(String name, int totalWork) {
- super.beginTask(name, totalWork);
- this.totalWork = totalWork;
- this.halfWay = totalWork / 2;
- this.currentIncrement = 1;
- this.nextProgress = currentIncrement;
- this.worked = 0;
- }
-
- public void worked(int work) {
- if (worked >= totalWork) return;
- if (--nextProgress <= 0) {
- super.worked(1);
- worked++;
- if (worked >= halfWay) {
- // we have passed the current halfway point, so double the
- // increment and reset the halfway point.
- currentIncrement *= 2;
- halfWay += (totalWork - halfWay) / 2;
- }
- // reset the progress counter to another full increment
- nextProgress = currentIncrement;
- }
- }
-
- /**
- * Don't allow clearing of the subtask. This will stop the flickering
- * of the subtask in the progress dialogs.
- *
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- if(name != null && ! name.equals("")) { //$NON-NLS-1$
- super.subTask(name);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java
deleted file mode 100644
index 694418e6b..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.team.IMoveDeleteHook;
-import org.eclipse.core.resources.team.IResourceTree;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.RepositoryProvider;
-
-public class MoveDeleteManager implements IMoveDeleteHook {
-
- private static final IMoveDeleteHook DEFAULT_HOOK = new DefaultMoveDeleteHook();
-
- private IMoveDeleteHook getHookFor(IResource resource) {
- IProject project = resource.getProject();
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if(provider==null) {
- return DEFAULT_HOOK;
- }
- IMoveDeleteHook hook = provider.getMoveDeleteHook();
- if (hook == null) {
- return DEFAULT_HOOK;
- }
- return hook;
- }
-
- /*
- * @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
- */
- public boolean deleteFile(
- IResourceTree tree,
- IFile file,
- int updateFlags,
- IProgressMonitor monitor) {
-
- return getHookFor(file).deleteFile(tree, file, updateFlags, monitor);
- }
-
- /*
- * @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
- */
- public boolean deleteFolder(
- IResourceTree tree,
- IFolder folder,
- int updateFlags,
- IProgressMonitor monitor) {
-
- return getHookFor(folder).deleteFolder(tree, folder, updateFlags, monitor);
- }
-
- /*
- * @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
- */
- public boolean deleteProject(
- IResourceTree tree,
- IProject project,
- int updateFlags,
- IProgressMonitor monitor) {
-
- return getHookFor(project).deleteProject(tree, project, updateFlags, monitor);
- }
-
- /*
- * @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
- */
- public boolean moveFile(
- IResourceTree tree,
- IFile source,
- IFile destination,
- int updateFlags,
- IProgressMonitor monitor) {
-
- return getHookFor(source).moveFile(tree, source, destination, updateFlags, monitor);
- }
-
- /*
- * @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
- */
- public boolean moveFolder(
- IResourceTree tree,
- IFolder source,
- IFolder destination,
- int updateFlags,
- IProgressMonitor monitor) {
-
- return getHookFor(source).moveFolder(tree, source, destination, updateFlags, monitor);
- }
-
- /*
- * @see IMoveDeleteHook#moveProject(IResourceTree, IProject, IProjectDescription, int, IProgressMonitor)
- */
- public boolean moveProject(
- IResourceTree tree,
- IProject source,
- IProjectDescription description,
- int updateFlags,
- IProgressMonitor monitor) {
-
- return getHookFor(source).moveProject(tree, source, description, updateFlags, monitor);
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java
deleted file mode 100644
index 50edd1a6a..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.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.core;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-/**
- * This sub-progress monitor can be used to ignore progress indication for
- * methods but allow cancellation.
- * <p>
- * This implementation supports cancelation. The default implementations of the
- * other methods do nothing.
- * </p>
- * @see NullProgressMonitor
- * @see SubProgressMonitor
- */
-public class NullSubProgressMonitor extends SubProgressMonitor {
- /**
- * Constructor for InfiniteSubProgressMonitor.
- * @param monitor
- * @param ticks
- */
- public NullSubProgressMonitor(IProgressMonitor monitor) {
- super(monitor, 0, 0);
- }
-
- /**
- * @see IProgressMonitor#beginTask(String, int)
- */
- public void beginTask(String name, int totalWork) {
- }
-
- /**
- * @see IProgressMonitor#done()
- */
- public void done() {
- }
-
- /**
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- }
-
- /**
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- }
-
- /**
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
deleted file mode 100644
index 2e6a59fca..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class Policy {
- protected static ResourceBundle bundle = null;
-
- //debug constants
- public static boolean DEBUG_STREAMS = false;
- public static boolean DEBUG_REFRESH_JOB = true;
- public static boolean DEBUG_BACKGROUND_EVENTS = false;
-
- static {
- //init debug options
- if (TeamPlugin.getPlugin().isDebugging()) {
- DEBUG_STREAMS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/streams"));//$NON-NLS-1$ //$NON-NLS-2$
- DEBUG_REFRESH_JOB = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/refreshjob"));//$NON-NLS-1$ //$NON-NLS-2$
- DEBUG_BACKGROUND_EVENTS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/backgroundevents"));//$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void localize(String bundleName) {
- bundle = ResourceBundle.getBundle(bundleName);
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] { binding1, binding2 });
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given arguments. If the key is
- * not found, return the key.
- */
- public static String bind(String key, Object[] args) {
- try {
- return MessageFormat.format(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Progress monitor helpers
- */
- public static void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- }
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
-
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
-
- public static IProgressMonitor infiniteSubMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new InfiniteSubProgressMonitor(monitor, ticks);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
deleted file mode 100644
index cda7872e2..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.CachedResourceVariant;
-
-/**
- * This class implements a caching facility that can be used by TeamProviders to cache contents
- */
-public class ResourceVariantCache {
-
- // Directory to cache file contents
- private static final String CACHE_DIRECTORY = ".cache"; //$NON-NLS-1$
- // Maximum lifespan of local cache file, in milliseconds
- private static final long CACHE_FILE_LIFESPAN = 60*60*1000; // 1hr
-
- // Map of registered cahces indexed by local name of a QualifiedName
- private static Map caches = new HashMap(); // String (local name) > RemoteContentsCache
-
- private String name;
- private Map cacheEntries;
- private long lastCacheCleanup;
- private int cacheDirSize;
-
- // Lock used to serialize the writting of cache contents
- private ILock lock = Platform.getJobManager().newLock();
-
- /**
- * Enables the use of remote contents caching for the given cacheId. The cache ID must be unique.
- * A good candidate for this ID is the plugin ID of the plugin peforming the caching.
- *
- * @param cacheId the unique Id of the cache being enabled
- * @throws TeamException if the cache area on disk could not be properly initialized
- */
- public static synchronized void enableCaching(String cacheId) {
- if (isCachingEnabled(cacheId)) return;
- ResourceVariantCache cache = new ResourceVariantCache(cacheId);
- try {
- cache.createCacheDirectory();
- } catch (TeamException e) {
- // Log the exception and continue
- TeamPlugin.log(e);
- }
- caches.put(cacheId, cache);
- }
-
- /**
- * Returns whether caching has been enabled for the given Id. A cache should only be enabled once.
- * It is conceivable that a cache be persisted over workbench invocations thus leading to a cahce that
- * is enabled on startup without intervention by the owning plugin.
- *
- * @param cacheId the unique Id of the cache
- * @return true if caching for the given Id is enabled
- */
- public static boolean isCachingEnabled(String cacheId) {
- return getCache(cacheId) != null;
- }
-
- /**
- * Disable the cache, dispoing of any file contents in the cache.
- *
- * @param cacheId the unique Id of the cache
- * @throws TeamException if the cached contents could not be deleted from disk
- */
- public static void disableCache(String cacheId) {
- ResourceVariantCache cache = getCache(cacheId);
- if (cache == null) {
- // There is no cache to dispose of
- return;
- }
- caches.remove(cacheId);
- try {
- cache.deleteCacheDirectory();
- } catch (TeamException e) {
- // Log the exception and continue
- TeamPlugin.log(e);
- }
- }
-
- /**
- * Return the cache for the given id or null if caching is not enabled for the given id.
- * @param cacheId
- * @return
- */
- public static synchronized ResourceVariantCache getCache(String cacheId) {
- return (ResourceVariantCache)caches.get(cacheId);
- }
-
- public static synchronized void shutdown() {
- for (Iterator iter = caches.keySet().iterator(); iter.hasNext();) {
- String id = (String) iter.next();
- disableCache(id);
- }
- }
-
- private ResourceVariantCache(String name) {
- this.name = name;
- }
-
- /**
- * Return whether the cache contains an entry for the given id. Register a hit if it does.
- * @param id the id of the cache entry
- * @return true if there are contents cached for the id
- */
- public boolean hasEntry(String id) {
- return internalGetCacheEntry(id) != null;
- }
-
- protected IPath getCachePath() {
- return getStateLocation().append(CACHE_DIRECTORY).append(name);
- }
-
- private IPath getStateLocation() {
- return TeamPlugin.getPlugin().getStateLocation();
- }
-
- private synchronized void clearOldCacheEntries() {
- long current = new Date().getTime();
- if ((lastCacheCleanup!=-1) && (current - lastCacheCleanup < CACHE_FILE_LIFESPAN)) return;
- List stale = new ArrayList();
- for (Iterator iter = cacheEntries.values().iterator(); iter.hasNext();) {
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry) iter.next();
- long lastHit = entry.getLastAccessTimeStamp();
- if ((current - lastHit) > CACHE_FILE_LIFESPAN){
- stale.add(entry);
- }
- }
- for (Iterator iter = stale.iterator(); iter.hasNext();) {
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry) iter.next();
- entry.dispose();
- }
- }
-
- private synchronized void purgeFromCache(String id) {
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry)cacheEntries.get(id);
- File f = entry.getFile();
- try {
- deleteFile(f);
- } catch (TeamException e) {
- // Ignore the deletion failure.
- // A failure only really matters when purging the directory on startup
- }
- cacheEntries.remove(id);
- }
-
- private synchronized void createCacheDirectory() throws TeamException {
- IPath cacheLocation = getCachePath();
- File file = cacheLocation.toFile();
- if (file.exists()) {
- deleteFile(file);
- }
- if (! file.mkdirs()) {
- throw new TeamException(Policy.bind("RemoteContentsCache.fileError", file.getAbsolutePath())); //$NON-NLS-1$
- }
- cacheEntries = new HashMap();
- lastCacheCleanup = -1;
- cacheDirSize = 0;
- }
-
- private synchronized void deleteCacheDirectory() throws TeamException {
- cacheEntries = null;
- lastCacheCleanup = -1;
- cacheDirSize = 0;
- IPath cacheLocation = getCachePath();
- File file = cacheLocation.toFile();
- if (file.exists()) {
- try {
- deleteFile(file);
- } catch (TeamException e) {
- // Don't worry about problems deleting.
- // The only case that matters is when the cache directory is created
- }
- }
- }
-
- private void deleteFile(File file) throws TeamException {
- if (file.isDirectory()) {
- File[] children = file.listFiles();
- for (int i = 0; i < children.length; i++) {
- deleteFile(children[i]);
- }
- }
- if (! file.delete()) {
- throw new TeamException(Policy.bind("RemoteContentsCache.fileError", file.getAbsolutePath())); //$NON-NLS-1$
- }
- }
-
- /**
- * Purge the given cache entry from the cache. This method should only be invoked from
- * an instance of ResourceVariantCacheEntry after it has set it's state to DISPOSED.
- * @param entry
- */
- protected void purgeFromCache(ResourceVariantCacheEntry entry) {
- purgeFromCache(entry.getId());
- }
-
- private synchronized ResourceVariantCacheEntry internalGetCacheEntry(String id) {
- if (cacheEntries == null) {
- // This probably means that the cache has been disposed
- throw new IllegalStateException(Policy.bind("RemoteContentsCache.cacheDisposed", name)); //$NON-NLS-1$
- }
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry)cacheEntries.get(id);
- if (entry != null) {
- entry.registerHit();
- }
- return entry;
- }
-
- /**
- * @param id the id that uniquely identifes the remote resource that is cached.
- * @return
- */
- public ResourceVariantCacheEntry getCacheEntry(String id) {
- return internalGetCacheEntry(id);
- }
-
- public synchronized ResourceVariantCacheEntry add(String id, CachedResourceVariant resource) {
- clearOldCacheEntries();
- String filePath = String.valueOf(cacheDirSize++);
- ResourceVariantCacheEntry entry = new ResourceVariantCacheEntry(this, lock, id, filePath);
- entry.setResourceVariant(resource);
- cacheEntries.put(id, entry);
- return entry;
- }
-
- public String getName() {
- return name;
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCacheEntry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCacheEntry.java
deleted file mode 100644
index 860028151..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCacheEntry.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.io.*;
-import java.util.Date;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.CachedResourceVariant;
-
-/**
- * This class provides the implementation for the ICacheEntry
- */
-public class ResourceVariantCacheEntry {
-
- public static final int UNINITIALIZED = 0;
- public static final int READY = 1;
- public static final int DISPOSED = 2;
-
- private String id;
- private String filePath;
- private ResourceVariantCache cache;
- private byte[] syncBytes;
- private int state = UNINITIALIZED;
- private long lastAccess;
- private CachedResourceVariant resourceVariant;
- private ILock lock;
-
- public ResourceVariantCacheEntry(ResourceVariantCache cache, ILock lock, String id, String filePath) {
- this.lock = lock;
- state = UNINITIALIZED;
- this.cache = cache;
- this.id = id;
- this.filePath = filePath;
- registerHit();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ICacheEntry#getContents()
- */
- public InputStream getContents() throws TeamException {
- if (state != READY) return null;
- registerHit();
- File ioFile = getFile();
- try {
- try {
- if (ioFile.exists()) {
- return new FileInputStream(ioFile);
- }
- } catch (IOException e) {
- // Try to purge the cache and continue
- cache.purgeFromCache(this);
- throw e;
- }
- } catch (IOException e) {
- // We will end up here if we couldn't read or delete the cache file
- throw new TeamException(Policy.bind("RemoteContentsCache.fileError", ioFile.getAbsolutePath()), e); //$NON-NLS-1$
- }
- // This can occur when there is no remote contents
- return new ByteArrayInputStream(new byte[0]);
- }
-
- protected File getFile() {
- return new File(cache.getCachePath().toFile(), filePath);
- }
-
- /**
- * Set the contents of for this cache entry. This method supports concurrency by only allowing
- * one cache entry to be written at a time. In the case of two concurrent writes to the same cache entry,
- * the contents from the first write is used and the content from subsequent writes is ignored.
- * @param stream an InputStream that provides the contents to be cached
- * @param monitor a progress monitor
- * @throws TeamException if the entry is DISPOSED or an I/O error occurres
- */
- public void setContents(InputStream stream, IProgressMonitor monitor) throws TeamException {
- // Use a lock to only allow one write at a time
- beginOperation();
- try {
- internalSetContents(stream, monitor);
- } finally {
- endOperation();
- }
- }
-
- private synchronized void endOperation() {
- lock.release();
- }
-
- private synchronized void beginOperation() {
- lock.acquire();
- }
-
- private void internalSetContents(InputStream stream, IProgressMonitor monitor) throws TeamException {
- // if the state is DISPOSED then there is a problem
- if (state == DISPOSED) {
- throw new TeamException(Policy.bind("RemoteContentsCacheEntry.3", cache.getName(), id)); //$NON-NLS-1$
- }
- // Otherwise, the state is UNINITIALIZED or READY so we can proceed
- registerHit();
- File ioFile = getFile();
- try {
-
- // Open the cache file for writing
- OutputStream out;
- try {
- if (state == UNINITIALIZED) {
- out = new BufferedOutputStream(new FileOutputStream(ioFile));
- } else {
- // If the entry is READY, the contents must have been read in another thread.
- // We still need to red the contents but they can be ignored since presumably they are the same
- out = new ByteArrayOutputStream();
- }
- } catch (FileNotFoundException e) {
- throw new TeamException(Policy.bind("RemoteContentsCache.fileError", ioFile.getAbsolutePath()), e); //$NON-NLS-1$
- }
-
- // Transfer the contents
- try {
- try {
- byte[] buffer = new byte[1024];
- int read;
- while ((read = stream.read(buffer)) >= 0) {
- Policy.checkCanceled(monitor);
- out.write(buffer, 0, read);
- }
- } finally {
- out.close();
- }
- } catch (IOException e) {
- // Make sure we don't leave the cache file around as it may not have the right contents
- cache.purgeFromCache(this);
- throw e;
- }
-
- // Mark the cache entry as ready
- state = READY;
- } catch (IOException e) {
- throw new TeamException(Policy.bind("RemoteContentsCache.fileError", ioFile.getAbsolutePath()), e); //$NON-NLS-1$
- } finally {
- try {
- stream.close();
- } catch (IOException e1) {
- // Ignore close errors
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ICacheEntry#getState()
- */
- public int getState() {
- return state;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ICacheEntry#getSize()
- */
- public long getSize() {
- if (state != READY) return 0;
- File ioFile = getFile();
- if (ioFile.exists()) {
- return ioFile.length();
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ICacheEntry#getLastAccessTimeStamp()
- */
- public long getLastAccessTimeStamp() {
- return lastAccess;
- }
-
- /**
- * Registers a hit on this cache entry. This updates the last access timestamp.
- * Thsi method is intended to only be invokded from inside this class or the cahce itself.
- * Other clients should not use it.
- */
- protected void registerHit() {
- lastAccess = new Date().getTime();
- }
-
- public void dispose() {
- // Use a lock to avoid changing state while another thread may be writting
- beginOperation();
- try {
- state = DISPOSED;
- cache.purgeFromCache(this);
- } finally {
- endOperation();
- }
- }
-
-
- public String getId() {
- return id;
- }
-
- public CachedResourceVariant getResourceVariant() {
- return resourceVariant;
- }
-
- public void setResourceVariant(CachedResourceVariant resourceVariant) {
- this.resourceVariant = resourceVariant;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java
deleted file mode 100644
index 475370c94..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-/**
- * The SortOperation takes a collection of objects and returns
- * a sorted collection of these objects. Concrete instances of this
- * class provide the criteria for the sorting of the objects based on
- * the type of the objects.
- */
-public abstract class Sorter {
- /**
- * Returns true is elementTwo is 'greater than' elementOne
- * This is the 'ordering' method of the sort operation.
- * Each subclass overides this method with the particular
- * implementation of the 'greater than' concept for the
- * objects being sorted.
- */
- public abstract boolean compare(Object elementOne, Object elementTwo);
- /**
- * Sort the objects in sorted collection and return that collection.
- */
- private Object[] quickSort(Object[] sortedCollection, int left, int right) {
- int originalLeft = left;
- int originalRight = right;
- Object mid = sortedCollection[ (left + right) / 2];
- do {
- while (compare(sortedCollection[left], mid))
- left++;
- while (compare(mid, sortedCollection[right]))
- right--;
- if (left <= right) {
- Object tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (originalLeft < right)
- sortedCollection = quickSort(sortedCollection, originalLeft, right);
- if (left < originalRight)
- sortedCollection = quickSort(sortedCollection, left, originalRight);
- return sortedCollection;
- }
- /**
- * Return a new sorted collection from this unsorted collection.
- * Sort using quick sort.
- */
- public Object[] sort(Object[] unSortedCollection) {
- int size = unSortedCollection.length;
- Object[] sortedCollection = new Object[size];
- //copy the array so can return a new sorted collection
- System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size);
- if (size > 1)
- quickSort(sortedCollection, 0, size - 1);
- return sortedCollection;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java
deleted file mode 100644
index 5262fedaf..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-
-import java.util.*;
-
-/**
- * A string pattern matcher, suppporting * and ? wildcards.
- * Note: code copied from org.eclipse.jdt.internal.core.util.StringMatcher on April 3, 2001
- * (version 0.1 - 010901H18 [rename jbl]).
- */
-public class StringMatcher {
- protected String fPattern;
- protected int fLength; // pattern length
- protected boolean fIgnoreWildCards;
- protected boolean fIgnoreCase;
- protected boolean fHasLeadingStar;
- protected boolean fHasTrailingStar;
- protected String fSegments[]; //the given pattern is split into * separated segments
-
- /* boundary value beyond which we don't need to search in the text */
- protected int fBound = 0;
-
-
- protected static final char fSingleWildCard = '\u0000';
-
- public static class Position {
- int start; //inclusive
- int end; //exclusive
- public Position(int start, int end) {
- this.start = start;
- this.end = end;
- }
- public int getStart() {
- return start;
- }
- public int getEnd() {
- return end;
- }
- }
- /**
- * Find the first occurrence of the pattern between <code>start</code)(inclusive)
- * and <code>end</code>(exclusive).
- * @param <code>text</code>, the String object to search in
- * @param <code>start</code>, the starting index of the search range, inclusive
- * @param <code>end</code>, the ending index of the search range, exclusive
- * @return an <code>StringMatcher.Position</code> object that keeps the starting
- * (inclusive) and ending positions (exclusive) of the first occurrence of the
- * pattern in the specified range of the text; return null if not found or subtext
- * is empty (start==end). A pair of zeros is returned if pattern is empty string
- * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
- * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
- */
-
- public StringMatcher.Position find(String text, int start, int end) {
- if (fPattern == null|| text == null)
- throw new IllegalArgumentException();
-
- int tlen = text.length();
- if (start < 0)
- start = 0;
- if (end > tlen)
- end = tlen;
- if (end < 0 ||start >= end )
- return null;
- if (fLength == 0)
- return new Position(start, start);
- if (fIgnoreWildCards) {
- int x = posIn(text, start, end);
- if (x < 0)
- return null;
- return new Position(x, x+fLength);
- }
-
- int segCount = fSegments.length;
- if (segCount == 0)//pattern contains only '*'(s)
- return new Position (start, end);
-
- int curPos = start;
- int matchStart = -1;
- int i;
- for (i = 0; i < segCount && curPos < end; ++i) {
- String current = fSegments[i];
- int nextMatch = regExpPosIn(text, curPos, end, current);
- if (nextMatch < 0 )
- return null;
- if(i == 0)
- matchStart = nextMatch;
- curPos = nextMatch + current.length();
- }
- if (i < segCount)
- return null;
- return new Position(matchStart, curPos);
- }
- /**
- * StringMatcher constructor takes in a String object that is a simple
- * pattern which may contain '*' for 0 and many characters and
- * '?' for exactly one character.
- *
- * Literal '*' and '?' characters must be escaped in the pattern
- * e.g., "\*" means literal "*", etc.
- *
- * Escaping any other character (including the escape character itself),
- * just results in that character in the pattern.
- * e.g., "\a" means "a" and "\\" means "\"
- *
- * If invoking the StringMatcher with string literals in Java, don't forget
- * escape characters are represented by "\\".
- *
- * @param aPattern the pattern to match text with
- * @param ignoreCase if true, case is ignored
- * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
- * (everything is taken literally).
- */
- public StringMatcher(String aPattern, boolean ignoreCase, boolean ignoreWildCards) {
- fIgnoreCase = ignoreCase;
- fIgnoreWildCards = ignoreWildCards;
- fLength = aPattern.length();
-
- /* convert case */
- if (fIgnoreCase) {
- fPattern = aPattern.toUpperCase();
- } else {
- fPattern = aPattern;
- }
-
- if (fIgnoreWildCards) {
- parseNoWildCards();
- } else {
- parseWildCards();
- }
- }
- /**
- * Given the starting (inclusive) and the ending (exclusive) poisitions in the
- * <code>text</code>, determine if the given substring matches with aPattern
- * @return true if the specified portion of the text matches the pattern
- * @param String <code>text</code>, a String object that contains the substring to match
- * @param int <code>start<code> marks the starting position (inclusive) of the substring
- * @param int <code>end<code> marks the ending index (exclusive) of the substring
- */
- public boolean match(String text, int start, int end) {
- if (null == text)
- throw new IllegalArgumentException();
-
- if (start > end)
- return false;
-
- if (fIgnoreWildCards)
- return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
- int segCount= fSegments.length;
- if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
- return true;
- if (start == end)
- return fLength == 0;
- if (fLength == 0)
- return start == end;
-
- int tlen= text.length();
- if (start < 0)
- start= 0;
- if (end > tlen)
- end= tlen;
-
- int tCurPos= start;
- int bound= end - fBound;
- if ( bound < 0)
- return false;
- int i=0;
- String current= fSegments[i];
- int segLength= current.length();
-
- /* process first segment */
- if (!fHasLeadingStar){
- if(!regExpRegionMatches(text, start, current, 0, segLength)) {
- return false;
- } else {
- ++i;
- tCurPos= tCurPos + segLength;
- }
- }
- if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
- // only one segment to match, no wildcards specified
- return tCurPos == end;
- }
- /* process middle segments */
- while (i < segCount) {
- current= fSegments[i];
- int currentMatch;
- int k= current.indexOf(fSingleWildCard);
- if (k < 0) {
- currentMatch= textPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- } else {
- currentMatch= regExpPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- }
- tCurPos= currentMatch + current.length();
- i++;
- }
-
- /* process final segment */
- if (!fHasTrailingStar && tCurPos != end) {
- int clen= current.length();
- return regExpRegionMatches(text, end - clen, current, 0, clen);
- }
- return i == segCount ;
- }
- /**
- * match the given <code>text</code> with the pattern
- * @return true if matched eitherwise false
- * @param <code>text</code>, a String object
- */
- public boolean match(String text) {
- return match(text, 0, text.length());
- }
- /**
- * This method parses the given pattern into segments seperated by wildcard '*' characters.
- * Since wildcards are not being used in this case, the pattern consists of a single segment.
- */
- private void parseNoWildCards() {
- fSegments = new String[1];
- fSegments[0] = fPattern;
- fBound = fLength;
- }
- /**
- * This method parses the given pattern into segments seperated by wildcard '*' characters.
- * @param p, a String object that is a simple regular expression with '*' and/or '?'
- */
- private void parseWildCards() {
- if(fPattern.startsWith("*"))//$NON-NLS-1$
- fHasLeadingStar = true;
- if(fPattern.endsWith("*")) {//$NON-NLS-1$
- /* make sure it's not an escaped wildcard */
- if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar = true;
- }
- }
-
- Vector temp = new Vector();
-
- int pos = 0;
- StringBuffer buf = new StringBuffer();
- while (pos < fLength) {
- char c = fPattern.charAt(pos++);
- switch (c) {
- case '\\':
- if (pos >= fLength) {
- buf.append(c);
- } else {
- char next = fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
- }
- break;
- case '*':
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
- }
- break;
- case '?':
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
- break;
- default:
- buf.append(c);
- }
- }
-
- /* add last buffer to segment list */
- if (buf.length() > 0) {
- temp.addElement(buf.toString());
- fBound += buf.length();
- }
-
- fSegments = new String[temp.size()];
- temp.copyInto(fSegments);
- }
- /**
- * @param <code>text</code>, a string which contains no wildcard
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int posIn(String text, int start, int end) {//no wild card in pattern
- int max = end - fLength;
-
- if (!fIgnoreCase) {
- int i = text.indexOf(fPattern, start);
- if (i == -1 || i > max)
- return -1;
- return i;
- }
-
- for (int i = start; i <= max; ++i) {
- if (text.regionMatches(true, i, fPattern, 0, fLength))
- return i;
- }
-
- return -1;
- }
- /**
- * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param <code>p</code>, a simple regular expression that may contains '?'
- * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int regExpPosIn(String text, int start, int end, String p) {
- int plen = p.length();
-
- int max = end - plen;
- for (int i = start; i <= max; ++i) {
- if (regExpRegionMatches(text, i, p, 0, plen))
- return i;
- }
- return -1;
- }
- /**
- *
- * @return boolean
- * @param <code>text</code>, a String to match
- * @param <code>start</code>, int that indicates the starting index of match, inclusive
- * @param <code>end</code> int that indicates the ending index of match, exclusive
- * @param <code>p</code>, String, String, a simple regular expression that may contain '?'
- * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
- */
- protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
- while (plen-- > 0) {
- char tchar = text.charAt(tStart++);
- char pchar = p.charAt(pStart++);
-
- /* process wild cards */
- if (!fIgnoreWildCards) {
- /* skip single wild cards */
- if (pchar == fSingleWildCard) {
- continue;
- }
- }
- if (pchar == tchar)
- continue;
- if (fIgnoreCase) {
- char tc = Character.toUpperCase(tchar);
- if (tc == pchar)
- continue;
- }
- return false;
- }
- return true;
- }
- /**
- * @param <code>text</code>, the string to match
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param code>p</code>, a string that has no wildcard
- * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int textPosIn(String text, int start, int end, String p) {
-
- int plen = p.length();
- int max = end - plen;
-
- if (!fIgnoreCase) {
- int i = text.indexOf(p, start);
- if (i == -1 || i > max)
- return -1;
- return i;
- }
-
- for (int i = start; i <= max; ++i) {
- if (text.regionMatches(true, i, p, 0, plen))
- return i;
- }
-
- return -1;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java
deleted file mode 100644
index e93f80ffc..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.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.core;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.team.TeamHook;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.RepositoryProvider;
-
-/**
- * This class forwards TeamHook callbacks to the proper RepositoryProvider
- */
-public class TeamHookDispatcher extends TeamHook {
-
- /**
- * @see org.eclipse.core.resources.team.TeamHook#validateCreateLink(org.eclipse.core.resources.IFile, int, org.eclipse.core.runtime.IPath)
- */
- public IStatus validateCreateLink(IFile file, int updateFlags, IPath location) {
- RepositoryProvider provider = getProvider(file);
- if (provider == null) {
- return super.validateCreateLink(file, updateFlags, location);
- } else {
- return provider.validateCreateLink(file, updateFlags, location);
- }
- }
-
- /**
- * @see org.eclipse.core.resources.team.TeamHook#validateCreateLink(org.eclipse.core.resources.IFolder, int, org.eclipse.core.runtime.IPath)
- */
- public IStatus validateCreateLink(IFolder folder, int updateFlags, IPath location) {
- RepositoryProvider provider = getProvider(folder);
- if (provider == null) {
- return super.validateCreateLink(folder, updateFlags, location);
- } else {
- return provider.validateCreateLink(folder, updateFlags, location);
- }
- }
-
- /**
- * Method getProvider.
- * @param folder
- * @return RepositoryProvider
- */
- private RepositoryProvider getProvider(IResource resource) {
- return RepositoryProvider.getProvider(resource.getProject());
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
deleted file mode 100644
index d646167ff..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.TeamException;
-
-/**
- * <code>TeamPlugin</code> is the plug-in runtime class for the Team
- * resource management plugin.
- * <p>
- *
- * @see Team
- * @see RepositoryProvider
- *
- * @since 2.0
- */
-final public class TeamPlugin extends Plugin {
-
- // The id of the core team plug-in
- public static final String ID = "org.eclipse.team.core"; //$NON-NLS-1$
-
- // The id of the providers extension point
- public static final String PROVIDER_EXTENSION = "repository-provider-type"; //$NON-NLS-1$
-
- // The id of the file types extension point
- public static final String FILE_TYPES_EXTENSION = "fileTypes"; //$NON-NLS-1$
-
- // The id of the global ignore extension point
- public static final String IGNORE_EXTENSION = "ignore"; //$NON-NLS-1$
- // The id of the project set extension point
- public static final String PROJECT_SET_EXTENSION = "projectSets"; //$NON-NLS-1$
- // The id of the targets extension point
- public static final String REPOSITORY_EXTENSION = "repository"; //$NON-NLS-1$
-
-
- // The one and only plug-in instance
- private static TeamPlugin plugin;
-
- /**
- * Constructs a plug-in runtime class for the given plug-in descriptor.
- */
- public TeamPlugin(IPluginDescriptor pluginDescriptor) {
- super(pluginDescriptor);
- plugin = this;
- }
-
- /**
- * @see Plugin#startup()
- */
- public void startup() throws CoreException {
- Policy.localize("org.eclipse.team.internal.core.messages"); //$NON-NLS-1$
- Team.startup();
- }
-
- /**
- * @see Plugin#shutdown()
- */
- public void shutdown() {
- Team.shutdown();
- ResourceVariantCache.shutdown();
- }
-
- /**
- * Returns the Team plug-in.
- *
- * @return the single instance of this plug-in runtime class
- */
- public static TeamPlugin getPlugin() {
- return plugin;
- }
-
- /**
- * Log the given exception alloing with the provided message and severity indicator
- */
- public static void log(int severity, String message, Throwable e) {
- plugin.getLog().log(new Status(severity, ID, 0, message, e));
- }
-
- /**
- * Log the given CoreException in a manner that will include the stacktrace of
- * the exception in the log.
- */
- public static void log(CoreException e) {
- log(e.getStatus().getSeverity(), e.getMessage(), e);
- }
-
- /*
- * Static helper methods for creating exceptions
- */
- public static TeamException wrapException(Exception e) {
- return new TeamException(new Status(IStatus.ERROR, ID, 0, e.getMessage() != null ? e.getMessage() : "", e)); //$NON-NLS-1$
- }
-
- public static TeamException wrapException(CoreException e) {
- IStatus status = e.getStatus();
- return new TeamException(new Status(status.getSeverity(), ID, status.getCode(), status.getMessage(), e));
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java
deleted file mode 100644
index 17a0bd383..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core;
-
-import java.io.*;
-import java.util.ArrayList;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.TeamException;
-import org.w3c.dom.*;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * This class represents the default implementation of the
- * <code>IMemento</code> interface.
- * <p>
- * This class is not intended to be extended by clients.
- * </p>
- * [Note: This class has been copied from org.eclipse.ui to get a quick and
- * dirty xml input/output code. This should be purged once the settings
- * work is complete]
- * @see IMemento
- */
-public final class XMLMemento implements IMemento {
- private Document factory;
- private Element element;
-
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- * <p>
- * Same as calling createReadRoot(reader, null)
- * </p>
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws <code>WorkbenchException</code> if IO problems, invalid format, or no element.
- */
- public static XMLMemento createReadRoot(Reader reader) throws TeamException {
- return createReadRoot(reader, null);
- }
-
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @param baseDir the directory used to resolve relative file names
- * in the XML document. This directory must exist and include the
- * trailing separator. The directory format, including the separators,
- * must be valid for the platform. Can be <code>null</code> if not
- * needed.
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws <code>WorkbenchException</code> if IO problems, invalid format, or no element.
- */
- public static XMLMemento createReadRoot(Reader reader, String baseDir) throws TeamException {
- String messageKey = "XMLMemento.noElement"; //$NON-NLS-1$
- Exception exception = null;
-
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- InputSource source = new InputSource(reader);
- if (baseDir != null)
- source.setSystemId(baseDir);
- Document document = parser.parse(source);
- NodeList list = document.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (node instanceof Element)
- return new XMLMemento(document, (Element) node);
- }
- } catch (ParserConfigurationException e) {
- exception = e;
- messageKey = "XMLMemento.parserConfigError"; //$NON-NLS-1$
- } catch (IOException e) {
- exception = e;
- messageKey = "XMLMemento.ioError"; //$NON-NLS-1$
- } catch (SAXException e) {
- exception = e;
- messageKey = "XMLMemento.formatError"; //$NON-NLS-1$
- }
-
- String problemText = null;
- if (exception != null)
- problemText = exception.getMessage();
- //if (problemText == null || problemText.length() == 0)
- // problemText = TeamException.getString(messageKey);
- throw new TeamException(problemText);
- }
-
- /**
- * Returns a root memento for writing a document.
- *
- * @param type the element node type to create on the document
- * @return the root memento for writing a document
- */
- public static XMLMemento createWriteRoot(String type) {
- Document document;
- try {
- document = DocumentBuilderFactory
- .newInstance()
- .newDocumentBuilder()
- .newDocument();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- }
- catch (ParserConfigurationException e) {
- throw new Error(e);
- }
- }
-
- /**
- * Creates a memento for the specified document and element.
- * <p>
- * Clients should use <code>createReadRoot</code> and
- * <code>createWriteRoot</code> to create the initial
- * memento on a document.
- * </p>
- *
- * @param document the document for the memento
- * @param element the element node for the memento
- */
- public XMLMemento(Document document, Element element) {
- super();
- this.factory = document;
- this.element = element;
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento createChild(String type) {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento createChild(String type, String id) {
- Element child = factory.createElement(type);
- child.setAttribute(TAG_ID, id == null ? "" : id); //$NON-NLS-1$
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento copyChild(IMemento child) {
- Element childElement = ((XMLMemento) child).element;
- Element newElement = (Element) factory.importNode(childElement, true);
- element.appendChild(newElement);
- return new XMLMemento(factory, newElement);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento getChild(String type) {
-
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return null;
-
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element = (Element) node;
- if (element.getNodeName().equals(type))
- return new XMLMemento(factory, element);
- }
- }
-
- // A child was not found.
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento[] getChildren(String type) {
-
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return new IMemento[0];
-
- // Extract each node with given type.
- ArrayList list = new ArrayList(size);
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element = (Element) node;
- if (element.getNodeName().equals(type))
- list.add(element);
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- IMemento[] results = new IMemento[size];
- for (int x = 0; x < size; x++) {
- results[x] = new XMLMemento(factory, (Element) list.get(x));
- }
- return results;
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Float(strValue);
- } catch (NumberFormatException e) {
- TeamPlugin.log(IStatus.ERROR, "Memento problem - Invalid float for key: " //$NON-NLS-1$
- + key + " value: " + strValue, null); //$NON-NLS-1$
- return null;
- }
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public String getID() {
- return element.getAttribute(TAG_ID);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Integer(strValue);
- } catch (NumberFormatException e) {
- TeamPlugin.log(IStatus.ERROR, "Memento problem - invalid integer for key: " + key //$NON-NLS-1$
- + " value: " + strValue, null); //$NON-NLS-1$
- return null;
- }
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- return attr.getValue();
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public String getTextData() {
- Text textNode = getTextNode();
- if (textNode != null) {
- return textNode.getData();
- } else {
- return null;
- }
- }
-
- /**
- * Returns the Text node of the memento. Each memento is allowed only
- * one Text node.
- *
- * @return the Text node of the memento, or <code>null</code> if
- * the memento has no Text node.
- */
- private Text getTextNode() {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return null;
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Text) {
- return (Text) node;
- }
- }
- // a Text node was not found
- return null;
- }
-
- /**
- * Places the element's attributes into the document.
- */
- private void putElement(Element element) {
- NamedNodeMap nodeMap = element.getAttributes();
- int size = nodeMap.getLength();
- for (int i = 0; i < size; i++) {
- Attr attr = (Attr) nodeMap.item(i);
- putString(attr.getName(), attr.getValue());
- }
-
- NodeList nodes = element.getChildNodes();
- size = nodes.getLength();
- for (int i = 0; i < size; i++) {
- Node node = nodes.item(i);
- if (node instanceof Element) {
- XMLMemento child = (XMLMemento) createChild(node.getNodeName());
- child.putElement((Element) node);
- }
- }
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putFloat(String key, float f) {
- element.setAttribute(key, String.valueOf(f));
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putInteger(String key, int n) {
- element.setAttribute(key, String.valueOf(n));
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putMemento(IMemento memento) {
- putElement(((XMLMemento) memento).element);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putString(String key, String value) {
- if (value == null)
- return;
- element.setAttribute(key, value);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putTextData(String data) {
- Text textNode = getTextNode();
- if (textNode == null) {
- textNode = factory.createTextNode(data);
- element.appendChild(textNode);
- } else {
- textNode.setData(data);
- }
- }
-
- /**
- * Saves this memento's document current values to the
- * specified writer.
- *
- * @param writer the writer used to save the memento's document
- * @throws IOException if there is a problem serializing the document to the stream.
- */
- public void save(Writer writer) throws IOException {
- Result result = new StreamResult(writer);
- Source source = new DOMSource(factory);
- try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.transform(source, result);
- }
- catch (TransformerConfigurationException e) {
- throw (IOException) (new IOException().initCause(e));
- }
- catch (TransformerException e) {
- throw (IOException) (new IOException().initCause(e));
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties
deleted file mode 100644
index 55fef4983..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties
+++ /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
-###############################################################################
-ok=OK
-concatStrings={0} {1}
-
-Assert.assertionFailed=Assertion failed: {0}
-
-manager.providerAlreadyMapped=Error associating {0} with provider named {1}. The project is already associated with a provider.
-manager.errorFlushSync=Error flushing provider mapping information for {0}.
-manager.errorDeconfigure=Error deconfiguring provider named {0} from project {1}.
-manager.providerTypeInvalid=The provider type is not registered: {0}.
-manager.providerExtensionNotFound=TeamPlugin provider extension not found.
-manager.providerNoConfigElems=No configuration elements found for extension: {0}.
-manager.cannotInstantiateExt=Cannot instantiate extension: {0}.
-manager.errorSerialize=Error serializing provider mappings for {0}.
-manager.errorUnserializeProvider=Cannot unserialize association of {0} with provider of type: {1}. It is no longer a registered provider type.
-manager.errorUnserialize=Error un-serializing provider mappings {0}.
-manager.notTeamNature=Error setting nature: {0} is not a registered team nature.
-manager.errorSettingNature=Error setting nature {1} on project {0}.
-manager.errorRemovingNature=Error removing nature {1} on project {0}.
-
-manager.badClassType=Error creating validator decorator: bad class type
-manager.coreException=Error creating validator decorator: core exception
-
-FileModificationValidator.someReadOnly=Some files are read-only.
-FileModificationValidator.fileIsReadOnly=File {0} is read-only.
-FileModificationValidator.editFailed=Files are read-only.
-
-RepositoryProvider_Error_removing_nature_from_project___1=Error removing nature from project:
-RepositoryProvider_Too_many_providers_associated_with_project___2=Too many providers associated with project:
-RepositoryProviderTypeduplicate_provider_found_in_plugin.xml___1=duplicate provider found in plugin.xml:
-RepositoryProviderTypeRepositoryProvider_assigned_to_the_project_must_be_a_subclass_of_RepositoryProvider___2=RepositoryProvider assigned to the project must be a subclass of RepositoryProvider:
-RepositoryProviderTypeRepositoryProvider_not_registered_as_a_nature_id___3=RepositoryProvider not registered as a nature id: {0}.
-RepositoryProvider_providerTypeIdNotRegistered=Error configuring the RepositoryProvider the nature id is not registered as a valid RepositoryProviderType id.
-RepositoryProvider.couldNotInstantiateProvider=Could not instantiate provider {1} for project {0}.
-RepositoryProvider.No_Provider_Registered=No provider registered for {0}.
-RepositoryProvider.propertyMismatch=Inconsistent session/persistent property state looking up provider {1}.
-RepositoryProvider.linkedResourcesExist=Project ''{0}'' contains linked resources but the''{1}'' repository provider does not supported them.
-RepositoryProvider.linkedResourcesNotSupported=Project ''{0}'' is mapped to repository type ''{1}'' which does not support linked resources.
-RepositoryProvider.couldNotClearAfterError=A serious error has occurred trying to map project ''{0}'' to provider ''{1}''. Please restart Eclipse.
-RepositoryProvider.invalidClass=Class ''{1}'' registered for id ''{0}'' is not a subclass of RepositoryProvider.
-
-TeamPlugin_setting_global_ignore_7=setting global ignore
-
-Team.couldNotDelete=Could not delete previous state file ''{0}''.
-Team.couldNotRename=Could not rename new state file from ''{0}'' to ''{1}''.
-Team.writeError=An error occurred writing the state file ''{0}''.
-Team.readError=An error occurred reading the state file ''{0}''
-Team.Could_not_delete_state_file_1=Could not delete state file
-Team.Could_not_rename_state_file_2=Could not rename state file
-
-PollingInputStream.readTimeout=Timeout while reading from input stream
-PollingInputStream.closeTimeout=Timeout while closing input stream
-PollingOutputStream.writeTimeout=Timeout while writing to output stream
-PollingOutputStream.closeTimeout=Timeout while closing output stream
-TimeoutOutputStream.cannotWriteToStream=Cannot write to output stream
-
-TargetManager.Problems_mapping_project._Project_is_already_mapped._4=Problems mapping project. Project is already mapped.
-TargetManager.Problems_mapping_project=Problems mapping project {0}
-TargetManager.unableToUnmap=Unable to unmap project. It wasn't mapped to the location. {0}
-TargetManager.problemsUnmapping=Problems unmapping project {0}
-TargetManager.problemsGettingProvider=Problems getting default target provider for {0}
-
-Config.error=Error configuring the provider
-
-teamStatus.notCheckedOut=Not checked out.
-teamStatus.notCheckedIn=Not checked in.
-teamStatus.unmanagedResource=Unmanaged resource.
-teamStatus.noRemoteResource=Remote resource does not exist.
-teamStatus.ioFailed=An IO error occurred.
-teamStatus.conflict=A conflict occurred.
-
-multiStatus.errorsOccurred=Errors occurred.
-provider.configuration.missing=Required configuration value missing.
-provider.configuration.invalid=Configuration value is invalid.
-filetransfer.monitor={0} ({1}K of {2}K bytes)
-
-SynchronizedTargetProvider.invalidURLCombination=Could not form a valid URL from {0} and {1}
-
-RemoteSyncElement.delimit=[{0}]
-RemoteSyncElement.insync=in-sync
-RemoteSyncElement.conflicting=conflicting
-RemoteSyncElement.outgoing=outgoing
-RemoteSyncElement.incoming=incoming
-RemoteSyncElement.change=change
-RemoteSyncElement.addition=addition
-RemoteSyncElement.deletion=deletion
-RemoteSyncElement.manual={manual}
-RemoteSyncElement.auto={auto}
-
-Team.Error_loading_ignore_state_from_disk_1=Error loading ignore state from disk
-
-RemoteContentsCache.cacheNotEnabled=The cache for {0} is not enabled.
-RemoteContentsCache.cacheDisposed=The cache for {0} is disposed.
-RemoteContentsCache.fileError=An I/O error performing an operation on {0}.
-TeamProvider.10=Error restoring subscribers. Cannot find factory with id: {0}
-TeamProvider.11=Error saving subscribers. Cannot find factory with id: {0}
-ContentComparisonCriteria.2=Comparing content {0}
-ContentComparisonCriteria.3=\ ignoring whitespace
-
-SubscriberEventHandler.2=Calculating synchronization state for {0}.
-SubscriberEventHandler.jobName=Updating synchronization states for {0}.
-SubscriberEventHandler.errors=Errors have occured while calculating the synchronization state for {0}.
-RemoteContentsCacheEntry.3=Cache entry in {0} for {1} has been disposed
-DeploymentProviderManager.10=Cannot map provider {0}. It's extension point description cannot be found.
-DeploymentProviderManager.12=Resource {0} is mapped to multiple deployment providers of type {1}.
-DeploymentProviderManager.13={0} is already mapped to {1}
-DeploymentProviderManager.15=An I/O error occurred while persisting the deployment configurations for project {0}.
-DeploymentProviderManager.16=Previously deployed folder {0} in project {1} no longer exists.
-DeploymentProviderManager.17=Previously deployed resource {0} in project {1} is now a file and cannot be deployed.
-SynchronizationCacheRefreshOperation.0=Refreshing {0}
-SubscriberEventHandler.8=The members of folder {0} could not be retrieved: {1}
-SubscriberEventHandler.9=The synchronization state for resource {0} could not be determined: {1}
-SubscriberEventHandler.10=An internal error occurred processing subscriber events.
-SubscriberEventHandler.11=An internal error occurred processing resource {0}: {1}
-CachedResourceVariant.0=There is no cached contents for resource {0}.
-SyncInfoTree.0=Sync info is missing for resource {0}.
-ResourceVariantTreeSubscriber.1=Errors occurred during refresh of {0}
-ResourceVariantTreeSubscriber.2=An error occurred refreshing {0}: {1}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java
deleted file mode 100644
index 980c73871..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.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.core.registry;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.DeploymentProvider;
-
-public class DeploymentProviderDescriptor {
-
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_NAME = "name"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
-
- private String name;
- private String className;
- private String id;
- private String description;
-
- private IConfigurationElement configElement;
-
- /**
- * Create a new ViewDescriptor for an extension.
- */
- public DeploymentProviderDescriptor(IConfigurationElement e, String desc) throws CoreException {
- configElement = e;
- description = desc;
- loadFromExtension();
- }
-
-
- public IConfigurationElement getConfigurationElement() {
- return configElement;
- }
-
- public DeploymentProvider createProvider() throws CoreException {
- return (DeploymentProvider)configElement.createExecutableExtension(ATT_CLASS);
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- private void loadFromExtension() throws CoreException {
- String identifier = configElement.getAttribute(ATT_ID);
- name = configElement.getAttribute(ATT_NAME);
- className = configElement.getAttribute(ATT_CLASS);
-
- // Sanity check.
- if ((name == null) || (className == null) || (identifier == null)) {
- throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + id, //$NON-NLS-1$
- null));
- }
-
- id = identifier;
- }
-
- /**
- * Returns a string representation of this descriptor. For debugging
- * purposes only.
- */
- public String toString() {
- return "Team Provider(" + getId() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java
deleted file mode 100644
index 09beff082..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.registry;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public class DeploymentProviderRegistry extends RegistryReader {
-
- private final static String PT_TEAMPROVIDER = "deployment"; //$NON-NLS-1$
- private Map providers = new HashMap();
- private String extensionId;
-
- public DeploymentProviderRegistry() {
- super();
- this.extensionId = PT_TEAMPROVIDER;
- readRegistry(Platform.getPluginRegistry(), TeamPlugin.ID, PT_TEAMPROVIDER);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(extensionId)) {
- String descText = getDescription(element);
- DeploymentProviderDescriptor desc;
- try {
- desc = new DeploymentProviderDescriptor(element, descText);
- providers.put(desc.getId(), desc);
- } catch (CoreException e) {
- TeamPlugin.log(e);
- }
- return true;
- }
- return false;
- }
-
- public DeploymentProviderDescriptor[] getTeamProviderDescriptors() {
- return (DeploymentProviderDescriptor[])providers.values().toArray(new DeploymentProviderDescriptor[providers.size()]);
- }
-
- public DeploymentProviderDescriptor find(String id) {
- return (DeploymentProviderDescriptor)providers.get(id);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java
deleted file mode 100644
index afb5dbef1..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.registry;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.core.Sorter;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public abstract class RegistryReader {
- protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- protected static Hashtable extensionPoints = new Hashtable();
- /**
- * The constructor.
- */
- protected RegistryReader() {
- }
- /**
- * This method extracts description as a subelement of the given element.
- *
- * @return description string if defined, or empty string if not.
- */
- protected String getDescription(IConfigurationElement config) {
- IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length >= 1) {
- return children[0].getValue();
- }
- return ""; //$NON-NLS-1$
- }
- /**
- * Logs the error in the workbench log using the provided text and the
- * information in the configuration element.
- */
- protected void logError(IConfigurationElement element, String text) {
- IExtension extension = element.getDeclaringExtension();
- IPluginDescriptor descriptor = extension.getDeclaringPluginDescriptor();
- StringBuffer buf = new StringBuffer();
- buf.append("Plugin " + descriptor.getUniqueIdentifier() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
- buf.append("\n" + text); //$NON-NLS-1$
- TeamPlugin.log(IStatus.ERROR, buf.toString(), null);
- }
- /**
- * Logs a very common registry error when a required attribute is missing.
- */
- protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
- logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a very common registry error when a required child is missing.
- */
- protected void logMissingElement(IConfigurationElement element, String elementName) {
- logError(element, "Required sub element '" + elementName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a registry error when the configuration element is unknown.
- */
- protected void logUnknownElement(IConfigurationElement element) {
- logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$
- }
- /**
- * Apply a reproducable order to the list of extensions provided, such that
- * the order will not change as extensions are added or removed.
- */
- protected IExtension[] orderExtensions(IExtension[] extensions) {
- // By default, the order is based on plugin id sorted
- // in ascending order. The order for a plugin providing
- // more than one extension for an extension point is
- // dependent in the order listed in the XML file.
- Sorter sorter = new Sorter() {
- public boolean compare(Object extension1, Object extension2) {
- String s1 = ((IExtension) extension1).getDeclaringPluginDescriptor().getUniqueIdentifier();
- String s2 = ((IExtension) extension2).getDeclaringPluginDescriptor().getUniqueIdentifier();
- //Return true if elementTwo is 'greater than' elementOne
- return s2.compareToIgnoreCase(s1) > 0;
- }
- };
-
- Object[] sorted = sorter.sort(extensions);
- IExtension[] sortedExtension = new IExtension[sorted.length];
- System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
- return sortedExtension;
- }
- /**
- * Implement this method to read element's attributes. If children should
- * also be read, then implementor is responsible for calling <code>readElementChildren</code>.
- * Implementor is also responsible for logging missing attributes.
- *
- * @return true if element was recognized, false if not.
- */
- protected abstract boolean readElement(IConfigurationElement element);
- /**
- * Read the element's children. This is called by the subclass' readElement
- * method when it wants to read the children of the element.
- */
- protected void readElementChildren(IConfigurationElement element) {
- readElements(element.getChildren());
- }
- /**
- * Read each element one at a time by calling the subclass implementation
- * of <code>readElement</code>.
- *
- * Logs an error if the element was not recognized.
- */
- protected void readElements(IConfigurationElement[] elements) {
- for (int i = 0; i < elements.length; i++) {
- if (!readElement(elements[i]))
- logUnknownElement(elements[i]);
- }
- }
- /**
- * Read one extension by looping through its configuration elements.
- */
- protected void readExtension(IExtension extension) {
- readElements(extension.getConfigurationElements());
- }
- /**
- * Start the registry reading process using the supplied plugin ID and
- * extension point.
- */
- public void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
- String pointId = pluginId + "-" + extensionPoint; //$NON-NLS-1$
- IExtension[] extensions = (IExtension[]) extensionPoints.get(pointId);
- if (extensions == null) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point == null)
- return;
- extensions = point.getExtensions();
- extensionPoints.put(pointId, extensions);
- }
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java
deleted file mode 100644
index db7d7fc06..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.simpleAccess;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-
-/*
- * This class represents provisional API. Its here to allow experimentation with 3rd party tools
- * calling providers in a repository neutral manner.
- *
- * A provider is not required to implement this API.
- * Implementers, and those who reference it, do so with the awareness that this class may be
- * removed or substantially changed at future times without warning.
- *
- * The <code>SimpleAccessOperations</code> class exposes a basic repository model that
- * providers may implement to allow third-party plugins to perform repository operations
- * programmatically. For example, a code generation tool may want to get source
- * files before generating the code, and check-in the results. If a provider plugin does
- * not adhere to the <i>semantics</i> of the <code>SimpleAccessOperations</code> class
- * as described, they are free to opt out of implementing it.
- *
- * @since 2.0
- */
-public interface SimpleAccessOperations {
- /*
- * Updates the local resource to have the same content as the corresponding remote
- * resource. Where the local resource does not exist, this method will create it.
- * <p>
- * If the remote resource is a container (e.g. folder or project) this operation is equivalent
- * to getting each non-container member of the remote resource, thereby updating the
- * content of existing local members, creating local members to receive new remote resources,
- * and deleting local members that no longer have a corresponding remote resource.</p>
- * <p>
- * The method is applied to all resources satisfying the depth parameter, described above.</p>
- * <p>
- * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.</p>
- *
- * @param resources an array of local resources to update from the corresponding remote
- * resources.
- * @param depth the depth to traverse the given resources, taken from <code>IResource</code>
- * static constants.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamException if there is a problem getting one or more of the resources. The
- * exception will contain multiple statuses, one for each resource in the <code>resources</code>
- * array. Possible status codes include:
- * <ul>
- * <li>NO_REMOTE_RESOURCE</li>
- * <li>IO_FAILED</li>
- * <li>NOT_AUTHORIZED</li>
- * <li>UNABLE</li>
- * </ul>
- */
- public void get(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
-
- /*
- * Changes the state of the local resource from checked-in to checked-out and transfers the content
- * of the remote resource to the local resource.
- * <p>
- * Where no corresponding local resource exists in the workspace, one is created (including any
- * intermediate parent containers) to receive the contents of the remote resource.</p>
- * <p>
- * Implementations may optimistically only flag the state change locally and rely on resolving conflicts
- * during check-in, or they may pessimistically also checkout or lock the remote resource during a
- * local resource checkout to avoid conflicts. The provider API does not subscribe to either model
- * and supports each equally.</p>
- * <p>
- * Where checkout is applied to a resource that is already checked-out the method has no
- * effect.</p>
- *
- * @param resources the array of local resources to be checked-out.
- * @param depth the depth to traverse the given resources, taken from <code>IResource</code>
- * constants.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamProviderException if there is a problem checking-out one or more of the resources.
- * The exception will contain multiple statuses, one for each resource in the <code>resources</code>
- * array. Possible status codes include:
- * <ul>
- * <li>NOT_CHECKED_IN</li>
- * <li>NO_REMOTE_RESOURCE</li>
- * <li>IO_FAILED</li>
- * <li>NOT_AUTHORIZED</li>
- * <li>UNABLE</li>
- * </ul>
- * @see checkin(IResource[], int, IProgressMonitor)
- */
- public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
-
- /*
- * Transfers the content of the local resource to the corresponding remote resource, and changes the
- * state of the local resource from checked-out to checked-in.
- * <p>
- * If a remote resource does not exist this method creates a new remote resource with the same content
- * as the given local resource. The local resource is said to <i>correspond</i> to the new remote resource.</p>
- * <p>
- * Where providers deal with stores that check-out or lock resources this method is an opportunity
- * to transfer the content and make the corresponding remote check-in or unlock. It is envisaged that
- * where the server maintains resource versions, checkin creates a new version of the remote resource.</p>
- * <p>
- * Note that some providers may <em>require</em> that a resource is checked-out before it can be
- * checked-in. However, all providers must support the explicit checking out a resource before checking
- * it in (e.g., even if the check out is a no-op).</p>
- *
- * @param resources an array of local resources to be checked-in.
- * @param the depth to traverse the given resources, taken from <code>IResource</code>
- * constants.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamException if there is a problem checking-in one or more of the resources.
- * The exception will contain multiple statuses, one for each resource in the <code>resources</code>
- * array. Possible status codes include:
- * <ul>
- * <li>NOT_CHECKED_OUT</li>
- * <li>IO_FAILED</li>
- * <li>NOT_AUTHORIZED</li>
- * <li>UNABLE</li>
- * </ul>
- * @see checkout(IResource[], int, IProgressMonitor)
- */
- public void checkin(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
-
- /*
- * Changes the state of the local resource from checked-out to checked-in without updating the contents
- * of the remote resource.
- * <p>
- * Note that where the provider is a versioning provider, it is envisaged (though not required) that the
- * uncheckout operation does not create a new version.</p>
- * <p>
- * Note also that <code>uncheckout()</code> does not affect the content of the local resource. The
- * caller is required to perform a <code>get()</code> to revert the local resource if that is required
- * (otherwise the local resource will be left with the changes that were made while the remote resource
- * was checked-out. Furthermore, it is valid to call <code>uncheckout()</code> with an
- * <code>IResource</code> that does not exist locally.</p>
- *
- * @param resources an array of the local resources that are to be unchecked-out.
- * @param depth the depth to traverse the given resources, taken from <code>IResource</code>
- * constants.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamProviderException if there is a problem undoing the check-out of one or more of
- * the resources. The exception will contain multiple statuses, one for each resource in the
- * <code>resources</code> array. Possible status codes include:
- * <ul>
- * <li>NOT_CHECKED_OUT</li>
- * <li>IO_FAILED</li>
- * <li>NOT_AUTHORIZED</li>
- * <li>UNABLE</li>
- * </ul>
- * @see checkin(IResource)
- * @see uncheckout(IResource)
- */
- public void uncheckout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
-
- /*
- * Deletes the remote resource corresponding to the given local resource.
- * <p>
- * The notion of delete is simply to make the remote resource unavailable. Where the provider
- * supports versioning it is not specified whether the delete operation makes the version
- * temporarily or forever unavailable, or indeed whether the entire history is made unavailable.</p>
- * <p>
- * Note that the <code>IResource</code>'s passed as arguments may be non-existant in the
- * workbench, the typical case is when such a resource has been received in a core callback.</p>
- * <p>
- * The resource may be checked-in or checked-out prior to deletion. The local resource is not
- * deleted by this method.</p>
- * <p>
- * Resource deletions are inherently deep.</p>
- *
- * @param resources the array of resources whose corresponding remote resources are to be deleted.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamProviderException if there is a problem deleting one or more of
- * the resources. The exception will contain multiple statuses, one for each resource in the
- * <code>resources</code> array. Possible status codes include:
- * <ul>
- * <li>NO_REMOTE_RESOURCE</li>
- * <li>IO_FAILED</li>
- * <li>NOT_AUTHORIZED</li>
- * <li>UNABLE</li>
- * </ul>
- */
- public void delete(IResource[] resources, IProgressMonitor progress) throws TeamException;
-
- /*
- * Informs the provider that a local resource's name or path has changed.
- * <p>
- * Some providers, such as versioning providers, may require this information to track the resource
- * across name changes.</p>
- * <p>
- * Note that this method is always called <em>after</em> the local resource has been moved.</p>
- *
- * @param source the full name of the resource before it was moved.
- * @param target the resource that was moved.
- * @param progress a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- * @throws TeamProviderException if there is a problem recording the move. The exception will
- * contain a single status. Possible status codes are:
- * <ul>
- * <li>NO_REMOTE_RESOURCE</li>
- * <li>IO_FAILED</li>
- * <li>NOT_AUTHORIZED</li>
- * <li>UNABLE</li>
- * </ul>
- */
- public void moved(IPath source, IResource target, IProgressMonitor progress) throws TeamException;
-
- /*
- * Implementor's Note:
- * The following methods are required to return promptly (i.e., they may be used to determine the state of
- * a resource in a UI where long delays are unacceptable). Implementations may cache these values
- * and update the cache on an explicit call to #refreshState().
- *
- * They are currently listed in the provider API, however, they may be moved to a new or different
- * interface in the future to better reflect their UI-orientation.
- */
-
- /*
- * Answers if the remote resource state is checked-out. If the resource has never been checked in this
- * method will return <code>true</code>.
- * <p>
- * It is undefined whether this method tests for a resource being checked out to this workspace
- * or any workspace.</p>
- *
- * @param resource the local resource to test.
- * @return <code>true</code> if the resource is checked-out and <code>false</code> if it is not.
- * @see checkout(IResource[], int, IProgressMonitor)
- */
- public boolean isCheckedOut(IResource resource);
-
- /*
- * Answers whether the resource has a corresponding remote resource.
- * <p>
- * Before a resource is checked-in, the resource will occur locally but not remotely, and calls to this
- * method will return <code>false</code>. Once a local resource is checked in (and assuming the local
- * local resource is not moved or the remote resource deleted) there will be a corresponding remote
- * resource and this method returns <code>true</code>.</p>
- *
- * @param resource the local resource to test.
- * @return <code>true</code> if the local resource has a corresponding remote resource,
- * and <code>false</code> otherwise.
- * @see checkin(IResource[], int, IProgressMonitor)
- * @see refreshState(IResource[], int, IProgressMonitor)
- */
- public boolean hasRemote(IResource resource);
-
- /*
- * Answer if the local resource currently has a different timestamp to the base timestamp
- * for this resource.
- *
- * @param resource the resource to test.
- * @return <code>true</code> if the resource has a different modification
- * timestamp, and <code>false</code> otherwise.
- */
- public boolean isDirty(IResource resource);
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java
deleted file mode 100644
index 9a52b0871..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-
-/**
- * Converts CR/LFs in the underlying input stream to LF.
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * if the underlying stream does. Check the bytesTransferred field to determine how
- * much of the operation completed; conversely, at what point to resume.
- */
-public class CRLFtoLFInputStream extends FilterInputStream {
- private boolean pendingByte = false;
- private int lastByte = -1;
-
- /**
- * Creates a new filtered input stream.
- * @param in the underlying input stream
- */
- public CRLFtoLFInputStream(InputStream in) {
- super(in);
- }
-
- /**
- * Wraps the underlying stream's method.
- * Translates CR/LF sequences to LFs transparently.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public int read() throws IOException {
- if (! pendingByte) {
- lastByte = in.read(); // ok if this throws
- pendingByte = true; // remember the byte in case we throw an exception later on
- }
- if (lastByte == '\r') {
- lastByte = in.read(); // ok if this throws
- if (lastByte != '\n') {
- if (lastByte == -1) pendingByte = false;
- return '\r'; // leaves the byte pending for later
- }
- }
- pendingByte = false;
- return lastByte;
- }
-
- /**
- * Wraps the underlying stream's method.
- * Translates CR/LF sequences to LFs transparently.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public int read(byte[] buffer, int off, int len) throws IOException {
- // handle boundary cases cleanly
- if (len == 0) {
- return 0;
- } else if (len == 1) {
- int b = read();
- if (b == -1) return -1;
- buffer[off] = (byte) b;
- return 1;
- }
- // read some bytes from the stream
- // prefix with pending byte from last read if any
- int count = 0;
- if (pendingByte) {
- buffer[off] = (byte) lastByte;
- pendingByte = false;
- count = 1;
- }
- InterruptedIOException iioe = null;
- try {
- len = in.read(buffer, off + count, len - count);
- if (len == -1) {
- return (count == 0) ? -1 : count;
- }
- } catch (InterruptedIOException e) {
- len = e.bytesTransferred;
- iioe = e;
- }
- count += len;
- // strip out CR's in CR/LF pairs
- // pendingByte will be true iff previous byte was a CR
- int j = off;
- for (int i = off; i < off + count; ++i) { // invariant: j <= i
- lastByte = buffer[i];
- if (lastByte == '\r') {
- if (pendingByte) {
- buffer[j++] = '\r'; // write out orphan CR
- } else {
- pendingByte = true;
- }
- } else {
- if (pendingByte) {
- if (lastByte != '\n') buffer[j++] = '\r'; // if LF, don't write the CR
- pendingByte = false;
- }
- buffer[j++] = (byte) lastByte;
- }
- }
- if (iioe != null) {
- iioe.bytesTransferred = j - off;
- throw iioe;
- }
- return j - off;
- }
-
- /**
- * Calls read() to skip the specified number of bytes
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public long skip(long count) throws IOException {
- int actualCount = 0; // assumes count < Integer.MAX_INT
- try {
- while (count-- > 0 && read() != -1) actualCount++; // skip the specified number of bytes
- return actualCount;
- } catch (InterruptedIOException e) {
- e.bytesTransferred = actualCount;
- throw e;
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * Returns the number of bytes that can be read without blocking; accounts for
- * possible translation of CR/LF sequences to LFs in these bytes.
- * @throws IOException if an i/o error occurs
- */
- public int available() throws IOException {
- return in.available() / 2; // we can guarantee at least this amount after contraction
- }
-
- /**
- * Mark is not supported by the wrapper even if the underlying stream does, returns false.
- */
- public boolean markSupported() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java
deleted file mode 100644
index 9c14ffb86..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-
-/**
- * Converts LFs in the underlying input stream to CR/LF.
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * if the underlying stream does. Check the bytesTransferred field to determine how
- * much of the operation completed; conversely, at what point to resume.
- */
-public class LFtoCRLFInputStream extends FilterInputStream {
- private boolean mustReturnLF = false;
-
- /**
- * Creates a new filtered input stream.
- * @param in the underlying input stream
- */
- public LFtoCRLFInputStream(InputStream in) {
- super(in);
- }
-
- /**
- * Wraps the underlying stream's method.
- * Translates LFs to CR/LF sequences transparently.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public int read() throws IOException {
- if (mustReturnLF) {
- mustReturnLF = false;
- return '\n';
- }
- int b = in.read(); // ok if this throws
- if (b == '\n') {
- mustReturnLF = true;
- b = '\r';
- }
- return b;
- }
-
- /**
- * Wraps the underlying stream's method.
- * Translates LFs to CR/LF sequences transparently.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public int read(byte[] buffer, int off, int len) throws IOException {
- // handle boundary cases cleanly
- if (len == 0) {
- return 0;
- } else if (len == 1) {
- int b = read();
- if (b == -1) return -1;
- buffer[off] = (byte) b;
- return 1;
- }
- // prefix with remembered \n from last read, but don't expand it a second time
- int count = 0;
- if (mustReturnLF) {
- mustReturnLF = false;
- buffer[off++] = '\n';
- --len;
- count = 1;
- if (len < 2) return count; // is there still enough room to expand more?
- }
- // read some bytes from the stream into the back half of the buffer
- // this guarantees that there is always room to expand
- len /= 2;
- int j = off + len;
- InterruptedIOException iioe = null;
- try {
- len = in.read(buffer, j, len);
- if (len == -1) {
- return (count == 0) ? -1 : count;
- }
- } catch (InterruptedIOException e) {
- len = e.bytesTransferred;
- iioe = e;
- }
- count += len;
- // copy bytes from the middle to the front of the array, expanding LF->CR/LF
- while (len-- > 0) {
- byte b = buffer[j++];
- if (b == '\n') {
- buffer[off++] = '\r';
- count++;
- }
- buffer[off++] = b;
- }
- if (iioe != null) {
- iioe.bytesTransferred = count;
- throw iioe;
- }
- return count;
- }
-
- /**
- * Calls read() to skip the specified number of bytes
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public long skip(long count) throws IOException {
- int actualCount = 0; // assumes count < Integer.MAX_INT
- try {
- while (count-- > 0 && read() != -1) actualCount++; // skip the specified number of bytes
- return actualCount;
- } catch (InterruptedIOException e) {
- e.bytesTransferred = actualCount;
- throw e;
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * Returns the number of bytes that can be read without blocking; accounts for
- * possible translation of LFs to CR/LF sequences in these bytes.
- * @throws IOException if an i/o error occurs
- */
- public int available() throws IOException {
- return in.available(); // we can guarantee at least this amount after expansion
- }
-
- /**
- * Mark is not supported by the wrapper even if the underlying stream does, returns false.
- */
- public boolean markSupported() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
deleted file mode 100644
index 26b61275c..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * Polls a progress monitor periodically and handles timeouts over extended durations.
- * For this class to be effective, a high numAttempts should be specified, and the
- * underlying stream should time out frequently on reads (every second or so).
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * if the underlying stream does. Check the bytesTransferred field to determine how
- * much of the operation completed; conversely, at what point to resume.
- */
-public class PollingInputStream extends FilterInputStream {
- private static final boolean DEBUG = Policy.DEBUG_STREAMS;
- private int numAttempts;
- private IProgressMonitor monitor;
- private boolean cancellable;
-
- /**
- * Creates a new polling input stream.
- * @param in the underlying input stream
- * @param numAttempts the number of attempts before issuing an InterruptedIOException,
- * if 0, retries indefinitely until canceled
- * @param monitor the progress monitor to be polled for cancellation
- */
- public PollingInputStream(InputStream in, int numAttempts, IProgressMonitor monitor) {
- super(in);
- this.numAttempts = numAttempts;
- this.monitor = monitor;
- this.cancellable = true;
- }
-
- /**
- * Wraps the underlying stream's method.
- * It may be important to wait for an input stream to be closed because it
- * holds an implicit lock on a system resoure (such as a file) while it is
- * open. Closing a stream may take time if the underlying stream is still
- * servicing a previous request.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times
- * @throws IOException if an i/o error occurs
- */
- public void close() throws IOException {
- int attempts = 0;
- try {
- readPendingInput();
- } catch (IOException e) {
- // We shouldn't get an exception when we're getting the available input.
- // If we do, just log it so we can close.
- TeamPlugin.log(IStatus.ERROR, e.getMessage(), e);
- } finally {
- for (;;) {
- try {
- in.close();
- return;
- } catch (InterruptedIOException e) {
- if (checkCancellation()) throw new OperationCanceledException();
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingInputStream.closeTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("close retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times
- * and no data was received, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public int read() throws IOException {
- int attempts = 0;
- for (;;) {
- if (checkCancellation()) throw new OperationCanceledException();
- try {
- return in.read();
- } catch (InterruptedIOException e) {
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingInputStream.readTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("read retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times
- * and no data was received, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public int read(byte[] buffer, int off, int len) throws IOException {
- int attempts = 0;
- for (;;) {
- if (checkCancellation()) throw new OperationCanceledException();
- try {
- return in.read(buffer, off, len);
- } catch (InterruptedIOException e) {
- if (e.bytesTransferred != 0) return e.bytesTransferred; // keep partial transfer
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingInputStream.readTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("read retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times
- * and no data was received, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public long skip(long count) throws IOException {
- int attempts = 0;
- for (;;) {
- if (checkCancellation()) throw new OperationCanceledException();
- try {
- return in.skip(count);
- } catch (InterruptedIOException e) {
- if (e.bytesTransferred != 0) return e.bytesTransferred; // keep partial transfer
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingInputStream.readTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("read retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Reads any pending input from the input stream so that
- * the stream can savely be closed.
- */
- protected void readPendingInput() throws IOException {
- byte[] buffer= new byte[2048];
- while (true) {
- int available = in.available();
- if (available < 1) break;
- if (available > buffer.length) available = buffer.length;
- if (in.read(buffer, 0, available) < 1) break;
- }
- }
-
- /**
- * Called to set whether cancellation will be checked by this stream. Turning cancellation checking
- * off can be very useful for protecting critical portions of a protocol that shouldn't be interrupted.
- * For example, it is often necessary to protect login sequences.
- * @param cancellable a flag controlling whether this stream will check for cancellation.
- */
- public void setIsCancellable(boolean cancellable) {
- this.cancellable = cancellable;
- }
-
- /**
- * Checked whether the monitor for this stream has been cancelled. If the cancellable
- * flag is <code>false</code> then the monitor is never cancelled.
- * @return <code>true</code> if the monitor has been cancelled and <code>false</code>
- * otherwise.
- */
- private boolean checkCancellation() {
- if(cancellable) {
- return monitor.isCanceled();
- } else {
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
deleted file mode 100644
index ecbdb8eeb..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * Polls a progress monitor periodically and handles timeouts over extended durations.
- * For this class to be effective, a high numAttempts should be specified, and the
- * underlying stream should time out frequently on writes (every second or so).
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * if the underlying stream does. Check the bytesTransferred field to determine how
- * much of the operation completed; conversely, at what point to resume.
- */
-public class PollingOutputStream extends FilterOutputStream {
- private static final boolean DEBUG = Policy.DEBUG_STREAMS;
- private int numAttempts;
- private IProgressMonitor monitor;
- private boolean cancellable;
-
- /**
- * Creates a new polling output stream.
- * @param in the underlying output stream
- * @param numAttempts the number of attempts before issuing an InterruptedIOException,
- * if 0, retries indefinitely until canceled
- * @param monitor the progress monitor to be polled for cancellation
- */
- public PollingOutputStream(OutputStream out, int numAttempts, IProgressMonitor monitor) {
- super(out);
- this.numAttempts = numAttempts;
- this.monitor = monitor;
- this.cancellable = true;
- }
-
- /**
- * Wraps the underlying stream's method.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times
- * and no data was sent, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public void write(int b) throws IOException {
- int attempts = 0;
- for (;;) {
- if (checkCancellation()) throw new OperationCanceledException();
- try {
- out.write(b);
- return;
- } catch (InterruptedIOException e) {
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingOutputStream.writeTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("write retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times,
- * bytesTransferred will reflect the number of bytes sent
- * @throws IOException if an i/o error occurs
- */
- public void write(byte[] buffer, int off, int len) throws IOException {
- int count = 0;
- int attempts = 0;
- for (;;) {
- if (checkCancellation()) throw new OperationCanceledException();
- try {
- out.write(buffer, off, len);
- return;
- } catch (InterruptedIOException e) {
- int amount = e.bytesTransferred;
- if (amount != 0) { // keep partial transfer
- len -= amount;
- if (len <= 0) return;
- off += amount;
- count += amount;
- attempts = 0; // made some progress, don't time out quite yet
- }
- if (++attempts == numAttempts) {
- e = new InterruptedIOException(Policy.bind("PollingOutputStream.writeTimeout")); //$NON-NLS-1$
- e.bytesTransferred = count;
- throw e;
- }
- if (DEBUG) System.out.println("write retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times,
- * bytesTransferred will reflect the number of bytes sent
- * @throws IOException if an i/o error occurs
- */
- public void flush() throws IOException {
- int count = 0;
- int attempts = 0;
- for (;;) {
- if (checkCancellation()) throw new OperationCanceledException();
- try {
- out.flush();
- return;
- } catch (InterruptedIOException e) {
- int amount = e.bytesTransferred;
- if (amount != 0) { // keep partial transfer
- count += amount;
- attempts = 0; // made some progress, don't time out quite yet
- }
- if (++attempts == numAttempts) {
- e = new InterruptedIOException(Policy.bind("PollingOutputStream.writeTimeout")); //$NON-NLS-1$
- e.bytesTransferred = count;
- throw e;
- }
- if (DEBUG) System.out.println("write retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Calls flush() then close() on the underlying stream.
- * @throws OperationCanceledException if the progress monitor is canceled
- * @throws InterruptedIOException if the underlying operation times out numAttempts times,
- * bytesTransferred will reflect the number of bytes sent during the flush()
- * @throws IOException if an i/o error occurs
- */
- public void close() throws IOException {
- int attempts = numAttempts - 1; // fail fast if flush() does times out
- try {
- out.flush();
- attempts = 0;
- } finally {
- for (;;) {
- try {
- out.close();
- return;
- } catch (InterruptedIOException e) {
- if (checkCancellation()) throw new OperationCanceledException();
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingOutputStream.closeTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("close retry=" + attempts); //$NON-NLS-1$
- }
- }
- }
- }
-
- /**
- * Called to set whether cancellation will be checked by this stream. Turning cancellation checking
- * off can be very useful for protecting critical portions of a protocol that shouldn't be interrupted.
- * For example, it is often necessary to protect login sequences.
- * @param cancellable a flag controlling whether this stream will check for cancellation.
- */
- public void setIsCancellable(boolean cancellable) {
- this.cancellable = cancellable;
- }
-
- /**
- * Checked whether the monitor for this stream has been cancelled. If the cancellable
- * flag is <code>false</code> then the monitor is never cancelled.
- * @return <code>true</code> if the monitor has been cancelled and <code>false</code>
- * otherwise.
- */
- private boolean checkCancellation() {
- if(cancellable) {
- return monitor.isCanceled();
- } else {
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java
deleted file mode 100644
index 54b2e4aff..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * Updates a progress monitor as bytes are read from the input stream.
- * Also starts a background thread to provide responsive cancellation on read().
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * if the underlying stream does. Check the bytesTransferred field to determine how
- * much of the operation completed; conversely, at what point to resume.
- */
-public abstract class ProgressMonitorInputStream extends FilterInputStream {
- private IProgressMonitor monitor;
- private int updateIncrement;
- private long bytesTotal;
- private long bytesRead = 0;
- private long lastUpdate = -1;
- private long nextUpdate = 0;
-
- /**
- * Creates a progress monitoring input stream.
- * @param in the underlying input stream
- * @param bytesTotal the number of bytes to read in total (passed to updateMonitor())
- * @param updateIncrement the number of bytes read between updates
- * @param monitor the progress monitor
- */
- public ProgressMonitorInputStream(InputStream in, long bytesTotal, int updateIncrement, IProgressMonitor monitor) {
- super(in);
- this.bytesTotal = bytesTotal;
- this.updateIncrement = updateIncrement;
- this.monitor = monitor;
- update(true);
- }
-
- protected abstract void updateMonitor(long bytesRead, long size, IProgressMonitor monitor);
-
- /**
- * Wraps the underlying stream's method.
- * Updates the progress monitor to the final number of bytes read.
- * @throws IOException if an i/o error occurs
- */
- public void close() throws IOException {
- try {
- in.close();
- } finally {
- update(true);
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * Updates the progress monitor if the next update increment has been reached.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public int read() throws IOException {
- int b = in.read();
- if (b != -1) {
- bytesRead += 1;
- update(false);
- }
- return b;
- }
-
- /**
- * Wraps the underlying stream's method.
- * Updates the progress monitor if the next update increment has been reached.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public int read(byte[] buffer, int offset, int length) throws IOException {
- try {
- int count = in.read(buffer, offset, length);
- if (count != -1) {
- bytesRead += count;
- update(false);
- }
- return count;
- } catch (InterruptedIOException e) {
- bytesRead += e.bytesTransferred;
- update(false);
- throw e;
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * Updates the progress monitor if the next update increment has been reached.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public long skip(long amount) throws IOException {
- try {
- long count = in.skip(amount);
- bytesRead += count;
- update(false);
- return count;
- } catch (InterruptedIOException e) {
- bytesRead += e.bytesTransferred;
- update(false);
- throw e;
- }
- }
-
- /**
- * Mark is not supported by the wrapper even if the underlying stream does, returns false.
- */
- public boolean markSupported() {
- return false;
- }
-
- private void update(boolean now) {
- if (bytesRead >= nextUpdate || now) {
- nextUpdate = bytesRead - (bytesRead % updateIncrement);
- if (nextUpdate != lastUpdate) updateMonitor(nextUpdate, bytesTotal, monitor);
- lastUpdate = nextUpdate;
- nextUpdate += updateIncrement;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java
deleted file mode 100644
index d7d26cac8..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-
-import org.eclipse.core.runtime.OperationCanceledException;
-
-/**
- * Simulates a stream that represents only a portion of the underlying stream.
- * Will report EOF when this portion has been fully read and prevent further reads.
- * The underlying stream is not closed on close(), but the remaining unread input
- * may optionally be skip()'d.
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * if the underlying stream does. Check the bytesTransferred field to determine how
- * much of the operation completed; conversely, at what point to resume.
- */
-public class SizeConstrainedInputStream extends FilterInputStream {
- private boolean discardOnClose;
- private long bytesRemaining;
-
- /**
- * Creates a size contrained input stream.
- * @param in the underlying input stream, never actually closed by this filter
- * @param size the maximum number of bytes of the underlying input stream that
- * can be read through this filter
- * @param discardOnClose if true, discards remaining unread bytes on close()
- */
- public SizeConstrainedInputStream(InputStream in, long size, boolean discardOnClose) {
- super(in);
- this.bytesRemaining = size;
- this.discardOnClose = discardOnClose;
- }
-
- /**
- * Prevents further reading from the stream but does not close the underlying stream.
- * If discardOnClose, skip()'s over any remaining unread bytes in the constrained region.
- * @throws IOException if an i/o error occurs
- */
- public void close() throws IOException {
- try {
- if (discardOnClose) {
- while (bytesRemaining != 0 && skip(bytesRemaining) != 0);
- }
- } catch (OperationCanceledException e) {
- // The receiver is likely wrapping a PollingInputStream which could throw
- // an OperationCanceledException on a skip.
- // Since we're closing, just ignore the cancel and let the caller check the monitor
- } finally {
- bytesRemaining = 0;
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * Simulates an end-of-file condition if the end of the constrained region has been reached.
- * @throws IOException if an i/o error occurs
- */
- public int available() throws IOException {
- int amount = in.available();
- if (amount > bytesRemaining) amount = (int) bytesRemaining;
- return amount;
- }
-
- /**
- * Wraps the underlying stream's method.
- * Simulates an end-of-file condition if the end of the constrained region has been reached.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public int read() throws IOException {
- if (bytesRemaining == 0) return -1;
- int b = in.read();
- if (b != -1) bytesRemaining -= 1;
- return b;
- }
-
- /**
- * Wraps the underlying stream's method.
- * Simulates an end-of-file condition if the end of the constrained region has been reached.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public int read(byte[] buffer, int offset, int length) throws IOException {
- if (length > bytesRemaining) {
- if (bytesRemaining == 0) return -1;
- length = (int) bytesRemaining;
- }
- try {
- int count = in.read(buffer, offset, length);
- if (count != -1) bytesRemaining -= count;
- return count;
- } catch (InterruptedIOException e) {
- bytesRemaining -= e.bytesTransferred;
- throw e;
- }
- }
-
- /**
- * Wraps the underlying stream's method.
- * Simulates an end-of-file condition if the end of the constrained region has been reached.
- * @throws InterruptedIOException if the operation was interrupted before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public long skip(long amount) throws IOException {
- if (amount > bytesRemaining) amount = bytesRemaining;
- try {
- long count = in.skip(amount);
- bytesRemaining -= count;
- return count;
- } catch (InterruptedIOException e) {
- bytesRemaining -= e.bytesTransferred;
- throw e;
- }
- }
-
- /**
- * Mark is not supported by the wrapper even if the underlying stream does, returns false.
- */
- public boolean markSupported() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
deleted file mode 100644
index f55682cc2..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-
-/**
- * Wraps an input stream that blocks indefinitely to simulate timeouts on read(),
- * skip(), and close(). The resulting input stream is buffered and supports
- * retrying operations that failed due to an InterruptedIOException.
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * REGARDLESS of whether the underlying stream does unless the underlying stream itself
- * generates InterruptedIOExceptions in which case it must also support resuming.
- * Check the bytesTransferred field to determine how much of the operation completed;
- * conversely, at what point to resume.
- */
-public class TimeoutInputStream extends FilterInputStream {
- // unsynchronized variables
- private final long readTimeout; // read() timeout in millis
- private final long closeTimeout; // close() timeout in millis, or -1
-
- // requests for the thread (synchronized)
- private boolean closeRequested = false; // if true, close requested
-
- // responses from the thread (synchronized)
- private Thread thread; // if null, thread has terminated
- private byte[] iobuffer; // circular buffer
- private int head = 0; // points to first unread byte
- private int length = 0; // number of remaining unread bytes
- private IOException ioe = null; // if non-null, contains a pending exception
- private boolean waitingForClose = false; // if true, thread is waiting for close()
-
- /**
- * Creates a timeout wrapper for an input stream.
- * @param in the underlying input stream
- * @param bufferSize the buffer size in bytes; should be large enough to mitigate
- * Thread synchronization and context switching overhead
- * @param readTimeout the number of milliseconds to block for a read() or skip() before
- * throwing an InterruptedIOException; 0 blocks indefinitely
- * @param closeTimeout the number of milliseconds to block for a close() before throwing
- * an InterruptedIOException; 0 blocks indefinitely, -1 closes the stream in the background
- */
- public TimeoutInputStream(InputStream in, int bufferSize, long readTimeout, long closeTimeout) {
- super(in);
- this.readTimeout = readTimeout;
- this.closeTimeout = closeTimeout;
- this.iobuffer = new byte[bufferSize];
- thread = new Thread(new Runnable() {
- public void run() {
- runThread();
- }
- }, "TimeoutInputStream");//$NON-NLS-1$
- thread.setDaemon(true);
- thread.start();
- }
-
- /**
- * Wraps the underlying stream's method.
- * It may be important to wait for a stream to actually be closed because it
- * holds an implicit lock on a system resoure (such as a file) while it is
- * open. Closing a stream may take time if the underlying stream is still
- * servicing a previous request.
- * @throws InterruptedIOException if the timeout expired
- * @throws IOException if an i/o error occurs
- */
- public void close() throws IOException {
- Thread oldThread;
- synchronized (this) {
- if (thread == null) return;
- oldThread = thread;
- closeRequested = true;
- thread.interrupt();
- checkError();
- }
- if (closeTimeout == -1) return;
- try {
- oldThread.join(closeTimeout);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt(); // we weren't expecting to be interrupted
- }
- synchronized (this) {
- checkError();
- if (thread != null) throw new InterruptedIOException();
- }
- }
-
- /**
- * Returns the number of unread bytes in the buffer.
- * @throws IOException if an i/o error occurs
- */
- public synchronized int available() throws IOException {
- if (length == 0) checkError();
- return length > 0 ? length : 0;
- }
-
- /**
- * Reads a byte from the stream.
- * @throws InterruptedIOException if the timeout expired and no data was received,
- * bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public synchronized int read() throws IOException {
- if (! syncFill()) return -1; // EOF reached
- int b = iobuffer[head++] & 255;
- if (head == iobuffer.length) head = 0;
- length--;
- notify();
- return b;
- }
-
- /**
- * Reads multiple bytes from the stream.
- * @throws InterruptedIOException if the timeout expired and no data was received,
- * bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public synchronized int read(byte[] buffer, int off, int len) throws IOException {
- if (! syncFill()) return -1; // EOF reached
- int pos = off;
- if (len > length) len = length;
- while (len-- > 0) {
- buffer[pos++] = iobuffer[head++];
- if (head == iobuffer.length) head = 0;
- length--;
- }
- notify();
- return pos - off;
- }
-
- /**
- * Skips multiple bytes in the stream.
- * @throws InterruptedIOException if the timeout expired before all of the
- * bytes specified have been skipped, bytesTransferred may be non-zero
- * @throws IOException if an i/o error occurs
- */
- public synchronized long skip(long count) throws IOException {
- long amount = 0;
- try {
- do {
- if (! syncFill()) break; // EOF reached
- int skip = (int) Math.min(count - amount, length);
- head = (head + skip) % iobuffer.length;
- length -= skip;
- amount += skip;
- } while (amount < count);
- } catch (InterruptedIOException e) {
- e.bytesTransferred = (int) amount; // assumes amount < Integer.MAX_INT
- throw e;
- }
- notify();
- return amount;
- }
-
- /**
- * Mark is not supported by the wrapper even if the underlying stream does, returns false.
- */
- public boolean markSupported() {
- return false;
- }
-
- /**
- * Waits for the buffer to fill if it is empty and the stream has not reached EOF.
- * @return true if bytes are available, false if EOF has been reached
- * @throws InterruptedIOException if EOF not reached but no bytes are available
- */
- private boolean syncFill() throws IOException {
- if (length != 0) return true;
- checkError(); // check errors only after we have read all remaining bytes
- if (waitingForClose) return false;
- notify();
- try {
- wait(readTimeout);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt(); // we weren't expecting to be interrupted
- }
- if (length != 0) return true;
- checkError(); // check errors only after we have read all remaining bytes
- if (waitingForClose) return false;
- throw new InterruptedIOException();
- }
-
- /**
- * If an exception is pending, throws it.
- */
- private void checkError() throws IOException {
- if (ioe != null) {
- IOException e = ioe;
- ioe = null;
- throw e;
- }
- }
-
- /**
- * Runs the thread in the background.
- */
- private void runThread() {
- try {
- readUntilDone();
- } catch (IOException e) {
- synchronized (this) { ioe = e; }
- } finally {
- waitUntilClosed();
- try {
- in.close();
- } catch (IOException e) {
- synchronized (this) { ioe = e; }
- } finally {
- synchronized (this) {
- thread = null;
- notify();
- }
- }
- }
- }
-
- /**
- * Waits until we have been requested to close the stream.
- */
- private synchronized void waitUntilClosed() {
- waitingForClose = true;
- notify();
- while (! closeRequested) {
- try {
- wait();
- } catch (InterruptedException e) {
- closeRequested = true; // alternate quit signal
- }
- }
- }
-
- /**
- * Reads bytes into the buffer until EOF, closed, or error.
- */
- private void readUntilDone() throws IOException {
- for (;;) {
- int off, len;
- synchronized (this) {
- for (;;) {
- if (closeRequested) return; // quit signal
- if (length != iobuffer.length) break;
- try {
- wait();
- } catch (InterruptedException e) {
- closeRequested = true; // alternate quit signal
- }
- }
- off = (head + length) % iobuffer.length;
- len = ((head > off) ? head : iobuffer.length) - off;
- }
- int count;
- try {
- // the i/o operation might block without releasing the lock,
- // so we do this outside of the synchronized block
- count = in.read(iobuffer, off, len);
- if (count == -1) return; // EOF encountered
- } catch (InterruptedIOException e) {
- count = e.bytesTransferred; // keep partial transfer
- }
- synchronized (this) {
- length += count;
- notify();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java
deleted file mode 100644
index 0041e6bbd..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.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.core.streams;
-
-import java.io.BufferedOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.io.OutputStream;
-
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * Wraps an output stream that blocks indefinitely to simulate timeouts on write(),
- * flush(), and close(). The resulting output stream is buffered and supports
- * retrying operations that failed due to an InterruptedIOException.
- *
- * Supports resuming partially completed operations after an InterruptedIOException
- * REGARDLESS of whether the underlying stream does unless the underlying stream itself
- * generates InterruptedIOExceptions in which case it must also support resuming.
- * Check the bytesTransferred field to determine how much of the operation completed;
- * conversely, at what point to resume.
- */
-public class TimeoutOutputStream extends FilterOutputStream {
- // unsynchronized variables
- private final long writeTimeout; // write() timeout in millis
- private final long closeTimeout; // close() timeout in millis, or -1
-
- // requests for the thread (synchronized)
- private byte[] iobuffer; // circular buffer
- private int head = 0; // points to first unwritten byte
- private int length = 0; // number of remaining unwritten bytes
- private boolean closeRequested = false; // if true, close requested
- private boolean flushRequested = false; // if true, flush requested
-
- // responses from the thread (synchronized)
- private Thread thread;
- private boolean waitingForClose = false; // if true, the thread is waiting for close()
- private IOException ioe = null;
-
- /**
- * Creates a timeout wrapper for an output stream.
- * @param out the underlying input stream
- * @param bufferSize the buffer size in bytes; should be large enough to mitigate
- * Thread synchronization and context switching overhead
- * @param writeTimeout the number of milliseconds to block for a write() or flush() before
- * throwing an InterruptedIOException; 0 blocks indefinitely
- * @param closeTimeout the number of milliseconds to block for a close() before throwing
- * an InterruptedIOException; 0 blocks indefinitely, -1 closes the stream in the background
- */
- public TimeoutOutputStream(OutputStream out, int bufferSize, long writeTimeout, long closeTimeout) {
- super(new BufferedOutputStream(out, bufferSize));
- this.writeTimeout = writeTimeout;
- this.closeTimeout = closeTimeout;
- this.iobuffer = new byte[bufferSize];
- thread = new Thread(new Runnable() {
- public void run() {
- runThread();
- }
- }, "TimeoutOutputStream");//$NON-NLS-1$
- thread.setDaemon(true);
- thread.start();
- }
-
- /**
- * Wraps the underlying stream's method.
- * It may be important to wait for a stream to actually be closed because it
- * holds an implicit lock on a system resoure (such as a file) while it is
- * open. Closing a stream may take time if the underlying stream is still
- * servicing a previous request.
- * @throws InterruptedIOException if the timeout expired, bytesTransferred will
- * reflect the number of bytes flushed from the buffer
- * @throws IOException if an i/o error occurs
- */
- public void close() throws IOException {
- Thread oldThread;
- synchronized (this) {
- if (thread == null) return;
- oldThread = thread;
- closeRequested = true;
- thread.interrupt();
- checkError();
- }
- if (closeTimeout == -1) return;
- try {
- oldThread.join(closeTimeout);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt(); // we weren't expecting to be interrupted
- }
- synchronized (this) {
- checkError();
- if (thread != null) throw new InterruptedIOException();
- }
- }
-
- /**
- * Writes a byte to the stream.
- * @throws InterruptedIOException if the timeout expired and no data was sent,
- * bytesTransferred will be zero
- * @throws IOException if an i/o error occurs
- */
- public synchronized void write(int b) throws IOException {
- syncCommit(true);
- iobuffer[(head + length) % iobuffer.length] = (byte) b;
- length++;
- notify();
- }
-
- /**
- * Writes multiple bytes to the stream.
- * @throws InterruptedIOException if the timeout expired, bytesTransferred will
- * reflect the number of bytes sent
- * @throws IOException if an i/o error occurs
- */
- public synchronized void write(byte[] buffer, int off, int len) throws IOException {
- int amount = 0;
- try {
- do {
- syncCommit(true);
- while (amount < len && length != iobuffer.length) {
- iobuffer[(head + length) % iobuffer.length] = buffer[off++];
- length++;
- amount++;
- }
- } while (amount < len);
- } catch (InterruptedIOException e) {
- e.bytesTransferred = amount;
- throw e;
- }
- notify();
- }
-
- /**
- * Flushes the stream.
- * @throws InterruptedIOException if the timeout expired, bytesTransferred will
- * reflect the number of bytes flushed from the buffer
- * @throws IOException if an i/o error occurs
- */
- public synchronized void flush() throws IOException {
- int oldLength = length;
- flushRequested = true;
- try {
- syncCommit(false);
- } catch (InterruptedIOException e) {
- e.bytesTransferred = oldLength - length;
- throw e;
- }
- notify();
- }
-
- /**
- * Waits for the buffer to drain if it is full.
- * @param partial if true, waits until the buffer is partially empty, else drains it entirely
- * @throws InterruptedIOException if the buffer could not be drained as requested
- */
- private void syncCommit(boolean partial) throws IOException {
- checkError(); // check errors before allowing the addition of new bytes
- if (partial && length != iobuffer.length || length == 0) return;
- if (waitingForClose) throw new IOException(Policy.bind("TimeoutOutputStream.cannotWriteToStream")); //$NON-NLS-1$
- notify();
- try {
- wait(writeTimeout);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt(); // we weren't expecting to be interrupted
- }
- checkError(); // check errors before allowing the addition of new bytes
- if (partial && length != iobuffer.length || length == 0) return;
- throw new InterruptedIOException();
- }
-
- /**
- * If an exception is pending, throws it.
- */
- private void checkError() throws IOException {
- if (ioe != null) {
- IOException e = ioe;
- ioe = null;
- throw e;
- }
- }
-
- /**
- * Runs the thread in the background.
- */
- private void runThread() {
- try {
- writeUntilDone();
- } catch (IOException e) {
- synchronized (this) { ioe = e; }
- } finally {
- waitUntilClosed();
- try {
- out.close();
- } catch (IOException e) {
- synchronized (this) { ioe = e; }
- } finally {
- synchronized (this) {
- thread = null;
- notify();
- }
- }
- }
- }
-
- /**
- * Waits until we have been requested to close the stream.
- */
- private synchronized void waitUntilClosed() {
- waitingForClose = true;
- notify();
- while (! closeRequested) {
- try {
- wait();
- } catch (InterruptedException e) {
- closeRequested = true; // alternate quit signal
- }
- }
- }
-
- /**
- * Writes bytes from the buffer until closed and buffer is empty
- */
- private void writeUntilDone() throws IOException {
- int bytesUntilFlush = -1; // if > 0, then we will flush after that many bytes have been written
- for (;;) {
- int off, len;
- synchronized (this) {
- for (;;) {
- if (closeRequested && length == 0) return; // quit signal
- if (length != 0 || flushRequested) break;
- try {
- wait();
- } catch (InterruptedException e) {
- closeRequested = true; // alternate quit signal
- }
- }
- off = head;
- len = iobuffer.length - head;
- if (len > length) len = length;
- if (flushRequested && bytesUntilFlush < 0) {
- flushRequested = false;
- bytesUntilFlush = length;
- }
- }
-
- // If there are bytes to be written, write them
- if (len != 0) {
- // write out all remaining bytes from the buffer before flushing
- try {
- // the i/o operation might block without releasing the lock,
- // so we do this outside of the synchronized block
- out.write(iobuffer, off, len);
- } catch (InterruptedIOException e) {
- len = e.bytesTransferred;
- }
- }
-
- // If there was a pending flush, do it
- if (bytesUntilFlush >= 0) {
- bytesUntilFlush -= len;
- if (bytesUntilFlush <= 0) {
- // flush the buffer now
- try {
- out.flush();
- } catch (InterruptedIOException e) {
- }
- bytesUntilFlush = -1; // might have been 0
- }
- }
-
- // If bytes were written, update the circular buffer
- if (len != 0) {
- synchronized (this) {
- head = (head + len) % iobuffer.length;
- length -= len;
- notify();
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java
deleted file mode 100644
index 44922f9fa..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import java.io.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * This is an internal class that is usd by the <code>ContentComparisonSyncInfoFilter</code>
- * to compare the comtents of the local and remote resources
- */
-public class ContentComparator {
-
- private boolean ignoreWhitespace = false;
-
- public ContentComparator(boolean ignoreWhitespace) {
- this.ignoreWhitespace = ignoreWhitespace;
- }
-
- public boolean compare(Object e1, Object e2, IProgressMonitor monitor) {
- InputStream is1 = null;
- InputStream is2 = null;
- try {
- is1 = getContents(e1, Policy.subMonitorFor(monitor, 50));
- is2 = getContents(e2, Policy.subMonitorFor(monitor, 50));
- return contentsEqual(is1, is2, shouldIgnoreWhitespace());
- } catch(TeamException e) {
- TeamPlugin.log(e);
- return false;
- } finally {
- try {
- try {
- if (is1 != null) {
- is1.close();
- }
- } finally {
- if (is2 != null) {
- is2.close();
- }
- }
- } catch (IOException e) {
- // Ignore
- }
- }
- }
-
- protected boolean shouldIgnoreWhitespace() {
- return ignoreWhitespace;
- }
-
- /**
- * Returns <code>true</code> if both input streams byte contents is
- * identical.
- *
- * @param input1
- * first input to contents compare
- * @param input2
- * second input to contents compare
- * @return <code>true</code> if content is equal
- */
- private boolean contentsEqual(InputStream is1, InputStream is2, boolean ignoreWhitespace) {
- try {
- if (is1 == is2)
- return true;
-
- if (is1 == null && is2 == null) // no byte contents
- return true;
-
- if (is1 == null || is2 == null) // only one has
- // contents
- return false;
-
- while (true) {
- int c1 = is1.read();
- while (shouldIgnoreWhitespace() && isWhitespace(c1))
- c1 = is1.read();
- int c2 = is2.read();
- while (shouldIgnoreWhitespace() && isWhitespace(c2))
- c2 = is2.read();
- if (c1 == -1 && c2 == -1)
- return true;
- if (c1 != c2)
- break;
-
- }
- } catch (IOException ex) {
- } finally {
- try {
- try {
- if (is1 != null) {
- is1.close();
- }
- } finally {
- if (is2 != null) {
- is2.close();
- }
- }
- } catch (IOException e) {
- // Ignore
- }
- }
- return false;
- }
-
- private boolean isWhitespace(int c) {
- if (c == -1)
- return false;
- return Character.isWhitespace((char) c);
- }
-
- private InputStream getContents(Object resource, IProgressMonitor monitor) throws TeamException {
- try {
- if (resource instanceof IFile) {
- return new BufferedInputStream(((IFile) resource).getContents());
- } else if(resource instanceof IResourceVariant) {
- IResourceVariant remote = (IResourceVariant)resource;
- if (!remote.isContainer()) {
- return new BufferedInputStream(remote.getStorage(monitor).getContents());
- }
- }
- return null;
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
deleted file mode 100644
index cdb8019e1..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.*;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.core.*;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * 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.
- */
-public class SubscriberEventHandler extends BackgroundEventHandler {
- // The set that receives notification when the resource synchronization state
- // has been calculated by the job.
- private SyncSetInputFromSubscriber syncSetInput;
-
- // Changes accumulated by the event handler
- private List resultCache = new ArrayList();
-
- private boolean started = false;
-
- private IProgressMonitor progressGroup;
-
- private int ticks;
-
- /**
- * Internal resource synchronization event. Can contain a result.
- */
- class SubscriberEvent extends Event{
- static final int REMOVAL = 1;
- static final int CHANGE = 2;
- static final int INITIALIZE = 3;
- SyncInfo result;
-
- SubscriberEvent(IResource resource, int type, int depth) {
- super(resource, type, depth);
- }
- public SubscriberEvent(
- IResource resource,
- int type,
- int depth,
- SyncInfo result) {
- this(resource, type, depth);
- this.result = result;
- }
- public SyncInfo getResult() {
- return result;
- }
- protected String getTypeString() {
- switch (getType()) {
- case REMOVAL :
- return "REMOVAL"; //$NON-NLS-1$
- case CHANGE :
- return "CHANGE"; //$NON-NLS-1$
- case INITIALIZE :
- return "INITIALIZE"; //$NON-NLS-1$
- default :
- return "INVALID"; //$NON-NLS-1$
- }
- }
- }
-
- /**
- * This is a special event used to reset and connect sync sets.
- * The preemtive flag is used to indicate that the runnable should take
- * the highest priority and thus be placed on the front of the queue
- * and be processed as soon as possible, preemting any event that is currently
- * being processed. The curent event will continue processing once the
- * high priority event has been processed
- */
- public class RunnableEvent extends Event {
- static final int RUNNABLE = 1000;
- private IWorkspaceRunnable runnable;
- private boolean preemtive;
- public RunnableEvent(IWorkspaceRunnable runnable, boolean preemtive) {
- super(ResourcesPlugin.getWorkspace().getRoot(), RUNNABLE, IResource.DEPTH_ZERO);
- this.runnable = runnable;
- this.preemtive = preemtive;
- }
- public void run(IProgressMonitor monitor) throws CoreException {
- runnable.run(monitor);
- }
- public boolean isPreemtive() {
- return preemtive;
- }
- }
-
- /**
- * 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(Subscriber subscriber) {
- super(
- Policy.bind("SubscriberEventHandler.jobName", subscriber.getName()), //$NON-NLS-1$
- Policy.bind("SubscriberEventHandler.errors", subscriber.getName())); //$NON-NLS-1$
- this.syncSetInput = new SyncSetInputFromSubscriber(subscriber, this);
- }
-
- /**
- * Start the event handler by queuing events to prime the sync set input with the out-of-sync
- * resources of the subscriber.
- */
- public synchronized void start() {
- // Set the started flag to enable event queueing.
- // We are gaurenteed to be the first since this method is synchronized.
- started = true;
- reset(syncSetInput.getSubscriber().roots(), SubscriberEvent.INITIALIZE);
- }
-
- protected synchronized void queueEvent(Event event, boolean front) {
- // Only post events if the handler is started
- if (started) {
- super.queueEvent(event, front);
- }
- }
- /**
- * Schedule the job or process the events now.
- */
- public void schedule() {
- Job job = getEventHandlerJob();
- if(progressGroup != null) {
- job.setSystem(false);
- job.setProgressGroup(progressGroup, ticks);
- } else {
- job.setSystem(true);
- }
- getEventHandlerJob().schedule();
- }
-
- /**
- * Initialize all resources for the subscriber associated with the set. This will basically recalculate
- * all synchronization information for the subscriber.
- * <p>
- * This method is sycnrhonized with the queueEvent method to ensure that the two events
- * queued by this method are back-to-back
- */
- public synchronized void reset(IResource[] roots) {
- if (roots == null) {
- roots = syncSetInput.getSubscriber().roots();
- }
- // First, reset the sync set input to clear the sync set
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- syncSetInput.reset(monitor);
- }
- }, false /* keep ordering the same */);
- // Then, prime the set from the subscriber
- reset(roots, SubscriberEvent.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 SubscriberEvent(resource, SubscriberEvent.CHANGE, depth), false);
- }
-
- /**
- * 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 SubscriberEvent(resource, SubscriberEvent.REMOVAL, IResource.DEPTH_INFINITE), false);
- }
-
- /**
- * 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) {
-
- // handle any preemtive events before continuing
- handlePreemptiveEvents(monitor);
-
- if (resource.getType() != IResource.FILE
- && depth != IResource.DEPTH_ZERO) {
- try {
- IResource[] members =
- syncSetInput.getSubscriber().members(resource);
- for (int i = 0; i < members.length; i++) {
- collect(
- members[i],
- depth == IResource.DEPTH_INFINITE
- ? IResource.DEPTH_INFINITE
- : IResource.DEPTH_ZERO,
- monitor);
- }
- } catch (TeamException e) {
- handleException(e, resource, ITeamStatus.SYNC_INFO_SET_ERROR, Policy.bind("SubscriberEventHandler.8", resource.getFullPath().toString(), e.getMessage())); //$NON-NLS-1$
- }
- }
-
- monitor.subTask(Policy.bind("SubscriberEventHandler.2", resource.getFullPath().toString())); //$NON-NLS-1$
- try {
- SyncInfo info = syncSetInput.getSubscriber().getSyncInfo(resource);
- // resource is no longer under the subscriber control
- if (info == null) {
- resultCache.add(
- new SubscriberEvent(resource, SubscriberEvent.REMOVAL, IResource.DEPTH_ZERO));
- } else {
- resultCache.add(
- new SubscriberEvent(resource, SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, info));
- }
- handlePendingDispatch(monitor);
- } catch (TeamException e) {
- handleException(e, resource, ITeamStatus.RESOURCE_SYNC_INFO_ERROR, Policy.bind("SubscriberEventHandler.9", resource.getFullPath().toString(), e.getMessage())); //$NON-NLS-1$
- }
- monitor.worked(1);
- }
-
- private void handlePendingDispatch(IProgressMonitor monitor) {
- if (isReadyForDispatch(false /*don't wait if queue is empty*/)) {
- dispatchEvents(Policy.subMonitorFor(monitor, 5));
- eventsDispatched();
- }
- }
-
- /*
- * Handle the exception by returning it as a status from the job but also by
- * dispatching it to the sync set input so any down stream views can react
- * accordingly.
- */
- private void handleException(CoreException e, IResource resource, int code, String message) {
- handleException(e);
- syncSetInput.handleError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, code, message, e, resource));
- }
-
- /**
- * 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 void collectAll(
- IResource resource,
- int depth,
- IProgressMonitor monitor) {
-
-
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- try {
-
- // Create a monitor that will handle preemptions and dispatch if required
- IProgressMonitor collectionMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN) {
- public void subTask(String name) {
- handlePreemptiveEvents(this);
- handlePendingDispatch(this);
- super.subTask(name);
- }
- public void worked(int work) {
- handlePreemptiveEvents(this);
- handlePendingDispatch(this);
- super.worked(work);
- }
- };
-
- // Create a sync set that queues up resources and errors for dispatch
- SyncInfoSet collectionSet = new SyncInfoSet() {
- public void add(SyncInfo info) {
- super.add(info);
- resultCache.add(
- new SubscriberEvent(info.getLocal(), SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, info));
- }
- public void addError(ITeamStatus status) {
- super.addError(status);
- TeamPlugin.getPlugin().getLog().log(status);
- syncSetInput.handleError(status);
- }
- public void remove(IResource resource) {
- super.remove(resource);
- resultCache.add(
- new SubscriberEvent(resource, SubscriberEvent.REMOVAL, IResource.DEPTH_ZERO));
- }
- };
-
- syncSetInput.getSubscriber().collectOutOfSync(new IResource[] { resource }, depth, collectionSet, collectionMonitor);
-
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Feed the given events to the set. The appropriate method on the set is called
- * for each event type.
- * @param events
- */
- private void dispatchEvents(SubscriberEvent[] events, IProgressMonitor monitor) {
- // this will batch the following set changes until endInput is called.
- try {
- syncSetInput.getSyncSet().beginInput();
- for (int i = 0; i < events.length; i++) {
- SubscriberEvent event = events[i];
- switch (event.getType()) {
- case SubscriberEvent.CHANGE :
- syncSetInput.collect(event.getResult(), monitor);
- break;
- case SubscriberEvent.REMOVAL :
- syncSetInput.getSyncSet().remove(event.getResource(), event.getDepth());
- break;
- }
- }
- } finally {
- syncSetInput.getSyncSet().endInput(monitor);
- }
- }
-
- /**
- * 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(IResource[] roots, int type) {
- IResource[] resources = roots;
- for (int i = 0; i < resources.length; i++) {
- queueEvent(new SubscriberEvent(resources[i], type, IResource.DEPTH_INFINITE), false);
- }
- }
-
- protected void processEvent(Event event, IProgressMonitor monitor) {
- try {
- // Cancellation is dangerous because this will leave the sync info in a bad state.
- // Purposely not checking -
- int type = event.getType();
- switch (type) {
- case RunnableEvent.RUNNABLE :
- executeRunnable(event, monitor);
- break;
- case SubscriberEvent.REMOVAL :
- resultCache.add(event);
- break;
- case SubscriberEvent.CHANGE :
- collect(
- event.getResource(),
- event.getDepth(),
- monitor);
- break;
- case SubscriberEvent.INITIALIZE :
- getEventHandlerJob().setSystem(false);
- monitor.subTask(Policy.bind("SubscriberEventHandler.2", event.getResource().getFullPath().toString())); //$NON-NLS-1$
- collectAll(
- event.getResource(),
- event.getDepth(),
- Policy.subMonitorFor(monitor, 64));
- break;
- }
- } catch (RuntimeException e) {
- // handle the exception and keep processing
- handleException(new TeamException(Policy.bind("SubscriberEventHandler.10"), e), event.getResource(), ITeamStatus.SYNC_INFO_SET_ERROR, Policy.bind("SubscriberEventHandler.11", event.getResource().getFullPath().toString(), e.getMessage())); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /*
- * Execute the RunnableEvent
- */
- private void executeRunnable(Event event, IProgressMonitor monitor) {
- // Dispatch any queued results to clear pending output events
- dispatchEvents(Policy.subMonitorFor(monitor, 1));
- eventsDispatched();
- try {
- ((RunnableEvent)event).run(Policy.subMonitorFor(monitor, 1));
- } catch (CoreException e) {
- handleException(e, event.getResource(), ITeamStatus.SYNC_INFO_SET_ERROR, e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.BackgroundEventHandler#dispatchEvents()
- */
- protected void dispatchEvents(IProgressMonitor monitor) {
- if (!resultCache.isEmpty()) {
- dispatchEvents((SubscriberEvent[]) resultCache.toArray(new SubscriberEvent[resultCache.size()]), monitor);
- resultCache.clear();
- }
- }
-
- /**
- * Queue up the given runnable in an event to be processed by this job
- * @param runnable the runnable to be run by the handler
- */
- public void run(IWorkspaceRunnable runnable, boolean frontOnQueue) {
- queueEvent(new RunnableEvent(runnable, frontOnQueue), frontOnQueue);
- }
-
- /**
- * Return the sync set input that was created by this event handler
- * @return
- */
- public SyncSetInputFromSubscriber getSyncSetInput() {
- return syncSetInput;
- }
-
- public void setProgressGroupHint(IProgressMonitor progressGroup, int ticks) {
- this.progressGroup = progressGroup;
- this.ticks = ticks;
- }
-
- /**
- * @return Returns the started.
- */
- protected boolean isStarted() {
- return started;
- }
-
- private void handlePreemptiveEvents(IProgressMonitor monitor) {
- Event event = peek();
- if (event instanceof RunnableEvent && ((RunnableEvent)event).isPreemtive()) {
- executeRunnable(nextElement(), monitor);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java
deleted file mode 100644
index 99fd3ff20..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * The <code>SubscriberSyncInfoSet</code> is a <code>SyncInfoSet</code> that provides the ability to add,
- * remove and change <code>SyncInfo</code> and fires change event notifications to registered listeners.
- * It also provides the ability
- * to batch changes in a single change notification as well as optimizations for sync info retrieval.
- *
- * This class uses synchronized methods and synchronized blocks to protect internal data structures during both access
- * and modify operations and uses an <code>ILock</code> to make modification operations thread-safe. The events
- * are fired while this lock is held so clients responding to these events should not obtain their own internal locks
- * while processing change events.
- *
- * TODO: Override modification methods to enforce use with handler
- *
- */
-public class SubscriberSyncInfoSet extends SyncInfoTree {
-
- protected SubscriberEventHandler handler;
-
- public SubscriberSyncInfoSet(SubscriberEventHandler handler) {
- this.handler = handler;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoSet#connect(org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void connect(ISyncInfoSetChangeListener listener, IProgressMonitor monitor) {
- if (handler == null) {
- super.connect(listener, monitor);
- } else {
- connect(listener);
- }
- }
-
- /**
- * Variation of connect that does not need progress and does not throw an exception.
- * Progress is provided by the background event handler and errors are passed through
- * the chain to the view.
- * @param listener
- */
- public void connect(final ISyncInfoSetChangeListener listener) {
- if (handler == null) {
- // Should only use this connect if the set has a handler
- throw new UnsupportedOperationException();
- } else {
- handler.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- try {
- beginInput();
- monitor.beginTask(null, 100);
- removeSyncSetChangedListener(listener);
- addSyncSetChangedListener(listener);
- listener.syncInfoSetReset(SubscriberSyncInfoSet.this, Policy.subMonitorFor(monitor, 95));
- } finally {
- endInput(Policy.subMonitorFor(monitor, 5));
- monitor.done();
- }
- }
- }, true /* high priority */);
- }
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java
deleted file mode 100644
index 7372b400f..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/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.core.subscribers;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.team.core.synchronize.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) == kind) {
- count += ((Long)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.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java
deleted file mode 100644
index 5cb06dd60..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.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.core.subscribers;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-
-public class SyncInfoTreeChangeEvent extends SyncSetChangedEvent implements ISyncInfoTreeChangeEvent {
-
- private Set removedSubtrees = new HashSet();
- private Set addedSubtrees = new HashSet();
-
- public SyncInfoTreeChangeEvent(SyncInfoSet set) {
- super(set);
- }
-
- public void removedSubtreeRoot(IResource root) {
- if (addedSubtrees.contains(root)) {
- // The root was added and removed which is a no-op
- addedSubtrees.remove(root);
- } else if (isDescendantOfAddedRoot(root)) {
- // Nothing needs to be done since no listeners ever knew about the 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 = removedSubtrees.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;
- }
- }
- removedSubtrees.add(root);
- }
- }
-
- private boolean isParent(IResource root, IResource element) {
- return root.getFullPath().isPrefixOf(element.getFullPath());
- }
-
- public void addedSubtreeRoot(IResource parent) {
- if (removedSubtrees.contains(parent)) {
- // The root was re-added. Just removing the removedRoot
- // may not give the proper event.
- // Since we can't be sure, just force a reset.
- reset();
- } else {
- // only add the root if their isn't a higher root in the list already
- if (!isDescendantOfAddedRoot(parent)) {
- addedSubtrees.add(parent);
- }
- }
- }
-
- private boolean isDescendantOfAddedRoot(IResource resource) {
- for (Iterator iter = addedSubtrees.iterator(); iter.hasNext();) {
- IResource root = (IResource) iter.next();
- if (isParent(root, resource)) {
- // There is a higher added root already in the list
- return true;
- }
- }
- return false;
- }
-
- public IResource[] getAddedSubtreeRoots() {
- return (IResource[]) addedSubtrees.toArray(new IResource[addedSubtrees.size()]);
- }
-
- public IResource[] getRemovedSubtreeRoots() {
- return (IResource[]) removedSubtrees.toArray(new IResource[removedSubtrees.size()]);
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && removedSubtrees.isEmpty() && addedSubtrees.isEmpty();
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
deleted file mode 100644
index ca632a6b0..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * WorkingSet filter for a SyncSet.
- */
-public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
-
- private IResource[] resources;
-
- /* (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 (isEmpty()) 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
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource setResource = resources[i];
- if (isParent(setResource, resource)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isParent(IResource parent, IResource child) {
- return (parent.getFullPath().isPrefixOf(child.getFullPath()));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.views.SyncSetInputFromSubscriber#getRoots()
- */
- public IResource[] getRoots(Subscriber subscriber) {
- IResource[] roots = subscriber.roots();
- if (isEmpty()) 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(Subscriber subscriber, IResource resource) {
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource setResource = resources[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
- TeamPlugin.log(e);
- result.add(setResource);
- }
- } else if (isParent(setResource, resource)) {
- result.add(resource);
- }
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- public void setWorkingSet(IResource[] resources) {
- this.resources = resources;
- }
-
- public IResource[] getWorkingSet() {
- return this.resources;
- }
-
- private boolean isEmpty() {
- return resources == null || resources.length == 0;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetChangedEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetChangedEvent.java
deleted file mode 100644
index 1581ba012..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetChangedEvent.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.core.subscribers;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.*;
-
-/**
- * This event keeps track of the changes in a sync set
- */
-public class SyncSetChangedEvent implements ISyncInfoSetChangeEvent {
-
- private SyncInfoSet set;
-
- // List that accumulate changes
- // SyncInfo
- private Set changedResources = new HashSet();
- private Set removedResources = new HashSet();
- private Set addedResources = new HashSet();
-
- private boolean reset = false;
-
- private boolean errorAdded;
-
- private List errors = new ArrayList();
-
- public SyncSetChangedEvent(SyncInfoSet set) {
- super();
- this.set = set;
- }
-
- public void added(SyncInfo info) {
- if (removedResources.contains(info.getLocal())) {
- // A removal followed by an addition is treated as a change
- removedResources.remove(info.getLocal());
- changed(info);
- } else {
- addedResources.add(info);
- }
- }
-
- public void removed(IResource resource, SyncInfo info) {
- if (changedResources.contains(info)) {
- // No use in reporting the change since it has subsequently been removed
- changedResources.remove(info);
- } else if (addedResources.contains(info)) {
- // An addition followed by a removal can be dropped
- addedResources.remove(info);
- return;
- }
- removedResources.add(resource);
- }
-
- public void changed(SyncInfo info) {
- changedResources.add(info);
- }
-
- public SyncInfo[] getAddedResources() {
- return (SyncInfo[]) addedResources.toArray(new SyncInfo[addedResources.size()]);
- }
-
- public SyncInfo[] getChangedResources() {
- return (SyncInfo[]) changedResources.toArray(new SyncInfo[changedResources.size()]);
- }
-
- public IResource[] getRemovedResources() {
- return (IResource[]) removedResources.toArray(new IResource[removedResources.size()]);
- }
-
- public SyncInfoSet getSet() {
- return set;
- }
-
- public void reset() {
- reset = true;
- }
-
- public boolean isReset() {
- return reset;
- }
-
- public boolean isEmpty() {
- return changedResources.isEmpty() && removedResources.isEmpty() && addedResources.isEmpty() && errors.isEmpty();
- }
-
- public void errorOccurred(ITeamStatus status) {
- errors.add(status);
- }
-
- public ITeamStatus[] getErrors() {
- return (ITeamStatus[]) errors.toArray(new ITeamStatus[errors.size()]);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java
deleted file mode 100644
index 3935cffe8..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * This is the superclass for all SyncSet input providers
- */
-public abstract class SyncSetInput {
-
- private SubscriberSyncInfoSet syncSet;
- private SyncInfoFilter filter = new FastSyncInfoFilter();
-
- public SyncSetInput(SubscriberEventHandler handler) {
- syncSet = new SubscriberSyncInfoSet(handler);
- }
-
- public SubscriberSyncInfoSet 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 {
- syncSet.beginInput();
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- syncSet.clear();
- fetchInput(Policy.subMonitorFor(monitor, 90));
- } finally {
- syncSet.endInput(Policy.subMonitorFor(monitor, 10));
- monitor.done();
- }
- }
-
- /**
- * Collect the change in the provided sync info.
- */
- protected void collect(SyncInfo info, IProgressMonitor monitor) {
- boolean isOutOfSync = filter.select(info, monitor);
- SyncInfo oldInfo = syncSet.getSyncInfo(info.getLocal());
- boolean wasOutOfSync = oldInfo != null;
- if (isOutOfSync) {
- 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.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java
deleted file mode 100644
index 19f03d931..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-
-/**
- * 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 Subscriber subscriber;
-
- public SyncSetInputFromSubscriber(Subscriber subscriber, SubscriberEventHandler handler) {
- super(handler);
- this.subscriber = subscriber;
- }
-
- public void disconnect() {
- }
-
- public Subscriber 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.
- }
-
- /**
- * Handle an error that occurred while populating the receiver's set.
- * The <code>ITeamStatus</code> includes the resource for which the
- * error occurred.
- * This error is propogated to any set listeners.
- * @param status the error status
- */
- public void handleError(ITeamStatus status) {
- getSyncSet().addError(status);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
deleted file mode 100644
index 3d84b4532..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.Policy;
-
-/**
- * Ths class uses the contents of one sync set as the input of another.
- */
-public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSetChangeListener {
-
- SubscriberSyncInfoSet inputSyncSet;
-
- public SyncSetInputFromSyncSet(SubscriberSyncInfoSet set, SubscriberEventHandler handler) {
- super(handler);
- this.inputSyncSet = set;
- inputSyncSet.addSyncSetChangedListener(this);
- }
-
- public SyncInfoSet 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) {
- if (inputSyncSet == null) return;
- SyncInfo[] infos = inputSyncSet.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- collect(infos[i], monitor);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent)
- */
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- SyncInfoSet syncSet = getSyncSet();
- try {
- syncSet.beginInput();
- monitor.beginTask(null, 105);
- syncSetChanged(event.getChangedResources(), Policy.subMonitorFor(monitor, 50));
- syncSetChanged(event.getAddedResources(), Policy.subMonitorFor(monitor, 50));
- remove(event.getRemovedResources());
- } finally {
- syncSet.endInput(Policy.subMonitorFor(monitor, 5));
- }
- }
-
- private void syncSetChanged(SyncInfo[] infos, IProgressMonitor monitor) {
- for (int i = 0; i < infos.length; i++) {
- collect(infos[i], monitor);
- }
- }
-
- private void remove(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- remove(resources[i]);
- }
- }
-
- public void reset() {
- inputSyncSet.connect(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- SyncInfoSet syncSet = getSyncSet();
- try {
- syncSet.beginInput();
- monitor.beginTask(null, 100);
- syncSet.clear();
- fetchInput(Policy.subMonitorFor(monitor, 95));
- } finally {
- syncSet.endInput(Policy.subMonitorFor(monitor, 5));
- monitor.done();
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetError(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- SubscriberSyncInfoSet syncSet = getSyncSet();
- try {
- syncSet.beginInput();
- for (int i = 0; i < errors.length; i++) {
- ITeamStatus status = errors[i];
- syncSet.addError(status);
- }
- } finally {
- syncSet.endInput(monitor);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetSyncSetInput.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetSyncSetInput.java
deleted file mode 100644
index 7cb0fdbcb..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetSyncSetInput.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.core.subscribers;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.subscribers.Subscriber;
-
-public class WorkingSetSyncSetInput extends SyncSetInputFromSyncSet {
-
- private SyncInfoWorkingSetFilter workingSetFilter = new SyncInfoWorkingSetFilter();
-
- public WorkingSetSyncSetInput(SubscriberSyncInfoSet set, SubscriberEventHandler handler) {
- super(set, handler);
- setFilter(workingSetFilter);
- }
-
- public void setWorkingSet(IResource[] resources) {
- workingSetFilter.setWorkingSet(resources);
- }
-
- public IResource[] getWorkingSet() {
- return workingSetFilter.getWorkingSet();
- }
-
- public IResource[] roots(Subscriber subscriber) {
- return workingSetFilter.getRoots(subscriber);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/AbstractResourceVariantTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/AbstractResourceVariantTree.java
deleted file mode 100644
index 09a9e5387..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/AbstractResourceVariantTree.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers.caches;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.core.Policy;
-
-
-/**
- * An implemenation of <code>IResourceVariantTree</code> that provides the logic for
- * refreshing the tree and collecting the results so they can be cached locally.
- * This class does not perform the caching but relies on subclasses to do that by
- * overriding the <code>setVariant</code> method. The subclass
- * {@link ResourceVariantTree} does provide caching.
- *
- * @see IResourceVariantTree
- * @see ResourceVariantTree
- *
- * @since 3.0
- */
-public abstract class AbstractResourceVariantTree implements IResourceVariantTree {
-
- /**
- * Refreshes the resource variant tree for the specified resources and possibly their descendants,
- * depending on the depth. The default implementation of this method invokes
- * <code>refresh(IResource, int, IProgressMonitor)</code> for each resource.
- * Subclasses may override but should either invoke the above mentioned refresh or
- * <code>collectChanges</code> in order to reconcile the resource variant tree.
- * @param resources the resources whose variants should be refreshed
- * @param depth the depth of the refresh (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @param monitor a progress monitor
- * @return the array of resources whose corresponding varianst have changed
- * @throws TeamException
- */
- public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
- List changedResources = new ArrayList();
- monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IResource[] changed = refresh(resource, depth, Policy.subMonitorFor(monitor, 100));
- changedResources.addAll(Arrays.asList(changed));
- }
- monitor.done();
- if (changedResources == null) return new IResource[0];
- return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
- }
-
- /**
- * Helper method invoked from <code>refresh(IResource[], int, IProgressMonitor monitor)</code>
- * for each resource. The default implementation performs the following steps:
- * <ol>
- * <li>obtaine the scheduling rule for the resource
- * as returned from <code>getSchedulingRule(IResource)</code>.
- * <li>get the resource variant handle corresponding to the local resource by calling
- * <code>getRemoteTree</code>.
- * <li>pass the local resource and the resource variant handle to <code>collectChanges</code>
- * </ol>
- * Subclasses may override but should perform roughly the same steps.
- * @param resource the resoure being refreshed
- * @param depth the depth of the refresh (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @param monitor a progress monitor
- * @return the resource's whose variants have changed
- * @throws TeamException
- */
- protected IResource[] refresh(IResource resource, int depth, IProgressMonitor monitor) throws TeamException {
- IResource[] changedResources = null;
- monitor.beginTask(null, 100);
- ISchedulingRule rule = getSchedulingRule(resource);
- try {
- Platform.getJobManager().beginRule(rule, monitor);
- if (!resource.getProject().isAccessible()) {
- // The project is closed so silently skip it
- return new IResource[0];
- }
-
- monitor.setTaskName(Policy.bind("SynchronizationCacheRefreshOperation.0", resource.getFullPath().makeRelative().toString())); //$NON-NLS-1$
-
- // build the remote tree only if an initial tree hasn't been provided
- IResourceVariant tree = fetchVariant(resource, depth, Policy.subMonitorFor(monitor, 70));
-
- // update the known remote handles
- IProgressMonitor sub = Policy.infiniteSubMonitorFor(monitor, 30);
- try {
- sub.beginTask(null, 64);
- changedResources = collectChanges(resource, tree, depth, sub);
- } finally {
- sub.done();
- }
- } finally {
- Platform.getJobManager().endRule(rule);
- monitor.done();
- }
- if (changedResources == null) return new IResource[0];
- return changedResources;
- }
-
- /**
- * Return the scheduling rule that should be obtained for the given resource.
- * This method is invoked from <code>refresh(IResource, int, IProgressMonitor)</code>.
- * By default, the resource's project is returned. Subclasses may override.
- * @param resource the resource being refreshed
- * @return a scheduling rule or <code>null</code>
- */
- protected ISchedulingRule getSchedulingRule(IResource resource) {
- return resource.getProject();
- }
-
- /**
- * Collect the changes in the remote tree to the specified depth.
- * @param local the local resource being refreshed
- * @param remote the corresponding resource variant
- * @param depth the depth of the refresh (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @param monitor a progress monitor
- * @return the resource's whose variants have changed
- * @throws TeamException
- */
- protected IResource[] collectChanges(IResource local, IResourceVariant remote, int depth, IProgressMonitor monitor) throws TeamException {
- List changedResources = new ArrayList();
- collectChanges(local, remote, changedResources, depth, monitor);
- return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
- }
-
- /**
- * Fetch the members of the given resource variant handle. This method may
- * return members that were fetched when <code>getRemoteTree</code> was called or
- * may fetch the children directly.
- * @param variant the resource variant
- * @param progress a progress monitor
- * @return the members of the resource variant.
- */
- protected abstract IResourceVariant[] fetchMembers(IResourceVariant variant, IProgressMonitor progress) throws TeamException;
-
- /**
- * Fetch the resource variant corresponding to the given resource.
- * The depth
- * parameter indicates the depth of the refresh operation and also indicates the
- * depth to which the resource variant's desendants will be traversed.
- * This method may prefetch the descendants to the provided depth
- * or may just return the variant handle corresponding to the given
- * local resource, in which case
- * the descendant variants will be fetched by <code>fecthMembers(IResourceVariant, IProgressMonitor)</code>.
- * @param resource the local resource
- * @param depth the depth of the refresh (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @param monitor a progress monitor
- * @return the resource variant corresponding to the given local resource
- */
- protected abstract IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException;
- /**
- * Method that is invoked during collection to let subclasses know which members
- * were collected for the given resource. Implementors should purge any cached
- * state for children of the local resource that are no longer members. Any such resources
- * should be returned.
- * @param local the local resource
- * @param members the collected members
- * @return any resources that were previously collected whose state has been flushed
- */
- protected IResource[] collectedMembers(IResource local, IResource[] members) throws TeamException {
- return new IResource[0];
- }
-
- /**
- * Set the variant associated with the local resource to the newly fetched resource
- * variant.
- * This method is invoked during change collection and should return whether
- * the variant associated with the lcoal resource has changed
- * @param local the local resource
- * @param remote the newly fetched resoure variant
- * @return <code>true</code> if the resource variant changed
- * @throws TeamException
- */
- protected abstract boolean setVariant(IResource local, IResourceVariant remote) throws TeamException;
-
- private void collectChanges(IResource local, IResourceVariant remote, Collection changedResources, int depth, IProgressMonitor monitor) throws TeamException {
- boolean changed = setVariant(local, remote);
- if (changed) {
- changedResources.add(local);
- }
- if (depth == IResource.DEPTH_ZERO) return;
- Map children = mergedMembers(local, remote, monitor);
- for (Iterator it = children.keySet().iterator(); it.hasNext();) {
- IResource localChild = (IResource) it.next();
- IResourceVariant remoteChild = (IResourceVariant)children.get(localChild);
- collectChanges(localChild, remoteChild, changedResources,
- depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO,
- monitor);
- }
-
- IResource[] cleared = collectedMembers(local, (IResource[]) children.keySet().toArray(new IResource[children.keySet().size()]));
- changedResources.addAll(Arrays.asList(cleared));
- }
-
- private Map mergedMembers(IResource local, IResourceVariant remote, IProgressMonitor progress) throws TeamException {
-
- // {IResource -> IResourceVariant}
- Map mergedResources = new HashMap();
-
- IResourceVariant[] remoteChildren;
- if (remote == null) {
- remoteChildren = new IResourceVariant[0];
- } else {
- remoteChildren = fetchMembers(remote, progress);
- }
-
-
- IResource[] localChildren = members(local);
-
- if (remoteChildren.length > 0 || localChildren.length > 0) {
- Set allSet = new HashSet(20);
- Map localSet = null;
- Map remoteSet = null;
-
- if (localChildren.length > 0) {
- localSet = new HashMap(10);
- for (int i = 0; i < localChildren.length; i++) {
- IResource localChild = localChildren[i];
- String name = localChild.getName();
- localSet.put(name, localChild);
- allSet.add(name);
- }
- }
-
- if (remoteChildren.length > 0) {
- remoteSet = new HashMap(10);
- for (int i = 0; i < remoteChildren.length; i++) {
- IResourceVariant remoteChild = remoteChildren[i];
- String name = remoteChild.getName();
- remoteSet.put(name, remoteChild);
- allSet.add(name);
- }
- }
-
- Iterator e = allSet.iterator();
- while (e.hasNext()) {
- String keyChildName = (String) e.next();
-
- if (progress != null) {
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
- // XXX show some progress?
- }
-
- IResource localChild =
- localSet != null ? (IResource) localSet.get(keyChildName) : null;
-
- IResourceVariant remoteChild =
- remoteSet != null ? (IResourceVariant) remoteSet.get(keyChildName) : null;
-
- if (localChild == null) {
- // there has to be a remote resource available if we got this far
- Assert.isTrue(remoteChild != null);
- boolean isContainer = remoteChild.isContainer();
- localChild = getResourceChild(local /* parent */, keyChildName, isContainer);
- }
- mergedResources.put(localChild, remoteChild);
- }
- }
- return mergedResources;
- }
-
- private IResource getResourceChild(IResource parent, String childName, boolean isContainer) {
- if (parent.getType() == IResource.FILE) {
- return null;
- }
- if (isContainer) {
- return ((IContainer) parent).getFolder(new Path(childName));
- } else {
- return ((IContainer) parent).getFile(new Path(childName));
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/DescendantResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/DescendantResourceVariantByteStore.java
deleted file mode 100644
index 0e3e6a79e..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/DescendantResourceVariantByteStore.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers.caches;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-
-/**
- * A <code>ResourceVariantByteStore</code> that optimizes the memory footprint
- * of a remote resource variant tree by only storing those bytes that
- * differ from a base resource variant tree. This class should only be used
- * for cases where the base and remote are on the same line-of-descent.
- * For example, when the remote tree represents the current state of a branch
- * and the base represents the state of the same branch when the local workspace
- * as last refreshed.
- * <p>
- * This class also contains the logic that allows subclasses to determine if
- * bytes stored in the remote tree are on a different line-of-descent than the base.
- * This is necessary because it is possible for the base tree to change in ways that
- * invalidate the stored remote variants. For example, if the local resources are moved
- * from the main trunck to a branch, any cached remote resource variants would be stale.
- *
- * @since 3.0
- */
-public abstract class DescendantResourceVariantByteStore extends ResourceVariantByteStore {
-
- ResourceVariantByteStore baseStore, remoteStore;
-
- public DescendantResourceVariantByteStore(ResourceVariantByteStore baseCache, ResourceVariantByteStore remoteCache) {
- this.baseStore = baseCache;
- this.remoteStore = remoteCache;
- }
-
- /**
- * This method will dispose the remote cache but not the base cache.
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#dispose()
- */
- public void dispose() {
- remoteStore.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#getBytes(org.eclipse.core.resources.IResource)
- */
- public byte[] getBytes(IResource resource) throws TeamException {
- byte[] remoteBytes = remoteStore.getBytes(resource);
- byte[] baseBytes = baseStore.getBytes(resource);
- if (baseBytes == null) {
- // There is no base so use the remote bytes
- return remoteBytes;
- }
- if (remoteBytes == null) {
- if (isVariantKnown(resource)) {
- // The remote is known to not exist
- // TODO: The check for NO_REMOTE does not take into consideration the line-of-descent
- return remoteBytes;
- } else {
- // The remote was either never queried or was the same as the base.
- // In either of these cases, the base bytes are used.
- return baseBytes;
- }
- }
- if (isDescendant(resource, baseBytes, remoteBytes)) {
- // Only use the remote bytes if they are later on the same line-of-descent as the base
- return remoteBytes;
- }
- // Use the base sbytes since the remote bytes must be stale (i.e. are
- // not on the same line-of-descent
- return baseBytes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setBytes(org.eclipse.core.resources.IResource, byte[])
- */
- public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
- byte[] baseBytes = baseStore.getBytes(resource);
- if (baseBytes != null && equals(baseBytes, bytes)) {
- // Remove the existing bytes so the base will be used (thus saving space)
- return remoteStore.flushBytes(resource, IResource.DEPTH_ZERO);
- } else {
- return remoteStore.setBytes(resource, bytes);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#removeBytes(org.eclipse.core.resources.IResource, int)
- */
- public boolean flushBytes(IResource resource, int depth) throws TeamException {
- return remoteStore.flushBytes(resource, depth);
- }
-
- /**
- * Return <code>true</code> if the variant associated with the given local
- * resource has been cached. This method is useful for those cases when
- * there are no bytes for a resource variant and the client wants to
- * know if this means that the remote does exist (i.e. this method returns
- * <code>true</code>) or the remote has not been fetched (i.e. this method returns
- * <code>false</code>).
- * @param resource the local resource
- * @return <code>true</code> if the variant associated with the given local
- * resource has been cached.
- * @throws TeamException
- */
- public abstract boolean isVariantKnown(IResource resource) throws TeamException;
-
- /**
- * This method indicates whether the remote bytes are a later revision or version
- * on the same line-of-descent as the base. A line of descent may be a branch or a fork
- * (depending on the terminology used by the versioing server). If this method returns
- * <code>false</code> then the remote bytes will be ignored by this tree.
- * @param resource the local resource
- * @param baseBytes the base bytes for the local resoource
- * @param remoteBytes the remote bytes for the local resoource
- * @return whether the remote bytes are later on the same line-of-descent as the base bytes
- */
- protected abstract boolean isDescendant(IResource resource, byte[] baseBytes, byte[] remoteBytes) throws TeamException;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setVariantDoesNotExist(org.eclipse.core.resources.IResource)
- */
- public boolean deleteBytes(IResource resource) throws TeamException {
- return remoteStore.deleteBytes(resource);
- }
-
- /**
- * Return the base tree from which the remote is descendant.
- * @return Returns the base tree.
- */
- protected ResourceVariantByteStore getBaseStore() {
- return baseStore;
- }
-
- /**
- * Return the remote tree which contains bytes only for the resource variants
- * that differ from those in the base tree.
- * @return Returns the remote tree.
- */
- protected ResourceVariantByteStore getRemoteStore() {
- return remoteStore;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#members(org.eclipse.core.resources.IResource)
- */
- public IResource[] members(IResource resource) throws TeamException {
- IResource[] remoteMembers = getRemoteStore().members(resource);
- IResource[] baseMembers = getBaseStore().members(resource);
- Set members = new HashSet();
- for (int i = 0; i < remoteMembers.length; i++) {
- members.add(remoteMembers[i]);
- }
- for (int i = 0; i < baseMembers.length; i++) {
- IResource member = baseMembers[i];
- // Add the base only if the remote does not know about it
- // (i.e. hasn't marked it as deleted
- if (!isVariantKnown(member)) {
- members.add(member);
- }
- }
- return (IResource[]) members.toArray(new IResource[members.size()]);
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/IResourceVariantTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/IResourceVariantTree.java
deleted file mode 100644
index 3270c0048..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/IResourceVariantTree.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.core.subscribers.caches;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-
-/**
- * A handle that provides access to locally cached resource variants that
- * represent a resource line-up such as a project version or branch.
- * <p>
- * This interface is not intended to be implemented by clients. However,
- * clients may subclass {@link AbstractResourceVariantTree} or {@link ResourceVariantTree}.
- * </p>
- *
- * @since 3.0
- */
-public interface IResourceVariantTree {
-
- /**
- * Returns the list of root resources for which this tree may have resource
- * variants.
- * @return the list of root resources.
- */
- public abstract IResource[] roots();
-
- /**
- * Returns the members of the local resource that have resource variants in this tree.
- * The members may or may not exist locally. The resource variants corresponding to the
- * memebers can be retrieved using <code>getResourceVariant(IResource)</code>.
- * @param resource the local resource
- * @return the members of the local resource for which this tree contains resource variants
- * @throws TeamException
- */
- public abstract IResource[] members(IResource resource) throws TeamException;
-
- /**
- * Return the resource variant corresponding to the local resource. Return
- * <code>null</code> if there is no variant for the resource.
- * @param resource the local resource
- * @return the resource's variant in this tree
- * @throws TeamException
- */
- public abstract IResourceVariant getResourceVariant(IResource resource) throws TeamException;
-
- /**
- * Return whether the local resource has a variant in this tree.
- * @param resource the local resource
- * @return <code>true</code> if the tree contains a variant for the resource
- * @throws TeamException
- */
- public boolean hasResourceVariant(IResource resource) throws TeamException;
-
- /**
- * Refreshes the resource variant tree for the specified resources and possibly
- * their descendants, depending on the depth.
- * @param resources the resources whose variants should be refreshed
- * @param depth the depth of the refresh (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @param monitor a progress monitor
- * @return the array of resources whose corresponding variants have changed
- * as a result of the refresh
- * @throws TeamException
- */
- public IResource[] refresh(
- IResource[] resources,
- int depth,
- IProgressMonitor monitor) throws TeamException;
-
- /**
- * Flush any variants in the tree for the given resource to the depth
- * specified.
- * @param resource the resource
- * @param depth the flush depth (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- */
- public void flushVariants(IResource resource, int depth) throws TeamException;
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/PersistantResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/PersistantResourceVariantByteStore.java
deleted file mode 100644
index 4c0f94356..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/PersistantResourceVariantByteStore.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers.caches;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Assert;
-
-/**
- * A <code>ResourceVariantByteStore</code> that caches the variant bytes using
- * the <code>org.eclipse.core.resources.ISynchronizer</code> so that
- * the tree is cached accross workbench invocations.
- * <p>
- * This class is not intended to be subclassed by clients
- *
- * @since 3.0
- */
-public class PersistantResourceVariantByteStore extends ResourceVariantByteStore {
-
- private static final byte[] NO_REMOTE = new byte[0];
-
- private QualifiedName syncName;
-
- /**
- * Create a persistant tree that uses the given qualified name
- * as the key in the <code>org.eclipse.core.resources.ISynchronizer</code>.
- * It must be unique and should use the plugin as the local name
- * and a unique id within the plugin as the qualifier name.
- * @param name the key used in the Core synchronizer
- */
- public PersistantResourceVariantByteStore(QualifiedName name) {
- syncName = name;
- getSynchronizer().add(syncName);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#dispose()
- */
- public void dispose() {
- getSynchronizer().remove(getSyncName());
- }
-
- /**
- * Return the qualified name that uniquely identifies this tree.
- * @return the qwualified name that uniquely identifies this tree.
- */
- public QualifiedName getSyncName() {
- return syncName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#getBytes(org.eclipse.core.resources.IResource)
- */
- public byte[] getBytes(IResource resource) throws TeamException {
- byte[] syncBytes = internalGetSyncBytes(resource);
- if (syncBytes != null && equals(syncBytes, NO_REMOTE)) {
- // If it is known that there is no remote, return null
- return null;
- }
- return syncBytes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setBytes(org.eclipse.core.resources.IResource, byte[])
- */
- public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
- Assert.isNotNull(bytes);
- byte[] oldBytes = internalGetSyncBytes(resource);
- if (oldBytes != null && equals(oldBytes, bytes)) return false;
- try {
- getSynchronizer().setSyncInfo(getSyncName(), resource, bytes);
- return true;
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#removeBytes(org.eclipse.core.resources.IResource, int)
- */
- public boolean flushBytes(IResource resource, int depth) throws TeamException {
- if (resource.exists() || resource.isPhantom()) {
- try {
- if (depth != IResource.DEPTH_ZERO || internalGetSyncBytes(resource) != null) {
- getSynchronizer().flushSyncInfo(getSyncName(), resource, depth);
- return true;
- }
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#isVariantKnown(org.eclipse.core.resources.IResource)
- */
- public boolean isVariantKnown(IResource resource) throws TeamException {
- return internalGetSyncBytes(resource) != null;
- }
-
- /**
- * This method should be invoked by a client to indicate that it is known that
- * there is no remote resource associated with the local resource. After this method
- * is invoked, <code>isRemoteKnown(resource)</code> will return <code>true</code> and
- * <code>getSyncBytes(resource)</code> will return <code>null</code>.
- * @return <code>true</code> if this changes the remote sync bytes
- */
- public boolean deleteBytes(IResource resource) throws TeamException {
- return setBytes(resource, NO_REMOTE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#members(org.eclipse.core.resources.IResource)
- */
- public IResource[] members(IResource resource) throws TeamException {
- if(resource.getType() == IResource.FILE) {
- return new IResource[0];
- }
- try {
- // Filter and return only resources that have sync bytes in the cache.
- IResource[] members = ((IContainer)resource).members(true /* include phantoms */);
- List filteredMembers = new ArrayList(members.length);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
- if(getBytes(member) != null) {
- filteredMembers.add(member);
- }
- }
- return (IResource[]) filteredMembers.toArray(new IResource[filteredMembers.size()]);
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
-
- private ISynchronizer getSynchronizer() {
- return ResourcesPlugin.getWorkspace().getSynchronizer();
- }
-
- private byte[] internalGetSyncBytes(IResource resource) throws TeamException {
- try {
- return getSynchronizer().getSyncInfo(getSyncName(), resource);
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantByteStore.java
deleted file mode 100644
index 8d2d8e8e5..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantByteStore.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers.caches;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-
-/**
- * The purpose of a <code>ResourceVariantByteStore</code> is to support the caching of
- * the synchronization bytes for the resource variants that represent
- * a resource line-up of interest such as a version, baseline or branch. The
- * cache stores bytes in order to minimize the memory footprint of the tree. It is the
- * reponsibility of the client of this API to cache enough bytes to meaningfully identify
- * a resource variant (and possibly create an {@link IResourceVariant} handle from them).
- * <p>
- * The bytes for
- * a resource variant are accessed using the local handle that corresponds to the
- * resource variant (using the <code>getSyncInfo</code> method).
- * The potential children of a resource variant are also accessed
- * by using the local handle that corresponds to the resource variant
- * (using the <code>members</code> method).
- *
- * @since 3.0
- */
-public abstract class ResourceVariantByteStore {
-
- /**
- * Dispose of any cached sync bytes when this cache is no longer needed.
- */
- public abstract void dispose();
-
- /**
- * Return the bytes for the variant corresponding the given local resource.
- * A return value of <code>null</code> means that no bytes have been stored
- * for the resource variant. It is up to the client to determine whether
- * this means that the resource variant does not exist or that it has not been
- * fetched or otherwise determined yet.
- * @param resource the local resource
- * @return the bytes that represent the resource's variant
- * @throws TeamException
- */
- public abstract byte[] getBytes(IResource resource) throws TeamException;
-
- /**
- * Set the bytes for the variant corresponding the given local resource.
- * The bytes should never be <code>null</code>. If it is known that the remote
- * does not exist, <code>deleteBytes(IResource)</code> should be used instead.
- * If the sync bytes for the remote are stale and should be removed,
- * <code>flushBytes(IResouce, int)</code> should be called.
- * @param resource the local resource
- * @param bytes the bytes that represent the resource's variant
- * @return <code>true</code> if the bytes changed
- * @throws TeamException
- */
- public abstract boolean setBytes(IResource resource, byte[] bytes) throws TeamException;
-
- /**
- * Remove the bytes from the tree for the resource variants corresponding to the
- * given local resource and its descendants to the given depth.
- * After the bytes are removed, <code>getBytes(resource)</code> will
- * return <code>null</code> for the affected resources.
- * @param resource the local resource
- * @param depth the depth of the operation (one of <code>IResource.DEPTH_ZERO</code>,
- * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
- * @return <code>true</code> if there were bytes present which were removed
- * @throws TeamException
- */
- public abstract boolean flushBytes(IResource resource, int depth) throws TeamException;
-
- /**
- * Method called to indicate that it is known that there is no variant associated
- * with the local resource. Subclasses may handle this information in different ways.
- * The <code>flush(IResource, int)</code> method should be used in the cases
- * where a client wishes to remove bytes for other reason.
- * @param resource the local resource
- * @return <code>true</code> if this changes the bytes for the variant
- */
- public abstract boolean deleteBytes(IResource resource) throws TeamException;
-
- /**
- * Return the children of the given resource that have resource variants in this tree.
- * @param resource the parent resource
- * @return the members who have resource variants in this tree.
- */
- public abstract IResource[] members(IResource resource) throws TeamException;
-
- /**
- * Helper method to compare two byte arrays for equality
- * @param syncBytes1 the first byte array or <code>null</code>
- * @param syncBytes2 the second byte array or <code>null</code>
- * @return whetehr the two arrays are equal (i.e. same content)
- */
- protected boolean equals(byte[] syncBytes1, byte[] syncBytes2) {
- if (syncBytes1 == null) {
- return syncBytes2 == null;
- } else if (syncBytes2 == null) {
- return false;
- }
- if (syncBytes1.length != syncBytes2.length) return false;
- for (int i = 0; i < syncBytes1.length; i++) {
- if (syncBytes1[i] != syncBytes2[i]) return false;
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTree.java
deleted file mode 100644
index 177a9d2ad..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTree.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers.caches;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-
-/**
- * Provides caching for a {@link AbstractResourceVariantTree} using a
- * {@link ResourceVariantByteStore}.
- *
- * @see IResourceVariantTree
- * @see AbstractResourceVariantTree
- * @see ResourceVariantByteStore
- * @since 3.0
- */
-public abstract class ResourceVariantTree extends AbstractResourceVariantTree {
-
- private ResourceVariantByteStore store;
-
- protected ResourceVariantTree(ResourceVariantByteStore store) {
- this.store = store;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.IResourceVariantTree#members(org.eclipse.core.resources.IResource)
- */
- public IResource[] members(IResource resource) throws TeamException {
- return getByteStore().members(resource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.IResourceVariantTree#hasResourceVariant(org.eclipse.core.resources.IResource)
- */
- public boolean hasResourceVariant(IResource resource) throws TeamException {
- return getByteStore().getBytes(resource) != null;
- }
-
- /**
- * Flush any variants for the given resource to the depth specified.
- * @param resource the local resource
- * @param depth the depth of the flush
- * @throws TeamException
- */
- public void flushVariants(IResource resource, int depth) throws TeamException {
- getByteStore().flushBytes(resource, depth);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.AbstractResourceVariantTree#setVariant(org.eclipse.core.resources.IResource, org.eclipse.team.core.synchronize.IResourceVariant)
- */
- protected boolean setVariant(IResource local, IResourceVariant remote) throws TeamException {
- ResourceVariantByteStore cache = getByteStore();
- byte[] newRemoteBytes = getBytes(local, remote);
- boolean changed;
- if (newRemoteBytes == null) {
- changed = cache.deleteBytes(local);
- } else {
- changed = cache.setBytes(local, newRemoteBytes);
- }
- return changed;
- }
-
-
-
- /**
- * Get the byte store that is used to cache the serialization bytes
- * for the resource variants of this tree. A byte store is used
- * to reduce the memory footprint of the tree.
- * @return the resource variant tree that is being refreshed.
- */
- protected ResourceVariantByteStore getByteStore() {
- return store;
- }
-
- /**
- * Get the bytes to be stored in the <code>ResourceVariantByteStore</code>
- * from the given resource variant.
- * @param local the local resource
- * @param remote the corresponding resource variant handle
- * @return the bytes for the resource variant.
- */
- protected abstract byte[] getBytes(IResource local, IResourceVariant remote) throws TeamException;
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTreeSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTreeSubscriber.java
deleted file mode 100644
index e4ec78c08..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/ResourceVariantTreeSubscriber.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.core.subscribers.caches;
-
-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.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberChangeEvent;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-/**
- * A specialization of Subscriber that uses <code>IResourceVariantTree</code> objects
- * to manage the base (for three-way) and remote trees. Refreshing and obtaining the subscriber
- * members and resource variants is delegated to the resource variant trees.
- *
- * @since 3.0
- */
-public abstract class ResourceVariantTreeSubscriber extends Subscriber {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.Subscriber#getSyncInfo(org.eclipse.core.resources.IResource)
- */
- public SyncInfo getSyncInfo(IResource resource) throws TeamException {
- if (!isSupervised(resource)) return null;
- IResourceVariant remoteResource = getRemoteTree().getResourceVariant(resource);
- IResourceVariant baseResource;
- if (getResourceComparator().isThreeWay()) {
- baseResource= getBaseTree().getResourceVariant(resource);
- } else {
- baseResource = null;
- }
- return getSyncInfo(resource, baseResource, remoteResource);
- }
-
- /**
- * Method that creates an instance of SyncInfo for the provider local, base and remote
- * resource variants.
- * Can be overiden by subclasses.
- * @param local the local resource
- * @param base the base resource variant or <code>null</code>
- * @param remote the remote resource variant or <code>null</code>
- * @return the <code>SyncInfo</code> containing the provided resources
- */
- protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException {
- SyncInfo info = new SyncInfo(local, base, remote, this.getResourceComparator());
- info.init();
- return info;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.Subscriber#members(org.eclipse.core.resources.IResource)
- */
- public IResource[] members(IResource resource) throws TeamException {
- if(resource.getType() == IResource.FILE) {
- return new IResource[0];
- }
- try {
- Set allMembers = new HashSet();
- try {
- allMembers.addAll(Arrays.asList(((IContainer)resource).members()));
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
- // The resource is no longer exists so ignore the exception
- } else {
- throw e;
- }
- }
- allMembers.addAll(Arrays.asList(internalMembers(getRemoteTree(), resource)));
- if (getResourceComparator().isThreeWay()) {
- allMembers.addAll(Arrays.asList(internalMembers(getBaseTree(), resource)));
- }
- for (Iterator iterator = allMembers.iterator(); iterator.hasNext();) {
- IResource member = (IResource) iterator.next();
- if(!member.exists() && !getRemoteTree().hasResourceVariant(member)) {
- // Remove deletion conflicts
- iterator.remove();
- } else if (!isSupervised(resource)) {
- // Remove unsupervised resources
- iterator.remove();
- }
- }
- return (IResource[]) allMembers.toArray(new IResource[allMembers.size()]);
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ISyncTreeSubscriber#refresh(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
- monitor = Policy.monitorFor(monitor);
- List errors = new ArrayList();
- try {
- monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IStatus status = refresh(resource, depth, Policy.subMonitorFor(monitor, 100));
- if (!status.isOK()) {
- errors.add(status);
- }
- }
- } finally {
- monitor.done();
- }
- if (!errors.isEmpty()) {
- throw new TeamException(new MultiStatus(TeamPlugin.ID, 0,
- (IStatus[]) errors.toArray(new IStatus[errors.size()]),
- Policy.bind("ResourceVariantTreeSubscriber.1", getName()), null)); //$NON-NLS-1$
- }
- }
-
- /**
- * Return the base resource variant tree.
- */
- protected abstract IResourceVariantTree getBaseTree();
-
- /**
- * Return the remote resource variant tree.
- */
- protected abstract IResourceVariantTree getRemoteTree();
-
- private IStatus refresh(IResource resource, int depth, IProgressMonitor monitor) {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- Set allChanges = new HashSet();
- IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- allChanges.addAll(Arrays.asList(remoteChanges));
- if (getResourceComparator().isThreeWay()) {
- IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- allChanges.addAll(Arrays.asList(baseChanges));
- }
- IResource[] changedResources = (IResource[]) allChanges.toArray(new IResource[allChanges.size()]);
- fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, changedResources));
- return Status.OK_STATUS;
- } catch (TeamException e) {
- return new TeamStatus(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("ResourceVariantTreeSubscriber.2", resource.getFullPath().toString(), e.getMessage()), e, resource); //$NON-NLS-1$
- } finally {
- monitor.done();
- }
- }
-
- private IResource[] internalMembers(IResourceVariantTree tree, IResource resource) throws TeamException, CoreException {
- // Filter and return only phantoms associated with the remote synchronizer.
- IResource[] members;
- try {
- members = tree.members(resource);
- } catch (CoreException e) {
- if (!isSupervised(resource) || e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
- // The resource is no longer supervised or doesn't exist in any form
- // so ignore the exception and return that there are no members
- return new IResource[0];
- }
- throw e;
- }
- return members;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/SessionResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/SessionResourceVariantByteStore.java
deleted file mode 100644
index 4aa20c7b2..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/caches/SessionResourceVariantByteStore.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.core.subscribers.caches;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.Assert;
-
-/**
- * A <code>ResourceVariantByteStore</code> that caches the variant bytes in memory
- * and does not persist them over workbench invocations.
- * <p>
- * This class is not intended to be subclassed by clients.
- *
- * @since 3.0
- */
-public class SessionResourceVariantByteStore extends ResourceVariantByteStore {
-
- private static final byte[] NO_REMOTE = new byte[0];
- private Map membersCache = new HashMap();
-
- private Map syncBytesCache = new HashMap();
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setVariantDoesNotExist(org.eclipse.core.resources.IResource)
- */
- public boolean deleteBytes(IResource resource) throws TeamException {
- return flushBytes(resource, IResource.DEPTH_ZERO);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#dispose()
- */
- public void dispose() {
- syncBytesCache.clear();
- membersCache.clear();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#removeBytes(org.eclipse.core.resources.IResource, int)
- */
- public boolean flushBytes(IResource resource, int depth) throws TeamException {
- if (getSyncBytesCache().containsKey(resource)) {
- if (depth != IResource.DEPTH_ZERO) {
- IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource child = members[i];
- flushBytes(child, (depth == IResource.DEPTH_INFINITE) ? IResource.DEPTH_INFINITE: IResource.DEPTH_ZERO);
- }
- }
- getSyncBytesCache().remove(resource);
- internalRemoveFromParent(resource);
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#getBytes(org.eclipse.core.resources.IResource)
- */
- public byte[] getBytes(IResource resource) throws TeamException {
- byte[] syncBytes = internalGetSyncBytes(resource);
- if (syncBytes != null && equals(syncBytes, NO_REMOTE)) {
- // If it is known that there is no remote, return null
- return null;
- }
- return syncBytes;
- }
-
- /**
- * Return <code>true</code> if no bytes are contained in this tree.
- * @return <code>true</code> if no bytes are contained in this tree.
- */
- public boolean isEmpty() {
- return syncBytesCache.isEmpty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#members(org.eclipse.core.resources.IResource)
- */
- public IResource[] members(IResource resource) {
- List members = (List)membersCache.get(resource);
- if (members == null) {
- return new IResource[0];
- }
- return (IResource[]) members.toArray(new IResource[members.size()]);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setBytes(org.eclipse.core.resources.IResource, byte[])
- */
- public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
- Assert.isNotNull(bytes);
- byte[] oldBytes = internalGetSyncBytes(resource);
- if (oldBytes != null && equals(oldBytes, bytes)) return false;
- internalSetSyncInfo(resource, bytes);
- return true;
- }
-
- private Map getSyncBytesCache() {
- return syncBytesCache;
- }
-
- private void internalAddToParent(IResource resource) {
- IContainer parent = resource.getParent();
- if (parent == null) return;
- List members = (List)membersCache.get(parent);
- if (members == null) {
- members = new ArrayList();
- membersCache.put(parent, members);
- }
- members.add(resource);
- }
-
- private byte[] internalGetSyncBytes(IResource resource) {
- return (byte[])getSyncBytesCache().get(resource);
- }
-
- private void internalRemoveFromParent(IResource resource) {
- IContainer parent = resource.getParent();
- List members = (List)membersCache.get(parent);
- if (members != null) {
- members.remove(resource);
- if (members.isEmpty()) {
- membersCache.remove(parent);
- }
- }
- }
-
- private void internalSetSyncInfo(IResource resource, byte[] bytes) {
- getSyncBytesCache().put(resource, bytes);
- internalAddToParent(resource);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/.classpath b/bundles/org.eclipse.team.cvs.ssh/.classpath
deleted file mode 100644
index 065ac06e1..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.team.cvs.ssh/.cvsignore b/bundles/org.eclipse.team.cvs.ssh/.cvsignore
deleted file mode 100644
index c5e82d745..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh/.options b/bundles/org.eclipse.team.cvs.ssh/.options
deleted file mode 100644
index 126e6d962..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/.options
+++ /dev/null
@@ -1,7 +0,0 @@
-# Debugging options for the org.eclipse.team.cvs.core plugin.
-
-# Turn on debugging for the plugin.
-org.eclipse.team.cvs.ssh/debug=false
-
-# Shows ssh protocol messages
-org.eclipse.team.cvs.ssh/ssh_protocol=false \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh/.project b/bundles/org.eclipse.team.cvs.ssh/.project
deleted file mode 100644
index 942f4d4fd..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.team.cvs.ssh</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.team.core</project>
- <project>org.eclipse.team.cvs.core</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.team.cvs.ssh/about.html b/bundles/org.eclipse.team.cvs.ssh/about.html
deleted file mode 100644
index cd1279abd..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/about.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Third Party Content</h3>
-
-<p>The Content includes items that have been sourced from third parties as follows:</p>
-
-<p><b>The Java (TM) Ssh Applet</b></p>
-<p>The plug-in is based on software developed by Cedric Gourio.
-If the source code is included, it is located in teamcvssshsrc.zip. The binary code is located in teamcvsssh.jar. The Java Ssh Applet includes the following copyright notice which
-must be included in any redistribution:</p>
-
-<blockquote>
- Copyright (c) 1998 Cedric Gourio<br>
- (<a href="http://www.cl.cam.ac.uk/~fapp2/software/java-ssh/">http://www.cl.cam.ac.uk/~fapp2/software/java-ssh/</a>)<br>
- (<a href="mailto:javassh@france-mail.com">javassh@france-mail.com</a>)
-
- <p>This program is FREE FOR COMMERCIAL AND NON-COMMERCIAL USE.<br>
- You can freely modify the code.</p>
-
- <p>You should however include this copyright notice in any redistribution<br>
- and please keep in touch with the author for any feedback.</p>
-</blockquote>
-
-<p><b>The Blowfish Encryption Algorithm</b></p>
-<p>The plug-in is based on an algorithm developed by Bruce Schneier. The algorithm was originally published in
-a paper that is located at <a href="http://www.counterpane.com/bfsverlag.html">http://www.counterpane.com/bfsverlag.html</a>.
-Your use of the Blowfish Encryption Algorithm in both source and binary code form contained in the plug-in is not subject to any
-additional terms and conditions. If the source code, Blowfish.java is included, it is located in teamcvssshsrc.zip. The binary code, Blowfish.class is located in
-teamcvsssh.jar.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-<h3>Cryptography</h3>
-
-<p><b>Export Control</b></p>
-<p>The plug-in contains encryption software. The country in which you are currently may have restrictions on the import, possession,
-and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's
-laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this
-is permitted.</p>
-
-<p><b>Encryption Items</b></p>
-
-<p>Details of the encryption software in this plug-in are provided to assist in obtaining relevant export control classification and approval.
-Cryptography in this plug-in has been classified as Export Commodity Control Number (ECCN) 5D002.c.1 by the U.S. Government Department of Commerce,
-Bureau of Export Administration and deemed eligible for export under License Exception Technology Software Unrestricted (TSU) for object code
-and (cryptographic) source code, and License Exception ENC Retail for object code and no (cryptographic) source code.</p>
-
-<p>The plug-in contains an implementation of the Secure Shell (SSH) protocol that encrypts the network traffic (program code files
-in file versioning systems) between a Concurrent Versions System (CVS) server and a CVS client. Data is encrypted using the Blowfish algorithm
-which is a 64-bit symmetric cipher that uses a key varying in length from 32 bits to 448 bits. The RSA PKCS #1 v1.5 key exchange algorithm is
-used to authenticate and exchange keys with a minimum modulus size of 96 bits and a maximum modulus size theoretically unlimited since the
-implementation uses the java.math.BigInteger class which has a maximum positive integer range limited only by the available memory in the computer.
-In practice, the key length is defined by the CVS server with which communication is initiated.</p>
-
-<p>The following Java classes contain encryption items (the plug-in may contain both binary and source code):</p>
-
-<ul>
- <li>org.eclipse.team.internal.ccvs.ssh.Blowfish</li>
- <li>org.eclipse.team.internal.ccvs.ssh.Cipher</li>
- <li>org.eclipse.team.internal.ccvs.ssh.Client</li>
- <li>org.eclipse.team.internal.ccvs.ssh.ClientPacket</li>
- <li>org.eclipse.team.internal.ccvs.ssh.Misc</li>
-</ul>
-
-<small>Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.</small>
-
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh/build.properties b/bundles/org.eclipse.team.cvs.ssh/build.properties
deleted file mode 100644
index 487a6e818..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/build.properties
+++ /dev/null
@@ -1,14 +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
-###############################################################################
-# Eclipse build contribution
-source.teamcvsssh.jar=src/
-src.includes=about.html
-bin.includes=about.html,plugin.xml,plugin.properties,*.jar,.options \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh/plugin.properties b/bundles/org.eclipse.team.cvs.ssh/plugin.properties
deleted file mode 100644
index 357dec3bc..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/plugin.properties
+++ /dev/null
@@ -1,12 +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
-###############################################################################
-providerName=Eclipse.org
-pluginName=CVS SSH Core \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh/plugin.xml b/bundles/org.eclipse.team.cvs.ssh/plugin.xml
deleted file mode 100644
index cc5d16f81..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/plugin.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.team.cvs.ssh"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.team.internal.ccvs.ssh.SSHPlugin">
-
- <runtime>
- <library name="teamcvsssh.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.team.internal.ccvs.ssh"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.boot"/>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.team.cvs.core"/>
- <import plugin="org.eclipse.team.core"/>
- </requires>
-
-<!--
- <extension
- id="ssh"
- point="org.eclipse.team.cvs.core.connectionmethods">
- <adapter>
- <run
- class="org.eclipse.team.internal.ccvs.ssh.SSHMethod">
- <parameter
- name="trace"
- value="false">
- </parameter>
- </run>
- </adapter>
- </extension>
--->
-
-</plugin>
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java
deleted file mode 100644
index c72949045..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java
+++ /dev/null
@@ -1,1220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-public class Blowfish extends Cipher {
- private int[] P = new int[18];
- private int[][] S = new int[4][256];
-
- private int lastEncipherXL = 0;
- private int lastEncipherXR = 0;
- private int lastDecipherXL = 0;
- private int lastDecipherXR = 0;
-
- private final static int[] INIT_DATA =
- {
- 0x243f6a88,
- 0x85a308d3,
- 0x13198a2e,
- 0x03707344,
- 0xa4093822,
- 0x299f31d0,
- 0x082efa98,
- 0xec4e6c89,
- 0x452821e6,
- 0x38d01377,
- 0xbe5466cf,
- 0x34e90c6c,
- 0xc0ac29b7,
- 0xc97c50dd,
- 0x3f84d5b5,
- 0xb5470917,
- 0x9216d5d9,
- 0x8979fb1b,
- 0xd1310ba6,
- 0x98dfb5ac,
- 0x2ffd72db,
- 0xd01adfb7,
- 0xb8e1afed,
- 0x6a267e96,
- 0xba7c9045,
- 0xf12c7f99,
- 0x24a19947,
- 0xb3916cf7,
- 0x0801f2e2,
- 0x858efc16,
- 0x636920d8,
- 0x71574e69,
- 0xa458fea3,
- 0xf4933d7e,
- 0x0d95748f,
- 0x728eb658,
- 0x718bcd58,
- 0x82154aee,
- 0x7b54a41d,
- 0xc25a59b5,
- 0x9c30d539,
- 0x2af26013,
- 0xc5d1b023,
- 0x286085f0,
- 0xca417918,
- 0xb8db38ef,
- 0x8e79dcb0,
- 0x603a180e,
- 0x6c9e0e8b,
- 0xb01e8a3e,
- 0xd71577c1,
- 0xbd314b27,
- 0x78af2fda,
- 0x55605c60,
- 0xe65525f3,
- 0xaa55ab94,
- 0x57489862,
- 0x63e81440,
- 0x55ca396a,
- 0x2aab10b6,
- 0xb4cc5c34,
- 0x1141e8ce,
- 0xa15486af,
- 0x7c72e993,
- 0xb3ee1411,
- 0x636fbc2a,
- 0x2ba9c55d,
- 0x741831f6,
- 0xce5c3e16,
- 0x9b87931e,
- 0xafd6ba33,
- 0x6c24cf5c,
- 0x7a325381,
- 0x28958677,
- 0x3b8f4898,
- 0x6b4bb9af,
- 0xc4bfe81b,
- 0x66282193,
- 0x61d809cc,
- 0xfb21a991,
- 0x487cac60,
- 0x5dec8032,
- 0xef845d5d,
- 0xe98575b1,
- 0xdc262302,
- 0xeb651b88,
- 0x23893e81,
- 0xd396acc5,
- 0x0f6d6ff3,
- 0x83f44239,
- 0x2e0b4482,
- 0xa4842004,
- 0x69c8f04a,
- 0x9e1f9b5e,
- 0x21c66842,
- 0xf6e96c9a,
- 0x670c9c61,
- 0xabd388f0,
- 0x6a51a0d2,
- 0xd8542f68,
- 0x960fa728,
- 0xab5133a3,
- 0x6eef0b6c,
- 0x137a3be4,
- 0xba3bf050,
- 0x7efb2a98,
- 0xa1f1651d,
- 0x39af0176,
- 0x66ca593e,
- 0x82430e88,
- 0x8cee8619,
- 0x456f9fb4,
- 0x7d84a5c3,
- 0x3b8b5ebe,
- 0xe06f75d8,
- 0x85c12073,
- 0x401a449f,
- 0x56c16aa6,
- 0x4ed3aa62,
- 0x363f7706,
- 0x1bfedf72,
- 0x429b023d,
- 0x37d0d724,
- 0xd00a1248,
- 0xdb0fead3,
- 0x49f1c09b,
- 0x075372c9,
- 0x80991b7b,
- 0x25d479d8,
- 0xf6e8def7,
- 0xe3fe501a,
- 0xb6794c3b,
- 0x976ce0bd,
- 0x04c006ba,
- 0xc1a94fb6,
- 0x409f60c4,
- 0x5e5c9ec2,
- 0x196a2463,
- 0x68fb6faf,
- 0x3e6c53b5,
- 0x1339b2eb,
- 0x3b52ec6f,
- 0x6dfc511f,
- 0x9b30952c,
- 0xcc814544,
- 0xaf5ebd09,
- 0xbee3d004,
- 0xde334afd,
- 0x660f2807,
- 0x192e4bb3,
- 0xc0cba857,
- 0x45c8740f,
- 0xd20b5f39,
- 0xb9d3fbdb,
- 0x5579c0bd,
- 0x1a60320a,
- 0xd6a100c6,
- 0x402c7279,
- 0x679f25fe,
- 0xfb1fa3cc,
- 0x8ea5e9f8,
- 0xdb3222f8,
- 0x3c7516df,
- 0xfd616b15,
- 0x2f501ec8,
- 0xad0552ab,
- 0x323db5fa,
- 0xfd238760,
- 0x53317b48,
- 0x3e00df82,
- 0x9e5c57bb,
- 0xca6f8ca0,
- 0x1a87562e,
- 0xdf1769db,
- 0xd542a8f6,
- 0x287effc3,
- 0xac6732c6,
- 0x8c4f5573,
- 0x695b27b0,
- 0xbbca58c8,
- 0xe1ffa35d,
- 0xb8f011a0,
- 0x10fa3d98,
- 0xfd2183b8,
- 0x4afcb56c,
- 0x2dd1d35b,
- 0x9a53e479,
- 0xb6f84565,
- 0xd28e49bc,
- 0x4bfb9790,
- 0xe1ddf2da,
- 0xa4cb7e33,
- 0x62fb1341,
- 0xcee4c6e8,
- 0xef20cada,
- 0x36774c01,
- 0xd07e9efe,
- 0x2bf11fb4,
- 0x95dbda4d,
- 0xae909198,
- 0xeaad8e71,
- 0x6b93d5a0,
- 0xd08ed1d0,
- 0xafc725e0,
- 0x8e3c5b2f,
- 0x8e7594b7,
- 0x8ff6e2fb,
- 0xf2122b64,
- 0x8888b812,
- 0x900df01c,
- 0x4fad5ea0,
- 0x688fc31c,
- 0xd1cff191,
- 0xb3a8c1ad,
- 0x2f2f2218,
- 0xbe0e1777,
- 0xea752dfe,
- 0x8b021fa1,
- 0xe5a0cc0f,
- 0xb56f74e8,
- 0x18acf3d6,
- 0xce89e299,
- 0xb4a84fe0,
- 0xfd13e0b7,
- 0x7cc43b81,
- 0xd2ada8d9,
- 0x165fa266,
- 0x80957705,
- 0x93cc7314,
- 0x211a1477,
- 0xe6ad2065,
- 0x77b5fa86,
- 0xc75442f5,
- 0xfb9d35cf,
- 0xebcdaf0c,
- 0x7b3e89a0,
- 0xd6411bd3,
- 0xae1e7e49,
- 0x00250e2d,
- 0x2071b35e,
- 0x226800bb,
- 0x57b8e0af,
- 0x2464369b,
- 0xf009b91e,
- 0x5563911d,
- 0x59dfa6aa,
- 0x78c14389,
- 0xd95a537f,
- 0x207d5ba2,
- 0x02e5b9c5,
- 0x83260376,
- 0x6295cfa9,
- 0x11c81968,
- 0x4e734a41,
- 0xb3472dca,
- 0x7b14a94a,
- 0x1b510052,
- 0x9a532915,
- 0xd60f573f,
- 0xbc9bc6e4,
- 0x2b60a476,
- 0x81e67400,
- 0x08ba6fb5,
- 0x571be91f,
- 0xf296ec6b,
- 0x2a0dd915,
- 0xb6636521,
- 0xe7b9f9b6,
- 0xff34052e,
- 0xc5855664,
- 0x53b02d5d,
- 0xa99f8fa1,
- 0x08ba4799,
- 0x6e85076a,
- 0x4b7a70e9,
- 0xb5b32944,
- 0xdb75092e,
- 0xc4192623,
- 0xad6ea6b0,
- 0x49a7df7d,
- 0x9cee60b8,
- 0x8fedb266,
- 0xecaa8c71,
- 0x699a17ff,
- 0x5664526c,
- 0xc2b19ee1,
- 0x193602a5,
- 0x75094c29,
- 0xa0591340,
- 0xe4183a3e,
- 0x3f54989a,
- 0x5b429d65,
- 0x6b8fe4d6,
- 0x99f73fd6,
- 0xa1d29c07,
- 0xefe830f5,
- 0x4d2d38e6,
- 0xf0255dc1,
- 0x4cdd2086,
- 0x8470eb26,
- 0x6382e9c6,
- 0x021ecc5e,
- 0x09686b3f,
- 0x3ebaefc9,
- 0x3c971814,
- 0x6b6a70a1,
- 0x687f3584,
- 0x52a0e286,
- 0xb79c5305,
- 0xaa500737,
- 0x3e07841c,
- 0x7fdeae5c,
- 0x8e7d44ec,
- 0x5716f2b8,
- 0xb03ada37,
- 0xf0500c0d,
- 0xf01c1f04,
- 0x0200b3ff,
- 0xae0cf51a,
- 0x3cb574b2,
- 0x25837a58,
- 0xdc0921bd,
- 0xd19113f9,
- 0x7ca92ff6,
- 0x94324773,
- 0x22f54701,
- 0x3ae5e581,
- 0x37c2dadc,
- 0xc8b57634,
- 0x9af3dda7,
- 0xa9446146,
- 0x0fd0030e,
- 0xecc8c73e,
- 0xa4751e41,
- 0xe238cd99,
- 0x3bea0e2f,
- 0x3280bba1,
- 0x183eb331,
- 0x4e548b38,
- 0x4f6db908,
- 0x6f420d03,
- 0xf60a04bf,
- 0x2cb81290,
- 0x24977c79,
- 0x5679b072,
- 0xbcaf89af,
- 0xde9a771f,
- 0xd9930810,
- 0xb38bae12,
- 0xdccf3f2e,
- 0x5512721f,
- 0x2e6b7124,
- 0x501adde6,
- 0x9f84cd87,
- 0x7a584718,
- 0x7408da17,
- 0xbc9f9abc,
- 0xe94b7d8c,
- 0xec7aec3a,
- 0xdb851dfa,
- 0x63094366,
- 0xc464c3d2,
- 0xef1c1847,
- 0x3215d908,
- 0xdd433b37,
- 0x24c2ba16,
- 0x12a14d43,
- 0x2a65c451,
- 0x50940002,
- 0x133ae4dd,
- 0x71dff89e,
- 0x10314e55,
- 0x81ac77d6,
- 0x5f11199b,
- 0x043556f1,
- 0xd7a3c76b,
- 0x3c11183b,
- 0x5924a509,
- 0xf28fe6ed,
- 0x97f1fbfa,
- 0x9ebabf2c,
- 0x1e153c6e,
- 0x86e34570,
- 0xeae96fb1,
- 0x860e5e0a,
- 0x5a3e2ab3,
- 0x771fe71c,
- 0x4e3d06fa,
- 0x2965dcb9,
- 0x99e71d0f,
- 0x803e89d6,
- 0x5266c825,
- 0x2e4cc978,
- 0x9c10b36a,
- 0xc6150eba,
- 0x94e2ea78,
- 0xa5fc3c53,
- 0x1e0a2df4,
- 0xf2f74ea7,
- 0x361d2b3d,
- 0x1939260f,
- 0x19c27960,
- 0x5223a708,
- 0xf71312b6,
- 0xebadfe6e,
- 0xeac31f66,
- 0xe3bc4595,
- 0xa67bc883,
- 0xb17f37d1,
- 0x018cff28,
- 0xc332ddef,
- 0xbe6c5aa5,
- 0x65582185,
- 0x68ab9802,
- 0xeecea50f,
- 0xdb2f953b,
- 0x2aef7dad,
- 0x5b6e2f84,
- 0x1521b628,
- 0x29076170,
- 0xecdd4775,
- 0x619f1510,
- 0x13cca830,
- 0xeb61bd96,
- 0x0334fe1e,
- 0xaa0363cf,
- 0xb5735c90,
- 0x4c70a239,
- 0xd59e9e0b,
- 0xcbaade14,
- 0xeecc86bc,
- 0x60622ca7,
- 0x9cab5cab,
- 0xb2f3846e,
- 0x648b1eaf,
- 0x19bdf0ca,
- 0xa02369b9,
- 0x655abb50,
- 0x40685a32,
- 0x3c2ab4b3,
- 0x319ee9d5,
- 0xc021b8f7,
- 0x9b540b19,
- 0x875fa099,
- 0x95f7997e,
- 0x623d7da8,
- 0xf837889a,
- 0x97e32d77,
- 0x11ed935f,
- 0x16681281,
- 0x0e358829,
- 0xc7e61fd6,
- 0x96dedfa1,
- 0x7858ba99,
- 0x57f584a5,
- 0x1b227263,
- 0x9b83c3ff,
- 0x1ac24696,
- 0xcdb30aeb,
- 0x532e3054,
- 0x8fd948e4,
- 0x6dbc3128,
- 0x58ebf2ef,
- 0x34c6ffea,
- 0xfe28ed61,
- 0xee7c3c73,
- 0x5d4a14d9,
- 0xe864b7e3,
- 0x42105d14,
- 0x203e13e0,
- 0x45eee2b6,
- 0xa3aaabea,
- 0xdb6c4f15,
- 0xfacb4fd0,
- 0xc742f442,
- 0xef6abbb5,
- 0x654f3b1d,
- 0x41cd2105,
- 0xd81e799e,
- 0x86854dc7,
- 0xe44b476a,
- 0x3d816250,
- 0xcf62a1f2,
- 0x5b8d2646,
- 0xfc8883a0,
- 0xc1c7b6a3,
- 0x7f1524c3,
- 0x69cb7492,
- 0x47848a0b,
- 0x5692b285,
- 0x095bbf00,
- 0xad19489d,
- 0x1462b174,
- 0x23820e00,
- 0x58428d2a,
- 0x0c55f5ea,
- 0x1dadf43e,
- 0x233f7061,
- 0x3372f092,
- 0x8d937e41,
- 0xd65fecf1,
- 0x6c223bdb,
- 0x7cde3759,
- 0xcbee7460,
- 0x4085f2a7,
- 0xce77326e,
- 0xa6078084,
- 0x19f8509e,
- 0xe8efd855,
- 0x61d99735,
- 0xa969a7aa,
- 0xc50c06c2,
- 0x5a04abfc,
- 0x800bcadc,
- 0x9e447a2e,
- 0xc3453484,
- 0xfdd56705,
- 0x0e1e9ec9,
- 0xdb73dbd3,
- 0x105588cd,
- 0x675fda79,
- 0xe3674340,
- 0xc5c43465,
- 0x713e38d8,
- 0x3d28f89e,
- 0xf16dff20,
- 0x153e21e7,
- 0x8fb03d4a,
- 0xe6e39f2b,
- 0xdb83adf7,
- 0xe93d5a68,
- 0x948140f7,
- 0xf64c261c,
- 0x94692934,
- 0x411520f7,
- 0x7602d4f7,
- 0xbcf46b2e,
- 0xd4a20068,
- 0xd4082471,
- 0x3320f46a,
- 0x43b7d4b7,
- 0x500061af,
- 0x1e39f62e,
- 0x97244546,
- 0x14214f74,
- 0xbf8b8840,
- 0x4d95fc1d,
- 0x96b591af,
- 0x70f4ddd3,
- 0x66a02f45,
- 0xbfbc09ec,
- 0x03bd9785,
- 0x7fac6dd0,
- 0x31cb8504,
- 0x96eb27b3,
- 0x55fd3941,
- 0xda2547e6,
- 0xabca0a9a,
- 0x28507825,
- 0x530429f4,
- 0x0a2c86da,
- 0xe9b66dfb,
- 0x68dc1462,
- 0xd7486900,
- 0x680ec0a4,
- 0x27a18dee,
- 0x4f3ffea2,
- 0xe887ad8c,
- 0xb58ce006,
- 0x7af4d6b6,
- 0xaace1e7c,
- 0xd3375fec,
- 0xce78a399,
- 0x406b2a42,
- 0x20fe9e35,
- 0xd9f385b9,
- 0xee39d7ab,
- 0x3b124e8b,
- 0x1dc9faf7,
- 0x4b6d1856,
- 0x26a36631,
- 0xeae397b2,
- 0x3a6efa74,
- 0xdd5b4332,
- 0x6841e7f7,
- 0xca7820fb,
- 0xfb0af54e,
- 0xd8feb397,
- 0x454056ac,
- 0xba489527,
- 0x55533a3a,
- 0x20838d87,
- 0xfe6ba9b7,
- 0xd096954b,
- 0x55a867bc,
- 0xa1159a58,
- 0xcca92963,
- 0x99e1db33,
- 0xa62a4a56,
- 0x3f3125f9,
- 0x5ef47e1c,
- 0x9029317c,
- 0xfdf8e802,
- 0x04272f70,
- 0x80bb155c,
- 0x05282ce3,
- 0x95c11548,
- 0xe4c66d22,
- 0x48c1133f,
- 0xc70f86dc,
- 0x07f9c9ee,
- 0x41041f0f,
- 0x404779a4,
- 0x5d886e17,
- 0x325f51eb,
- 0xd59bc0d1,
- 0xf2bcc18f,
- 0x41113564,
- 0x257b7834,
- 0x602a9c60,
- 0xdff8e8a3,
- 0x1f636c1b,
- 0x0e12b4c2,
- 0x02e1329e,
- 0xaf664fd1,
- 0xcad18115,
- 0x6b2395e0,
- 0x333e92e1,
- 0x3b240b62,
- 0xeebeb922,
- 0x85b2a20e,
- 0xe6ba0d99,
- 0xde720c8c,
- 0x2da2f728,
- 0xd0127845,
- 0x95b794fd,
- 0x647d0862,
- 0xe7ccf5f0,
- 0x5449a36f,
- 0x877d48fa,
- 0xc39dfd27,
- 0xf33e8d1e,
- 0x0a476341,
- 0x992eff74,
- 0x3a6f6eab,
- 0xf4f8fd37,
- 0xa812dc60,
- 0xa1ebddf8,
- 0x991be14c,
- 0xdb6e6b0d,
- 0xc67b5510,
- 0x6d672c37,
- 0x2765d43b,
- 0xdcd0e804,
- 0xf1290dc7,
- 0xcc00ffa3,
- 0xb5390f92,
- 0x690fed0b,
- 0x667b9ffb,
- 0xcedb7d9c,
- 0xa091cf0b,
- 0xd9155ea3,
- 0xbb132f88,
- 0x515bad24,
- 0x7b9479bf,
- 0x763bd6eb,
- 0x37392eb3,
- 0xcc115979,
- 0x8026e297,
- 0xf42e312d,
- 0x6842ada7,
- 0xc66a2b3b,
- 0x12754ccc,
- 0x782ef11c,
- 0x6a124237,
- 0xb79251e7,
- 0x06a1bbe6,
- 0x4bfb6350,
- 0x1a6b1018,
- 0x11caedfa,
- 0x3d25bdd8,
- 0xe2e1c3c9,
- 0x44421659,
- 0x0a121386,
- 0xd90cec6e,
- 0xd5abea2a,
- 0x64af674e,
- 0xda86a85f,
- 0xbebfe988,
- 0x64e4c3fe,
- 0x9dbc8057,
- 0xf0f7c086,
- 0x60787bf8,
- 0x6003604d,
- 0xd1fd8346,
- 0xf6381fb0,
- 0x7745ae04,
- 0xd736fccc,
- 0x83426b33,
- 0xf01eab71,
- 0xb0804187,
- 0x3c005e5f,
- 0x77a057be,
- 0xbde8ae24,
- 0x55464299,
- 0xbf582e61,
- 0x4e58f48f,
- 0xf2ddfda2,
- 0xf474ef38,
- 0x8789bdc2,
- 0x5366f9c3,
- 0xc8b38e74,
- 0xb475f255,
- 0x46fcd9b9,
- 0x7aeb2661,
- 0x8b1ddf84,
- 0x846a0e79,
- 0x915f95e2,
- 0x466e598e,
- 0x20b45770,
- 0x8cd55591,
- 0xc902de4c,
- 0xb90bace1,
- 0xbb8205d0,
- 0x11a86248,
- 0x7574a99e,
- 0xb77f19b6,
- 0xe0a9dc09,
- 0x662d09a1,
- 0xc4324633,
- 0xe85a1f02,
- 0x09f0be8c,
- 0x4a99a025,
- 0x1d6efe10,
- 0x1ab93d1d,
- 0x0ba5a4df,
- 0xa186f20f,
- 0x2868f169,
- 0xdcb7da83,
- 0x573906fe,
- 0xa1e2ce9b,
- 0x4fcd7f52,
- 0x50115e01,
- 0xa70683fa,
- 0xa002b5c4,
- 0x0de6d027,
- 0x9af88c27,
- 0x773f8641,
- 0xc3604c06,
- 0x61a806b5,
- 0xf0177a28,
- 0xc0f586e0,
- 0x006058aa,
- 0x30dc7d62,
- 0x11e69ed7,
- 0x2338ea63,
- 0x53c2dd94,
- 0xc2c21634,
- 0xbbcbee56,
- 0x90bcb6de,
- 0xebfc7da1,
- 0xce591d76,
- 0x6f05e409,
- 0x4b7c0188,
- 0x39720a3d,
- 0x7c927c24,
- 0x86e3725f,
- 0x724d9db9,
- 0x1ac15bb4,
- 0xd39eb8fc,
- 0xed545578,
- 0x08fca5b5,
- 0xd83d7cd3,
- 0x4dad0fc4,
- 0x1e50ef5e,
- 0xb161e6f8,
- 0xa28514d9,
- 0x6c51133c,
- 0x6fd5c7e7,
- 0x56e14ec4,
- 0x362abfce,
- 0xddc6c837,
- 0xd79a3234,
- 0x92638212,
- 0x670efa8e,
- 0x406000e0,
- 0x3a39ce37,
- 0xd3faf5cf,
- 0xabc27737,
- 0x5ac52d1b,
- 0x5cb0679e,
- 0x4fa33742,
- 0xd3822740,
- 0x99bc9bbe,
- 0xd5118e9d,
- 0xbf0f7315,
- 0xd62d1c7e,
- 0xc700c47b,
- 0xb78c1b6b,
- 0x21a19045,
- 0xb26eb1be,
- 0x6a366eb4,
- 0x5748ab2f,
- 0xbc946e79,
- 0xc6a376d2,
- 0x6549c2c8,
- 0x530ff8ee,
- 0x468dde7d,
- 0xd5730a1d,
- 0x4cd04dc6,
- 0x2939bbdb,
- 0xa9ba4650,
- 0xac9526e8,
- 0xbe5ee304,
- 0xa1fad5f0,
- 0x6a2d519a,
- 0x63ef8ce2,
- 0x9a86ee22,
- 0xc089c2b8,
- 0x43242ef6,
- 0xa51e03aa,
- 0x9cf2d0a4,
- 0x83c061ba,
- 0x9be96a4d,
- 0x8fe51550,
- 0xba645bd6,
- 0x2826a2f9,
- 0xa73a3ae1,
- 0x4ba99586,
- 0xef5562e9,
- 0xc72fefd3,
- 0xf752f7da,
- 0x3f046f69,
- 0x77fa0a59,
- 0x80e4a915,
- 0x87b08601,
- 0x9b09e6ad,
- 0x3b3ee593,
- 0xe990fd5a,
- 0x9e34d797,
- 0x2cf0b7d9,
- 0x022b8b51,
- 0x96d5ac3a,
- 0x017da67d,
- 0xd1cf3ed6,
- 0x7c7d2d28,
- 0x1f9f25cf,
- 0xadf2b89b,
- 0x5ad6b472,
- 0x5a88f54c,
- 0xe029ac71,
- 0xe019a5e6,
- 0x47b0acfd,
- 0xed93fa9b,
- 0xe8d3c48d,
- 0x283b57cc,
- 0xf8d56629,
- 0x79132e28,
- 0x785f0191,
- 0xed756055,
- 0xf7960e44,
- 0xe3d35e8c,
- 0x15056dd4,
- 0x88f46dba,
- 0x03a16125,
- 0x0564f0bd,
- 0xc3eb9e15,
- 0x3c9057a2,
- 0x97271aec,
- 0xa93a072a,
- 0x1b3f6d9b,
- 0x1e6321f5,
- 0xf59c66fb,
- 0x26dcf319,
- 0x7533d928,
- 0xb155fdf5,
- 0x03563482,
- 0x8aba3cbb,
- 0x28517711,
- 0xc20ad9f8,
- 0xabcc5167,
- 0xccad925f,
- 0x4de81751,
- 0x3830dc8e,
- 0x379d5862,
- 0x9320f991,
- 0xea7a90c2,
- 0xfb3e7bce,
- 0x5121ce64,
- 0x774fbe32,
- 0xa8b6e37e,
- 0xc3293d46,
- 0x48de5369,
- 0x6413e680,
- 0xa2ae0810,
- 0xdd6db224,
- 0x69852dfd,
- 0x09072166,
- 0xb39a460a,
- 0x6445c0dd,
- 0x586cdecf,
- 0x1c20c8ae,
- 0x5bbef7dd,
- 0x1b588d40,
- 0xccd2017f,
- 0x6bb4e3bb,
- 0xdda26a7e,
- 0x3a59ff45,
- 0x3e350a44,
- 0xbcb4cdd5,
- 0x72eacea8,
- 0xfa6484bb,
- 0x8d6612ae,
- 0xbf3c6f47,
- 0xd29be463,
- 0x542f5d9e,
- 0xaec2771b,
- 0xf64e6370,
- 0x740e0d8d,
- 0xe75b1357,
- 0xf8721671,
- 0xaf537d5d,
- 0x4040cb08,
- 0x4eb4e2cc,
- 0x34d2466a,
- 0x0115af84,
- 0xe1b00428,
- 0x95983a1d,
- 0x06b89fb4,
- 0xce6ea048,
- 0x6f3f3b82,
- 0x3520ab82,
- 0x011a1d4b,
- 0x277227f8,
- 0x611560b1,
- 0xe7933fdc,
- 0xbb3a792b,
- 0x344525bd,
- 0xa08839e1,
- 0x51ce794b,
- 0x2f32c9b7,
- 0xa01fbac9,
- 0xe01cc87e,
- 0xbcc7d1f6,
- 0xcf0111c3,
- 0xa1e8aac7,
- 0x1a908749,
- 0xd44fbd9a,
- 0xd0dadecb,
- 0xd50ada38,
- 0x0339c32a,
- 0xc6913667,
- 0x8df9317c,
- 0xe0b12b4f,
- 0xf79e59b7,
- 0x43f5bb3a,
- 0xf2d519ff,
- 0x27d9459c,
- 0xbf97222c,
- 0x15e6fc2a,
- 0x0f91fc71,
- 0x9b941525,
- 0xfae59361,
- 0xceb69ceb,
- 0xc2a86459,
- 0x12baa8d1,
- 0xb6c1075e,
- 0xe3056a0c,
- 0x10d25065,
- 0xcb03a442,
- 0xe0ec6e0e,
- 0x1698db3b,
- 0x4c98a0be,
- 0x3278e964,
- 0x9f1f9532,
- 0xe0d392df,
- 0xd3a0342b,
- 0x8971f21e,
- 0x1b0a7441,
- 0x4ba3348c,
- 0xc5be7120,
- 0xc37632d8,
- 0xdf359f8d,
- 0x9b992f2e,
- 0xe60b6f47,
- 0x0fe3f11d,
- 0xe54cda54,
- 0x1edad891,
- 0xce6279cf,
- 0xcd3e7e6f,
- 0x1618b166,
- 0xfd2c1d05,
- 0x848fd2c5,
- 0xf6fb2299,
- 0xf523f357,
- 0xa6327623,
- 0x93a83531,
- 0x56cccd02,
- 0xacf08162,
- 0x5a75ebb5,
- 0x6e163697,
- 0x88d273cc,
- 0xde966292,
- 0x81b949d0,
- 0x4c50901b,
- 0x71c65614,
- 0xe6c6c7bd,
- 0x327a140a,
- 0x45e1d006,
- 0xc3f27b9a,
- 0xc9aa53fd,
- 0x62a80f00,
- 0xbb25bfe2,
- 0x35bdd2f6,
- 0x71126905,
- 0xb2040222,
- 0xb6cbcf7c,
- 0xcd769c2b,
- 0x53113ec0,
- 0x1640e3d3,
- 0x38abbd60,
- 0x2547adf0,
- 0xba38209c,
- 0xf746ce76,
- 0x77afa1c5,
- 0x20756060,
- 0x85cbfe4e,
- 0x8ae88dd8,
- 0x7aaaf9b0,
- 0x4cf9aa7e,
- 0x1948c25c,
- 0x02fb8a8c,
- 0x01c36ae4,
- 0xd6ebe1f9,
- 0x90d4f869,
- 0xa65cdea0,
- 0x3f09252d,
- 0xc208e69f,
- 0xb74e6132,
- 0xce77e25b,
- 0x578fdfe3,
- 0x3ac372e6 };
-public void decipher(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
- int xL = lastDecipherXL;
- int xR = lastDecipherXR;
-
- int dataXL;
- int dataXR;
-
- int[] xLxR = new int[2];
-
- for (int i = 0; i < len; i = i + 8) {
- dataXL = (src[srcOff + i] & 0xff) | ((src[srcOff + i + 1] & 0xff) << 8) | ((src[srcOff + i + 2] & 0xff) << 16) | ((src[srcOff + i + 3] & 0xff) << 24);
- dataXR = (src[srcOff + i + 4] & 0xff) | ((src[srcOff + i + 5] & 0xff) << 8) | ((src[srcOff + i + 6] & 0xff) << 16) | ((src[srcOff + i + 7] & 0xff) << 24);
-
- decipher(dataXL, dataXR, xLxR);
-
- xL ^= xLxR[0];
- xR ^= xLxR[1];
-
- dst[dstOff + i] = (byte) (xL & 0xff);
- dst[dstOff + i + 1] = (byte) ((xL >> 8) & 0xff);
- dst[dstOff + i + 2] = (byte) ((xL >> 16) & 0xff);
- dst[dstOff + i + 3] = (byte) ((xL >> 24) & 0xff);
- dst[dstOff + i + 4] = (byte) (xR & 0xff);
- dst[dstOff + i + 5] = (byte) ((xR >> 8) & 0xff);
- dst[dstOff + i + 6] = (byte) ((xR >> 16) & 0xff);
- dst[dstOff + i + 7] = (byte) ((xR >> 24) & 0xff);
-
- xL = dataXL;
- xR = dataXR;
- }
-
- lastDecipherXL = xL;
- lastDecipherXR = xR;
-}
-private void decipher(int xL, int xR, int[] xLxR) {
- xL ^= P[17];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[16];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[15];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[14];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[13];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[12];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[11];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[10];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[9];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[8];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[7];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[6];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[5];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[4];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[3];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[2];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[1];
- xR ^= P[0];
-
- xLxR[0] = xR;
- xLxR[1] = xL;
-}
-public void encipher(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
- int xL = lastEncipherXL;
- int xR = lastEncipherXR;
-
- int[] xLxR = new int[2];
-
- for (int i = 0; i < len; i = i + 8) {
- xL ^= (src[srcOff + i] & 0xff) | ((src[srcOff + i + 1] & 0xff) << 8) | ((src[srcOff + i + 2] & 0xff) << 16) | ((src[srcOff + i + 3] & 0xff) << 24);
- xR ^= (src[srcOff + i + 4] & 0xff) | ((src[srcOff + i + 5] & 0xff) << 8) | ((src[srcOff + i + 6] & 0xff) << 16) | ((src[srcOff + i + 7] & 0xff) << 24);
-
- encipher(xL, xR, xLxR);
-
- xL = xLxR[0];
- xR = xLxR[1];
-
- dst[dstOff + i] = (byte) (xL & 0xff);
- dst[dstOff + i + 1] = (byte) ((xL >> 8) & 0xff);
- dst[dstOff + i + 2] = (byte) ((xL >> 16) & 0xff);
- dst[dstOff + i + 3] = (byte) ((xL >> 24) & 0xff);
- dst[dstOff + i + 4] = (byte) (xR & 0xff);
- dst[dstOff + i + 5] = (byte) ((xR >> 8) & 0xff);
- dst[dstOff + i + 6] = (byte) ((xR >> 16) & 0xff);
- dst[dstOff + i + 7] = (byte) ((xR >> 24) & 0xff);
- }
-
- lastEncipherXL = xL;
- lastEncipherXR = xR;
-}
-private void encipher(int xL, int xR, int[] xLxR) {
- xL ^= P[0];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[1];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[2];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[3];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[4];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[5];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[6];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[7];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[8];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[9];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[10];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[11];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[12];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[13];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[14];
- xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[15];
- xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[16];
- xR ^= P[17];
-
- xLxR[0] = xR;
- xLxR[1] = xL;
-}
-public void setKey(byte key[]) {
- int data = 0;
- int offset = 0;
-
- for (int i = 0; i < P.length; ++i) {
- P[i] = INIT_DATA[offset++];
- }
-
- for (int i = 0; i < S.length; ++i) {
- for (int j = 0; j < S[i].length; ++j) {
- S[i][j] = INIT_DATA[offset++];
- }
- }
-
- offset = 0;
- for (int i = 0; i < P.length; ++i) {
- data = 0;
- for (int k = 0; k < 4; ++k) {
- data = (data << 8) | (key[offset++] & 0xff);
- if (offset >= key.length) {
- offset = 0;
- }
- }
- P[i] = P[i] ^ data;
- }
-
- int[] lr = new int[] { 0, 0 };
- for (int i = 0; i < P.length; i += 2) {
- encipher(lr[0], lr[1], lr);
- P[i] = lr[0];
- P[i + 1] = lr[1];
- }
-
- for (int i = 0; i < S.length; ++i) {
- for (int j = 0; j < S[i].length; j += 2) {
- encipher(lr[0], lr[1], lr);
- S[i][j] = lr[0];
- S[i][j + 1] = lr[1];
- }
- }
-
- lastEncipherXL = 0;
- lastEncipherXR = 0;
- lastDecipherXL = 0;
- lastDecipherXR = 0;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java
deleted file mode 100644
index 2e55a3ae6..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.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.ccvs.ssh;
-
-public abstract class Cipher {
-public abstract void decipher(byte[] src, int srcPos, byte[] dst, int dstPos, int len);
-public abstract void encipher(byte[] src, int srcPos, byte[] dst, int dstPos, int len);
-public static Cipher getInstance(String algorithm) {
- try {
- Class c = Class.forName("org.eclipse.team.internal.ccvs.ssh." + algorithm); //$NON-NLS-1$
- return (Cipher) c.newInstance();
- } catch (Exception e) {
- return null;
- }
-}
-public abstract void setKey(byte[] key);
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java
deleted file mode 100644
index cd2e60214..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java
+++ /dev/null
@@ -1,724 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-/**
- * An SSH 1.5 client..
- */
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.net.Socket;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.core.streams.PollingInputStream;
-import org.eclipse.team.internal.core.streams.PollingOutputStream;
-import org.eclipse.team.internal.core.streams.TimeoutOutputStream;
-
-public class Client {
- // client identification string
- private static final String clientId = "SSH-1.5-Java 1.2.2\n"; //$NON-NLS-1$
-
- // server identification string
- private static String serverId = null;
-
- // maximum outgoing packet size
- private static final int MAX_CLIENT_PACKET_SIZE = 1024;
-
- // packet types
- private static final int SSH_MSG_DISCONNECT = 1;
- private static final int SSH_SMSG_PUBLIC_KEY = 2;
- private static final int SSH_CMSG_SESSION_KEY = 3;
- private static final int SSH_CMSG_USER = 4;
- private static final int SSH_CMSG_AUTH_PASSWORD = 9;
- private static final int SSH_CMSG_REQUEST_PTY = 10;
- private static final int SSH_CMSG_EXEC_SHELL = 12;
- private static final int SSH_CMSG_EXEC_CMD = 13;
- private static final int SSH_SMSG_SUCCESS = 14;
- private static final int SSH_SMSG_FAILURE = 15;
- private static final int SSH_CMSG_STDIN_DATA = 16;
- private static final int SSH_SMSG_STDOUT_DATA = 17;
- private static final int SSH_SMSG_STDERR_DATA = 18;
- private static final int SSH_SMSG_EXITSTATUS = 20;
- private static final int SSH_CMSG_EXIT_CONFIRMATION = 33;
- private static final int SSH_MSG_DEBUG = 36;
-
- // cipher names
- private static String[] cipherNames = { "None", "IDEA", "DES", "3DES", "TSS", "RC4", "Blowfish" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-
- // cipher types
- private static int SSH_CIPHER_NONE = 0;
- private static int SSH_CIPHER_IDEA = 1;
- private static int SSH_CIPHER_DES = 2;
- private static int SSH_CIPHER_3DES = 3;
- private static int SSH_CIPHER_TSS = 4;
- private static int SSH_CIPHER_RC4 = 5;
- private static int SSH_CIPHER_BLOWFISH = 6;
-
- // preferred cipher types
- private int[] preferredCipherTypes = { SSH_CIPHER_BLOWFISH };
-
- // authentication methods
- private final int SSH_AUTH_RHOSTS = 1;
- private final int SSH_AUTH_RSA = 2;
- private final int SSH_AUTH_PASSWORD = 3;
- private final int SSH_AUTH_RHOSTS_RSA = 4;
-
- private String host;
- private int port;
- private String username;
- private String password;
- private String command;
-
- private Socket socket;
- private InputStream socketIn;
- private PollingOutputStream socketOut;
- private InputStream is;
- private OutputStream os;
- private boolean connected = false;
- private int timeout = -1;
-
- private Cipher cipher = null;
-
- private class StandardInputStream extends InputStream {
- private ServerPacket packet = null;
- private InputStream buffer = null;
- private int buflen = 0;
- private boolean atEnd = false;
- private boolean closed = false;
- private int exitStatus = 0;
-
- public int available() throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed")); //$NON-NLS-1$
- }
-
- int available = buffer == null ? 0 : buffer.available();
-
- if (available == 0 && socketIn.available() > 0) {
- fill();
- if (atEnd) {
- return 0;
- }
- available = buffer.available();
- }
-
- return available;
- }
-
- public void close() throws IOException {
- if (!closed) {
- closed = true;
- if (packet != null) {
- packet.close(false);
- buffer = null;
- packet = null;
- buflen = 0;
- }
- }
- }
-
- public int read() throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- if (atEnd) {
- return -1;
- }
-
- if (buffer == null || buffer.available() == 0) {
- fill();
- if (atEnd) {
- return -1;
- }
- }
-
- return buffer.read();
- }
-
- public int read(byte b[], int off, int len) throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- if (atEnd) {
- return -1;
- }
-
- if (buffer == null || buffer.available() == 0) {
- fill();
- if (atEnd) {
- return -1;
- }
- }
-
- return buffer.read(b, off, len);
- }
-
- private void fill() throws IOException {
- if (buffer != null) {
- buffer.close();
- }
-
- packet = skip_SSH_MSG_DEBUG();
- int packetType = packet.getType();
-
- switch (packetType) {
- case SSH_SMSG_STDOUT_DATA :
- case SSH_SMSG_STDERR_DATA :
- case SSH_MSG_DEBUG :
- buffer = packet.getInputStream();
- buflen = Misc.readInt(buffer);
- break;
- case SSH_SMSG_EXITSTATUS :
- buffer = null;
- buflen = 0;
- atEnd = true;
- InputStream pis = packet.getInputStream();
- exitStatus = Misc.readInt(pis);
- pis.close();
- send(SSH_CMSG_EXIT_CONFIRMATION, null);
- break;
- case SSH_MSG_DISCONNECT :
- buffer = null;
- buflen = 0;
- atEnd = true;
- handleDisconnect(packet.getInputStream());
- break;
- default :
- throw new IOException(Policy.bind("Client.packetType", new Object[] {new Integer(packetType)} ));//$NON-NLS-1$
- }
- }
-
- private void handleDisconnect(InputStream in) throws IOException {
- String description = null;
- try {
- description = Misc.readString(in);
- } catch (IOException e) {
- } finally {
- in.close();
- }
-
- // Log the description provided by the server
- if (description == null) {
- description = Policy.bind("Client.noDisconnectDescription"); //$NON-NLS-1$
- }
-
- // Throw an IOException with the proper text
- throw new IOException(Policy.bind("Client.disconnectDescription", new Object[] {description}));//$NON-NLS-1$
- }
- }
-
- private class StandardOutputStream extends OutputStream {
- private int MAX_BUFFER_SIZE = MAX_CLIENT_PACKET_SIZE;
- private byte[] buffer = new byte[MAX_BUFFER_SIZE];
- private int bufpos = 0;
- private boolean closed = false;
-
- public void close() throws IOException {
- if (!closed) {
- try {
- flush();
- } finally {
- closed = true;
- }
- }
- }
-
- public void flush() throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- if (bufpos > 0) {
- send(SSH_CMSG_STDIN_DATA, buffer, 0, bufpos);
- bufpos = 0;
- }
- }
-
- public void write(int b) throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- buffer[bufpos++] = (byte) b;
-
- if (bufpos == MAX_BUFFER_SIZE) {
- flush();
- }
- }
-
- public void write(byte b[], int off, int len) throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed")); //$NON-NLS-1$
- }
-
- int bytesWritten = 0;
- int totalBytesWritten = 0;
-
- if (bufpos > 0) {
- bytesWritten = Math.min(MAX_BUFFER_SIZE - bufpos, len);
- System.arraycopy(b, off, buffer, bufpos, bytesWritten);
- bufpos += bytesWritten;
- totalBytesWritten += bytesWritten;
-
- if (bufpos == MAX_BUFFER_SIZE) {
- flush();
- }
- }
-
- while (len - totalBytesWritten >= MAX_BUFFER_SIZE) {
- send(SSH_CMSG_STDIN_DATA, b, off + totalBytesWritten, MAX_BUFFER_SIZE);
- totalBytesWritten += MAX_BUFFER_SIZE;
- }
-
- if (totalBytesWritten < len) {
- bytesWritten = len - totalBytesWritten;
- System.arraycopy(b, off + totalBytesWritten, buffer, 0, bytesWritten);
- bufpos += bytesWritten;
- }
- }
- }
-public Client(String host, int port, String username, String password) {
- this.host = host;
- this.port = port;
- this.username = username;
- this.password = password;
-}
-public Client(String host, int port, String username, String password, String command) {
- this(host, port, username, password);
- this.command = command;
-}
-public Client(String host, int port, String username, String password, String command, int timeout) {
- this(host, port, username, password, command);
- this.timeout = timeout;
-}
-/**
- * Close all streams and sockets.
- */
-private void cleanup() throws IOException {
- try {
- if (is != null)
- is.close();
- } finally {
- try {
- if (os != null)
- os.close();
- } finally {
- try {
- if (socketIn != null)
- socketIn.close();
- } finally {
- try {
- if (socketOut != null)
- socketOut.close();
- } finally {
- try {
- if (socket != null)
- socket.close();
- } finally {
- socket = null;
- }
- }
- }
- }
- }
-}
-/**
- * Connect to the remote server. If an exception is thrown, the caller
- * can asssume that all streams and sockets are closed.
- */
-public void connect(IProgressMonitor monitor) throws IOException, CVSAuthenticationException {
- // If we're already connected, just ignore the invokation
- if (connected)
- return;
-
- // Otherwise, set up the connection
- try {
- PollingInputStream pollingInputStream = null;
- // Create the socket (the socket should always be null here)
- if (socket == null) {
- try {
- socket = Util.createSocket(host, port, monitor);
- // Bug 36351: disable buffering and send bytes immediately
- socket.setTcpNoDelay(true);
- } catch (InterruptedIOException e) {
- // If we get this exception, chances are the host is not responding
- throw new InterruptedIOException(Policy.bind("Client.socket", new Object[] {host}));//$NON-NLS-1$
-
- }
- if (timeout >= 0) {
- socket.setSoTimeout(1000);
- }
- pollingInputStream = new PollingInputStream(socket.getInputStream(),
- timeout > 0 ? timeout : 1, monitor);
- socketIn = new BufferedInputStream(pollingInputStream);
-
- socketOut = new PollingOutputStream(new TimeoutOutputStream(
- socket.getOutputStream(), 8192 /*bufferSize*/, 1000 /*writeTimeout*/, 1000 /*closeTimeout*/),
- timeout > 0 ? timeout : 1, monitor);
- }
-
- // read the ssh server id. The socket creation may of failed if the
- // server cannot accept our connection request. We don't expect the
- // socket to be closed at this point.
- // Don't allow cancellation during the initial handshake and login since this
- // can potentially cause the SSH server to think that it is being hacked and
- // disable the account.
- socketOut.setIsCancellable(false /* don't allow cancellation */);
- pollingInputStream.setIsCancellable(false);
- StringBuffer buf = new StringBuffer();
- int c;
- while ((c = socketIn.read()) != '\n') {
- if (c == -1)
- throw new IOException(Policy.bind("Client.socketClosed"));//$NON-NLS-1$
- buf.append((char) c);
- }
- serverId = buf.toString();
-
- if (Policy.DEBUG_SSH_PROTOCOL) {
- System.out.println("SSH > server ID: " + serverId); //$NON-NLS-1$
- System.out.println("SSH > client ID: " + clientId); //$NON-NLS-1$
- }
-
- if (!serverId.startsWith("SSH-1.")) { //$NON-NLS-1$
- String sshVersion = (serverId.startsWith("SSH-")? serverId:""); //$NON-NLS-1$ //$NON-NLS-2$
- throw new IOException(Policy.bind("Client.sshProtocolVersion", sshVersion));//$NON-NLS-1$
- }
-
- // send our id.
- socketOut.write(clientId.getBytes());
- socketOut.flush();
-
- login();
-
- socketOut.setIsCancellable(true /* allow cancellation */);
- pollingInputStream.setIsCancellable(true);
-
- // start a shell and enter interactive session or start by
- // executing the given command.
- if( command == null ) {
- startShell();
- } else {
- executeCommand();
- }
-
- is = new StandardInputStream();
- os = new StandardOutputStream();
- connected = true;
- // If an exception occurs while connected, make sure we disconnect before passing the exception on
- } finally {
- if (! connected) cleanup();
- }
-}
-/**
- * Terminate the connection to the server.
- */
-public void disconnect() throws IOException {
- if (Policy.DEBUG_SSH_PROTOCOL) {
- System.out.println("Disconnecting."); //$NON-NLS-1$
- }
- if (connected) {
- connected = false;
- try {
- send(SSH_MSG_DISCONNECT, null);
- } finally {
- cleanup();
- }
- }
-}
-public InputStream getInputStream() throws IOException {
- if (!connected) {
- throw new IOException(Policy.bind("Client.notConnected"));//$NON-NLS-1$
- }
-
- return is;
-}
-public OutputStream getOutputStream() throws IOException {
- if (!connected) {
- throw new IOException(Policy.bind("Client.notConnected"));//$NON-NLS-1$
- }
-
- return os;
-}
-
-private void startShell() throws IOException {
- ServerPacket packet = null;
- int packetType;
-
- send_SSH_CMSG_REQUEST_PTY();
-
- try {
- packet = skip_SSH_MSG_DEBUG();
- packetType = packet.getType();
-
- if (packetType != SSH_SMSG_SUCCESS) {
- throw new IOException(Policy.bind("Client.packetType", new Object[] {new Integer(packetType)} ));//$NON-NLS-1$
- }
- } finally {
- if (packet != null) {
- packet.close(true /*perform crc check*/);
- }
- }
-
- send(SSH_CMSG_EXEC_SHELL, null);
-}
-
-private void executeCommand() throws IOException {
- send(SSH_CMSG_EXEC_CMD, command);
-}
-
-private void login() throws IOException, CVSAuthenticationException {
- ServerPacket packet = null;
- int packetType;
-
- try {
- packet = skip_SSH_MSG_DEBUG();
- packetType = packet.getType();
-
- if (packetType != SSH_SMSG_PUBLIC_KEY) {
- throw new IOException(Policy.bind("Client.packetType", new Object[] {new Integer(packetType)} ));//$NON-NLS-1$
- }
-
- receive_SSH_SMSG_PUBLIC_KEY(packet);
- } finally {
- if (packet != null) {
- packet.close(true);
- }
- }
-
- try {
- packet = skip_SSH_MSG_DEBUG();
- packetType = packet.getType();
-
- if (packetType != SSH_SMSG_SUCCESS) {
- throw new IOException(Policy.bind("Client.packetType", new Object[] {new Integer(packetType)} ));//$NON-NLS-1$
- }
- } finally {
- if (packet != null) {
- packet.close(true);
- }
- }
-
- send(SSH_CMSG_USER, username);
-
- try {
- packet = skip_SSH_MSG_DEBUG();
- packetType = packet.getType();
-
- if (packetType != SSH_SMSG_FAILURE) {
- throw new IOException(Policy.bind("Client.packetType", new Object[] {new Integer(packetType)} ));//$NON-NLS-1$
- }
- } finally {
- if (packet != null) {
- packet.close(true);
- }
- }
-
- send(SSH_CMSG_AUTH_PASSWORD, password);
-
- try {
- packet = skip_SSH_MSG_DEBUG();
- packetType = packet.getType();
-
- if (packetType == SSH_SMSG_FAILURE) {
- throw new CVSAuthenticationException(Policy.bind("Client.authenticationFailed"), CVSAuthenticationException.RETRY);//$NON-NLS-1$
- }
-
- if (packetType != SSH_SMSG_SUCCESS) {
- throw new IOException(Policy.bind("Client.packetType", new Object[] {new Integer(packetType)} ));//$NON-NLS-1$
- }
- } finally {
- if (packet != null) {
- packet.close(true);
- }
- }
-}
-private void receive_SSH_SMSG_PUBLIC_KEY(ServerPacket packet) throws IOException, CVSAuthenticationException {
- InputStream pis = packet.getInputStream();
-
- byte[] anti_spoofing_cookie = new byte[8];
- Misc.readFully(pis, anti_spoofing_cookie);
-
- byte[] server_key_bits = new byte[4];
- Misc.readFully(pis, server_key_bits);
-
- byte[] server_key_public_exponent = Misc.readMpInt(pis);
- byte[] server_key_public_modulus = Misc.readMpInt(pis);
-
- byte[] host_key_bits = new byte[4];
- Misc.readFully(pis, host_key_bits);
-
- byte[] host_key_public_exponent = Misc.readMpInt(pis);
- byte[] host_key_public_modulus = Misc.readMpInt(pis);
-
- byte[] protocol_flags = new byte[4];
- Misc.readFully(pis, protocol_flags);
-
- byte[] supported_ciphers_mask = new byte[4];
- Misc.readFully(pis, supported_ciphers_mask);
-
- byte[] supported_authentications_mask = new byte[4];
- Misc.readFully(pis, supported_authentications_mask);
-
- pis.close();
-
- send_SSH_CMSG_SESSION_KEY(anti_spoofing_cookie, host_key_bits, server_key_public_modulus, host_key_public_modulus, supported_ciphers_mask, server_key_public_exponent, host_key_public_exponent);
-}
-private void send(int packetType, String s) throws IOException {
- byte[] data = s == null ? new byte[0] : s.getBytes("UTF-8"); //$NON-NLS-1$
- send(packetType, data, 0, data.length);
-}
-private void send(int packetType, byte[] data, int off, int len) throws IOException {
- data = data == null ? null : Misc.lengthEncode(data, off, len);
- ClientPacket packet = new ClientPacket(packetType, data, cipher);
- socketOut.write(packet.getBytes());
- socketOut.flush();
-}
-private void send_SSH_CMSG_REQUEST_PTY() throws IOException {
- byte packet_type = SSH_CMSG_REQUEST_PTY;
-
- byte[] termType = Misc.lengthEncode("dumb".getBytes(), 0, 4);//$NON-NLS-1$
- byte[] row = {0, 0, 0, 0};
- byte[] col = {0, 0, 0, 0};
- byte[] XPixels = {0, 0, 0, 0};
- byte[] YPixels = {0, 0, 0, 0};
- byte[] terminalModes = {0};
-
- byte[] data = new byte[termType.length + row.length + col.length + XPixels.length + YPixels.length + terminalModes.length];
-
- int offset = 0;
- System.arraycopy(termType, 0, data, offset, termType.length);
-
- offset += termType.length;
- System.arraycopy(row, 0, data, offset, row.length);
-
- offset += row.length;
- System.arraycopy(col, 0, data, offset, col.length);
-
- offset += col.length;
- System.arraycopy(XPixels, 0, data, offset, XPixels.length);
-
- offset += XPixels.length;
- System.arraycopy(YPixels, 0, data, offset, YPixels.length);
-
- offset += YPixels.length;
- System.arraycopy(terminalModes, 0, data, offset, terminalModes.length);
-
- ClientPacket packet = new ClientPacket(packet_type, data, cipher);
- socketOut.write(packet.getBytes());
- socketOut.flush();
-}
-private void send_SSH_CMSG_SESSION_KEY(byte[] anti_spoofing_cookie, byte[] host_key_bits, byte[] server_key_public_modulus, byte[] host_key_public_modulus, byte[] supported_ciphers_mask, byte[] server_key_public_exponent, byte[] host_key_public_exponent) throws IOException, CVSAuthenticationException {
- byte packet_type = SSH_CMSG_SESSION_KEY;
-
- // session_id
- byte[] session_id = new byte[host_key_public_modulus.length + server_key_public_modulus.length + anti_spoofing_cookie.length];
-
- int offset = 0;
- System.arraycopy(host_key_public_modulus, 0, session_id, offset, host_key_public_modulus.length);
-
- offset += host_key_public_modulus.length;
- System.arraycopy(server_key_public_modulus, 0, session_id, offset, server_key_public_modulus.length);
-
- offset += server_key_public_modulus.length;
- System.arraycopy(anti_spoofing_cookie, 0, session_id, offset, anti_spoofing_cookie.length);
-
- session_id = Misc.md5(session_id);
-
- // cipher_type
- byte cipher_type = 0;
- boolean foundSupportedCipher = false;
-
- for (int i = 0; i < preferredCipherTypes.length && !foundSupportedCipher; ++i) {
- cipher_type = (byte) preferredCipherTypes[i];
- foundSupportedCipher = (supported_ciphers_mask[3] & (byte) (1 << cipher_type)) != 0;
- }
-
- if (!foundSupportedCipher) {
- throw new IOException(Policy.bind("Client.cipher"));//$NON-NLS-1$
- }
-
- // session_key
- byte[] session_key = new byte[32];
- byte[] session_key_xored = new byte[32];
- byte[] session_key_encrypted = null;
-
- Misc.random(session_key, 0, session_key.length, true);
- System.arraycopy(session_key, 0, session_key_xored, 0, session_key.length);
- Misc.xor(session_key_xored, 0, session_id, 0, session_key_xored, 0, session_id.length);
-
- BigInteger host_e = new BigInteger(1, host_key_public_exponent);
- BigInteger host_n = new BigInteger(1, host_key_public_modulus);
- if (!new KnownHosts().verifyKey(host, host_key_bits, host_e, host_n)) {
- throw new CVSAuthenticationException(Policy.bind("Client.hostIdChanged"), CVSAuthenticationException.NO_RETRY); //$NON-NLS-1$
- };
- byte[] result;
- if (new BigInteger(1,server_key_public_modulus).compareTo(host_n) == -1) {
- result = Misc.encryptRSAPkcs1(session_key_xored, server_key_public_exponent, server_key_public_modulus);
- result = Misc.encryptRSAPkcs1(result, host_key_public_exponent, host_key_public_modulus);
- } else {
- result = Misc.encryptRSAPkcs1(session_key_xored, host_key_public_exponent, host_key_public_modulus);
- result = Misc.encryptRSAPkcs1(result, server_key_public_exponent, server_key_public_modulus);
- }
-
- session_key_encrypted = new byte[result.length + 2];
- session_key_encrypted[1] = (byte) ((8 * result.length) & 0xff);
- session_key_encrypted[0] = (byte) (((8 * result.length) >> 8) & 0xff);
-
- for (int i = 0; i < result.length; i++) {
- session_key_encrypted[i + 2] = result[i];
- }
-
- // protocol_flags
- byte[] protocol_flags = {0, 0, 0, 0};
-
- // data
- byte[] data = new byte[1 + anti_spoofing_cookie.length + session_key_encrypted.length + protocol_flags.length];
-
- offset = 0;
- data[offset++] = (byte) cipher_type;
-
- System.arraycopy(anti_spoofing_cookie, 0, data, offset, anti_spoofing_cookie.length);
-
- offset += anti_spoofing_cookie.length;
- System.arraycopy(session_key_encrypted, 0, data, offset, session_key_encrypted.length);
-
- offset += session_key_encrypted.length;
- System.arraycopy(protocol_flags, 0, data, offset, protocol_flags.length);
-
- // cipher
- cipher = Cipher.getInstance(cipherNames[cipher_type]);
- cipher.setKey(session_key);
-
- // packet
- ClientPacket packet = new ClientPacket(packet_type, data, null);
- socketOut.write(packet.getBytes());
- socketOut.flush();
-}
-
-private ServerPacket skip_SSH_MSG_DEBUG() throws IOException {
- ServerPacket packet = new ServerPacket(socketIn, cipher);
- while (packet.getType() == SSH_MSG_DEBUG) {
- packet.close(true);
- packet = new ServerPacket(socketIn, cipher);
- }
-
- return packet;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java
deleted file mode 100644
index 7a8a7edfb..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.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.ccvs.ssh;
-
-class ClientPacket extends Packet {
- byte[] packet;
-public ClientPacket(int type, byte[] data, Cipher cipher) {
- packetLength = data == null ? 5 : data.length + 5;
- paddingLength = 8 - (packetLength % 8);
- packetType = type;
- packet = new byte[4 + paddingLength + packetLength];
-
- int packetOff = 0;
- Misc.writeInt(packetLength, packet, packetOff);
- packetOff += 4;
-
- if (cipher == null) {
- for (int i = 0; i < paddingLength; i++) {
- packet[packetOff++] = 0;
- }
- } else {
- Misc.random(packet, packetOff, paddingLength, false);
- packetOff += paddingLength;
- }
-
- packet[packetOff++] = (byte) packetType;
-
- if (data != null) {
- for (int i = 0; i < data.length; ++i) {
- packet[packetOff++] = data[i];
- }
- }
-
- long crc = Misc.crc32(packet, 4, packet.length - 8, 0);
- Misc.writeInt((int) crc, packet, packetOff);
- packetOff += 4;
-
- if (cipher != null) {
- cipher.encipher(packet, 4, packet, 4, packet.length - 4);
- }
-}
-public byte[] getBytes() {
- return packet;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java
deleted file mode 100644
index 489798852..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Vector;
-
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.ssh.Policy;
-
-/**
- * I represent a database of known hosts usually placed in ~/.ssh/known_hosts
- * on Unix/Linux systems.
- * Currently, only RSA keys are supported, as these are the only keys we
- * have to deal with during SSH1 key exchange.
- */
-public class KnownHosts {
-
- private String filename;
-
- public KnownHosts(String filename) {
- this.filename = filename;
- }
-
- public KnownHosts() {
- this.filename = KnownHosts.defaultFilename();
- }
-
- static String defaultFilename() {
- if (!BootLoader.getOS().equals(BootLoader.OS_LINUX)) return internalFilename();
- String HOME = System.getProperty("user.home"); //$NON-NLS-1$
- if (HOME==null) return internalFilename();
- return HOME+"/.ssh/known_hosts"; //$NON-NLS-1$
- }
-
- private static String internalFilename() {
- return SSHPlugin.getPlugin().getStateLocation().append("known_hosts").toOSString(); //$NON-NLS-1$
- }
-
- /**
- * Verify if the public key for the specified host is known.
- * If the public key matches, return true.
- * If the key does not match, return false.
- * If the key is not listed in <code>known_hosts</code>, or
- * <code>known_hosts</code> does not exist, assume we are connecting
- * to the authentic server, add the key, and return true.
- * @param e key exponent
- * @param n key modulus * @return boolean whether the key is correct */
- public boolean verifyKey(String hostname, byte[] host_key_bits, BigInteger e, BigInteger n) {
- FileReader f;
- BigInteger nbits = new BigInteger(1, host_key_bits);
- try {
- f= new FileReader(filename);
- } catch (FileNotFoundException ex) {
- createHostFile();
- addHost(hostname, nbits, e, n);
- return true;
- }
- BufferedReader r = new BufferedReader(f);
- try {
- boolean found = false;
- String line;
- while ((line = r.readLine()) != null) {
- if (line.trim().length()==0) continue;
- if (line.startsWith("#")) continue; //$NON-NLS-1$
- String[] tokens=subStrings(line);
- if (tokens.length==4 && Character.isDigit(tokens[1].charAt(0)) && tokens[0].equalsIgnoreCase(hostname)) {
- if (nbits.equals(new BigInteger(tokens[1])) && e.equals(new BigInteger(tokens[2])) && n.equals(new BigInteger(tokens[3]))) {
- f.close();
- return true;
- } else {
- f.close();
- return false;
- }
- }
- }
- f.close();
- addHost(hostname, nbits, e, n);
- return true;
- } catch (IOException ex) {
- SSHPlugin.log(IStatus.ERROR, Policy.bind("KnownHosts.8"), ex); //$NON-NLS-1$
- return false;
- }
- }
-
- /*
- * Append the host key information to known_hosts.
- * Always assume the file exists. */
- void addHost(String hostname, BigInteger key_bits, BigInteger e, BigInteger n) {
- try {
- FileWriter w = new FileWriter(defaultFilename(), true);
- w.write(Character.LINE_SEPARATOR);
- w.write(hostname + " " + key_bits.toString(10) + " " + e.toString(10) + " " + n.toString(10)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- w.close();
- String message = Policy.bind("Client.addedHostKey", new String[] {hostname, defaultFilename()}); //$NON-NLS-1$
- SSHPlugin.log(IStatus.INFO, message, null);
- } catch (IOException ex) {
- SSHPlugin.log(IStatus.ERROR, Policy.bind("KnownHosts.9"), ex); //$NON-NLS-1$
- }
- }
-
- /*
- * Create the known_hosts file in the default location.
- * Fail if the file can not be created (issue a warning in the log). */
- void createHostFile() {
- try {
- File file = new File(defaultFilename());
- // Ensure the parent directory exists
- File parentDir = file.getParentFile();
- parentDir.mkdirs();
- // Create the file
- file.createNewFile();
- } catch (IOException ee) {
- SSHPlugin.log(IStatus.ERROR, Policy.bind("KnownHosts.10"), ee); //$NON-NLS-1$
- }
-
- }
- private static String[] subStrings(String s) {
- Vector v = subStringsVector(s);
- String[] substrings = new String[v.size()];
- v.copyInto(substrings);
- return substrings;
- }
- private static Vector subStringsVector(String s) {
- Vector v = new Vector();
- s = s.trim();
- if (s.length()==0) return v;
- int first1 = s.indexOf(' ');
- int first2 = s.indexOf('\t');
- int first;
- if ((first1==-1)&&(first2==-1)) first=-1;
- else if ((first1!=-1)&&(first2!=-1)) first = Math.min(first1, first2);
- else if (first1!=-1) first=first1; else first=first2;
- if (first==-1) {
- v.add(s);
- return v;
- }
- v.add(s.substring(0,first));
- v.addAll(subStringsVector(s.substring(first+1)));
- return v;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java
deleted file mode 100644
index 8f61a04f2..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-
-class Misc {
- private static MessageDigest md5 = null;
- private static SecureRandom random = null;
- private static long crc32_tab[] = {
- 0x00000000L,
- 0x77073096L,
- 0xee0e612cL,
- 0x990951baL,
- 0x076dc419L,
- 0x706af48fL,
- 0xe963a535L,
- 0x9e6495a3L,
- 0x0edb8832L,
- 0x79dcb8a4L,
- 0xe0d5e91eL,
- 0x97d2d988L,
- 0x09b64c2bL,
- 0x7eb17cbdL,
- 0xe7b82d07L,
- 0x90bf1d91L,
- 0x1db71064L,
- 0x6ab020f2L,
- 0xf3b97148L,
- 0x84be41deL,
- 0x1adad47dL,
- 0x6ddde4ebL,
- 0xf4d4b551L,
- 0x83d385c7L,
- 0x136c9856L,
- 0x646ba8c0L,
- 0xfd62f97aL,
- 0x8a65c9ecL,
- 0x14015c4fL,
- 0x63066cd9L,
- 0xfa0f3d63L,
- 0x8d080df5L,
- 0x3b6e20c8L,
- 0x4c69105eL,
- 0xd56041e4L,
- 0xa2677172L,
- 0x3c03e4d1L,
- 0x4b04d447L,
- 0xd20d85fdL,
- 0xa50ab56bL,
- 0x35b5a8faL,
- 0x42b2986cL,
- 0xdbbbc9d6L,
- 0xacbcf940L,
- 0x32d86ce3L,
- 0x45df5c75L,
- 0xdcd60dcfL,
- 0xabd13d59L,
- 0x26d930acL,
- 0x51de003aL,
- 0xc8d75180L,
- 0xbfd06116L,
- 0x21b4f4b5L,
- 0x56b3c423L,
- 0xcfba9599L,
- 0xb8bda50fL,
- 0x2802b89eL,
- 0x5f058808L,
- 0xc60cd9b2L,
- 0xb10be924L,
- 0x2f6f7c87L,
- 0x58684c11L,
- 0xc1611dabL,
- 0xb6662d3dL,
- 0x76dc4190L,
- 0x01db7106L,
- 0x98d220bcL,
- 0xefd5102aL,
- 0x71b18589L,
- 0x06b6b51fL,
- 0x9fbfe4a5L,
- 0xe8b8d433L,
- 0x7807c9a2L,
- 0x0f00f934L,
- 0x9609a88eL,
- 0xe10e9818L,
- 0x7f6a0dbbL,
- 0x086d3d2dL,
- 0x91646c97L,
- 0xe6635c01L,
- 0x6b6b51f4L,
- 0x1c6c6162L,
- 0x856530d8L,
- 0xf262004eL,
- 0x6c0695edL,
- 0x1b01a57bL,
- 0x8208f4c1L,
- 0xf50fc457L,
- 0x65b0d9c6L,
- 0x12b7e950L,
- 0x8bbeb8eaL,
- 0xfcb9887cL,
- 0x62dd1ddfL,
- 0x15da2d49L,
- 0x8cd37cf3L,
- 0xfbd44c65L,
- 0x4db26158L,
- 0x3ab551ceL,
- 0xa3bc0074L,
- 0xd4bb30e2L,
- 0x4adfa541L,
- 0x3dd895d7L,
- 0xa4d1c46dL,
- 0xd3d6f4fbL,
- 0x4369e96aL,
- 0x346ed9fcL,
- 0xad678846L,
- 0xda60b8d0L,
- 0x44042d73L,
- 0x33031de5L,
- 0xaa0a4c5fL,
- 0xdd0d7cc9L,
- 0x5005713cL,
- 0x270241aaL,
- 0xbe0b1010L,
- 0xc90c2086L,
- 0x5768b525L,
- 0x206f85b3L,
- 0xb966d409L,
- 0xce61e49fL,
- 0x5edef90eL,
- 0x29d9c998L,
- 0xb0d09822L,
- 0xc7d7a8b4L,
- 0x59b33d17L,
- 0x2eb40d81L,
- 0xb7bd5c3bL,
- 0xc0ba6cadL,
- 0xedb88320L,
- 0x9abfb3b6L,
- 0x03b6e20cL,
- 0x74b1d29aL,
- 0xead54739L,
- 0x9dd277afL,
- 0x04db2615L,
- 0x73dc1683L,
- 0xe3630b12L,
- 0x94643b84L,
- 0x0d6d6a3eL,
- 0x7a6a5aa8L,
- 0xe40ecf0bL,
- 0x9309ff9dL,
- 0x0a00ae27L,
- 0x7d079eb1L,
- 0xf00f9344L,
- 0x8708a3d2L,
- 0x1e01f268L,
- 0x6906c2feL,
- 0xf762575dL,
- 0x806567cbL,
- 0x196c3671L,
- 0x6e6b06e7L,
- 0xfed41b76L,
- 0x89d32be0L,
- 0x10da7a5aL,
- 0x67dd4accL,
- 0xf9b9df6fL,
- 0x8ebeeff9L,
- 0x17b7be43L,
- 0x60b08ed5L,
- 0xd6d6a3e8L,
- 0xa1d1937eL,
- 0x38d8c2c4L,
- 0x4fdff252L,
- 0xd1bb67f1L,
- 0xa6bc5767L,
- 0x3fb506ddL,
- 0x48b2364bL,
- 0xd80d2bdaL,
- 0xaf0a1b4cL,
- 0x36034af6L,
- 0x41047a60L,
- 0xdf60efc3L,
- 0xa867df55L,
- 0x316e8eefL,
- 0x4669be79L,
- 0xcb61b38cL,
- 0xbc66831aL,
- 0x256fd2a0L,
- 0x5268e236L,
- 0xcc0c7795L,
- 0xbb0b4703L,
- 0x220216b9L,
- 0x5505262fL,
- 0xc5ba3bbeL,
- 0xb2bd0b28L,
- 0x2bb45a92L,
- 0x5cb36a04L,
- 0xc2d7ffa7L,
- 0xb5d0cf31L,
- 0x2cd99e8bL,
- 0x5bdeae1dL,
- 0x9b64c2b0L,
- 0xec63f226L,
- 0x756aa39cL,
- 0x026d930aL,
- 0x9c0906a9L,
- 0xeb0e363fL,
- 0x72076785L,
- 0x05005713L,
- 0x95bf4a82L,
- 0xe2b87a14L,
- 0x7bb12baeL,
- 0x0cb61b38L,
- 0x92d28e9bL,
- 0xe5d5be0dL,
- 0x7cdcefb7L,
- 0x0bdbdf21L,
- 0x86d3d2d4L,
- 0xf1d4e242L,
- 0x68ddb3f8L,
- 0x1fda836eL,
- 0x81be16cdL,
- 0xf6b9265bL,
- 0x6fb077e1L,
- 0x18b74777L,
- 0x88085ae6L,
- 0xff0f6a70L,
- 0x66063bcaL,
- 0x11010b5cL,
- 0x8f659effL,
- 0xf862ae69L,
- 0x616bffd3L,
- 0x166ccf45L,
- 0xa00ae278L,
- 0xd70dd2eeL,
- 0x4e048354L,
- 0x3903b3c2L,
- 0xa7672661L,
- 0xd06016f7L,
- 0x4969474dL,
- 0x3e6e77dbL,
- 0xaed16a4aL,
- 0xd9d65adcL,
- 0x40df0b66L,
- 0x37d83bf0L,
- 0xa9bcae53L,
- 0xdebb9ec5L,
- 0x47b2cf7fL,
- 0x30b5ffe9L,
- 0xbdbdf21cL,
- 0xcabac28aL,
- 0x53b39330L,
- 0x24b4a3a6L,
- 0xbad03605L,
- 0xcdd70693L,
- 0x54de5729L,
- 0x23d967bfL,
- 0xb3667a2eL,
- 0xc4614ab8L,
- 0x5d681b02L,
- 0x2a6f2b94L,
- 0xb40bbe37L,
- 0xc30c8ea1L,
- 0x5a05df1bL,
- 0x2d02ef8dL
- };
-static public long crc32(byte[] b, int off, int len) {
- return crc32(b, off, len, 0);
-}
-/**
- * Compute the crc Cyclic Redundancy Check, with the polynomial 0xedb88320,
- * The polynomial is X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
- * We take it "backwards" and put the highest-order term in the lowest-order bit.
- * The X^32 term is "implied"; the LSB is the X^31 term, etc.
- * The X^0 term (usually shown as "+1") results in the MSB being 1.
- * so the poly is 0x04c11db7 (used for Ethernet)
- * The buf will be the Padding, Packet type, and Data fields.
- * The crc is computed before any encryption.
- * R =X^n * M rem P M message P polynomial crc R : crc calculated.
- * T(x) = x^n * M(x) + R(x) property: T rem P = 0
- */
-static public long crc32(byte[] b, int off, int len, long crc32val) {
- for (int i = 0; i < len; i++) {
- crc32val = crc32_tab[(int) ((crc32val ^ b[off + i]) & 0xff)] ^ (crc32val >> 8);
- }
-
- return crc32val;
-}
-static public byte[] lengthEncode(byte[] b, int off, int len) throws IOException {
- byte[] result = new byte[len + 4];
- writeInt(len, result, 0);
- System.arraycopy(b, off, result, 4, len);
- return result;
-}
-static public byte[] readMpInt(InputStream is) throws IOException {
- int a = is.read();
- int b = is.read();
-
- if(a == -1 || b == -1){
- throw new IOException(Policy.bind("stream"));//$NON-NLS-1$
- }
-
- int bits = ((a & 0xFF) << 8) + (b & 0xFF);
- int bytes = (bits + 7) / 8;
-
- byte[] result = new byte[bytes];
-
- readFully(is, result);
-
- return result;
-}
-public static byte[] md5(byte[] b) throws IOException {
- if (md5 == null) {
- try {
- md5 = MessageDigest.getInstance("MD5");//$NON-NLS-1$
- } catch (NoSuchAlgorithmException e) {
- throw new IOException(Policy.bind("Misc.missingMD5", e.getMessage())); //$NON-NLS-1$
- }
- }
-
- return md5.digest(b);
-}
-public static byte[] md5(String s) throws IOException {
- return md5(s.getBytes());
-}
-public static void readFully(InputStream is, byte[] b) throws IOException {
- readFully(is, b, 0, b.length);
-}
-public static void readFully(InputStream is, byte[] b, int off, int len) throws IOException {
- int bytesRead = 0;
- int totalBytesRead = 0;
-
- while (totalBytesRead < len) {
- bytesRead = is.read(b, totalBytesRead + off, len - totalBytesRead);
-
- if (bytesRead == -1) {
- throw new IOException(Policy.bind("stream"));//$NON-NLS-1$
- }
-
- totalBytesRead += bytesRead;
- }
-}
-public static int readInt(byte[] arr, int off) throws IOException {
- int a = arr[off] & 0xff;
- int b = arr[off + 1] & 0xff;
- int c = arr[off + 2] & 0xff;
- int d = arr[off + 3] & 0xff;
-
- return (a << 24) + (b << 16) + (c << 8) + d;
-}
-public static int readInt(InputStream is) throws IOException {
- int a = is.read();
- int b = is.read();
- int c = is.read();
- int d = is.read();
-
- if (a == -1 || b == -1 || c == -1 || d == -1) {
- throw new IOException(Policy.bind("stream"));//$NON-NLS-1$
- }
-
- return (a << 24) + (b << 16) + (c << 8) + d;
-}
-public static String readString(InputStream is) throws IOException {
- int size = Misc.readInt(is);
- byte[] buffer = new byte[size];
- for (int i = 0; i < buffer.length; i++) {
- int next = is.read();
- if (next == -1) {
- throw new IOException(Policy.bind("stream")); //$NON-NLS-1$
- } else {
- buffer[i] = (byte)next;
- }
- }
- return new String(buffer);
-}
-public static void skipFully(InputStream is, long n) throws IOException {
- while (n != 0) {
- int b = is.read();
-
- if (b == -1) {
- if (n > 0) {
- throw new IOException(Policy.bind("stream"));//$NON-NLS-1$
- }
-
- return;
- }
-
- --n;
- }
-}
-public static void writeInt(int i, byte[] b, int off) {
- b[off] = (byte) ((i >> 24) & 0xff);
- b[off + 1] = (byte) ((i >> 16) & 0xff);
- b[off + 2] = (byte) ((i >> 8) & 0xff);
- b[off + 3] = (byte) (i & 0xff);
-}
-static public void xor(byte[] src_a, int off_a, byte[] src_b, int off_b, byte[] dst, int dst_off, int len) {
- for(int i = 0; i < len; ++i){
- dst[i + dst_off] = (byte) (src_a[i + off_a] ^ src_b[i + off_b]);
- }
-}
-static public void random(byte[] b, int off, int len, boolean allowZeroBytes) {
- if (random == null) {
- try {
- random = SecureRandom.getInstance("SHA1PRNG");//$NON-NLS-1$
- } catch (NoSuchAlgorithmException e) {
- // If SHA1PRNG is not available, just use the default
- random = new SecureRandom();
- }
- }
-
- for(int i = off; i < off + len; ++i){
- do {
- b[i] = (byte) random.nextInt();
- } while(!allowZeroBytes && b[i] == 0);
- }
-}
-static public byte[] encryptRSAPkcs1(byte[] data, byte[] public_key_exponent, byte[] public_key_modulus) {
- byte[] block;
-
- int offset = 0;
- block = new byte[public_key_modulus.length];
- block[offset++] = 0;
- block[offset++] = 2;
-
- Misc.random(block, offset, block.length - data.length - 3, false);
- offset += block.length - data.length - 3;
-
- block[offset++] = 0;
-
- for (int i = 0; i < data.length; i++){
- block[offset++] = data[i];
- }
-
- BigInteger m, e, message;
- byte[] messageByte;
-
- m = new BigInteger(1, public_key_modulus);
- e = new BigInteger(1, public_key_exponent);
- message = new BigInteger(1, block);
- message = message.modPow(e, m);
-
- byte[] messageByteTemp = message.toByteArray();
- messageByte = new byte[public_key_modulus.length];
-
- int tempOffset = 0;
- while (messageByteTemp[tempOffset] == 0){
- tempOffset++;
- }
-
- for (int i = messageByte.length - messageByteTemp.length + tempOffset; i < messageByte.length; i++){
- messageByte[i] = messageByteTemp[tempOffset++];
- }
-
- return messageByte;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java
deleted file mode 100644
index b810ded94..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-class Packet {
- protected int packetLength;
- protected int paddingLength;
- protected int packetType;
-public int getType() {
- return packetType;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java
deleted file mode 100644
index 112db9ac4..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.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.ccvs.ssh;
-
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.Platform;
-
-public class Policy {
- protected static ResourceBundle bundle = null;
-
- //debug constants
- public static boolean DEBUG_SSH_PROTOCOL = false;
-
- static {
- //init debug options
- if (SSHPlugin.getPlugin().isDebugging()) {
- DEBUG_SSH_PROTOCOL = "true".equalsIgnoreCase(Platform.getDebugOption(SSHPlugin.ID + "/ssh_protocol"));//$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void localize(String bundleName) {
- bundle = ResourceBundle.getBundle(bundleName);
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given arguments. If the key is
- * not found, return the key.
- */
- public static String bind(String key, Object[] args) {
- try {
- return MessageFormat.format(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java
deleted file mode 100644
index 1c94171a6..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
-import org.eclipse.team.internal.ccvs.core.IServerConnection;
-
-public class SSHMethod implements IConnectionMethod {
- /**
- * @see IConnectionMethod#getName
- */
- public String getName() {
- return "extssh";//$NON-NLS-1$
- }
-
- /**
- * @see IConnectionMethod#createConnection
- */
- public IServerConnection createConnection(ICVSRepositoryLocation repositoryRoot, String password) {
- return new SSHServerConnection(repositoryRoot, password);
- }
-
- public void disconnect(ICVSRepositoryLocation location) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java
deleted file mode 100644
index 081c30580..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.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.ccvs.ssh;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-public class SSHPlugin extends Plugin {
-
- public static String ID = "org.eclipse.team.cvs.ssh"; //$NON-NLS-1$
-
- private static SSHPlugin instance;
-
- /**
- * Log the given exception along with the provided message and severity indicator
- */
- public static void log(int severity, String message, Throwable e) {
- getPlugin().getLog().log(new Status(severity, ID, 0, message, e));
- }
-
- /**
- * Constructor for SSHPlugin
- */
- public SSHPlugin(IPluginDescriptor d) {
- super(d);
- instance = this;
- }
-
- /**
- * @see Plugin#startup()
- */
- public void startup() throws CoreException {
- super.startup();
- Policy.localize("org.eclipse.team.internal.ccvs.ssh.messages"); //$NON-NLS-1$
- }
-
- /**
- * Method getPlugin.
- */
- public static SSHPlugin getPlugin() {
- return instance;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java
deleted file mode 100644
index 98e1d1904..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ssh;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IServerConnection;
-import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException;
-
-public class SSHServerConnection implements IServerConnection {
-
- // command to start remote cvs in server mode
- private static final String INVOKE_SVR_CMD = "cvs server"; //$NON-NLS-1$
-
- private static final int DEFAULT_PORT = 22;
-
- // cvs format for the repository (e.g. :extssh:user@host:/home/cvs/repo)
- private ICVSRepositoryLocation location;
-
- // password for user specified in repository location string
- private String password;
-
- // incoming from remote host
- InputStream inputStream;
-
- // outgoing to remote host
- OutputStream outputStream;
-
- // ssh client
- Client client;
-
- public SSHServerConnection(ICVSRepositoryLocation location, String password) {
- this.location = location;
- this.password = password;
- }
-
- public void close() throws IOException {
- client.disconnect();
- }
- /**
- * Returns the <code>InputStream</code> used to read data from the
- * server.
- */
- public InputStream getInputStream() {
- return inputStream;
- }
- /**
- * Returns the <code>OutputStream</code> used to send data to the
- * server.
- */
- public OutputStream getOutputStream() {
- return outputStream;
- }
-
- /**
- * Opens the connection and invokes cvs in server mode.
- *
- * @see Connection.open()
- */
- public void open(IProgressMonitor monitor) throws IOException, CVSAuthenticationException {
- monitor.subTask(Policy.bind("SSHServerConnection.authenticating")); //$NON-NLS-1$
- monitor.worked(1);
- String hostname = location.getHost();
- String username = location.getUsername();
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT)
- port = DEFAULT_PORT;
- // create the connection using host, username, and password
- client = new Client(hostname, port, username, password, INVOKE_SVR_CMD, location.getTimeout());
- client.connect(monitor);
- inputStream = client.getInputStream();
- outputStream = client.getOutputStream();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java
deleted file mode 100644
index d37a03bc1..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.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.ccvs.ssh;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-class ServerPacket extends Packet {
- private PacketInputStream pis = null;
-
- private static class PacketInputStream extends FilterInputStream {
- private static int MAX_BUFFER_SIZE = 1024;
-
- private byte[] buffer = new byte[MAX_BUFFER_SIZE];
- private int bufpos = 0;
- private int buflen = 0;
- private int bufrem = 0;
-
- private long remaining = 0;
- private Cipher cipher = null;
-
- private long crc = 0;
- private boolean closed = false;
-
- public PacketInputStream(InputStream in, long length, Cipher cipher) {
- super(in);
-
- this.remaining = length;
- this.cipher = cipher;
- }
-
- public int available() throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- return (int) Math.min(remaining - 4, Integer.MAX_VALUE);
- }
-
- public void close() throws IOException {
- close(true);
- }
-
- public void close(boolean doCrcCheck) throws IOException {
- if (!closed) {
- try {
- long toRead = doCrcCheck ? remaining - 4 : remaining;
-
- try {
- Misc.skipFully(this, toRead);
- } catch(IOException e) {
- // we tried our best, keep going
- }
-
- if(doCrcCheck) {
- if ((int) crc != Misc.readInt(buffer, bufpos)) {
- throw new IOException(Policy.bind("ServerPacket.crc"));//$NON-NLS-1$
- }
- }
- } finally {
- closed = true;
- }
- }
- }
-
- private void fill() throws IOException {
- if (bufrem > 0) {
- System.arraycopy(buffer, bufpos, buffer, 0, bufrem);
- }
-
- int totalBytesRead = bufrem;
- int read = 0;
- int toRead = (int)Math.min(remaining - totalBytesRead, MAX_BUFFER_SIZE - totalBytesRead);
-
- while (toRead > 0) {
- read = in.read(buffer, totalBytesRead, toRead);
-
- if (read == -1) {
- throw new IOException(Policy.bind("stream"));//$NON-NLS-1$
- }
-
- totalBytesRead += read;
- toRead -= read;
- }
-
- bufpos = 0;
-
- buflen = (totalBytesRead / 8) * 8;
- bufrem = totalBytesRead - buflen;
-
- if (cipher != null) {
- cipher.decipher(buffer, 0, buffer, 0, buflen);
- }
-
- crc = Misc.crc32(buffer, 0, buflen == remaining ? buflen - 4 : buflen, crc);
- }
-
- public int read() throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- if (remaining - 4 == 0) {
- return -1;
- }
-
- if (bufpos == buflen) {
- fill();
- }
-
- int b = buffer[bufpos] & 0xff;
-
- ++bufpos;
- --remaining;
-
- return b;
- }
-
- public int read(byte b[], int off, int len) throws IOException {
- if (closed) {
- throw new IOException(Policy.bind("closed"));//$NON-NLS-1$
- }
-
- if (remaining - 4 == 0) {
- return -1;
- }
-
- if (bufpos == buflen) {
- fill();
- }
-
- len = (int) Math.min(len, (buflen == remaining + bufpos ? buflen - 4 : buflen) - bufpos);
-
- System.arraycopy(buffer, bufpos, b, off, len);
-
- bufpos += len;
- remaining -= len;
-
- return len;
- }
- }
-public ServerPacket(InputStream is, Cipher cipher) throws java.io.IOException {
- packetLength = Misc.readInt(is);
- paddingLength = 8 - (packetLength % 8);
- pis = new PacketInputStream(is, packetLength + paddingLength, cipher);
- Misc.skipFully(pis, paddingLength);
- packetType = (byte) pis.read();
-}
-public void close(boolean doCrcCheck) throws IOException {
- pis.close(doCrcCheck);
-}
-public InputStream getInputStream() {
- return pis;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties
deleted file mode 100644
index 7cc4673a9..000000000
--- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties
+++ /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
-###############################################################################
-
-# String resources for vcm.core.cvs.ssh
-###########################
-
-closed=Closed
-stream=Unexpected end of stream
-
-Client.packetType=unexpected packet type: {0}
-Client.notConnected=Not connected
-Client.cipher=Supported cipher not found
-Client.socketClosed=Connection closed by server
-Client.authenticationFailed=Invalid username, password, host or repository
-Client.socket=Cannot connect to host: {0}
-Client.disconnectDescription=SSH server disconnected: {0}
-Client.noDisconnectDescription=No reason could be obtained.
-Client.sshProtocolVersion=Unsupported SSH protocol version: {0}
-Client.hostIdChanged=The server host key does not match the key previously stored. Either the host key has changed or there is a man-in-the-middle attack. Contact the server administrator
-Client.addedHostKey=Host key for {0} was not found in the list of known hosts stored in {1}. The key is being automatically added to the known_hosts file for you. This key, which is like a personal signature, is used by Eclipse to guarantee that the host it is communicating with is the correct one. If the Eclipse client detects a change in this key you will be notified.
-Client.sshProtocolVersion=Unsupported SSH protocol version: {0}
-
-ServerPacket.crc=crc error
-
-SSHServerConnection.authenticating=Authenticating over extssh
-
-Misc.missingMD5=The MD5 encryption algorithm is required but not available: {0}
-
-KnownHosts.8=Error reading host key file
-KnownHosts.9=Error writing host key file
-KnownHosts.10=Error creating host key file
diff --git a/bundles/org.eclipse.team.cvs.ssh2/.classpath b/bundles/org.eclipse.team.cvs.ssh2/.classpath
deleted file mode 100644
index 382214e75..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="lib" path="jsch-0.1.13.jar"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.team.cvs.ssh2/.cvsignore b/bundles/org.eclipse.team.cvs.ssh2/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.team.cvs.ssh2/.project b/bundles/org.eclipse.team.cvs.ssh2/.project
deleted file mode 100644
index 7073f7766..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/.project
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.team.cvs.ssh2</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.team.core</project>
- <project>org.eclipse.team.cvs.core</project>
- <project>org.eclipse.team.cvs.ssh</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.team.cvs.ssh2/about.html b/bundles/org.eclipse.team.cvs.ssh2/about.html
deleted file mode 100644
index a5e75280f..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/about.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th November, 2003</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). With the exception of the files listed below, all Content should be defined as the &quot;SWT&quot; and
-is provided to you under the terms and conditions of the Common Public License Version 1.0 (&quot;CPL&quot;).
-A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; shall mean the SWT.</p>
-
-<h3>Third Party Content</h3>
-
-<p>The Content includes items that have been sourced from third parties as follows:</p>
-
-<h4>JSch 0.1.13</h4>
-
-<p>The plug-in is based on software developed by Atsuhiko Yamanaka, JCraft, Inc., and others and
-made available at <a href="http://www.jcraft.com/">http://www.jcraft.com/</a>.
-
-<p>The following files shall be defined as the &quot;JSch&quot;:
-<ul>
- <li>jsch-0.1.13.jar</li>
-</ul>
-
-<p>Use of JSch is governed by the terms and conditions of the following license:</p>
-
-<blockquote>Copyright (c) 2002,2003 ymnk, JCraft,Inc. All rights reserved.<br>
-<br>
-Redistribution and use in source and binary forms, with or without<br>
-modification, are permitted provided that the following conditions are met:<br>
-<br>
- 1. Redistributions of source code must retain the above copyright notice,<br>
- this list of conditions and the following disclaimer.<br>
-<br>
- 2. Redistributions in binary form must reproduce the above copyright<br>
- notice, this list of conditions and the following disclaimer in<br>
- the documentation and/or other materials provided with the distribution.<br>
-<br>
- 3. The names of the authors may not be used to endorse or promote products<br>
- derived from this software without specific prior written permission.<br>
-<br>
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,<br>
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND<br>
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,<br>
-INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,<br>
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT<br>
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,<br>
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF<br>
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING<br>
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,<br>
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-</blockquote>
-
-<h3>Contributions</h3>
-
-<p>If you wish to provide modifications, enhancements and/or other code and/or documentation (&quot;Contributions&quot;) related to the JSch, such Contributions
-should be made to JCraft at <a href="http://www.jcraft.com/">http://www.jcraft.com/</a>.</p>
-
-<p>If you wish to provide Contributions related to any other part of the plug-in, any Contributions uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to the plug-in (but not to JSch) are
-provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.team.cvs.ssh2/build.properties b/bundles/org.eclipse.team.cvs.ssh2/build.properties
deleted file mode 100644
index 6da955575..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/build.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-bin.includes = about.html,\
- plugin.xml,\
- plugin.properties,\
- *.jar
-src.includes = about.html,\
- src/,\
- plugin.xml,\
- plugin.properties,\
- *.jar
-source.cvsssh2.jar = src/ \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh2/jsch-0.1.13.jar b/bundles/org.eclipse.team.cvs.ssh2/jsch-0.1.13.jar
deleted file mode 100644
index 4081f179e..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/jsch-0.1.13.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ssh2/plugin.properties b/bundles/org.eclipse.team.cvs.ssh2/plugin.properties
deleted file mode 100644
index 02b9439ce..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/plugin.properties
+++ /dev/null
@@ -1,14 +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:
-# Atsuhiko Yamanaka, JCraft,Inc. - initial API and implementation.
-# IBM Corporation - implementation
-###############################################################################
-providerName=Eclipse.org
-pluginName=CVS SSH2
-ssh2PreferencePage.name=SSH2 Connection Method
diff --git a/bundles/org.eclipse.team.cvs.ssh2/plugin.xml b/bundles/org.eclipse.team.cvs.ssh2/plugin.xml
deleted file mode 100644
index 30098d203..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/plugin.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<!-- =================================================================================== -->
-<!-- SSH2 Plug-in Manifest -->
-<!-- =================================================================================== -->
-<plugin
- id="org.eclipse.team.cvs.ssh2"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.team.ccvs.ssh2.CVSSSH2Plugin">
-
-<!-- =================================================================================== -->
-<!-- Runtime Libraries -->
-<!-- =================================================================================== -->
-<runtime>
- <library name="cvsssh2.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.team.ccvs.ssh2"/>
- </library>
- <library name="jsch-0.1.13.jar">
- <packages prefixes="com.jcraft.jsch"/>
- </library>
-</runtime>
-
-<!-- =================================================================================== -->
-<!-- Prerequisite Plug-ins -->
-<!-- =================================================================================== -->
-<requires>
- <import plugin="org.eclipse.core.boot"/>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.team.cvs.core"/>
- <import plugin="org.eclipse.team.core"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.team.cvs.ssh"/>
-</requires>
-
-<!-- =================================================================================== -->
-<!-- Extension Point: CVS connection method -->
-<!-- =================================================================================== -->
-<extension id="ssh2" point="org.eclipse.team.cvs.core.connectionmethods">
- <adapter>
- <run class="org.eclipse.team.ccvs.ssh2.CVSSSH2Method">
- <parameter name="trace" value="false"/>
- </run>
- </adapter>
-</extension>
-
-<!-- =================================================================================== -->
-<!-- Extension Point: Preference page -->
-<!-- =================================================================================== -->
-<extension point="org.eclipse.ui.preferencePages">
- <page
- name="%ssh2PreferencePage.name"
- category="org.eclipse.team.cvs.ui.CVSPreferences"
- class="org.eclipse.team.ccvs.ssh2.CVSSSH2PreferencePage"
- id="org.eclipse.team.cvs.ssh2.CVSSSH2Preferences">
- </page>
-</extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Method.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Method.java
deleted file mode 100644
index e6475b7de..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Method.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/*******************************************************************************
- * Copyright (c) 2003, Atsuhiko Yamanaka, JCraft,Inc. and others. All rights
- * reserved. This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: Atsuhiko Yamanaka, JCraft,Inc. - initial API and
- * implementation.
- ******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
-import org.eclipse.team.internal.ccvs.core.IServerConnection;
-import org.eclipse.team.internal.ccvs.ssh.SSHServerConnection;
-
-public class CVSSSH2Method implements IConnectionMethod {
- public String getName() {
- return "extssh"; //$NON-NLS-1$
- }
-
- public IServerConnection createConnection(ICVSRepositoryLocation root, String password) {
- IPreferenceStore store = CVSSSH2Plugin.getDefault().getPreferenceStore();
- // Support for user defined switching between SSH1 and SSH2 for now. Will
- // improve this to provide automatic server version detection.
- if(store.getBoolean(CVSSSH2PreferencePage.KEY_USE_SSH2)) {
- return new CVSSSH2ServerConnection(root, password);
- } else {
- return new SSHServerConnection(root, password);
- }
- }
-
- public void disconnect(ICVSRepositoryLocation location) {
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Plugin.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Plugin.java
deleted file mode 100644
index 02acf74f1..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2Plugin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/*******************************************************************************
- * Copyright (c) 2003, Atsuhiko Yamanaka, JCraft,Inc. and others. All rights
- * reserved. This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: Atsuhiko Yamanaka, JCraft,Inc. - initial API and
- * implementation.
- ******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-public class CVSSSH2Plugin extends AbstractUIPlugin {
-
- public static String ID = "org.eclipse.team.cvs.ssh2"; //$NON-NLS-1$
- private static CVSSSH2Plugin plugin;
-
- public CVSSSH2Plugin(IPluginDescriptor d) {
- super(d);
- plugin = this;
- }
-
- public static CVSSSH2Plugin getPlugin() {
- return plugin;
- }
-
- public void shutdown() throws org.eclipse.core.runtime.CoreException {
- JSchSession.shutdown();
- super.shutdown();
- }
-
- public static CVSSSH2Plugin getDefault() {
- return plugin;
- }
-
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- CVSSSH2PreferencePage.initDefaults(store);
- }
-
- public void startup() throws CoreException {
- Policy.localize("org.eclipse.team.ccvs.ssh2.messages"); //$NON-NLS-1$
- super.startup();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2PreferencePage.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2PreferencePage.java
deleted file mode 100644
index 1c14e7916..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2PreferencePage.java
+++ /dev/null
@@ -1,1137 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/**********************************************************************
-Copyright (c) 2003,2004 Atsuhiko Yamanaka, JCraft,Inc. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- Atsuhiko Yamanaka, JCraft,Inc. - initial API and implementation.
-**********************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.SftpException;
-import com.jcraft.jsch.SftpATTRS;
-import com.jcraft.jsch.KeyPair;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.Channel;
-import com.jcraft.jsch.ChannelSftp;
-import org.eclipse.team.ccvs.ssh2.Policy;
-
-public class CVSSSH2PreferencePage extends PreferencePage
- implements IWorkbenchPreferencePage {
-
- public static String KEY_PROXY="CVSSSH2PreferencePage.PROXY"; //$NON-NLS-1$
- public static String KEY_PROXY_TYPE="CVSSSH2PreferencePage.PROXY_TYPE"; //$NON-NLS-1$
- public static String KEY_PROXY_HOST="CVSSSH2PreferencePage.PROXY_HOST"; //$NON-NLS-1$
- public static String KEY_PROXY_PORT="CVSSSH2PreferencePage.PROXY_PORT"; //$NON-NLS-1$
- public static String KEY_PROXY_AUTH="CVSSSH2PreferencePage.PROXY_AUTH"; //$NON-NLS-1$
- public static String KEY_PROXY_USER="CVSSSH2PreferencePage.PROXY_USER"; //$NON-NLS-1$
- public static String KEY_PROXY_PASS="CVSSSH2PreferencePage.PROXY_PASS"; //$NON-NLS-1$
- public static String KEY_SSH2HOME="CVSSSH2PreferencePage.SSH2HOME"; //$NON-NLS-1$
- public static String KEY_KEYFILE="CVSSSH2PreferencePage.KEYFILE"; //$NON-NLS-1$
- public static String KEY_PRIVATEKEY="CVSSSH2PreferencePage.PRIVATEKEY"; //$NON-NLS-1$
-
- // Temporary preference for using ssh2 instead of ssh1
- public static String KEY_USE_SSH2="CVSSSH2PreferencePage.SSH2_USE_SSH2"; //$NON-NLS-1$
-
- static String SOCKS5="SOCKS5"; //$NON-NLS-1$
- static String HTTP="HTTP"; //$NON-NLS-1$
- private static String HTTP_DEFAULT_PORT="80"; //$NON-NLS-1$
- private static String SOCKS5_DEFAULT_PORT="1080"; //$NON-NLS-1$
- private static String privatekeys="id_dsa,id_rsa"; //$NON-NLS-1$
-
- static String DSA="DSA"; //$NON-NLS-1$
- static String RSA="RSA"; //$NON-NLS-1$
-
-// private DirectoryFieldEditor ssh2homeEditor;
-
- private Label ssh2HomeLabel;
- private Label proxyTypeLabel;
- private Label proxyHostLabel;
- private Label proxyPortLabel;
- private Label proxyUserLabel;
- private Label proxyPassLabel;
- private Label privateKeyLabel;
- private Combo proxyTypeCombo;
- private Text ssh2HomeText;
- private Text proxyHostText;
- private Text proxyPortText;
- private Text proxyUserText;
- private Text proxyPassText;
- private Text privateKeyText;
- private Button enableProxy;
- private Button enableAuth;
- private Button enableSSH2;
- private Button privateKeyAdd;
- private boolean useProxy;
- private boolean useAuth;
-
- private Label keyTypeLabel;
- private Combo keyTypeCombo;
- private Button ssh2HomeBrowse;
- private Button keyGenerate;
- private Button keyExport;
- private Button saveKeyPair;
- private Label keyCommentLabel;
- private Text keyCommentText;
- private Label keyFingerPrintLabel;
- private Text keyFingerPrintText;
- private Label keyPassphrase1Label;
- private Text keyPassphrase1Text;
- private Label keyPassphrase2Label;
- private Text keyPassphrase2Text;
- private Label publicKeylabel;
- private Text publicKeyText;
- private KeyPair kpair=null;
- private String kpairComment;
-
- public static final String AUTH_SCHEME = "";//$NON-NLS-1$
- public static final URL FAKE_URL;
-
- static {
- URL temp = null;
- try{
- temp = new URL("http://org.eclipse.team.cvs.ssh2");//$NON-NLS-1$
- }catch (MalformedURLException e){}
- FAKE_URL = temp;
- }
-
- public CVSSSH2PreferencePage() {
-// super(GRID);
- IPreferenceStore store=CVSSSH2Plugin.getDefault().getPreferenceStore();
- setPreferenceStore(store);
- setDescription(Policy.bind("CVSSSH2PreferencePage.18")); //$NON-NLS-1$
- }
-
- protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
-
- TabFolder tabFolder = new TabFolder(container, SWT.NONE);
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
- tabItem.setText(Policy.bind("CVSSSH2PreferencePage.19")); //$NON-NLS-1$
- tabItem.setControl(createGeneralPage(tabFolder));
-
- tabItem = new TabItem(tabFolder, SWT.NONE);
- tabItem.setText(Policy.bind("CVSSSH2PreferencePage.20")); //$NON-NLS-1$
- tabItem.setControl(createProxyPage(tabFolder));
-
- tabItem = new TabItem(tabFolder, SWT.NONE);
- tabItem.setText(Policy.bind("CVSSSH2PreferencePage.21")); //$NON-NLS-1$
- tabItem.setControl(createKeyManagementPage(tabFolder));
-
- IPreferenceStore store=CVSSSH2Plugin.getDefault().getPreferenceStore();
- initDefaults(store);
- initControls();
-
- Dialog.applyDialogFont(parent);
- return container;
- }
-
- private Control createGeneralPage(Composite parent) {
- Composite group=new Composite(parent, SWT.NULL);
- GridLayout layout=new GridLayout();
- layout.numColumns=3;
- group.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- group.setLayoutData(data);
-
- enableSSH2=new Button(group, SWT.CHECK);
- enableSSH2.setText(Policy.bind("CVSSSH2PreferencePage.22")); //$NON-NLS-1$
- GridData gd=new GridData();
- gd.horizontalSpan=3;
- enableSSH2.setLayoutData(gd);
-
- createSpacer(group, 3);
-
- ssh2HomeLabel=new Label(group, SWT.NONE);
- ssh2HomeLabel.setText(Policy.bind("CVSSSH2PreferencePage.23")); //$NON-NLS-1$
-
- ssh2HomeText=new Text(group, SWT.SINGLE | SWT.BORDER);
- ssh2HomeText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=1;
- ssh2HomeText.setLayoutData(gd);
-
- ssh2HomeBrowse=new Button(group, SWT.NULL);
- ssh2HomeBrowse.setText(Policy.bind("CVSSSH2PreferencePage.24")); //$NON-NLS-1$
- gd=new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan=1;
- ssh2HomeBrowse.setLayoutData(gd);
-
-
- createSpacer(group, 3);
-
- privateKeyLabel=new Label(group, SWT.NONE);
- privateKeyLabel.setText(Policy.bind("CVSSSH2PreferencePage.25")); //$NON-NLS-1$
-
- privateKeyText=new Text(group, SWT.SINGLE | SWT.BORDER);
- privateKeyText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=1;
- privateKeyText.setLayoutData(gd);
-
- privateKeyAdd=new Button(group, SWT.NULL);
- privateKeyAdd.setText(Policy.bind("CVSSSH2PreferencePage.26")); //$NON-NLS-1$
- gd=new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan=1;
- privateKeyAdd.setLayoutData(gd);
-
- ssh2HomeBrowse.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
- String home=ssh2HomeText.getText();
-
- if(!new File(home).exists()){
- while(true){
- int foo=home.lastIndexOf(java.io.File.separator, home.length());
- if(foo==-1)break;
- home=home.substring(0, foo);
- if(new File(home).exists())break;
- }
- }
-
- DirectoryDialog dd=new DirectoryDialog(getShell());
- dd.setFilterPath(home);
- dd.setMessage(Policy.bind("CVSSSH2PreferencePage.27")); //$NON-NLS-1$
- String dir=dd.open();
- if(dir==null){ // cancel
- return;
- }
- ssh2HomeText.setText(dir);
- }
- });
-
- privateKeyAdd.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
- String home=ssh2HomeText.getText();
-
- FileDialog fd=new FileDialog(getShell(), SWT.OPEN|SWT.MULTI);
- fd.setFilterPath(home);
- Object o=fd.open();
- if(o==null){ // cancel
- return;
- }
- String[] files=fd.getFileNames();
- String keys=privateKeyText.getText();
- String dir=fd.getFilterPath();
- if(dir.equals(home)){dir="";} //$NON-NLS-1$
- else{dir+=java.io.File.separator;}
-
- for(int i=0; i<files.length; i++){
- String foo=files[i];
- if(keys.length()!=0)keys=keys+",";
- keys=keys+dir+foo;
- }
- privateKeyText.setText(keys);
- }
- });
-
- return group;
- }
-
- private Control createProxyPage(Composite parent) {
- Composite group=new Composite(parent, SWT.NULL);
- GridLayout layout=new GridLayout();
- layout.numColumns=3;
- group.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- group.setLayoutData(data);
-
- enableProxy=new Button(group, SWT.CHECK);
- enableProxy.setText(Policy.bind("CVSSSH2PreferencePage.30")); //$NON-NLS-1$
- GridData gd=new GridData();
- gd.horizontalSpan=3;
- enableProxy.setLayoutData(gd);
-
- proxyTypeLabel=new Label(group, SWT.NONE);
- proxyTypeLabel.setText(Policy.bind("CVSSSH2PreferencePage.31")); //$NON-NLS-1$
- proxyTypeCombo=new Combo(group, SWT.READ_ONLY);
- proxyTypeCombo.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- proxyTypeCombo.setLayoutData(gd);
- proxyTypeCombo.addModifyListener(new ModifyListener () {
- public void modifyText(ModifyEvent e){
- if(proxyPortText==null) return;
- Combo combo=(Combo)(e.getSource());
- String foo=combo.getText();
- if(foo.equals(HTTP)){
- proxyPortText.setText(HTTP_DEFAULT_PORT);
- }
- else if(foo.equals(SOCKS5)){
- proxyPortText.setText(SOCKS5_DEFAULT_PORT);
- }
- }
- });
- proxyTypeCombo.add(HTTP);
- proxyTypeCombo.add(SOCKS5);
- proxyTypeCombo.select(0);
-
- proxyHostLabel=new Label(group, SWT.NONE);
- proxyHostLabel.setText(Policy.bind("CVSSSH2PreferencePage.32")); //$NON-NLS-1$
-
- proxyHostText=new Text(group, SWT.SINGLE | SWT.BORDER);
- proxyHostText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- proxyHostText.setLayoutData(gd);
-
- proxyPortLabel=new Label(group, SWT.NONE);
- proxyPortLabel.setText(Policy.bind("CVSSSH2PreferencePage.33")); //$NON-NLS-1$
-
- proxyPortText=new Text(group, SWT.SINGLE | SWT.BORDER);
- proxyPortText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- proxyPortText.setLayoutData(gd);
-
- proxyPortText.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
- if(isValidPort(proxyPortText.getText())){
- setErrorMessage(null);
- }
- }
- });
-
-
- createSpacer(group, 3);
-
- enableAuth=new Button(group, SWT.CHECK);
- enableAuth.setText(Policy.bind("CVSSSH2PreferencePage.34")); //$NON-NLS-1$
- gd=new GridData();
- gd.horizontalSpan=3;
- enableAuth.setLayoutData(gd);
-
- proxyUserLabel=new Label(group, SWT.NONE);
- proxyUserLabel.setText(Policy.bind("CVSSSH2PreferencePage.35")); //$NON-NLS-1$
-
- proxyUserText=new Text(group, SWT.SINGLE | SWT.BORDER);
- proxyUserText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- proxyUserText.setLayoutData(gd);
-
- proxyPassLabel=new Label(group, SWT.NONE);
- proxyPassLabel.setText(Policy.bind("CVSSSH2PreferencePage.36")); //$NON-NLS-1$
-
- proxyPassText=new Text(group, SWT.SINGLE | SWT.BORDER);
- proxyPassText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- proxyPassText.setLayoutData(gd);
-
- // performDefaults();
-
- enableProxy.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateControls();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- enableAuth.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateControls();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- return group;
- }
- private Control createKeyManagementPage(Composite parent) {
- int columnSpan=3;
- Composite group=new Composite(parent, SWT.NULL);
- GridLayout layout=new GridLayout();
- layout.numColumns=3;
- group.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- group.setLayoutData(data);
-
- keyTypeLabel=new Label(group, SWT.NONE);
- keyTypeLabel.setText(Policy.bind("CVSSSH2PreferencePage.37")); //$NON-NLS-1$
- keyTypeCombo=new Combo(group, SWT.READ_ONLY);
- keyTypeCombo.setFont(group.getFont());
- GridData gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- keyTypeCombo.setLayoutData(gd);
-
- keyGenerate=new Button(group, SWT.NULL);
- keyGenerate.setText(Policy.bind("CVSSSH2PreferencePage.38")); //$NON-NLS-1$
- gd=new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan=columnSpan;
- keyGenerate.setLayoutData(gd);
-
-/*
- keyLoad=new Button(group, SWT.NULL);
- keyLoad.setText("Load(not implemented)");
- gd=new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan=columnSpan;
- keyLoad.setLayoutData(gd);
-*/
-
- publicKeylabel=new Label(group, SWT.NONE);
- publicKeylabel.setText(Policy.bind("CVSSSH2PreferencePage.39")); //$NON-NLS-1$
- gd=new GridData();
- gd.horizontalSpan=columnSpan;
- publicKeylabel.setLayoutData(gd);
-
- publicKeyText=new Text(group,SWT.MULTI|SWT.BORDER|SWT.V_SCROLL|SWT.WRAP);
- publicKeyText.setText(""); //$NON-NLS-1$
- publicKeyText.setEditable(false);
- gd=new GridData();
- gd.horizontalSpan=columnSpan;
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- publicKeyText.setLayoutData(gd);
-
- keyExport=new Button(group, SWT.NULL);
- keyExport.setText(Policy.bind("CVSSSH2PreferencePage.105")); //$NON-NLS-1$
- gd=new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan=columnSpan;
- keyExport.setLayoutData(gd);
-
- keyFingerPrintLabel=new Label(group, SWT.NONE);
- keyFingerPrintLabel.setText(Policy.bind("CVSSSH2PreferencePage.41")); //$NON-NLS-1$
- keyFingerPrintText=new Text(group, SWT.SINGLE | SWT.BORDER);
- keyFingerPrintText.setFont(group.getFont());
- keyFingerPrintText.setEditable(false);
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- keyFingerPrintText.setLayoutData(gd);
-
- keyCommentLabel=new Label(group, SWT.NONE);
- keyCommentLabel.setText(Policy.bind("CVSSSH2PreferencePage.42")); //$NON-NLS-1$
- keyCommentText=new Text(group, SWT.SINGLE | SWT.BORDER);
- keyCommentText.setFont(group.getFont());
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- keyCommentText.setLayoutData(gd);
-
- keyCommentText.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
- if(kpair==null)return;
- try{
- ByteArrayOutputStream out=new ByteArrayOutputStream();
- kpair.writePublicKey(out, keyCommentText.getText());
- out.close();
- publicKeyText.setText(out.toString());
- }
- catch(IOException ee){}
- }});
-
- keyPassphrase1Label=new Label(group, SWT.NONE);
- keyPassphrase1Label.setText(Policy.bind("CVSSSH2PreferencePage.43")); //$NON-NLS-1$
- keyPassphrase1Text=new Text(group, SWT.SINGLE | SWT.BORDER);
- keyPassphrase1Text.setFont(group.getFont());
- keyPassphrase1Text.setEchoChar('*');
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- keyPassphrase1Text.setLayoutData(gd);
-
- keyPassphrase2Label=new Label(group, SWT.NONE);
- keyPassphrase2Label.setText(Policy.bind("CVSSSH2PreferencePage.44")); //$NON-NLS-1$
- keyPassphrase2Text=new Text(group, SWT.SINGLE | SWT.BORDER);
- keyPassphrase2Text.setFont(group.getFont());
- keyPassphrase2Text.setEchoChar('*');
- gd=new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan=2;
- keyPassphrase2Text.setLayoutData(gd);
-
- keyPassphrase1Text.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
- String pass1=keyPassphrase1Text.getText();
- String pass2=keyPassphrase2Text.getText();
- if(kpair!=null && pass1.equals(pass2)){
- saveKeyPair.setEnabled(true);
- }
- else{
- saveKeyPair.setEnabled(false);
- }
- if(pass2.length()==0){
- setErrorMessage(null);
- return;
- }
- if(pass1.equals(pass2)){
- setErrorMessage(null);
- }
- else{
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- }
- }
- });
-
- keyPassphrase2Text.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
- String pass1=keyPassphrase1Text.getText();
- String pass2=keyPassphrase2Text.getText();
- if(kpair!=null && pass1.equals(pass2)){
- saveKeyPair.setEnabled(true);
- }
- else{
- saveKeyPair.setEnabled(false);
- }
- if(pass2.length()<pass1.length()){
- if(pass1.startsWith(pass2)){
- setErrorMessage(null);
- }
- else{
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- }
- return;
- }
- if(pass1.equals(pass2)){
- setErrorMessage(null);
- }
- else{
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- }
- }
- });
-
- keyPassphrase2Text.addFocusListener(new FocusListener(){
- public void focusGained(FocusEvent e){
- String pass1=keyPassphrase1Text.getText();
- String pass2=keyPassphrase2Text.getText();
- if(pass2.length()<pass1.length()){
- if(pass1.startsWith(pass2)){
- setErrorMessage(null);
- }
- else{
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- }
- return;
- }
- if(pass1.equals(pass2)){
- setErrorMessage(null);
- }
- else{
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- }
- }
- public void focusLost(FocusEvent e){
- String pass1=keyPassphrase1Text.getText();
- String pass2=keyPassphrase2Text.getText();
- if(pass1.equals(pass2)){
- setErrorMessage(null);
- }
- else{
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- }
- }
- });
-
- saveKeyPair=new Button(group, SWT.NULL);
- saveKeyPair.setText(Policy.bind("CVSSSH2PreferencePage.45")); //$NON-NLS-1$
- gd=new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan=columnSpan;
- saveKeyPair.setLayoutData(gd);
-
- keyGenerate.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
- JSch jsch=JSchSession.getJSch();
- boolean ok=true;
- String _type=keyTypeCombo.getText();
-
- try{
- int type=0;
- if(_type.equals(DSA)){
- type=KeyPair.DSA;
- }
- else if(_type.equals(RSA)){
- type=KeyPair.RSA;
- }
- else{
- return;
- }
-
- final KeyPair[] _kpair=new KeyPair[1];
- final JSch _jsch=jsch;
- final int __type=type;
- final JSchException[] _e=new JSchException[1];
- BusyIndicator.showWhile(getShell().getDisplay(),
- new Runnable(){
- public void run(){
- try{
- _kpair[0]=KeyPair.genKeyPair(_jsch, __type);
- }catch(JSchException e){
- _e[0]=e;
- }
- }}
- );
- if(_e[0]!=null){
- throw _e[0];
- }
- kpair=_kpair[0];
-
- ByteArrayOutputStream out=new ByteArrayOutputStream();
- kpairComment=_type+"-1024"; //$NON-NLS-1$
- kpair.writePublicKey(out, kpairComment);
- out.close();
- publicKeyText.setText(out.toString());
- keyFingerPrintText.setText(kpair.getFingerPrint());
- keyCommentText.setText(kpairComment);
- updateControls();
- }
- catch(IOException ee){
- ok=false;
- }
- catch(JSchException ee){
- ok=false;
- }
- if(!ok){
- MessageDialog.openError(getShell(),
- Policy.bind("CVSSSH2PreferencePage.error"), //$NON-NLS-1$
- Policy.bind("CVSSSH2PreferencePage.47")); //$NON-NLS-1$
- }
- }
- });
-
- keyExport.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
- if(kpair==null)return;
-
- setErrorMessage(null);
-
- final String[] target=new String[1];
- final String title=Policy.bind("CVSSSH2PreferencePage.106"); //$NON-NLS-1$
- final String message=Policy.bind("CVSSSH2PreferencePage.107"); //$NON-NLS-1$
- Display.getDefault().syncExec(new Runnable(){
- public void run(){
- Display display=Display.getCurrent();
- Shell shell=new Shell(display);
- ExportDialog dialog=new ExportDialog(shell, title, message);
- dialog.open();
- shell.dispose();
- target[0]=dialog.getTarget();
- }});
- if(target[0]==null){
- return;
- }
- String user="";
- String host="";
- int port=22;
-
- if(target[0].indexOf('@')>0){
- user=target[0].substring(0, target[0].indexOf('@'));
- host=target[0].substring(target[0].indexOf('@')+1);
- }
- if(host.indexOf(':')>0){
- try{port=Integer.parseInt(host.substring(host.indexOf(':')+1));}
- catch(NumberFormatException ee) {
- port=-1;
- }
- host=host.substring(0, host.indexOf(':'));
- }
-
- if(user.length()==0 ||
- host.length()==0 ||
- port==-1){
- setErrorMessage(target[0]+Policy.bind("CVSSSH2PreferencePage.108")); //$NON-NLS-1$
- return;
- }
-
- String options="";
- try{
- ByteArrayOutputStream bos=new ByteArrayOutputStream();
- if(options.length()!=0){
- try{bos.write((options+" ").getBytes());}
- catch(IOException eeee){}
- }
- kpair.writePublicKey(bos, kpairComment);
- bos.close();
- export_via_sftp(user, host, port,
- ".ssh/authorized_keys",
- bos.toByteArray());
- }
- catch(IOException ee){
- }
- catch(JSchException ee){
- }
-
- }});
-
- saveKeyPair.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
- if(kpair==null)return;
-
- String pass=keyPassphrase1Text.getText();
- /*
- if(!pass.equals(keyPassphrase2Text.getText())){
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.48")); //$NON-NLS-1$
- return;
- }
- */
- if(pass.length()==0){
- if(!MessageDialog.openConfirm(getShell(),
- Policy.bind("CVSSSH2PreferencePage.confirmation"), //$NON-NLS-1$
- Policy.bind("CVSSSH2PreferencePage.49") //$NON-NLS-1$
- )){
- return ;
- }
- }
-
- kpair.setPassphrase(pass);
-
- IPreferenceStore store=CVSSSH2Plugin.getDefault().getPreferenceStore();
- String home=ssh2HomeText.getText();
-
- File _home=new File(home);
-
- if(!_home.exists()){
- if(!MessageDialog.openConfirm(getShell(),
- Policy.bind("CVSSSH2PreferencePage.confirmation"), //$NON-NLS-1$
- home+Policy.bind("CVSSSH2PreferencePage.50") //$NON-NLS-1$
- )){
- return ;
- }
- if(!_home.mkdirs()){
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.100")+home); //$NON-NLS-1$
- return;
- }
- }
-
- FileDialog fd=new FileDialog(getShell(), SWT.SAVE);
- fd.setFilterPath(home);
- String file=(kpair.getKeyType()==KeyPair.RSA) ? "id_rsa" : "id_dsa"; //$NON-NLS-1$ //$NON-NLS-2$
- fd.setFileName(file);
- file=fd.open();
- if(file==null){ // cancel
- return;
- }
-
- if(new File(file).exists()){
- if(!MessageDialog.openConfirm(getShell(),
- Policy.bind("CVSSSH2PreferencePage.confirmation"), //$NON-NLS-1$
- file+Policy.bind("CVSSSH2PreferencePage.53") //$NON-NLS-1$
- )){
- return;
- }
- }
-
- boolean ok=true;
- try{
- kpair.writePrivateKey(file);
- kpair.writePublicKey(file+".pub", kpairComment); //$NON-NLS-1$
- }
- catch(Exception ee){
- ok=false;
- }
-
- if(ok){
- MessageDialog.openInformation(getShell(),
- Policy.bind("CVSSSH2PreferencePage.information"), //$NON-NLS-2$
- Policy.bind("CVSSSH2PreferencePage.55")+ //$NON-NLS-1$
- "\n"+ //$NON-NLS-1$
- Policy.bind("CVSSSH2PreferencePage.57")+file+ //$NON-NLS-1$
- "\n"+ //$NON-NLS-1$
- Policy.bind("CVSSSH2PreferencePage.59")+ //$NON-NLS-1$
- file+
- ".pub");
- }
- }
- });
-
- keyTypeCombo.add(DSA);
- keyTypeCombo.add(RSA);
- keyTypeCombo.select(0);
-
- return group;
- }
-
- private void export_via_sftp(String user, String host, int port, String target, byte[] pkey) throws JSchException{
- try{
-
- /*
- int i=0;
- String authorized_keys=target;
- String dir="";
- String separator="/";
- i=target.lastIndexOf("/");
- if(i<0){
- i=target.lastIndexOf("\\");
- if(i>=0){ separator="\\"; }
- }
- else{
- }
- if(i>=0){
- authorized_keys=target.substring(i+1);
- dir=target.substring(0, i+1);
- }
- */
-
- String location=":extssh:dummy@dummy:/";
- CVSRepositoryLocation crl=CVSRepositoryLocation.fromString(location);
- IProgressMonitor pm=new org.eclipse.core.runtime.NullProgressMonitor();
- Session session=JSchSession.getSession(crl, user, "", host, port, pm);
- if(session.getServerVersion().indexOf("OpenSSH")==-1){
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.110"));
- return;
- }
- Channel channel=session.openChannel("sftp");
- channel.connect();
- ChannelSftp c=(ChannelSftp)channel;
-
- String pwd=c.pwd();
- SftpATTRS attr=null;
-
- try{ attr=c.stat(".ssh"); }
- catch(SftpException ee){ }
- if(attr==null){
- try{ c.mkdir(".ssh"); }
- catch(SftpException ee){
- setErrorMessage(ee.message);
- return;
- }
- }
- try{ c.cd(".ssh"); }
- catch(SftpException ee){
- setErrorMessage(ee.message);
- return;
- }
-
- try{
- ByteArrayInputStream bis=new ByteArrayInputStream(pkey);
- c.put(bis, "authorized_keys", null, ChannelSftp.APPEND);
- bis.close();
- checkPermission(c, "authorized_keys");
- checkPermission(c, "."); // .ssh
- c.cd("..");
- checkPermission(c, "."); // home directory
- }
- catch(SftpException ee){
- //setErrorMessage(debug+ee.message);
- }
-
- MessageDialog.openInformation(getShell(),
- Policy.bind("CVSSSH2PreferencePage.information"), //$NON-NLS-1$
- Policy.bind("CVSSSH2PreferencePage.109")+
- (user+"@"+host+(port==22 ? "" : ":"+port)+":~/.ssh/authorized_keys")); //$NON-NLS-1$
-
- c.disconnect();
- //session.disconnect();
- }
- catch(CVSException eee){
- }
- catch(IOException eee){
- setErrorMessage(eee.toString());
- }
- }
-
- private void checkPermission(ChannelSftp c, String path) throws SftpException{
- SftpATTRS attr=c.stat(path);
- int permissions=attr.getPermissions();
- if((permissions&00022)!=0){
- permissions&=~00022;
- c.chmod(permissions,path);
- }
- }
- private void updateControls() {
- boolean enable=enableProxy.getSelection();
- proxyTypeLabel.setEnabled(enable);
- proxyTypeCombo.setEnabled(enable);
- proxyPortLabel.setEnabled(enable);
- proxyPortText.setEnabled(enable);
- proxyHostLabel.setEnabled(enable);
- proxyHostText.setEnabled(enable);
-
- enableAuth.setEnabled(enable);
- enable&=enableAuth.getSelection();
- proxyUserLabel.setEnabled(enable);
- proxyUserText.setEnabled(enable);
- proxyPassLabel.setEnabled(enable);
- proxyPassText.setEnabled(enable);
-
- enable=(kpair!=null);
- publicKeylabel.setEnabled(enable);
- publicKeyText.setEnabled(enable);
- keyFingerPrintLabel.setEnabled(enable);
- keyFingerPrintText.setEnabled(enable);
- keyCommentLabel.setEnabled(enable);
- keyCommentText.setEnabled(enable);
- keyPassphrase1Label.setEnabled(enable);
- keyPassphrase1Text.setEnabled(enable);
- keyPassphrase2Label.setEnabled(enable);
- keyPassphrase2Text.setEnabled(enable);
- keyExport.setEnabled(enable);
- saveKeyPair.setEnabled(enable);
- }
-
- public void init(IWorkbench workbench) {
-// super.init(workbench);
-// initControls();
- }
-
- public void initialize() {
- initControls();
- }
-
- public static void initDefaults(IPreferenceStore store) {
- setDefault(store, KEY_SSH2HOME, JSchSession.default_ssh_home);
- setDefault(store, KEY_PRIVATEKEY, privatekeys);
- setDefault(store, KEY_PROXY_TYPE, HTTP);
- setDefault(store, KEY_PROXY_PORT, HTTP_DEFAULT_PORT);
- setDefault(store, KEY_PROXY_AUTH, "false"); //$NON-NLS-1$
- setDefault(store, KEY_PROXY_USER, ""); //$NON-NLS-1$
- setDefault(store, KEY_PROXY_PASS, ""); //$NON-NLS-1$
- store.setDefault(KEY_USE_SSH2, false);
- }
-
- private static void setDefault(IPreferenceStore store, String key, String value){
- store.setDefault(key, value);
- if(store.getString(key).length()==0)
- store.setValue(key, value);
- }
-
- private void initControls(){
- IPreferenceStore store=CVSSSH2Plugin.getDefault().getPreferenceStore();
- ssh2HomeText.setText(store.getString(KEY_SSH2HOME));
- privateKeyText.setText(store.getString(KEY_PRIVATEKEY));
- enableSSH2.setSelection(store.getBoolean(KEY_USE_SSH2));
- useProxy=store.getString(KEY_PROXY).equals("true"); //$NON-NLS-1$
- enableProxy.setSelection(useProxy);
- proxyHostText.setText(store.getString(KEY_PROXY_HOST));
- proxyPortText.setText(store.getString(KEY_PROXY_PORT));
- proxyTypeCombo.select(store.getString(KEY_PROXY_TYPE).equals(HTTP)?0:1);
- useAuth=store.getString(KEY_PROXY_AUTH).equals("true"); //$NON-NLS-1$
- enableAuth.setSelection(useAuth);
-
- Map map = Platform.getAuthorizationInfo(FAKE_URL, "proxy", AUTH_SCHEME);
- if(map!=null){
- String username=(String) map.get(KEY_PROXY_USER);
- if(username!=null) proxyUserText.setText(username);
- String password=(String) map.get(KEY_PROXY_PASS);
- if(password!=null) proxyPassText.setText(password);
- }
-
- proxyPassText.setEchoChar('*');
- updateControls();
- }
- public boolean performOk() {
- boolean result=super.performOk();
- if(result){
- setErrorMessage(null);
- String home=ssh2HomeText.getText();
- File _home=new File(home);
- if(!_home.exists()){
- if(MessageDialog.openQuestion(getShell(),
- Policy.bind("CVSSSH2PreferencePage.question"), //$NON-NLS-1$
- home+Policy.bind("CVSSSH2PreferencePage.99") //$NON-NLS-1$
- )){
- if(!(_home.mkdirs())){
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.100")+home); //$NON-NLS-1$
- return false;
- }
- }
- }
-
- if(enableProxy.getSelection() && !isValidPort(proxyPortText.getText())){
- return false;
- }
-
- IPreferenceStore store=CVSSSH2Plugin.getDefault().getPreferenceStore();
- store.setValue(KEY_SSH2HOME, home);
- store.setValue(KEY_PRIVATEKEY, privateKeyText.getText());
- store.setValue(KEY_PROXY, enableProxy.getSelection());
- store.setValue(KEY_PROXY_TYPE, proxyTypeCombo.getText());
- store.setValue(KEY_PROXY_HOST, proxyHostText.getText());
- store.setValue(KEY_PROXY_PORT, proxyPortText.getText());
-
- store.setValue(KEY_PROXY_AUTH, enableAuth.getSelection());
- store.setValue(KEY_PROXY_USER, "");
- store.setValue(KEY_PROXY_PASS, "");
-
- Map map = Platform.getAuthorizationInfo(FAKE_URL, "proxy", AUTH_SCHEME);
- if(map==null) map=new java.util.HashMap(10);
- map.put(KEY_PROXY_USER, proxyUserText.getText());
- map.put(KEY_PROXY_PASS, proxyPassText.getText());
- try{ Platform.addAuthorizationInfo(FAKE_URL, "proxy", AUTH_SCHEME, map);}
- catch(CoreException e){}
-
- store.setValue(KEY_USE_SSH2, enableSSH2.getSelection());
- }
- CVSSSH2Plugin.getDefault().savePluginPreferences();
- return result;
- }
-
- private boolean isValidPort(String port){
- int i=-1;
- try {
- i=Integer.parseInt(port);
- }
- catch (NumberFormatException ee) {
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.103")); //$NON-NLS-1$
- return false;
- }
- if((i < 0) || (i > 65535)){
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.104")); //$NON-NLS-1$
- return false;
- }
- return true;
- }
- public void performApply() {
- setErrorMessage(null);
- String home=ssh2HomeText.getText();
- File _home=new File(home);
- if(!_home.exists()){
- if(MessageDialog.openQuestion(getShell(),
- Policy.bind("CVSSSH2PreferencePage.question"), //$NON-NLS-1$
- home+Policy.bind("CVSSSH2PreferencePage.101") //$NON-NLS-1$
- )){
- if(!(_home.mkdirs())){
- setErrorMessage(Policy.bind("CVSSSH2PreferencePage.102")+home); //$NON-NLS-1$
- return;
- }
- }
- }
-
- if(enableProxy.getSelection() && !isValidPort(proxyPortText.getText())){
- return;
- }
-
- IPreferenceStore store=CVSSSH2Plugin.getDefault().getPreferenceStore();
- store.setValue(KEY_SSH2HOME, ssh2HomeText.getText());
- store.setValue(KEY_PRIVATEKEY, privateKeyText.getText());
- store.setValue(KEY_PROXY, enableProxy.getSelection());
- store.setValue(KEY_PROXY_TYPE, proxyTypeCombo.getText());
- store.setValue(KEY_PROXY_HOST, proxyHostText.getText());
- store.setValue(KEY_PROXY_PORT, proxyPortText.getText());
-
- store.setValue(KEY_PROXY_AUTH, enableAuth.getSelection());
-
- Map map = Platform.getAuthorizationInfo(FAKE_URL, "proxy", AUTH_SCHEME);
- if(map==null) map=new java.util.HashMap(10);
- map.put(KEY_PROXY_USER, proxyUserText.getText());
- map.put(KEY_PROXY_PASS, proxyPassText.getText());
- try{Platform.addAuthorizationInfo(FAKE_URL, "proxy", AUTH_SCHEME, map);}
- catch (CoreException e) {}
- }
-
- protected void performDefaults(){
- super.performDefaults();
- enableProxy.setSelection(false);
- proxyHostText.setText(""); //$NON-NLS-1$
- proxyPortText.setText(HTTP_DEFAULT_PORT);
- proxyTypeCombo.select(0);
- enableAuth.setSelection(false);
- proxyUserText.setText(""); //$NON-NLS-1$
- proxyPassText.setText(""); //$NON-NLS-1$
- updateControls();
- }
-
- protected void createSpacer(Composite composite, int columnSpan) {
- Label label=new Label(composite, SWT.NONE);
- GridData gd=new GridData();
- gd.horizontalSpan=columnSpan;
- label.setLayoutData(gd);
- }
-}
-
-class ExportDialog extends Dialog {
- protected Text field;
- protected String target=null;
- protected String title=null;
- protected String message=null;
-
- public ExportDialog(Shell parentShell, String title, String message) {
- super(parentShell);
- this.title=title;
- this.message=message;
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- public void create() {
- super.create();
- field.setFocus();
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite main=new Composite(parent, SWT.NONE);
- GridLayout layout=new GridLayout();
- layout.numColumns=3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- if (message!=null) {
- Label messageLabel=new Label(main, SWT.WRAP);
- messageLabel.setText(message);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan=3;
- messageLabel.setLayoutData(data);
- }
-
- createTargetFields(main);
- Dialog.applyDialogFont(main);
- return main;
- }
-
- protected void createTargetFields(Composite parent) {
- new Label(parent, SWT.NONE).setText("Target site:");
-
- field=new Text(parent, SWT.BORDER);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint=convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- field.setLayoutData(data);
- new Label(parent, SWT.NONE);
- }
-
- public String getTarget() {
- return target;
- }
-
- protected void okPressed() {
- String _target=field.getText();
- if(_target==null || _target.length()==0){
- return;
- }
- target=_target;
- super.okPressed();
- }
-
- protected void cancelPressed() {
- target=null;
- super.cancelPressed();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java
deleted file mode 100644
index 6dbefefc2..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/*******************************************************************************
- * Copyright (c) 2003, Atsuhiko Yamanaka, JCraft,Inc. and others. All rights
- * reserved. This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: Atsuhiko Yamanaka, JCraft,Inc. - initial API and
- * implementation.
- ******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-import java.io.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IServerConnection;
-import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException;
-import org.eclipse.team.internal.ccvs.ssh.SSHServerConnection;
-import com.jcraft.jsch.*;
-import org.eclipse.team.ccvs.ssh2.Policy;
-public class CVSSSH2ServerConnection implements IServerConnection {
- private static final String COMMAND = "cvs server"; //$NON-NLS-1$
- private ICVSRepositoryLocation location;
- private String password;
- private InputStream inputStream;
- private OutputStream outputStream;
- private Session session;
- private Channel channel;
- private IServerConnection ssh1;
- protected CVSSSH2ServerConnection(ICVSRepositoryLocation location, String password) {
- this.location = location;
- this.password = password;
- }
- public void close() throws IOException {
- if (ssh1 != null) {
- ssh1.close();
- return;
- }
- if (channel != null)
- channel.disconnect();
- }
- public InputStream getInputStream() {
- if (ssh1 != null) {
- return ssh1.getInputStream();
- }
- return inputStream;
- }
- public OutputStream getOutputStream() {
- if (ssh1 != null) {
- return ssh1.getOutputStream();
- }
- return outputStream;
- }
- public void open(IProgressMonitor monitor) throws IOException, CVSAuthenticationException {
- if (ssh1 != null) {
- ssh1.open(monitor);
- return;
- }
- monitor.subTask(Policy.bind("CVSSSH2ServerConnection.open", location.getHost())); //$NON-NLS-1$
- monitor.worked(1);
- try {
- String hostname = location.getHost();
- String username = location.getUsername();
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT)
- port = 0;
- int retry = 1;
- OutputStream channel_out;
- InputStream channel_in;
- while (true) {
- session = JSchSession.getSession(location, username, password, hostname, port, monitor);
- channel = session.openChannel("exec"); //$NON-NLS-1$
- ((ChannelExec) channel).setCommand(COMMAND);
- channel_out = channel.getOutputStream();
- channel_in = channel.getInputStream();
- try {
- channel.connect();
- } catch (JSchException ee) {
- retry--;
- if(retry<0){
- throw new CVSAuthenticationException(Policy.bind("CVSSSH2ServerConnection.3"), CVSAuthenticationException.NO_RETRY); //$NON-NLS-1$
- }
- if(session.isConnected()){
- session.disconnect();
- }
- continue;
- }
- break;
- }
- inputStream = channel_in;
- outputStream = channel_out;
- } catch (JSchException e) {
- if (e.toString().indexOf("invalid server's version string") == -1) { //$NON-NLS-1$
- throw new CVSAuthenticationException(e.toString(), CVSAuthenticationException.NO_RETRY);
- }
- ssh1 = new SSHServerConnection(location, password);
- if (ssh1 == null) {
- throw new CVSAuthenticationException(e.toString(), CVSAuthenticationException.NO_RETRY);
- }
- ssh1.open(monitor);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java
deleted file mode 100644
index 17d03452b..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/*******************************************************************************
- * Copyright (c) 2003, Atsuhiko Yamanaka, JCraft,Inc. and others. All rights
- * reserved. This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: Atsuhiko Yamanaka, JCraft,Inc. - initial API and
- * implementation.
- ******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-import java.io.*;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.Enumeration;
-
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-
-import com.jcraft.jsch.*;
-
-class JSchSession {
- private static final int SSH_DEFAULT_PORT = 22;
- private static JSch jsch=new JSch();
- private static java.util.Hashtable pool = new java.util.Hashtable();
-
- static String default_ssh_home = null;
- static {
- String ssh_dir_name = ".ssh"; //$NON-NLS-1$
-
- // Windows doesn't like files or directories starting with a dot.
- if (BootLoader.getOS().equals(BootLoader.OS_WIN32)) {
- ssh_dir_name = "ssh"; //$NON-NLS-1$
- }
- default_ssh_home = System.getProperty("user.home"); //$NON-NLS-1$
- if (default_ssh_home != null) {
- default_ssh_home = default_ssh_home + java.io.File.separator + ssh_dir_name;
- } else {
-
- }
- }
-
- private static String current_ssh_home = null;
-
- /**
- * User information delegates to the IUserAuthenticator. This allows
- * headless access to the connection method.
- */
- private static class MyUserInfo implements UserInfo, UIKeyboardInteractive {
- private String username;
- private String password;
- private String passphrase;
- private ICVSRepositoryLocation location;
-
- MyUserInfo(String username, ICVSRepositoryLocation location) {
- this.location = location;
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public String getPassphrase() {
- return passphrase;
- }
- public boolean promptYesNo(String str) {
- IUserAuthenticator authenticator = location.getUserAuthenticator();
- int prompt = authenticator.prompt(
- location,
- IUserAuthenticator.QUESTION,
- Policy.bind("JSchSession.5"), //$NON-NLS-1$
- str,
- new int[] {IUserAuthenticator.YES_ID, IUserAuthenticator.NO_ID},
- 0 //yes the default
- );
- return prompt == 0;
- }
- private String promptSecret(String message) throws CVSException{
- IUserAuthenticator authenticator = location.getUserAuthenticator();
- final String[] _password = new String[1];
- IUserInfo info = new IUserInfo() {
- public String getUsername() {
- return username;
- }
- public boolean isUsernameMutable() {
- return false;
- }
- public void setPassword(String password) {
- _password[0] = password;
- }
- public void setUsername(String username) {
- }
- };
- authenticator.promptForUserInfo(location, info, message);
- return _password[0];
- }
- public boolean promptPassphrase(String message) {
- try{
- String _passphrase=promptSecret(message);
- if(_passphrase!=null){
- passphrase=_passphrase;
- }
- return _passphrase!=null;
- }
- catch(CVSException e){
- return false;
- }
- }
- public boolean promptPassword(String message) {
- try{
- String _password=promptSecret(message);
- if(_password!=null){
- password=_password;
- // Cache the password with the repository location on the memory.
- ((CVSRepositoryLocation)location).setPassword(password);
- }
- return _password!=null;
- }
- catch(CVSException e){
- return false;
- }
- }
- public void showMessage(String message) {
- IUserAuthenticator authenticator = location.getUserAuthenticator();
- authenticator.prompt(
- location,
- IUserAuthenticator.INFORMATION,
- Policy.bind("JSchSession.5"), //$NON-NLS-1$
- message,
- new int[] {IUserAuthenticator.OK_ID},
- IUserAuthenticator.OK_ID
- );
- }
- public String[] promptKeyboardInteractive(String destination,
- String name,
- String instruction,
- String[] prompt,
- boolean[] echo){
- IUserAuthenticator authenticator = location.getUserAuthenticator();
- try{
- String[] result=
- authenticator.promptForKeyboradInteractive(location,
- destination,
- name,
- instruction,
- prompt,
- echo);
- return result;
- }
- catch(CVSException e){
- return null;
- }
- }
- }
-
- static Session getSession(ICVSRepositoryLocation location, String username, String password, String hostname, int port, final IProgressMonitor monitor) throws JSchException {
- if (port == 0)
- port = SSH_DEFAULT_PORT;
-
- IPreferenceStore store = CVSSSH2Plugin.getDefault().getPreferenceStore();
- String ssh_home = store.getString(CVSSSH2PreferencePage.KEY_SSH2HOME);
-
- if (current_ssh_home == null || !current_ssh_home.equals(ssh_home)) {
- current_ssh_home = ssh_home;
- if (ssh_home.length() == 0)
- ssh_home = default_ssh_home;
-
- try {
- java.io.File file;
- file=new java.io.File(ssh_home, "known_hosts"); //$NON-NLS-1$
- jsch.setKnownHosts(file.getPath());
-
- String pkeys=store.getString(CVSSSH2PreferencePage.KEY_PRIVATEKEY);
- String[] pkey=pkeys.split(","); //$NON-NLS-1$
- for(int i=0; i<pkey.length;i++){
- file = new java.io.File(ssh_home, pkey[i]);
- if (file.exists())
- jsch.addIdentity(file.getPath());
- }
- } catch (Exception e) {
- }
- }
-
- String key = username + "@" + hostname + ":" + port; //$NON-NLS-1$ //$NON-NLS-2$
-
- try {
- Session session = (Session) pool.get(key);
- if (session != null && !session.isConnected()) {
- pool.remove(key);
- session = null;
- }
-
- if (session == null) {
- session = jsch.getSession(username, hostname, port);
-
- boolean useProxy = store.getString(CVSSSH2PreferencePage.KEY_PROXY).equals("true"); //$NON-NLS-1$
- if (useProxy) {
- String _type = store.getString(CVSSSH2PreferencePage.KEY_PROXY_TYPE);
- String _host = store.getString(CVSSSH2PreferencePage.KEY_PROXY_HOST);
- String _port = store.getString(CVSSSH2PreferencePage.KEY_PROXY_PORT);
-
- boolean useAuth = store.getString(CVSSSH2PreferencePage.KEY_PROXY_AUTH).equals("true"); //$NON-NLS-1$
- String _user = store.getString(CVSSSH2PreferencePage.KEY_PROXY_USER);
- String _pass = store.getString(CVSSSH2PreferencePage.KEY_PROXY_PASS);
-
- Proxy proxy = null;
- String proxyhost = _host + ":" + _port; //$NON-NLS-1$
- if (_type.equals(CVSSSH2PreferencePage.HTTP)) {
- proxy = new ProxyHTTP(proxyhost);
- if (useAuth) {
- ((ProxyHTTP) proxy).setUserPasswd(_user, _pass);
- }
- } else if (_type.equals(CVSSSH2PreferencePage.SOCKS5)) {
- proxy = new ProxySOCKS5(proxyhost);
- if (useAuth) {
- ((ProxySOCKS5) proxy).setUserPasswd(_user, _pass);
- }
- } else {
- proxy = null;
- }
- if (proxy != null) {
- session.setProxy(proxy);
- }
- }
-
- session.setPassword(password);
-
- UserInfo ui = new MyUserInfo(username, location);
- session.setUserInfo(ui);
-
- session.setSocketFactory(new SocketFactory() {
- InputStream in = null;
- OutputStream out = null;
- public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
- Socket socket = null;
- socket = Util.createSocket(host, port, monitor);
- return socket;
- }
- public InputStream getInputStream(Socket socket) throws IOException {
- if (in == null)
- in = socket.getInputStream();
- return in;
- }
- public OutputStream getOutputStream(Socket socket) throws IOException {
- if (out == null)
- out = socket.getOutputStream();
- return out;
- }
- });
-
- session.connect();
- pool.put(key, session);
- }
- return session;
- } catch (JSchException e) {
- pool.remove(key);
- throw e;
- }
- }
-
- static void shutdown() {
- if (jsch != null && pool.size() > 0) {
- for (Enumeration e = pool.elements(); e.hasMoreElements(); ) {
- Session session = (Session) (e.nextElement());
- try {
- session.disconnect();
- } catch (Exception ee) {
- }
- }
- pool.clear();
- }
- }
- static JSch getJSch(){
- return jsch;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2Method.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2Method.java
deleted file mode 100644
index 4070f52ae..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2Method.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/*******************************************************************************
- * Copyright (c) 2003, Atsuhiko Yamanaka, JCraft,Inc. and others. All rights
- * reserved. This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: Atsuhiko Yamanaka, JCraft,Inc. - initial API and
- * implementation.
- ******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
-import org.eclipse.team.internal.ccvs.core.IServerConnection;
-
-public class PServerSSH2Method implements IConnectionMethod {
- public String getName() {
- return "pserverssh2"; //$NON-NLS-1$
- }
- public IServerConnection createConnection(ICVSRepositoryLocation root, String password) {
- return new PServerSSH2ServerConnection(root, password);
- }
- public void disconnect(ICVSRepositoryLocation location) {
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java
deleted file mode 100644
index fd8539217..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/*******************************************************************************
- * Copyright (c) 2003, Atsuhiko Yamanaka, JCraft,Inc. and others. All rights
- * reserved. This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: Atsuhiko Yamanaka, JCraft,Inc. - initial API and
- * implementation.
- ******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-import java.io.*;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-
-import com.jcraft.jsch.*;
-
-public class PServerSSH2ServerConnection implements IServerConnection {
-
- private ICVSRepositoryLocation location;
- private String password;
- private Session session;
- private static int localport = 2403;
- private IServerConnection psc = null;
-
- protected PServerSSH2ServerConnection(ICVSRepositoryLocation location, String password) {
- this.location = location;
- this.password = password;
- }
-
- public void close() throws IOException {
- psc.close();
- }
-
- public InputStream getInputStream() {
- return psc.getInputStream();
- }
- public OutputStream getOutputStream() {
- return psc.getOutputStream();
- }
-
- public void open(IProgressMonitor monitor) throws IOException, CVSAuthenticationException {
- monitor.subTask("PServerSSH2ServerConnection.open"); //$NON-NLS-1$
- monitor.worked(1);
- String cvs_root = location.getRootDirectory();
- int cvs_port = location.getPort();
- if (cvs_port == 0)
- cvs_port = 2401;
- String cvs_host = location.getHost();
- String ssh_host = cvs_host;
- String ssh_user = location.getUsername();
-
- String host = cvs_host;
- if (host.indexOf('@') != -1) {
- cvs_host = host.substring(host.lastIndexOf('@') + 1);
- host = host.substring(0, host.lastIndexOf('@'));
- if (host.indexOf('@') != -1) {
- ssh_host = host.substring(host.lastIndexOf('@') + 1);
- if (ssh_host.length() == 0)
- ssh_host = cvs_host;
- ssh_user = host.substring(0, host.lastIndexOf('@'));
- } else {
- ssh_host = host;
- }
- }
-
- int ssh_port = 0;
- if (ssh_host.indexOf('#') != -1) {
- try {
- ssh_port = Integer.parseInt(ssh_host.substring(ssh_host.lastIndexOf('#') + 1));
- ssh_host = ssh_host.substring(0, ssh_host.lastIndexOf('#'));
- } catch (Exception e) {
- }
- }
-
- int lport = cvs_port;
- String rhost = (cvs_host.equals(ssh_host) ? "localhost" : cvs_host); //$NON-NLS-1$
- int rport = cvs_port;
-
- // ssh -L lport:rhost:rport ssh_user@ssh_host
- int retry = 1;
- while (true) {
- try {
- session = JSchSession.getSession(location, ssh_user, "", ssh_host, ssh_port, monitor); //$NON-NLS-1$
- String[] list = session.getPortForwardingL();
- String name = ":" + rhost + ":" + rport; //$NON-NLS-1$ //$NON-NLS-2$
- boolean done = false;
- for (int i = 0; i < list.length; i++) {
- if (list[i].endsWith(name)) {
- try {
- String foo = list[i].substring(0, list[i].indexOf(':'));
- lport = Integer.parseInt(foo);
- } catch (Exception ee) {
- }
- done = true;
- break;
- }
- }
- if (!done) {
- lport = localport++;
- session.setPortForwardingL(lport, rhost, rport);
- }
- } catch (JSchException ee) {
- retry--;
- if(retry<0){
- throw new CVSAuthenticationException(Policy.bind("CVSSSH2ServerConnection.3"), CVSAuthenticationException.NO_RETRY); //$NON-NLS-1$
- }
- if(session.isConnected()){
- session.disconnect();
- }
- continue;
- }
- break;
- }
- // password for location will be over-written in JSchSession ;-<
- ((CVSRepositoryLocation)location).setPassword(password);
-
- // CVSROOT=":pserver:localhost:"+lport+""cvs_root
- try {
- Properties prop = new Properties();
- prop.put("connection", "pserver"); //$NON-NLS-1$ //$NON-NLS-2$
- prop.put("user", location.getUsername()); //$NON-NLS-1$
- prop.put("password", password); //$NON-NLS-1$
- prop.put("host", "localhost"); //$NON-NLS-1$ //$NON-NLS-2$
- prop.put("port", Integer.toString(lport)); //$NON-NLS-1$
- prop.put("root", cvs_root); //$NON-NLS-1$
-
- CVSRepositoryLocation cvsrl = CVSRepositoryLocation.fromProperties(prop);
-
- IConnectionMethod method = cvsrl.getMethod();
- psc = method.createConnection(cvsrl, password);
- } catch (Exception e) {
- throw new CVSAuthenticationException(e.toString(), CVSAuthenticationException.NO_RETRY);
- }
- psc.open(monitor);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/Policy.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/Policy.java
deleted file mode 100644
index da74a9786..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/Policy.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ccvs.ssh2;
-
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class Policy {
- protected static ResourceBundle bundle = null;
-
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void localize(String bundleName) {
- bundle = ResourceBundle.getBundle(bundleName);
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given arguments. If the key is
- * not found, return the key.
- */
- public static String bind(String key, Object[] args) {
- try {
- return MessageFormat.format(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/messages.properties b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/messages.properties
deleted file mode 100644
index 75ddb32e9..000000000
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/messages.properties
+++ /dev/null
@@ -1,80 +0,0 @@
-JSchSession.5=SSH2 Client
-CVSSSH2ServerConnection.open=Connecting via SSH to {0}...
-CVSSSH2PreferencePage.0=CVSSSH2PreferencePage.PROXY
-CVSSSH2PreferencePage.18=Configuration options for SSH2:
-CVSSSH2PreferencePage.19=&General
-CVSSSH2PreferencePage.20=&Proxy
-CVSSSH2PreferencePage.21=&Key Management
-CVSSSH2PreferencePage.22=&Enable SSH protocol version 2 support (temporary until version 2 fully tested)
-CVSSSH2PreferencePage.23=SSH2 &Home:
-CVSSSH2PreferencePage.24=&Browse...
-CVSSSH2PreferencePage.25=P&rivate key:
-CVSSSH2PreferencePage.26=A&dd Private Key...
-CVSSSH2PreferencePage.27=SSH Home:
-CVSSSH2PreferencePage.30=&Enable proxy connection
-CVSSSH2PreferencePage.31=Proxy &type:
-CVSSSH2PreferencePage.32=Proxy host a&ddress:
-CVSSSH2PreferencePage.33=Proxy host p&ort:
-CVSSSH2PreferencePage.34=E&nable proxy authentication
-CVSSSH2PreferencePage.35=Proxy &user name:
-CVSSSH2PreferencePage.36=Proxy pa&ssword:
-CVSSSH2PreferencePage.37=Key &type:
-CVSSSH2PreferencePage.38=G&enerate
-CVSSSH2PreferencePage.39=&You can paste this public key into the remote authorized_keys file:
-CVSSSH2PreferencePage.41=&Fingerprint:
-CVSSSH2PreferencePage.42=&Comment:
-CVSSSH2PreferencePage.43=Passp&hrase:
-CVSSSH2PreferencePage.44=C&onfirm passphrase:
-CVSSSH2PreferencePage.45=&Save Private Key...
-CVSSSH2PreferencePage.47=The key was not generated.
-CVSSSH2PreferencePage.48=The passphrases entered do not match.
-CVSSSH2PreferencePage.49=Are you sure you want to save this private key without passphrase protection?
-CVSSSH2PreferencePage.50=\ does not exsit.\nAre you sure you want to create it?
-CVSSSH2PreferencePage.53=\ has already existed.\nAre you sure you want to over write it?
-CVSSSH2PreferencePage.55=Successfully saved.
-CVSSSH2PreferencePage.57=Private key:
-CVSSSH2PreferencePage.59=Public key:
-CVSSSH2PreferencePage.66=Proxy settings
-CVSSSH2PreferencePage.67=Enable proxy connection
-CVSSSH2PreferencePage.68=Proxy type
-CVSSSH2PreferencePage.69=Proxy host address
-CVSSSH2PreferencePage.70=Proxy host port
-CVSSSH2PreferencePage.71=Enable proxy authentication
-CVSSSH2PreferencePage.72=Proxy user name
-CVSSSH2PreferencePage.73=Proxy password
-CVSSSH2PreferencePage.74=Key Management
-CVSSSH2PreferencePage.75=Key type
-CVSSSH2PreferencePage.76=Generate
-CVSSSH2PreferencePage.77=&You can paste this public key into the remote authorized_keys file:
-CVSSSH2PreferencePage.79=&Fingerprint
-CVSSSH2PreferencePage.80=Comment
-CVSSSH2PreferencePage.81=Passphrase
-CVSSSH2PreferencePage.82=Confirm passphrase
-CVSSSH2PreferencePage.83=Save
-CVSSSH2PreferencePage.85=\ 1024bits key is successfully generated.
-CVSSSH2PreferencePage.86=The passphrases entered do not match.
-CVSSSH2PreferencePage.87=Are you sure you want to save this private key without the passphrase protection?
-CVSSSH2PreferencePage.88=\ does not exist.\nAre you sure you want to create it?
-CVSSSH2PreferencePage.91=\ has already existed.\nAre you sure you want to overwrite it?
-CVSSSH2PreferencePage.93=Successfully saved.
-CVSSSH2PreferencePage.95=Private key:
-CVSSSH2PreferencePage.97=Public key:
-CVSSSH2PreferencePage.99=\ does not exist.\nAre you sure you want to create it?
-CVSSSH2PreferencePage.100=Failed to create
-CVSSSH2PreferencePage.101=\ does not exist.\nAre you sure you want to create it?
-CVSSSH2PreferencePage.102=Failed to create
-CVSSSH2PreferencePage.103=Proxy host port is not a number.
-CVSSSH2PreferencePage.104=Proxy host port is out of range(0-65535).
-CVSSSH2PreferencePage.105=E&xport via sftp...
-CVSSSH2PreferencePage.106=Export ssh key to remote server via sftp.
-CVSSSH2PreferencePage.107=Specify a target site(in user@host[:port] format) where your public key should be installed.\nYour key will be stored in user@host[:port]:~/.ssh/authorized_keys
-CVSSSH2PreferencePage.108=\ is not valid site.
-CVSSSH2PreferencePage.109=Your public key has been successfully installed to
-CVSSSH2PreferencePage.110=Remote sshd is not from OpenSSH.
-CVSSSH2ServerConnection.3=session is down
-CVSSSH2PreferencePage.info=Information
-CVSSSH2PreferencePage.warning=Warning
-CVSSSH2PreferencePage.information=Information
-CVSSSH2PreferencePage.error=Error
-CVSSSH2PreferencePage.confirmation=Confirmation
-CVSSSH2PreferencePage.question=Question
diff --git a/bundles/org.eclipse.team.ui/.classpath b/bundles/org.eclipse.team.ui/.classpath
deleted file mode 100644
index 065ac06e1..000000000
--- a/bundles/org.eclipse.team.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.team.ui/.cvsignore b/bundles/org.eclipse.team.ui/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/bundles/org.eclipse.team.ui/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.team.ui/.project b/bundles/org.eclipse.team.ui/.project
deleted file mode 100644
index 340fab81e..000000000
--- a/bundles/org.eclipse.team.ui/.project
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.team.ui</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.compare</project>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.team.core</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.ui.editors</project>
- <project>org.eclipse.ui.forms</project>
- <project>org.eclipse.ui.ide</project>
- <project>org.eclipse.ui.views</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- <project>org.eclipse.update.ui.forms</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.team.ui/DESIGN.TXT b/bundles/org.eclipse.team.ui/DESIGN.TXT
deleted file mode 100644
index 91dffbe4a..000000000
--- a/bundles/org.eclipse.team.ui/DESIGN.TXT
+++ /dev/null
@@ -1,93 +0,0 @@
-
-======================
- core
-======================
-SyncInfo
-- represents relative sync of local and remote gives access to resources
-
-TeamSubscriber
-- creates sync infos
-
-SyncInfoSet/MutableSyncInfoSet (optimized collection of sync infos - immutable)
-
-SyncInfoFilter (filtering of sync sets used by actions and creation of sync sets)
-
-SyncInfoCollector (collects sync infos from subscriber, and optionally from workspace. Uses background thread to collect and calculate changes. Is updated automatically with changes)
-
-FilteredSyncInfoSet (filters a provided sync info set with a given filter and possible roots)
-
-======================
- ui
-======================
-
-ISynchronizeManager (manages the lifesycle of synchronize participants)
-
-ISynchronizeView
-
-ISynchronizeParticipant (shows in the sync view, has a mode, working set, and creates a page with the UI pieces)
-
-Modes in sync view (DirectionFilterActionGroup)
-
-SyncInfoSetCompareConfiguration (encapsulates navigation, menus, content, label providers)this
- is used to configure a viewer in different ways based on it's use.
-
-SyncInfoDiffTreeViewer/SyncInfoDiffCheckboxViewer (shows diff nodes)
-
-SyncInfoDiffNode -> DiffNode
-
-SyncInfoSetCompareInput
-
-
-
-DiffNode
-SyncInfoDiffNode
-
-Viewer
-ContentProvider
-Sorter
-LabelProvider
-ViewerInput
-
-1. sync set is created
-2. decide how to model the sync set (hierachy, compressed, change log...) sorter...
-3. hook up chagnen listener
-4. ensure model doesn't change while building it?
-5. update model dynamically
-6. dispose of listener when input changes
-
-SuperCharged MVC
-================
-
-Sync Set Compare Input (displays a diff tree viewer with the compare panes)
-
-Sync Info Compare Input (displays a compare pane for one sync info)
-
-Viewer (viewers) -> view configurators (menus, content provider, label provider, controller)
-
-Viewer Model (diff nodes) logical structure of sync info
-
-Viewer Input (creates viewer model, keeps it up-to-date, sorter)
-
-Data (sync info, sync info set)
-
-1. when does the viewer model get created, it is implementation dependant
-2. why is creating the viewer model takes a while.
-
-How is progress shown?
-======================
-
-1. actions that run jobs that affect a view's content should schedule in the view
- - object contributions, or delegates get this for free via SubscriberAction which
- has a schedule which will schedule via the associated IWorkbenchPart.
- - actions programatically added to a view should be initialized with the view part or view site
- so that it can run the job in the view's context.
- - this will get you (1) the view icon change hint, (2) the half-busy cursor
-2. jobs should provide meaningful progress shown in progress view
- - this will get you (1) a job listed in the progress support showing that something is happening
-3. if working on syncinfodiffnodes in the background you can mark the nodes as working as a hint
- to the UI to display them differently (e.g. should make this adapter specific)
- - this will get you (1) nodes in the sync view showing that they are being worked on
-4. Use progress groups in refresh to show remote refresh and sync calculation as one work item.
- - this will get you (1) one entry in the progress view for both the remote refresh and background
- processing of sync states. no more updating sync view message.
-
diff --git a/bundles/org.eclipse.team.ui/TODO-syncview.txt b/bundles/org.eclipse.team.ui/TODO-syncview.txt
deleted file mode 100644
index 523df08b3..000000000
--- a/bundles/org.eclipse.team.ui/TODO-syncview.txt
+++ /dev/null
@@ -1,173 +0,0 @@
-======================================================================
- EXAMPLE TEAM UI API USAGES
-======================================================================
-1. embeding sync viewer in dialog/wizard
-2. added a new content provider (logical views of sync info changes)
-3. adding custom label decorations
-4. actions/menus
-5. fetching sync info set without instantiating a participant
-6. fetch and wait for the event collector to finish processing the changes
-7. showing in a diff viewer either a static model (doesn't update when changes occur) or dynamic
-
-======================================================================
- PR LIST (07-01-2004)
-======================================================================
-
-x P3 schedule support by participant.
- this requires changing the refresh jobs to accept scheduling different jobs. Essentially being able to have an
- ordered *queue of refreshes. Also, participant will need a schedule object to encapsulate the schedule logic.
-
-x P3 status message could be more precise instead of simply "Working". But to do this we need access to the job progress monitor
- and it isn't available API from the UI. (removed status in sync view, progress will be shown in the progress shell).
-
-x P1 end of refresh prompt should be a property change notice, and let the participant decide what to do!
-
-x P2 decide overview page contents and how it should be used
-
-x remove duplicated tree/table viewers classes. the orignial ones simply have the INavigable behavior.
-
-x P1 make changes section only be a pagebook. this would easily allow adding any number of composites to the page?
- should look at memory consuption and ensure that we are disposing properly!
-
-- compareeditorinput fetcheds remote content outside of a progress monitor
-
-x decorations for SyncInfoDiffElements (of which type.. project persistent property setting?)
-x labels for compare editors (text merge viewers and title for diff viewer)
-
-x generic navigate support for SyncInfoDiffTreeViewer, PRd compare for API support
-
-x readonly state for compare panes
-
-- progress support added when fetching (e.g. caching contents in ITypedElement). This will require compare to add some API.
-
-x INavigable in compare needs to be made API.
-
-- details dialog needs to create composites once then display them. Or only create once!!!!
-
-x sync set filtering creation must be more precise. For example you should be able to specify a root and a direction.
-
-x cvs update/commit action in sync view toolbar are not updating their state anymore :(
-
-x P3 mode switching at the end of a refresh to ensure that changes are shown if available
-
-x P2 need an event for adding roots to a subscriber to update the list shown
-
-x memory and sync set disposal in syncsetcompare input!!!! VERY IMPORTANT!!!
-
-- overiding outgoing/incoming doesn't show the changes in the commit dialog because the filter is only configured to show in one direction.
-
-======================================================================
- PR LIST (16-01-2004)
-======================================================================
-x progress monitoring in SyncSet.reset and such. there are many places where null progress monitors are passed along.
-- showing sync view in commit dialog is complicated because there is no easy way of finding out exactly which resources will be committed at the
- point the commit comment dialog is shown. Need to provide new API on the commit dialog for this.
-- convert details dialogs that show sync view into wizards, this allows more room to browse the changes. almost like the refactoring. Preview >> button instead of Next >>.
-x job status handler API or not??
-
-======================================================================
- PR LIST (26-01-2004)
-======================================================================
-x navigable APIs must be consolidated, sync view navigation
-x compare configuration review
-x logical view extensions [not going to do this in 3.0]
-x content provider should not assume diff nodes have associated resources
- - content provider input? Is it a diff node or sync set? diff node hack required for getting the
- compare editor input working.
-x viewer input as a diffnode with a sync set seems wrong?
-- share reconciling with existing (e.g. using compare contents to resolve)
-x comment grouping logical view
-- target migration
-
-======================================================================
- PR LIST (30-01-2004) MV
-======================================================================
-x actions in sync view all assume that selection will have a resource (e.g refresh action).
- - how would a refresh know what to select if a change comment node was selected, for example
- - could first attempt to obtain resource and, if that fails, visit children to obtain resources
- [jm] I think that actions will have to know about DiffNodes and we need the helper to
- get the list of children nodes.
- [jm] added Utils.getResources(Iselection) does all the logic for retreiving resources
-x sorter is related to input so may need to change when input does
- - there does not appear to be a clean way to change the sorter and input without causing two refreshes
-x SyncInfoSet##getOutOfSyncDescendants(IResource) is speced to include the resource itself if it is out-of-sync
- - this is a bit confusing as the name implies otherwise
- - should either consider a name change or a spec change
- [jm] I never understood why is was spec'd like that :) You can decide...
-x compare input requires root node to have children or diff viewer is not added
- - this is problematic when creating a wizard page that is dynamically populated
- - not sure if there's problems caused by returning true when there are no children
- [jm] I think this it's fine to have root nodes return true to hasChildren. I don't like
- compares subtle way of determining is the diff viewer should be shown, but in our case a
- root node can safely always have children.
-x several places require a resource
- - e.g. conflict propogation requires a resource but shouldn't (modified to work without a resource)
- x conflicts do not propogate in comment view [jm] fixed
- [jm] we have to change this assumption everywhere! Actions, label decorators... and such.
- [jm] does sync info diff node require a resource? currently it does. But I still don't like
- the SyncSet methods that take IResource.ROOT to return first level children.
-x there are times when the sync set changes but the input hasn't yet and the given input
- doesn't handle outgoing changes. For example, when changing from incoming to outgoing with
- the change log root, the change log root gets a reset from the sync set then the input
- is changed. this can cause an NPE. Must look into the ordering here.
- [mv] I think we have to make the statement that the content provider must handle all sync types
- in some fashion. I recall that we discussed the restriction that a sync diff root node must
- show all elements in it's sync set. Could the comment builder place all outgoing changes in
- an additional section. The user would never see this but it would fulfill the contract.
- [jm] yes, this is what i ended up doing.
- [mv] for efficiency, we should still try to couple the mode change with the content provider
- change so that the diff node tree is not built and displayed twice during a change
-- the test cases starve the subscriber event handler such that an event has additions and removals for the same resources
- - this causes failures in the diff tree builders
- - although less likely in UI, can still happen
- - need tests for these scenarios to ensure generated event is correct after addition and removal
-x there are several places in SyncInfoSet and in the DiffNodes where we must use the workspace root
- as the input resource to imply get all members? Maybe this should be cleaned up a bit.
-x SyncInfoSet must be cleaned up a lot, the API is vague and method names are not clear.
- x we need a way to ensure that the sync set does not change while we are building a diff tree
- x events are only fired from endInput(). It should work in both batching and non-batching mode
-x SyncInfoDiffNode doesn't have to return a resource or a syncinfo. By definition a diff node already has API
- for returning a sync kind getKind() and access to all three resources getRight(), getLeft(), getAncestor().
-
-======================================================================
- PR LIST (02-02-2004) MV
-======================================================================
-x sync view title says "Summary" when first opened
-- would like to show subscriber roots as compressed folders at root of sync view
- - sync set needs to have the concept of roots
-x How is a reset propogated through the sync set chain.
- - I'm concerned that this is adhoc at the moment. we need to make it explicit.
-x why must clearModelObjects go deep? Can't you just disconnect from the parent?
-
-======================================================================
- PR LIST (05-02-2004) MV
-======================================================================
-x I notice that SyncInfoDiffNode requires a resource (via assert) and sync info is only obtained from
-SyncInfoDiffNodes (in Util). This is problematic as now the diff tree cannot contain diff nodes that
-do not map to a resource but parent nodes that do. The selection determination for SubscriberAction
-needs to walk the diff node tree for this case.
-
-======================================================================
- PR LIST (05-02-2004) Jm
-======================================================================
-- cvs merge participant doesn't get view progress support because participant is added before
-viewer is created. But this should be solvable by ensuring that showInActivePerspective forces
-viewer creation in a sync exec.
-
-==============================
-x initialize case doesn't work because main page is shown as empty but mode is correct
-x how do we handle changes to sync: re-create new nodes or update the nodes with new sync kind?
-x new projects don't show up?
-- how does our APIs support moves/renames? Do we need another sync state?
-
-=====
-x status line doesn't show?
-- there's a bunch of non-NLSd strings?
-- performance scalability with large sets
-- initialization feedback when set is populating?
-- scenarios/user doc
- - most sync state stuff must be tested by automated tests
- - progress should have scenarios (expected feedback, init case)
- - errors
-- resource filtering as seen in Refreshcompletedialog is very ineficient
-- can you call start on the collector multiple times? \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/about.html b/bundles/org.eclipse.team.ui/about.html
deleted file mode 100644
index 9db411aab..000000000
--- a/bundles/org.eclipse.team.ui/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/build.properties b/bundles/org.eclipse.team.ui/build.properties
deleted file mode 100644
index a90fcf573..000000000
--- a/bundles/org.eclipse.team.ui/build.properties
+++ /dev/null
@@ -1,14 +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
-###############################################################################
-# Eclipse build contribution
-bin.includes=about.html,icons/,plugin.xml,plugin.properties,*.jar
-source.teamui.jar=src/
-src.includes=about.html,schema/
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif
deleted file mode 100644
index ba8ee00a3..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif
deleted file mode 100644
index 25d4c998b..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif
deleted file mode 100644
index b95e26a1b..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif
deleted file mode 100644
index 706dc020e..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif
deleted file mode 100644
index 0bae56c34..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif
deleted file mode 100644
index ecde52ea8..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif
deleted file mode 100644
index bb2d85225..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif
deleted file mode 100644
index 1492b4efa..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gif
deleted file mode 100644
index b84df084f..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gif
deleted file mode 100644
index e597c3d16..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif
deleted file mode 100644
index 097ecdda5..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif
deleted file mode 100644
index dc9bfc62d..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gif
deleted file mode 100644
index 8392f3345..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif
deleted file mode 100644
index afe6b1736..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gif
deleted file mode 100644
index 9b278e6fa..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif
deleted file mode 100644
index a063c230a..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif
deleted file mode 100644
index 9597ad7f8..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif
deleted file mode 100644
index 3162b9373..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif
deleted file mode 100644
index 12a9167c5..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif
deleted file mode 100644
index 8411bc227..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif
deleted file mode 100644
index 9dd4d8300..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif
deleted file mode 100644
index b69c1a48f..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif
deleted file mode 100644
index f302d8c88..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif b/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif
deleted file mode 100644
index c4a11c3cc..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif
deleted file mode 100644
index 627c90188..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif
deleted file mode 100644
index 125662ffe..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif
deleted file mode 100644
index e84103f40..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif
deleted file mode 100644
index 4e9a3eb98..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gif
deleted file mode 100644
index 3409b11b3..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif
deleted file mode 100644
index 7c1a8a852..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif
deleted file mode 100644
index c5f90b61b..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif
deleted file mode 100644
index 2b6285b75..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gif
deleted file mode 100644
index aa0160d1c..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gif
deleted file mode 100644
index 76f336003..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif
deleted file mode 100644
index 8a7dece74..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif
deleted file mode 100644
index 4221aa488..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gif
deleted file mode 100644
index 6cbeced26..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif
deleted file mode 100644
index 14e440b10..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gif
deleted file mode 100644
index a3441a062..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif
deleted file mode 100644
index b2281b40c..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif
deleted file mode 100644
index 0f63a2204..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif
deleted file mode 100644
index 3f2bc7c1e..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif
deleted file mode 100644
index 7e0ad4aed..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif
deleted file mode 100644
index 3dcccb3c7..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif
deleted file mode 100644
index 4ea29e507..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif
deleted file mode 100644
index a0f800693..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif
deleted file mode 100644
index 93e221909..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif
deleted file mode 100644
index 8898cd608..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif
deleted file mode 100644
index feb14bf53..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif
deleted file mode 100644
index 4fdde615d..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif
deleted file mode 100644
index 3409b11b3..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif
deleted file mode 100644
index 8eb28e6d6..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif
deleted file mode 100644
index 151193a0b..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif
deleted file mode 100644
index 537265693..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gif
deleted file mode 100644
index 9f9ca4876..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gif
deleted file mode 100644
index b50b2c38a..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif
deleted file mode 100644
index b771b21a8..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif
deleted file mode 100644
index dab07f784..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gif
deleted file mode 100644
index 03b7af342..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif
deleted file mode 100644
index c978a2974..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gif
deleted file mode 100644
index dd65c5235..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif
deleted file mode 100644
index 919423d43..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif
deleted file mode 100644
index cbafcaacf..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif
deleted file mode 100644
index 525d8091b..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif
deleted file mode 100644
index 310510ee5..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif
deleted file mode 100644
index 4410b22ee..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif
deleted file mode 100644
index b69740dfb..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif
deleted file mode 100644
index 2fddc3ea1..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif b/bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif
deleted file mode 100644
index e2b83b811..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif b/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif
deleted file mode 100644
index ab35990f1..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif b/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif
deleted file mode 100644
index 17cb2e7db..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif b/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif
deleted file mode 100644
index 2b73ce2b3..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif
deleted file mode 100644
index a11a542b1..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif
deleted file mode 100644
index 020fc5438..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif
deleted file mode 100644
index 07a8c35f3..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif
deleted file mode 100644
index a2b345d79..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gif
deleted file mode 100644
index 3af228cea..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif b/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif
deleted file mode 100644
index 0b179a95c..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif b/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif
deleted file mode 100644
index 7ebb8362a..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif b/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif
deleted file mode 100644
index 5ce318153..000000000
--- a/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
deleted file mode 100644
index cb76d2eca..000000000
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ /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
-###############################################################################
-providerName=Eclipse.org
-pluginName=Team Support UI
-
-Team=Team
-configurationWizards=Configuration Wizards
-synchronizeParticipants=Synchronize View Participants
-logicalViews=Logical Synchronize Views
-
-TeamPreferencePage.name=Team
-TextPreferencePage.name=File Content
-IgnorePreferencePage.name=Ignored Resources
-
-ConfigureProject.label=&Share Project...
-ConfigureProject.tooltip=Share the project with others using a version and configuration management system.
-
-TeamGroupMenu.label=T&eam
-Team.viewCategory=Team
-
-Synchronizing.perspective=Team Synchronizing
-SyncView.name=Synchronize
-
-ProjectSetImportWizard.name=Team Project Set
-ProjectSetImportWizard.description=A wizard that imports a Team Project Set
-ProjectSetExportWizard.name=Team Project Set
-ProjectSetExportWizard.description=A wizard that exports a Team Project Set
-
-Command.category.name=Team
-Command.category.description=Actions that apply when working with a Team
-Command.syncAll.name=Synchronize
-Command.syncAll.description=Synchronize
-
-Command.incomingFilter.name=Select Incoming Mode
-Command.incomingFilter.description=Select Incoming Mode in the Synchronize view
-Command.outgoingFilter.name=Select Outgoing Mode
-Command.outgoingFilter.description=Select Outgoing Mode in the Synchronize view
-Command.conflictsFilter.name=Select Conflicts Mode
-Command.conflictsFilter.description=Select Conflicts Mode in the Synchronize view
-Command.bothFilter.name=Select Incoming/Outgoing Mode
-Command.bothFilter.description=Select Incoming/Outgoing Mode in the Synchronize view
-Command.toggleView.name=Toggle Synchronize View Layout
-Command.toggleView.description=Toggle the Synchronize view's layout
-
-Command.selectNextChange.description=Move to the next change
-Command.selectNextChange.name=Next Change
-Command.selectPreviousChange.description=Move to the previous change
-Command.selectPreviousChange.name=Previous Change
-
-CompressFolderView.name=Compress Folders
-CompressFolderView.description=Compress in-sync folders paths
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
deleted file mode 100644
index 23a969d05..000000000
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.team.ui"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.team.internal.ui.TeamUIPlugin">
-
- <runtime>
- <library name="teamui.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.team.ui, org.eclipse.team.internal.ui"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.ui.ide" optional="true"/>
- <import plugin="org.eclipse.ui.views" optional="true"/>
- <import plugin="org.eclipse.jface.text" optional="true"/>
- <import plugin="org.eclipse.ui.workbench.texteditor" optional="true"/>
- <import plugin="org.eclipse.ui.editors" optional="true"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- <import plugin="org.eclipse.team.core"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.compare"/>
- <import plugin="org.eclipse.ui.forms"/>
- </requires>
-
-
- <extension-point id="configurationWizards" name="%configurationWizards" schema="schema/configurationWizards.exsd"/>
- <extension-point id="synchronizeParticipants" name="%synchronizeParticipants" schema="schema/synchronizeParticipants.exsd"/>
- <extension-point id="logicalViews" name="%logicalViews" schema="schema/logicalViews.exsd"/>
-
-<!-- **************** PREFERENCES ******************* -->
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%TeamPreferencePage.name"
- class="org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage"
- id="org.eclipse.team.ui.TeamPreferences">
- </page>
- <page
- name="%TextPreferencePage.name"
- category="org.eclipse.team.ui.TeamPreferences"
- class="org.eclipse.team.internal.ui.preferences.TextPreferencePage"
- id="org.eclipse.team.ui.TextPreferences">
- </page>
- <page
- name="%IgnorePreferencePage.name"
- category="org.eclipse.team.ui.TeamPreferences"
- class="org.eclipse.team.internal.ui.preferences.IgnorePreferencePage"
- id="org.eclipse.team.ui.IgnorePreferences">
- </page>
- </extension>
-<!-- ****************** POPUP ACTIONS *************** -->
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- id="org.eclipse.team.ui.ResourceContributions">
- <menu
- label="%TeamGroupMenu.label"
- path="additions"
- id="team.main">
- <separator
- name="group1">
- </separator>
- <separator
- name="group2">
- </separator>
- <separator
- name="group3">
- </separator>
- <separator
- name="group4">
- </separator>
- <separator
- name="group5">
- </separator>
- <separator
- name="group6">
- </separator>
- <separator
- name="group7">
- </separator>
- <separator
- name="group8">
- </separator>
- <separator
- name="group9">
- </separator>
- <separator
- name="group10">
- </separator>
- <separator
- name="targetGroup">
- </separator>
- <separator
- name="projectGroup">
- </separator>
- </menu>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true"
- id="org.eclipse.team.ui.ProjectContributions">
- <action
- label="%ConfigureProject.label"
- tooltip="%ConfigureProject.tooltip"
- class="org.eclipse.team.internal.ui.actions.ConfigureProjectAction"
- menubarPath="team.main/projectGroup"
- enablesFor="1"
- id="org.eclipse.team.ui.ConfigureProject">
- </action>
- </objectContribution>
- </extension>
-<!-- ************** Views ********************** -->
- <extension
- point="org.eclipse.ui.views">
- <category
- name="%Team.viewCategory"
- id="org.eclipse.team.ui">
- </category>
- <view
- name="%SyncView.name"
- icon="icons/full/cview16/synch_synch.gif"
- fastViewWidthRatio="0.25"
- category="org.eclipse.team.ui"
- class="org.eclipse.team.internal.ui.synchronize.SynchronizeView"
- id="org.eclipse.team.sync.views.SynchronizeView">
- </view>
- </extension>
-<!-- **************** Synchronizing Perspective ******************* -->
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="%Synchronizing.perspective"
- icon="icons/full/cview16/synch_synch.gif"
- class="org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective"
- id="org.eclipse.team.ui.TeamSynchronizingPerspective">
- </perspective>
- </extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.ui.resourcePerspective">
- <perspectiveShortcut
- id="org.eclipse.team.ui.TeamSynchronizingPerspective">
- </perspectiveShortcut>
- </perspectiveExtension>
- </extension>
-<!-- ****************** Import Wizards ********************* -->
- <extension
- point="org.eclipse.ui.importWizards">
- <wizard
- name="%ProjectSetImportWizard.name"
- icon="icons/full/obj/import_projectset.gif"
- class="org.eclipse.team.internal.ui.wizards.ProjectSetImportWizard"
- id="org.eclipse.team.ui.ProjectSetImportWizard">
- <description>
- %ProjectSetImportWizard.description
- </description>
- <selection
- class="org.eclipse.core.resources.IProject">
- </selection>
- </wizard>
- </extension>
-<!-- ****************** Export Wizards ********************* -->
- <extension
- point="org.eclipse.ui.exportWizards">
- <wizard
- name="%ProjectSetExportWizard.name"
- icon="icons/full/obj/export_projectset.gif"
- class="org.eclipse.team.internal.ui.wizards.ProjectSetExportWizard"
- id="org.eclipse.team.ui.ProjectSetExportWizard">
- <description>
- %ProjectSetExportWizard.description
- </description>
- <selection
- class="org.eclipse.core.resources.IProject">
- </selection>
- </wizard>
- </extension>
-<!-- ***************** Perspective Extensions ********************** -->
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.team.ui.TeamSynchronizingPerspective">
- <showInPart
- id="org.eclipse.ui.views.ResourceNavigator">
- </showInPart>
- </perspectiveExtension>
- </extension>
-<!-- ***************** Action sets ********************** -->
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="%Team"
- description="%ActionSet.description"
- visible="false"
- id="org.eclipse.team.ui.actionSet">
- </actionSet>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd b/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd
deleted file mode 100644
index 944ede91e..000000000
--- a/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.ui" id="configurationWizards" name="Configuration Wizards"/>
- </appInfo>
- <documentation>
- This extension point is used to register a method for configuration of a project.
-Configuration involves the association of a project with a team provider, including all information necessary to initialize
-that team provider, including such things as username, password, and any relevant information necessary to locate the provider.
-&lt;p&gt;
-Providers may provide an extension for this extension point, and an implementation of &lt;samp&gt;org.eclipse.team.ui.IConfigurationWizard&lt;/samp&gt;
-which gathers the necessary information and configures the projects.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="wizard" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="wizard">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The name of the configuration type as it should appear in the configuration wizard. Examples are &quot;CVS&quot;, &quot;WebDAV&quot;.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- the icon to present in the configuration wizard next to the name.
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified name of the Java class implementing &lt;samp&gt;org.eclipse.team.ui.IConfigurationWizard&lt;/samp&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.wizard.Wizard:org.eclipse.team.ui.IConfigurationWizard"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier for this extension.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of a configuration wizard extension:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.team.ui.configurationWizard&quot;&gt;
- &lt;wizard
- name=&quot;WebDAV&quot;
- icon=&quot;webdav.gif&quot;
- class=&quot;com.xyz.DAVDecorator&quot;
- id=&quot;com.xyz.dav&quot;&gt;
- &lt;/wizard&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that implements &lt;samp&gt;org.eclipse.team.ui.IConfigurationWizard&lt;/samp&gt;.
-This interface supports configuration of a wizard given a workbench and a project.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The plug-in org.eclipse.team.provider.examples.ui contains sample implementations of IConfigurationWizard for the WebDAV and filesystem provider types.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2002 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
deleted file mode 100644
index c834e81d1..000000000
--- a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.ui" id="synchronizeParticipants" name="Synchronize View Participants"/>
- </appInfo>
- <documentation>
- This extension point is used to register a synchronize participant with the Synchronize View. A synchronize participant provides a logical connection between local resources and a remote location that is used to share those resources. The Synchronize View displays synchronize participants.
-&lt;p&gt;
-Providers may provide an extension for this extension point, and an implementation of &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeParticipant&lt;/samp&gt;.
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="participant"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- A fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- An optional identifier of the extension instance.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- An optional name for this extension instance.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="participant">
- <complexType>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- An icon that will be used when showing this participant in lists and menus.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- A unique name that will be used to identify this type of participant.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- A fully qualified name of the class the implements &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeParticipant&lt;/samp&gt;. A common practice is to subclass &lt;samp&gt;org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant&lt;/samp&gt; in order to inherit some of the default functionality. In addition, it is recommended to subclass &lt;samp&gt;org.eclipse.team.ui.synchronize.TeamSubscriberParticipant&lt;/samp&gt; to benefit from a full featured participant based on the &lt;samp&gt;org.eclipse.team.core.TeamSubscriber&lt;/samp&gt; implementation.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- A value identifying the type of participant. Possible values are &lt;samp&gt;static&lt;/samp&gt; if the participant is to be created automatically by the Team plugin or &lt;samp&gt;dynamic&lt;/samp&gt; if the participant will be created and registered with the Synchronize Manager at some other time.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- The name of the participant. This will be shown in the UI.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;extension
-point=&quot;org.eclipse.team.ui.synchronizeParticipants&quot;&gt;
-&lt;participant
-name=&quot;CVS Workspace&quot;
-icon=&quot;icons/full/cview16/server.gif&quot; class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant&quot;
-type=&quot;static&quot;
-id=&quot;org.eclipse.team.cvs.ui.cvsworkspace-participant&quot;&gt;
-&lt;/participant&gt;
-&lt;participant
-name=&quot;CVS Merge&quot;
-icon=&quot;icons/full/obj16/prjversions_rep.gif&quot;
-class=&quot;org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant&quot;
-type=&quot;dynamic&quot;
-id=&quot;org.eclipse.team.cvs.ui.cvsmerge-participant&quot;&gt;
-&lt;/participant&gt;
-&lt;/extension&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that implements &lt;samp&gt;org.eclipse.team.ui.synchronize.ISynchronizeView&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/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 38c613284..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-public interface IPreferenceIds {
- public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$
-
- // Sync Viewer
- 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_SYNCINFO_IN_LABEL = PREFIX + "view_syncinfo_in_label"; //$NON-NLS-1$
-
- public static final String SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES = PREFIX + "syncview_promptwhennochanges"; //$NON-NLS-1$
- public static final String SYNCVIEW_VIEW_PROMPT_WITH_CHANGES = PREFIX + "syncview_promptwithchanges"; //$NON-NLS-1$
-
- public static final String SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES = PREFIX + "syncview__bkg_promptwhennochanges"; //$NON-NLS-1$
- public static final String SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES = PREFIX + "syncview_bkg_promptwithchanges"; //$NON-NLS-1$
-
- public static final String SYNCVIEW_VIEW_SMART_MODE_SWITCH = PREFIX + "syncview_smartmode"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java
deleted file mode 100644
index 801bd250e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java
+++ /dev/null
@@ -1,99 +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.Arrays;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * An OverlayIcon consists of a main icon and several adornments.
- */
-public class OverlayIcon extends CompositeImageDescriptor {
- // the base image
- private Image base;
- // the overlay images
- private ImageDescriptor[] overlays;
- // the size
- private Point size;
- // the locations
- private int[] locations;
-
- public static final int TOP_LEFT = 0;
- public static final int TOP_RIGHT = 1;
- public static final int BOTTOM_LEFT = 2;
- public static final int BOTTOM_RIGHT = 3;
-
- /**
- * OverlayIcon constructor.
- *
- * @param base the base image
- * @param overlays the overlay images
- * @param locations the location of each image
- * @param size the size
- */
- public OverlayIcon(Image base, ImageDescriptor[] overlays, int[] locations, Point size) {
- this.base = base;
- this.overlays = overlays;
- this.locations = locations;
- this.size = size;
- }
-
- protected void drawOverlays(ImageDescriptor[] overlays, int[] locations) {
- Point size = getSize();
- for (int i = 0; i < overlays.length; i++) {
- ImageDescriptor overlay = overlays[i];
- ImageData overlayData = overlay.getImageData();
- switch (locations[i]) {
- case TOP_LEFT:
- drawImage(overlayData, 0, 0);
- break;
- case TOP_RIGHT:
- drawImage(overlayData, size.x - overlayData.width, 0);
- break;
- case BOTTOM_LEFT:
- drawImage(overlayData, 0, size.y - overlayData.height);
- break;
- case BOTTOM_RIGHT:
- drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height);
- break;
- }
- }
- }
-
- public boolean equals(Object o) {
- if (! (o instanceof OverlayIcon)) return false;
- OverlayIcon other = (OverlayIcon) o;
- return base.equals(other.base) && Arrays.equals(overlays, other.overlays);
- }
-
- public int hashCode() {
- int code = base.hashCode();
- for (int i = 0; i < overlays.length; i++) {
- code ^= overlays[i].hashCode();
- }
- return code;
- }
-
-
- protected void drawCompositeImage(int width, int height) {
- drawImage(base.getImageData(), 0, 0);
- drawOverlays(overlays, locations);
- }
-
- protected Point getSize() {
- return size;
- }
-}
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 36611f963..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.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;
-
-
-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, ResourceBundle b) {
- try {
- return b.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- *
- * @param key the id to look up
- * @return the string with the given key
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } 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$
- }
- }
-
- public static ResourceBundle getBundle() {
- return bundle;
- }
-}
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 1d58bdff1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.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;
-
-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 {
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$
- 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 (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$
- 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 (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$
- 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 {
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$
- inPsf = false;
- return;
- }
- if (isVersionOne) return;
- if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$
- map.put(id, references);
- references = null;
- inProvider = false;
- return;
- }
- if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$
- inProject = false;
- return;
- }
- }
-
- public Map getReferences() {
- return map;
- }
-
- public boolean isVersionOne() {
- return isVersionOne;
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for project sets doesn't use namespaces so either of the two names
- * is fine. Therefore, use whichever one is provided.
- */
- private String getElementName(String namespaceURI, String localName, String qName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- } else {
- return qName;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.java
deleted file mode 100644
index 315c9dcc1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.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;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.team.internal.ui.synchronize.DiffNodeWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-
-public class TeamAdapterFactory implements IAdapterFactory {
-
- private DiffNodeWorkbenchAdapter diffNodeAdapter = new DiffNodeWorkbenchAdapter();
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adaptableObject instanceof DiffNode && adapterType == IWorkbenchAdapter.class) {
- return diffNodeAdapter;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- // TODO Auto-generated method stub
- return new Class[] {IWorkbenchAdapter.class};
- }
-}
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 5de10c18f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ /dev/null
@@ -1,380 +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.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ui.synchronize.SynchronizeManager;
-import org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.ui.*;
-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 {
-
- private static TeamUIPlugin instance;
-
- // image paths
- public static final String ICON_PATH = "icons/full/"; //$NON-NLS-1$
-
- public static final String ID = "org.eclipse.team.ui"; //$NON-NLS-1$
-
- // plugin id
- public static final String PLUGIN_ID = "org.eclipse.team.ui"; //$NON-NLS-1$
-
- private static List propertyChangeListeners = new ArrayList(5);
-
- private Hashtable imageDescriptors = new Hashtable(20);
-
- /**
- * Creates a new TeamUIPlugin.
- *
- * @param descriptor the plugin descriptor
- */
- public TeamUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- initializeImages(this);
- initializePreferences();
- instance = this;
- }
-
- /**
- * 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() {
- // If the instance has not been initialized, we will wait.
- // This can occur if multiple threads try to load the plugin at the same
- // time (see bug 33825: http://bugs.eclipse.org/bugs/show_bug.cgi?id=33825)
- while (instance == null) {
- try {
- Thread.sleep(50);
- } catch (InterruptedException e) {
- // ignore and keep trying
- }
- }
- return instance;
- }
- /**
- * Initializes the preferences for this plugin if necessary.
- */
- protected void initializePreferences() {
- IPreferenceStore store = getPreferenceStore();
- store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, false);
- store.setDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS, true);
- store.setDefault(IPreferenceIds.SYNCVIEW_SELECTED_MODE, SubscriberParticipant.BOTH_MODE);
- store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, TeamSynchronizingPerspective.ID);
- store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES, true);
- store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, true);
- store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES, false);
- store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, true);
- store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SMART_MODE_SWITCH, false);
- }
-
- /**
- * 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();
- IAdapterFactory factory = new TeamAdapterFactory();
- Platform.getAdapterManager().registerAdapters(factory, DiffNode.class);
- ((SynchronizeManager)TeamUI.getSynchronizeManager()).init();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#shutdown()
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- ((SynchronizeManager)TeamUI.getSynchronizeManager()).dispose();
- }
-
- /**
- * 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);
- }
- }
-
- /**
- * 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(TeamUIPlugin plugin, String id, URL baseURL) {
- // Delegate to the plugin instance to avoid concurrent class loading problems
- plugin.privateCreateImageDescriptor(id, baseURL);
- }
- private void privateCreateImageDescriptor(String id, URL baseURL) {
- URL url = null;
- try {
- url = new URL(baseURL, ICON_PATH + id);
- } catch (MalformedURLException e) {
- }
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- imageDescriptors.put(id, desc);
- }
-
- /**
- * Returns the 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) {
- // Delegate to the plugin instance to avoid concurrent class loading problems
- return getPlugin().privateGetImageDescriptor(id);
- }
- private ImageDescriptor privateGetImageDescriptor(String id) {
- if(! imageDescriptors.containsKey(id)) {
- URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL();
- createImageDescriptor(getPlugin(), 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. The plugin is
- * provided because this method is called before the plugin staic
- * variable has been set. See the comment on the getPlugin() method
- * for a description of why this is required.
- */
- private void initializeImages(TeamUIPlugin plugin) {
- URL baseURL = plugin.getDescriptor().getInstallURL();
-
- // Overlays
- createImageDescriptor(plugin, ISharedImages.IMG_DIRTY_OVR, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CONFLICT_OVR, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CHECKEDIN_OVR, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CHECKEDOUT_OVR, baseURL);
-
-
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_VIEW, baseURL);
-
- // Collapse all
- createImageDescriptor(plugin, ISharedImages.IMG_COLLAPSE_ALL, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_COLLAPSE_ALL_ENABLED, baseURL);
-
- // Target Management Icons
- createImageDescriptor(plugin, ISharedImages.IMG_SITE_ELEMENT, baseURL);
-
- // Sync View Icons
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_INCOMING, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_OUTGOING, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_CONFLICTING, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_REFRESH, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CHANGE_FILTER, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_IGNORE_WHITESPACE, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CONTENTS, baseURL);
-
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_INCOMING_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_OUTGOING_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_CONFLICTING_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_REFRESH_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_IGNORE_WHITESPACE_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CONTENTS_DISABLED, baseURL);
-
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_INCOMING_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_OUTGOING_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_CONFLICTING_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_REFRESH_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_IGNORE_WHITESPACE_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_CONTENTS_ENABLED, baseURL);
-
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_CATCHUP, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_RELEASE, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_FREE, baseURL);
-
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_CATCHUP_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_RELEASE_DISABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_FREE_DISABLED, baseURL);
-
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_CATCHUP_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_RELEASE_ENABLED, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_FREE_ENABLED, baseURL);
-
- createImageDescriptor(plugin, ISharedImages.IMG_WIZBAN_SHARE, baseURL);
-
- // Wizard banners
- createImageDescriptor(plugin, ISharedImages.IMG_PROJECTSET_IMPORT_BANNER, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_PROJECTSET_EXPORT_BANNER, baseURL);
-
- // Live Sync View icons
- createImageDescriptor(plugin, ISharedImages.IMG_COMPRESSED_FOLDER, baseURL);
- createImageDescriptor(plugin, ISharedImages.IMG_WARNING, baseURL);
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated display. If so, this
- * display is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display= Display.getCurrent();
- if (display == null) {
- display= Display.getDefault();
- }
- return display;
- }
-
- public Image getImage(String key) {
- Image image = getImageRegistry().get(key);
- if(image == null) {
- ImageDescriptor d = getImageDescriptor(key);
- image = d.createImage();
- getImageRegistry().put(key, image);
- }
- return image;
- }
-
- public static void run(IRunnableWithProgress runnable) {
- try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable);
- } catch (InvocationTargetException e) {
- Utils.handleError(getStandardDisplay().getActiveShell(), e, null, null);
- } catch (InterruptedException e2) {
- // Nothing to be done
- }
- }
-}
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 83e5bafb6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ /dev/null
@@ -1,473 +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.HashSet;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import org.eclipse.compare.CompareConfiguration;
-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.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-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.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-
-public class Utils {
-
- /**
- * The SortOperation takes a collection of objects and returns a sorted
- * collection of these objects. Concrete instances of this class provide
- * the criteria for the sorting of the objects based on the type of the
- * objects.
- */
- static public abstract class Sorter {
-
- /**
- * Returns true is elementTwo is 'greater than' elementOne This is the
- * 'ordering' method of the sort operation. Each subclass overides this
- * method with the particular implementation of the 'greater than'
- * concept for the objects being sorted.
- */
- public abstract boolean compare(Object elementOne, Object elementTwo);
-
- /**
- * Sort the objects in sorted collection and return that collection.
- */
- private Object[] quickSort(Object[] sortedCollection, int left, int right) {
- int originalLeft = left;
- int originalRight = right;
- Object mid = sortedCollection[(left + right) / 2];
- do {
- while (compare(sortedCollection[left], mid))
- left++;
- while (compare(mid, sortedCollection[right]))
- right--;
- if (left <= right) {
- Object tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (originalLeft < right)
- sortedCollection = quickSort(sortedCollection, originalLeft, right);
- if (left < originalRight)
- sortedCollection = quickSort(sortedCollection, left, originalRight);
- return sortedCollection;
- }
-
- /**
- * Return a new sorted collection from this unsorted collection. Sort
- * using quick sort.
- */
- public Object[] sort(Object[] unSortedCollection) {
- int size = unSortedCollection.length;
- Object[] sortedCollection = new Object[size];
- //copy the array so can return a new sorted collection
- System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size);
- if (size > 1)
- quickSort(sortedCollection, 0, size - 1);
- return sortedCollection;
- }
- }
-
- /**
- * 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 IWorkbenchPartSite findSite(Control c) {
- while (c != null && !c.isDisposed()) {
- Object data = c.getData();
- if (data instanceof IWorkbenchPart)
- return ((IWorkbenchPart) data).getSite();
- c = c.getParent();
- }
- return null;
- }
-
- public static IWorkbenchPartSite findSite() {
- IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IWorkbenchPart part = page.getActivePart();
- if (part != null)
- return part.getSite();
- }
- }
- return null;
- }
-
- public static void initAction(IAction a, String prefix) {
- Utils.initAction(a, prefix, Policy.bundle);
- }
-
- public static void updateLabels(SyncInfo sync, CompareConfiguration config) {
- final IResourceVariant remote = sync.getRemote();
- final IResourceVariant base = sync.getBase();
- String localContentId = sync.getLocalContentIdentifier();
- if (localContentId != null) {
- config.setLeftLabel(Policy.bind("SyncInfoCompareInput.localLabelExists", localContentId)); //$NON-NLS-1$
- } else {
- config.setLeftLabel(Policy.bind("SyncInfoCompareInput.localLabel")); //$NON-NLS-1$
- }
- if (remote != null) {
- config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabelExists", remote.getContentIdentifier())); //$NON-NLS-1$
- } else {
- config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabel")); //$NON-NLS-1$
- }
- if (base != null) {
- config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabelExists", base.getContentIdentifier())); //$NON-NLS-1$
- } else {
- config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabel")); //$NON-NLS-1$
- }
- }
-
- /**
- * Initialize the given Action from a ResourceBundle.
- */
- public static void initAction(IAction a, String prefix, ResourceBundle bundle) {
- String labelKey = "label"; //$NON-NLS-1$
- String tooltipKey = "tooltip"; //$NON-NLS-1$
- String imageKey = "image"; //$NON-NLS-1$
- String descriptionKey = "description"; //$NON-NLS-1$
- if (prefix != null && prefix.length() > 0) {
- labelKey = prefix + labelKey;
- tooltipKey = prefix + tooltipKey;
- imageKey = prefix + imageKey;
- descriptionKey = prefix + descriptionKey;
- }
- String s = Policy.bind(labelKey, bundle);
- if (s != null)
- a.setText(s);
- s = Policy.bind(tooltipKey, bundle);
- if (s != null)
- a.setToolTipText(s);
- s = Policy.bind(descriptionKey, bundle);
- if (s != null)
- a.setDescription(s);
- String relPath = Policy.bind(imageKey, bundle);
- if (relPath != null && !relPath.equals(imageKey) && relPath.trim().length() > 0) {
- String cPath;
- String dPath;
- String ePath;
- if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
- String path = relPath.substring(1);
- cPath = 'c' + path;
- dPath = 'd' + path;
- ePath = 'e' + path;
- } else {
- cPath = "clcl16/" + relPath; //$NON-NLS-1$
- dPath = "dlcl16/" + relPath; //$NON-NLS-1$
- ePath = "elcl16/" + relPath; //$NON-NLS-1$
- }
- ImageDescriptor id = TeamImages.getImageDescriptor(dPath); // we
- // set
- // the
- // disabled
- // image
- // first
- // (see
- // PR
- // 1GDDE87)
- if (id != null)
- a.setDisabledImageDescriptor(id);
- id = TeamUIPlugin.getImageDescriptor(cPath);
- if (id != null)
- a.setHoverImageDescriptor(id);
- id = TeamUIPlugin.getImageDescriptor(ePath);
- if (id != null)
- a.setImageDescriptor(id);
- }
- }
-
- public static String modeToString(int mode) {
- switch (mode) {
- case SubscriberParticipant.INCOMING_MODE :
- return Policy.bind("Utils.22"); //$NON-NLS-1$
- case SubscriberParticipant.OUTGOING_MODE :
- return Policy.bind("Utils.23"); //$NON-NLS-1$
- case SubscriberParticipant.BOTH_MODE :
- return Policy.bind("Utils.24"); //$NON-NLS-1$
- case SubscriberParticipant.CONFLICTING_MODE :
- return Policy.bind("Utils.25"); //$NON-NLS-1$
- }
- return Policy.bind("Utils.26"); //$NON-NLS-1$
- }
-
- public static String workingSetToString(IWorkingSet set, int maxLength) {
- String text = Policy.bind("StatisticsPanel.noWorkingSet"); //$NON-NLS-1$
- if (set != null) {
- text = set.getName();
- if (text.length() > maxLength) {
- text = text.substring(0, maxLength - 3) + "..."; //$NON-NLS-1$
- }
- }
- return text;
- }
-
- /**
- * Returns the list of resources contained in the given elements.
- * @param elements
- * @return the list of resources contained in the given elements.
- */
- public static IResource[] getResources(Object[] elements) {
- List resources = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
- IResource resource = null;
- if (element instanceof IResource) {
- resource = (IResource)element;
- } else if (element instanceof SynchronizeModelElement){
- resource = ((SynchronizeModelElement) element).getResource();
- } else {
- resource = (IResource)getAdapter(element, IResource.class);
- }
- if (resource != null) {
- resources.add(resource);
- }
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- public static Object getAdapter(Object element, Class adapter) {
- if (element instanceof IAdaptable) {
- return ((IAdaptable) element).getAdapter(adapter);
- }
- return null;
- }
-
- /**
- * This method returns all out-of-sync SyncInfos that are in the current
- * selection.
- *
- * @return the list of selected sync infos
- */
- public static IDiffElement[] getDiffNodes(Object[] selected) {
- Set result = new HashSet();
- for (int i = 0; i < selected.length; i++) {
- Object object = selected[i];
- if(object instanceof IDiffElement) {
- collectAllNodes((IDiffElement)object, result);
- }
- }
- return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
- }
-
- private static void collectAllNodes(IDiffElement element, Set nodes) {
- if(element.getKind() != SyncInfo.IN_SYNC) {
- nodes.add(element);
- }
- if(element instanceof IDiffContainer) {
- IDiffElement[] children = ((IDiffContainer)element).getChildren();
- for (int i = 0; i < children.length; i++) {
- collectAllNodes(children[i], nodes);
- }
- }
- }
-
- public static void schedule(Job job, IWorkbenchSite site) {
- if (site != null) {
- IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService) site.getAdapter(IWorkbenchSiteProgressService.class);
- if (siteProgress != null) {
- siteProgress.useHalfBusyCursor(job);
- siteProgress.schedule(job);
- return;
- }
- }
- job.schedule();
- }
-} \ No newline at end of file
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 2ec58ed3b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.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.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.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-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 {
- private static class ResizeWizardDialog extends WizardDialog {
- public ResizeWizardDialog(Shell parentShell, IWizard newWizard) {
- super(parentShell, newWizard);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
- }
-
- /*
- * 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 ResizeWizardDialog(getShell(), wizard);
- //dialog.
- 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.isShared(selectedProjects[0])) 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/ITeamRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ITeamRunnableContext.java
deleted file mode 100644
index 36218fc9a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ITeamRunnableContext.java
+++ /dev/null
@@ -1,46 +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.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * An ITeamRunnableContext is used to provide the context for a Team operation.
- * The hierarchy of contexts is used to configure the following:
- * 1) whether the operation is run in the background as a job
- * 2) whether the operation modifies the workspace
- * 3) what shell the operation should use to display info to the user
- */
-public interface ITeamRunnableContext {
-
- /**
- * Run the given runnable in the context of the receiver. By default, the
- * progress is provided by the active workbench windows but subclasses may
- * override this to provide progress in some other way (Progress Monitor or
- * job).
- */
- public abstract void run(
- String title,
- ISchedulingRule schedulingRule,
- boolean postponeBuild,
- IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException;
-
- /**
- * Get a shell that can be used to prompt the user.
- * @return a shell
- */
- public abstract Shell getShell();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
deleted file mode 100644
index 3eebe1a5b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.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.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This runnable context executes it's operation in the context of a background job.
- */
-public class JobRunnableContext implements ITeamRunnableContext {
-
- private IJobChangeListener listener;
- private IWorkbenchSite site;
-
- public JobRunnableContext() {
- this(null, null);
- }
-
- public JobRunnableContext(IJobChangeListener listener, IWorkbenchSite site) {
- this.listener = listener;
- this.site = site;
- }
-
- protected IStatus run(IRunnableWithProgress runnable, IProgressMonitor monitor) {
- try {
- runnable.run(monitor);
- } catch (InvocationTargetException e) {
- return TeamException.asTeamException(e).getStatus();
- } catch (InterruptedException e) {
- return Status.OK_STATUS;
- }
- return Status.OK_STATUS;
- }
-
- protected Job getBasicJob(String title, final IRunnableWithProgress runnable) {
- return new Job(title) {
- public IStatus run(IProgressMonitor monitor) {
- return JobRunnableContext.this.run(runnable, monitor);
- }
- };
- }
-
- protected Job getWorkspaceJob(String title, final IRunnableWithProgress runnable) {
- return new WorkspaceJob(title) {
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- return JobRunnableContext.this.run(runnable, monitor);
- }
- };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#run(java.lang.String, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(String title, ISchedulingRule schedulingRule, boolean postponeBuild, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- Job job;
- if (schedulingRule == null && !postponeBuild) {
- job = getBasicJob(title, runnable);
- } else {
- job = getWorkspaceJob(title, runnable);
- if (schedulingRule != null) {
- job.setRule(schedulingRule);
- }
- }
- if (listener != null) {
- job.addJobChangeListener(listener);
- }
- Utils.schedule(job, site);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#getShell()
- */
- public Shell getShell() {
- final Shell[] newShell = new Shell[] { null };
- Display.getDefault().syncExec(
- new Runnable() {
- public void run() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- Display display = Display.getDefault();
- newShell[0] = new Shell(display);
- } else {
- newShell[0] = window.getShell();
- }
- }
- });
- return newShell[0];
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java
deleted file mode 100644
index 8ad5daffc..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.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.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-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.jobs.ISchedulingRule;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * This CVS runnable context blocks the UI and can therfore have a shell assigned to
- * it (since the shell won't be closed by the user before the runnable completes.
- */
-public class ProgressDialogRunnableContext implements ITeamRunnableContext {
-
- private Shell shell;
- private IRunnableContext runnableContext;
-
- public ProgressDialogRunnableContext(Shell shell) {
- this.shell = shell;
- }
-
- /**
- * Run the given runnable in the context of the receiver. By default, the
- * progress is provided by the active workbench windows but subclasses may
- * override this to provide progress in some other way (Progress Monitor or
- * job).
- */
- public void run(String title, ISchedulingRule schedulingRule, boolean postponeBuild, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- getRunnableContext().run(true /* fork */, true /* cancelable */, wrapRunnable(title, schedulingRule, postponeBuild, runnable));
- }
-
- protected IRunnableContext getRunnableContext() {
- if (runnableContext == null) {
- return new IRunnableContext() {
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- IProgressService manager = PlatformUI.getWorkbench().getProgressService();
- manager.busyCursorWhile(runnable);
- }
- };
- }
- return runnableContext;
- }
-
- /*
- * Return an IRunnableWithProgress that sets the task name for the progress monitor
- * and runs in a workspace modify operation if requested.
- */
- private IRunnableWithProgress wrapRunnable(final String title, final ISchedulingRule schedulingRule, final boolean postponeBuild, final IRunnableWithProgress runnable) {
- return new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(title, 100);
- try {
- if (schedulingRule == null && !postponeBuild) {
- runnable.run(Policy.subMonitorFor(monitor, 100));
- } else {
- final Exception[] exception = new Exception[] { null };
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- runnable.run(pm);
- } catch (InvocationTargetException e) {
- exception[0] = e;
- } catch (InterruptedException e) {
- exception[0] = e;
- }
- }
- }, schedulingRule, 0 /* allow updates */, Policy.subMonitorFor(monitor, 100));
- if (exception[0] != null) {
- if (exception[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException)exception[0];
- } else if (exception[0] instanceof InterruptedException) {
- throw (InterruptedException)exception[0];
- }
- }
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- };
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSRunnableContext#getShell()
- */
- public Shell getShell() {
- return shell;
- }
-
- /**
- * Set the shell to be used by the owner of this context to prompt the user.
- * @param shell
- */
- public void setShell(Shell shell) {
- this.shell = shell;
- }
-
- /**
- * @param runnableContext
- */
- public void setRunnableContext(IRunnableContext runnableContext) {
- this.runnableContext = runnableContext;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java
deleted file mode 100644
index 6f0dc745b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java
+++ /dev/null
@@ -1,329 +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 java.util.*;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
-import org.eclipse.ui.*;
-
-/**
- * This action provides utilities for performing operations on selections that
- * contain instances of {@link SyncInfoModelElement}. Subclasses can use this support
- * to:
- * <ul>
- * <li>provides easy filtering of selection
- * <li>provides scheduling action via workbench part (provide feedback via view)
- * <li>provides support for running action in background or foreground
- * <li>provides support for locking workspace resources
- * </ul>
- * @see SyncInfo
- * @see SyncInfoSet
- * @see SyncInfoModelElement
- * @since 3.0
- */
-public abstract class SubscriberAction implements IObjectActionDelegate, IViewActionDelegate, IEditorActionDelegate {
-
- private IStructuredSelection selection;
- private IWorkbenchPart part;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public final void run(IAction action) {
- // TODO: We used to prompt for unsaved changes in any editor. We don't anymore. Would
- // it be better to prompt for unsaved changes to editors affected by this action?
- SyncInfoSet syncSet = makeSyncInfoSetFromSelection(getFilteredSyncInfos());
- if (syncSet == null || syncSet.isEmpty()) return;
- try {
- getRunnableContext().run(getJobName(syncSet), getSchedulingRule(syncSet), true, getRunnable(syncSet));
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- handle(e);
- }
- }
-
- /**
- * Subsclasses must override to provide behavior for the action.
- * @param syncSet the set of filtered sync info objects on which to perform the action.
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws TeamException if something went wrong running the action
- */
- protected abstract void run(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException;
-
- /**
- * Subsclasses may override to perform custom processing on the selection before
- * the action is run. This can be used to prompt the user for more information.
- * @param infos the
- */
- protected SyncInfoSet makeSyncInfoSetFromSelection(SyncInfo[] infos) {
- return new SyncInfoSet(infos);
- }
-
- protected void handle(Exception e) {
- Utils.handle(e);
- }
-
- /**
- * This method returns all instances of SyncInfo that are in the current
- * selection. For a tree view, this is any descendants of the selected resource that are
- * contained in the view.
- *
- * @return the selected resources
- */
- protected IDiffElement[] getDiffElements() {
- return Utils.getDiffNodes(((IStructuredSelection)selection).toArray());
- }
-
- /**
- * 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 (getFilteredDiffElements().length > 0);
- }
-
- /**
- * Default filter includes all out-of-sync elements in the current
- * selection.
- * @return a sync info filter which selects all out-of-sync resources.
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new FastSyncInfoFilter();
- }
-
- /**
- * Return the selected diff element for which this action is enabled.
- * @return the list of selected diff elements for which this action is enabled.
- */
- protected IDiffElement[] getFilteredDiffElements() {
- IDiffElement[] elements = getDiffElements();
- List filtered = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement e = elements[i];
- if (e instanceof SyncInfoModelElement) {
- SyncInfo info = ((SyncInfoModelElement) e).getSyncInfo();
- if (info != null && getSyncInfoFilter().select(info)) {
- filtered.add(e);
- }
- }
- }
- return (IDiffElement[]) filtered.toArray(new IDiffElement[filtered.size()]);
- }
-
- /**
- * Return the selected SyncInfo for which this action is enabled.
- * @return the selected SyncInfo for which this action is enabled.
- */
- protected SyncInfo[] getFilteredSyncInfos() {
- IDiffElement[] elements = getFilteredDiffElements();
- List filtered = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement e = elements[i];
- if (e instanceof SyncInfoModelElement) {
- filtered.add(((SyncInfoModelElement)e).getSyncInfo());
- }
- }
- return (SyncInfo[]) filtered.toArray(new SyncInfo[filtered.size()]);
- }
-
- private void markBusy(IDiffElement[] elements, boolean isBusy) {
- for (int i = 0; i < elements.length; i++) {
- IDiffElement element = elements[i];
- if (element instanceof SynchronizeModelElement) {
- ((SynchronizeModelElement)element).setPropertyToRoot(SynchronizeModelElement.BUSY_PROPERTY, isBusy);
- }
- }
- }
-
- /**
- * Uses the {@link #canRunAsJob()} hint to return a {@link ITeamRunnableContext}.
- *
- * @return the runnable context in which to run this action.
- */
- protected ITeamRunnableContext getRunnableContext() {
- if (canRunAsJob()) {
- // mark resources that will be affected by job
- final IDiffElement[] affectedElements = getFilteredDiffElements();
- markBusy(affectedElements, true);
-
- // register to unmark when job is finished
- IJobChangeListener listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- markBusy(affectedElements, false);
- }
- };
- return new JobRunnableContext(listener, getSite());
- } else {
- return new ProgressDialogRunnableContext(getShell());
- }
- }
-
- /**
- * If this action can safely be run in the background, then subclasses can
- * override this method and return <code>true</code>. This will make their
- * action run in a {@link Job}.
- *
- * @return <code>true</code> if this action can be run in the background and
- * <code>false</code> otherwise.
- */
- protected boolean canRunAsJob() {
- return false;
- }
-
- /**
- * Return the job name to be used if the action can run as a job.
- *
- * @param syncSet
- * @return
- */
- protected String getJobName(SyncInfoSet syncSet) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Return a scheduling rule that includes all resources that will be operated
- * on by the subscriber action. The default behavior is to include all projects
- * effected by the operation. Subclasses may override.
- *
- * @param syncSet
- * @return
- */
- protected ISchedulingRule getSchedulingRule(SyncInfoSet syncSet) {
- IResource[] resources = syncSet.getResources();
- Set set = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- set.add(resource.getProject());
- }
- IProject[] projects = (IProject[]) set.toArray(new IProject[set.size()]);
- if (projects.length == 1) {
- return projects[0];
- } else {
- return new MultiRule(projects);
- }
- }
-
- protected IRunnableWithProgress getRunnable(final SyncInfoSet syncSet) {
- return new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- SubscriberAction.this.run(syncSet, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- }
-
- private IWorkbenchSite getSite() {
- IWorkbenchSite site = null;
- if(part != null) {
- site = part.getSite();
- }
- return site;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.part = targetPart;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
- this.part = view;
- }
-
- /*
- * 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);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- // Ignore since these actions aren't meant for editors.
- // This seems to be required because of a bug in the UI
- // plug-in that will disable viewer actions if they aren't
- // editor actions? Go figure...
- }
-
- protected Shell getShell() {
- if(part != null) {
- return part.getSite().getShell();
- } else {
- IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
- if (workbench == null) return null;
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window == null) return null;
- return window.getShell();
- }
- }
-} \ No newline at end of file
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 706fe6d96..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ /dev/null
@@ -1,362 +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.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-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, IViewActionDelegate {
- // 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;
- public final static int PROGRESS_WORKBENCH_WINDOW = 3;
-
- 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_WORKBENCH_WINDOW :
- try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable);
- } catch (InterruptedException e1) {
- exceptions[0] = null;
- e1.printStackTrace();
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- }
- break;
- 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) {
- if(targetPart != null) {
- 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;
- }
-
- /**
- * @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;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
- targetPart = view;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
deleted file mode 100644
index 53069ba25..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
+++ /dev/null
@@ -1,306 +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.*;
-
-/**
- * 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);
- }
- if(includeDetailsButton()) {
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, getDetailsButtonLabelShow(), false);
- }
- updateEnablements();
- }
-
- protected String getDetailsButtonLabelShow() {
- return IDialogConstants.SHOW_DETAILS_LABEL;
- }
-
- protected String getDetailsButtonLabelHide() {
- return IDialogConstants.HIDE_DETAILS_LABEL;
- }
-
- /* (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));
-
- // 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_BEGINNING));
-
- // 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));
- createMainDialogArea(right);
- } else {
- createMainDialogArea(composite);
- }
-
- if(includeErrorMessage()) {
- errorMessageLabel = new Label(composite, SWT.NONE);
- errorMessageLabel.setLayoutData(new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
- }
-
- Dialog.applyDialogFont(parent);
- 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(getDetailsButtonLabelShow());
- } else {
- detailsComposite = createDropDownDialogArea((Composite)getContents());
- detailsCreated = true;
- detailsButton.setText(getDetailsButtonLabelHide());
- }
- Dialog.applyDialogFont(getContents());
- 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));
- return composite;
- }
-
- protected boolean isDetailsVisible() {
- return detailsCreated;
- }
-
- protected boolean includeErrorMessage() {
- return true;
- }
-
- protected boolean includeDetailsButton() {
- return true;
- }
-}
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 30dcc23c6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
+++ /dev/null
@@ -1,108 +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.*;
-
-/**
- * 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 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);
- 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));
-
- 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 035f8a3cb..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java
+++ /dev/null
@@ -1,213 +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;
- }
- protected Label createLabel(Composite parent, String text, int horizontalSpan) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = horizontalSpan;
- data.horizontalAlignment = GridData.FILL;
- 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;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- 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 acaf2b035..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
+++ /dev/null
@@ -1,412 +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) {
- Composite composite = (Composite)super.createDialogArea(parent);
- ((GridLayout) composite.getLayout()).numColumns = 1;
-
- // 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));
-
- 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(parent);
- 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.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);
- updateMessage();
- return fTitleArea;
- }
-
- /**
- * Creates the inner page container.
- */
- private Composite createPageContainer(Composite parent) {
- Composite result = new Composite(parent, SWT.NULL);
- result.setLayout(new PageLayout());
- 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/RefreshChangeListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java
deleted file mode 100644
index d5a3d1723..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.team.internal.ui.jobs;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.synchronize.*;
-
-class RefreshChangeListener implements ISubscriberChangeListener {
- private List changes = new ArrayList();
- private SubscriberSyncInfoCollector collector;
-
- RefreshChangeListener(SubscriberSyncInfoCollector collector) {
- this.collector = collector;
- }
- public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- for (int i = 0; i < deltas.length; i++) {
- ISubscriberChangeEvent delta = deltas[i];
- if (delta.getFlags() == ISubscriberChangeEvent.SYNC_CHANGED) {
- changes.add(delta);
- }
- }
- }
- public SyncInfo[] getChanges() {
- collector.waitForCollector(new NullProgressMonitor());
- List changedSyncInfos = new ArrayList();
- SyncInfoSet set = collector.getSubscriberSyncInfoSet();
- for (Iterator it = changes.iterator(); it.hasNext();) {
- ISubscriberChangeEvent delta = (ISubscriberChangeEvent) it.next();
- SyncInfo info = set.getSyncInfo(delta.getResource());
- if (info != null && interestingChange(info)) {
- changedSyncInfos.add(info);
- }
- }
- return (SyncInfo[]) changedSyncInfos.toArray(new SyncInfo[changedSyncInfos.size()]);
- }
-
- private boolean interestingChange(SyncInfo info) {
- int kind = info.getKind();
- if(isThreeWay()) {
- int direction = SyncInfo.getDirection(kind);
- return (direction == SyncInfo.INCOMING || direction == SyncInfo.CONFLICTING);
- } else {
- return SyncInfo.getChange(kind) != SyncInfo.IN_SYNC;
- }
- }
-
- private boolean isThreeWay() {
- return collector.getSubscriber().getResourceComparator().isThreeWay();
- }
-
- public void clear() {
- changes.clear();
- }
-}
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 439cc04f8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
+++ /dev/null
@@ -1,351 +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 java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.IRefreshEvent;
-import org.eclipse.team.internal.ui.synchronize.IRefreshSubscriberListener;
-
-/**
- * Job to refresh a subscriber with its remote state.
- *
- * There can be several refresh jobs created but they will be serialized.
- * This is accomplished using a synchrnized block on the family id. It is
- * important that no scheduling rules are used for the job in order to
- * avoid possible deadlock.
- */
-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;
-
- /**
- * The subscribers and roots to refresh. If these are changed when the job
- * is running the job is cancelled.
- */
- private IResource[] resources;
- private SubscriberSyncInfoCollector collector;
-
- /**
- * Refresh started/completed listener for every refresh
- */
- private static List listeners = new ArrayList(1);
-
- protected static class RefreshEvent implements IRefreshEvent {
- int type;
- Subscriber subscriber;
- SyncInfo[] changes;
- long startTime = 0;
- long stopTime = 0;
- IStatus status;
- IResource[] resources;
-
- RefreshEvent(int type, IResource[] resources, Subscriber subscriber) {
- this.type = type;
- this.subscriber = subscriber;
- this.resources = resources;
- }
-
- public int getRefreshType() {
- return type;
- }
-
- public Subscriber getSubscriber() {
- return subscriber;
- }
-
- public SyncInfo[] getChanges() {
- return changes;
- }
-
- public void setChanges(SyncInfo[] changes) {
- this.changes = changes;
- }
-
- /**
- * @return Returns the startTime.
- */
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * @param startTime The startTime to set.
- */
- public void setStartTime(long startTime) {
- this.startTime = startTime;
- }
-
- /**
- * @return Returns the stopTime.
- */
- public long getStopTime() {
- return stopTime;
- }
-
- /**
- * @param stopTime The stopTime to set.
- */
- public void setStopTime(long stopTime) {
- this.stopTime = stopTime;
- }
-
- public IStatus getStatus() {
- return status;
- }
-
- public void setStatus(IStatus status) {
- this.status = status;
- }
-
- public IResource[] getResources() {
- return resources;
- }
- }
-
- private abstract class Notification implements ISafeRunnable {
- private IRefreshSubscriberListener listener;
- public void handleException(Throwable exception) {
- // don't log the exception....it is already being logged in Platform#run
- }
- public void run(IRefreshSubscriberListener listener) {
- this.listener = listener;
- Platform.run(this);
- }
- public void run() throws Exception {
- notify(listener);
- }
- /**
- * Subsclasses overide this method to send an event safely to a lsistener
- * @param listener
- */
- protected abstract void notify(IRefreshSubscriberListener listener);
- }
-
-
- public RefreshSubscriberJob(String name, IResource[] resources, SubscriberSyncInfoCollector collector) {
- this(name, collector);
- this.resources = resources;
- }
-
- public RefreshSubscriberJob(String name, SubscriberSyncInfoCollector collector) {
- super(name);
-
- this.collector = collector;
-
- setPriority(Job.DECORATE);
- setRefreshInterval(3600 /* 1 hour */);
-
- 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 collector != null && getSubscriber() != 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) {
- // Synchronized to ensure only one refresh job is running at a particular time
- synchronized (getFamily()) {
- MultiStatus status = new MultiStatus(TeamUIPlugin.ID, TeamException.UNABLE, Policy.bind("RefreshSubscriberJob.0"), null); //$NON-NLS-1$
- Subscriber 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(null, 100);
- RefreshEvent event = new RefreshEvent(reschedule ? IRefreshEvent.SCHEDULED_REFRESH : IRefreshEvent.USER_REFRESH, roots, collector.getSubscriber());
- RefreshChangeListener changeListener = new RefreshChangeListener(collector);
- try {
- // Only allow one refresh job at a time
- // NOTE: It would be cleaner if this was done by a scheduling
- // rule but at the time of writting, it is not possible due to
- // the scheduling rule containment rules.
- event.setStartTime(System.currentTimeMillis());
- if(monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- try {
- // Set-up change listener so that we can determine the changes found
- // during this refresh.
- subscriber.addListener(changeListener);
- // Pre-Notify
- notifyListeners(true, event);
- // Perform the refresh
- subscriber.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();
- }
-
- // Post-Notify
- event.setChanges(changeListener.getChanges());
- event.setStopTime(System.currentTimeMillis());
- event.setStatus(status.isOK() ? Status.OK_STATUS : (IStatus) status);
- notifyListeners(false, event);
- changeListener.clear();
-
- return event.getStatus();
- }
- }
-
- protected IResource[] getResources() {
- if(resources != null) {
- return resources;
- } else {
- return collector.getSubscriber().roots();
- }
- }
-
- protected Subscriber getSubscriber() {
- return collector.getSubscriber();
- }
-
- public long getScheduleDelay() {
- return scheduleDelay;
- }
-
- protected void start() {
- if(getState() == Job.NONE) {
- if(shouldReschedule()) {
- schedule(getScheduleDelay());
- }
- }
- }
-
- /**
- * Specify the interval in seconds at which this job is scheduled.
- * @param seconds delay specified in seconds
- */
- public void setRefreshInterval(long seconds) {
- boolean restart = false;
- if(getState() == Job.SLEEPING) {
- restart = true;
- cancel();
- }
- scheduleDelay = seconds * 1000;
- if(restart) {
- start();
- }
- }
-
- /**
- * Returns the interval of this job in seconds.
- * @return
- */
- 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 static void addRefreshListener(IRefreshSubscriberListener listener) {
- synchronized(listeners) {
- if(! listeners.contains(listener)) {
- listeners.add(listener);
- }
- }
- }
-
- public static void removeRefreshListener(IRefreshSubscriberListener listener) {
- synchronized(listeners) {
- listeners.remove(listener);
- }
- }
-
- protected void notifyListeners(final boolean started, final IRefreshEvent event) {
- // Get a snapshot of the listeners so the list doesn't change while we're firing
- IRefreshSubscriberListener[] listenerArray;
- synchronized (listeners) {
- listenerArray = (IRefreshSubscriberListener[]) listeners.toArray(new IRefreshSubscriberListener[listeners.size()]);
- }
- // Notify each listener in a safe manner (i.e. so their exceptions don't kill us)
- for (int i = 0; i < listenerArray.length; i++) {
- IRefreshSubscriberListener listener = listenerArray[i];
- Notification notification = new Notification() {
- protected void notify(IRefreshSubscriberListener listener) {
- if(started) {
- listener.refreshStarted(event);
- } else {
- listener.refreshDone(event);
- }
- }
- };
- notification.run(listener);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
deleted file mode 100644
index 52191239a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package org.eclipse.team.internal.ui.jobs;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.synchronize.SyncInfo;
-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.synchronize.IRefreshEvent;
-import org.eclipse.team.internal.ui.synchronize.IRefreshSubscriberListener;
-import org.eclipse.team.internal.ui.synchronize.RefreshCompleteDialog;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-
-public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener {
-
- private SubscriberParticipant participant;
- private boolean addIfNeeded;
-
- public RefreshUserNotificationPolicy(SubscriberParticipant participant, boolean addIfNeeded) {
- this.participant = participant;
- this.addIfNeeded = addIfNeeded;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshStarted(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
- */
- public void refreshStarted(IRefreshEvent event) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshDone(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
- */
- public void refreshDone(IRefreshEvent event) {
- if(event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber()) return;
-
- int type = event.getRefreshType();
-
- boolean promptWithChanges = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES);
- boolean promptWhenNoChanges = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES);
- boolean promptWithChangesBkg = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES);
- boolean promptWhenNoChangesBkg = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES);
-
- boolean shouldPrompt = false;
- SyncInfo[] infos = event.getChanges();
-
- if (type == IRefreshEvent.USER_REFRESH) {
- if (promptWhenNoChanges && infos.length == 0) {
- shouldPrompt = true;
- } else if (promptWithChanges && infos.length > 0) {
- shouldPrompt = true;
- }
- } else {
- if (promptWhenNoChangesBkg && infos.length == 0) {
- shouldPrompt = true;
- } else if (promptWithChangesBkg && infos.length > 0) {
- shouldPrompt = true;
- }
- }
-
- // If there are interesting changes, ensure the sync view is showing them
- // Also, add the participant to the sync view only if changes have been found.
- if (infos.length > 0) {
- participant.setMode(SubscriberParticipant.INCOMING_MODE);
- final ISynchronizeManager manager = TeamUI.getSynchronizeManager();
- if (addIfNeeded) {
- manager.addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- ISynchronizeView view = manager.showSynchronizeViewInActivePage(null);
- if (view != null) {
- view.display(participant);
- }
- }
- });
- }
- }
-
- // Prompt user if preferences are set for this type of refresh.
- if (shouldPrompt) {
- notifyIfNeededModal(event);
- }
- RefreshSubscriberJob.removeRefreshListener(this);
- }
-
- private void notifyIfNeededModal(final IRefreshEvent event) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- RefreshCompleteDialog d = new RefreshCompleteDialog(new Shell(TeamUIPlugin.getStandardDisplay()), event, participant);
- d.setBlockOnOpen(false);
- d.open();
- }
- });
- }
-
- private void notifyIfNeededNonModal(final IRefreshEvent event) {
- String message = Policy.bind("RefreshUserNotificationPolicy.0", event.getSubscriber().getName()); //$NON-NLS-1$
- PlatformUI.getWorkbench().getProgressService().requestInUI(new UIJob(message) {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- RefreshCompleteDialog d = new RefreshCompleteDialog(new Shell(TeamUIPlugin.getStandardDisplay()), event, participant);
- d.setBlockOnOpen(false);
- d.open();
- return Status.OK_STATUS;
- }
- }, message);
- }
-} \ 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 b132fce74..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ /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
-###############################################################################
-###############################################
-# Message catalog for org.eclipse.team.ui
-###############################################
-
-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.titleTooltip=Working Set: {0}
-LiveSyncView.title=Synchronize
-LiveSyncView.titleSubscriber=Synchronize - {0}
-
-SyncInfoCompareInput.localLabel=Local File
-SyncInfoCompareInput.localLabelExists=Local File ({0})
-SyncInfoCompareInput.remoteLabel=Remote File
-SyncInfoCompareInput.baseLabel=Common Ancestor
-SyncInfoCompareInput.remoteLabelExists=Remote File ({0})
-SyncInfoCompareInput.baseLabelExists=Common Ancestor ({0})
-SyncInfoCompareInput.title={0}
-SyncInfoCompareInput.tooltip={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=Refreshing synchronize view partners with remote
-SyncViewRefresh.taskName=Refreshing ''{0}''
-
-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
-
-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.toggleViewFlat.label=Flat
-action.toggleViewFlat.image=flatLayout.gif
-
-action.toggleViewHierarchical.label=Hierarchical
-action.toggleViewHierarchical.image=hierarchicalLayout.gif
-
-action.workingSets.label=Working Sets
-action.workingSets.none=Working Sets
-action.workingSets.tooltip=Working Sets
-action.workingSets.description=Working Sets
-action.workingSets.image=workingsets.gif
-
-action.collapseAll.label=Collapse All
-action.collapseAll.tooltip=Collapse All
-action.collapseAll.description=Collapse All
-action.collapseAll.image=collapseall.gif
-
-action.configureSchedulel.label=Schedule...
-action.configureSchedulel.tooltip=Configure the Refresh Schedule...
-
-action.changeFilters.label=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
-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
-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
-action.directionFilterConflicts.tooltip=Conflicts Mode
-action.directionFilterConflicts.description=Conflicts Mode (shows conflicts)
-action.directionFilterConflicts.image=conflict_synch.gif
-
-action.directionFilterBoth.label=Both
-action.directionFilterBoth.tooltip=Incoming/Outgoing mode
-action.directionFilterBoth.description=Incoming/Outgoing mode (shows outgoing changes, incoming changes, and conflicts)
-action.directionFilterBoth.image=catchuprelease_rls.gif
-
-action.refreshSubscriber.label=Registered Synchronize Partners
-action.refreshSubscriber.tooltip=Registered Synchronize Partners
-action.refreshSubscriber.description=Registered Synchronize Partners
-action.refreshSubscriber.image=contents.gif
-
-action.comparisonCriteria.label=Comparison Criteria
-action.comparisonCriteria.tooltip=Select the comparison method
-action.comparisonCriteria.description=Select the comparison method
-action.comparisonCriteria.image=showsync_rn.gif
-
-action.navigateNext.label=Go to Next Difference
-action.navigateNext.tooltip=Go to Next Difference
-action.navigateNext.description=Go to Next Difference
-action.navigateNext.image=next_nav.gif
-
-action.navigatePrevious.label=Go to Previous Difference
-action.navigatePrevious.tooltip=Go to Previous Difference
-action.navigatePrevious.description=Go to Next Difference
-action.navigatePrevious.image=prev_nav.gif
-
-action.removePage.label=Remove
-action.removePage.tooltip=Remove
-action.removePage.description=Remove
-action.removePage.image=rem_co.gif
-
-action.expandAll.label=E&xpand All
-action.open.label=&Open
-action.openInCompareEditor.label=Open In Compare Editor
-action.cancelSubscriber.label=Cancel
-
-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
-action.layout.label=Layout
-
-###############################################
-# Misc
-###############################################
-
-SynchronizeView.12=One item selected
-SynchronizeView.13=\ items selected
-SynchronizeView.14=Error opening perspective
-SynchronizeView.16=Error opening view
-
-StatisticsPanel.outgoing=Outgoing:
-StatisticsPanel.incoming=Incoming:
-StatisticsPanel.conflicting=Conflicting:
-StatisticsPanel.changeNumbers={0}/{1}
-StatisticsPanel.outgoing=Outgoing
-StatisticsPanel.conflicting=Conflicting
-StatisticsPanel.incoming=Incoming
-StatisticsPanel.noWorkingSet=<No Working Set>
-StatisticsPanel.workingSetTooltip=Double-click to change the working set applied to the Synchronize View.
-StatisticsPanel.numbersTooltip=The number of ''{0}'' changes in the entire workspace.
-StatisticsPanel.numbersWorkingSetTooltip=The number of ''{0}'' changes in working set ''{1}'' versus those in the entire workspace.
-StatisticsPanel.numberTotal={0} changes
-
-SyncViewerPreferencePage.6=General Synchronize Settings
-SyncViewerPreferencePage.7=General Team 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.15=Perspective Switching
-
-RefreshSubscriberInputJob.1=Synchronizing ''{0}'' with remote: {1} resources
-RefreshSubscriberJob.1=Team refresh {0} folders for {1}
-RefreshSubscriberJob.0=An error occured while synchronizing with remote contents.
-
-CopyAction.title=&Copy
-CopyAction.toolTip=Copy
-CopyAction.errorTitle=Problem Copying to Clipboard
-CopyAction.errorMessage=There was a problem when accessing the system clipboard. Retry?
-PasteAction.title=&Paste
-PasteAction.toolTip=Paste
-RefactorActionGroup.0=Edi&t
-SynchronizeManager.7=Error notifying of added/removal of synchronize participants
-SynchronizeManager.8=Error initializing participants
-SynchronizeManager.9=Synchronize participant with id {0} is not in the registry
-SynchronizeManager.10=Error saving synchronize participants
-SynchronizeView.1=Synchronize
-SynchronizeView.2=Synchronize -
-SyncViewerPreferencePage.19=Show all synchronization information in a resource\'s text label
-TeamSubscriberParticipantPage.7=Resource
-TeamSubscriberParticipantPage.8=In Folder
-TeamSubscriberSyncPage.labelWithSyncKind={0} {1}
-AbstractSynchronizeParticipant.4=Cannot initialize participant. Wrong descriptor type
-
-SynchronizeManager.11=Error creating participant instance
-AbstractSynchronizeParticipant.5=Exception notifying participant listeners of changes.
-SynchronizeManager.13=Error initializing synchronize participant
-SyncViewerPreferencePage.16=Prompt at the end of a refresh even when no changes are found.
-SyncViewerPreferencePage.17=Prompt at the end of a refresh if changes are found.
-SyncViewerPreferencePage.30=Prompting
-SyncViewerPreferencePage.31=Prompt at the end of a scheduled refresh even when no changes are found
-SyncViewerPreferencePage.32=Prompt at the end of a scheduled refresh when changes are found
-
-ChangesSection.filterHides=The current ''{0}'' mode is empty.
-ChangesSection.filterHidesSingular=However there is {0} change in the ''{1}'' mode.
-ChangesSection.filterHidesPlural=However there are {0} changes in the ''{1}'' mode.
-ChangesSection.filterChange=Change to ''{0}'' mode.
-ChangesSection.workingSetHiding=The current working set ''{0}'' is hiding changes in your workspace.
-ChangesSection.workingSetRemove=Remove working set.
-ChangesSection.noChanges=No changes in ''{0}''.
-Utils.22=Incoming
-Utils.23=Outgoing
-Utils.24=Incoming/Outgoing
-Utils.25=Conflicting
-Utils.26=unknown mode
-RefreshCompleteDialog.4=Team Resfresh Complete - {0}
-RefreshCompleteDialog.5={0} new changes found
-RefreshCompleteDialog.6=No new changes found
-RefreshCompleteDialog.7=refreshing the following {0} resource(s):
-RefreshCompleteDialog.13=SyncViewerPreferencePage.16
-RefreshCompleteDialog.14=SyncViewerPreferencePage.17
-RefreshCompleteDialog.15=SyncViewerPreferencePage.31
-RefreshCompleteDialog.16=SyncViewerPreferencePage.32
-RefreshCompleteDialog.17=Preview Changes >>
-RefreshCompleteDialog.18=<< Preview Changes
-RefreshUserNotificationPolicy.0=Refresh of ''{0}'' Complete.
-ConfigureRefreshScheduleDialog.0=Configure Refresh Schedule - {0}
-ConfigureRefreshScheduleDialog.1=You can allow ''{0}'' to periodically refresh it's synchronization state in the background.
-ConfigureRefreshScheduleDialog.1a=The last refresh occured at: {0}
-ConfigureRefreshScheduleDialog.2=Don't schedule the refresh operation to run periodically.
-ConfigureRefreshScheduleDialog.3=Using the following schedule:
-ConfigureRefreshScheduleDialog.4=Every:
-ConfigureRefreshScheduleDialog.5=hour(s)
-ConfigureRefreshScheduleDialog.6=minutes(s)
-ConfigureRefreshScheduleDialog.7=Number must be a positive number greater than 0
-ConfigureRefreshScheduleDialog.8=Number must be a positive number greater than 0
-RefreshSchedule.6=\ ({0} changes found)
-RefreshSchedule.7=\ (No changes found)
-RefreshSchedule.8=Not Scheduled
-RefreshSchedule.9=hours
-RefreshSchedule.10=minutes
-RefreshSchedule.11=hour
-RefreshSchedule.12=minute
-RefreshSchedule.13=Every {0} {1}
-RefreshSchedule.14=Scheduled refresh of ''{0}''
-DiffNodeControllerHierarchical.0=Updating labels
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 a423da7c9..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.preferences;
-
-import java.text.Collator;
-import java.text.DateFormat;
-import java.util.*;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.ui.*;
-
-/**
- * This area provides the widgets for providing the CVS commit comment
- */
-public class SyncViewerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IPreferenceIds {
-
- private BooleanFieldEditor compressFolders = null;
- private BooleanFieldEditor showSyncInLabels = null;
- private BooleanFieldEditor promptWithChanges = null;
- private BooleanFieldEditor promptWhenNoChanges = null;
- private BooleanFieldEditor promptWithChangesBkg = null;
- private BooleanFieldEditor promptWhenNoChangesBkg = null;
-
- 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;
- }
- }
-
- 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() {
- 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);
- showSyncInLabels = new BooleanFieldEditor(SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, Policy.bind("SyncViewerPreferencePage.19"), SWT.NONE, displayGroup); //$NON-NLS-1$
- addField(showSyncInLabels);
-
- Group promptGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.30")); //$NON-NLS-1$
-
- promptWhenNoChanges = new BooleanFieldEditor(SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES, Policy.bind("SyncViewerPreferencePage.16"), SWT.NONE, promptGroup); //$NON-NLS-1$
- addField(promptWhenNoChanges);
- promptWithChanges = new BooleanFieldEditor(SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, Policy.bind("SyncViewerPreferencePage.17"), SWT.NONE, promptGroup); //$NON-NLS-1$
- addField(promptWithChanges);
-
- promptWhenNoChangesBkg = new BooleanFieldEditor(SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES, Policy.bind("SyncViewerPreferencePage.31"), SWT.NONE, promptGroup); //$NON-NLS-1$
- addField(promptWhenNoChangesBkg);
- promptWithChangesBkg = new BooleanFieldEditor(SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, Policy.bind("SyncViewerPreferencePage.32"), SWT.NONE, promptGroup); //$NON-NLS-1$
- addField(promptWithChangesBkg);
-
- 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(perspectiveGroup);
- 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 = 0;
- 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(mills);
- 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 || event.getSource() == scheduledDelay) {
- // 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 7aca276af..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
+++ /dev/null
@@ -1,375 +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.*;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.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 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/registry/RegistryReader.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
deleted file mode 100644
index 5768755f7..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.registry;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ui.Utils.Sorter;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-public abstract class RegistryReader {
- protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- protected static Hashtable extensionPoints = new Hashtable();
- /**
- * The constructor.
- */
- protected RegistryReader() {
- }
- /**
- * This method extracts description as a subelement of the given element.
- *
- * @return description string if defined, or empty string if not.
- */
- protected String getDescription(IConfigurationElement config) {
- IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length >= 1) {
- return children[0].getValue();
- }
- return ""; //$NON-NLS-1$
- }
- /**
- * Logs the error in the workbench log using the provided text and the
- * information in the configuration element.
- */
- protected void logError(IConfigurationElement element, String text) {
- IExtension extension = element.getDeclaringExtension();
- IPluginDescriptor descriptor = extension.getDeclaringPluginDescriptor();
- StringBuffer buf = new StringBuffer();
- buf.append("Plugin " + descriptor.getUniqueIdentifier() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
- buf.append("\n" + text); //$NON-NLS-1$
- WorkbenchPlugin.log(buf.toString());
- }
- /**
- * Logs a very common registry error when a required attribute is missing.
- */
- protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
- logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a very common registry error when a required child is missing.
- */
- protected void logMissingElement(IConfigurationElement element, String elementName) {
- logError(element, "Required sub element '" + elementName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a registry error when the configuration element is unknown.
- */
- protected void logUnknownElement(IConfigurationElement element) {
- logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$
- }
- /**
- * Apply a reproducable order to the list of extensions provided, such that
- * the order will not change as extensions are added or removed.
- */
- protected IExtension[] orderExtensions(IExtension[] extensions) {
- // By default, the order is based on plugin id sorted
- // in ascending order. The order for a plugin providing
- // more than one extension for an extension point is
- // dependent in the order listed in the XML file.
- Sorter sorter = new Sorter() {
- public boolean compare(Object extension1, Object extension2) {
- String s1 = ((IExtension) extension1).getDeclaringPluginDescriptor().getUniqueIdentifier();
- String s2 = ((IExtension) extension2).getDeclaringPluginDescriptor().getUniqueIdentifier();
- //Return true if elementTwo is 'greater than' elementOne
- return s2.compareToIgnoreCase(s1) > 0;
- }
- };
-
- Object[] sorted = sorter.sort(extensions);
- IExtension[] sortedExtension = new IExtension[sorted.length];
- System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
- return sortedExtension;
- }
- /**
- * Implement this method to read element's attributes. If children should
- * also be read, then implementor is responsible for calling <code>readElementChildren</code>.
- * Implementor is also responsible for logging missing attributes.
- *
- * @return true if element was recognized, false if not.
- */
- protected abstract boolean readElement(IConfigurationElement element);
- /**
- * Read the element's children. This is called by the subclass' readElement
- * method when it wants to read the children of the element.
- */
- protected void readElementChildren(IConfigurationElement element) {
- readElements(element.getChildren());
- }
- /**
- * Read each element one at a time by calling the subclass implementation
- * of <code>readElement</code>.
- *
- * Logs an error if the element was not recognized.
- */
- protected void readElements(IConfigurationElement[] elements) {
- for (int i = 0; i < elements.length; i++) {
- if (!readElement(elements[i]))
- logUnknownElement(elements[i]);
- }
- }
- /**
- * Read one extension by looping through its configuration elements.
- */
- protected void readExtension(IExtension extension) {
- readElements(extension.getConfigurationElements());
- }
- /**
- * Start the registry reading process using the supplied plugin ID and
- * extension point.
- */
- public void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
- String pointId = pluginId + "-" + extensionPoint; //$NON-NLS-1$
- IExtension[] extensions = (IExtension[]) extensionPoints.get(pointId);
- if (extensions == null) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point == null)
- return;
- extensions = point.getExtensions();
- extensionPoints.put(pointId, extensions);
- }
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
deleted file mode 100644
index f1675c65d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java
+++ /dev/null
@@ -1,119 +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.registry;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-public class SynchronizeParticipantDescriptor implements ISynchronizeParticipantDescriptor {
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_NAME = "name"; //$NON-NLS-1$
- public static final String ATT_ICON = "icon"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
- private static final String ATT_TYPE = "type"; //$NON-NLS-1$
- private static final String TYPE_STATIC = "static"; //$NON-NLS-1$
-
- private String label;
- private String className;
- private String type;
- private String id;
- private ImageDescriptor imageDescriptor;
- private String description;
-
- private IConfigurationElement configElement;
-
- /**
- * Create a new ViewDescriptor for an extension.
- */
- public SynchronizeParticipantDescriptor(IConfigurationElement e, String desc) throws CoreException {
- configElement = e;
- description = desc;
- loadFromExtension();
- }
- /**
- * Return an instance of the declared view.
- */
- public IViewPart createView() throws CoreException {
- Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
- return (IViewPart) obj;
- }
-
- public IConfigurationElement getConfigurationElement() {
- return configElement;
- }
-
- /**
- * Returns this view's description. This is the value of its <code>"description"</code>
- * attribute.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- public String getId() {
- return id;
- }
-
- public String getType() {
- return type;
- }
-
- public ImageDescriptor getImageDescriptor() {
- if (imageDescriptor != null)
- return imageDescriptor;
- String iconName = configElement.getAttribute(ATT_ICON);
- if (iconName == null)
- return null;
- imageDescriptor = TeamUIPlugin.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName);
- return imageDescriptor;
- }
-
- public String getLabel() {
- return label;
- }
-
- public boolean isStatic() {
- if(type == null) return true;
- return type.equals(TYPE_STATIC);
- }
-
- /**
- * load a view descriptor from the registry.
- */
- private void loadFromExtension() throws CoreException {
- String identifier = configElement.getAttribute(ATT_ID);
- label = configElement.getAttribute(ATT_NAME);
- className = configElement.getAttribute(ATT_CLASS);
- type = configElement.getAttribute(ATT_TYPE);
-
- // Sanity check.
- if ((label == null) || (className == null) || (identifier == null)) {
- throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$
- null));
- }
-
- id = identifier;
- }
-
- /**
- * Returns a string representation of this descriptor. For debugging
- * purposes only.
- */
- public String toString() {
- return "Synchronize Participant(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java
deleted file mode 100644
index 73ab80fe3..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.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.registry;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-
-public class SynchronizeParticipantRegistry extends RegistryReader {
-
- private static final String TAG_SYNCPARTICIPANT = "participant"; //$NON-NLS-1$
- private Map participants = new HashMap();
-
- public SynchronizeParticipantRegistry() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_SYNCPARTICIPANT)) {
- String descText = getDescription(element);
- SynchronizeParticipantDescriptor desc;
- try {
- desc = new SynchronizeParticipantDescriptor(element, descText);
- participants.put(desc.getId(), desc);
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
- }
- return true;
- }
- return false;
- }
-
- public SynchronizeParticipantDescriptor[] getSynchronizeParticipants() {
- return (SynchronizeParticipantDescriptor[])participants.values().toArray(new SynchronizeParticipantDescriptor[participants.size()]);
- }
-
- public SynchronizeParticipantDescriptor find(String id) {
- return (SynchronizeParticipantDescriptor)participants.get(id);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
deleted file mode 100644
index 3b76b13c2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
+++ /dev/null
@@ -1,342 +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.synchronize;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.Viewer;
-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.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
-import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
-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.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage;
-import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelChangeListener;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * Section shown in a participant page to show the changes for this participant. This
- * includes a diff viewer for browsing the changes.
- *
- * @since 3.0
- */
-public class ChangesSection extends Composite {
-
- private SubscriberParticipant participant;
- private Composite parent;
- private SubscriberParticipantPage page;
-
- /**
- * Page book either shows the diff tree viewer if there are changes or
- * shows a message to the user if there are no changes that would be
- * shown in the tree.
- */
- private PageBook changesSectionContainer;
-
- /**
- * Shows message to user is no changes are to be shown in the diff
- * tree viewer.
- */
- private Composite filteredContainer;
-
- /**
- * Diff tree viewer that shows synchronization changes. This is created
- * by the participant.
- */
- private Viewer changesViewer;
-
- /**
- * Boolean that indicates whether the error page is being shown.
- * This is used to avoid redrawing the error page when new events come in
- */
- private boolean showingError;
-
- /**
- * Listen to sync set changes so that we can update message to user and totals.
- */
- private ISynchronizeModelChangeListener changedListener = new ISynchronizeModelChangeListener() {
- public void modelChanged(SynchronizeModelElement root) {
- calculateDescription();
- }
- };
-
- /**
- * Listener registered with the subscriber sync info set which contains
- * all out-of-sync resources for the subscriber.
- */
- private ISyncInfoSetChangeListener subscriberListener = new ISyncInfoSetChangeListener() {
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- // Handled by output set listener
- }
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- calculateDescription();
- }
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // Handled by output set listener
- }
- };
-
- /**
- * Listener registered with the output sync info set which contains
- * only the visible sync info.
- */
- private ISyncInfoSetChangeListener outputSetListener = new ISyncInfoSetChangeListener() {
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- calculateDescription();
- }
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- // Input changed listener will call calculateDescription()
- // The input will then react to output set changes
- }
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- calculateDescription();
- }
- };
-
- /**
- * Create a changes section on the following page.
- *
- * @param parent the parent control
- * @param page the page showing this section
- */
- public ChangesSection(Composite parent, SubscriberParticipantPage page) {
- super(parent, SWT.NONE);
- this.page = page;
- this.participant = page.getParticipant();
- this.parent = parent;
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessVerticalSpace = true;
- setLayoutData(data);
-
- changesSectionContainer = new PageBook(this, SWT.NONE);
- data = new GridData(GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- changesSectionContainer.setLayoutData(data);
- }
-
- public Composite getComposite() {
- return changesSectionContainer;
- }
-
- public void setViewer(Viewer viewer) {
- this.changesViewer = viewer;
- calculateDescription();
- page.getViewerConfiguration().addInputChangedListener(changedListener);
- participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet().addSyncSetChangedListener(subscriberListener);
- participant.getSubscriberSyncInfoCollector().getSyncInfoTree().addSyncSetChangedListener(outputSetListener);
- }
-
- private void calculateDescription() {
- SyncInfoTree syncInfoTree = participant.getSubscriberSyncInfoCollector().getSyncInfoTree();
- if (syncInfoTree.getErrors().length > 0) {
- if (!showingError) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- if (changesSectionContainer.isDisposed()) return;
- if(filteredContainer != null) {
- filteredContainer.dispose();
- filteredContainer = null;
- }
- filteredContainer = getErrorComposite(changesSectionContainer);
- changesSectionContainer.showPage(filteredContainer);
- showingError = true;
- }
- });
- }
- return;
- }
-
- showingError = false;
- if(syncInfoTree.size() == 0) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- if (changesSectionContainer.isDisposed()) return;
- if(filteredContainer != null) {
- filteredContainer.dispose();
- filteredContainer = null;
- }
- filteredContainer = getEmptyChangesComposite(changesSectionContainer);
- changesSectionContainer.showPage(filteredContainer);
- }
- });
- } else {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- if(filteredContainer != null) {
- filteredContainer.dispose();
- filteredContainer = null;
- }
- changesSectionContainer.showPage(changesViewer.getControl());
- }
- });
- }
- }
-
- private boolean isThreeWay() {
- return page.getParticipant().getSubscriber().getResourceComparator().isThreeWay();
- }
-
- private Composite getEmptyChangesComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessVerticalSpace = true;
- composite.setLayoutData(data);
-
- if(! isThreeWay()) {
- createDescriptionLabel(composite,Policy.bind("ChangesSection.noChanges", participant.getName())); //$NON-NLS-1$
- return composite;
- }
-
- SyncInfoSet workspace = participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet();
- SyncInfoSet workingSet = participant.getSubscriberSyncInfoCollector().getWorkingSetSyncInfoSet();
- SyncInfoSet filteredSet = participant.getSubscriberSyncInfoCollector().getSyncInfoTree();
-
- int changesInWorkspace = workspace.size();
- int changesInWorkingSet = workingSet.size();
- int changesInFilter = filteredSet.size();
-
- long outgoingChanges = workingSet.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- long incomingChanges = workingSet.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
-
- if(changesInFilter == 0 && changesInWorkingSet != 0) {
- int mode = participant.getMode();
- final int newMode = outgoingChanges != 0 ? SubscriberParticipant.OUTGOING_MODE : SubscriberParticipant.INCOMING_MODE;
- long numChanges = outgoingChanges != 0 ? outgoingChanges : incomingChanges;
- StringBuffer text = new StringBuffer();
- text.append(Policy.bind("ChangesSection.filterHides", Utils.modeToString(participant.getMode()))); //$NON-NLS-1$
- if(numChanges > 1) {
- text.append(Policy.bind("ChangesSection.filterHidesPlural", Long.toString(numChanges), Utils.modeToString(newMode))); //$NON-NLS-1$
- } else {
- text.append(Policy.bind("ChangesSection.filterHidesSingular", Long.toString(numChanges), Utils.modeToString(newMode))); //$NON-NLS-1$
- }
-
- Label warning = new Label(composite, SWT.NONE);
- warning.setImage(TeamUIPlugin.getPlugin().getImage(ISharedImages.IMG_WARNING));
-
- Hyperlink link = new Hyperlink(composite, SWT.WRAP);
- link.setText(Policy.bind("ChangesSection.filterChange", Utils.modeToString(newMode))); //$NON-NLS-1$
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- participant.setMode(newMode);
- }
- });
- link.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- link.setUnderlined(true);
- createDescriptionLabel(composite, text.toString());
- } else if(changesInFilter == 0 && changesInWorkingSet == 0 && changesInWorkspace != 0) {
- Label warning = new Label(composite, SWT.NONE);
- warning.setImage(TeamUIPlugin.getPlugin().getImage(ISharedImages.IMG_WARNING));
-
- Hyperlink link = new Hyperlink(composite, SWT.WRAP);
- link.setText(Policy.bind("ChangesSection.workingSetRemove")); //$NON-NLS-1$
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- participant.setWorkingSet(null);
- }
- });
- link.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- link.setUnderlined(true);
- createDescriptionLabel(composite,Policy.bind("ChangesSection.workingSetHiding", Utils.workingSetToString(participant.getWorkingSet(), 50))); //$NON-NLS-1$
- } else {
- createDescriptionLabel(composite,Policy.bind("ChangesSection.noChanges", participant.getName())); //$NON-NLS-1$
- }
- return composite;
- }
-
- private Label createDescriptionLabel(Composite parent, String text) {
- Label description = new Label(parent, SWT.WRAP);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = 100;
- description.setLayoutData(data);
- description.setText(text);
- description.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- return description;
- }
-
- public void dispose() {
- super.dispose();
- page.getViewerConfiguration().removeInputChangedListener(changedListener);
- participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet().removeSyncSetChangedListener(subscriberListener);
- }
-
- private Composite getErrorComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessVerticalSpace = true;
- composite.setLayoutData(data);
-
- Hyperlink link = new Hyperlink(composite, SWT.WRAP);
- link.setText("Show Errors");
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- showErrors();
- }
- });
- link.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- link.setUnderlined(true);
-
- link = new Hyperlink(composite, SWT.WRAP);
- link.setText("Reset View");
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- participant.getSubscriberSyncInfoCollector().reset();
- }
- });
- link.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WHITE));
- link.setUnderlined(true);
-
- createDescriptionLabel(composite, "Errors have occurred calculating the synchronization state for {0}" + participant.getName());
-
- return composite;
- }
-
- /* private */ void showErrors() {
- ITeamStatus[] status = participant.getSubscriberSyncInfoCollector().getSyncInfoTree().getErrors();
- String title = "Errors Populating View";
- if (status.length == 1) {
- ErrorDialog.openError(getShell(), title, status[0].getMessage(), status[0]);
- } else {
- MultiStatus multi = new MultiStatus(TeamUIPlugin.ID, 0, status, "Multiple errors occurred while attempting to populate the view.", null);
- ErrorDialog.openError(getShell(), title, null, multi);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
deleted file mode 100644
index c4c62f649..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package org.eclipse.team.internal.ui.synchronize;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberRefreshSchedule;
-import org.eclipse.team.internal.ui.Policy;
-
-
-public class ConfigureRefreshScheduleDialog extends DetailsDialog {
-
- private SubscriberRefreshSchedule schedule;
- private Button userRefreshOnly;
- private Button enableBackgroundRefresh;
- private Text time;
- private Combo hoursOrSeconds;
-
- public ConfigureRefreshScheduleDialog(Shell parentShell, SubscriberRefreshSchedule schedule) {
- super(parentShell, Policy.bind("ConfigureRefreshScheduleDialog.0", schedule.getParticipant().getName())); //$NON-NLS-1$
- this.schedule = schedule;
- }
-
- private void initializeValues() {
- boolean enableBackground = schedule.isEnabled();
- boolean hours = false;
-
- userRefreshOnly.setSelection(! enableBackground);
- enableBackgroundRefresh.setSelection(enableBackground);
-
- long seconds = schedule.getRefreshInterval();
- if(seconds <= 60) {
- seconds = 60;
- }
-
- long minutes = seconds / 60;
-
- if(minutes >= 60) {
- minutes = minutes / 60;
- hours = true;
- }
- hoursOrSeconds.select(hours ? 0 : 1);
- time.setText(Long.toString(minutes));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- Composite area = new Composite(parent, SWT.NONE);
- final GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- area.setLayout(gridLayout);
- area.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- {
- final Label label = new Label(area, SWT.WRAP);
- final GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.horizontalSpan = 2;
- gridData.widthHint = 325;
- label.setLayoutData(gridData);
- label.setText(Policy.bind("ConfigureRefreshScheduleDialog.1", schedule.getParticipant().getName())); //$NON-NLS-1$
- }
- {
- final Label label = new Label(area, SWT.WRAP);
- final GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.horizontalSpan = 2;
- gridData.widthHint = 325;
- label.setLayoutData(gridData);
- label.setText(Policy.bind("ConfigureRefreshScheduleDialog.1a", SubscriberRefreshSchedule.refreshEventAsString(schedule.getLastRefreshEvent()))); //$NON-NLS-1$
- }
- {
- userRefreshOnly = new Button(area, SWT.RADIO);
- final GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- userRefreshOnly.setLayoutData(gridData);
- userRefreshOnly.setText(Policy.bind("ConfigureRefreshScheduleDialog.2")); //$NON-NLS-1$
- userRefreshOnly.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- }
- {
- enableBackgroundRefresh = new Button(area, SWT.RADIO);
- final GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- enableBackgroundRefresh.setLayoutData(gridData);
- enableBackgroundRefresh.setText(Policy.bind("ConfigureRefreshScheduleDialog.3")); //$NON-NLS-1$
- enableBackgroundRefresh.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- }
- {
- final Composite composite = new Composite(area, SWT.NONE);
- final GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gridData.horizontalSpan = 2;
- composite.setLayoutData(gridData);
- final GridLayout gridLayout_1 = new GridLayout();
- gridLayout_1.numColumns = 3;
- composite.setLayout(gridLayout_1);
- {
- final Label label = new Label(composite, SWT.NONE);
- label.setText(Policy.bind("ConfigureRefreshScheduleDialog.4")); //$NON-NLS-1$
- }
- {
- time = new Text(composite, SWT.BORDER | SWT.RIGHT);
- final GridData gridData_1 = new GridData();
- gridData_1.widthHint = 35;
- time.setLayoutData(gridData_1);
- time.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEnablements();
- }
- });
- }
- {
- hoursOrSeconds = new Combo(composite, SWT.READ_ONLY);
- hoursOrSeconds.setItems(new String[] { Policy.bind("ConfigureRefreshScheduleDialog.5"), Policy.bind("ConfigureRefreshScheduleDialog.6") }); //$NON-NLS-1$ //$NON-NLS-2$
- final GridData gridData_1 = new GridData();
- gridData_1.widthHint = 75;
- hoursOrSeconds.setLayoutData(gridData_1);
- }
- }
- initializeValues();
- Dialog.applyDialogFont(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- int hours = hoursOrSeconds.getSelectionIndex();
- long seconds = Long.parseLong(time.getText());
- if(hours == 0) {
- seconds = seconds * 3600;
- } else {
- seconds = seconds * 60;
- }
- schedule.setRefreshInterval(seconds);
- if(schedule.isEnabled() != enableBackgroundRefresh.getSelection()) {
- schedule.setEnabled(enableBackgroundRefresh.getSelection(), true /* allow to start */);
- }
-
- // update schedule
- schedule.getParticipant().setRefreshSchedule(schedule);
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- try {
- long number = Long.parseLong(time.getText());
- if(number <= 0) {
- setPageComplete(false);
- setErrorMessage(Policy.bind("ConfigureRefreshScheduleDialog.7")); //$NON-NLS-1$
- } else {
- setPageComplete(true);
- setErrorMessage(null);
- }
- } catch (NumberFormatException e) {
- setPageComplete(false);
- setErrorMessage(Policy.bind("ConfigureRefreshScheduleDialog.8")); //$NON-NLS-1$
- }
-
- time.setEnabled(enableBackgroundRefresh.getSelection());
- hoursOrSeconds.setEnabled(enableBackgroundRefresh.getSelection());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton()
- */
- protected boolean includeDetailsButton() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java
deleted file mode 100644
index ea3991bb8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class DiffNodeWorkbenchAdapter implements IWorkbenchAdapter {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- DiffNode node = getDiffNode(o);
- return node != null ? node.getChildren() : new Object[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object o) {
- DiffNode node = getDiffNode(o);
- if(node instanceof SynchronizeModelElement) {
- return ((SynchronizeModelElement)node).getImageDescriptor(o);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- DiffNode node = getDiffNode(o);
- return node != null ? node.getName() : ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- DiffNode node = getDiffNode(o);
- return node != null ? node.getParent() : null;
- }
-
- /*
- * Return a diff node if the input object is a diff node or null otherwise.
- */
- private DiffNode getDiffNode(Object element) {
- if(element instanceof DiffNode) {
- return (DiffNode)element;
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshEvent.java
deleted file mode 100644
index 1fd7579a0..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshEvent.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.synchronize;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-
-public interface IRefreshEvent {
- public static final int SCHEDULED_REFRESH = 1;
-
- public static final int USER_REFRESH = 2;
-
- public int getRefreshType();
-
- public Subscriber getSubscriber();
-
- public SyncInfo[] getChanges();
-
- public long getStartTime();
-
- public long getStopTime();
-
- public IStatus getStatus();
-
- public IResource[] getResources();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshSubscriberListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshSubscriberListener.java
deleted file mode 100644
index 12bb707a5..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IRefreshSubscriberListener.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.eclipse.team.internal.ui.synchronize;
-
-public interface IRefreshSubscriberListener {
- public void refreshStarted(IRefreshEvent event);
- public void refreshDone(IRefreshEvent event);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java
deleted file mode 100644
index 237a00fea..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
-
-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;
-
-/**
- * A resource node that is not buffered. Changes made to it are applied directly
- * to the underlying resource.
- *
- * @since 3.0
- */
-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/synchronize/RefreshCompleteDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
deleted file mode 100644
index d6b1776fc..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.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.synchronize;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.subscribers.FilteredSyncInfoCollector;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.team.ui.synchronize.viewers.TreeViewerAdvisor;
-import org.eclipse.team.ui.synchronize.viewers.SynchronizeCompareInput;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class RefreshCompleteDialog extends DetailsDialog {
- private static final String HEIGHT_KEY = "width-key"; //$NON-NLS-1$
- private final static int RESOURCE_LIST_SIZE = 10;
- private static final String WIDTH_KEY = "height-key"; //$NON-NLS-1$
- private FilteredSyncInfoCollector collector;
- private SynchronizeCompareInput compareEditorInput;
- private IRefreshEvent event;
- private SubscriberParticipant participant;
-
- private Button promptWhenNoChanges;
- private Button promptWithChanges;
- private IDialogSettings settings;
- private SyncInfoTree syncInfoSet = new SyncInfoTree();
-
- public RefreshCompleteDialog(Shell parentShell, IRefreshEvent event, SubscriberParticipant participant) {
- super(parentShell, Policy.bind("RefreshCompleteDialog.4", participant.getName())); //$NON-NLS-1$
- this.participant = participant;
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.RESIZE | SWT.MAX);
- this.event = event;
- setImageKey(DLG_IMG_INFO);
- // Set-up a sync info set that contains the resources that where found
- // when the refresh occured.
- SyncInfoFilter filter = new SyncInfoFilter() {
-
- public boolean select(SyncInfo info, IProgressMonitor monitor) {
- IResource[] resources = getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (info.getLocal().equals(resource)) {
- return true;
- }
- }
- return false;
- }
- };
- this.collector = new FilteredSyncInfoCollector(
- participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet(),
- syncInfoSet,
- filter);
- IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("RefreshCompleteDialog");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("RefreshCompleteDialog");//$NON-NLS-1$
- }
- }
-
- /**
- * Populate the dialog with the new changes discovered during the refresh
- */
- public void initialize() {
- this.collector.start(new NullProgressMonitor());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#close()
- */
- public boolean close() {
- collector.dispose();
- Rectangle bounds = getShell().getBounds();
- settings.put(HEIGHT_KEY, bounds.height);
- settings.put(WIDTH_KEY, bounds.width);
- return super.close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- }
-
- protected Combo createCombo(Composite parent, int widthChars) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- GC gc = new GC(combo);
- gc.setFont(combo.getFont());
- FontMetrics fontMetrics = gc.getFontMetrics();
- data.widthHint = Dialog.convertWidthInCharsToPixels(fontMetrics, widthChars);
- gc.dispose();
- combo.setLayoutData(data);
- return combo;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- try {
- CompareConfiguration compareConfig = new CompareConfiguration();
- TreeViewerAdvisor viewerAdvisor = new TreeViewerAdvisor(participant.getId(), syncInfoSet);
- compareEditorInput = new SynchronizeCompareInput(compareConfig, viewerAdvisor) {
-
- public String getTitle() {
- return "Resources found during last refresh";
- }
- };
- // Preparing the input should be fast since we haven't started the collector
- compareEditorInput.run(new NullProgressMonitor());
- // Starting the collector will populate the dialog in the background
- initialize();
- } catch (InterruptedException e) {
- Utils.handle(e);
- } catch (InvocationTargetException e) {
- Utils.handle(e);
- }
- Composite result = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- result.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.heightHint = 350;
- //data.widthHint = 700;
- result.setLayoutData(data);
- Control c = compareEditorInput.createContents(result);
- data = new GridData(GridData.FILL_BOTH);
- c.setLayoutData(data);
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- StringBuffer text = new StringBuffer();
- SyncInfo[] changes = event.getChanges();
- IResource[] resources = event.getResources();
- if (changes.length != 0) {
- text.append(Policy.bind("RefreshCompleteDialog.5", Integer.toString(changes.length))); //$NON-NLS-1$
- } else {
- text.append(Policy.bind("RefreshCompleteDialog.6")); //$NON-NLS-1$
- }
- text.append(Policy.bind("RefreshCompleteDialog.7", Integer.toString(resources.length))); //$NON-NLS-1$ //$NON-NLS-2$
- createLabel(parent, text.toString(), 2);
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = 200;
- data.heightHint = 125;
- table.setLayoutData(data);
- TableViewer resourceList = new TableViewer(table);
- resourceList.setContentProvider(new ArrayContentProvider());
- resourceList.setLabelProvider(new WorkbenchLabelProvider());
- resourceList.setInput(resources);
- createLabel(parent, "", 2); //$NON-NLS-1$
- promptWhenNoChanges = new Button(parent, SWT.CHECK);
- data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- promptWhenNoChanges.setLayoutData(data);
- promptWithChanges = new Button(parent, SWT.CHECK);
- data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- promptWithChanges.setLayoutData(data);
- if (event.getRefreshType() == IRefreshEvent.USER_REFRESH) {
- promptWhenNoChanges.setText(Policy.bind(Policy.bind("RefreshCompleteDialog.13"))); //$NON-NLS-1$
- promptWhenNoChanges.setSelection(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES));
- promptWithChanges.setText(Policy.bind(Policy.bind("RefreshCompleteDialog.14"))); //$NON-NLS-1$
- promptWithChanges.setSelection(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES));
- } else {
- promptWhenNoChanges.setText(Policy.bind(Policy.bind("RefreshCompleteDialog.15"))); //$NON-NLS-1$
- promptWhenNoChanges.setSelection(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES));
- promptWithChanges.setText(Policy.bind(Policy.bind("RefreshCompleteDialog.16"))); //$NON-NLS-1$
- promptWithChanges.setSelection(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES));
- }
- Dialog.applyDialogFont(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getDetailsButtonLabelHide()
- */
- protected String getDetailsButtonLabelHide() {
- return Policy.bind("RefreshCompleteDialog.18");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getDetailsButtonLabelShow()
- */
- protected String getDetailsButtonLabelShow() {
- return Policy.bind("RefreshCompleteDialog.17");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#getInitialSize()
- */
- protected Point getInitialSize() {
- int width, height;
- try {
- height = settings.getInt(HEIGHT_KEY);
- width = settings.getInt(WIDTH_KEY);
- } catch (NumberFormatException e) {
- return super.getInitialSize();
- }
- Point p = super.getInitialSize();
- return new Point(width, p.y);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeCancelButton()
- */
- protected boolean includeCancelButton() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton()
- */
- protected boolean includeDetailsButton() {
- return event.getChanges().length != 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeErrorMessage()
- */
- protected boolean includeErrorMessage() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- if (event.getRefreshType() == IRefreshEvent.USER_REFRESH) {
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES, promptWhenNoChanges.getSelection());
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, promptWithChanges.getSelection());
- } else {
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES, promptWhenNoChanges.getSelection());
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, promptWithChanges.getSelection());
- }
- TeamUIPlugin.getPlugin().savePluginPreferences();
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- private Label createLabel(Composite parent, String text, int columns) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = columns;
- label.setLayoutData(data);
- return label;
- }
-
- private IResource[] getResources() {
- SyncInfo[] changes = event.getChanges();
- IResource[] resources = new IResource[changes.length];
- for (int i = 0; i < changes.length; i++) {
- SyncInfo info = changes[i];
- resources[i] = info.getLocal();
- }
- return resources;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java
deleted file mode 100644
index edfb92c13..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.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.synchronize;
-
-import java.io.InputStream;
-
-import org.eclipse.compare.*;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-
-/**
- * RemoteResourceTypedElement
- */
-public class RemoteResourceTypedElement extends BufferedContent implements ITypedElement, IEditableContent {
-
- private IResourceVariant remote;
- private IStorage bufferedContents;
-
- /**
- * Creates a new content buffer for the given team node.
- */
- public RemoteResourceTypedElement(IResourceVariant remote) {
- this.remote = remote;
- }
-
- public Image getImage() {
- return CompareUI.getImage(getType());
- }
-
- public String getName() {
- return remote.getName();
- }
-
- public String getContentIdentifier() {
- return remote.getContentIdentifier();
- }
-
- 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 false;
- }
-
- /**
- * 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(bufferedContents == null) {
- cacheContents(new NullProgressMonitor());
- }
- if (bufferedContents != null) {
- return bufferedContents.getContents();
- }
- return null;
- }
-
- public IResourceVariant getRemote() {
- return remote;
- }
-
- /**
- * Cache the contents for the remote resource in a local buffer
- * @param monitor
- */
- public void cacheContents(IProgressMonitor monitor) throws TeamException {
- bufferedContents = remote.getStorage(monitor);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
deleted file mode 100644
index 83cbf6711..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
+++ /dev/null
@@ -1,519 +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.synchronize;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry;
-import org.eclipse.team.ui.ITeamUIConstants;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.*;
-
-/**
- * Manages the registered synchronize participants. It handles notification of
- * participant lifecycles, creation of <code>static</code> participants, and
- * the re-creation of persisted participants.
- *
- * @see ISynchronizeView
- * @see ISynchronizeParticipant
- * @since 3.0
- */
-public class SynchronizeManager implements ISynchronizeManager {
- /**
- * Synchronize participants listeners
- */
- private ListenerList fListeners = null;
-
- /**
- * List of registered synchronize view pages {String id -> List participant
- * instances}}
- */
- private Map synchronizeParticipants = Collections.synchronizedMap(new HashMap(10));
- private SynchronizeParticipantRegistry participantRegistry = new SynchronizeParticipantRegistry();
-
- // change notification constants
- private final static int ADDED = 1;
- private final static int REMOVED = 2;
-
- // save context constants
- private final static String CTX_PARTICIPANTS = "syncparticipants"; //$NON-NLS-1$
- private final static String CTX_PARTICIPANT = "participant"; //$NON-NLS-1$
- private final static String CTX_ID = "id"; //$NON-NLS-1$
- private final static String CTX_PARTICIPANT_DATA = "data"; //$NON-NLS-1$
- private final static String FILENAME = "syncParticipants.xml"; //$NON-NLS-1$
-
- /**
- * Notifies a participant listeners of additions or removals
- */
- class SynchronizeViewPageNotifier implements ISafeRunnable {
-
- private ISynchronizeParticipantListener fListener;
- private int fType;
- private ISynchronizeParticipant[] fChanged;
-
- public void handleException(Throwable exception) {
- TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.7"), exception); //$NON-NLS-1$
- }
-
- public void run() throws Exception {
- switch (fType) {
- case ADDED :
- fListener.participantsAdded(fChanged);
- break;
- case REMOVED :
- fListener.participantsRemoved(fChanged);
- break;
- }
- }
-
- /**
- * Notifies the given listener of the adds/removes
- * @param participants the participants that changed
- * @param update the type of change
- */
- public void notify(ISynchronizeParticipant[] participants, int update) {
- if (fListeners == null) {
- return;
- }
- fChanged = participants;
- fType = update;
- Object[] copiedListeners = fListeners.getListeners();
- for (int i = 0; i < copiedListeners.length; i++) {
- fListener = (ISynchronizeParticipantListener) copiedListeners[i];
- Platform.run(this);
- }
- fChanged = null;
- fListener = null;
- }
- }
-
- /**
- * Represents a paticipant instance and allows lazy initialization of the instance
- * only when the participant is required.
- */
- static class ParticipantInstance {
- private ISynchronizeParticipant participant;
- private IMemento savedState;
- private SynchronizeParticipantDescriptor descriptor;
-
- public ParticipantInstance(SynchronizeParticipantDescriptor descriptor, IMemento savedState) {
- this.savedState = savedState;
- this.descriptor = descriptor;
- }
-
- public void setParticipant(ISynchronizeParticipant participant) {
- this.participant = participant;
- }
-
- public ISynchronizeParticipant getParticipant() throws TeamException {
- if (participant == null) {
- try {
- participant = (ISynchronizeParticipant) TeamUIPlugin.createExtension(descriptor.getConfigurationElement(), SynchronizeParticipantDescriptor.ATT_CLASS);
- participant.setInitializationData(descriptor.getConfigurationElement(), null, null);
- participant.init(savedState);
- } catch (PartInitException e2) {
- participant = null;
- throw new TeamException(Policy.bind("SynchronizeManager.11"), e2);
- } catch (CoreException e) {
- participant = null;
- throw TeamException.asTeamException(e);
- }
- }
- return participant;
- }
-
- public boolean isParticipantInitialized() {
- return participant != null;
- }
-
- public IMemento getSavedState() {
- return savedState;
- }
-
- public boolean equals(Object other) {
- try {
- if(other == this) return true;
- if (other instanceof ISynchronizeParticipant) {
- return other == this.getParticipant();
- } else if(other instanceof ParticipantInstance) {
- return ((ParticipantInstance)other).getParticipant() == this.getParticipant();
- }
- return false;
- } catch (TeamException e) {
- return false;
- }
- }
-
- public void dispose() {
- if(participant != null) {
- participant.dispose();
- }
- }
-
- public String getId() {
- return descriptor.getId();
- }
- }
-
- public SynchronizeManager() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener)
- */
- public void addSynchronizeParticipantListener(ISynchronizeParticipantListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList(5);
- }
- fListeners.add(listener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener)
- */
- public void removeSynchronizeParticipantListener(ISynchronizeParticipantListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#getParticipantDescriptor(java.lang.String)
- */
- public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) {
- return participantRegistry.find(id);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
- public synchronized void addSynchronizeParticipants(ISynchronizeParticipant[] participants) {
- List added = new ArrayList(participants.length);
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
- ParticipantInstance instance = new ParticipantInstance(participantRegistry.find(participant.getId()), null /* no saved state */);
- instance.setParticipant(participant);
- addParticipant(instance);
- try {
- participant.init(null);
- } catch (PartInitException e) {
- TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.13"), e); //$NON-NLS-1$
- continue;
- }
- added.add(participant);
- }
- if (!added.isEmpty()) {
- saveState();
- fireUpdate((ISynchronizeParticipant[]) added.toArray(new ISynchronizeParticipant[added.size()]), ADDED);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
- public synchronized void removeSynchronizeParticipants(ISynchronizeParticipant[] participants) {
- List removed = new ArrayList(participants.length);
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
- if (removeParticipant(participant)) {
- removed.add(participant);
- }
- }
- if (!removed.isEmpty()) {
- saveState();
- fireUpdate((ISynchronizeParticipant[]) removed.toArray(new ISynchronizeParticipant[removed.size()]), REMOVED);
- for (Iterator it = removed.iterator(); it.hasNext(); ) {
- ISynchronizeParticipant participant = (ISynchronizeParticipant) it.next();
- participant.dispose();
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#getSynchronizeParticipants()
- */
- public synchronized ISynchronizeParticipant[] getSynchronizeParticipants() {
- List participants = new ArrayList();
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) {
- String id = (String) it.next();
- ISynchronizeParticipant[] instances = find(id);
- participants.addAll(Arrays.asList(instances));
- }
- return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#find(java.lang.String)
- */
- public ISynchronizeParticipant[] find(String id) {
- List instances = (List) synchronizeParticipants.get(id);
- if (instances == null) {
- return new ISynchronizeParticipant[0];
- }
- List participants = new ArrayList(instances.size());
- for (Iterator it = instances.iterator(); it.hasNext(); ) {
- ParticipantInstance instance = (ParticipantInstance) it.next();
- ISynchronizeParticipant participant;
- try {
- participant = instance.getParticipant();
- if(participant != null) {
- participants.add(participant);
- }
- } catch (TeamException e) {
- // Participant instance is invalid - remove from list
- synchronizeParticipants.remove(instance.getId());
- TeamUIPlugin.log(e);
- }
- }
- return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]);
- }
-
- /**
- * Called to display the synchronize view in the given page. If the given
- * page is <code>null</code> the synchronize view is shown in the default
- * active workbench window.
- */
- public ISynchronizeView showSynchronizeViewInActivePage(IWorkbenchPage activePage) {
- IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
-
- if (!TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE).equals(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE_NONE)) {
- try {
- String pId = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE);
- activePage = workbench.showPerspective(pId, window);
- } catch (WorkbenchException e) {
- Utils.handleError(window.getShell(), e, Policy.bind("SynchronizeView.14"), e.getMessage()); //$NON-NLS-1$
- }
- }
- try {
- if (activePage == null) {
- activePage = TeamUIPlugin.getActivePage();
- if (activePage == null)
- return null;
- }
- return (ISynchronizeView) activePage.showView(ISynchronizeView.VIEW_ID);
- } catch (PartInitException pe) {
- Utils.handleError(window.getShell(), pe, Policy.bind("SynchronizeView.16"), pe.getMessage()); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Creates the participant registry and restore any saved participants.
- * Will also instantiate any static participants.
- */
- public void init() {
- try {
- // Initialize the participant registry - reads all participant
- // extension descriptions.
- participantRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_SYNCPARTICIPANTS);
-
- // Instantiate and register any dynamic participants saved from a
- // previous session.
- restoreSavedParticipants();
-
- // Instantiate and register any static participant that has not
- // already been created.
- initializeStaticParticipants();
- } catch (CoreException e) {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.8"), e)); //$NON-NLS-1$
- }
- }
-
- /**
- * Allow participant instances to clean-up.
- */
- public void dispose() {
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) {
- String id = (String) it.next();
- List participants = (List) synchronizeParticipants.get(id);
- for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
- ParticipantInstance instance = (ParticipantInstance) it2.next();
- instance.dispose();
- }
- }
-
- // save state and settings for existing participants.
- saveState();
- }
-
- private void initializeStaticParticipants() throws CoreException {
- SynchronizeParticipantDescriptor[] desc = participantRegistry.getSynchronizeParticipants();
- List participants = new ArrayList();
- for (int i = 0; i < desc.length; i++) {
- SynchronizeParticipantDescriptor descriptor = desc[i];
- if (descriptor.isStatic() && !synchronizeParticipants.containsKey(descriptor.getId())) {
- addParticipant(new ParticipantInstance(descriptor, null /* no saved state */));
- }
- }
- }
-
- /**
- * Restores participants that have been saved between sessions.
- */
- private void restoreSavedParticipants() throws TeamException, CoreException {
- File file = getStateFile();
- Reader reader;
- try {
- reader = new BufferedReader(new FileReader(file));
- } catch (FileNotFoundException e) {
- return;
- }
- List participants = new ArrayList();
- IMemento memento = XMLMemento.createReadRoot(reader);
- IMemento[] participantNodes = memento.getChildren(CTX_PARTICIPANT);
- for (int i = 0; i < participantNodes.length; i++) {
- IMemento memento2 = participantNodes[i];
- String id = memento2.getString(CTX_ID);
- SynchronizeParticipantDescriptor desc = participantRegistry.find(id);
- if (desc != null) {
- IConfigurationElement cfgElement = desc.getConfigurationElement();
- addParticipant(new ParticipantInstance(desc, memento2.getChild(CTX_PARTICIPANT_DATA)));
- } else {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Saves a file containing the list of participant ids that are registered
- * with this manager. Each initialized participant is also given the chance to save
- * it's state.
- */
- private void saveState() {
- XMLMemento xmlMemento = XMLMemento.createWriteRoot(CTX_PARTICIPANTS);
- List children = new ArrayList();
- for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) {
- String id = (String) it.next();
- List participants = (List) synchronizeParticipants.get(id);
- for (Iterator it2 = participants.iterator(); it2.hasNext(); ) {
- ParticipantInstance instance = (ParticipantInstance) it2.next();
-
- // Participants can opt out of being saved between sessions
- if(instance.isParticipantInitialized()) {
- ISynchronizeParticipant participant;
- try {
- participant = instance.getParticipant();
- } catch (TeamException e1) {
- continue;
- }
- if(! participant.isPersistent()) continue;
- }
-
- // Create the state placeholder for a participant
- IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT);
- participantNode.putString(CTX_ID, instance.getId());
- IMemento participantData = participantNode.createChild(CTX_PARTICIPANT_DATA);
-
- // Allow the participant to save it's state. If the participant exists
- // but isn't instantiated any loaded state will be re-saved.
- if(instance.isParticipantInitialized()) {
- ISynchronizeParticipant participant;
- try {
- participant = instance.getParticipant();
- } catch (TeamException e1) {
- // Continue with the next participant instance.
- continue;
- }
- participant.saveState(participantData);
- } else {
- IMemento savedState = instance.getSavedState();
- if(savedState != null) {
- participantData.putMemento(savedState);
- }
- }
- }
- }
- try {
- Writer writer = new BufferedWriter(new FileWriter(getStateFile()));
- try {
- xmlMemento.save(writer);
- } finally {
- writer.close();
- }
- } catch (IOException e) {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.10"), e)); //$NON-NLS-1$
- }
- }
-
- private File getStateFile() {
- IPath pluginStateLocation = TeamUIPlugin.getPlugin().getStateLocation();
- return pluginStateLocation.append(FILENAME).toFile(); //$NON-NLS-1$
- }
-
- private synchronized void addParticipant(ParticipantInstance instance) {
- String id = instance.getId();
- List instances = (List) synchronizeParticipants.get(id);
- if (instances == null) {
- instances = new ArrayList(2);
- synchronizeParticipants.put(id, instances);
- }
- instances.add(instance);
- }
-
- private synchronized boolean removeParticipant(ISynchronizeParticipant participant) {
- boolean removed = false;
- String id = participant.getId();
- List instances = (List) synchronizeParticipants.get(id);
- if (instances != null) {
- Iterator it = instances.iterator();
- ParticipantInstance instance = null;
- while (it.hasNext()) {
- ParticipantInstance tempInstance = (ParticipantInstance) it.next();
- try {
- if(tempInstance.getParticipant() == participant) {
- instance = tempInstance;
- }
- } catch (TeamException e) {
- // Participant instance is invalid - remove from list
- synchronizeParticipants.remove(tempInstance);
- TeamUIPlugin.log(e);
- }
- }
- if(instance != null) {
- removed = instances.remove(instance);
- if (instances.isEmpty()) {
- synchronizeParticipants.remove(id);
- }
- }
- }
- return removed;
- }
-
- /**
- * Fires notification.
- * @param participants participants added/removed
- * @param type ADD or REMOVE
- */
- private void fireUpdate(ISynchronizeParticipant[] participants, int type) {
- new SynchronizeViewPageNotifier().notify(participants, type);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
deleted file mode 100644
index bc8fcab53..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ /dev/null
@@ -1,344 +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.synchronize;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.actions.SynchronizePageDropDownAction;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.MessagePage;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.PageBookView;
-
-/**
- * Implements a Synchronize View that contains multiple synchronize participants.
- */
-public class SynchronizeView extends PageBookView implements ISynchronizeView, ISynchronizeParticipantListener, IPropertyChangeListener {
-
- /**
- * The participant being displayed, or <code>null</code> if none
- */
- private ISynchronizeParticipant activeParticipant = null;
-
- /**
- * Map of participants to dummy participant parts (used to close pages)
- */
- private Map fParticipantToPart;
-
- /**
- * Map of parts to participants
- */
- private Map fPartToPage;
-
- /**
- * Drop down action to switch between participants
- */
- private SynchronizePageDropDownAction fPageDropDown;
-
- /**
- * Preference key to save
- */
- private static final String KEY_LAST_ACTIVE_PARTICIPANT = "lastactiveparticipant"; //$NON-NLS-1$
- private static final String KEY_SETTINGS_SECTION= "SynchronizeViewSettings"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- Object source = event.getSource();
- if (source instanceof ISynchronizeParticipant && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) {
- if (source.equals(getParticipant())) {
- updateTitle();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeView#getParticipant()
- */
- public ISynchronizeParticipant getParticipant() {
- return activeParticipant;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec)
- */
- protected void showPageRec(PageRec pageRec) {
- super.showPageRec(pageRec);
- activeParticipant = (ISynchronizeParticipant)fPartToPage.get(pageRec.part);
- updateTitle();
- }
-
- /*
- * Updates the view title based on the active participant
- */
- protected void updateTitle() {
- ISynchronizeParticipant page = getParticipant();
- if (page == null) {
- setTitle(Policy.bind("SynchronizeView.1")); //$NON-NLS-1$
- } else {
- setTitle(Policy.bind("SynchronizeView.2") + page.getName()); //$NON-NLS-1$
- }
- setTitle("This is a big bad boy...");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
- */
- protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
- IPage page = pageRecord.page;
- page.dispose();
- pageRecord.dispose();
- ISynchronizeParticipant participant = (ISynchronizeParticipant) fPartToPage.get(part);
- participant.removePropertyChangeListener(this);
- // empty cross-reference cache
- fPartToPage.remove(part);
- fParticipantToPart.remove(participant);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
- */
- protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
- SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)dummyPart;
- Object component = part.getPage();
- IPageBookViewPage page = null;
- if(component instanceof ISynchronizeParticipant) {
- ISynchronizeParticipant participant = (ISynchronizeParticipant)component;
- participant.addPropertyChangeListener(this);
- page = participant.createPage(this);
- } else if(component instanceof IPageBookViewPage) {
- page = (IPageBookViewPage)component;
- }
-
- if(page != null) {
- initPage(page);
- page.createControl(getPageBook());
- PageRec rec = new PageRec(dummyPart, page);
- return rec;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
- */
- protected boolean isImportant(IWorkbenchPart part) {
- return part instanceof SynchronizeViewWorkbenchPart;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- super.dispose();
-
- IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
- if(activeParticipant != null) {
- IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection(KEY_SETTINGS_SECTION);
- }
- section.put(KEY_LAST_ACTIVE_PARTICIPANT, activeParticipant.getId());
- }
-
- TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
- */
- protected IPage createDefaultPage(PageBook book) {
- MessagePage page = new MessagePage();
- page.createControl(getPageBook());
- initPage(page);
- return page;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
- public void participantsAdded(final ISynchronizeParticipant[] participants) {
- for (int i = 0; i < participants.length; i++) {
- if (isAvailable()) {
- ISynchronizeParticipant participant = participants[i];
- SynchronizeViewWorkbenchPart part = new SynchronizeViewWorkbenchPart(participant, getSite());
- fParticipantToPart.put(participant, part);
- fPartToPage.put(part, participant);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
- public void participantsRemoved(final ISynchronizeParticipant[] consoles) {
- if (isAvailable()) {
- Runnable r = new Runnable() {
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- ISynchronizeParticipant console = consoles[i];
- SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(console);
- if (part != null) {
- partClosed(part);
- }
- if (getParticipant() == null) {
- ISynchronizeParticipant[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- if (available.length > 0) {
- display(available[available.length - 1]);
- }
- }
- }
- }
- }
- };
- asyncExec(r);
- }
- }
-
- /**
- * Constructs a synchronize view
- */
- public SynchronizeView() {
- super();
- fParticipantToPart = new HashMap();
- fPartToPage = new HashMap();
- updateTitle();
- }
-
- /**
- * Create the default actions for the view. These will be shown regardless of the
- * participant being displayed.
- */
- protected void createActions() {
- fPageDropDown = new SynchronizePageDropDownAction(this);
- }
-
- /**
- * Add the actions to the toolbar
- *
- * @param mgr toolbar manager
- */
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.add(fPageDropDown);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeView#display(org.eclipse.team.ui.synchronize.ISynchronizeParticipant)
- */
- public void display(ISynchronizeParticipant participant) {
- SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
- if (part != null) {
- partActivated(part);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
- */
- protected IWorkbenchPart getBootstrapPart() {
- return null;
- }
-
- /**
- * Registers the given runnable with the display
- * associated with this view's control, if any.
- */
- public void asyncExec(Runnable r) {
- if (isAvailable()) {
- getPageBook().getDisplay().asyncExec(r);
- }
- }
-
- /**
- * Creates this view's underlying viewer and actions.
- * Hooks a pop-up menu to the underlying viewer's control,
- * as well as a key listener. When the delete key is pressed,
- * the <code>REMOVE_ACTION</code> is invoked. Hooks help to
- * this view. Subclasses must implement the following methods
- * which are called in the following order when a view is
- * created:<ul>
- * <li><code>createViewer(Composite)</code> - the context
- * menu is hooked to the viewer's control.</li>
- * <li><code>createActions()</code></li>
- * <li><code>configureToolBar(IToolBarManager)</code></li>
- * <li><code>getHelpContextId()</code></li>
- * </ul>
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- createActions();
- IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
- configureToolBar(tbm);
- updateForExistingParticipants();
- getViewSite().getActionBars().updateActionBars();
- updateTitle();
- }
-
- /**
- * Initialize for existing participants
- */
- private void updateForExistingParticipants() {
- ISynchronizeManager manager = TeamUI.getSynchronizeManager();
- // create pages for consoles
- ISynchronizeParticipant[] participants = manager.getSynchronizeParticipants();
- participantsAdded(participants);
- // decide which participant to show on startup
- if (participants.length > 0) {
- ISynchronizeParticipant participantToSelect = participants[0];
- IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$
- if (section != null) {
- String selectedParticipantId = section.get(KEY_LAST_ACTIVE_PARTICIPANT);
- if(selectedParticipantId != null) {
- ISynchronizeParticipant[] selectedParticipant = manager.find(selectedParticipantId);
- if(selectedParticipant.length > 0) {
- participantToSelect = selectedParticipant[0];
- }
- }
- }
- display(participantToSelect);
- }
-
- // add as a listener to update when new participants are added
- manager.addSynchronizeParticipantListener(this);
- }
-
- private boolean isAvailable() {
- return getPageBook() != null && !getPageBook().isDisposed();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
deleted file mode 100644
index cc65485ff..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.*;
-
-/**
- * Fake part to use as keys in page book for synchronize participants
- */
-public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
-
- private Object page = null;
- private IWorkbenchPartSite site = null;
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return (obj instanceof SynchronizeViewWorkbenchPart) &&
- page.equals(((SynchronizeViewWorkbenchPart)obj).getPage());
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return page.hashCode();
- }
-
- /**
- * Constructs a part for the given participant that binds to the given
- * site
- */
- public SynchronizeViewWorkbenchPart(Object page, IWorkbenchPartSite site) {
- this.page = page;
- this.site = site;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void addPropertyListener(IPropertyListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getSite()
- */
- public IWorkbenchPartSite getSite() {
- return site;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitle()
- */
- public String getTitle() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleImage()
- */
- public Image getTitleImage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
- */
- public String getTitleToolTip() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void removePropertyListener(IPropertyListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- /**
- * Returns the participant associated with this part.
- *
- * @return participant associated with this part
- */
- protected Object getPage() {
- return page;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java
deleted file mode 100644
index b28617e0d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
-
-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.ui.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(SynchronizeView.VIEW_ID);
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
- layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
-
- 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);
- layout.setEditorAreaVisible(true);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java
deleted file mode 100644
index 1d6e8f7b4..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.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.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Clears the selected working set in the working set action group.
- *
- * @since 2.1
- */
-public class ClearWorkingSetAction extends Action {
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- */
- public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) {
- super(WorkbenchMessages.getString("ClearWorkingSetAction.text")); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.getString("ClearWorkingSetAction.toolTip")); //$NON-NLS-1$
- setEnabled(actionGroup.getWorkingSet() != null);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLEAR_WORKING_SET_ACTION);
- this.actionGroup = actionGroup;
- }
- /**
- * Overrides method from Action
- *
- * @see org.eclipse.jface.Action#run
- */
- public void run() {
- actionGroup.setWorkingSet(null);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java
deleted file mode 100644
index c9e1290ab..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.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.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Displays an IWorkingSetEditWizard for editing a working set.
- *
- * @since 2.1
- */
-public class EditWorkingSetAction extends Action {
- private Shell shell;
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- */
- public EditWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
- super(WorkbenchMessages.getString("EditWorkingSetAction.text")); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.getString("EditWorkingSetAction.toolTip")); //$NON-NLS-1$
- this.shell = shell;
- this.actionGroup = actionGroup;
- WorkbenchHelp.setHelp(this, IHelpContextIds.EDIT_WORKING_SET_ACTION);
- }
- /**
- * Overrides method from Action
- *
- * @see org.eclipse.jface.Action#run
- */
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = actionGroup.getWorkingSet();
-
- if (workingSet == null) {
- setEnabled(false);
- return;
- }
- IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(workingSet);
- if (wizard == null) {
- String title = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.title"); //$NON-NLS-1$
- String message = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.message"); //$NON-NLS-1$
- MessageDialog.openError(shell, title, message);
- return;
- }
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- if (dialog.open() == WizardDialog.OK)
- actionGroup.setWorkingSet(wizard.getSelection());
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java
deleted file mode 100644
index 0d305b152..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.*;
-
-
-public class ExpandAllAction extends Action implements ISelectionChangedListener {
-
- private final AbstractTreeViewer viewer;
-
- public ExpandAllAction(AbstractTreeViewer viewer) {
- this.viewer = viewer;
- viewer.addSelectionChangedListener(this);
- }
- public void run() {
- expandAllFromSelection();
- }
-
- protected void expandAllFromSelection() {
- AbstractTreeViewer tree = viewer;
- if (tree == null) return;
- ISelection selection = tree.getSelection();
- if(! selection.isEmpty()) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- tree.expandToLevel(next, AbstractTreeViewer.ALL_LEVELS);
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- setEnabled(!ss.isEmpty());
- return;
- }
- setEnabled(false);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
deleted file mode 100644
index 6da1e0fcb..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
+++ /dev/null
@@ -1,117 +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.synchronize.actions;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ICompareNavigator;
-import org.eclipse.compare.internal.INavigatable;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * Action to navigate the changes shown in the Synchronize View. This
- * will coordinate change browsing between the view and the compare
- * editors.
- *
- * @since 3.0
- */
-public class NavigateAction extends Action {
- private final boolean next;
- private ISynchronizeView view;
- private INavigatable navigator;
-
- /**
- * Direction to navigate
- */
- final public static int NEXT = 1;
- final public static int PREVIOUS = 2;
-
- public NavigateAction(ISynchronizeView view, INavigatable navigator, boolean next) {
- this.navigator = navigator;
- this.view = view;
- this.next = next;
-
- IKeyBindingService kbs = view.getSite().getKeyBindingService();
- if(next) {
- Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$
- view.getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.NEXT.getId(), this);
- } else {
- Utils.initAction(this, "action.navigatePrevious."); //$NON-NLS-1$
- view.getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), this);
- }
- }
-
- public void run() {
- navigate();
- }
-
- private void navigate() {
- SyncInfo info = getSyncInfoFromSelection();
- if(info == null) {
- if(navigator.gotoDifference(next)) {
- return;
- } else {
- info = getSyncInfoFromSelection();
- if(info == null) return;
- }
- }
-
- if(info.getLocal().getType() != IResource.FILE) {
- if(! navigator.gotoDifference(next)) {
- info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
- }
- return;
- }
-
- IEditorPart editor = OpenInCompareAction.findOpenCompareEditor(view.getSite(), info.getLocal());
- boolean atEnd = false;
- CompareEditorInput input;
- ICompareNavigator navigator;
-
- if(editor != null) {
- // if an existing editor is open on the current selection, use it
- input = (CompareEditorInput)editor.getEditorInput();
- navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class);
- if(navigator != null) {
- if(navigator.selectChange(next)) {
- if(! this.navigator.gotoDifference(next)) {
- info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
- }
- }
- }
- } else {
- // otherwise, select the next change and open a compare editor which will automatically
- // show the first change.
- OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
- }
- }
-
- private SyncInfo getSyncInfoFromSelection() {
- IStructuredSelection selection = (IStructuredSelection)view.getSite().getPage().getSelection();
- if(selection == null) return null;
- Object obj = selection.getFirstElement();
- if (obj instanceof SyncInfoModelElement) {
- return ((SyncInfoModelElement) obj).getSyncInfo();
- } else {
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
deleted file mode 100644
index 8564d3d8e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.actions.OpenFileAction;
-
-public class OpenFileInSystemEditorAction extends OpenFileAction {
-
- public OpenFileInSystemEditorAction(IWorkbenchPage page) {
- super(page);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedResources()
- */
- protected List getSelectedResources() {
- IStructuredSelection selection = getStructuredSelection();
- IResource[] resources = Utils.getResources(selection.toArray());
- return Arrays.asList(resources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedNonResources()
- */
- protected List getSelectedNonResources() {
- return Collections.EMPTY_LIST;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
deleted file mode 100644
index bb4784fc7..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ /dev/null
@@ -1,165 +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.synchronize.actions;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.viewers.SyncInfoCompareInput;
-import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement;
-import org.eclipse.ui.*;
-
-/**
- * Action to open a compare editor from a SyncInfo object.
- *
- * @see SyncInfoCompareInput
- * @since 3.0
- */
-public class OpenInCompareAction extends Action {
-
- private ISynchronizeView view;
- private ISynchronizeParticipant participant;
-
- public OpenInCompareAction(ISynchronizeView view, ISynchronizeParticipant participant) {
- this.participant = participant;
- this.view = view;
- Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$
- }
-
- public void run() {
- ISelection selection = view.getSite().getPage().getSelection();
- if(selection instanceof IStructuredSelection) {
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof SyncInfoModelElement) {
- SyncInfo info = ((SyncInfoModelElement) obj).getSyncInfo();
- if (info != null) {
- openCompareEditor(view, participant, info, true);
- }
- }
- }
- }
-
- public static SyncInfoCompareInput openCompareEditor(IWorkbenchPart page, ISynchronizeParticipant participant, SyncInfo info, boolean keepFocus) {
- SyncInfoCompareInput input = getCompareInput(participant, info);
- if(input != null) {
- IWorkbenchPage wpage = page.getSite().getPage();
- IEditorPart editor = findReusableCompareEditor(wpage);
-
- if(editor != null) {
- IEditorInput otherInput = editor.getEditorInput();
- if(otherInput instanceof SyncInfoCompareInput && otherInput.equals(input)) {
- // simply provide focus to editor
- wpage.activate(editor);
- } else {
- // if editor is currently not open on that input either re-use existing
- if(editor != null && editor instanceof IReusableEditor) {
- CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
- wpage.activate(editor);
- }
- }
- } else {
- CompareUI.openCompareEditor(input);
- editor = page.getSite().getPage().getActiveEditor();
- }
-
- if(editor != null) {
- input.setCompareEditor(editor);
- }
-
- if(keepFocus) {
- wpage.activate(page);
- }
- return input;
- }
- return null;
- }
-
- /**
- * Returns a SyncInfoCompareInput instance for the current selection.
- */
- private static SyncInfoCompareInput getCompareInput(ISynchronizeParticipant participant, SyncInfo info) {
- if (info != null && info.getLocal() instanceof IFile) {
- CompareConfiguration cc = new CompareConfiguration();
- //cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, Boolean.TRUE);
- return new SyncInfoCompareInput(cc, participant.getName(), info);
- }
- return null;
- }
-
- /**
- * Returns an editor that can be re-used. An open compare editor that
- * has un-saved changes cannot be re-used.
- */
- public static IEditorPart findReusableCompareEditor(IWorkbenchPage page) {
- IEditorReference[] editorRefs = page.getEditorReferences();
-
- for (int i = 0; i < editorRefs.length; i++) {
- IEditorPart part = editorRefs[i].getEditor(true);
- if(part != null && part.getEditorInput() instanceof SyncInfoCompareInput) {
- if(! part.isDirty()) {
- return part;
- }
- }
- }
- return null;
- }
-
- /**
- * Close a compare editor that is opened on the given IResource.
- *
- * @param site the view site in which to close the editors
- * @param resource the resource to use to find the compare editor
- */
- public static void closeCompareEditorFor(final IWorkbenchPartSite site, final IResource resource) {
- site.getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IEditorPart editor = findOpenCompareEditor(site, resource);
- if(editor != null) {
- site.getPage().closeEditor(editor, true /*save changes if required */);
- }
- }
- });
- }
-
- /**
- * Returns an editor handle if a SyncInfoCompareInput compare editor is opened on
- * the given IResource.
- *
- * @param site the view site in which to search for editors
- * @param resource the resource to use to find the compare editor
- * @return an editor handle if found and <code>null</code> otherwise
- */
- public static IEditorPart findOpenCompareEditor(IWorkbenchPartSite site, IResource resource) {
- IWorkbenchPage page = site.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)) {
- return part;
- }
- }
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
deleted file mode 100644
index 71a6d58fc..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.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.synchronize.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.subscriber.*;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.OpenWithMenu;
-import org.eclipse.ui.views.navigator.ResourceNavigatorMessages;
-
-/**
- * This is the action group for the open actions. It contains open
- * actions for
- */
-public class OpenWithActionGroup extends ActionGroup {
-
- private OpenFileInSystemEditorAction openFileAction;
- private OpenInCompareAction openInCompareAction;
- private SubscriberParticipantPage page;
- private ISynchronizeView view;
- private ISynchronizeParticipant participant;
-
- public OpenWithActionGroup(ISynchronizeView part, ISynchronizeParticipant participant) {
- this.participant = participant;
- this.view = part;
- makeActions();
- }
-
- protected void makeActions() {
- openFileAction = new OpenFileInSystemEditorAction(view.getSite().getPage());
- openInCompareAction = new OpenInCompareAction(view, participant);
- }
-
- public void fillContextMenu(IMenuManager menu) {
- fillOpenWithMenu(menu, (IStructuredSelection)view.getSite().getPage().getSelection());
- }
-
- /**
- * 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 resources[] = Utils.getResources(new Object[] {element});
- IResource resource = null;
- if(resources.length == 0) {
- return;
- }
- resource = resources[0];
-
- if(resource.getType() != IResource.FILE) return;
-
- menu.add(openInCompareAction);
-
- if(!((resource.exists()))) {
- return;
- }
-
- openFileAction.selectionChanged(selection);
- menu.add(openFileAction);
-
- MenuManager submenu =
- new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.openWith")); //$NON-NLS-1$
- submenu.add(new OpenWithMenu(view.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();
- }
- }
-
- 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/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
deleted file mode 100644
index 63ba14ed7..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.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.synchronize.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-
-/**
- * This action group is modeled after the class of the same name in
- * the org.eclipse.ui.workbench plugin. We couldn't reuse that class
- * because of a hard dependency on the navigator.
- */
-public class RefactorActionGroup extends ActionGroup {
-
- private DeleteResourceAction deleteAction;
- private MoveResourceAction moveAction;
- private RenameResourceAction renameAction;
- private TextActionHandler textActionHandler;
- private ISynchronizeView view;
-
- public RefactorActionGroup(ISynchronizeView view) {
- this.view = view;
- makeActions();
- }
-
- public void fillContextMenu(IMenuManager parentMenu) {
- IStructuredSelection selection = getSelection();
-
- boolean anyResourceSelected =
- !selection.isEmpty()
- && allResourcesAreOfType(
- selection,
- IResource.PROJECT | IResource.FOLDER | IResource.FILE);
-
- MenuManager menu = new MenuManager(Policy.bind("RefactorActionGroup.0")); //$NON-NLS-1$
- IStructuredSelection convertedSelection = convertSelection(selection);
-
- if (anyResourceSelected) {
- deleteAction.selectionChanged(convertedSelection);
- menu.add(deleteAction);
- moveAction.selectionChanged(convertedSelection);
- menu.add(moveAction);
- renameAction.selectionChanged(convertedSelection);
- menu.add(renameAction);
- }
- parentMenu.add(menu);
- }
-
- private IStructuredSelection convertSelection(IStructuredSelection selection) {
- return new StructuredSelection(Utils.getResources(selection.toArray()));
- }
-
- public void fillActionBars(IActionBars actionBars) {
- textActionHandler = new TextActionHandler(actionBars); // hooks handlers
- textActionHandler.setDeleteAction(deleteAction);
- renameAction.setTextActionHandler(textActionHandler);
- }
-
- protected void makeActions() {
- // Get the key binding service for registering actions with commands.
- final IWorkbenchPartSite site = view.getSite();
- final IKeyBindingService keyBindingService = site.getKeyBindingService();
-
- Shell shell = site.getShell();
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
-
- moveAction = new MoveResourceAction(shell);
- renameAction = new RenameResourceAction(shell);
-
- deleteAction = new DeleteResourceAction(shell);
- deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
- /* NOTE: This is defined in "plugin.xml" in "org.eclipse.ui". It is
- * only publicly declared in code in IWorkbenchActionDefinitionIds in
- * "org.eclipse.ui.workbench.texteditor".
- */
- deleteAction.setActionDefinitionId("org.eclipse.ui.edit.delete"); //$NON-NLS-1$
- keyBindingService.registerAction(deleteAction);
- }
-
- public void updateActionBars() {
- IStructuredSelection selection = getSelection();
- deleteAction.selectionChanged(selection);
- moveAction.selectionChanged(selection);
- renameAction.selectionChanged(selection);
- }
-
- private IStructuredSelection getSelection() {
- return (IStructuredSelection)view.getSite().getPage().getSelection();
- }
-
- private boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) {
- Iterator resources = selection.iterator();
- while (resources.hasNext()) {
- Object next = resources.next();
- IResource resource = null;
- if (next instanceof IResource) {
- resource = (IResource)next;
- } else if (next instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable)next;
- resource = (IResource)adaptable.getAdapter(IResource.class);
- }
- if(resource == null) {
- IResource[] r = Utils.getResources(new Object[] {next});
- if(r.length == 1) {
- resource = r[0];
- }
- }
- if (resource == null || (resource.getType() & resourceMask) == 0) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
deleted file mode 100644
index 1ddf87c28..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-
-/**
- * Action to remove the given participant from the synchronize manager.
- * @since 3.0
- */
-public class RemoveSynchronizeParticipantAction extends Action {
- private ISynchronizeParticipant participant;
-
- /**
- * Creates the action to remove the participant from the synchronize
- * manager.
- * @param participant the participant to remove from the synchronize
- * manager.
- */
- public RemoveSynchronizeParticipantAction(ISynchronizeParticipant participant) {
- this.participant = participant;
- Utils.initAction(this, "action.removePage.", Policy.getBundle()); //$NON-NLS-1$
- }
-
- public void run() {
- TeamUI.getSynchronizeManager().removeSynchronizeParticipants(
- new ISynchronizeParticipant[] {participant});
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java
deleted file mode 100644
index a9a26a591..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Displays an IWorkingSetSelectionDialog and sets the selected
- * working set in the action group.
- *
- * @since 2.1
- */
-public class SelectWorkingSetAction extends Action {
- private Shell shell;
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- * @param shell shell to use for opening working set selection dialog.
- */
- public SelectWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
- super(WorkbenchMessages.getString("SelectWorkingSetAction.text")); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.getString("SelectWorkingSetAction.toolTip")); //$NON-NLS-1$
- this.shell = shell;
- this.actionGroup = actionGroup;
- WorkbenchHelp.setHelp(this, IHelpContextIds.SELECT_WORKING_SET_ACTION);
- }
- /**
- * Overrides method from Action
- *
- * @see org.eclipse.jface.Action#run
- */
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(shell, false);
- IWorkingSet workingSet = actionGroup.getWorkingSet();
-
- if (workingSet != null)
- dialog.setSelection(new IWorkingSet[]{workingSet});
-
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- actionGroup.setWorkingSet(result[0]);
- manager.addRecentWorkingSet(result[0]);
- }
- else {
- actionGroup.setWorkingSet(null);
- }
- }
- else
- actionGroup.setWorkingSet(workingSet);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
deleted file mode 100644
index e0d21abd6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-
-public class ShowSynchronizeParticipantAction extends Action {
-
- private ISynchronizeParticipant fPage;
- private ISynchronizeView fView;
-
- public void run() {
- if (!fPage.equals(fView.getParticipant())) {
- fView.display(fPage);
- }
- }
-
- /**
- * Constructs an action to display the given synchronize participant in the
- * synchronize view.
- *
- * @param view the synchronize view in which the given page is contained
- * @param participant the participant to show
- */
- public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipant participant) {
- super(participant.getName(), Action.AS_RADIO_BUTTON);
- fPage = participant;
- fView = view;
- setImageDescriptor(participant.getImageDescriptor());
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
deleted file mode 100644
index 06a76c05e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java
+++ /dev/null
@@ -1,133 +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.synchronize.actions;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Listener;
-
-public class StatusLineCLabelContribution extends ContributionItem {
-
- public final static int DEFAULT_CHAR_WIDTH = 40;
-
- private int charWidth;
- private CLabel label;
- private Image image;
- private String text = ""; //$NON-NLS-1$
- private int widthHint = -1;
-
- private Listener listener;
- private int eventType;
- private String tooltip;
-
- public StatusLineCLabelContribution(String id) {
- this(id, DEFAULT_CHAR_WIDTH);
- }
-
- public StatusLineCLabelContribution(String id, int charWidth) {
- super(id);
- this.charWidth = charWidth;
- setVisible(false); // no text to start with
- }
-
- public void fill(Composite parent) {
- label = new CLabel(parent, SWT.SHADOW_IN);
- StatusLineLayoutData statusLineLayoutData = new StatusLineLayoutData();
-
- if (widthHint < 0) {
- GC gc = new GC(parent);
- gc.setFont(parent.getFont());
- widthHint = gc.getFontMetrics().getAverageCharWidth() * charWidth;
- gc.dispose();
- }
-
- statusLineLayoutData.widthHint = widthHint;
- label.setLayoutData(statusLineLayoutData);
- label.setText(text);
- label.setImage(image);
- if(listener != null) {
- label.addListener(eventType, listener);
- }
- if(tooltip != null) {
- label.setToolTipText(tooltip);
- }
- }
-
- public void addListener(int eventType, Listener listener) {
- this.eventType = eventType;
- this.listener = listener;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- if (text == null)
- throw new NullPointerException();
-
- this.text = text;
-
- if (label != null && !label.isDisposed())
- label.setText(this.text);
-
- if (this.text.length() == 0) {
- if (isVisible()) {
- setVisible(false);
- IContributionManager contributionManager = getParent();
-
- if (contributionManager != null)
- contributionManager.update(true);
- }
- } else {
- if (!isVisible()) {
- setVisible(true);
- IContributionManager contributionManager = getParent();
-
- if (contributionManager != null)
- contributionManager.update(true);
- }
- }
- }
-
- public void setTooltip(String tooltip) {
- if (tooltip == null)
- throw new NullPointerException();
-
- this.tooltip = tooltip;
-
- if (label != null && !label.isDisposed()) {
- label.setToolTipText(this.tooltip);
- }
- }
-
- public void setImage(Image image) {
- if (image == null)
- throw new NullPointerException();
-
- this.image = image;
-
- if (label != null && !label.isDisposed())
- label.setImage(this.image);
-
- if (!isVisible()) {
- setVisible(true);
- IContributionManager contributionManager = getParent();
-
- if (contributionManager != null)
- contributionManager.update(true);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
deleted file mode 100644
index b74a28f53..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.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.synchronize.actions;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.actions.ActionGroup;
-
-public class StatusLineContributionGroup extends ActionGroup implements ISyncInfoSetChangeListener, IPropertyChangeListener {
-
- private static final String INCOMING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.incoming"; //$NON-NLS-1$
- private static final String OUTGOING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.outgoing"; //$NON-NLS-1$
- private static final String CONFLICTING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.conflicting"; //$NON-NLS-1$
- private static final String WORKINGSET_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.workingset"; //$NON-NLS-1$
- private static final String TOTALS_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.totals"; //$NON-NLS-1$
- private final static int TEXT_FIELD_MAX_SIZE = 25;
-
- private StatusLineCLabelContribution incoming;
- private StatusLineCLabelContribution outgoing;
- private StatusLineCLabelContribution conflicting;
- private StatusLineCLabelContribution workingSet;
- private StatusLineCLabelContribution totalChanges;
-
- private Image incomingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage();
- private Image outgoingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage();
- private Image conflictingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage();
-
- private SubscriberSyncInfoCollector collector;
- private SubscriberParticipant participant;
-
- public StatusLineContributionGroup(final Shell shell, SubscriberParticipant participant, final WorkingSetFilterActionGroup setGroup) {
- super();
- this.participant = participant;
- this.collector = participant.getSubscriberSyncInfoCollector();
- this.incoming = createStatusLineContribution(INCOMING_ID, SubscriberParticipant.INCOMING_MODE, "0", incomingImage); //$NON-NLS-1$
- this.outgoing = createStatusLineContribution(OUTGOING_ID, SubscriberParticipant.OUTGOING_MODE, "0", outgoingImage); //$NON-NLS-1$
- this.conflicting = createStatusLineContribution(CONFLICTING_ID, SubscriberParticipant.CONFLICTING_MODE, "0", conflictingImage); //$NON-NLS-1$
-
- this.totalChanges = new StatusLineCLabelContribution(TOTALS_ID, TEXT_FIELD_MAX_SIZE);
- this.workingSet = new StatusLineCLabelContribution(WORKINGSET_ID, TEXT_FIELD_MAX_SIZE);
- this.workingSet.setTooltip(Policy.bind("StatisticsPanel.workingSetTooltip")); //$NON-NLS-1$
- updateWorkingSetText();
-
- this.workingSet.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event event) {
- new SelectWorkingSetAction(setGroup, shell).run();
- }
- });
-
- // Listen to changes to update the working set
- participant.addPropertyChangeListener(this);
-
- // Listen to changes to update the counts
- collector.getSyncInfoTree().addSyncSetChangedListener(this);
- }
-
- private boolean isThreeWay() {
- return participant.getSubscriber().getResourceComparator().isThreeWay();
- }
-
- private void updateWorkingSetText() {
- IWorkingSet set = participant.getWorkingSet();
- if (set == null) {
- workingSet.setText(Policy.bind("StatisticsPanel.noWorkingSet")); //$NON-NLS-1$
- } else {
- String name = set.getName();
- if (name.length() > TEXT_FIELD_MAX_SIZE) {
- name = name.substring(0, TEXT_FIELD_MAX_SIZE - 3) + "..."; //$NON-NLS-1$
- }
- workingSet.setText(name);
- }
- }
-
- private StatusLineCLabelContribution createStatusLineContribution(String id, final int mode, String label, Image image) {
- StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15);
- item.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent(Event event) {
- participant.setMode(mode);
- }
- });
- item.setText(label); //$NON-NLS-1$
- item.setImage(image);
- return item;
- }
-
- public void dispose() {
- collector.getSyncInfoTree().removeSyncSetChangedListener(this);
- participant.removePropertyChangeListener(this);
- incomingImage.dispose();
- outgoingImage.dispose();
- conflictingImage.dispose();
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(SubscriberParticipant.P_SYNCVIEWPAGE_WORKINGSET)) {
- updateWorkingSetText();
- updateCounts();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent)
- */
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- updateCounts();
- }
-
- private void updateCounts() {
- if (collector != null) {
- SyncInfoSet workspaceSetStats = collector.getSubscriberSyncInfoSet();
- SyncInfoSet workingSetSetStats = collector.getWorkingSetSyncInfoSet();
-
- final int total = workspaceSetStats.size();
- final int workspaceConflicting = (int) workspaceSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- final int workspaceOutgoing = (int) workspaceSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- final int workspaceIncoming = (int) workspaceSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
- final int workingSetConflicting = (int) workingSetSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- final int workingSetOutgoing = (int) workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- final int workingSetIncoming = (int) workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
-
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkingSet set = participant.getWorkingSet();
- if (set != null) {
- conflicting.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
- incoming.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
- outgoing.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
-
- conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.conflicting"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.outgoing"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- incoming.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.incoming"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$
-
- } else {
- conflicting.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$
- incoming.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$
- outgoing.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$
-
- conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.conflicting"))); //$NON-NLS-1$ //$NON-NLS-2$
- outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.outgoing"))); //$NON-NLS-1$ //$NON-NLS-2$
- incoming.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.incoming"))); //$NON-NLS-1$ //$NON-NLS-2$
- }
- totalChanges.setText(Policy.bind("StatisticsPanel.numberTotal", Integer.toString(total))); //$NON-NLS-1$
- }
- });
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- IStatusLineManager mgr = actionBars.getStatusLineManager();
- mgr.add(workingSet);
- if (isThreeWay()) {
- mgr.add(incoming);
- mgr.add(outgoing);
- mgr.add(conflicting);
- } else {
- mgr.add(totalChanges);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- updateCounts();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetError(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // Nothing to do for errors
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
deleted file mode 100644
index ca6abf4a0..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/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.synchronize.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/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
deleted file mode 100644
index 40b468a2e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.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.synchronize.actions;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.texteditor.IUpdate;
-
-public class SynchronizePageDropDownAction extends Action implements IMenuCreator, ISynchronizeParticipantListener, IUpdate {
-
- private ISynchronizeView fView;
- private Menu fMenu;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- setEnabled(pages.length >= 1);
- }
-
- public SynchronizePageDropDownAction(ISynchronizeView view) {
- fView= view;
- Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
- setMenuCreator(this);
- TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fView= null;
- TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
- fMenu= new Menu(parent);
- ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- ISynchronizeParticipant current = fView.getParticipant();
- for (int i = 0; i < pages.length; i++) {
- ISynchronizeParticipant page = pages[i];
- Action action = new ShowSynchronizeParticipantAction(fView, page);
- action.setChecked(page.equals(current));
- addActionToMenu(fMenu, action);
- }
- return fMenu;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- protected void addMenuSeparator() {
- new MenuItem(fMenu, SWT.SEPARATOR);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- // do nothing - this is a menu
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
- public void participantsAdded(ISynchronizeParticipant[] consoles) {
- Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- update();
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
- public void participantsRemoved(ISynchronizeParticipant[] consoles) {
- Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (fMenu != null) {
- fMenu.dispose();
- }
- update();
- }
- });
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
deleted file mode 100644
index 1dbb8fce9..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.internal.ui.jobs.RefreshUserNotificationPolicy;
-import org.eclipse.team.ui.synchronize.subscriber.RefreshAction;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.ui.IWorkbenchSite;
-
-/**
- * A specialized RefreshAction that extracts the required components from a
- * particpant.
- */
-public class TeamParticipantRefreshAction extends RefreshAction {
-
- public TeamParticipantRefreshAction(ISelectionProvider provider, SubscriberParticipant participant, boolean addIfNeeded, boolean refreshAll) {
- super(provider, participant.getName(), participant.getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(participant, addIfNeeded), refreshAll);
- }
-
- public static void run(IWorkbenchSite site, IResource[] resources, SubscriberParticipant participant, boolean addIfNeeded) {
- run(site, participant.getName(), resources, participant.getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(participant, addIfNeeded));
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
deleted file mode 100644
index 109aa9c56..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java
+++ /dev/null
@@ -1,131 +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.synchronize.actions;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * Adds working set filter actions (set / clear / edit)
- *
- * @since 2.1
- */
-public class WorkingSetFilterActionGroup extends ActionGroup {
- public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$
-
- private IWorkingSet workingSet = null;
-
- private ClearWorkingSetAction clearWorkingSetAction;
- private SelectWorkingSetAction selectWorkingSetAction;
- private EditWorkingSetAction editWorkingSetAction;
- private IPropertyChangeListener workingSetUpdater;
- private IActionBars bars;
- private IContributionItem item;
- private String id;
-
- /**
- * Creates a new instance of the receiver
- *
- * @param shell shell to open dialogs and wizards on
- * @param workingSetUpdater property change listener notified when a
- * working set is set
- */
- public WorkingSetFilterActionGroup(Shell shell, IPropertyChangeListener workingSetUpdater, ISynchronizeView view, SubscriberParticipant participant) {
- Assert.isNotNull(shell);
- this.id = participant.toString();
- this.workingSetUpdater = workingSetUpdater;
- this.workingSet = participant.getWorkingSet();
- clearWorkingSetAction = new ClearWorkingSetAction(this);
- selectWorkingSetAction = new SelectWorkingSetAction(this, shell);
- editWorkingSetAction = new EditWorkingSetAction(this, shell);
- }
-
- /**
- * Adds working set actions to the specified action bar.
- *
- * @param actionBars action bar to add working set actions to.
- * @see ActionGroup#fillActionBars(IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- bars = actionBars;
- IMenuManager menuManager = actionBars.getMenuManager();
- menuManager.add(selectWorkingSetAction);
- menuManager.add(clearWorkingSetAction);
- menuManager.add(editWorkingSetAction);
- menuManager.add(new Separator(id));
- updateMruContribution(menuManager);
- };
-
- private void updateMruContribution(IMenuManager menuManager) {
- IWorkingSet[] sets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
- if(sets.length > 0) {
- if(item == null) {
- item = new WorkingSetMenuContributionItem(id, this);
- menuManager.prependToGroup(id, item);
- }
- } else {
- if(item != null) {
- menuManager.remove(item);
- }
- item = null;
- }
- }
-
- /**
- * Returns the working set which is currently selected.
- *
- * @return the working set which is currently selected.
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /**
- * Sets the current working set.
- *
- * @param newWorkingSet the new working set
- */
- public void setWorkingSet(IWorkingSet newWorkingSet) {
- IWorkingSet oldWorkingSet = workingSet;
-
- workingSet = newWorkingSet;
- // Update action
- clearWorkingSetAction.setEnabled(newWorkingSet != null);
- editWorkingSetAction.setEnabled(newWorkingSet != null);
-
- if(workingSet != null)
- PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(newWorkingSet);
- // Update viewer
- if (workingSetUpdater != null) {
- workingSetUpdater.propertyChange(
- new PropertyChangeEvent(
- this,
- WorkingSetFilterActionGroup.CHANGE_WORKING_SET,
- oldWorkingSet,
- newWorkingSet));
- }
-
- // Trick to get dynamic menu contribution for most-recent list to
- // be updated. These are action contributions and must be added/removed
- // before the menu is shown.
- // It is also quite possible that this menu hasn't been created when a
- // setWorking set property change occurs.
- if(bars.getMenuManager().find(id) != null) {
- updateMruContribution(bars.getMenuManager());
- }
- //bars.updateActionBars();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java
deleted file mode 100644
index 43d42c558..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
-
-import java.util.*;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkingSetComparator;
-
-/**
- * Menu contribution item which shows all the most recent working
- * sets.
- *
- * @since 3.0
- */
-public class WorkingSetMenuContributionItem extends ContributionItem {
- private WorkingSetFilterActionGroup actionGroup;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param id sequential id of the new instance
- * @param actionGroup the action group this contribution item is created in
- */
- public WorkingSetMenuContributionItem(String id, WorkingSetFilterActionGroup actionGroup) {
- super(id + TeamUIPlugin.ID + "working_set_contribution"); //$NON-NLS-1$
- Assert.isNotNull(actionGroup);
- this.actionGroup = actionGroup;
- }
-
- /**
- * Adds a menu item for the working set.
- * Overrides method from ContributionItem.
- *
- * @see org.eclipse.jface.action.ContributionItem#fill(Menu,int)
- */
- public void fill(Menu menu, int index) {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
- List sortedWorkingSets = Arrays.asList(workingSets);
- Collections.sort(sortedWorkingSets, new WorkingSetComparator());
-
- Iterator iter = sortedWorkingSets.iterator();
- int mruMenuCount = sortedWorkingSets.size();
- int i = 0;
- while (iter.hasNext()) {
- final IWorkingSet workingSet = (IWorkingSet)iter.next();
- if (workingSet != null) {
- MenuItem mi = new MenuItem(menu, SWT.RADIO, index + i);
- mi.setText("&" + (++i) + " " + workingSet.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- mi.setSelection(workingSet.equals(actionGroup.getWorkingSet()));
- mi.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- actionGroup.setWorkingSet(workingSet);
- manager.addRecentWorkingSet(workingSet);
- }
- });
- }
- }
- }
-
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- public boolean isDynamic() {
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java
deleted file mode 100644
index ba17383a1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java
+++ /dev/null
@@ -1,140 +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.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchAdapter;
-
-/**
- * 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 0de5120b7..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
+++ /dev/null
@@ -1,230 +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.*;
-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.*;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.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 ITeamUIConstants.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 b0849aa9a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.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.wizards;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-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.*;
-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.model.*;
-
-/**
- * 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);
- Dialog.applyDialogFont(parent);
- }
- /**
- * 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 693f6fd3a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.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.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.Dialog;
-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();
- Dialog.applyDialogFont(parent);
- }
-
- 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 e1a5b9133..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
+++ /dev/null
@@ -1,216 +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.Dialog;
-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();
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * 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 f29f19f97..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.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.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 javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-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$
-
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- ProjectSetContentHandler handler = new ProjectSetContentHandler();
- InputSource source = new InputSource(reader);
- parser.parse(source, handler);
-
- 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);
- } catch (ParserConfigurationException 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 b827bebb5..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.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.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 {
- 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_CONFLICT_OVR = "ovr/confchg_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$
- public final String IMG_COMPRESSED_FOLDER = "obj/compressed_folder_obj.gif"; //$NON-NLS-1$
- public final String IMG_WARNING = "ovr/warning_co.gif"; //$NON-NLS-1$
-
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
deleted file mode 100644
index 0aa50c41b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui;
-
-public interface ITeamUIConstants {
-
- // extension points
- public static final String PT_SYNCPARTICIPANTS = "synchronizeParticipants"; //$NON-NLS-1$
- public static final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$
- public static final String PT_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$
- public static final String PT_LOGICAL_VIEWS = "logicalViews"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java
deleted file mode 100644
index 5af378995..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.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.ui;
-
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-
-/**
- * TeamImages provides convenience methods for accessing shared images
- * provided by the org.eclipse.team.ui plug-in.
- * <p>
- * This class provides <code>Image</code> and <code>ImageDescriptor</code>s
- * for each named image in the interface. All <code>Image</code> objects provided
- * by this class are managed by this class and must never be disposed
- * by other clients.
- * </p>
- */
-public class TeamImages {
- /**
- * 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) {
- return TeamUIPlugin.getImageDescriptor(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) {
- return TeamUIPlugin.getImageDescriptorFromExtension(extension, subdirectoryAndFilename);
- }
-}
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 29a752129..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.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.ui;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.SynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-
-/**
- * TeamUI contains public API for generic UI-based Team functionality
- */
-public class TeamUI {
-
- // manages synchronize participants
- private static ISynchronizeManager synchronizeManager;
-
- /**
- * Property constant indicating the global ignores list has changed.
- */
- public static String GLOBAL_IGNORES_CHANGED = TeamUIPlugin.ID + "global_ignores_changed"; //$NON-NLS-1$
-
- /**
- * Return the synchronize manager.
- *
- * @return the synchronize manager
- * @since 3.0
- */
- public static ISynchronizeManager getSynchronizeManager() {
- if (synchronizeManager == null) {
- synchronizeManager = new SynchronizeManager();
- }
- return synchronizeManager;
- }
-
- /**
- * 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);
- }
-} \ No newline at end of file
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 8a222f458..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
+++ /dev/null
@@ -1,21 +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>
-Provides basic support for managing Team providers.
-<h2>Package Specification</h2>
-<p>This package specifies the API for integrating Team support plug-ins into
-the workbench. This support includes:</p>
-<ul>
-<li>A set of common images for enabling a common Team look in the workbench.
-<li>A configuration wizard extension for allowing Team providers to associate their
-provider with a project in the workspace.
-<li>A synchronization infrastructure to allow Team providers to extend or participate
-in the Synchronize View.
-</ul>
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
deleted file mode 100644
index 7da095d8d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.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.ui.synchronize;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
-
-/**
- * AbstractSynchronizeParticipant is the abstract base class for all
- * synchronize view participants. It provides default lifecycle support
- * for participants.
- *
- * @see ISynchronizeParticipant
- * @since 3.0
- */
-public abstract class AbstractSynchronizeParticipant implements ISynchronizeParticipant {
- // property listeners
- private ListenerList fListeners;
-
- private String fName;
- private String fId;
- private ImageDescriptor fImageDescriptor;
- protected IConfigurationElement configElement;
-
- /**
- * Notifies listeners of property changes, handling any exceptions
- */
- class PropertyNotifier implements ISafeRunnable {
-
- private IPropertyChangeListener fListener;
- private PropertyChangeEvent fEvent;
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- TeamUIPlugin.log(IStatus.ERROR, Policy.bind("AbstractSynchronizeParticipant.5"), exception); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- fListener.propertyChange(fEvent);
- }
-
- /**
- * Notifies listeners of the property change
- *
- * @param property
- * the property that has changed
- */
- public void notify(PropertyChangeEvent event) {
- if (fListeners == null) {
- return;
- }
- fEvent = event;
- Object[] copiedListeners = fListeners.getListeners();
- for (int i = 0; i < copiedListeners.length; i++) {
- fListener = (IPropertyChangeListener) copiedListeners[i];
- Platform.run(this);
- }
- fListener = null;
- }
- }
-
- public AbstractSynchronizeParticipant() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.IConsole#getName()
- */
- public String getName() {
- return fName;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.IConsole#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return fImageDescriptor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipant#getId()
- */
- public String getId() {
- return fId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#isPersistent()
- */
- public boolean isPersistent() {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.IConsole#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList();
- }
- fListeners.add(listener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.IConsole#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- }
-
- /**
- * Notify all listeners that the given property has changed.
- *
- * @param source
- * the object on which a property has changed
- * @param property
- * identifier of the property that has changed
- * @param oldValue
- * the old value of the property, or <code>null</code>
- * @param newValue
- * the new value of the property, or <code>null</code>
- */
- public void firePropertyChange(Object source, String property, Object oldValue, Object newValue) {
- if (fListeners == null) {
- return;
- }
- PropertyNotifier notifier = new PropertyNotifier();
- notifier.notify(new PropertyChangeEvent(source, property, oldValue, newValue));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
- * java.lang.String, java.lang.Object)
- */
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- // Save config element.
- configElement = config;
-
- // Id
- fId = config.getAttribute("id"); //$NON-NLS-1$
-
- // Title.
- fName = config.getAttribute("name"); //$NON-NLS-1$
- if (config == null) {
- fName = "Unknown"; //$NON-NLS-1$
- }
-
- // Icon.
- String strIcon = config.getAttribute("icon"); //$NON-NLS-1$
- if (strIcon != null) {
- fImageDescriptor = TeamImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), strIcon);
- }
- }
-
- protected void setInitializationData(ISynchronizeParticipantDescriptor descriptor) throws CoreException {
- if(descriptor instanceof SynchronizeParticipantDescriptor) {
- setInitializationData(((SynchronizeParticipantDescriptor)descriptor).getConfigurationElement(), null, null);
- } else {
- throw new TeamException(Policy.bind("AbstractSynchronizeParticipant.4")); //$NON-NLS-1$
- }
- }
-
- /**
- * Sets the name of this console to the specified value and notifies
- * property listeners of the change.
- *
- * @param name
- * the new name
- */
- protected void setName(String name) {
- String old = fName;
- fName = name;
- firePropertyChange(this, IBasicPropertyConstants.P_TEXT, old, name);
- }
-
- /**
- * Sets the image descriptor for this console to the specified value and
- * notifies property listeners of the change.
- *
- * @param imageDescriptor
- * the new image descriptor
- */
- protected void setImageDescriptor(ImageDescriptor imageDescriptor) {
- ImageDescriptor old = fImageDescriptor;
- fImageDescriptor = imageDescriptor;
- firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void init(IMemento memento) throws PartInitException {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
deleted file mode 100644
index 9c5cdbebc..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
+++ /dev/null
@@ -1,90 +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.synchronize;
-
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * Manages synchronization view participants. Clients can programatically add
- * or remove participants via this manager.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @see ISynchronizeParticipant
- * @since 3.0
- */
-public interface ISynchronizeManager {
- /**
- * Registers the given listener for participant notifications. Has
- * no effect if an identical listener is already registered.
- *
- * @param listener listener to register
- */
- public void addSynchronizeParticipantListener(ISynchronizeParticipantListener listener);
-
- /**
- * Deregisters the given listener for participant notifications. Has
- * no effect if an identical listener is not already registered.
- *
- * @param listener listener to deregister
- */
- public void removeSynchronizeParticipantListener(ISynchronizeParticipantListener listener);
-
- /**
- * Adds the given participants to the synchronize manager. Has no effect for
- * equivalent participants are already registered. The participants will be added
- * to any existing synchronize views.
- *
- * @param consoles consoles to add
- */
- public void addSynchronizeParticipants(ISynchronizeParticipant[] participants);
-
- /**
- * Removes the given participants from the synchronize manager. If the participants are
- * being displayed in any synchronize views, the associated pages will be closed.
- *
- * @param consoles consoles to remove
- */
- public void removeSynchronizeParticipants(ISynchronizeParticipant[] participants);
-
- /**
- * Returns a collection of synchronize participants registered with the synchronize manager.
- *
- * @return a collection of synchronize participants registered with the synchronize manager.
- */
- public ISynchronizeParticipant[] getSynchronizeParticipants();
-
- /**
- * Opens the synchronize view in the given page. Has no effect if the view is
- * already open in that page.
- *
- * @return the opened synchronize view
- */
- public ISynchronizeView showSynchronizeViewInActivePage(IWorkbenchPage page);
-
- /**
- * Returns the registered synchronize participants with the given id. It is
- * possible to have multiple instances of the same participant type.
- *
- * @return the registered synchronize participants with the given id, or
- * <code>null</code> if none with that id is not registered.
- */
- public ISynchronizeParticipant[] find(String id);
-
- /**
- * Returns the participant descriptor for the given participant id or
- * <code>null</code> if a descriptor is not found for that id.
- *
- * @return the participant descriptor for the given participant id or
- * <code>null</code> if a descriptor is not found for that id.
- */
- public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
deleted file mode 100644
index 4daa0e83f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java
+++ /dev/null
@@ -1,162 +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.synchronize;
-
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A synchronize participant is shown in the <code>Synchronize View</code>. Typically
- * a participant will show changes between local resources and variant states of
- * those resources. For example, a participant could show the relative synchronization
- * between local resources and those on an FTP server, or alternatively, between local
- * resources and local history.
- * <p>
- * A participant is added to the Synchronize View in three steps:
- * <ol>
- * <li>A <code>synchronizeParticipant</code> extension is contributed to
- * the team registry. This extension defines the participant id,
- * name, icon, type, and participant class.</li>
- * <li>The participant is included in the Synchronize View when the view is
- * created if its type is <code>static</code>.</li>
- * <li>If a participant is not static, plug-in developers can add the
- * participant to the view by adding the participant via
- * {@link ISynchronizeManager#addSynchronizeParticipants(ISynchronizeParticipant[]) and
- * remove it using {@link ISynchronizeManager#removeSynchronizeParticipants(ISynchronizeParticipant[]).
- * </ol>
- * </p>
- * <p>
- * A participant must create a page that will be displayed in the ISynchronizeView page
- * book view.
- * </p><p>
- * Clients may implement this interface.
- * </p>
- * @see ISynchronizeView
- * @see ISynchronizeManager
- * @since 3.0
- */
-public interface ISynchronizeParticipant extends IExecutableExtension {
- /**
- * Returns the unique id that identified the <i>type</i> of this
- * synchronize participant. The synchronize manager supports registering
- * several instances of the same participant type.
- *
- * @return the unique id that identified the <i>type</i> of this
- * synchronize participant.
- */
- public String getId();
-
- /**
- * Returns the name of this synchronize participant.
- *
- * @return the name of this synchronize participant
- */
- public String getName();
-
- /**
- * Returns <code>true</code> if this participant should be persisted between
- * workbench sessions and <code>false</code> otherwise.
- *
- * @return <code>true</code> if this participant should be persisted between
- * workbench sessions and <code>false</code> otherwise.
- */
- public boolean isPersistent();
-
- /**
- * Returns an image descriptor for this synchronize participant, or <code>null</code>
- * if none.
- *
- * @return an image descriptor for this synchronize participant, or <code>null</code>
- * if none
- */
- public ImageDescriptor getImageDescriptor();
-
- /**
- * Creates and returns a new page for this synchronize participant. The
- * page is displayed for this synchronize participant in the given
- * synchronize view.
- *
- * @param view the view in which the page is to be created
- * @return a page book view page representation of this synchronize
- * participant
- */
- public IPageBookViewPage createPage(ISynchronizeView view);
-
- /**
- * Initializes this participant with the given participant state.
- * A memento is passed to the participant which contains a snapshot
- * of the participants state from a previous session.
- * <p>
- * This method is automatically called by the team plugin shortly after
- * participant construction. It marks the start of the views's
- * lifecycle. Clients must not call this method.
- * </p>
- * @param memento the participant state or <code>null</code> if there
- * is no previous saved state
- * @exception PartInitException if this participant was not initialized
- * successfully
- */
- public void init(IMemento memento) throws PartInitException;
-
- /**
- * Disposes of this synchronize participant. This is the last method called
- * on the <code>ISynchronizeParticipant</code>. It marks the end of the
- * participants lifecycle.
- * </p>
- * <p>
- * Within this method a participant may release any resources, fonts, images, etc.
- * held by this part. It is also very important to deregister all listeners.
- * </p>
- * <p>
- * Clients should not call this method (the synchronize manager calls this
- * method at appropriate times).
- * </p>
- */
- public void dispose();
-
- /**
- * Saves the participants object state within the memento. This state
- * will be available when the participant is restored via <code>init</code>.
- * @param memento a memento to receive the object state
- */
- public void saveState(IMemento memento);
-
- /**
- * Adds a listener for changes to properties of this synchronize
- * participant. Has no effect if an identical listener is already
- * registered.
- * <p>
- * The changes supported by the synchronize view are as follows:
- * <ul>
- * <li><code>IBasicPropertyConstants.P_TEXT</code>- indicates the name
- * of a synchronize participant has changed</li>
- * <li><code>IBasicPropertyConstants.P_IMAGE</code>- indicates the
- * image of a synchronize participant has changed</li>
- * </ul></p>
- * <p>
- * Clients may define additional properties as required.
- * </p>
- * @param listener a property change listener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Removes the given property listener from this synchronize participant.
- * Has no effect if an identical listener is not alread registered.
- *
- * @param listener a property listener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java
deleted file mode 100644
index 9a0a99fac..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.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.ui.synchronize;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A participant descriptor contains the content of the
- * <code>synchronizeParticipants</code> extension section for
- * for a registered participant type in the declaring plug-in's
- * manifest (<code>plugin.xml</code>) file.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @see ISynchronizeManager#getParticipantDescriptor(String)
- * @since 3.0
- */
-public interface ISynchronizeParticipantDescriptor {
- /**
- * Returns a string describing this participant type.
- *
- * @return a string describing this participant type.
- */
- public String getDescription();
-
- /**
- * Returns the unique id that identifies this participant type.
- *
- * @return the unique id that identifies this participant type.
- */
- public String getId();
-
- /**
- * Returns the image descriptor for this participant type.
- *
- * @return the image descriptor for this participant type.
- */
- public ImageDescriptor getImageDescriptor();
-
- /**
- * Returns <code>true</code> if the participant is static and
- * <code>false</code> otherwise. Static participants are created
- * automatically by the synchronize manager at startup whereas
- * not static participants are created by client code and registered
- * with the manager.
- *
- * @return <code>true</code> if the participant is static and
- * <code>false</code> otherwise
- */
- public boolean isStatic();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java
deleted file mode 100644
index 6dde603ae..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java
+++ /dev/null
@@ -1,38 +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.synchronize;
-
-/**
- * A synchronize participant listener is notified when participants are added or
- * removed from the synchronize manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface ISynchronizeParticipantListener {
- /**
- * Notification the given participants have been added to the synchronize
- * manager.
- *
- * @param participants added participants
- */
- public void participantsAdded(ISynchronizeParticipant[] participants);
-
- /**
- * Notification the given participants have been removed from the
- * synchronize manager.
- *
- * @param participants removed participants
- */
- public void participantsRemoved(ISynchronizeParticipant[] participants);
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java
deleted file mode 100644
index 387158033..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.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.ui.synchronize;
-
-import org.eclipse.ui.IViewPart;
-
-/**
- * A view that displays synchronization participants that are registered with the
- * synchronize manager. This is essentially a generic container that allows
- * multiple {@link ISynchronizeParticipant} implementations to share the same
- * view. The only behavior provided by the view is a mechanism for switching
- * between participants.
- * <p>
- * Clients should not add viewActions to this view because they will be global
- * to all participants. Instead, add participant specific actions as described
- * in {@link StructuredViewerAdvisor}.
- * </p>
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @see ISynchronizeManager
- * @since 3.0
- */
-public interface ISynchronizeView extends IViewPart {
- /**
- * The id for this view
- */
- public static final String VIEW_ID = "org.eclipse.team.sync.views.SynchronizeView"; //$NON-NLS-1$
-
- /**
- * Displays the given synchronize participant in the Synchronize View. This
- * has no effect if this participant is already being displayed.
- *
- * @param participant participant to be displayed, cannot be <code>null</code>
- */
- public void display(ISynchronizeParticipant participant);
-
- /**
- * Returns the participant currently being displayed in the Synchronize View
- * or <code>null</code> if none.
- *
- * @return the participant currently being displayed in the Synchronize View
- * or <code>null</code> if none
- */
- public ISynchronizeParticipant getParticipant();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html
deleted file mode 100644
index b40bd2f51..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta content="text/html; charset=iso-8859-1"
- http-equiv="Content-Type">
- <meta content="IBM" name="Author">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-<p>Application programming interfaces for interaction
-with the Eclipse Synchronize View.</p>
-<h2>Package Specification</h2>
-<p>The Eclipse Team UI plug-in provides a set of classes and interfaces
-to support a generic synchronize view that can show multiple
-synchronize participants. This package contains a generic abstract
-synchronize participant that provides the common functionality for
-synchronize participants. The basic model for the Synchronize View APIs
-is the following:</p>
-<ul>
- <li>A ISynchronizeManager manages registered synchronize
-participants. There can be several instances of the same participant
-type.</li>
- <li>A ISynchronizeParticipant is a logical representation of a
-connection between workspace resources and a remote location used to
-shared those resources.</li>
- <li>A ISynchronizeView is a page book view of participants.</li>
- <li>A ISynchronizeParticipant must create a page that will be
-displayed in the ISynchronizeView page book view.</li>
- <li>The ISynchronizeView shows a drop-down of all registered
-participants and allows switching between them.</li>
- <li>A ISynchronizeParticipant can contribute actions to the toolbar,
-menus, and view menu.</li>
-</ul>
-<p>Synchronize participants are declared by extending the <strong>synchronizeParticipants
-</strong>extension point. There are two classes of synchronize
-participants: <em>static </em>participants will be created when the
-synchronize view is created, and <em>dynamic</em> participants that
-are created by user code at some other time. A synchronize manager (<b>ISynchronizeManager</b>)
-manages all active synchronize participants, and provides notification
-of participants which are added and removed. Participants are displayed
-in a page book view. Each participant implementation is reponsible for
-creating its page (<b>IPageBookView</b>), which provides freedom of
-presentation to the synchronize view implementation. A single
-participant may be displayed simultaneously in multiple synchronize
-views, and in different workbench windows.</p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java
deleted file mode 100644
index 3b76316c2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java
+++ /dev/null
@@ -1,176 +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.synchronize.subscriber;
-
-import java.util.*;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * 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.
- * <p>
- * When a modes changes a property change event is fired from the participant
- * with a value of <code>SubscriberParticipant.P_SYNCVIEWPAGE_MODE</code>.
- * </p>
- * @see SubscriberParticipant
- * @since 3.0
- */
-public class DirectionFilterActionGroup extends ActionGroup implements IPropertyChangeListener {
-
- // An array of the selection actions for the modes (indexed by mode constant)
- private List actions = new ArrayList(3);
-
- private DirectionFilterAction incomingMode;
- private DirectionFilterAction outgoingMode;
- private DirectionFilterAction bothMode;
- private DirectionFilterAction conflictsMode;
- private SubscriberParticipant page;
-
- private int supportedModes;
-
- class DirectionFilterAction extends Action {
- private int modeId;
-
- public DirectionFilterAction(String prefix,String commandId, int modeId) {
- super("", AS_RADIO_BUTTON); //$NON-NLS-1$
- this.modeId = modeId;
- Utils.initAction(this, prefix, Policy.getBundle());
- Action a = new Action() {
- public void run() {
- DirectionFilterAction.this.run();
- }
- };
- }
- public void run() {
- // checkMode() is called because programatic checking of radio buttons doesn't
- // consider radio buttons, hence breaks the radio-button behavior. As a workaround
- // we have to manually check/uncheck the set instead.
- //checkMode(modeId);
- if(isChecked()) {
- page.setMode(modeId);
- }
- }
- public int getModeId() {
- return modeId;
- }
- }
-
- /**
- * Creates a direction filter group with the given supported modes. The
- * possible values for modes are defined by the {@link SubscriberParticipant}
- * class.
- *
- * @see SubscriberParticipant#BOTH_MODE
- * @see SubscriberParticipant#OUTGOING_MODE
- * @see SubscriberParticipant#INCOMING_MODE
- * @see SubscriberParticipant#CONFLICTING_MODE
- * @see SubscriberParticipant#ALL_MODES
- *
- * @param participant the participant showing this group
- * @param supportedModes the modes to be shown
- */
- public DirectionFilterActionGroup(SubscriberParticipant participant, int supportedModes) {
- this.supportedModes = supportedModes;
- this.page = participant;
- createActions();
- participant.addPropertyChangeListener(this);
- checkMode(participant.getMode());
- }
-
- /**
- * Sets up the sync modes and the actions for switching between them.
- */
- private void createActions() {
- // Create the actions
- if((supportedModes & SubscriberParticipant.INCOMING_MODE) != 0) {
- incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", SubscriberParticipant.INCOMING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(incomingMode);
- }
-
- if((supportedModes & SubscriberParticipant.OUTGOING_MODE) != 0) {
- outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", SubscriberParticipant.OUTGOING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(outgoingMode);
- }
-
- if((supportedModes & SubscriberParticipant.BOTH_MODE) != 0) {
- bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", SubscriberParticipant.BOTH_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(bothMode);
- }
-
- if((supportedModes & SubscriberParticipant.CONFLICTING_MODE) != 0) {
- conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", SubscriberParticipant.CONFLICTING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(conflictsMode);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars, String group) {
- super.fillActionBars(actionBars);
- IToolBarManager toolBar = actionBars.getToolBarManager();
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction) it.next();
- if(group != null) {
- toolBar.appendToGroup(group, action);
- } else {
- toolBar.add(action);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillToolBar(IToolBarManager toolBar) {
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction) it.next();
- toolBar.add(action);
- }
- }
-
- private void checkMode(int mode) {
- for (Iterator it = actions.iterator(); it.hasNext();) {
- DirectionFilterAction action = (DirectionFilterAction)it.next();
- if(action.getModeId() == mode) {
- action.setChecked(true);
- } else {
- action.setChecked(false);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if(event.getProperty().equals(SubscriberParticipant.P_SYNCVIEWPAGE_MODE)) {
- Integer mode = (Integer)event.getNewValue();
- checkMode(mode.intValue());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#dispose()
- */
- public void dispose() {
- super.dispose();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java
deleted file mode 100644
index a3b999a5a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.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.ui.synchronize.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
-import org.eclipse.team.internal.ui.synchronize.IRefreshSubscriberListener;
-import org.eclipse.ui.IWorkbenchSite;
-
-/**
- * A general refresh action that will refresh a subscriber in the background.
- */
-public class RefreshAction extends Action {
-
- private ISelectionProvider selectionProvider;
- private boolean refreshAll;
- private SubscriberSyncInfoCollector collector;
- private IRefreshSubscriberListener listener;
- private String description;
- private IWorkbenchSite workbenchSite;
-
- public RefreshAction(ISelectionProvider page, String description, SubscriberSyncInfoCollector collector, IRefreshSubscriberListener listener, boolean refreshAll) {
- this.selectionProvider = page;
- this.description = description;
- this.collector = collector;
- this.listener = listener;
- this.refreshAll = refreshAll;
- Utils.initAction(this, "action.refreshWithRemote."); //$NON-NLS-1$
- }
-
- public void run() {
- ISelection selection = selectionProvider.getSelection();
- if(selection instanceof IStructuredSelection) {
- IResource[] resources = Utils.getResources(((IStructuredSelection)selection).toArray());
- if (refreshAll || resources.length == 0) {
- // If no resources are selected, refresh all the subscriber roots
- resources = collector.getRoots();
- }
- run(getWorkbenchSite(), description, resources, collector, listener);
- }
- }
-
- public static void run(IWorkbenchSite site, String description, IResource[] resources, final SubscriberSyncInfoCollector collector, IRefreshSubscriberListener listener) {
- // Cancel the scheduled background refresh or any other refresh that is happening.
- // The scheduled background refresh will restart automatically.
- Platform.getJobManager().cancel(RefreshSubscriberJob.getFamily());
- RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", description), resources, collector); //$NON-NLS-1$
- if (listener != null) {
- RefreshSubscriberJob.addRefreshListener(listener);
- }
- Utils.schedule(job, site);
- }
-
- public void setWorkbenchSite(IWorkbenchSite part) {
- this.workbenchSite = part;
- }
-
- public IWorkbenchSite getWorkbenchSite() {
- return workbenchSite;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java
deleted file mode 100644
index 5a9ef43d3..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java
+++ /dev/null
@@ -1,312 +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.synchronize.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-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.synchronize.actions.TeamParticipantRefreshAction;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A synchronize participant that displays synchronization information for local
- * resources that are managed via a {@link Subscriber}.
- *
- * @since 3.0
- */
-public abstract class SubscriberParticipant extends AbstractSynchronizeParticipant implements IPropertyChangeListener {
-
- private SubscriberSyncInfoCollector collector;
-
- private SubscriberRefreshSchedule refreshSchedule;
-
- private int currentMode;
-
- private IWorkingSet workingSet;
-
- private ISynchronizeView view;
-
- private boolean starting = true;
-
- /**
- * Key for settings in memento
- */
- private static final String CTX_SUBSCRIBER_PARTICIPANT_SETTINGS = TeamUIPlugin.ID + ".TEAMSUBSRCIBERSETTINGS"; //$NON-NLS-1$
-
- /**
- * Key for schedule in memento
- */
- private static final String CTX_SUBSCRIBER_SCHEDULE_SETTINGS = TeamUIPlugin.ID + ".TEAMSUBSRCIBER_REFRESHSCHEDULE"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the mode of a page has changed.
- */
- public static final String P_SYNCVIEWPAGE_WORKINGSET = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_WORKINGSET"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the schedule of a page has changed.
- */
- public static final String P_SYNCVIEWPAGE_SCHEDULE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_SCHEDULE"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the mode of a page has changed.
- */
- public static final String P_SYNCVIEWPAGE_MODE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_MODE"; //$NON-NLS-1$
-
- /**
- * Modes are direction filters for the view
- */
- public final static int INCOMING_MODE = 0x1;
- public final static int OUTGOING_MODE = 0x2;
- public final static int BOTH_MODE = 0x4;
- public final static int CONFLICTING_MODE = 0x8;
- public final static int ALL_MODES = INCOMING_MODE | OUTGOING_MODE | CONFLICTING_MODE | BOTH_MODE;
-
- public final static int[] INCOMING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING};
- public final static int[] OUTGOING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING};
- public final static int[] BOTH_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING, SyncInfo.OUTGOING};
- public final static int[] CONFLICTING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING};
-
- public SubscriberParticipant() {
- super();
- refreshSchedule = new SubscriberRefreshSchedule(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView)
- */
- public final IPageBookViewPage createPage(ISynchronizeView view) {
- this.view = view;
- return doCreatePage(view);
- }
-
- protected IPageBookViewPage doCreatePage(ISynchronizeView view) {
- return new SubscriberParticipantPage(this, view);
- }
-
- public void setMode(int mode) {
- int oldMode = getMode();
- if(oldMode == mode) return;
- currentMode = mode;
- TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_SELECTED_MODE, mode);
- updateMode(mode);
- firePropertyChange(this, P_SYNCVIEWPAGE_MODE, new Integer(oldMode), new Integer(mode));
- }
-
- public int getMode() {
- return currentMode;
- }
-
- public void setRefreshSchedule(SubscriberRefreshSchedule schedule) {
- this.refreshSchedule = schedule;
- firePropertyChange(this, P_SYNCVIEWPAGE_SCHEDULE, null, schedule);
- }
-
- public SubscriberRefreshSchedule getRefreshSchedule() {
- return refreshSchedule;
- }
-
- public void setWorkingSet(IWorkingSet set) {
- IWorkingSet oldSet = workingSet;
- if(collector != null) {
- IResource[] resources = set != null ? Utils.getResources(set.getElements()) : new IResource[0];
- collector.setWorkingSet(resources);
- firePropertyChange(this, P_SYNCVIEWPAGE_WORKINGSET, oldSet, set);
- }
- workingSet = set;
- }
-
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- public void refreshWithRemote(IResource[] resources, boolean addIfNeeded) {
- IWorkbenchSite site = view != null ? view.getSite() : null;
- if((resources == null || resources.length == 0)) {
- TeamParticipantRefreshAction.run(site, collector.getWorkingSet(), this, addIfNeeded);
- } else {
- TeamParticipantRefreshAction.run(site, resources, this, addIfNeeded);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#dispose()
- */
- public void dispose() {
- refreshSchedule.dispose();
- TeamUI.removePropertyChangeListener(this);
- collector.dispose();
- }
-
- /**
- * Return the <code>SubscriberSyncInfoCollector</code> for the participant.
- * This collector maintains the set of all out-of-sync resources for the subscriber.
- * @return the <code>SubscriberSyncInfoCollector</code> for this participant
- */
- public final SubscriberSyncInfoCollector getSubscriberSyncInfoCollector() {
- return collector;
- }
-
- protected void setSubscriber(Subscriber subscriber) {
- collector = new SubscriberSyncInfoCollector(subscriber);
-
- // listen for global ignore changes
- TeamUI.addPropertyChangeListener(this);
-
- preCollectingChanges();
-
- collector.start();
-
- // start the refresh now that a subscriber has been added
- SubscriberRefreshSchedule schedule = getRefreshSchedule();
- if(schedule.isEnabled()) {
- getRefreshSchedule().startJob();
- }
- }
-
- /**
- * This method is invoked just before the collector is started.
- * This gives an opertunity to configure the collector parameters
- * before collection starts. The default implementation sets the working
- * set as returned by <code>getWorkingSet()</code> and sets the mode
- * as returned by <code>getMode()</code>.
- */
- protected void preCollectingChanges() {
- if(workingSet != null) {
- setWorkingSet(workingSet);
- }
- updateMode(getMode());
- }
-
- /**
- * Get the <code>Subscriber</code> for this participant
- * @return a <code>TamSubscriber</code>
- */
- public Subscriber getSubscriber() {
- return collector.getSubscriber();
- }
-
- /* (non-Javadoc)
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
- collector.reset();
- }
- }
-
- /**
- * This method is invoked from <code>setMode</code> when the mode has changed.
- * It sets the filter on the collector to show the <code>SyncInfo</code>
- * appropriate for the mode.
- * @param mode the new mode (one of <code>INCOMING_MODE_FILTER</code>,
- * <code>OUTGOING_MODE_FILTER</code>, <code>CONFLICTING_MODE_FILTER</code>
- * or <code>BOTH_MODE_FILTER</code>)
- */
- protected void updateMode(int mode) {
- if(collector != null) {
-
- int[] modeFilter = BOTH_MODE_FILTER;
- switch(mode) {
- case SubscriberParticipant.INCOMING_MODE:
- modeFilter = INCOMING_MODE_FILTER; break;
- case SubscriberParticipant.OUTGOING_MODE:
- modeFilter = OUTGOING_MODE_FILTER; break;
- case SubscriberParticipant.BOTH_MODE:
- modeFilter = BOTH_MODE_FILTER; break;
- case SubscriberParticipant.CONFLICTING_MODE:
- modeFilter = CONFLICTING_MODE_FILTER; break;
- }
-
- collector.setFilter(
- new FastSyncInfoFilter.AndSyncInfoFilter(
- new FastSyncInfoFilter[] {
- new FastSyncInfoFilter.SyncInfoDirectionFilter(modeFilter)
- }));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void init(IMemento memento) throws PartInitException {
- if(memento != null) {
- IMemento settings = memento.getChild(CTX_SUBSCRIBER_PARTICIPANT_SETTINGS);
- if(settings != null) {
- String setSetting = settings.getString(P_SYNCVIEWPAGE_WORKINGSET);
- String modeSetting = settings.getString(P_SYNCVIEWPAGE_MODE);
- SubscriberRefreshSchedule schedule = SubscriberRefreshSchedule.init(settings.getChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS), this);
- setRefreshSchedule(schedule);
-
- if(setSetting != null) {
- IWorkingSet workingSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(setSetting);
- if(workingSet != null) {
- setWorkingSet(workingSet);
- }
- }
-
- int mode = SubscriberParticipant.BOTH_MODE;
- if(modeSetting != null) {
- try {
- mode = Integer.parseInt(modeSetting);
- } catch (NumberFormatException e) {
- mode = SubscriberParticipant.BOTH_MODE;
- }
- }
- setMode(mode);
- }
- } else {
- setMode(BOTH_MODE);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- IMemento settings = memento.createChild(CTX_SUBSCRIBER_PARTICIPANT_SETTINGS);
- IWorkingSet set = getWorkingSet();
- if(set != null) {
- settings.putString(P_SYNCVIEWPAGE_WORKINGSET, getWorkingSet().getName());
- }
- settings.putString(P_SYNCVIEWPAGE_MODE, Integer.toString(getMode()));
- refreshSchedule.saveState(settings.createChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS));
- }
-
- public static SubscriberParticipant find(Subscriber s) {
- ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant p = participants[i];
- if(p instanceof SubscriberParticipant) {
- if(((SubscriberParticipant)p).getSubscriber().equals(s)) {
- return (SubscriberParticipant)p;
- }
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java
deleted file mode 100644
index 712c82176..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java
+++ /dev/null
@@ -1,312 +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.synchronize.subscriber;
-
-import org.eclipse.compare.internal.INavigatable;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.synchronize.ChangesSection;
-import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog;
-import org.eclipse.team.internal.ui.synchronize.actions.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.viewers.TreeViewerAdvisor;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-
-/**
- * A synchronize view page that works with participants that are subclasses of
- * {@link SubscriberParticipant}. It shows changes in the tree or table view
- * and supports navigation, opening, and filtering changes.
- * <p>
- * Clients can subclass to extend the label decoration or add action bar
- * contributions. For more extensive modifications, clients should create
- * their own custom page.
- * </p>
- * @since 3.0
- */
-public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyChangeListener, IAdaptable {
- // 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 ChangesSection changesSection;
- private Viewer changesViewer;
- private boolean settingWorkingSet = false;
-
- private ISynchronizeView view;
- private SubscriberParticipant participant;
- private IPageSite site;
-
- // Toolbar and status line actions for this page, note that context menu actions shown in
- // the changes viewer are contributed via the viewer and not the page.
- private NavigateAction gotoNext;
- private NavigateAction gotoPrevious;
- private Action configureSchedule;
- private SyncViewerShowPreferencesAction showPreferences;
- private TeamParticipantRefreshAction refreshAllAction;
- private Action collapseAll;
- private WorkingSetFilterActionGroup workingSetGroup;
- private StatusLineContributionGroup statusLine;
- private SynchronizeViewerAdvisor viewerAdvisor;
-
- /**
- * Constructs a new SynchronizeView.
- */
- public SubscriberParticipantPage(SubscriberParticipant page, ISynchronizeView view) {
- this.participant = page;
- this.view = view;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- composite = new Composite(parent, SWT.NONE);
- //sc.setContent(composite);
- GridLayout gridLayout= new GridLayout();
- gridLayout.makeColumnsEqualWidth= false;
- gridLayout.marginWidth= 0;
- gridLayout.marginHeight = 0;
- gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessVerticalSpace = true;
- composite.setLayoutData(data);
-
- // Create the changes section which, in turn, creates the changes viewer and its configuration
- this.changesSection = new ChangesSection(composite, this);
- this.changesViewer = createChangesViewer(changesSection.getComposite());
- changesSection.setViewer(changesViewer);
-
- // toolbar
- INavigatable nav = new INavigatable() {
- public boolean gotoDifference(boolean next) {
- return viewerAdvisor.navigate(next);
- }
- };
- gotoNext = new NavigateAction(view, nav, true /*next*/);
- gotoPrevious = new NavigateAction(view, nav, false /*previous*/);
- refreshAllAction = new TeamParticipantRefreshAction(getSite().getSelectionProvider(), getParticipant(), false, true /* refresh all */);
- refreshAllAction.setWorkbenchSite(view.getSite());
- collapseAll = new Action() {
- public void run() {
- if (changesViewer == null || !(changesViewer instanceof AbstractTreeViewer)) return;
- changesViewer.getControl().setRedraw(false);
- ((AbstractTreeViewer)changesViewer).collapseToLevel(changesViewer.getInput(), TreeViewer.ALL_LEVELS);
- changesViewer.getControl().setRedraw(true);
- }
- };
- Utils.initAction(collapseAll, "action.collapseAll."); //$NON-NLS-1$
-
- configureSchedule = new Action() {
- public void run() {
- ConfigureRefreshScheduleDialog d = new ConfigureRefreshScheduleDialog(
- getShell(), participant.getRefreshSchedule());
- d.setBlockOnOpen(false);
- d.open();
- }
- };
- Utils.initAction(configureSchedule, "action.configureSchedulel."); //$NON-NLS-1$
-
- // view menu
- workingSetGroup = new WorkingSetFilterActionGroup(getShell(), this, view, participant);
- showPreferences = new SyncViewerShowPreferencesAction(getShell());
- statusLine = new StatusLineContributionGroup(getShell(), getParticipant(), workingSetGroup);
-
- participant.addPropertyChangeListener(this);
- TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(this);
- participant.setMode(participant.getMode());
- }
-
- private Shell getShell() {
- return view.getSite().getShell();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- */
- public void init(IPageSite site) throws PartInitException {
- this.site = site;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setFocus()
- */
- public void setFocus() {
- changesSection.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- statusLine.dispose();
- changesSection.dispose();
- viewerAdvisor.dispose();
- TeamUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this);
- participant.removePropertyChangeListener(this);
- }
-
- /*
- * 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.equals(ISelectionProvider.class))
- return changesViewer;
- if (key == IShowInSource.class) {
- return new IShowInSource() {
- public ShowInContext getShowInContext() {
- StructuredViewer v = (StructuredViewer)changesViewer;
- if (v == null) return null;
- ISelection s = v.getSelection();
- if (s instanceof IStructuredSelection) {
- Object[] resources = Utils.getResources(((IStructuredSelection)s).toArray());
- return new ShowInContext(null, new StructuredSelection(resources));
- }
- return null;
- }
- };
- }
- if (key == IShowInTargetList.class) {
- return new IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { IPageLayout.ID_RES_NAV };
- }
-
- };
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#getControl()
- */
- public Control getControl() {
- return composite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- if(actionBars != null) {
- IToolBarManager manager = actionBars.getToolBarManager();
-
- // toolbar
- manager.add(refreshAllAction);
- manager.add(new Separator());
- if(gotoNext != null) {
- manager.add(gotoNext);
- manager.add(gotoPrevious);
- }
- manager.add(collapseAll);
- manager.add(new Separator());
-
- // view menu
- IMenuManager menu = actionBars.getMenuManager();
- MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$
- MenuManager comparisonCriteria = new MenuManager(Policy.bind("action.comparisonCriteria.label")); //$NON-NLS-1$
- //comparisonCriteriaGroup.addActionsToMenuMgr(comparisonCriteria);
- workingSetGroup.fillActionBars(actionBars);
- menu.add(new Separator());
- menu.add(new Separator());
- menu.add(new Separator("others")); //$NON-NLS-1$
- menu.add(new Separator());
- menu.add(configureSchedule);
- menu.add(new Separator());
- menu.add(showPreferences);
-
- // status line
- statusLine.fillActionBars(actionBars);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPageBookViewPage#getSite()
- */
- public IPageSite getSite() {
- return this.site;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- // Working set changed by user
- if(event.getProperty().equals(WorkingSetFilterActionGroup.CHANGE_WORKING_SET)) {
- if(settingWorkingSet) return;
- settingWorkingSet = true;
- participant.setWorkingSet((IWorkingSet)event.getNewValue());
- settingWorkingSet = false;
- // Working set changed programatically
- } else if(event.getProperty().equals(SubscriberParticipant.P_SYNCVIEWPAGE_WORKINGSET)) {
- if(settingWorkingSet) return;
- settingWorkingSet = true;
- Object newValue = event.getNewValue();
- if (newValue instanceof IWorkingSet) {
- workingSetGroup.setWorkingSet((IWorkingSet)newValue);
- } else if (newValue == null) {
- workingSetGroup.setWorkingSet(null);
- }
- settingWorkingSet = false;
- // Change to showing of sync state in text labels preference
- } else if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) {
- if(changesViewer instanceof StructuredViewer) {
- ((StructuredViewer)changesViewer).refresh(true /* update labels */);
- }
- }
- }
-
- /**
- * @return Returns the participant.
- */
- public SubscriberParticipant getParticipant() {
- return participant;
- }
-
- /**
- * @return Returns the view.
- */
- public ISynchronizeView getSynchronizeView() {
- return view;
- }
-
- private Viewer createChangesViewer(Composite parent) {
- viewerAdvisor = createSynchronizeViewerAdvisor();
- TreeViewer viewer = new TreeViewerAdvisor.NavigableTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData(GridData.FILL_BOTH);
- viewer.getControl().setLayoutData(data);
- viewerAdvisor.initializeViewer(viewer);
- getSite().setSelectionProvider(viewer);
- return viewer;
- }
-
- public TreeViewerAdvisor getViewerConfiguration() {
- return viewerAdvisor;
- }
-
- public Viewer getViewer() {
- return changesViewer;
- }
-
- protected SynchronizeViewerAdvisor createSynchronizeViewerAdvisor() {
- return new SynchronizeViewerAdvisor(getSynchronizeView(), getParticipant());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java
deleted file mode 100644
index 1b8a8c7f8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java
+++ /dev/null
@@ -1,195 +0,0 @@
-package org.eclipse.team.ui.synchronize.subscriber;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
-import org.eclipse.team.internal.ui.synchronize.IRefreshEvent;
-import org.eclipse.team.internal.ui.synchronize.IRefreshSubscriberListener;
-import org.eclipse.ui.IMemento;
-
-public class SubscriberRefreshSchedule {
- private long refreshInterval = 3600; // 1 hour default
-
- private boolean enabled = false;
-
- private RefreshSubscriberJob job;
-
- private SubscriberParticipant participant;
-
- private IRefreshEvent lastRefreshEvent;
-
- /**
- * Key for settings in memento
- */
- private static final String CTX_REFRESHSCHEDULE_INTERVAL = TeamUIPlugin.ID + ".CTX_REFRESHSCHEDULE_INTERVAL"; //$NON-NLS-1$
-
- /**
- * Key for schedule in memento
- */
- private static final String CTX_REFRESHSCHEDULE_ENABLED = TeamUIPlugin.ID + ".CTX_REFRESHSCHEDULE_ENABLED"; //$NON-NLS-1$
-
- private IRefreshSubscriberListener refreshSubscriberListener = new IRefreshSubscriberListener() {
- public void refreshStarted(IRefreshEvent event) {
- }
- public void refreshDone(final IRefreshEvent event) {
- if (event.getSubscriber() == participant.getSubscriber()) {
- lastRefreshEvent = event;
- }
- }
- };
-
-
- public SubscriberRefreshSchedule(SubscriberParticipant participant) {
- this.participant = participant;
- RefreshSubscriberJob.addRefreshListener(refreshSubscriberListener);
- }
-
- /**
- * @return Returns the enabled.
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * @param enabled The enabled to set.
- */
- public void setEnabled(boolean enabled, boolean allowedToStart) {
- boolean wasEnabled = isEnabled();
- this.enabled = enabled;
- if(enabled && ! wasEnabled) {
- if(allowedToStart) {
- startJob();
- }
- } else {
- stopJob();
- }
- }
-
- /**
- * @return Returns the refreshInterval.
- */
- public long getRefreshInterval() {
- return refreshInterval;
- }
-
- public SubscriberParticipant getParticipant() {
- return participant;
- }
-
- /**
- * @param refreshInterval The refreshInterval to set.
- */
- public void setRefreshInterval(long refreshInterval) {
- stopJob();
- this.refreshInterval = refreshInterval;
- if(isEnabled()) {
- startJob();
- }
- }
-
- protected void startJob() {
- SyncInfoSet set = participant.getSubscriberSyncInfoCollector().getSyncInfoTree();
- if(set == null) {
- return;
- }
- if(job == null) {
- job = new RefreshSubscriberJob(Policy.bind("RefreshSchedule.14", participant.getName(), getRefreshIntervalAsString()), participant.getSubscriberSyncInfoCollector()); //$NON-NLS-1$
- } else if(job.getState() != Job.NONE){
- stopJob();
- }
- job.setRestartOnCancel(true);
- job.setReschedule(true);
- job.schedule(getRefreshInterval());
- }
-
- protected void stopJob() {
- if(job != null) {
- job.setRestartOnCancel(false /* don't restart the job */);
- job.setReschedule(false);
- job.cancel();
- job = null;
- }
- }
-
- public void dispose() {
- stopJob();
- RefreshSubscriberJob.removeRefreshListener(refreshSubscriberListener);
- }
-
- public void saveState(IMemento memento) {
- memento.putString(CTX_REFRESHSCHEDULE_ENABLED, Boolean.toString(enabled));
- memento.putInteger(CTX_REFRESHSCHEDULE_INTERVAL, (int)refreshInterval);
- }
-
- public static SubscriberRefreshSchedule init(IMemento memento, SubscriberParticipant participant) {
- SubscriberRefreshSchedule schedule = new SubscriberRefreshSchedule(participant);
- if(memento != null) {
- String enabled = memento.getString(CTX_REFRESHSCHEDULE_ENABLED);
- int interval = memento.getInteger(CTX_REFRESHSCHEDULE_INTERVAL).intValue();
- schedule.setRefreshInterval(interval);
- schedule.setEnabled("true".equals(enabled) ? true : false, false /* don't start job */); //$NON-NLS-1$
- }
- // Use the defaults if a schedule hasn't been saved or can't be found.
- return schedule;
- }
-
- public static String refreshEventAsString(IRefreshEvent event) {
- if(event == null) {
- return Policy.bind("SyncViewPreferencePage.lastRefreshRunNever"); //$NON-NLS-1$
- }
- long stopMills = event.getStopTime();
- long startMills = event.getStartTime();
- StringBuffer text = new StringBuffer();
- if(stopMills <= 0) {
- text.append(Policy.bind("SyncViewPreferencePage.lastRefreshRunNever")); //$NON-NLS-1$
- } else {
- Date lastTimeRun = new Date(stopMills);
- text.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(lastTimeRun));
- }
- SyncInfo[] changes = event.getChanges();
- if (changes.length != 0) {
- text.append(Policy.bind("RefreshSchedule.6", Integer.toString(changes.length))); //$NON-NLS-1$
- } else {
- text.append(Policy.bind("RefreshSchedule.7")); //$NON-NLS-1$
- }
- return text.toString();
- }
-
- public String getScheduleAsString() {
- if(! isEnabled()) {
- return Policy.bind("RefreshSchedule.8"); //$NON-NLS-1$
- }
- return getRefreshIntervalAsString();
- }
-
- public IRefreshEvent getLastRefreshEvent() {
- return lastRefreshEvent;
- }
-
- private String getRefreshIntervalAsString() {
- boolean hours = false;
- long seconds = getRefreshInterval();
- if(seconds <= 60) {
- seconds = 60;
- }
- long minutes = seconds / 60;
- if(minutes >= 60) {
- minutes = minutes / 60;
- hours = true;
- }
- String unit;
- if(minutes >= 1) {
- unit = (hours ? Policy.bind("RefreshSchedule.9") : Policy.bind("RefreshSchedule.10")); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- unit = (hours ? Policy.bind("RefreshSchedule.11") : Policy.bind("RefreshSchedule.12")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return Policy.bind("RefreshSchedule.13", Long.toString(minutes), unit); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java
deleted file mode 100644
index 31a3d86ba..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.synchronize.actions.*;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.viewers.*;
-
-/**
- * Overrides the SyncInfoDiffViewerConfiguration to configure the diff viewer
- * for the synchroniza view
- */
-public class SynchronizeViewerAdvisor extends TreeViewerAdvisor {
-
- private ISynchronizeView view;
- private SubscriberParticipant participant;
- private OpenWithActionGroup openWithActions;
- private RefactorActionGroup refactorActions;
- private TeamParticipantRefreshAction refreshSelectionAction;
-
- public SynchronizeViewerAdvisor(ISynchronizeView view, SubscriberParticipant participant) {
- super(participant.getId(), participant.getSubscriberSyncInfoCollector().getSyncInfoTree());
- this.view = view;
- this.participant = participant;
- }
-
- protected SubscriberParticipant getParticipant() {
- return participant;
- }
-
- protected void initializeActions(StructuredViewer treeViewer) {
- super.initializeActions(treeViewer);
- openWithActions = new OpenWithActionGroup(view, participant);
- refactorActions = new RefactorActionGroup(view);
- refreshSelectionAction = new TeamParticipantRefreshAction(treeViewer, participant, false /* refresh */, false);
- refreshSelectionAction.setWorkbenchSite(view.getSite());
- }
-
- protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) {
- openWithActions.fillContextMenu(manager);
- refactorActions.fillContextMenu(manager);
- manager.add(refreshSelectionAction);
- manager.add(new Separator());
- super.fillContextMenu(viewer, manager);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoDiffTreeViewer#handleDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
- protected void handleDoubleClick(StructuredViewer viewer, DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- DiffNode node = (DiffNode) selection.getFirstElement();
- if (node != null && node instanceof SyncInfoModelElement) {
- SyncInfoModelElement syncNode = (SyncInfoModelElement) node;
- IResource resource = syncNode.getResource();
- if (syncNode != null && resource != null && resource.getType() == IResource.FILE) {
- openWithActions.openInCompareEditor();
- return;
- }
- }
- // Double-clicking should expand/collapse containers
- super.handleDoubleClick(viewer, event);
- }
-
- protected void initializeListeners(StructuredViewer viewer) {
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- updateStatusLine((IStructuredSelection) event.getSelection());
- }
- });
- viewer.addOpenListener(new IOpenListener() {
-
- public void open(OpenEvent event) {
- handleOpen();
- }
- });
- super.initializeListeners(viewer);
- }
-
- protected void handleOpen() {
- openWithActions.openInCompareEditor();
- }
-
- /**
- * Updates the message shown in the status line.
- * @param selection
- * the current selection
- */
- private void updateStatusLine(IStructuredSelection selection) {
- String msg = getStatusLineMessage(selection);
- view.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
- */
- private String getStatusLineMessage(IStructuredSelection selection) {
- if (selection.size() == 1) {
- Object first = selection.getFirstElement();
- if (first instanceof SyncInfoModelElement) {
- SyncInfoModelElement node = (SyncInfoModelElement) first;
- IResource resource = node.getResource();
- if (resource == null) {
- return node.getName();
- } else {
- return resource.getFullPath().makeRelative().toString();
- }
- }
- }
- if (selection.size() > 1) {
- return selection.size() + Policy.bind("SynchronizeView.13"); //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html
deleted file mode 100644
index 729b92e03..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta content="text/html; charset=iso-8859-1"
- http-equiv="Content-Type">
- <meta content="IBM" name="Author">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-<p>Actions and utilities for use with the Eclipse Synchronize View.</p>
-<h2>Package Specification</h2>
-<p>This package contains actions that are used by subclasses of <b>TeamSubscriberParticipant</b>.
-<br>
-</p>
-<p>The class <b>TeamSubscriberParticipant</b> provides an
-implementation of a synchronize participant that enables
-synchronization for a <b>Subscriber</b>. For providers that implement
-a <strong>Subscriber</strong>, this is the easiest method of
-integrating into the Synchronize View. The TeamSubscriberParticipant
-provides a view of changes (incoming, outgoing, conflicting), modes for
-showing only a subset of the changes, decorations for identifying the
-changes, and working sets. Here are the steps for creating a
-participant based on the TeamSubscriberParticipant implementation:</p>
-<ul>
- <li>Implement a concrete subclass of <strong>TeamSubscriber</strong>
-that will provide the physical connection between the workspace
-resources and the remote location that is used to share the resources.</li>
- <li>Subclass <strong>TeamSubscriberParticipant</strong> and provide
-concrete implementations for init(QualifiedName), saveState(), and
-optionally createPage().</li>
- <li>To add actions to the context menu of the participant page you
-must create a viewerContribution in your plugin.xml with the targetID
-field equal to that of the qualifier part of the participant's type id.
-For example:
- <pre>&lt;viewerContribution id="org.eclipse.myteamplugin.syncparticipant.actions" <br> targetID="org.eclipse.myteamplugin.syncparticipant"</pre>
- </li>
- <li>To add participant specific actions to the view's action bar,
-subclass TeamSubscriberParticipantPage and implement setActionBars().</li>
- <li>To add participant specific decorations to the viewer, subclass
-TeamSubscriberParticipantPage and implement getLabelProvider().</li>
-</ul>
-</body>
-</html>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/CompressedFoldersModelProvider.java
deleted file mode 100644
index 0a02d8a62..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/CompressedFoldersModelProvider.java
+++ /dev/null
@@ -1,281 +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.synchronize.viewers;
-
-import java.util.*;
-
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.ISharedImages;
-
-public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
-
- protected class UnchangedCompressedDiffNode extends UnchangedResourceModelElement {
- public UnchangedCompressedDiffNode(IDiffContainer parent, IResource resource) {
- super(parent, resource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
- public String getName() {
- IResource resource = getResource();
- return resource.getProjectRelativePath().toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER);
- }
- }
-
- /**
- * A compressed folder appears under a project and contains out-of-sync resources
- */
- public class CompressedFolderDiffNode extends SyncInfoModelElement {
-
- public CompressedFolderDiffNode(IDiffContainer parent, SyncInfo info) {
- super(parent, info);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
- public String getName() {
- IResource resource = getResource();
- return resource.getProjectRelativePath().toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER);
- }
- }
-
- public CompressedFoldersModelProvider(SyncInfoTree set) {
- super(set);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoDiffNodeRoot#getSorter()
- */
- public ViewerSorter getViewerSorter() {
- return new SynchronizeModelElementSorter() {
- protected int compareNames(IResource resource1, IResource resource2) {
- if (resource1.getType() == IResource.FOLDER && resource2.getType() == IResource.FOLDER) {
- return collator.compare(resource1.getProjectRelativePath().toString(), resource2.getProjectRelativePath().toString());
- }
- return super.compareNames(resource1, resource2);
- }
- };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObjects(org.eclipse.compare.structuremergeviewer.DiffNode)
- */
- protected IDiffElement[] createModelObjects(SynchronizeModelElement container) {
- IResource resource = null;
- if (container == getModelRoot()) {
- resource = ResourcesPlugin.getWorkspace().getRoot();
- } else {
- resource = container.getResource();
- }
- if(resource != null) {
- if (resource.getType() == IResource.PROJECT) {
- return getProjectChildren(container, (IProject)resource);
- }
- if (resource.getType() == IResource.FOLDER) {
- return getFolderChildren(container, resource);
- }
- }
- return super.createModelObjects(container);
- }
-
- private IDiffElement[] getFolderChildren(SynchronizeModelElement parent, IResource resource) {
- // Folders will only contain out-of-sync children
- IResource[] children = getSyncInfoTree().members(resource);
- List result = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
- if (child.getType() == IResource.FILE) {
- result.add(createModelObject(parent, child));
- }
- }
- return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
- }
-
- private IDiffElement[] getProjectChildren(SynchronizeModelElement parent, IProject project) {
- // The out-of-sync elements could possibly include the project so the code
- // below is written to ignore the project
- SyncInfo[] outOfSync = getSyncInfoTree().getSyncInfos(project, IResource.DEPTH_INFINITE);
- Set result = new HashSet();
- Set resourcesToShow = new HashSet();
- for (int i = 0; i < outOfSync.length; i++) {
- SyncInfo info = outOfSync[i];
- IResource local = info.getLocal();
- if (local.getProjectRelativePath().segmentCount() == 1 && local.getType() == IResource.FILE) {
- resourcesToShow.add(local);
- } else {
- if (local.getType() == IResource.FILE) {
- resourcesToShow.add(local.getParent());
- } else if (local.getType() == IResource.FOLDER){
- resourcesToShow.add(local);
- }
- }
- }
- for (Iterator iter = resourcesToShow.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- result.add(createModelObject(parent, resource));
- }
-
- return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#createChildNode(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource)
- */
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObject(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource)
- */
- protected SynchronizeModelElement createModelObject(SynchronizeModelElement parent, IResource resource) {
- if (resource.getType() == IResource.FOLDER) {
- SyncInfo info = getSyncInfoTree().getSyncInfo(resource);
- SynchronizeModelElement newNode;
- if(info != null) {
- newNode = new CompressedFolderDiffNode(parent, info);
- } else {
- newNode = new UnchangedCompressedDiffNode(parent, resource);
- }
- addToViewer(newNode);
- return newNode;
- }
- return super.createModelObject(parent, resource);
- }
-
- /**
- * Update the viewer for the sync set additions in the provided event.
- * This method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>.
- * Subclasses may override.
- * @param event
- */
- protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- SyncInfo[] infos = event.getAddedResources();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- addResource(info);
- }
- }
-
- private void addResource(SyncInfo info) {
- IResource local = info.getLocal();
- SynchronizeModelElement existingNode = getModelObject(local);
- if (existingNode == null) {
- if (local.getType() == IResource.FILE) {
- SynchronizeModelElement parentNode = getModelObject(local.getParent());
- if (parentNode == null) {
- SynchronizeModelElement projectNode = getModelObject(local.getProject());
- if (projectNode == null) {
- projectNode = createModelObject(getModelRoot(), local.getProject());
- }
- if (local.getParent().getType() == IResource.PROJECT) {
- parentNode = projectNode;
- } else {
- parentNode = createModelObject(projectNode, local.getParent());
- }
- }
- createModelObject(parentNode, local);
- } else {
- SynchronizeModelElement projectNode = getModelObject(local.getProject());
- if (projectNode == null) {
- projectNode = createModelObject(getModelRoot(), local.getProject());
- }
- createModelObject(projectNode, local);
- }
- } else {
- // Either The folder node was added as the parent of a newly added out-of-sync file
- // or the file was somehow already there so just refresh
- handleChange(existingNode, info);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent)
- */
- protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- IResource[] roots = event.getRemovedSubtreeRoots();
-
- // First, deal with any projects that have been removed
- List removedProjects = new ArrayList();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
- if (resource.getType() == IResource.PROJECT) {
- removeFromViewer(resource);
- removedProjects.add(resource);
- }
- }
-
- IResource[] resources = event.getRemovedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!removedProjects.contains(resource.getProject())) {
- if (resource.getType() == IResource.FILE) {
- if (isCompressedParentEmpty(resource)) {
- // The parent compressed folder is also empty so remove it
- removeFromViewer(resource.getParent());
- } else {
- removeFromViewer(resource);
- }
- } else {
- // A folder has been removed (i.e. is in-sync)
- // but may still contain children
- removeFromViewer(resource);
- if (hasFileMembers((IContainer)resource)) {
- createModelObject(getModelObject(resource.getProject()), resource);
- buildModelObjects(getModelObject(resource));
- }
- }
- }
- }
- }
-
- private boolean isCompressedParentEmpty(IResource resource) {
- IContainer parent = resource.getParent();
- if (parent == null
- || parent.getType() == IResource.ROOT
- || parent.getType() == IResource.PROJECT) {
- return false;
- }
- return !hasFileMembers(parent);
- }
-
- private boolean hasFileMembers(IContainer parent) {
- // Check if the sync set has any file children of the parent
- IResource[] members = getSyncInfoTree().members(parent);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
- if (member.getType() == IResource.FILE) {
- return true;
- }
- }
- // The parent does not contain any files
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/HierarchicalModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/HierarchicalModelProvider.java
deleted file mode 100644
index a537e8da4..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/HierarchicalModelProvider.java
+++ /dev/null
@@ -1,230 +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.synchronize.viewers;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.team.core.synchronize.*;
-
-/**
- * An input that can be used with both {@link } and
- * {@link }. The
- * job of this input is to create the logical model of the contents of the
- * sync set for displaying to the user. The created logical model must diff
- * nodes.
- * <p>
- * 1. First, prepareInput is called to initialize the model with the given sync
- * set. Building the model occurs in the ui thread.
- * 2. The input must react to changes in the sync set and adjust its diff node
- * model then update the viewer. In effect mediating between the sync set
- * changes and the model shown to the user. This happens in the ui thread.
- * </p>
- * NOT ON DEMAND - model is created then maintained!
- * @since 3.0
- */
-public class HierarchicalModelProvider extends SynchronizeModelProvider {
-
- /**
- * Create an input based on the provide sync set. The input is not initialized
- * until <code>prepareInput</code> is called.
- *
- * @param set the sync set used as the basis for the model created by this input.
- */
- public HierarchicalModelProvider(SyncInfoTree set) {
- super(set);
- }
-
- public ViewerSorter getViewerSorter() {
- return new SynchronizeModelElementSorter();
- }
-
- protected SyncInfoTree getSyncInfoTree() {
- return (SyncInfoTree)getSyncInfoSet();
- }
-
- /**
- * Invoked by the <code>buildModelObject</code> method to create
- * the childen of the given node. This method can be overriden
- * by subclasses but subclasses should inv
- * @param container
- * @return
- */
- protected IDiffElement[] createModelObjects(SynchronizeModelElement container) {
- IResource resource = null;
- if (container == getModelRoot()) {
- resource = ResourcesPlugin.getWorkspace().getRoot();
- } else {
- resource = container.getResource();
- }
- if(resource != null) {
- SyncInfoTree infoTree = getSyncInfoTree();
- IResource[] children = infoTree.members(resource);
- SynchronizeModelElement[] nodes = new SynchronizeModelElement[children.length];
- for (int i = 0; i < children.length; i++) {
- nodes[i] = createModelObject(container, children[i]);
- }
- return nodes;
- }
- return new IDiffElement[0];
- }
-
- protected SynchronizeModelElement createModelObject(SynchronizeModelElement parent, IResource resource) {
- SyncInfo info = getSyncInfoTree().getSyncInfo(resource);
- SynchronizeModelElement newNode;
- if(info != null) {
- newNode = new SyncInfoModelElement(parent, info);
- } else {
- newNode = new UnchangedResourceModelElement(parent, resource);
- }
- addToViewer(newNode);
- return newNode;
- }
-
- /**
- * Invokes <code>getModelObject(Object)</code> on an array of resources.
- * @param resources
- * the resources
- * @return the model objects for the resources
- */
- 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;
- }
-
- /**
- * Handle the change for the existing diff node. The diff node
- * should be changed to have the given sync info
- * @param diffNode the diff node to be changed
- * @param info the new sync info for the diff node
- */
- protected void handleChange(SynchronizeModelElement diffNode, SyncInfo info) {
- IResource local = info.getLocal();
- // TODO: Get any additional sync bits
- if(diffNode instanceof SyncInfoModelElement) {
- boolean wasConflict = isConflicting(diffNode);
- // The update preserves any of the additional sync info bits
- ((SyncInfoModelElement)diffNode).update(info);
- boolean isConflict = isConflicting(diffNode);
- updateLabel(diffNode);
- if (wasConflict && !isConflict) {
- setParentConflict(diffNode, false);
- } else if (!wasConflict && isConflict) {
- setParentConflict(diffNode, true);
- }
- } else {
- removeFromViewer(local);
- addResources(new IResource[] {local});
- }
- // TODO: set any additional sync info bits
- }
-
- protected void addResources(IResource[] added) {
- for (int i = 0; i < added.length; i++) {
- IResource resource = added[i];
- SynchronizeModelElement node = getModelObject(resource);
- if (node != null) {
- // Somehow the node exists. Remove it and read it to ensure
- // what is shown matches the contents of the sync set
- removeFromViewer(resource);
- }
- // Build the sub-tree rooted at this node
- SynchronizeModelElement parent = getModelObject(resource.getParent());
- if (parent != null) {
- node = createModelObject(parent, resource);
- buildModelObjects(node);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#buildModelObjects(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
- */
- protected IDiffElement[] buildModelObjects(SynchronizeModelElement node) {
- IDiffElement[] children = createModelObjects(node);
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- if (element instanceof SynchronizeModelElement) {
- buildModelObjects((SynchronizeModelElement) element);
- }
- }
- return children;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doAdd(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement, org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
- */
- protected void doAdd(SynchronizeModelElement parent, SynchronizeModelElement element) {
- AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
- viewer.add(parent, element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doRemove(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
- */
- protected void doRemove(SynchronizeModelElement element) {
- AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
- viewer.remove(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceAdditions(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
- protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- IResource[] added = event.getAddedSubtreeRoots();
- addResources(added);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
- protected void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
- // Refresh the viewer for each changed resource
- SyncInfo[] infos = event.getChangedResources();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IResource local = info.getLocal();
- SynchronizeModelElement diffNode = getModelObject(local);
- if (diffNode != null) {
- handleChange(diffNode, info);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceRemovals(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
- protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- // Remove the removed subtrees
- IResource[] removedRoots = event.getRemovedSubtreeRoots();
- for (int i = 0; i < removedRoots.length; i++) {
- removeFromViewer(removedRoots[i]);
- }
- // We have to look for folders that may no longer be in the set
- // (i.e. are in-sync) but still have descendants in the set
- IResource[] removedResources = event.getRemovedResources();
- for (int i = 0; i < removedResources.length; i++) {
- IResource resource = removedResources[i];
- if (resource.getType() != IResource.FILE) {
- SynchronizeModelElement node = getModelObject(resource);
- if (node != null) {
- removeFromViewer(resource);
- addResources(new IResource[] {resource});
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java
deleted file mode 100644
index cbe3e8a37..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.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.ui.synchronize.viewers;
-
-
-/**
- * Listener that gets informed when the <code>DiffNode</code> model created
- * by the configurator is created or updated.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface ISynchronizeModelChangeListener {
- /**
- * Called whenever the input model shown in a diff node viewer is updated.
- *
- * @param input the root <code>DiffNode</code> of the model.
- */
- public void modelChanged(SynchronizeModelElement root);
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java
deleted file mode 100644
index fa5b10140..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java
+++ /dev/null
@@ -1,401 +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.synchronize.viewers;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.internal.PluginAction;
-import org.eclipse.ui.model.BaseWorkbenchContentProvider;
-
-/**
- * A <code>StructuredViewerAdvisor</code> controls various UI
- * aspects of viewers that show {@link SyncInfoSet} like the context menu, toolbar,
- * content provider, label provider, navigation, and model provider. The
- * advisor allows decoupling viewer behavior from the viewers presentation. This
- * allows viewers that aren't in the same class hierarchy to re-use basic
- * behavior.
- * <p>
- * This advisor allows viewer contributions made in a plug-in manifest to
- * be scoped to a particular unique id. As a result the context menu for the
- * viewer can be configured to show object contributions for random id schemes.
- * To enable declarative action contributions for a configuration there are two
- * steps required:
- * <ul>
- * <li>Create a viewer contribution with a <code>targetID</code> that groups
- * sets of actions that are related. A common pratice for synchronize view
- * configurations is to use the participant id as the targetID.
- *
- * <pre>
- * &lt;viewerContribution
- * id=&quot;org.eclipse.team.ccvs.ui.CVSCompareSubscriberContributions&quot;
- * targetID=&quot;org.eclipse.team.cvs.ui.compare-participant&quot;&gt;
- * ...
- * </pre>
- *
- * <li>Create a configuration instance with a <code>menuID</code> that
- * matches the targetID in the viewer contribution.
- * </ul>
- * </p><p>
- * Clients may subclass to add behavior for concrete structured viewers.
- * </p>
- *
- * @see TreeViewerAdvisor
- * @since 3.0
- */
-public abstract class StructuredViewerAdvisor {
-
- private SynchronizeModelProvider modelProvider;
- private ListenerList listeners;
- private String targetID;
-
- private SyncInfoSet set;
- private StructuredViewer viewer;
-
- /**
- * Create an advisor that will allow viewer contributions with the given <code>targetID</code>. This
- * advisor will provide a presentation model based on the given sync info set. Note that it's important
- * to call {@link #dispose()} when finished with an advisor.
- *
- * @param targetID the targetID defined in the viewer contributions in a plugin.xml file.
- * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user.
- */
- public StructuredViewerAdvisor(String targetID, SyncInfoSet set) {
- this.set = set;
- this.targetID = targetID;
- }
-
- /**
- * Create an advisor that will provide a presentation model based on the given sync info set.
- * Note that it's important to call {@link #dispose()} when finished with an advisor.
- *
- * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user.
- */
- public StructuredViewerAdvisor(SyncInfoSet set) {
- this(null, set);
- }
-
- /**
- * Install a viewer to be configured with this advisor. An advisor can only be installed with
- * one viewer at a time. When this method completes the viewer is considered initialized and
- * can be shown to the user.
-
- * @param viewer the viewer being installed
- */
- public final void initializeViewer(StructuredViewer viewer) {
- Assert.isTrue(this.viewer == null, "Can only be initialized once."); //$NON-NLS-1$
- Assert.isTrue(validateViewer(viewer));
- this.viewer = viewer;
-
- initializeListeners(viewer);
- hookContextMenu(viewer);
- initializeActions(viewer);
- viewer.setLabelProvider(getLabelProvider());
- viewer.setContentProvider(getContentProvider());
-
- // The input may of been set already. In that case, don't change it and
- // simply assign it to the view.
- if(modelProvider == null) {
- modelProvider = getModelProvider();
- modelProvider.prepareInput(null);
- }
- setInput(viewer);
- }
-
- /**
- * This is called to add a listener to the model shown in the viewer. The listener is
- * called when the model is changed or updated.
- *
- * @param listener the listener to add
- */
- public void addInputChangedListener(ISynchronizeModelChangeListener listener) {
- if (listeners == null)
- listeners= new ListenerList();
- listeners.add(listener);
- }
-
- /**
- * Remove a model listener.
- *
- * @param listener the listener to remove.
- */
- public void removeInputChangedListener(ISynchronizeModelChangeListener listener) {
- if (listeners != null) {
- listeners.remove(listener);
- if (listeners.isEmpty())
- listeners= null;
- }
- }
-
- /**
- * Must be called when an advisor is no longer needed.
- */
- public void dispose() {
- if(modelProvider != null) {
- modelProvider.dispose();
- }
- }
-
- /**
- * Return the targetID that is used to obtain context menu items from the workbench. When
- * a context menu is added to the viewer, this ID is registered with the workbench to allow
- * viewer contributions.
- *
- * @return the targetID or <code>null</code> if this advisor doesn't allow contributions.
- */
- public String getTargetID() {
- return targetID;
- }
-
- /**
- * Return the <code>SyncInfoSet</code> used to create the model shown by this advisor.
- *
- * @return the <code>SyncInfoSet</code> used to create the model shown by this advisor.
- */
- public SyncInfoSet getSyncInfoSet() {
- return set;
- }
-
- /**
- * Subclasses must implement to allow navigation of their viewers.
- *
- * @param next if <code>true</code> then navigate forwards, otherwise navigate
- * backwards.
- * @return <code>true</code> if the end is reached, and <code>false</code> otherwise.
- */
- public abstract boolean navigate(boolean next);
-
- /**
- * Creates the model that will be shown in the viewers. This can be called before the
- * viewer has been created.
- * <p>
- * The result of this method can be shown used as the input to a viewer. However, the
- * prefered method of initializing a viewer is to call {@link #initializeViewer(StructuredViewer)}
- * directly. This method only exists when the model must be created before the
- * viewer.
- * </p>
- * @param monitor shows progress while preparing the model
- * @return the model that can be shown in a viewer
- */
- public Object prepareInput(IProgressMonitor monitor) throws TeamException {
- if(modelProvider != null) {
- modelProvider.dispose();
- }
- modelProvider = getModelProvider();
- return modelProvider.prepareInput(monitor);
- }
-
- /**
- * Callback that is invoked when a context menu is about to be shown in the
- * viewer. Subsclasses must implement to contribute menus. Also, menus can
- * contributed by creating a viewer contribution with a <code>targetID</code>
- * that groups sets of actions that are related.
- *
- * @param viewer the viewer in which the context menu is being shown.
- * @param manager the menu manager to which actions can be added.
- */
- protected void fillContextMenu(final StructuredViewer viewer, IMenuManager manager) {
- }
-
- /**
- * Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code>
- * in order to initialize any actions for the viewer. It is invoked before
- * the input is set on the viewer in order to allow actions to be
- * initialized before there is any reaction to the input being set (e.g.
- * selecting and opening the first element).
- * <p>
- * The default behavior is to add the up and down navigation nuttons to the
- * toolbar. Subclasses can override.
- * </p>
- * @param viewer the viewer being initialize
- */
- protected void initializeActions(StructuredViewer viewer) {
- }
-
- /**
- * Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code>
- * in order to initialize any listeners for the viewer.
- *
- * @param viewer the viewer being initialize
- */
- protected void initializeListeners(final StructuredViewer viewer) {
- }
-
- /**
- * Get the input that will be assigned to the viewer initialized by this
- * configuration. Subclass may override.
- * @return the viewer input
- */
- protected abstract SynchronizeModelProvider getModelProvider();
-
-
- /**
- * Subclasses can validate that the viewer being initialized with this advisor
- * is of the correct type.
- *
- * @param viewer the viewer to validate
- * @return <code>true</code> if the viewer is valid, <code>false</code> otherwise.
- */
- protected abstract boolean validateViewer(StructuredViewer viewer);
-
- /**
- * Returns whether workbench menu items whould be included in the context
- * menu. By default, this returns <code>true</code> if there is a menu id
- * and <code>false</code> otherwise
- * @return whether to include workbench context menu items
- */
- protected boolean allowParticipantMenuContributions() {
- return getTargetID() != null;
- }
-
- /**
- * Run the runnable in the UI thread.
- * @param r the runnable to run in the UI thread.
- */
- protected void aSyncExec(Runnable r) {
- final Control ctrl = viewer.getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().asyncExec(r);
- }
- }
-
- private void fireChanges() {
- if (listeners != null) {
- Object[] l= listeners.getListeners();
- for (int i= 0; i < l.length; i++)
- ((ISynchronizeModelChangeListener) l[i]).modelChanged(modelProvider.getModelRoot());
- }
- }
-
- /**
- * Returns the content provider for the viewer.
- *
- * @return the content provider for the viewer.
- */
- protected IStructuredContentProvider getContentProvider() {
- return new BaseWorkbenchContentProvider();
- }
-
-
- /**
- * Get the label provider that will be assigned to the viewer initialized
- * by this configuration. Subclass may override but should either wrap the
- * default one provided by this method or subclass <code>TeamSubscriberParticipantLabelProvider</code>.
- * In the later case, the logical label provider should still be assigned
- * to the subclass of <code>TeamSubscriberParticipantLabelProvider</code>.
- * @param logicalProvider
- * the label provider for the selected logical view
- * @return a label provider
- * @see SynchronizeModelElementLabelProvider
- */
- protected ILabelProvider getLabelProvider() {
- return new SynchronizeModelElementLabelProvider();
- }
-
- /**
- * Returns the viewer configured by this advisor.
- *
- * @return the viewer configured by this advisor.
- */
- protected StructuredViewer getViewer() {
- return viewer;
- }
-
- /**
- * Method invoked from <code>initializeViewer(StructuredViewer)</code>
- * in order to configure the viewer to call <code>fillContextMenu(StructuredViewer, IMenuManager)</code>
- * when a context menu is being displayed in viewer.
- *
- * @param viewer the viewer being initialized
- * @see fillContextMenu(StructuredViewer, IMenuManager)
- */
- protected final void hookContextMenu(final StructuredViewer viewer) {
- final MenuManager menuMgr = new MenuManager(getTargetID()); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
-
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(viewer, manager);
- }
- });
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- menu.addMenuListener(new MenuListener() {
-
- public void menuHidden(MenuEvent e) {
- }
-
- // Hack to allow action contributions to update their
- // state before the menu is shown. This is required when
- // the state of the selection changes and the contributions
- // need to update enablement based on this.
- public void menuShown(MenuEvent e) {
- IContributionItem[] items = menuMgr.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
- if (item instanceof ActionContributionItem) {
- IAction actionItem = ((ActionContributionItem) item).getAction();
- if (actionItem instanceof PluginAction) {
- ((PluginAction) actionItem).selectionChanged(viewer.getSelection());
- }
- }
- }
- }
- });
- viewer.getControl().setMenu(menu);
- if (allowParticipantMenuContributions()) {
- IWorkbenchPartSite site = Utils.findSite(viewer.getControl());
- if (site == null) {
- site = Utils.findSite();
- }
- if (site != null) {
- site.registerContextMenu(getTargetID(), menuMgr, viewer);
- }
- }
- }
-
- /**
- * Called to set the input to a viewer. The input to a viewer is always the model created
- * by the model provider.
- *
- * @param viewer the viewer to set the input.
- */
- protected final void setInput(StructuredViewer viewer) {
- modelProvider.setViewer(viewer);
- viewer.setSorter(modelProvider.getViewerSorter());
- DiffNode input = modelProvider.getModelRoot();
- input.addCompareInputChangeListener(new ICompareInputChangeListener() {
- public void compareInputChanged(ICompareInput source) {
- fireChanges();
- }
- });
- viewer.setInput(modelProvider.getModelRoot());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java
deleted file mode 100644
index 2cea55b65..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java
+++ /dev/null
@@ -1,261 +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.synchronize.viewers;
-
-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.compare.structuremergeviewer.IDiffContainer;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.core.Assert;
-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.synchronize.LocalResourceTypedElement;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * A {@link SyncInfo} editor input used as input to a two-way or three-way
- * compare viewer. It defines methods for accessing the three sides for the
- * compare, and a name and image which is used when displaying the three way input
- * in an editor. This input can alternatly be used to show compare results in
- * a dialog by calling {@link CompareUI#openCompareDialog()}.
- * <p>
- * Supports saving the local resource that is changed in the editor.
- * </p>
- * <p>
- * Use {@link SynchronizeCompareInput} to display more than one <code>SyncInfo</code>
- * in an compare viewer.
- * </p>
- * @see SyncInfoModelElement
- * @since 3.0
- */
-public final class SyncInfoCompareInput extends CompareEditorInput implements IResourceChangeListener {
-
- private MyDiffNode node;
- private String description;
- private IResource resource;
- private IEditorPart editor;
-
- private static class MyDiffNode extends SyncInfoModelElement {
- public MyDiffNode(IDiffContainer parent, SyncInfo info) {
- super(parent, info);
- }
- public void fireChange() {
- super.fireChange();
- }
- }
-
- /**
- * Creates a compare editor input based on an existing <code>SyncInfo</code>.
- *
- * @param description a description of the context of this sync info. This
- * is displayed to the user.
- * @param sync the <code>SyncInfo</code> used as the base for the compare input.
- */
- public SyncInfoCompareInput(CompareConfiguration cc, String description, SyncInfo sync) {
- super(cc);
- Assert.isNotNull(sync);
- Assert.isNotNull(description);
- this.description = description;
- this.resource = sync.getLocal();
- this.node = new MyDiffNode(null, sync);
- initializeContentChangeListeners();
- initializeResourceChangeListeners();
- }
-
- 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) {
- }
- }
- });
- }
- }
-
- private void initializeResourceChangeListeners() {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- }
-
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- if (delta != null) {
- IResourceDelta resourceDelta = delta.findMember(resource.getFullPath());
- if (resourceDelta != null) {
- if (editor != null && editor instanceof IReusableEditor) {
- UIJob job = new UIJob("") {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- node.update(node.getSyncInfo());
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
- }
- }
- }
-
- public void setCompareEditor(IEditorPart editor) {
- Assert.isNotNull(editor);
- this.editor = editor;
- editor.getSite().getPage().addPartListener(new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- getCompareEditor().getSite().getPage().removePartListener(this);
- dispose();
- SyncInfoCompareInput.this.editor = null;
- }
- public void partDeactivated(IWorkbenchPart part) {
- }
- public void partOpened(IWorkbenchPart part) {
- }
- });
- }
-
- public IEditorPart getCompareEditor() {
- return this.editor;
- }
-
- protected void dispose() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getTitleImage()
- */
- public Image getTitleImage() {
- ImageRegistry reg = TeamUIPlugin.getPlugin().getImageRegistry();
- Image image = reg.get(ISharedImages.IMG_SYNC_VIEW);
- if (image == null) {
- image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW).createImage();
- reg.put(ISharedImages.IMG_SYNC_VIEW, image);
- }
- return image;
- }
-
- /*
- * (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());
- Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration());
- try {
- node.cacheContents(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- return node;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getTitle()
- */
- public String getTitle() {
- return Policy.bind("SyncInfoCompareInput.title", node.getName()); //$NON-NLS-1$
- }
-
- /*
- * (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", description, node.getResource().getFullPath().toString()); //$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 getSyncInfo().equals(((SyncInfoCompareInput) other).getSyncInfo());
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void saveChanges(IProgressMonitor pm) throws CoreException {
- super.saveChanges(pm);
- if (node != null) {
- try {
- commit(pm, node);
- } finally {
- node.fireChange();
- setDirty(false);
- }
- }
- }
-
- 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 node.getSyncInfo();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java
deleted file mode 100644
index 57e445795..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.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.ui.synchronize.viewers;
-
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.ResourceNode;
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;
-import org.eclipse.team.internal.ui.synchronize.RemoteResourceTypedElement;
-
-/**
- * A diff node used to display the synchronization state for resources described by
- * existing {@link SyncInfo} objects. The synchronization state for a node can
- * change after it has been created. Since it implements the <code>ITypedElement</code>
- * and <code>ICompareInput</code> interfaces it can be used directly to
- * display the compare result in a <code>DiffTreeViewer</code> and as the
- * input to any other compare/merge viewer.
- * <p>
- * You can access the {@link SyncInfoSet} this node was created from for quick access
- * to the underlying sync state model.
- * </p>
- * <p>
- * TODO: mention node builders and syncinfocompareinput and syncinfodifftree viewer
- * Clients typically use this class as is, but may subclass if required.
- * @see DiffTreeViewer
- * @see Differencer
- */
-public class SyncInfoModelElement extends SynchronizeModelElement {
-
- private ITypedElement ancestor;
- private SyncInfo info;
-
- /**
- * Construct a <code>SyncInfoModelElement</code> for the given resource. The {@link SyncInfoSet}
- * that contains sync states for this resource must also be provided. This set is used
- * to access the underlying sync state model that is the basis for this node this helps for
- * providing quick access to the logical containment
- *
- * @param set The set associated with the diff tree veiwer
- * @param resource The resource for the node
- */
- public SyncInfoModelElement(IDiffContainer parent, SyncInfo info) {
- super(parent);
- update(info);
- }
-
- public void update(SyncInfo info) {
- this.info = info;
- // update state
- setKind(info.getKind());
- // local
- setLeft(createLocalTypeElement(info));
- // remote
- setRight(createRemoteTypeElement(info));
- // base
- setAncestor(createBaseTypeElement(info));
- fireChange();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffElement#getKind()
- */
- public int getKind() {
- SyncInfo info = getSyncInfo();
- if (info != null) {
- return info.getKind();
- } else {
- return SyncInfo.IN_SYNC;
- }
- }
-
- /**
- * We have to track the base because <code>DiffNode</code> doesn't provide a
- * setter. See:
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52261
- */
- public void setAncestor(ITypedElement ancestor) {
- this.ancestor = ancestor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getAncestor()
- */
- public ITypedElement getAncestor() {
- return this.ancestor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
- public String getName() {
- IResource resource = getResource();
- if(resource != null) {
- return resource.getName();
- } else {
- return super.getName();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if(adapter == SyncInfo.class) {
- return getSyncInfo();
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * Helper method that returns the resource associated with this node. A node is not
- * required to have an associated local resource.
- * @return the resource associated with this node or <code>null</code> if the local
- * contributor is not a resource.
- */
- public IResource getResource() {
- ITypedElement element = getLeft();
- if(element instanceof ResourceNode) {
- return ((ResourceNode)element).getResource();
- }
- return null;
- }
-
- /**
- * Return true if the receiver's Subscriber 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) {
- return this==object;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- IResource resource = getResource();
- if (resource == null) {
- return super.hashCode();
- }
- return resource.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getResource() != null ? getResource().getFullPath().toString() : getName();
- }
-
- /**
- * Cache the contents for the base and remote.
- * @param monitor
- */
- public void cacheContents(IProgressMonitor monitor) throws TeamException {
- ITypedElement base = getAncestor();
- ITypedElement remote = getRight();
- int work = Math.min((remote== null ? 0 : 50) + (base == null ? 0 : 50), 10);
- monitor.beginTask(null, work);
- try {
- if (base != null && base instanceof RemoteResourceTypedElement) {
- ((RemoteResourceTypedElement)base).cacheContents(Policy.subMonitorFor(monitor, 50));
- }
- if (remote != null && remote instanceof RemoteResourceTypedElement) {
- ((RemoteResourceTypedElement)remote).cacheContents(Policy.subMonitorFor(monitor, 50));
- }
- } finally {
- monitor.done();
- }
- }
-
- public SyncInfo getSyncInfo() {
- return info;
- }
-
- /**
- * Create an ITypedElement for the given local resource. The returned ITypedElement
- * will prevent editing of outgoing deletions.
- */
- private static ITypedElement createTypeElement(final IResource resource, final int kind) {
- if(resource != null) {
- return new LocalResourceTypedElement(resource) {
- public boolean isEditable() {
- if(! resource.exists() && SyncInfo.getDirection(kind) == SyncInfo.OUTGOING && SyncInfo.getChange(kind) == SyncInfo.DELETION) {
- return false;
- }
- return super.isEditable();
- }
- };
- }
- return null;
- }
-
- /**
- * Create an ITypedElement for the given remote resource. The contents for the remote resource
- * will be retrieved from the given IStorage which is a local cache used to buffer the remote contents
- */
- protected static ITypedElement createTypeElement(IResourceVariant remoteResource) {
- return new RemoteResourceTypedElement(remoteResource);
- }
-
- protected static ITypedElement createRemoteTypeElement(SyncInfo info) {
- if(info != null && info.getRemote() != null) {
- return createTypeElement(info.getRemote());
- }
- return null;
- }
-
- protected static ITypedElement createLocalTypeElement(SyncInfo info) {
- if(info != null && info.getLocal() != null) {
- return createTypeElement(info.getLocal(), info.getKind());
- }
- return null;
- }
-
- protected static ITypedElement createBaseTypeElement(SyncInfo info) {
- if(info != null && info.getBase() != null) {
- return createTypeElement(info.getBase());
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java
deleted file mode 100644
index 0486ce71f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java
+++ /dev/null
@@ -1,196 +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.synchronize.viewers;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.CompareViewerPane;
-import org.eclipse.compare.NavigationAction;
-import org.eclipse.compare.internal.INavigatable;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * A <code>CompareEditorInput</code> whose diff viewer shows the resources contained
- * in a <code>SyncInfoSet</code>. The configuration of the diff viewer is determined by the
- * <code>SyncInfoSetCompareConfiguration</code> that is used to create the
- * <code>SynchronizeCompareInput</code>.
- *
- * uses the presentation model defined by the configuration.
- *
- * @since 3.0
- */
-public class SynchronizeCompareInput extends CompareEditorInput {
-
- private TreeViewerAdvisor diffViewerConfiguration;
- private Viewer diffViewer;
- private NavigationAction nextAction;
- private NavigationAction previousAction;
-
- /**
- * Create a <code>SynchronizeCompareInput</code> whose diff viewer is configured
- * using the provided <code>SyncInfoSetCompareConfiguration</code>.
- * @param configuration the compare configuration
- * @param diffViewerConfiguration the diff viewer configuration
- */
- public SynchronizeCompareInput(CompareConfiguration configuration, TreeViewerAdvisor diffViewerConfiguration) {
- super(configuration);
- this.diffViewerConfiguration = diffViewerConfiguration;
- }
-
- public final Viewer createDiffViewer(Composite parent) {
- this.diffViewer = internalCreateDiffViewer(parent, getViewerConfiguration());
- diffViewer.getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
-
- /*
- * This viewer can participate in navigation support in compare editor inputs. Note that
- * it is currently accessing an internal compare interface that should be made public. See
- * the following bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=48795.
- */
- INavigatable nav= new INavigatable() {
- public boolean gotoDifference(boolean next) {
- return diffViewerConfiguration.navigate(next);
- }
- };
- diffViewer.getControl().setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
- nextAction = new NavigationAction(true);
- previousAction = new NavigationAction(false);
- nextAction.setCompareEditorInput(this);
- previousAction.setCompareEditorInput(this);
-
-
- initializeToolBar(diffViewer.getControl().getParent());
- initializeDiffViewer(diffViewer);
- return diffViewer;
- }
-
- /**
- * Create the diff viewer for this compare input. This method simply creates the widget.
- * Any initialization is performed in the <code>initializeDiffViewer(StructuredViewer)</code>
- * method. The default diff viewer is a <code>SyncInfoDiffTreeViewer</code>. Subclass may override.
- * @param parent the parent <code>Composite</code> of the diff viewer to be created
- * @param diffViewerConfiguration the configuration for the diff viewer
- * @return the created diff viewer
- */
- protected StructuredViewer internalCreateDiffViewer(Composite parent, TreeViewerAdvisor diffViewerConfiguration) {
- TreeViewer viewer = new TreeViewerAdvisor.NavigableTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData(GridData.FILL_BOTH);
- viewer.getControl().setLayoutData(data);
- diffViewerConfiguration.initializeViewer(viewer);
- return viewer;
- }
-
- protected TreeViewerAdvisor getViewerConfiguration() {
- return diffViewerConfiguration;
- }
-
- protected Viewer getViewer() {
- return diffViewer;
- }
-
- /**
- * Initialize the diff viewer created for this compare input. If a subclass
- * overrides the <code>createDiffViewer(Composite)</code> method, it should
- * invoke this method on the created viewer in order to get the proper
- * labelling in the compare input's contents viewers.
- * @param viewer the diff viewer created by the compare input
- */
- protected void initializeDiffViewer(Viewer viewer) {
- if (viewer instanceof StructuredViewer) {
- ((StructuredViewer) viewer).addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- ISelection s = event.getSelection();
- final SyncInfoModelElement node = getElement(s);
- if (node != null) {
- IResource resource = node.getResource();
- int kind = node.getKind();
- if (resource != null && resource.getType() == IResource.FILE) {
- // Cache the contents because compare doesn't show progress
- // when calling getContents on a diff node.
- IProgressService manager = PlatformUI.getWorkbench().getProgressService();
- try {
- node.cacheContents(new NullProgressMonitor());
- } catch (TeamException e) {
- Utils.handle(e);
- } finally {
- // Update the labels even if the content wasn't fetched correctly. This is
- // required because the selection would still of changed.
- Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration());
- }
- }
- }
- }
- });
- }
- }
-
- public void contributeToToolBar(ToolBarManager tbm) {
- if(nextAction != null && previousAction != null) {
- tbm.appendToGroup("navigation", nextAction); //$NON-NLS-1$
- tbm.appendToGroup("navigation", previousAction); //$NON-NLS-1$
- }
- }
-
- private void initializeToolBar(Composite parent) {
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
- contributeToToolBar(tbm);
- tbm.update(true);
- }
- }
-
- /* private */ SyncInfoModelElement getElement(ISelection selection) {
- if (selection != null && selection instanceof IStructuredSelection) {
- IStructuredSelection ss= (IStructuredSelection) selection;
- if (ss.size() == 1) {
- Object o = ss.getFirstElement();
- if(o instanceof SyncInfoModelElement) {
- return (SyncInfoModelElement)o;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- return getViewerConfiguration().prepareInput(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java
deleted file mode 100644
index 0c05f4ace..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.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.ui.synchronize.viewers;
-
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A model element that can be shown in viewers.
- *
- * @since 3.0
- */
-public abstract class SynchronizeModelElement extends DiffNode implements IAdaptable {
-
- public static final String BUSY_PROPERTY = TeamUIPlugin.ID + ".busy"; //$NON-NLS-1$
- public static final String PROPAGATED_CONFLICT_PROPERTY = TeamUIPlugin.ID + ".conflict"; //$NON-NLS-1$
-
- /*
- * Internal flags bits for stroing properties in the flags variable
- */
- private static final int BUSY_FLAG = 1;
- private static final int PROPAGATED_CONFLICT_FLAG = 2;
-
- // Instance variable containing the flags for this node
- private int flags;
- private ListenerList listeners;
-
- public SynchronizeModelElement(IDiffContainer parent) {
- super(parent, SyncInfo.IN_SYNC);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- public synchronized void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (listeners == null) {
- listeners = new ListenerList();
- }
- listeners.add(listener);
- }
-
- public synchronized void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (listeners != null) {
- listeners.remove(listener);
- if (listeners.isEmpty()) {
- listeners = null;
- }
- }
- }
-
- /**
- * Return whether this node has the given property set.
- * @param propertyName the flag to test
- * @return <code>true</code> if the property is set
- */
- public boolean getProperty(String propertyName) {
- return (getFlags() & getFlag(propertyName)) > 0;
- }
-
- /**
- * Add the flag to the flags for this node
- * @param propertyName the flag to add
- */
- public void setProperty(String propertyName, boolean value) {
- if (value) {
- if (!getProperty(propertyName)) {
- int flag = getFlag(propertyName);
- flags |= flag;
- firePropertyChange(propertyName);
- }
- } else {
- if (getProperty(propertyName)) {
- int flag = getFlag(propertyName);
- flags ^= flag;
- firePropertyChange(propertyName);
- }
- }
- }
-
- public void setPropertyToRoot(String propertyName, boolean value) {
- if (value) {
- addToRoot(propertyName);
- } else {
- removeToRoot(propertyName);
- }
- }
-
- public void fireChanges() {
- fireChange();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- IResource resource = getResource();
- if(resource != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)((IAdaptable) resource).getAdapter(IWorkbenchAdapter.class);
- return adapter.getImageDescriptor(resource);
- }
- return null;
- }
-
- public abstract IResource getResource();
-
- private void addToRoot(String flag) {
- setProperty(flag, true);
- SynchronizeModelElement parent = (SynchronizeModelElement)getParent();
- if (parent != null) {
- if (parent.getProperty(flag)) return;
- parent.addToRoot(flag);
- }
- }
-
- private void firePropertyChange(String propertyName) {
- Object[] allListeners;
- synchronized(this) {
- if (listeners == null) return;
- allListeners = listeners.getListeners();
- }
- boolean set = getProperty(propertyName);
- final PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, Boolean.valueOf(!set), Boolean.valueOf(set));
- for (int i = 0; i < allListeners.length; i++) {
- Object object = allListeners[i];
- if (object instanceof IPropertyChangeListener) {
- final IPropertyChangeListener listener = (IPropertyChangeListener)object;
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // Exceptions logged by the platform
- }
- public void run() throws Exception {
- listener.propertyChange(event);
- }
- });
- }
- }
- }
-
- private int getFlag(String propertyName) {
- if (propertyName == BUSY_PROPERTY) {
- return BUSY_FLAG;
- } else if (propertyName == PROPAGATED_CONFLICT_PROPERTY) {
- return PROPAGATED_CONFLICT_FLAG;
- }
- return 0;
- }
-
- private int getFlags() {
- return flags;
- }
-
- private boolean hasChildWithFlag(String flag) {
- IDiffElement[] childen = getChildren();
- for (int i = 0; i < childen.length; i++) {
- IDiffElement element = childen[i];
- if (((SynchronizeModelElement)element).getProperty(flag)) {
- return true;
- }
- }
- return false;
- }
-
- private void removeToRoot(String flag) {
- setProperty(flag, false);
- SynchronizeModelElement parent = (SynchronizeModelElement)getParent();
- if (parent != null) {
- // If the parent doesn't have the tag, no recalculation is required
- // Also, if the parent still has a child with the tag, no recalculation is needed
- if (parent.getProperty(flag) && !parent.hasChildWithFlag(flag)) {
- // The parent no longer has the flag so propogate the reclaculation
- parent.removeToRoot(flag);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java
deleted file mode 100644
index ca14ae936..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java
+++ /dev/null
@@ -1,207 +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.synchronize.viewers;
-
-import java.util.*;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.ui.internal.WorkbenchColors;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * A label provider that decorates viewers showing
- * {@link org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement}.
- *
- * @since 3.0
- */
-public class SynchronizeModelElementLabelProvider extends LabelProvider implements IColorProvider {
-
- // Cache for folder images that have been overlayed with conflict icon
- private Map fgImageCache;
-
- // Contains direction images
- CompareConfiguration compareConfig = new CompareConfiguration();
-
- // Used as the base label provider for retreiving image and text from
- // the workbench adapter.
- private WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
-
- /**
- * Decorating label provider that also support color providers
- */
- public static class DecoratingColorLabelProvider extends DecoratingLabelProvider implements IColorProvider {
-
- public DecoratingColorLabelProvider(ILabelProvider provider, ILabelDecorator decorator) {
- super(provider, decorator);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
- public Color getForeground(Object element) {
- ILabelProvider p = getLabelProvider();
- if (p instanceof IColorProvider) {
- return ((IColorProvider) p).getForeground(element);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
- public Color getBackground(Object element) {
- ILabelProvider p = getLabelProvider();
- if (p instanceof IColorProvider) {
- return ((IColorProvider) p).getBackground(element);
- }
- return null;
- }
- }
-
- public SynchronizeModelElementLabelProvider() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
- public Color getForeground(Object element) {
- if (element instanceof SynchronizeModelElement) {
- SynchronizeModelElement node = (SynchronizeModelElement)element;
- if(node.getProperty(SynchronizeModelElement.BUSY_PROPERTY)) {
- return WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
- public Color getBackground(Object element) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- Image base = workbenchLabelProvider.getImage(element);
- if (base != null) {
- if (element instanceof DiffNode) {
- DiffNode syncNode = (DiffNode) element;
- int kind = syncNode.getKind();
- Image decoratedImage;
- decoratedImage = getCompareImage(base, kind);
- if (syncNode.hasChildren()) {
- // The reason we still overlay the compare image is to
- // ensure that the image width for all images shown in the viewer
- // are consistent.
- return propagateConflicts(decoratedImage, syncNode);
- } else {
- return decoratedImage;
- }
- }
- }
- return base;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- String base = workbenchLabelProvider.getText(element);
- if (element instanceof DiffNode) {
- if (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) {
- // if the folder is already conflicting then don't bother
- // propagating the conflict
- int kind = ((DiffNode) element).getKind();
- if (kind != SyncInfo.IN_SYNC) {
- String syncKindString = SyncInfo.kindToString(kind);
- return Policy.bind("TeamSubscriberSyncPage.labelWithSyncKind", base, syncKindString); //$NON-NLS-1$
- }
- }
- }
- return base;
- }
-
- protected Image getCompareImage(Image base, int kind) {
- switch (kind & SyncInfo.DIRECTION_MASK) {
- case SyncInfo.OUTGOING :
- kind = (kind & ~SyncInfo.OUTGOING) | SyncInfo.INCOMING;
- break;
- case SyncInfo.INCOMING :
- kind = (kind & ~SyncInfo.INCOMING) | SyncInfo.OUTGOING;
- break;
- }
- return compareConfig.getImage(base, kind);
- }
-
- private Image propagateConflicts(Image base, DiffNode element) {
- // if the folder is already conflicting then don't bother propagating
- // the conflict
- int kind = element.getKind();
- if ((kind & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) {
- if (hasDecendantConflicts(element)) {
- ImageDescriptor overlay = new OverlayIcon(base, new ImageDescriptor[]{TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR)}, new int[]{OverlayIcon.BOTTOM_LEFT}, new Point(base.getBounds().width, base.getBounds().height));
- if (fgImageCache == null) {
- fgImageCache = new HashMap(10);
- }
- Image conflictDecoratedImage = (Image) fgImageCache.get(overlay);
- if (conflictDecoratedImage == null) {
- conflictDecoratedImage = overlay.createImage();
- fgImageCache.put(overlay, conflictDecoratedImage);
- }
- return conflictDecoratedImage;
- }
- }
- return base;
- }
-
- /**
- * Return whether this diff node has descendant conflicts in the view in which it appears.
- * @return whether the node has descendant conflicts
- */
- private boolean hasDecendantConflicts(DiffNode node) {
- if(node instanceof SynchronizeModelElement) {
- return ((SynchronizeModelElement)node).getProperty(SynchronizeModelElement.PROPAGATED_CONFLICT_PROPERTY);
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- compareConfig.dispose();
- if (fgImageCache != null) {
- Iterator it = fgImageCache.values().iterator();
- while (it.hasNext()) {
- Image element = (Image) it.next();
- element.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java
deleted file mode 100644
index 7056320c6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui.synchronize.viewers;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * This class sorts <code>SyncInfoModelElement</code> instances.
- * It is not thread safe so it should not be reused between views.
- */
-public class SynchronizeModelElementSorter extends ResourceSorter {
-
- public SynchronizeModelElementSorter() {
- super(ResourceSorter.NAME);
- }
-
- /* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- IResource resource1 = getResource(o1);
- IResource resource2 = getResource(o2);
- int result;
- if (resource1 != null && resource2 != null) {
- result = super.compare(viewer, resource1, resource2);
- } else {
- result = super.compare(viewer, o1, o2);
- }
- return result;
- }
-
- protected IResource getResource(Object obj) {
- IResource[] resources = Utils.getResources(new Object[] {obj});
- return resources.length == 1 ? resources[0] : null;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelProvider.java
deleted file mode 100644
index 8633c6ecf..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelProvider.java
+++ /dev/null
@@ -1,426 +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.synchronize.viewers;
-
-import java.util.*;
-
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * This class is reponsible for creating and maintaining a presentation model of
- * {@link SynchronizeModelElement} elements that can be shown in a viewer. The model
- * is based on the synchronization information contained in the provided {@link SyncInfoSet}.
- * <p>
- * label updates (property propagation to parent nodes)
- * sync change listener (changes, additions, removals, reset)
- * batching busy updates
- * </p>
- *
- * @see HierarchicalModelProvider
- * @see CompressedFoldersModelProvider
- * @since 3.0
- */
-public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeListener {
-
- // Flasg to indicate if tree control should be updated while
- // building the model.
- private boolean refreshViewer;
-
- protected Map resourceMap = Collections.synchronizedMap(new HashMap());
-
- protected SynchronizeModelElement root;
-
- // The viewer this input is being displayed in
- private StructuredViewer viewer;
-
- private Set pendingLabelUpdates = new HashSet();
-
- private LabelUpdateJob labelUpdater = new LabelUpdateJob();
-
- private IPropertyChangeListener listener = new IPropertyChangeListener() {
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getProperty() == SynchronizeModelElement.BUSY_PROPERTY) {
- labelUpdater.add(event.getSource(), ((Boolean)event.getNewValue()).booleanValue());
- }
- }
- };
-
- class LabelUpdateJob extends UIJob {
- public static final int BATCH_WAIT_INCREMENT = 100;
- Set nodes = new HashSet();
- public LabelUpdateJob() {
- super(Policy.bind("HierarchicalModelProvider.0")); //$NON-NLS-1$
- setSystem(true);
- }
- public IStatus runInUIThread(IProgressMonitor monitor) {
- Object[] updates;
- synchronized(nodes) {
- updates = nodes.toArray(new Object[nodes.size()]);
- nodes.clear();
- }
- if (canUpdateViewer()) {
- StructuredViewer tree = getViewer();
- tree.update(updates, null);
- }
- schedule(BATCH_WAIT_INCREMENT);
- return Status.OK_STATUS;
- }
- public void add(Object node, boolean isBusy) {
- synchronized(nodes) {
- nodes.add(node);
- }
- if (isBusy) {
- schedule(BATCH_WAIT_INCREMENT);
- } else {
- // Wait when unbusying to give the events a chance to propogate through
- // the collector
- schedule(BATCH_WAIT_INCREMENT * 10);
- }
- }
- public boolean shouldRun() {
- return !nodes.isEmpty();
- }
- }
-
- private SyncInfoSet set;
-
- /**
- * Create an input based on the provide sync set. The input is not
- * initialized until <code>prepareInput</code> is called.
- * @param set
- * the sync set used as the basis for the model created by this
- * input.
- */
- public SynchronizeModelProvider(SyncInfoSet set) {
- this(new UnchangedResourceModelElement(null, ResourcesPlugin.getWorkspace().getRoot()), set);
- }
-
- public SynchronizeModelProvider(SynchronizeModelElement parent, SyncInfoSet set) {
- Assert.isNotNull(set);
- Assert.isNotNull(parent);
- this.root = parent;
- this.set = set;
- }
-
- public SyncInfoSet getSyncInfoSet() {
- return set;
- }
-
- /**
- * Return the <code>AbstractTreeViewer</code> asociated with this content
- * provider or <code>null</code> if the viewer is not of the proper type.
- * @return
- */
- public StructuredViewer getViewer() {
- return viewer;
- }
-
- public void setViewer(StructuredViewer viewer) {
- Assert.isTrue(viewer instanceof AbstractTreeViewer);
- this.viewer = (AbstractTreeViewer) viewer;
- }
-
- /**
- * Builds the viewer model based on the contents of the sync set.
- */
- public SynchronizeModelElement prepareInput(IProgressMonitor monitor) {
- // Connect to the sync set which will register us as a listener and give us a reset event
- // in a background thread
- getSyncInfoSet().connect(this, monitor);
- return getModelRoot();
- }
-
- /**
- * Dispose of the builder
- */
- public void dispose() {
- resourceMap.clear();
- getSyncInfoSet().removeSyncSetChangedListener(this);
- }
-
- /**
- * Returns the input created by this controller or <code>null</code> if
- * {@link #prepareInput(IProgressMonitor)} hasn't been called on this object yet.
- * @return
- */
- public SynchronizeModelElement getModelRoot() {
- return root;
- }
-
- public abstract ViewerSorter getViewerSorter();
-
- /**
- * Return the model object (i.e. an instance of <code>SyncInfoModelElement</code>
- * or one of its subclasses) for the given IResource.
- * @param resource
- * the resource
- * @return the <code>SyncInfoModelElement</code> for the given resource
- */
- protected SynchronizeModelElement getModelObject(IResource resource) {
- return (SynchronizeModelElement) resourceMap.get(resource);
- }
-
- public void syncInfoChanged(final ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- if (! (event instanceof ISyncInfoTreeChangeEvent)) {
- reset();
- } else {
- final Control ctrl = getViewer().getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (!ctrl.isDisposed()) {
- BusyIndicator.showWhile(ctrl.getDisplay(), new Runnable() {
- public void run() {
- handleChanges((ISyncInfoTreeChangeEvent)event);
- getModelRoot().fireChanges();
- }
- });
- }
- }
- });
- }
- }
- }
-
- /**
- * For each node create children based on the contents of
- * @param node
- * @return
- */
- protected abstract IDiffElement[] buildModelObjects(SynchronizeModelElement node);
-
- protected abstract void doAdd(SynchronizeModelElement parent, SynchronizeModelElement element);
-
- protected abstract void doRemove(SynchronizeModelElement element);
-
- protected void associateDiffNode(SynchronizeModelElement node) {
- IResource resource = node.getResource();
- if(resource != null) {
- resourceMap.put(resource, node);
- }
- }
-
- protected void unassociateDiffNode(IResource resource) {
- resourceMap.remove(resource);
- }
-
- /**
- * Handle the changes made to the viewer's <code>SyncInfoSet</code>.
- * This method delegates the changes to the three methods <code>handleResourceChanges(ISyncInfoSetChangeEvent)</code>,
- * <code>handleResourceRemovals(ISyncInfoSetChangeEvent)</code> and
- * <code>handleResourceAdditions(ISyncInfoSetChangeEvent)</code>.
- * @param event
- * the event containing the changed resourcses.
- */
- protected void handleChanges(ISyncInfoTreeChangeEvent event) {
- StructuredViewer viewer = getViewer();
- try {
- viewer.getControl().setRedraw(false);
- handleResourceChanges(event);
- handleResourceRemovals(event);
- handleResourceAdditions(event);
- firePendingLabelUpdates();
- } finally {
- viewer.getControl().setRedraw(true);
- }
- }
-
- /**
- * Update the viewer for the sync set additions in the provided event. This
- * method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>.
- * Subclasses may override.
- * @param event
- */
- protected abstract void handleResourceAdditions(ISyncInfoTreeChangeEvent event);
-
- /**
- * Update the viewer for the sync set changes in the provided event. This
- * method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>.
- * Subclasses may override.
- * @param event
- */
- protected abstract void handleResourceChanges(ISyncInfoTreeChangeEvent event);
-
- protected boolean isConflicting(SynchronizeModelElement diffNode) {
- return (diffNode.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING;
- }
-
- /**
- * Update the viewer for the sync set removals in the provided event. This
- * method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>.
- * Subclasses may override.
- * @param event
- */
- protected abstract void handleResourceRemovals(ISyncInfoTreeChangeEvent event);
-
- protected void reset() {
- try {
- refreshViewer = false;
-
- // Clear existing model, but keep the root node
- resourceMap.clear();
- clearModelObjects(getModelRoot());
- // remove all from tree viewer
- IDiffElement[] elements = getModelRoot().getChildren();
- for (int i = 0; i < elements.length; i++) {
- doRemove((SynchronizeModelElement)elements[i]);
- }
-
- // Rebuild the model
- associateDiffNode(getModelRoot());
- buildModelObjects(getModelRoot());
-
- // Notify listeners that model has changed
- getModelRoot().fireChanges();
- } finally {
- refreshViewer = true;
- }
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- StructuredViewer viewer = getViewer();
- if (viewer != null && !viewer.getControl().isDisposed()) {
- viewer.refresh();
- }
- }
- });
- }
-
- /**
- * Remove any traces of the resource and any of it's descendants in the
- * hiearchy defined by the content provider from the content provider and
- * the viewer it is associated with.
- * @param resource
- */
- protected void removeFromViewer(IResource resource) {
- SynchronizeModelElement node = getModelObject(resource);
- if (node == null) return;
- if (isConflicting(node)) {
- setParentConflict(node, false);
- }
- clearModelObjects(node);
- if (canUpdateViewer()) {
- doRemove(node);
- }
- }
-
- /**
- * Clear the model objects from the diff tree, cleaning up any cached state
- * (such as resource to model object map). This method recurses deeply on
- * the tree to allow the cleanup of any cached state for the children as
- * well.
- * @param node
- * the root node
- */
- protected void clearModelObjects(SynchronizeModelElement node) {
- IDiffElement[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- if (element instanceof SynchronizeModelElement) {
- clearModelObjects((SynchronizeModelElement) element);
- }
- }
- IResource resource = node.getResource();
- if (resource != null) {
- unassociateDiffNode(resource);
- }
- IDiffContainer parent = node.getParent();
- if (parent != null) {
- parent.removeToRoot(node);
- }
- }
-
- protected void addToViewer(SynchronizeModelElement node) {
- associateDiffNode(node);
- node.addPropertyChangeListener(listener);
- if (isConflicting(node)) {
- setParentConflict(node, true);
- }
- if (canUpdateViewer()) {
- doAdd((SynchronizeModelElement)node.getParent(), node);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- reset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // When errors occur we currently don't process them. It may be possible to decorate
- // elements in the model with errors, but currently we prefer to let ignore and except
- // another listener to display them.
- }
-
- /**
- * Update the label of the given diff node. Diff nodes
- * are accumulated and updated in a single call.
- * @param diffNode the diff node to be updated
- */
- protected void updateLabel(SynchronizeModelElement diffNode) {
- pendingLabelUpdates.add(diffNode);
- }
-
- /**
- * @param tree
- * @return
- */
- private boolean canUpdateViewer() {
- return refreshViewer && getViewer() != null;
- }
-
- /**
- * Forces the viewer to update the labels for parents whose children have
- * changed during this round of sync set changes.
- */
- protected void firePendingLabelUpdates() {
- try {
- if (canUpdateViewer()) {
- StructuredViewer tree = getViewer();
- tree.update(pendingLabelUpdates.toArray(new Object[pendingLabelUpdates.size()]), null);
- }
- } finally {
- pendingLabelUpdates.clear();
- }
- }
-
- protected void setParentConflict(SynchronizeModelElement diffNode, boolean value) {
- diffNode.setPropertyToRoot(SynchronizeModelElement.PROPAGATED_CONFLICT_PROPERTY, value);
- updateParentLabels(diffNode);
- }
-
- private void updateParentLabels(SynchronizeModelElement diffNode) {
- updateLabel(diffNode);
- while (diffNode.getParent() != null) {
- diffNode = (SynchronizeModelElement)diffNode.getParent();
- updateLabel(diffNode);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java
deleted file mode 100644
index 4e688fc6e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java
+++ /dev/null
@@ -1,356 +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.synchronize.viewers;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
-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.synchronize.actions.ExpandAllAction;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer;
-
-/**
- * A <code>TreeViewerAdvisor</code> that works with TreeViewers. Two default
- * tree viewers are provided that support navigation: <code>NavigableTreeViewer</code>
- * and <code>NavigableCheckboxTreeViewer</code>.
- * <p>
- * Note that this advisor can be used with any tree viewer. By default it provides an
- * expand all action, double click behavior on containers, and navigation support for
- * tree viewers.
- * </p><p>
- * By default this advisor supports hierarchical models and honour the compressed
- * folder Team preference for showing the sync set as compressed folders. Subclasses
- * can provide their own presentation models.
- * <p>
- * @since 3.0
- */
-public class TreeViewerAdvisor extends StructuredViewerAdvisor implements IPropertyChangeListener {
-
- /**
- * Interface used to implement navigation for tree viewers. This interface is used by
- * {@link TreeViewerAdvisor#navigate(TreeViewer, boolean, boolean, boolean) to open
- * selections and navigate.
- */
- public interface ITreeViewerAccessor {
-
- public void createChildren(TreeItem item);
- public void openSelection();
- }
-
- /**
- * A navigable checkboxec tree viewer that will work with the <code>navigate</code> method of
- * this advisor.
- */
- public static class NavigableCheckboxTreeViewer extends ContainerCheckedTreeViewer implements ITreeViewerAccessor {
- public NavigableCheckboxTreeViewer(Composite parent, int style) {
- super(parent, style);
- }
-
- public void createChildren(TreeItem item) {
- super.createChildren(item);
- }
-
- public void openSelection() {
- fireOpen(new OpenEvent(this, getSelection()));
- }
- }
-
- /**
- * A navigable tree viewer that will work with the <code>navigate</code> method of
- * this advisor.
- */
- public static class NavigableTreeViewer extends TreeViewer implements ITreeViewerAccessor {
- public NavigableTreeViewer(Composite parent, int style) {
- super(parent, style);
- }
-
- public void createChildren(TreeItem item) {
- super.createChildren(item);
- }
-
- public void openSelection() {
- fireOpen(new OpenEvent(this, getSelection()));
- }
- }
-
- private ExpandAllAction expandAllAction;
-
- /**
- * Create an advisor that will allow viewer contributions with the given <code>targetID</code>. This
- * advisor will provide a presentation model based on the given sync info set. Note that it's important
- * to call {@link #dispose()} when finished with an advisor.
- *
- * @param targetID the targetID defined in the viewer contributions in a plugin.xml file.
- * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user.
- */
- public TreeViewerAdvisor(String menuId, SyncInfoTree set) {
- super(menuId, set);
- TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(this);
- }
-
- /**
- * Create a tree viewer advisor that will provide a presentation model based on the given
- * sync info set. Note that it's important to call {@link #dispose()} when finished with
- * an advisor.
- *
- * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user.
- */
- public TreeViewerAdvisor(SyncInfoTree set) {
- this(null, set);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#dispose()
- */
- public void dispose() {
- TeamUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this);
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#navigate(boolean)
- */
- public boolean navigate(boolean next) {
- return TreeViewerAdvisor.navigate((TreeViewer)getViewer(), next, true, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (getViewer() != null && event.getProperty().equals(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) {
- try {
- prepareInput(null);
- setInput(getViewer());
- } catch (TeamException e) {
- TeamUIPlugin.log(e);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeViewer(org.eclipse.jface.viewers.StructuredViewer)
- */
- public boolean validateViewer(StructuredViewer viewer) {
- return viewer instanceof AbstractTreeViewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#fillContextMenu(org.eclipse.jface.viewers.StructuredViewer, org.eclipse.jface.action.IMenuManager)
- */
- protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) {
- manager.add(expandAllAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#getDiffNodeController()
- */
- protected SynchronizeModelProvider getModelProvider() {
- if(getShowCompressedFolders()) {
- return new CompressedFoldersModelProvider((SyncInfoTree)getSyncInfoSet());
- }
- return new HierarchicalModelProvider((SyncInfoTree)getSyncInfoSet());
- }
-
- /**
- * Handles a double-click event from the viewer. Expands or collapses a folder when double-clicked.
- *
- * @param viewer the viewer
- * @param event the double-click event
- */
- protected void handleDoubleClick(StructuredViewer viewer, DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
- AbstractTreeViewer treeViewer = (AbstractTreeViewer) getViewer();
- if (treeViewer.getExpandedState(element)) {
- treeViewer.collapseToLevel(element, AbstractTreeViewer.ALL_LEVELS);
- } else {
- TreeViewerAdvisor.navigate((TreeViewer)getViewer(), true /* next */, false /* no-open */, true /* only-expand */);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer)
- */
- protected void initializeActions(StructuredViewer viewer) {
- super.initializeActions(viewer);
- expandAllAction = new ExpandAllAction((AbstractTreeViewer) viewer);
- Utils.initAction(expandAllAction, "action.expandAll."); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeListeners(org.eclipse.jface.viewers.StructuredViewer)
- */
- protected void initializeListeners(StructuredViewer viewer) {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(getViewer(), event);
- }
- });
- }
-
- /**
- * Return the state of the compressed folder setting.
- *
- * @return the state of the compressed folder setting.
- */
- private boolean getShowCompressedFolders() {
- return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS);
- }
-
- private static TreeItem findNextPrev(TreeViewer viewer, TreeItem item, boolean next) {
- if (item == null || !(viewer instanceof ITreeViewerAccessor))
- return null;
- TreeItem children[] = null;
- ITreeViewerAccessor treeAccessor = (ITreeViewerAccessor) viewer;
- 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) {
- treeAccessor.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);
- treeAccessor.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 static void setSelection(TreeViewer viewer, TreeItem ti, boolean fireOpen, boolean expandOnly) {
- 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);
- if (expandOnly) {
- viewer.expandToLevel(data, 0);
- } else {
- viewer.setSelection(selection, true);
- ISelection currentSelection = viewer.getSelection();
- if (fireOpen && currentSelection != null && selection.equals(currentSelection)) {
- if (viewer instanceof ITreeViewerAccessor) {
- ((ITreeViewerAccessor) viewer).openSelection();
- }
- }
- }
- }
- }
- }
-
- /**
- * 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 not 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)
- */
- public static boolean navigate(TreeViewer viewer, boolean next, boolean fireOpen, boolean expandOnly) {
- Tree tree = viewer.getTree();
- if (tree == null)
- return false;
- 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) {
- setSelection(viewer, item, fireOpen, expandOnly); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- return false;
- }
- }
- }
- while (true) {
- item = findNextPrev(viewer, item, next);
- if (item == null)
- break;
- if (item.getItemCount() <= 0)
- break;
- }
- if (item != null) {
- setSelection(viewer, item, fireOpen, expandOnly); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- return false;
- }
- return true;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java
deleted file mode 100644
index a2b17e0d5..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.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.synchronize.viewers;
-
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * DiffNode that represents a resource that is in sync.
- */
-public class UnchangedResourceModelElement extends SynchronizeModelElement implements IAdaptable {
-
- private IResource resource;
-
- public UnchangedResourceModelElement(IDiffContainer parent, IResource resource) {
- super(parent);
- this.resource = resource;
- }
-
- /**
- * @return Returns the resource.
- */
- public IResource getResource() {
- return resource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
- public String getName() {
- return resource.getName();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html
deleted file mode 100644
index 6890ad44e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html
+++ /dev/null
@@ -1,82 +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>
-<p>
-Application programming interfaces for displaying synchronization
-states and variants.</p>
-<h2>Package Specification</h2>
-<p>This package contains classes that support displaying
-synchronization information described by SyncInfo. If you consider the
-synchronization model described by the classes in
-org.eclipse.team.core.synchronize as the physical representation of
-resource variants then the classes in this package allow you to control
-how the model is presented to the user. One key feature of these APIs
-is that they support managing dynamic models.<br>
-</p>
-<p>There is no specific support for the Synchronize View in this
-package. Instead, the classes here can be used to build a page that can
-be shown in the view, but they can also be used to show synchronization
-information in dialogs, wizards, and editors.<br>
-</p>
-<p>The central abstractions for presenting synchronization state are:<br>
-</p>
-<p>- SynchronizeModelProvider, SynchronizeModelElement: are the
-building blocks for
-describing the logical structure of a synchronization model.<br>
-- StructuredViewerAdvisor: are used to
-display the logical structure to the user and define the basics such as
-the SynchronizeModelProvider, label provider, and context menus.<br>
-- SyncInfoCompareInput: is used to show a comparison between a local
-resource and a variant in a compare editor.<br>
-- SyncInfoSetCompareInput: is used to showing a set of variants in a
-compare editor<br>
-</p>
-<p>Default implementations are provided and there are many levels of
-customizations available.<br>
-</p>
-<h2>Basic Example</h2>
-If you have a synchronization model described in a SyncInfoTree and
-would like to show it to the user in a simple resource hierarchical
-tree viewers you would:<br>
-<br>
-SyncInfoTree syncTree = getSyncTree();<br>
-DiffTreeViewerConfiguration viewerConfiguration = new
-DiffTreeViewerConfiguration(syncTree);<br>
-TreeViewer viewer = new TreeViewer(parent);<br>
-viewerConfiguration.initializeViewer(viewer);<br>
-...<br>
-viewerConfiguration.dispose();<br>
-<br>
-Some items of interest in the above example: (1) the viewer
-configuration is used to add behavior to different types of tree
-viewers and by default will build a hierarchical logical model of the
-synchronization info and, (2) the default label provider will show the
-nodes with resource decorations plus the standard diff change markers,
-(3) the default context menu action is expand all plus any object
-contributions.<br>
-<br>
-Another example, you would like to add additional label decorations,
-and actions defined as viewerContribution in your plugin.xml.<br>
-<br>
-SyncInfoTree syncTree = getSyncTree();<br>
-DiffTreeViewerConfiguration viewerConfiguration = new
-DiffTreeViewerConfiguration("org.eclipse.team.example.actions",
-syncTree) {<br>
-&nbsp;&nbsp;&nbsp; protected ILabelProvider getLabelProvider() {<br>
-&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return new
-SyncInfoLabelProvider.DecoratingColorLabelProvider(new
-SyncInfoLabelProvider(), new MyCustorDecorator());<br>
-&nbsp;&nbsp;&nbsp; }<br>
-}<br>
-TreeViewer viewer = new TreeViewer(parent);<br>
-viewerConfiguration.initializeViewer(viewer);<br>
-...<br>
-viewerConfiguration.dispose();<br>
-</body>
-</html>

Back to the top