From 74bbc478387089f120ad110aa30e4302427a17d0 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Wed, 5 Feb 2003 19:29:38 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'PR29944-decoratorPerformance'. Sprout from master 2003-02-05 19:29:35 UTC Michael Valenta '30985: NPE expanding HEAD in repository view' Delete: bundles/org.eclipse.compare/.classpath bundles/org.eclipse.compare/.cvsignore bundles/org.eclipse.compare/.project bundles/org.eclipse.compare/about.html bundles/org.eclipse.compare/build.properties bundles/org.eclipse.compare/buildnotes_compare.html bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/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/PatchCompareInput.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/PatchedResource.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/internal/previewAncestor.txt bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt 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/resolved.gif bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif bundles/org.eclipse.compare/icons/full/obj16/unresolved.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/plugin.properties bundles/org.eclipse.compare/plugin.xml bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/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/PatchCompareInput.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/PatchedResource.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/internal/previewAncestor.txt bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt 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/resolved.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/obj16/unresolved.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/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/doc/hglegal.htm bundles/org.eclipse.team.core/doc/ngibmcpy.gif bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html bundles/org.eclipse.team.core/doc/org_eclipse_team_core_fileTypes.html bundles/org.eclipse.team.core/doc/org_eclipse_team_core_ignore.html bundles/org.eclipse.team.core/doc/org_eclipse_team_core_projectSets.html bundles/org.eclipse.team.core/doc/org_eclipse_team_core_repository.html bundles/org.eclipse.team.core/plugin.properties bundles/org.eclipse.team.core/plugin.xml bundles/org.eclipse.team.core/schema/fileTypes.mxsd bundles/org.eclipse.team.core/schema/ignore.mxsd bundles/org.eclipse.team.core/schema/projectSets.mxsd bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/ILocalSyncElement.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteResource.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteSyncElement.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/LocalSyncElement.java bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties bundles/org.eclipse.team.cvs.ssh/.classpath bundles/org.eclipse.team.cvs.ssh/.cvsignore bundles/org.eclipse.team.cvs.ssh/.options bundles/org.eclipse.team.cvs.ssh/.project bundles/org.eclipse.team.cvs.ssh/about.html bundles/org.eclipse.team.cvs.ssh/build.properties bundles/org.eclipse.team.cvs.ssh/plugin.properties bundles/org.eclipse.team.cvs.ssh/plugin.xml bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties bundles/org.eclipse.team.ui/.classpath bundles/org.eclipse.team.ui/.cvsignore bundles/org.eclipse.team.ui/.project bundles/org.eclipse.team.ui/about.html bundles/org.eclipse.team.ui/build.properties bundles/org.eclipse.team.ui/doc/hglegal.htm bundles/org.eclipse.team.ui/doc/ngibmcpy.gif bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html 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/conflict_synch.gif bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif bundles/org.eclipse.team.ui/icons/full/dlcl16/site_element.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/conflict_synch.gif bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif bundles/org.eclipse.team.ui/icons/full/elcl16/site_element.gif bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif bundles/org.eclipse.team.ui/plugin.properties bundles/org.eclipse.team.ui/plugin.xml bundles/org.eclipse.team.ui/schema/configurationWizards.mxsd bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.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/TeamWizardPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java bundles/org.eclipse.team.ui/src/org/eclipse/team/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/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 examples/org.eclipse.team.examples.filesystem/.classpath examples/org.eclipse.team.examples.filesystem/.cvsignore examples/org.eclipse.team.examples.filesystem/.project examples/org.eclipse.team.examples.filesystem/about.html examples/org.eclipse.team.examples.filesystem/build.properties examples/org.eclipse.team.examples.filesystem/doc-html/hglegal.htm examples/org.eclipse.team.examples.filesystem/doc-html/ngibmcpy.gif examples/org.eclipse.team.examples.filesystem/doc-html/team_filesystem_ex.html examples/org.eclipse.team.examples.filesystem/icons/full/wizards/fsicon_wiz.gif examples/org.eclipse.team.examples.filesystem/icons/full/wizban/newconnect_wizban.gif examples/org.eclipse.team.examples.filesystem/plugin.properties examples/org.eclipse.team.examples.filesystem/plugin.xml examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemRemoteResource.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/Policy.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/StreamUtil.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/messages.properties examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemPropertiesPage.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/GetAction.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java tests/org.eclipse.team.tests.core/.classpath tests/org.eclipse.team.tests.core/.cvsignore tests/org.eclipse.team.tests.core/.project tests/org.eclipse.team.tests.core/about.html tests/org.eclipse.team.tests.core/build-tests.xml tests/org.eclipse.team.tests.core/build.properties tests/org.eclipse.team.tests.core/ftp.properties tests/org.eclipse.team.tests.core/plugin.xml tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTargetTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RemoteResourceTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTypeBic.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetTestSetup.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java tests/org.eclipse.team.tests.core/test.xml tests/org.eclipse.team.tests.core/webdav.properties tests/org.eclipse.team.tests.cvs.core/.classpath tests/org.eclipse.team.tests.cvs.core/.cvsignore tests/org.eclipse.team.tests.cvs.core/.project tests/org.eclipse.team.tests.cvs.core/about.html tests/org.eclipse.team.tests.cvs.core/benchmark/cvsui_benchmark.bat tests/org.eclipse.team.tests.cvs.core/benchmark/readme.txt tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_02_26.integration.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_03_19.integration.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_24.milestone5.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_25.integration.commandline.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_10.release2_0.commandline.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_11.release2_0.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20021127.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20030129.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/teamui_benchmark.bat tests/org.eclipse.team.tests.cvs.core/benchmark/vcm1.0/2002_02_26.integration.all.xml tests/org.eclipse.team.tests.cvs.core/benchmark/vcmui_benchmark.bat tests/org.eclipse.team.tests.cvs.core/build-tests.xml tests/org.eclipse.team.tests.cvs.core/build.properties tests/org.eclipse.team.tests.cvs.core/plugin.xml tests/org.eclipse.team.tests.cvs.core/readme.html tests/org.eclipse.team.tests.cvs.core/repository.properties tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkTiny.zip tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/macros/macro1 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project1/f1/file-in-p1.txt tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project2/file-p2.txt tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/sub/file-sub.txt tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/common/common.txt tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/linux/linux.txt tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/pc/pc.txt tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt tests/org.eclipse.team.tests.cvs.core/self-host.xml tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSClientException.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/ICVSClient.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/JUnitTestCase.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/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/ResourceSyncInfoTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/AllTestsProvider.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/LinkResourcesTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/WatchEditTest.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSUITestCase.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/DummyPromptCondition.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EclipseUITestHarnessApplication.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java tests/org.eclipse.team.tests.cvs.core/test.xml--- bundles/org.eclipse.compare/.classpath | 11 - bundles/org.eclipse.compare/.cvsignore | 1 - bundles/org.eclipse.compare/.project | 33 - bundles/org.eclipse.compare/about.html | 30 - bundles/org.eclipse.compare/build.properties | 8 - .../org.eclipse.compare/buildnotes_compare.html | 1193 -- .../org/eclipse/compare/BufferedContent.java | 122 - .../org/eclipse/compare/CompareConfiguration.java | 436 - .../org/eclipse/compare/CompareEditorInput.java | 815 -- .../compare/org/eclipse/compare/CompareUI.java | 267 - .../org/eclipse/compare/CompareViewerPane.java | 143 - .../compare/CompareViewerSwitchingPane.java | 370 - .../eclipse/compare/EditionSelectionDialog.java | 1123 -- .../compare/org/eclipse/compare/HistoryItem.java | 79 - .../eclipse/compare/IContentChangeListener.java | 24 - .../eclipse/compare/IContentChangeNotifier.java | 33 - .../org/eclipse/compare/IEditableContent.java | 68 - .../org/eclipse/compare/IModificationDate.java | 25 - .../eclipse/compare/IPropertyChangeNotifier.java | 35 - .../eclipse/compare/IStreamContentAccessor.java | 30 - .../compare/org/eclipse/compare/ITypedElement.java | 67 - .../org/eclipse/compare/IViewerCreator.java | 28 - .../org/eclipse/compare/NavigationAction.java | 70 - .../compare/org/eclipse/compare/ResourceNode.java | 190 - .../compare/org/eclipse/compare/Splitter.java | 134 - .../eclipse/compare/ZipFileStructureCreator.java | 314 - .../contentmergeviewer/ContentMergeViewer.java | 962 -- .../contentmergeviewer/DelayedProgressMonitor.java | 136 - .../compare/contentmergeviewer/IDocumentRange.java | 53 - .../IMergeViewerContentProvider.java | 149 - .../contentmergeviewer/ITokenComparator.java | 51 - .../contentmergeviewer/TextMergeViewer.java | 4042 ------ .../TextMergeViewerResources.properties | 91 - .../compare/contentmergeviewer/package.html | 45 - .../eclipse/compare/internal/AbstractViewer.java | 29 - .../compare/internal/AddFromHistoryAction.java | 135 - .../internal/AddFromHistoryAction.properties | 39 - .../compare/internal/AddFromHistoryDialog.java | 449 - .../compare/internal/BinaryCompareViewer.java | 119 - .../internal/BinaryCompareViewerCreator.java | 23 - .../BinaryCompareViewerResources.properties | 16 - .../eclipse/compare/internal/BufferedCanvas.java | 85 - .../compare/internal/BufferedResourceNode.java | 111 - .../compare/internal/ChangePropertyAction.java | 47 - .../org/eclipse/compare/internal/ColorEditor.java | 116 - .../eclipse/compare/internal/CompareAction.java | 38 - .../eclipse/compare/internal/CompareDialog.java | 110 - .../eclipse/compare/internal/CompareEditor.java | 168 - .../compare/internal/CompareEditorContributor.java | 87 - .../eclipse/compare/internal/CompareMessages.java | 26 - .../compare/internal/CompareMessages.properties | 52 - .../eclipse/compare/internal/CompareNavigator.java | 173 - .../compare/internal/ComparePreferencePage.java | 374 - .../eclipse/compare/internal/CompareUIPlugin.java | 859 -- .../compare/internal/CompareWithEditionAction.java | 13 - .../internal/CompareWithEditionAction.properties | 32 - .../org/eclipse/compare/internal/DiffImage.java | 72 - .../compare/internal/DocLineComparator.java | 185 - .../eclipse/compare/internal/DocumentManager.java | 59 - .../eclipse/compare/internal/EditionAction.java | 259 - .../eclipse/compare/internal/ExceptionHandler.java | 127 - .../org/eclipse/compare/internal/INavigatable.java | 15 - .../org/eclipse/compare/internal/IOpenable.java | 24 - .../org/eclipse/compare/internal/ISavable.java | 13 - .../internal/IStructureCreatorDescriptor.java | 27 - .../compare/internal/IViewerDescriptor.java | 35 - .../compare/internal/IgnoreWhiteSpaceAction.java | 20 - .../org/eclipse/compare/internal/ImageCanvas.java | 136 - .../eclipse/compare/internal/ImageMergeViewer.java | 134 - .../compare/internal/ImageMergeViewerCreator.java | 24 - .../internal/ImageMergeViewerResources.properties | 26 - .../compare/internal/ListContentProvider.java | 41 - .../org/eclipse/compare/internal/ListDialog.java | 83 - .../compare/internal/MergeSourceViewer.java | 387 - .../compare/internal/MergeViewerAction.java | 37 - .../internal/MergeViewerContentProvider.java | 156 - .../org/eclipse/compare/internal/NullViewer.java | 25 - .../compare/internal/OverlayPreferenceStore.java | 446 - .../compare/internal/ReplaceWithEditionAction.java | 13 - .../internal/ReplaceWithEditionAction.properties | 34 - .../internal/ReplaceWithPreviousEditionAction.java | 14 - .../eclipse/compare/internal/ResizableDialog.java | 136 - .../compare/internal/ResourceCompareInput.java | 285 - .../compare/internal/ShowPseudoConflicts.java | 20 - .../eclipse/compare/internal/SimpleTextViewer.java | 59 - .../eclipse/compare/internal/TabFolderLayout.java | 40 - .../compare/internal/TextMergeViewerCreator.java | 25 - .../compare/internal/TextViewerCreator.java | 26 - .../eclipse/compare/internal/TimeoutContext.java | 378 - .../eclipse/compare/internal/TokenComparator.java | 170 - .../org/eclipse/compare/internal/Utilities.java | 370 - .../eclipse/compare/internal/ViewerDescriptor.java | 58 - .../compare/internal/ViewerSwitchingCancelled.java | 7 - .../internal/patch/CompareWithPatchAction.java | 154 - .../org/eclipse/compare/internal/patch/Diff.java | 96 - .../org/eclipse/compare/internal/patch/Hunk.java | 126 - .../compare/internal/patch/InputPatchPage.java | 621 - .../eclipse/compare/internal/patch/LineReader.java | 126 - .../compare/internal/patch/PatchCompareInput.java | 186 - .../compare/internal/patch/PatchErrorDialog.java | 13 - .../compare/internal/patch/PatchMessages.java | 26 - .../internal/patch/PatchMessages.properties | 79 - .../compare/internal/patch/PatchWizard.java | 172 - .../compare/internal/patch/PatchedResource.java | 77 - .../eclipse/compare/internal/patch/Patcher.java | 1003 -- .../compare/internal/patch/PreviewPatchPage.java | 597 - .../eclipse/compare/internal/previewAncestor.txt | 10 - .../org/eclipse/compare/internal/previewLeft.txt | 10 - .../org/eclipse/compare/internal/previewRight.txt | 10 - .../compare/org/eclipse/compare/package.html | 99 - .../rangedifferencer/DifferencesIterator.java | 71 - .../compare/rangedifferencer/IRangeComparator.java | 54 - .../rangedifferencer/LinkedRangeDifference.java | 53 - .../compare/rangedifferencer/RangeDifference.java | 202 - .../compare/rangedifferencer/RangeDifferencer.java | 541 - .../eclipse/compare/rangedifferencer/package.html | 44 - .../structuremergeviewer/DiffContainer.java | 105 - .../compare/structuremergeviewer/DiffElement.java | 85 - .../compare/structuremergeviewer/DiffNode.java | 351 - .../structuremergeviewer/DiffTreeViewer.java | 707 -- .../DiffTreeViewerResources.properties | 44 - .../compare/structuremergeviewer/Differencer.java | 515 - .../structuremergeviewer/DocumentRangeNode.java | 351 - .../structuremergeviewer/ICompareInput.java | 136 - .../ICompareInputChangeListener.java | 32 - .../structuremergeviewer/IDiffContainer.java | 56 - .../compare/structuremergeviewer/IDiffElement.java | 55 - .../structuremergeviewer/IStructureComparator.java | 39 - .../structuremergeviewer/IStructureCreator.java | 109 - .../structuremergeviewer/StructureDiffViewer.java | 372 - .../compare/structuremergeviewer/package.html | 79 - .../icons/full/clcl16/ancestorpane_co.gif | Bin 154 -> 0 bytes .../icons/full/clcl16/copy_l_co.gif | Bin 166 -> 0 bytes .../icons/full/clcl16/copy_r_co.gif | Bin 169 -> 0 bytes .../icons/full/clcl16/copycont_l_co.gif | Bin 170 -> 0 bytes .../icons/full/clcl16/copycont_r_co.gif | Bin 174 -> 0 bytes .../icons/full/clcl16/next_nav.gif | Bin 105 -> 0 bytes .../icons/full/clcl16/prev_nav.gif | Bin 132 -> 0 bytes .../icons/full/clcl16/smartmode_co.gif | Bin 229 -> 0 bytes .../icons/full/clcl16/syncpane_co.gif | Bin 124 -> 0 bytes .../icons/full/clcl16/twowaycompare_co.gif | Bin 165 -> 0 bytes .../icons/full/ctool16/conflict_edit.gif | Bin 117 -> 0 bytes .../icons/full/ctool16/ignorews_edit.gif | Bin 119 -> 0 bytes .../icons/full/cview16/compare_view.gif | Bin 128 -> 0 bytes .../icons/full/dlcl16/ancestorpane_co.gif | Bin 129 -> 0 bytes .../icons/full/dlcl16/copy_l_co.gif | Bin 101 -> 0 bytes .../icons/full/dlcl16/copy_r_co.gif | Bin 100 -> 0 bytes .../icons/full/dlcl16/copycont_l_co.gif | Bin 101 -> 0 bytes .../icons/full/dlcl16/copycont_r_co.gif | Bin 101 -> 0 bytes .../icons/full/dlcl16/next_nav.gif | Bin 82 -> 0 bytes .../icons/full/dlcl16/prev_nav.gif | Bin 82 -> 0 bytes .../icons/full/dlcl16/smartmode_co.gif | Bin 99 -> 0 bytes .../icons/full/dlcl16/syncpane_co.gif | Bin 90 -> 0 bytes .../icons/full/dlcl16/twowaycompare_co.gif | Bin 97 -> 0 bytes .../icons/full/dtool16/conflict_edit.gif | Bin 85 -> 0 bytes .../icons/full/dtool16/ignorews_edit.gif | Bin 93 -> 0 bytes .../icons/full/elcl16/ancestorpane_co.gif | Bin 147 -> 0 bytes .../icons/full/elcl16/copy_l_co.gif | Bin 130 -> 0 bytes .../icons/full/elcl16/copy_r_co.gif | Bin 129 -> 0 bytes .../icons/full/elcl16/copycont_l_co.gif | Bin 133 -> 0 bytes .../icons/full/elcl16/copycont_r_co.gif | Bin 138 -> 0 bytes .../icons/full/elcl16/next_nav.gif | Bin 101 -> 0 bytes .../icons/full/elcl16/prev_nav.gif | Bin 102 -> 0 bytes .../icons/full/elcl16/smartmode_co.gif | Bin 133 -> 0 bytes .../icons/full/elcl16/syncpane_co.gif | Bin 121 -> 0 bytes .../icons/full/elcl16/twowaycompare_co.gif | Bin 125 -> 0 bytes .../icons/full/etool16/conflict_edit.gif | Bin 111 -> 0 bytes .../icons/full/etool16/ignorews_edit.gif | Bin 122 -> 0 bytes .../icons/full/eview16/compare_view.gif | Bin 129 -> 0 bytes .../icons/full/obj16/day_obj.gif | Bin 181 -> 0 bytes .../icons/full/obj16/resolved.gif | Bin 839 -> 0 bytes .../icons/full/obj16/resource_obj.gif | Bin 153 -> 0 bytes .../icons/full/obj16/unresolved.gif | Bin 833 -> 0 bytes .../icons/full/ovr16/add_ov.gif | Bin 95 -> 0 bytes .../icons/full/ovr16/chg_ov.gif | Bin 100 -> 0 bytes .../icons/full/ovr16/confadd_ov.gif | Bin 97 -> 0 bytes .../icons/full/ovr16/confchg_ov.gif | Bin 93 -> 0 bytes .../icons/full/ovr16/confdel_ov.gif | Bin 121 -> 0 bytes .../icons/full/ovr16/del_ov.gif | Bin 120 -> 0 bytes .../icons/full/ovr16/error_ov.gif | Bin 92 -> 0 bytes .../icons/full/ovr16/inadd_ov.gif | Bin 123 -> 0 bytes .../icons/full/ovr16/inchg_ov.gif | Bin 119 -> 0 bytes .../icons/full/ovr16/indel_ov.gif | Bin 119 -> 0 bytes .../icons/full/ovr16/outadd_ov.gif | Bin 124 -> 0 bytes .../icons/full/ovr16/outchg_ov.gif | Bin 120 -> 0 bytes .../icons/full/ovr16/outdel_ov.gif | Bin 122 -> 0 bytes .../icons/full/ovr16/r_inadd_ov.gif | Bin 124 -> 0 bytes .../icons/full/ovr16/r_inchg_ov.gif | Bin 117 -> 0 bytes .../icons/full/ovr16/r_indel_ov.gif | Bin 118 -> 0 bytes .../icons/full/ovr16/r_outadd_ov.gif | Bin 124 -> 0 bytes .../icons/full/ovr16/r_outchg_ov.gif | Bin 120 -> 0 bytes .../icons/full/ovr16/r_outdel_ov.gif | Bin 120 -> 0 bytes bundles/org.eclipse.compare/plugin.properties | 140 - bundles/org.eclipse.compare/plugin.xml | 211 - .../plugins/org.eclipse.compare/.classpath | 11 - .../plugins/org.eclipse.compare/.cvsignore | 1 - .../plugins/org.eclipse.compare/.project | 33 - .../plugins/org.eclipse.compare/about.html | 30 - .../plugins/org.eclipse.compare/build.properties | 8 - .../org.eclipse.compare/buildnotes_compare.html | 1193 -- .../org/eclipse/compare/BufferedContent.java | 122 - .../org/eclipse/compare/CompareConfiguration.java | 436 - .../org/eclipse/compare/CompareEditorInput.java | 815 -- .../compare/org/eclipse/compare/CompareUI.java | 267 - .../org/eclipse/compare/CompareViewerPane.java | 143 - .../compare/CompareViewerSwitchingPane.java | 370 - .../eclipse/compare/EditionSelectionDialog.java | 1123 -- .../compare/org/eclipse/compare/HistoryItem.java | 79 - .../eclipse/compare/IContentChangeListener.java | 24 - .../eclipse/compare/IContentChangeNotifier.java | 33 - .../org/eclipse/compare/IEditableContent.java | 68 - .../org/eclipse/compare/IModificationDate.java | 25 - .../eclipse/compare/IPropertyChangeNotifier.java | 35 - .../eclipse/compare/IStreamContentAccessor.java | 30 - .../compare/org/eclipse/compare/ITypedElement.java | 67 - .../org/eclipse/compare/IViewerCreator.java | 28 - .../org/eclipse/compare/NavigationAction.java | 70 - .../compare/org/eclipse/compare/ResourceNode.java | 190 - .../compare/org/eclipse/compare/Splitter.java | 134 - .../eclipse/compare/ZipFileStructureCreator.java | 314 - .../contentmergeviewer/ContentMergeViewer.java | 962 -- .../contentmergeviewer/DelayedProgressMonitor.java | 136 - .../compare/contentmergeviewer/IDocumentRange.java | 53 - .../IMergeViewerContentProvider.java | 149 - .../contentmergeviewer/ITokenComparator.java | 51 - .../contentmergeviewer/TextMergeViewer.java | 4042 ------ .../TextMergeViewerResources.properties | 91 - .../compare/contentmergeviewer/package.html | 45 - .../eclipse/compare/internal/AbstractViewer.java | 29 - .../compare/internal/AddFromHistoryAction.java | 135 - .../internal/AddFromHistoryAction.properties | 39 - .../compare/internal/AddFromHistoryDialog.java | 449 - .../compare/internal/BinaryCompareViewer.java | 119 - .../internal/BinaryCompareViewerCreator.java | 23 - .../BinaryCompareViewerResources.properties | 16 - .../eclipse/compare/internal/BufferedCanvas.java | 85 - .../compare/internal/BufferedResourceNode.java | 111 - .../compare/internal/ChangePropertyAction.java | 47 - .../org/eclipse/compare/internal/ColorEditor.java | 116 - .../eclipse/compare/internal/CompareAction.java | 38 - .../eclipse/compare/internal/CompareDialog.java | 110 - .../eclipse/compare/internal/CompareEditor.java | 168 - .../compare/internal/CompareEditorContributor.java | 87 - .../eclipse/compare/internal/CompareMessages.java | 26 - .../compare/internal/CompareMessages.properties | 52 - .../eclipse/compare/internal/CompareNavigator.java | 173 - .../compare/internal/ComparePreferencePage.java | 374 - .../eclipse/compare/internal/CompareUIPlugin.java | 859 -- .../compare/internal/CompareWithEditionAction.java | 13 - .../internal/CompareWithEditionAction.properties | 32 - .../org/eclipse/compare/internal/DiffImage.java | 72 - .../compare/internal/DocLineComparator.java | 185 - .../eclipse/compare/internal/DocumentManager.java | 59 - .../eclipse/compare/internal/EditionAction.java | 259 - .../eclipse/compare/internal/ExceptionHandler.java | 127 - .../org/eclipse/compare/internal/INavigatable.java | 15 - .../org/eclipse/compare/internal/IOpenable.java | 24 - .../org/eclipse/compare/internal/ISavable.java | 13 - .../internal/IStructureCreatorDescriptor.java | 27 - .../compare/internal/IViewerDescriptor.java | 35 - .../compare/internal/IgnoreWhiteSpaceAction.java | 20 - .../org/eclipse/compare/internal/ImageCanvas.java | 136 - .../eclipse/compare/internal/ImageMergeViewer.java | 134 - .../compare/internal/ImageMergeViewerCreator.java | 24 - .../internal/ImageMergeViewerResources.properties | 26 - .../compare/internal/ListContentProvider.java | 41 - .../org/eclipse/compare/internal/ListDialog.java | 83 - .../compare/internal/MergeSourceViewer.java | 387 - .../compare/internal/MergeViewerAction.java | 37 - .../internal/MergeViewerContentProvider.java | 156 - .../org/eclipse/compare/internal/NullViewer.java | 25 - .../compare/internal/OverlayPreferenceStore.java | 446 - .../compare/internal/ReplaceWithEditionAction.java | 13 - .../internal/ReplaceWithEditionAction.properties | 34 - .../internal/ReplaceWithPreviousEditionAction.java | 14 - .../eclipse/compare/internal/ResizableDialog.java | 136 - .../compare/internal/ResourceCompareInput.java | 285 - .../compare/internal/ShowPseudoConflicts.java | 20 - .../eclipse/compare/internal/SimpleTextViewer.java | 59 - .../eclipse/compare/internal/TabFolderLayout.java | 40 - .../compare/internal/TextMergeViewerCreator.java | 25 - .../compare/internal/TextViewerCreator.java | 26 - .../eclipse/compare/internal/TimeoutContext.java | 378 - .../eclipse/compare/internal/TokenComparator.java | 170 - .../org/eclipse/compare/internal/Utilities.java | 370 - .../eclipse/compare/internal/ViewerDescriptor.java | 58 - .../compare/internal/ViewerSwitchingCancelled.java | 7 - .../compare/internal/patch/Attic/LineReader.java | 126 - .../internal/patch/CompareWithPatchAction.java | 154 - .../org/eclipse/compare/internal/patch/Diff.java | 96 - .../org/eclipse/compare/internal/patch/Hunk.java | 126 - .../compare/internal/patch/InputPatchPage.java | 621 - .../eclipse/compare/internal/patch/LineReader.java | 126 - .../compare/internal/patch/PatchCompareInput.java | 186 - .../compare/internal/patch/PatchErrorDialog.java | 13 - .../compare/internal/patch/PatchMessages.java | 26 - .../internal/patch/PatchMessages.properties | 79 - .../compare/internal/patch/PatchWizard.java | 172 - .../compare/internal/patch/PatchedResource.java | 77 - .../eclipse/compare/internal/patch/Patcher.java | 1003 -- .../compare/internal/patch/PreviewPatchPage.java | 597 - .../eclipse/compare/internal/previewAncestor.txt | 10 - .../org/eclipse/compare/internal/previewLeft.txt | 10 - .../org/eclipse/compare/internal/previewRight.txt | 10 - .../compare/org/eclipse/compare/package.html | 99 - .../rangedifferencer/DifferencesIterator.java | 71 - .../compare/rangedifferencer/IRangeComparator.java | 54 - .../rangedifferencer/LinkedRangeDifference.java | 53 - .../compare/rangedifferencer/RangeDifference.java | 202 - .../compare/rangedifferencer/RangeDifferencer.java | 541 - .../eclipse/compare/rangedifferencer/package.html | 44 - .../structuremergeviewer/DiffContainer.java | 105 - .../compare/structuremergeviewer/DiffElement.java | 85 - .../compare/structuremergeviewer/DiffNode.java | 351 - .../structuremergeviewer/DiffTreeViewer.java | 707 -- .../DiffTreeViewerResources.properties | 44 - .../compare/structuremergeviewer/Differencer.java | 515 - .../structuremergeviewer/DocumentRangeNode.java | 351 - .../structuremergeviewer/ICompareInput.java | 136 - .../ICompareInputChangeListener.java | 32 - .../structuremergeviewer/IDiffContainer.java | 56 - .../compare/structuremergeviewer/IDiffElement.java | 55 - .../structuremergeviewer/IStructureComparator.java | 39 - .../structuremergeviewer/IStructureCreator.java | 109 - .../structuremergeviewer/StructureDiffViewer.java | 372 - .../compare/structuremergeviewer/package.html | 79 - .../icons/full/clcl16/ancestorpane_co.gif | Bin 154 -> 0 bytes .../icons/full/clcl16/copy_l_co.gif | Bin 166 -> 0 bytes .../icons/full/clcl16/copy_r_co.gif | Bin 169 -> 0 bytes .../icons/full/clcl16/copycont_l_co.gif | Bin 170 -> 0 bytes .../icons/full/clcl16/copycont_r_co.gif | Bin 174 -> 0 bytes .../icons/full/clcl16/next_nav.gif | Bin 105 -> 0 bytes .../icons/full/clcl16/prev_nav.gif | Bin 132 -> 0 bytes .../icons/full/clcl16/smartmode_co.gif | Bin 229 -> 0 bytes .../icons/full/clcl16/syncpane_co.gif | Bin 124 -> 0 bytes .../icons/full/clcl16/twowaycompare_co.gif | Bin 165 -> 0 bytes .../icons/full/ctool16/conflict_edit.gif | Bin 117 -> 0 bytes .../icons/full/ctool16/ignorews_edit.gif | Bin 119 -> 0 bytes .../icons/full/cview16/compare_view.gif | Bin 128 -> 0 bytes .../icons/full/dlcl16/ancestorpane_co.gif | Bin 129 -> 0 bytes .../icons/full/dlcl16/copy_l_co.gif | Bin 101 -> 0 bytes .../icons/full/dlcl16/copy_r_co.gif | Bin 100 -> 0 bytes .../icons/full/dlcl16/copycont_l_co.gif | Bin 101 -> 0 bytes .../icons/full/dlcl16/copycont_r_co.gif | Bin 101 -> 0 bytes .../icons/full/dlcl16/next_nav.gif | Bin 82 -> 0 bytes .../icons/full/dlcl16/prev_nav.gif | Bin 82 -> 0 bytes .../icons/full/dlcl16/smartmode_co.gif | Bin 99 -> 0 bytes .../icons/full/dlcl16/syncpane_co.gif | Bin 90 -> 0 bytes .../icons/full/dlcl16/twowaycompare_co.gif | Bin 97 -> 0 bytes .../icons/full/dtool16/conflict_edit.gif | Bin 85 -> 0 bytes .../icons/full/dtool16/ignorews_edit.gif | Bin 93 -> 0 bytes .../icons/full/elcl16/ancestorpane_co.gif | Bin 147 -> 0 bytes .../icons/full/elcl16/copy_l_co.gif | Bin 130 -> 0 bytes .../icons/full/elcl16/copy_r_co.gif | Bin 129 -> 0 bytes .../icons/full/elcl16/copycont_l_co.gif | Bin 133 -> 0 bytes .../icons/full/elcl16/copycont_r_co.gif | Bin 138 -> 0 bytes .../icons/full/elcl16/next_nav.gif | Bin 101 -> 0 bytes .../icons/full/elcl16/prev_nav.gif | Bin 102 -> 0 bytes .../icons/full/elcl16/smartmode_co.gif | Bin 133 -> 0 bytes .../icons/full/elcl16/syncpane_co.gif | Bin 121 -> 0 bytes .../icons/full/elcl16/twowaycompare_co.gif | Bin 125 -> 0 bytes .../icons/full/etool16/conflict_edit.gif | Bin 111 -> 0 bytes .../icons/full/etool16/ignorews_edit.gif | Bin 122 -> 0 bytes .../icons/full/eview16/compare_view.gif | Bin 129 -> 0 bytes .../icons/full/obj16/day_obj.gif | Bin 181 -> 0 bytes .../icons/full/obj16/resolved.gif | Bin 839 -> 0 bytes .../icons/full/obj16/resource_obj.gif | Bin 153 -> 0 bytes .../icons/full/obj16/unresolved.gif | Bin 833 -> 0 bytes .../icons/full/ovr16/add_ov.gif | Bin 95 -> 0 bytes .../icons/full/ovr16/chg_ov.gif | Bin 100 -> 0 bytes .../icons/full/ovr16/confadd_ov.gif | Bin 97 -> 0 bytes .../icons/full/ovr16/confchg_ov.gif | Bin 93 -> 0 bytes .../icons/full/ovr16/confdel_ov.gif | Bin 121 -> 0 bytes .../icons/full/ovr16/del_ov.gif | Bin 120 -> 0 bytes .../icons/full/ovr16/error_ov.gif | Bin 92 -> 0 bytes .../icons/full/ovr16/inadd_ov.gif | Bin 123 -> 0 bytes .../icons/full/ovr16/inchg_ov.gif | Bin 119 -> 0 bytes .../icons/full/ovr16/indel_ov.gif | Bin 119 -> 0 bytes .../icons/full/ovr16/outadd_ov.gif | Bin 124 -> 0 bytes .../icons/full/ovr16/outchg_ov.gif | Bin 120 -> 0 bytes .../icons/full/ovr16/outdel_ov.gif | Bin 122 -> 0 bytes .../icons/full/ovr16/r_inadd_ov.gif | Bin 124 -> 0 bytes .../icons/full/ovr16/r_inchg_ov.gif | Bin 117 -> 0 bytes .../icons/full/ovr16/r_indel_ov.gif | Bin 118 -> 0 bytes .../icons/full/ovr16/r_outadd_ov.gif | Bin 124 -> 0 bytes .../icons/full/ovr16/r_outchg_ov.gif | Bin 120 -> 0 bytes .../icons/full/ovr16/r_outdel_ov.gif | Bin 120 -> 0 bytes .../plugins/org.eclipse.compare/plugin.properties | 140 - .../plugins/org.eclipse.compare/plugin.xml | 211 - .../schema/contentMergeViewers.exsd | 132 - .../org.eclipse.compare/schema/contentViewers.exsd | 142 - .../schema/structureCreators.exsd | 134 - .../schema/structureMergeViewers.exsd | 138 - .../org.eclipse.compare/scripts/exportplugin.xml | 31 - .../schema/contentMergeViewers.exsd | 132 - .../org.eclipse.compare/schema/contentViewers.exsd | 142 - .../schema/structureCreators.exsd | 134 - .../schema/structureMergeViewers.exsd | 138 - .../org.eclipse.compare/scripts/exportplugin.xml | 31 - bundles/org.eclipse.team.core/.classpath | 9 - bundles/org.eclipse.team.core/.cvsignore | 1 - bundles/org.eclipse.team.core/.options | 4 - bundles/org.eclipse.team.core/.project | 20 - bundles/org.eclipse.team.core/about.html | 30 - bundles/org.eclipse.team.core/build.properties | 4 - bundles/org.eclipse.team.core/buildnotes_team.html | 531 - bundles/org.eclipse.team.core/doc/hglegal.htm | 14 - bundles/org.eclipse.team.core/doc/ngibmcpy.gif | Bin 1045 -> 0 bytes .../doc/org_eclipse_team_core.html | 28 - .../doc/org_eclipse_team_core_fileTypes.html | 45 - .../doc/org_eclipse_team_core_ignore.html | 43 - .../doc/org_eclipse_team_core_projectSets.html | 45 - .../doc/org_eclipse_team_core_repository.html | 45 - bundles/org.eclipse.team.core/plugin.properties | 7 - bundles/org.eclipse.team.core/plugin.xml | 68 - .../org.eclipse.team.core/schema/fileTypes.mxsd | 108 - bundles/org.eclipse.team.core/schema/ignore.mxsd | 107 - .../org.eclipse.team.core/schema/projectSets.mxsd | 115 - .../team/core/DefaultRepositoryProviderType.java | 8 - .../src/org/eclipse/team/core/IFileTypeInfo.java | 39 - .../src/org/eclipse/team/core/IIgnoreInfo.java | 40 - .../eclipse/team/core/IProjectSetSerializer.java | 65 - .../eclipse/team/core/ProjectSetCapability.java | 64 - .../org/eclipse/team/core/RepositoryProvider.java | 604 - .../eclipse/team/core/RepositoryProviderType.java | 108 - .../src/org/eclipse/team/core/Team.java | 615 - .../src/org/eclipse/team/core/TeamException.java | 91 - .../src/org/eclipse/team/core/package.html | 20 - .../eclipse/team/core/sync/ILocalSyncElement.java | 201 - .../eclipse/team/core/sync/IRemoteResource.java | 67 - .../eclipse/team/core/sync/IRemoteSyncElement.java | 48 - .../eclipse/team/core/sync/LocalSyncElement.java | 115 - .../eclipse/team/core/sync/RemoteSyncElement.java | 440 - .../src/org/eclipse/team/internal/core/Assert.java | 100 - .../core/DefaultFileModificationValidator.java | 61 - .../team/internal/core/DefaultMoveDeleteHook.java | 95 - .../core/FileModificationValidatorManager.java | 100 - .../internal/core/InfiniteSubProgressMonitor.java | 83 - .../team/internal/core/MoveDeleteManager.java | 110 - .../team/internal/core/NullSubProgressMonitor.java | 65 - .../src/org/eclipse/team/internal/core/Policy.java | 107 - .../eclipse/team/internal/core/StringMatcher.java | 389 - .../team/internal/core/TeamHookDispatcher.java | 60 - .../org/eclipse/team/internal/core/TeamPlugin.java | 115 - .../eclipse/team/internal/core/messages.properties | 90 - .../core/simpleAccess/SimpleAccessOperations.java | 267 - .../internal/core/streams/CRLFtoLFInputStream.java | 155 - .../internal/core/streams/LFtoCRLFInputStream.java | 146 - .../internal/core/streams/PollingInputStream.java | 163 - .../internal/core/streams/PollingOutputStream.java | 162 - .../core/streams/ProgressMonitorInputStream.java | 139 - .../core/streams/SizeConstrainedInputStream.java | 138 - .../internal/core/streams/TimeoutInputStream.java | 277 - .../internal/core/streams/TimeoutOutputStream.java | 280 - .../internal/core/target/AuthenticatedSite.java | 81 - .../BaseIdentifierNotInitializedException.java | 31 - .../core/target/IRemoteTargetResource.java | 120 - .../team/internal/core/target/ISiteFactory.java | 42 - .../team/internal/core/target/ISiteListener.java | 16 - .../team/internal/core/target/ITargetRunnable.java | 18 - .../internal/core/target/ITeamStatusConstants.java | 79 - .../team/internal/core/target/LocationMapping.java | 98 - .../core/target/RemoteTargetSyncElement.java | 201 - .../team/internal/core/target/ResourceState.java | 826 -- .../eclipse/team/internal/core/target/Site.java | 145 - .../core/target/SynchronizedTargetProvider.java | 228 - .../team/internal/core/target/TargetManager.java | 274 - .../team/internal/core/target/TargetProvider.java | 218 - .../eclipse/team/internal/core/target/UrlUtil.java | 81 - .../team/internal/core/target/messages.properties | 11 - bundles/org.eclipse.team.cvs.ssh/.classpath | 10 - bundles/org.eclipse.team.cvs.ssh/.cvsignore | 1 - bundles/org.eclipse.team.cvs.ssh/.options | 7 - bundles/org.eclipse.team.cvs.ssh/.project | 21 - bundles/org.eclipse.team.cvs.ssh/about.html | 92 - bundles/org.eclipse.team.cvs.ssh/build.properties | 4 - bundles/org.eclipse.team.cvs.ssh/plugin.properties | 2 - bundles/org.eclipse.team.cvs.ssh/plugin.xml | 31 - .../eclipse/team/internal/ccvs/ssh/Blowfish.java | 1214 -- .../org/eclipse/team/internal/ccvs/ssh/Cipher.java | 19 - .../org/eclipse/team/internal/ccvs/ssh/Client.java | 721 -- .../team/internal/ccvs/ssh/ClientPacket.java | 47 - .../eclipse/team/internal/ccvs/ssh/KnownHosts.java | 148 - .../org/eclipse/team/internal/ccvs/ssh/Misc.java | 465 - .../org/eclipse/team/internal/ccvs/ssh/Packet.java | 14 - .../org/eclipse/team/internal/ccvs/ssh/Policy.java | 70 - .../eclipse/team/internal/ccvs/ssh/SSHMethod.java | 28 - .../eclipse/team/internal/ccvs/ssh/SSHPlugin.java | 1 - .../internal/ccvs/ssh/SSHServerConnection.java | 80 - .../team/internal/ccvs/ssh/ServerPacket.java | 158 - .../team/internal/ccvs/ssh/messages.properties | 30 - bundles/org.eclipse.team.ui/.classpath | 13 - bundles/org.eclipse.team.ui/.cvsignore | 1 - bundles/org.eclipse.team.ui/.project | 24 - bundles/org.eclipse.team.ui/about.html | 30 - bundles/org.eclipse.team.ui/build.properties | 4 - bundles/org.eclipse.team.ui/doc/hglegal.htm | 14 - bundles/org.eclipse.team.ui/doc/ngibmcpy.gif | Bin 1045 -> 0 bytes .../doc/org_eclipse_team_ui.html | 24 - .../org_eclipse_team_ui_configurationWizards.html | 61 - .../icons/full/clcl16/catchup_rls.gif | Bin 145 -> 0 bytes .../icons/full/clcl16/catchuprelease_rls.gif | Bin 184 -> 0 bytes .../icons/full/clcl16/conflict_synch.gif | Bin 117 -> 0 bytes .../icons/full/clcl16/contents.gif | Bin 229 -> 0 bytes .../icons/full/clcl16/ignorews_edit.gif | Bin 119 -> 0 bytes .../icons/full/clcl16/incom_synch.gif | Bin 117 -> 0 bytes .../icons/full/clcl16/outgo_synch.gif | Bin 120 -> 0 bytes .../icons/full/clcl16/refresh.gif | Bin 182 -> 0 bytes .../icons/full/clcl16/release_rls.gif | Bin 149 -> 0 bytes .../icons/full/clcl16/site_element.gif | Bin 147 -> 0 bytes .../icons/full/cview16/synch_synch.gif | Bin 176 -> 0 bytes .../icons/full/dlcl16/catchup_rls.gif | Bin 145 -> 0 bytes .../icons/full/dlcl16/catchuprelease_rls.gif | Bin 184 -> 0 bytes .../icons/full/dlcl16/conflict_synch.gif | Bin 84 -> 0 bytes .../icons/full/dlcl16/contents.gif | Bin 229 -> 0 bytes .../icons/full/dlcl16/ignorews_edit.gif | Bin 119 -> 0 bytes .../icons/full/dlcl16/incom_synch.gif | Bin 117 -> 0 bytes .../icons/full/dlcl16/outgo_synch.gif | Bin 120 -> 0 bytes .../icons/full/dlcl16/refresh.gif | Bin 104 -> 0 bytes .../icons/full/dlcl16/release_rls.gif | Bin 149 -> 0 bytes .../icons/full/dlcl16/site_element.gif | Bin 147 -> 0 bytes .../icons/full/elcl16/catchup_rls.gif | Bin 145 -> 0 bytes .../icons/full/elcl16/catchuprelease_rls.gif | Bin 184 -> 0 bytes .../icons/full/elcl16/conflict_synch.gif | Bin 111 -> 0 bytes .../icons/full/elcl16/contents.gif | Bin 229 -> 0 bytes .../icons/full/elcl16/ignorews_edit.gif | Bin 119 -> 0 bytes .../icons/full/elcl16/incom_synch.gif | Bin 116 -> 0 bytes .../icons/full/elcl16/outgo_synch.gif | Bin 143 -> 0 bytes .../icons/full/elcl16/refresh.gif | Bin 144 -> 0 bytes .../icons/full/elcl16/release_rls.gif | Bin 149 -> 0 bytes .../icons/full/elcl16/site_element.gif | Bin 147 -> 0 bytes .../icons/full/obj/export_projectset.gif | Bin 231 -> 0 bytes .../icons/full/obj/import_projectset.gif | Bin 230 -> 0 bytes .../icons/full/obj/share_project.gif | Bin 164 -> 0 bytes .../icons/full/ovr/checkedout_ov.gif | Bin 106 -> 0 bytes .../icons/full/ovr/dirty_ov.gif | Bin 75 -> 0 bytes .../icons/full/ovr/version_controlled.gif | Bin 80 -> 0 bytes .../icons/full/wizban/export_projectset_wizban.gif | Bin 2528 -> 0 bytes .../icons/full/wizban/import_projectset_wizban.gif | Bin 2711 -> 0 bytes .../icons/full/wizban/share_wizban.gif | Bin 2877 -> 0 bytes bundles/org.eclipse.team.ui/plugin.properties | 40 - bundles/org.eclipse.team.ui/plugin.xml | 248 - .../schema/configurationWizards.mxsd | 141 - .../internal/ui/ConfigurationWizardElement.java | 136 - .../team/internal/ui/ConfigurationWizardNode.java | 65 - .../team/internal/ui/ConfigureProjectWizard.java | 220 - .../ui/ConfigureProjectWizardMainPage.java | 179 - .../eclipse/team/internal/ui/DetailsDialog.java | 257 - .../internal/ui/DetailsDialogWithProjects.java | 115 - .../team/internal/ui/ExportProjectSetMainPage.java | 198 - .../eclipse/team/internal/ui/IHelpContextIds.java | 48 - .../eclipse/team/internal/ui/IPromptCondition.java | 31 - .../team/internal/ui/IgnorePreferencePage.java | 3 - .../team/internal/ui/ImportProjectSetMainPage.java | 211 - .../team/internal/ui/NatureToPropertyAction.java | 83 - .../src/org/eclipse/team/internal/ui/Policy.java | 132 - .../team/internal/ui/ProjectSetContentHandler.java | 87 - .../team/internal/ui/ProjectSetExportWizard.java | 200 - .../team/internal/ui/ProjectSetImportWizard.java | 156 - .../eclipse/team/internal/ui/PromptingDialog.java | 111 - .../team/internal/ui/TeamPreferencePage.java | 120 - .../org/eclipse/team/internal/ui/TeamUIPlugin.java | 251 - .../eclipse/team/internal/ui/TeamWizardPage.java | 107 - .../team/internal/ui/TextPreferencePage.java | 1 - .../org/eclipse/team/internal/ui/UIConstants.java | 73 - .../ui/actions/ConfigureProjectAction.java | 53 - .../ui/actions/DeconfigureProjectAction.java | 46 - .../team/internal/ui/actions/TeamAction.java | 388 - .../eclipse/team/internal/ui/messages.properties | 278 - .../internal/ui/sync/CatchupReleaseViewer.java | 723 -- .../internal/ui/sync/ChangedTeamContainer.java | 74 - .../eclipse/team/internal/ui/sync/ITeamNode.java | 44 - .../team/internal/ui/sync/MergeResource.java | 160 - .../team/internal/ui/sync/SyncCompareInput.java | 470 - .../org/eclipse/team/internal/ui/sync/SyncSet.java | 282 - .../eclipse/team/internal/ui/sync/SyncView.java | 454 - .../eclipse/team/internal/ui/sync/TeamFile.java | 378 - .../internal/ui/sync/TypedBufferedContent.java | 71 - .../internal/ui/sync/UnchangedTeamContainer.java | 72 - .../AuthenticatedTargetSitePropertiesPage.java | 104 - .../internal/ui/target/ConfigureTargetWizard.java | 400 - .../internal/ui/target/CreateNewFolderAction.java | 147 - .../team/internal/ui/target/DiscardSiteAction.java | 190 - .../ui/target/ExportTargetSiteMainPage.java | 194 - .../eclipse/team/internal/ui/target/GetAction.java | 173 - .../team/internal/ui/target/GetAsAction.java | 198 - .../internal/ui/target/GetAsProjectAction.java | 161 - .../team/internal/ui/target/GetSyncAction.java | 149 - .../ui/target/ImportTargetSiteMainPage.java | 137 - .../internal/ui/target/MappingSelectionPage.java | 195 - .../target/ProjectTargetMappingPropertiesPage.java | 115 - .../eclipse/team/internal/ui/target/PutAction.java | 72 - .../team/internal/ui/target/PutSyncAction.java | 149 - .../internal/ui/target/RemoteResourceElement.java | 181 - .../team/internal/ui/target/SiteElement.java | 92 - .../team/internal/ui/target/SiteExplorerView.java | 562 - .../ui/target/SiteExplorerViewLabelProvider.java | 54 - .../ui/target/SiteLazyContentProvider.java | 25 - .../team/internal/ui/target/SiteRootsElement.java | 68 - .../team/internal/ui/target/SiteSelectionPage.java | 187 - .../team/internal/ui/target/SiteViewSorter.java | 40 - .../team/internal/ui/target/SyncAction.java | 45 - .../team/internal/ui/target/TargetAction.java | 102 - .../ui/target/TargetCatchupReleaseViewer.java | 61 - .../internal/ui/target/TargetProjectAction.java | 59 - .../ui/target/TargetSiteContentHandler.java | 79 - .../internal/ui/target/TargetSiteExportWizard.java | 181 - .../internal/ui/target/TargetSiteImportWizard.java | 148 - .../team/internal/ui/target/TargetSyncAction.java | 235 - .../internal/ui/target/TargetSyncCompareInput.java | 100 - .../team/internal/ui/target/TargetWizardPage.java | 193 - .../team/internal/ui/target/UploadAction.java | 112 - .../org/eclipse/team/ui/IConfigurationWizard.java | 30 - .../src/org/eclipse/team/ui/ISharedImages.java | 20 - .../src/org/eclipse/team/ui/TeamImages.java | 131 - .../src/org/eclipse/team/ui/TeamUI.java | 40 - .../src/org/eclipse/team/ui/package.html | 16 - .../.classpath | 13 - .../.cvsignore | 1 - .../org.eclipse.team.examples.filesystem/.project | 24 - .../about.html | 30 - .../build.properties | 4 - .../doc-html/hglegal.htm | 14 - .../doc-html/ngibmcpy.gif | Bin 1045 -> 0 bytes .../doc-html/team_filesystem_ex.html | 35 - .../icons/full/wizards/fsicon_wiz.gif | Bin 173 -> 0 bytes .../icons/full/wizban/newconnect_wizban.gif | Bin 2615 -> 0 bytes .../plugin.properties | 18 - .../plugin.xml | 116 - .../filesystem/FileModificationValidator.java | 88 - .../team/examples/filesystem/FileSystemPlugin.java | 111 - .../examples/filesystem/FileSystemProvider.java | 166 - .../filesystem/FileSystemRemoteResource.java | 159 - .../FileSystemSimpleAccessOperations.java | 310 - .../eclipse/team/examples/filesystem/Policy.java | 93 - .../team/examples/filesystem/StreamUtil.java | 58 - .../team/examples/filesystem/messages.properties | 28 - .../filesystem/ui/ConfigurationWizard.java | 88 - .../examples/filesystem/ui/DisconnectAction.java | 46 - .../examples/filesystem/ui/FileSystemAction.java | 65 - .../examples/filesystem/ui/FileSystemMainPage.java | 301 - .../filesystem/ui/FileSystemPropertiesPage.java | 82 - .../team/examples/filesystem/ui/GetAction.java | 54 - .../team/examples/filesystem/ui/PutAction.java | 57 - .../team/examples/filesystem/ui/ReplaceAction.java | 77 - tests/org.eclipse.team.tests.core/.classpath | 16 - tests/org.eclipse.team.tests.core/.cvsignore | 1 - tests/org.eclipse.team.tests.core/.project | 38 - tests/org.eclipse.team.tests.core/about.html | 30 - tests/org.eclipse.team.tests.core/build-tests.xml | 42 - tests/org.eclipse.team.tests.core/build.properties | 2 - tests/org.eclipse.team.tests.core/ftp.properties | 7 - tests/org.eclipse.team.tests.core/plugin.xml | 104 - .../eclipse/team/tests/core/AllTargetTests.java | 41 - .../org/eclipse/team/tests/core/AllTeamTests.java | 44 - .../team/tests/core/RemoteResourceTests.java | 100 - .../team/tests/core/RepositoryProviderBic.java | 64 - .../team/tests/core/RepositoryProviderNaish.java | 61 - .../tests/core/RepositoryProviderOtherSport.java | 37 - .../team/tests/core/RepositoryProviderTests.java | 378 - .../team/tests/core/RepositoryProviderTypeBic.java | 53 - .../tests/core/RepositoryProviderWithLinking.java | 57 - .../org/eclipse/team/tests/core/StreamTests.java | 87 - .../eclipse/team/tests/core/SyncElementTest.java | 707 -- .../team/tests/core/TargetProviderTests.java | 237 - .../eclipse/team/tests/core/TargetTestSetup.java | 108 - .../src/org/eclipse/team/tests/core/TeamTest.java | 302 - tests/org.eclipse.team.tests.core/test.xml | 80 - .../org.eclipse.team.tests.core/webdav.properties | 7 - tests/org.eclipse.team.tests.cvs.core/.classpath | 21 - tests/org.eclipse.team.tests.cvs.core/.cvsignore | 1 - tests/org.eclipse.team.tests.cvs.core/.project | 32 - tests/org.eclipse.team.tests.cvs.core/about.html | 30 - .../benchmark/cvsui_benchmark.bat | 42 - .../benchmark/readme.txt | 180 - .../team2.0/2002_02_26.integration.all.xml | 6027 --------- .../team2.0/2002_03_19.integration.all.xml | 4577 ------- .../team2.0/2002_04_24.milestone5.all.xml | 12053 ------------------ .../team2.0/2002_04_25.integration.commandline.xml | 1731 --- .../team2.0/2002_07_10.release2_0.commandline.xml | 1731 --- .../team2.0/2002_07_11.release2_0.all.xml | 12051 ------------------ .../benchmark/team2.1/I20021127.all.xml | 12069 ------------------ .../benchmark/team2.1/I20030129.all.xml | 12195 ------------------- .../benchmark/teamui_benchmark.bat | 38 - .../vcm1.0/2002_02_26.integration.all.xml | 10960 ----------------- .../benchmark/vcmui_benchmark.bat | 43 - .../build-tests.xml | 47 - .../build.properties | 2 - tests/org.eclipse.team.tests.cvs.core/plugin.xml | 112 - tests/org.eclipse.team.tests.cvs.core/readme.html | 90 - .../repository.properties | 11 - .../resources/BenchmarkTest/benchmarkBig.zip | Bin 2571090 -> 0 bytes .../resources/BenchmarkTest/benchmarkSmall.zip | Bin 212938 -> 0 bytes .../resources/BenchmarkTest/benchmarkTiny.zip | Bin 2826 -> 0 bytes .../resources/CommandTest/CVSROOT/modules | 65 - .../resources/CommandTest/common/docs/readme.html | 2 - .../resources/CommandTest/common/macros/macro1 | 1 - .../CommandTest/project1/f1/file-in-p1.txt | 1 - .../resources/CommandTest/project2/file-p2.txt | 1 - .../resources/CommandTest/project3/src/file.c | 1 - .../resources/CommandTest/project3/src/file.h | 1 - .../CommandTest/project3/sub/file-sub.txt | 1 - .../CommandTest/project7/common/common.txt | 1 - .../resources/CommandTest/project7/linux/linux.txt | 1 - .../resources/CommandTest/project7/pc/pc.txt | 1 - .../resources/CommandTest/project8/file-p8.txt | 1 - .../org.eclipse.team.tests.cvs.core/self-host.xml | 74 - .../team/tests/ccvs/core/AllTeamAndCVSTests.java | 38 - .../org/eclipse/team/tests/ccvs/core/AllTests.java | 37 - .../team/tests/ccvs/core/CVSClientException.java | 15 - .../eclipse/team/tests/ccvs/core/CVSTestSetup.java | 192 - .../team/tests/ccvs/core/CommandLineCVSClient.java | 81 - .../team/tests/ccvs/core/EclipseCVSClient.java | 119 - .../eclipse/team/tests/ccvs/core/EclipseTest.java | 635 - .../eclipse/team/tests/ccvs/core/ICVSClient.java | 22 - .../team/tests/ccvs/core/JUnitTestCase.java | 323 - .../core/compatible/AllTestsCompatibility.java | 27 - .../team/tests/ccvs/core/compatible/BasicTest.java | 490 - .../ccvs/core/compatible/CompatibleTestSetup.java | 52 - .../tests/ccvs/core/compatible/ConflictTest.java | 89 - .../tests/ccvs/core/compatible/ModuleTest.java | 88 - .../tests/ccvs/core/compatible/SameResultEnv.java | 484 - .../core/cvsresources/AllTestsCVSResources.java | 28 - .../ccvs/core/cvsresources/BatchedTestSetup.java | 25 - .../ccvs/core/cvsresources/EclipseFolderTest.java | 95 - .../core/cvsresources/EclipseSynchronizerTest.java | 459 - .../core/cvsresources/ResourceSyncInfoTest.java | 141 - .../tests/ccvs/core/provider/AllTestsProvider.java | 45 - .../tests/ccvs/core/provider/CVSProviderTest.java | 405 - .../team/tests/ccvs/core/provider/ImportTest.java | 155 - .../tests/ccvs/core/provider/IsModifiedTests.java | 525 - .../ccvs/core/provider/LinkResourcesTest.java | 80 - .../team/tests/ccvs/core/provider/ModuleTest.java | 281 - .../ccvs/core/provider/RemoteResourceTest.java | 306 - .../ccvs/core/provider/ResourceDeltaTest.java | 260 - .../tests/ccvs/core/provider/SyncElementTest.java | 834 -- .../tests/ccvs/core/provider/WatchEditTest.java | 146 - .../eclipse/team/tests/ccvs/ui/CVSUITestCase.java | 448 - .../team/tests/ccvs/ui/DummyPromptCondition.java | 24 - .../ccvs/ui/EclipseUITestHarnessApplication.java | 185 - .../team/tests/ccvs/ui/EmptyPerspective.java | 48 - .../team/tests/ccvs/ui/FakeSelectionProvider.java | 36 - .../org/eclipse/team/tests/ccvs/ui/ICriteria.java | 17 - .../team/tests/ccvs/ui/LoggingTestCase.java | 99 - .../team/tests/ccvs/ui/LoggingTestResult.java | 258 - .../team/tests/ccvs/ui/LoggingTestRunner.java | 32 - .../team/tests/ccvs/ui/PerformanceTimer.java | 49 - .../team/tests/ccvs/ui/SequenceGenerator.java | 57 - .../src/org/eclipse/team/tests/ccvs/ui/Util.java | 789 -- .../src/org/eclipse/team/tests/ccvs/ui/Waiter.java | 29 - .../team/tests/ccvs/ui/benchmark/AllTests.java | 26 - .../ccvs/ui/benchmark/BenchmarkTestSetup.java | 49 - .../team/tests/ccvs/ui/benchmark/CommandTests.java | 231 - .../team/tests/ccvs/ui/benchmark/SyncTests.java | 112 - .../tests/ccvs/ui/benchmark/WorkflowTests.java | 156 - .../tests/ccvs/ui/logformatter/ArgumentParser.java | 43 - .../team/tests/ccvs/ui/logformatter/CaseEntry.java | 32 - .../ui/logformatter/DelimitedValuesWriter.java | 48 - .../tests/ccvs/ui/logformatter/GroupEntry.java | 22 - .../ccvs/ui/logformatter/ILogEntryVisitor.java | 13 - .../team/tests/ccvs/ui/logformatter/LogEntry.java | 118 - .../ccvs/ui/logformatter/LogEntryContainer.java | 57 - .../ccvs/ui/logformatter/LogFormatterUIMain.java | 182 - .../ccvs/ui/logformatter/MergeRunsVisitor.java | 70 - .../ccvs/ui/logformatter/PrintCSVDiffVisitor.java | 96 - .../ui/logformatter/PrintCSVSummaryVisitor.java | 76 - .../tests/ccvs/ui/logformatter/PrintDiffMain.java | 148 - .../ccvs/ui/logformatter/PrintDiffVisitor.java | 84 - .../ccvs/ui/logformatter/PrintSummaryMain.java | 116 - .../ccvs/ui/logformatter/PrintTextDiffVisitor.java | 141 - .../ui/logformatter/PrintTextSummaryVisitor.java | 103 - .../team/tests/ccvs/ui/logformatter/Result.java | 33 - .../team/tests/ccvs/ui/logformatter/RootEntry.java | 42 - .../team/tests/ccvs/ui/logformatter/TaskEntry.java | 100 - .../team/tests/ccvs/ui/logformatter/Util.java | 17 - .../tests/ccvs/ui/unit/MenuEnablementTest.java | 526 - tests/org.eclipse.team.tests.cvs.core/test.xml | 60 - 777 files changed, 167873 deletions(-) delete mode 100644 bundles/org.eclipse.compare/.classpath delete mode 100644 bundles/org.eclipse.compare/.cvsignore delete mode 100644 bundles/org.eclipse.compare/.project delete mode 100644 bundles/org.eclipse.compare/about.html delete mode 100644 bundles/org.eclipse.compare/build.properties delete mode 100644 bundles/org.eclipse.compare/buildnotes_compare.html delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareInput.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchedResource.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewAncestor.txt delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/package.html delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java delete mode 100644 bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/cview16/compare_view.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/eview16/compare_view.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/obj16/day_obj.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/obj16/resolved.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/obj16/unresolved.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugin.properties delete mode 100644 bundles/org.eclipse.compare/plugin.xml delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/.cvsignore delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/about.html delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/package.html delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextMergeViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareInput.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchedResource.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewAncestor.txt delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/package.html delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/package.html delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/package.html delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resolved.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/unresolved.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd delete mode 100644 bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml delete mode 100644 bundles/org.eclipse.compare/schema/contentMergeViewers.exsd delete mode 100644 bundles/org.eclipse.compare/schema/contentViewers.exsd delete mode 100644 bundles/org.eclipse.compare/schema/structureCreators.exsd delete mode 100644 bundles/org.eclipse.compare/schema/structureMergeViewers.exsd delete mode 100644 bundles/org.eclipse.compare/scripts/exportplugin.xml delete mode 100644 bundles/org.eclipse.team.core/.classpath delete mode 100644 bundles/org.eclipse.team.core/.cvsignore delete mode 100644 bundles/org.eclipse.team.core/.options delete mode 100644 bundles/org.eclipse.team.core/.project delete mode 100644 bundles/org.eclipse.team.core/about.html delete mode 100644 bundles/org.eclipse.team.core/build.properties delete mode 100644 bundles/org.eclipse.team.core/buildnotes_team.html delete mode 100644 bundles/org.eclipse.team.core/doc/hglegal.htm delete mode 100644 bundles/org.eclipse.team.core/doc/ngibmcpy.gif delete mode 100644 bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html delete mode 100644 bundles/org.eclipse.team.core/doc/org_eclipse_team_core_fileTypes.html delete mode 100644 bundles/org.eclipse.team.core/doc/org_eclipse_team_core_ignore.html delete mode 100644 bundles/org.eclipse.team.core/doc/org_eclipse_team_core_projectSets.html delete mode 100644 bundles/org.eclipse.team.core/doc/org_eclipse_team_core_repository.html delete mode 100644 bundles/org.eclipse.team.core/plugin.properties delete mode 100644 bundles/org.eclipse.team.core/plugin.xml delete mode 100644 bundles/org.eclipse.team.core/schema/fileTypes.mxsd delete mode 100644 bundles/org.eclipse.team.core/schema/ignore.mxsd delete mode 100644 bundles/org.eclipse.team.core/schema/projectSets.mxsd delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/package.html delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/ILocalSyncElement.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteResource.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteSyncElement.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/LocalSyncElement.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java delete mode 100644 bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties delete mode 100644 bundles/org.eclipse.team.cvs.ssh/.classpath delete mode 100644 bundles/org.eclipse.team.cvs.ssh/.cvsignore delete mode 100644 bundles/org.eclipse.team.cvs.ssh/.options delete mode 100644 bundles/org.eclipse.team.cvs.ssh/.project delete mode 100644 bundles/org.eclipse.team.cvs.ssh/about.html delete mode 100644 bundles/org.eclipse.team.cvs.ssh/build.properties delete mode 100644 bundles/org.eclipse.team.cvs.ssh/plugin.properties delete mode 100644 bundles/org.eclipse.team.cvs.ssh/plugin.xml delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java delete mode 100644 bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties delete mode 100644 bundles/org.eclipse.team.ui/.classpath delete mode 100644 bundles/org.eclipse.team.ui/.cvsignore delete mode 100644 bundles/org.eclipse.team.ui/.project delete mode 100644 bundles/org.eclipse.team.ui/about.html delete mode 100644 bundles/org.eclipse.team.ui/build.properties delete mode 100644 bundles/org.eclipse.team.ui/doc/hglegal.htm delete mode 100644 bundles/org.eclipse.team.ui/doc/ngibmcpy.gif delete mode 100644 bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html delete mode 100644 bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/dlcl16/site_element.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/elcl16/site_element.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif delete mode 100644 bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif delete mode 100644 bundles/org.eclipse.team.ui/plugin.properties delete mode 100644 bundles/org.eclipse.team.ui/plugin.xml delete mode 100644 bundles/org.eclipse.team.ui/schema/configurationWizards.mxsd delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html delete mode 100644 examples/org.eclipse.team.examples.filesystem/.classpath delete mode 100644 examples/org.eclipse.team.examples.filesystem/.cvsignore delete mode 100644 examples/org.eclipse.team.examples.filesystem/.project delete mode 100644 examples/org.eclipse.team.examples.filesystem/about.html delete mode 100644 examples/org.eclipse.team.examples.filesystem/build.properties delete mode 100644 examples/org.eclipse.team.examples.filesystem/doc-html/hglegal.htm delete mode 100644 examples/org.eclipse.team.examples.filesystem/doc-html/ngibmcpy.gif delete mode 100644 examples/org.eclipse.team.examples.filesystem/doc-html/team_filesystem_ex.html delete mode 100644 examples/org.eclipse.team.examples.filesystem/icons/full/wizards/fsicon_wiz.gif delete mode 100644 examples/org.eclipse.team.examples.filesystem/icons/full/wizban/newconnect_wizban.gif delete mode 100644 examples/org.eclipse.team.examples.filesystem/plugin.properties delete mode 100644 examples/org.eclipse.team.examples.filesystem/plugin.xml delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemRemoteResource.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/Policy.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/StreamUtil.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/messages.properties delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemPropertiesPage.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/GetAction.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java delete mode 100644 examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java delete mode 100644 tests/org.eclipse.team.tests.core/.classpath delete mode 100644 tests/org.eclipse.team.tests.core/.cvsignore delete mode 100644 tests/org.eclipse.team.tests.core/.project delete mode 100644 tests/org.eclipse.team.tests.core/about.html delete mode 100644 tests/org.eclipse.team.tests.core/build-tests.xml delete mode 100644 tests/org.eclipse.team.tests.core/build.properties delete mode 100644 tests/org.eclipse.team.tests.core/ftp.properties delete mode 100644 tests/org.eclipse.team.tests.core/plugin.xml delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTargetTests.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RemoteResourceTests.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTypeBic.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetTestSetup.java delete mode 100644 tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java delete mode 100644 tests/org.eclipse.team.tests.core/test.xml delete mode 100644 tests/org.eclipse.team.tests.core/webdav.properties delete mode 100644 tests/org.eclipse.team.tests.cvs.core/.classpath delete mode 100644 tests/org.eclipse.team.tests.cvs.core/.cvsignore delete mode 100644 tests/org.eclipse.team.tests.cvs.core/.project delete mode 100644 tests/org.eclipse.team.tests.cvs.core/about.html delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/cvsui_benchmark.bat delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/readme.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_02_26.integration.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_03_19.integration.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_24.milestone5.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_25.integration.commandline.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_10.release2_0.commandline.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_11.release2_0.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20021127.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20030129.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/teamui_benchmark.bat delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/vcm1.0/2002_02_26.integration.all.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/benchmark/vcmui_benchmark.bat delete mode 100644 tests/org.eclipse.team.tests.cvs.core/build-tests.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/build.properties delete mode 100644 tests/org.eclipse.team.tests.cvs.core/plugin.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/readme.html delete mode 100644 tests/org.eclipse.team.tests.cvs.core/repository.properties delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkTiny.zip delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/macros/macro1 delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project1/f1/file-in-p1.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project2/file-p2.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/sub/file-sub.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/common/common.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/linux/linux.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/pc/pc.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt delete mode 100644 tests/org.eclipse.team.tests.cvs.core/self-host.xml delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSClientException.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/ICVSClient.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/JUnitTestCase.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/AllTestsCompatibility.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/CompatibleTestSetup.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ConflictTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ModuleTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/AllTestsCVSResources.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/BatchedTestSetup.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/AllTestsProvider.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/LinkResourcesTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/WatchEditTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSUITestCase.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/DummyPromptCondition.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EclipseUITestHarnessApplication.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java delete mode 100644 tests/org.eclipse.team.tests.cvs.core/test.xml diff --git a/bundles/org.eclipse.compare/.classpath b/bundles/org.eclipse.compare/.classpath deleted file mode 100644 index 8a49fb9d5..000000000 --- a/bundles/org.eclipse.compare/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - 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 bf7d0f58b..000000000 --- a/bundles/org.eclipse.compare/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - org.eclipse.compare - - - org.eclipse.core.boot - org.eclipse.ui - org.eclipse.core.runtime - org.eclipse.core.resources - org.eclipse.swt - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - 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 @@ - - - -About - - - -

About This Content

- -

20th June, 2002

-

License

-

Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

- -

Contributions

- -

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.

- -

If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

- - - \ 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 46151f0cf..000000000 --- a/bundles/org.eclipse.compare/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -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 947cd0bd3..000000000 --- a/bundles/org.eclipse.compare/buildnotes_compare.html +++ /dev/null @@ -1,1193 +0,0 @@ - - - - - - - Eclipse Platform Release Notes - Desktop - - - -

-Eclipse Platform Build Notes
-Compare

-Eclipse Build Input February 6th 2003 - -

-Problem reports fixed

-#30525: "Team" menu item missing accelerator
-#28202: contentmergeviewers do not work with mixed-case extensions
-#19114: Restore Java Element from Local History should also provide check boxes [compare]
-#28436: Overview rule green only after focus change
- -

-

-Eclipse Build Input January 28th 2003 - -

-API Additions

-Added new method CompareUI.findContentViewer(..., Object input, ...) - -

-Problem reports fixed

-Remoced doc folder.
-#24597: Compare UI API issues
-#23883: CompareDialog.commitAction.label string resource name is wrong
-#29791: Rename 'Compare to Patch' to 'Apply Patch'
- -

-

-Eclipse Build Input January 14th 2003 - -

-Problem reports fixed

-Extension point schema files added.
-Resolve status indicator is only shown if there are incoming changes. - -

-

-Eclipse Build Input January 7th 2003 - -

-Problem reports fixed

-#28278: TextMergeViewer leaks Color objects
-#27864: Load of CompareUI fails when not triggered in UI thread
-#28388: Illegal Argument Exceptions in compare viewer
- -

-

-Eclipse Build Input December 17th 2002 - -

-Problem reports fixed

-#28388: Illegal Argument Exceptions in compare viewer
- -

-

-Eclipse Build Input December 16th 2002 - -

-Problem reports fixed

-Fixed a problem with trim in compare viewer on Mac OS X.
-#28278: TextMergeViewer leaks Color objects
- -
-Eclipse Build Input December 13th 2002 - -

-Problem reports fixed

-#28012: Double-click behaving strangely in Synchronize View
- -

-

-Eclipse Build Input December 10th 2002 - -

-What's new in this drop

-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. - -

-Problem reports fixed

-#27993: Incorrect structure comparison
- -

-

-Eclipse Build Input December 3rd 2002 - -

-What's new in this drop

- -

-API Additions

-Made internal class Splitter public API. - -

-Problem reports fixed

-#24597: Compare UI API issues
- -

-

-Eclipse Build Input November 26th 2002 - -

-Problem reports fixed

-#20975: Compare preference page has no F1 help
- -

-

-Eclipse Build Input June 27th 2002 - -

-What's new in this drop

-Updated JavaDoc package.html files - -

-

-Eclipse Build Input June 25th 2002 - -

-What's new in this drop

-Updated JavaDoc - -

-

-Eclipse Build Input June 12th 2002 - -

-What's new in this drop

- -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. - -

-

-Eclipse Build Input June 8th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#18807: Compare with patch fails due to missing LF
-#13730: Entire zipfiles content sent prior when computing synchronization view content
- -

-Problem reports closed

- -

-

-Eclipse Build Input June 7th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#13730: Entire zipfiles content sent prior when computing synchronization view content
-#14952: Diff Browser Opens Too Small / Not Easily Resizable
- - -

-Problem reports closed

- -

-

-Eclipse Build Input June 6th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

-New constant CompareUI.PLUGIN_ID - -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#13949: DBCS: bogus at text compare
-#19013: backgronud color: is it honored?
-#19216: Accessibility in Workbench > Compare > Text Compare
-#19371: Java & Compare editor's Next/Previous toolbar buttons shouldn't be retargetable
- - -

-Problem reports closed

- -

-

-Eclipse Build Input June 1st 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

-Made class NavigationAction public. - -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#8004: Ctrl+E beeps every time
-#14800: Compare View eats tabs
-#18200: Both sets of arrows say "Select Next Change"
-#18206: Casing, wording issue on "Last Resource reached" prompt
-#16285: Add from Local History needs a description label
-#17431: Accessibility issues
-#18148: Using combinations of No and Next file button break wrapping
-#18151: Next File button does not ding when on last file
-#16570: Compare refuses to show further differences if not ignoring whitespaces
-#10790: Patch does not apply if file not found locally
-#12643: Expand all does not disable when there is no selection
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 31st 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#18116: Compare view does not inherit Java editor background color
-#13190: Compare with Patch does not apply Patch, if single file selected
- - -

-Problem reports closed

- -

-

-Eclipse Build Input May 30th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#17699: Java Editor: Local Histroy menu entries are enabled for read-only files
-#16283: Add from Local History items are unsorted
-#16288: Add from Local History: list of available editions flashes
-#17664: Applying a patch with deleted package fails
- - -

-Problem reports closed

- -

-

-Eclipse Build Input May 29th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#14040: Platform interoperability issue w.r.t. Compare With Patch
-#17790: Missing mnemonics in patch selection dialog
-#10917: Patch support does not use mnemonics
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 28th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#17889: Should not assume type of PropertyChangeEvent values
-#17678: Applying a patch does many compiles
-#17536: NPE in compare
-#17121: Casing of message when end of changes needs to be sentence style
-#17648: Can't apply patch w/o ignoring whitespace
-#16936: Compare with patch requires "Ignore Whitespace" to be turned off
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 18th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#14371: TextMergeViewer.sameDoc() is broken
-#14378: CompareEditorInput never resets dirtyness flag (detailed)
-#14680: Compare unreadable in high contrast black
-#14952: Diff Browser Opens Too Small / Not Easily Resizable
-#14742: Ignore whitespace preference
-#14624: No visual cue when compared file wraps
-#13606: Support multiple selection in Add from local history
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 16th 2002 - -

-What's new in this drop

-Bumped plugin version number to 2.0.0
-Adapted to new findEditor methods
- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#8373: Compare With->Patch... missing mnemonic
-#12719: "Show Pseudo-Conflicts" setting is problematic
- -

-Problem reports closed

- -

-

-Eclipse Build Input April 30th 2002 - -

-What's new in this drop

-All strings NLSed. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#14515: java compare uses internal jcore scanner
-#14782: Add from Local History missing mnemonic
- -

-Problem reports closed

- -

-

-Eclipse Build Input April 18th 2002 - -

-What's new in this drop

-All strings NLSed. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#13152: Internal error in "Add from Local History..." on packages
- -

-Problem reports closed

- -

-

-Eclipse Build Input April 9th 2002 - -

-What's new in this drop

-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. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

-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. - -

-Problem reports fixed

-#11578: Patch: Missing resource on dialog
-#11579: Compare with Patch should be disabled on closed projects
-#11907: clicking in bird's eye view spots does nothing if panes not synched
-#11536: Option to turn off structured comparison
-#10682: Need better UI for recovering deletions from local history
-#11446: provide "add from local history" for compilation units
-#8615: Styled Text widget does not respond to system color change
-#9673: editor background color - no effect on other viewers
-#11642: Compare editors not using default background colors
-#10434: Compare browser fails silently and does not give result
- -

-Problem reports closed

- -

-

-Eclipse Build Input March 18th 2002 - -

-What's new in this drop

-First cut of a birdseyeview for the text compare viewer.
-'Compare which Each other' for Java elements. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#3641: DCR: Can't compare from outliner (1GDHJKK)
- -

-Problem reports closed

- -

-

-Eclipse Build Input March 14th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#11305: Can't compare a "C" file
- - -

-Problem reports closed

- -

-

-Eclipse Build Input March 12th 2002 - -

-What's new in this drop

-Structure Compare viewers are enabled by default.
- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#10379: Compare with Local History Dialog: lower pane is missing a bordeer
-#9768: (empty-menu) in compare view
-#9842: Expand All action needed in structure compare view
- - -

-Problem reports closed

- -

-

-Eclipse Build Input March 5th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#9869: Need more support for creating/deleting resources
- - -

-Problem reports closed

- -

-

-Eclipse Build Input February 26th 2002 - -

-What's new in this drop

-Patch: for every rejected file a task marker is added
-Compare preference page shows options in a preview
-New preference option for additional compare status line information - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#9540: Compare with patch: it should not be possible to check items that could not be applied
-#9532: Compare with patch: next disabled although clipboard specified
-#7681: Structured results expands import statements
-#9572: Debugging trace left in status bar
- - -

-Problem reports closed

- -

-

-Eclipse Build Input February 12th 2002 - -

-What's new in this drop

-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. -
-Patch wizard has a 'Reverse' option for applying a "reversed" patch. -This option can be used to 'undo' a patch. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#9153: NPE when closing synchronize view
-#9331: NPE during compare with stream version
-#6346: Problems with Patch
-#6727: Patch: *.rej file must be saved in workspace
-#7358: Internal Error in Compare with Patch with new files
- -

-Problem reports closed

- -

-

-Eclipse Build Input February 5th 2002 - -

-What's new in this drop

-The structure compare pane opens when a resource is selected. -In previous version a double click was required. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#5063: Should not have to double-click to open Structure Compare
-#2602: Compare FW accessibility issues (1GK79UB)
-#2707: Merge viewer should ask for save before releasing (1GI9JXS)
-#2772: DCR: Automatic structure compare (1GJ6EUY)
-#3829: Smart rename button enabled when no smartness is available (1GEUVHN)
-#9089: Local history - Selecting item in structured compare has no effect
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 29th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#6271: Can't tell which file is which in Compare browser
-#2519: next/prev arrows active when only one difference in compare (1GFIQX3)
-#8363: NPE comparing two resources in the navigator.
-#2501: Empty menu in compare browser (1GFBQKE)
-#2854: Compare: Save code path problematic (1GJYGAX)
-#8574: Not structure compare in compare with local history
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 23th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#8089: Replace from local history: parse error
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 22th 2002 - -

-What's new in this drop

-Fixed an inconsistency in the binary compare viewer: -info message didn't match +/-icon in the resource compare pane. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#3859: replace from history does not work for elements with error (1GEYIZ6)
-#6177: Double click action dangerous in 'Restore from Local History'
-#7821: Team 2.0 CVS synchronze bug 'no-name' dirs..
-#2773: Java structure compare should give better indication when no changes (1GJ6ENE)
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 15th 2002 - -

-What's new in this drop

-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. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#1893: Compare Viewer doesn't scroll to last line (1GBB34N)
-#5839: Usability: Initial diff is sometimes not horizontally aligned
-#5325: Compare always scroll the text pane to the extreme limit
-#7048: First element not selected
-#2548: Project compare should open viewing selected file (1GFMRP6)
-#2938: Replace from local history should show busy cursor (1GKU0P3)
-#7594: Menu entry "Replace with Previous" shouldn't have a "..."
-Workaround added for:
-#7320: Next diff scrolls when going into current diff
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 8th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

-Added methods to CompareUI plugin for adding and removing aliases -for the file extension to StructureCompareViewer mapping -(addStructureViewerAlias, removeStructureViewerAlias). - -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#6828: Support with replace with previous
-#2396: Save in compare editors needs progress bar (1GEYF58)
-#5271: JARs compared as source in release browser
-#5121: Replace with Previous (from local history)
- -

-Problem reports closed

- -

-

-Eclipse Build Input December 11th 2001 - -

-What's new in this drop

-Keyboard shortcuts for 'Goto next Difference' and 'Goto previous Difference' -changed to Control-E and Control-Shift-E.
-Better NLS support.
-Updated file "about.html". - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

- -

-Problem reports closed

- -

-

-Eclipse Build Input December 4th 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#4381: Replace from local histroy - workspace element included
- -

-Problem reports closed

- -

-

-Eclipse Build Input November 27th 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#6298: Replace with Local History: Workbench -> Workspace
-#5238: Compare fails if takes more than 20 seconds
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 210, November 12th, 2001 - -

-What's new in this drop

-First cut for 'rejected hunk' support. - -

-API changes

- -

-API Additions

-new classes CompareViewerPane and CompareViewerSwitchingPane
- -

-Other highlights

-Improved Patch wizard.
- -

-Known deficiencies

- -

-Problem reports fixed

-#5723: Apply Patch dialog has no radio selection
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 207, November 1st, 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#5334: Internal errors using patch tool
-#5150: Compare with patch cannot read VCM's CVS patch file
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 204, October 12th, 2001 - -

-What's new in this drop

-First cut of patch support. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

- -

-Problem reports closed

- -

-

-Eclipse SDK Build 202, September 27th, 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-1GKKUA5: ITPUI:WINNT - Severe: memory leak in sync view
-1GKKGGS: ITPJUI:WIN2000 - (136) compares zips as source
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 201, September 21st, 2001 - -

-What's new in this drop

-removed direction icon in TextMergeViewer for two-way compare - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-1GJURWJ: ITPUI:WIN2000 - Hebrew + Japanese: compare view defaults to binary
-1GK0388: ITPJCORE:WIN2000 - replace with local history: selecting (workspace) deletes source
-1GITG2V: ITPUI:WIN2000 - Comparing html files uses binary compare
-1GJW2TP: ITPJUI:WIN2000 - java compare: why beep every time?
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 200, September 13th, 2001 - -

-What's new in this drop

-If not specified otherwise Compare viewer font is taken from workbench text font
-The shortcut for "Goto Next/Previous Difference" is Ctrl-D/Ctrl-Shift-D -to avoid a clash with Ctrl-P of the Print command. - -

-API changes

- -

-API Additions

-new method EditionSelectionDialog.setHideIdenticalEntries(boolean)
-new method EditionSelectionDialog.setTargetIsRight(boolean)
-new method EditionSelectionDialog.setAddMode(boolean)
-new method CompareEditorInput.saveChanges(...)
-new method TextMergeViewer.createLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace)
- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty
-1GG0ELM: ITPVCM:ALL - Local history displayed some of Today's items as Yesterday
-1GGNKHN: ITPJUI:ALL - No progress during replace with local history
-1GF2JNI: ITPUI:ALL - (minor)Compare failed title should be title case
-1GHBPA1: ITPVCM:WINNT - Compare - next change arrow switches to wrong file
-1GGQQH3: ITPJUI:WINNT - Compare hightlights a non-change instead of the change
-1GI5DN9: ITPUI:WIN2000 - Conflicting token deletions don't show up in text compare viewer
-1GI3KUR: ITPJUI:WIN2000 - Compare: double-click in versions list closes view
-1GFFR4B: ITPUI:WIN98 - local history is misleading
-1GBM0IL: ITPUI:WINNT - CompareEditorInput#save should throw CoreException
-1GI99LE: ITPUI:ALL - Compare viewer does not show last line when horizontal scroll bar is present
-1GBB34N: ITPJUI:WIN2000 - Compare Viewer doesn't scroll to last line
-1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range
-1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files
-1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update
-1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options
-1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()
-1GI3HDZ: ITPJUI:ALL - Compare: conflicts with no ancestor does not show differences
-1GEUX0D: ITPJUI:ALL - not state aware toolbar button in compare
- -

-Problem reports closed

-1GF9Y9C: ITPUI:WIN2000 - DCR: only get ancestor pane contents if pane is visible
- - - 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 fbe1a66c2..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 IStreamContentAccessor. - *

- * Subclasses must implement the createStream method - * to connect the buffered content with a streamable source (e.g., a file). - *

- * As long as the contents of BufferedContent is only retrieved as an input stream - * (by means of getContents) and the BufferedContent is not modified (with - * setContent) no buffering takes place. - * Buffering starts when either method getContent or setContent 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. - *

- * Subclasses must implement this method. - *

- * - * @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 null if - * the contents could not be accessed - */ - public byte[] getContent() { - if (fContent == null) { - try { - InputStream is= createStream(); - fContent= Utilities.readBytes(is); - } catch(CoreException ex) { - } - } - 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 IContentChangeListeners 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 9bb8f76ab..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 CompareConfiguration 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 ICompareConfiguration 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 IGNORE_WHITESPACE property - * and all interested viewers would receive notification. - *

- * Suitable default labels are provided (without images); both the left and right sides - * are editable. - *

- *

- * Clients may use this class as is, or subclass to add new state and behavior. - *

- */ -public class CompareConfiguration { - - /** - * Name of the ignore whitespace property (value "IGNORE_WHITESPACE"). - */ - public static final String IGNORE_WHITESPACE= "IGNORE_WHITESPACE"; //$NON-NLS-1$ - /** - * Name of the show pseudo conflicts property (value "SHOW_PSEUDO_CONFLICTS"). - */ - public static final String SHOW_PSEUDO_CONFLICTS= "SHOW_PSEUDO_CONFLICTS"; //$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 ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE, - * and CompareConfiguration.IGNORE_WHITESPACE. - * - * @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 - * (CompareUIPlugin.getDefault().getPreferenceStore()). - */ - 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 Differencer. - * Newly created images are remembered by this class and - * disposed when the dispose method is called. - * - * @param kind the kind of change as defined in Differencer. - * @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 Differencer. - * 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 dispose 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 Differencer. - * @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() { - } - - /** - * Fires a PropertyChangeEvent 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 PropertyChangeEvent - * 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 null - * if no such property exists. - * - * @param propertyName the name of the property to retrieve - * @return the property with the given name, or null 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 null - * @return the label for the ancestor side or null - */ - 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 null - * @return the image for the ancestor side or null - */ - 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 true left side is editable - */ - public void setLeftEditable(boolean editable) { - fLeftEditable= editable; - } - - /** - * Returns whether the left hand side of a merge viewer is editable. - * - * @return true 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 null - * @return the label for the left hand side or null - */ - 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 null - * @return the image for the left hand side or null - */ - 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 true right side is editable - */ - public void setRightEditable(boolean editable) { - fRightEditable= editable; - } - - /** - * Returns whether the right hand side of a merge viewer is editable. - * - * @return true 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 null - * @return the label for the right hand side or null - */ - 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 null - * @return the image for the right hand side or null - */ - 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 8c408f334..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java +++ /dev/null @@ -1,815 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.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.swt.custom.BusyIndicator; -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 interface 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. - *

- * A CompareEditorInput defines methods for the following sequence steps: - *

- * The Compare plug-in's openCompareEditor method takes an ICompareEditorInput - * 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. - *

- * The prepareInput 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 ICompareEditorInput should hold onto them and return them with - * the getCompareResult method. - * If the value returned from getCompareResult is not null - * a compare editor is opened on the ICompareEditorInput with title and title image initialized by the - * corresponding methods of the ICompareEditorInput. - *

- * Creation of the editor's SWT controls is delegated to the createContents method. - * Here the SWT controls must be created and initialized with the result of the compare operation. - *

- * If merging is allowed, the modification state of the compared constituents must be tracked and the dirty - * state returned from method isSaveNeeded. The value true triggers a subsequent call - * to save where the modified resources can be saved. - *

- * 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. - *

- * Subclasses provide custom setups, e.g. for a Catchup/Release operation - * by passing a subclass of CompareConfiguration and by implementing the prepareInput method. - * If a subclass cannot use the DiffTreeViewer which is installed by default in the - * top left pane, method createDiffViewer 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 "DIRTY_STATE"). - */ - 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 ISelection fSelection2; - 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; - - /** - * Creates a CompareEditorInput 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); - - 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 (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 fTitle; - } - - /* (non Javadoc) - * see IEditorInput.getName - */ - public String getName() { - return fTitle; - } - - /** - * Returns null since this editor cannot be persisted. - * - * @return null because this editor cannot be persisted - */ - public IPersistableElement getPersistable() { - return null; - } - - /** - * Returns false to indicate that this input - * should not appear in the "File Most Recently Used" menu. - * - * @return false - */ - 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 setTitle. - * - * @return the title - */ - public String getTitle() { - 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 null 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 ToolBarManager. - *

- * Subclasses may override to add their own actions. - *

- * - * @param toolBarManager the ToolBarManager 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 prepareInput method must propagate a checked exception, - * it should wrap it inside an InvocationTargetException; runtime exceptions are automatically - * wrapped in an InvocationTargetException by the calling context - * @exception InterruptedException if the operation detects a request to cancel, - * using IProgressMonitor.isCanceled(), it should exit by throwing - * InterruptedException - */ - public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - fInput= prepareInput(monitor); - } - - /** - * Runs the compare operation and returns the compare result. - * If null 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 InterruptedException. - *

- * 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. - *

- * - * @param monitor the progress monitor to use to display progress and receive - * requests for cancelation - * @return the result of the compare operation, or null if there are no differences - * @exception InvocationTargetException if the prepareInput method must propagate a checked exception, - * it should wrap it inside an InvocationTargetException; runtime exceptions are automatically - * wrapped in an InvocationTargetException by the calling context - * @exception InterruptedException if the operation detects a request to cancel, - * using IProgressMonitor.isCanceled(), it should exit by throwing - * InterruptedException - */ - protected abstract Object prepareInput(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException; - - /** - * Returns the compare result computed by the most recent call to the - * run method. Returns null if no - * differences were found. - * - * @return the compare result prepared in method prepareInput - * or null 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. - *

- * 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); - - final Splitter h= new Splitter(fComposite, SWT.HORIZONTAL); - - 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); - - 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; - } - }; - fComposite.setVisible(h, false); - fComposite.setVisible(fContentInputPane, true); - - fComposite.setWeights(new int[] { 30, 70 }); - - fComposite.layout(); - - // 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()); - } - } - ); - - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // setup the wiring for second pane - /* - fStructurePane1.addOpenListener( - new IOpenListener() { - public void open(OpenEvent oe) { - feed2(oe.getSelection()); - } - } - ); - */ - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - fStructurePane1.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - ISelection s= e.getSelection(); - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // if (s == null || s.isEmpty()) - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - feed2(s); - } - } - ); - - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // setup the wiring for third pane - /* - fStructurePane2.addOpenListener( - new IOpenListener() { - public void open(OpenEvent oe) { - feed3(oe.getSelection()); - } - } - ); - */ - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - fStructurePane2.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - ISelection s= e.getSelection(); - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // if (s == null || s.isEmpty()) - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - feed3(s); - } - } - ); - - - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // now deal with activation/deactivation - /* - Listener activationListener= new Listener() { - int fOldOpenStrategy; - - public void handleEvent(Event event) { - if (event.widget instanceof CompareViewerSwitchingPane) { - - switch (event.type) { - case SWT.Activate: - fFocusPane= (CompareViewerSwitchingPane) event.widget; - fOldOpenStrategy= OpenStrategy.getOpenMethod(); - OpenStrategy.setOpenMethod(OpenStrategy.SINGLE_CLICK | OpenStrategy.ARROW_KEYS_OPEN); - break; - case SWT.Deactivate: - OpenStrategy.setOpenMethod(fOldOpenStrategy); - break; - } - } - } - }; - fStructureInputPane.addListener(SWT.Activate, activationListener); - fStructurePane1.addListener(SWT.Activate, activationListener); - fStructurePane2.addListener(SWT.Activate, activationListener); - fContentInputPane.addListener(SWT.Activate, activationListener); - - fStructureInputPane.addListener(SWT.Deactivate, activationListener); - fStructurePane1.addListener(SWT.Deactivate, activationListener); - fStructurePane2.addListener(SWT.Deactivate, activationListener); - fContentInputPane.addListener(SWT.Deactivate, activationListener); - */ - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - - - if (fInput instanceof ICompareInput) { - fStructureInputPane.setInput((ICompareInput) 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; - } - - 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 IStructuredSelection with exactly one element. Returns - * null otherwise. - * - * @param selection the selection - * @return the first element of the selection, or null - */ - 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). - *

- * 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. - *

- */ - 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 createContents and returns a DiffTreeViewer. - *

- * Subclasses may override if they need a different viewer. - *

- * - * @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 - * null can be returned to indicate that no viewer could be found. - *

- * This implementation forwards the request to CompareUI.findStructureViewer. - *

- * Subclasses may override to implement a different strategy. - *

- * - * @return a compare viewer which is suitable for the given input object or null - */ - 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 - * null can be returned to indicate that no viewer could be found. - *

- * This implementation forwards the request to CompareUI.findContentViewer. - *

- * Subclasses may override to implement a different strategy. - *

- * - * @return a compare viewer which is suitable for the given input object or null - */ - 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 true if there are unsaved changes. - * The value returned is the value of the DIRTY_STATE property of this input object. - - * Returns true if this input has unsaved changes, - * that is if setDirty(true) has been called. - * Subclasses don't have to override if the functionality provided by setDirty - * is sufficient. - * - * @return true 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 PropertyChangeEvent 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) { - fListenerList.add(listener); - } - - /* (non Javadoc) - * see IPropertyChangeNotifier.removeListener - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - fListenerList.remove(listener); - } - - /** - * Save any unsaved changes. - * Empty implementation. - * Subclasses must override to save any changes. - * - * @param progressMonitor an IProgressMonitor 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 ISavable.save on them. - * - * @param progressMonitor an IProgressMonitor 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 f19a441ac..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.plugin.AbstractUIPlugin; - -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.structuremergeviewer.ICompareInput; - - -/** - * The class CompareUI 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. - *

- * 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 "org.eclipse.compare"). - * @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. - * - * @param input the input on which to open the compare editor - */ - public static void openCompareEditor(CompareEditorInput input) { - CompareUIPlugin plugin= CompareUIPlugin.getDefault(); - if (plugin != null) - plugin.openCompareEditor(input); - } - - /** - * 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. - *

- * 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. - *

- * - * @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 IWorkbenchAdapter.getImageDescriptor, which it - * uses to create an image if it does not already have one. - *

- * 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. - *

- * - * @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 null 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 null - */ - 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 null 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 null - */ - 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 - * null 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 IStreamContentAccessor and - * ITypedElement or ICompareInput. - * @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 null - */ - 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 findStructureViewer - * treat alias as a synonym for type and return the same viewer. - *

- * 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. - *

- * 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 2461e5e22..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 CompareViewerPane is a convenience class which installs a - * CLabel and a Toolbar in a ViewForm. - *

- * Double clicking onto the CompareViewerPane's title bar maximizes - * the CompareViewerPane to the size of an enclosing Splitter - * (if there is one). - * If more Splitters are nested maximizing walks up and - * maximizes to the outermost Splitter. - * - * @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

- * @exception SWTException - */ - public CompareViewerPane(Composite parent, int style) { - super(parent, 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); - } - - /** - * Sets the receiver's title text. - * The value null clears it. - * - * @param text the text to be displayed in the CompareViewerPane's title or null - * - * @exception SWTException - */ - public void setText(String label) { - CLabel cl= (CLabel) getTopLeft(); - cl.setText(label); - } - - /** - * Return the receiver's title text. - * - * @return the text of the CompareViewerPane's title or null - */ - public void setImage(Image image) { - CLabel cl= (CLabel) getTopLeft(); - cl.setImage(image); - } - - /** - * Returns a ToolBarManager if the given parent is a - * CompareViewerPane or null otherwise. - * - * @param parent a Composite or null - * @return a ToolBarManager if the given parent is a CompareViewerPane otherwise null - */ - public static ToolBarManager getToolBarManager(Composite parent) { - if (parent instanceof CompareViewerPane) { - CompareViewerPane pane= (CompareViewerPane) parent; - return pane.getToolBarManager(); - } - return null; - } - - /** - * Clears tool items in the CompareViewerPane's control bar. - * - * @param parent a Composite or null - */ - 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 b185dfb3e..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 CompareViewerPane that supports dynamic viewer switching. - * - *

- * Clients must implement the viewer switching strategy by implementing - * the getViewer(Viewer, Object) method. - *

- * If a property with the name CompareUI.COMPARE_VIEWER_TITLE is set - * on the top level SWT control of a viewer, it is used as a title in the CompareViewerPane'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 CompareViewerSwitchingPane 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

- * @exception SWTException - */ - public CompareViewerSwitchingPane(Composite parent, int style) { - this(parent, style, false); - } - - /** - * Creates a CompareViewerSwitchingPane 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 - * @exception SWTException - */ - 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 setTitelArgument - * or null if no optional title argument has been set. - *

- * Note: this method is for internal use only. Clients should not call this method. - * - * @return the optional title argument or null - */ - public String getTitleArgument() { - return fTitleArgument; - } - - /** - * Returns true if no viewer is installed or if the current viewer - * is a NullViewer. - * - * @return true if no viewer is installed or if the current viewer is a NullViewer - */ - 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 getViewer(Viewer, Object). - * 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 setInput(Object) method. - * If new and old viewer don't differ no new viewer is installed but just - * setInput(Object) is called. - * If the input is null the pane is cleared, - * that is the current viewer is disposed. - * - * @param input the new input object or null - */ - 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 Object 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, null is returned. - * The additional argument oldViewer represents the viewer currently installed - * in the pane (or null 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 null - * @param input the input object for which a viewer must be determined or null - * @return a viewer for the given input, or null 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 8fa8ba34d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java +++ /dev/null @@ -1,1123 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.io.InputStream; -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.*; -import org.eclipse.compare.*; - - -/** - * 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. - *

- * 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. - *

- * Subsections of an input element are determined by first finding an - * IStructureCreator for the input's type. - * Then the method locate is used to extract the subsection. - *

- * Each edition (variant in the list of variants) must implement the IModificationDate interface - * so that the dialog can sort the editions and present them in a tree structure where every - * node corresponds one day. - *

- * The functionality is surfaced in a single function selectEdition. - *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- * - * @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 { - InputStream is= sca.getContents(); - if (is != null) - fContent= Utilities.readString(is); - } catch (CoreException ex) { - } - } - } - 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: - *
-	 *	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
-	 * 
- * - * @param parent if not null the new dialog stays on top of this parent shell - * @param bundle ResourceBundle to configure the dialog - */ - public EditionSelectionDialog(Shell parent, ResourceBundle bundle) { - super(parent, bundle); - - fCompareConfiguration= new CompareConfiguration(); - fCompareConfiguration.setLeftEditable(false); - fCompareConfiguration.setRightEditable(false); - - 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(); - } - - /** - * 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 null - * @param editions the list of editions (element type: ITypedElements) - * @param path If null dialog shows full input; if non null it extracts a subsection - * @return returns the selected edition or null if error occurred. - * The returned ITypedElement is one of the original editions - * if path was null; otherwise - * it is an ITypedElement returned from IStructureCreator.locate(path, item) - * @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 null - * @param editions the list of editions (element type: ITypedElements) - * @param path If null dialog shows full input; if non null it extracts a subsection - * @return returns the selected edition or null if dialog was cancelled. - * The returned ITypedElement is one of the original editions - * if path was null; otherwise - * it is an ITypedElement returned from IStructureCreator.locate(path, item) - */ - 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) - fCompareConfiguration.setRightLabel(targetLabel); - else - fCompareConfiguration.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 selectEdition. - * - * @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 EditionSelectionDialog 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 EditionSelectionDialog 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 selectEdition. If a not null path was specified this method - * returns a subsection of this target (IStructureCreator.locate(path, target)) - * instead of the input target. - *

- * For example if the target is a Java compilation unit and path specifies - * a method, the value returned from getTarget 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 selected editions that have been specified with the most - * recent call to selectEdition. - * - * @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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the name of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param target the target element for which a label must be returned - * @param item if a path has been specified in selectEdition 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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the formatted modification date of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param selectedEdition the selected edition for which a label must be returned - * @param item if a path has been specified in selectEdition 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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the formatted modification date of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param edition the edition for which a label must be returned - * @param item if a path has been specified in edition 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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the formatted modification date of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param selectedEdition the selected edition for which a label must be returned - * @param item if a path has been specified in selectEdition 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) - return fTimeImage; - return null; - } - - /* (non Javadoc) - * Creates SWT control tree. - */ - protected synchronized Control createDialogArea(Composite parent) { - - 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 (fDateImage != null) - fDateImage.dispose(); - if (fTimeImage != null) - fTimeImage.dispose(); - } - } - ); - - 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, fCompareConfiguration); - 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, fCompareConfiguration); - } - }; - vsplitter.setWeights(new int[] { 30, 70 }); - - return vsplitter; - } - - /* (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 null 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= (ITypedElement)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); - 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 { - 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 94d31411e..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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; - -import org.eclipse.compare.*; - -/** - * A combination IFileState and ITypedElement that can be used as - * an input to a compare viewer or other places where an IStreamContentAccessor - * is needed. - *

- *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- */ -public class HistoryItem implements IStreamContentAccessor, ITypedElement, IModificationDate { - - private ITypedElement fBase; - private IFileState fFileState; - - /** - * Creates a HistoryItem object which combines the given IFileState - * and ITypedElement into an object - * which is suitable as input for a compare viewer or ReplaceWithEditionDialog. - * - * @param base the implementation of the ITypedElement interface delegates to this base ITypedElement - * @param fileState the IFileState 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()); - } -} - 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 4e2daf187..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -/** - * An IContentChangeListener is informed about content changes of a - * IContentChangeNotifier. - *

- * Clients may implement this interface. - *

- * - * @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 e47077147..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -/** - * Interface common to all objects that provide a means for registering - * for content change notification. - *

- * Clients may implement this interface. - *

- * - * @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 66d5f9921..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -/** - * Common interface for objects with editable contents. - * Typically it is implemented by objects that also implement - * the IStreamContentAccessor interface. - *

- * Clients may implement this interface. - *

- * Note that implementing IEditableContent does not - * automatically mean that it is editable. An object is only editable if - * it implements IEditableContent and the isEditable method returns true. - * - * @see IStreamContentAccessor - */ -public interface IEditableContent { - - /** - * Returns true if this object can be modified. - * If it returns false the other methods of this API must not be called. - * - * @return true 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 - *

- * - * What to do is encoded in the two arguments as follows: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
add:child == nullother != null
remove:child != nullother == null
copy:child != nullother != null
- */ - ITypedElement replace(ITypedElement child, ITypedElement other); -} 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 0ab0bbd5a..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * Clients may implement this interface. - *

- */ -public interface IModificationDate { - - /** - * Returns the modification time of this object. - *

- * 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 02aa86de8..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * Clients may implement this interface. - *

- * - * @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 07ae9828c..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -import java.io.InputStream; - -import org.eclipse.core.runtime.CoreException; - -/** - * An IStreamContentAccessor object represents a set of bytes which can be - * accessed by means of a stream. - *

- * Clients may implement this interface, or use the standard implementation, - * BufferedContent. - * - * @see BufferedContent - */ -public interface IStreamContentAccessor { - /** - * Returns an open InputStream for this object which can be used to retrieve the object's content. - * The client is responsible for closing the stream when finished. - * Returns null 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/ITypedElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java deleted file mode 100644 index 2bf989fd5..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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. - *

- * These methods are typically used to present an input object in the compare UI - * (getName and getImage) - * and for finding a viewer for a given input type (getType). - *

- * Clients may implement this interface. - */ -public interface ITypedElement { - - /** - * Type for a folder input (value "FOLDER"). - * 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 "txt"). - */ - public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$ - - /** - * Type for an element whose actual type could not - * be determined (value "???"). - */ - 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 null 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 - * FOLDER_TYPE. - * 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 86d878ff4..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -import org.eclipse.swt.widgets.Composite; - -import org.eclipse.jface.viewers.Viewer; - -/** - * A factory object for Viewer. - *

- * This interface is only required when creating a Viewer from a plugin.xml file. - * Since Viewers have no default constructor they cannot be - * instantiated directly with Class.forName. - */ -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 8e7d9572f..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.compare.internal.CompareNavigator; -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.internal.Utilities; - -/** - * A NavigationAction is used to navigate through the individual - * differences of a CompareEditorInput. - *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- * @since 2.0 - */ -public class NavigationAction extends Action { - - private boolean fNext; - private CompareEditorInput fCompareEditorInput; - - - /** - * Creates a NavigationAction. - * - * @param next if true action goes to the next difference; otherwise to the previous difference. - */ - public NavigationAction(boolean next) { - this(CompareUIPlugin.getResourceBundle(), next); - } - - /** - * Creates a NavigationAction that initializes its attributes - * from the given ResourceBundle. - * - * @param bundle is used to initialize the action - * @param next if true 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(CompareNavigator.class); - if (adapter instanceof CompareNavigator) - ((CompareNavigator)adapter).selectChange(fNext); - } - } - - /** - * Sets the CompareEditorInput on which this action operates. - * - * @param input the CompareEditorInput on which this action operates; if null 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 46b5be006..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.structuremergeviewer.IStructureComparator; - -/** - * A ResourceNode wrappers an IResources so that it can be used - * as input for the differencing engine (interfaces IStructureComparator and ITypedElement) - * and the ReplaceWithEditionDialog (interfaces ITypedElement and IModificationDate). - *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- * - * @see EditionSelectionDialog - */ -public class ResourceNode extends BufferedContent - implements IStructureComparator, ITypedElement, IEditableContent, IModificationDate { - - private IResource fResource; - private ArrayList fChildren; - - - /** - * Creates a ResourceNode 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 true if the other object is of type ITypedElement - * 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) { - } - } - } - return fChildren.toArray(); - } - - /** - * This hook method is called from getChildren once for every - * member of a container resource. This implementation - * creates a new ResourceNode for the given child resource. - * Clients may override this method to create a different type of - * IStructureComparator or to filter children by returning null. - * - * @param child the child resource for which a IStructureComparator must be returned - * @return a ResourceNode for the given child or null - */ - protected IStructureComparator createChild(IResource child) { - return new ResourceNode(child); - } - - /** - * Returns an open stream if the corresponding resource implements the - * IStorage interface. Otherwise the value null 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) - return new BufferedInputStream(((IStorage)fResource).getContents()); - 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; - } -} - 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 221157198..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2002 IBM Corp. All rights reserved. This file is made - * available under the terms of the Common Public License v1.0 which accompanies - * 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. - *

- * If Splitters are nested directly: - *

- * - * @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. - *

- * The style value is either one of the style constants defined in - * class SWT which is applicable to instances of this - * class, or must be built by bitwise OR'ing together - * (that is, using the int "|" operator) two or more - * of those SWT style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - *

- * - * @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 - * @exception SWTException - * - * @see SWT#HORIZONTAL - * @see SWT#VERTICAL - * @see #getStyle - */ - 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(); - } - } - - /* - * 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 up - Composite parent= getParent(); - if (parent instanceof Splitter) - ((Splitter) parent).setMaximizedControl(this); - else - layout(true); - } - - /* - * 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; - } - - /* - * 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 e5d338784..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.Iterator; -import java.util.HashMap; -import java.util.zip.*; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.jface.util.Assert; - -import org.eclipse.core.runtime.CoreException; - -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.compare.internal.Utilities; - - -/** - * This implementation of the IStructureCreator interface - * makes the contents of a zip archive available as a - * hierarchical structure of IStructureComparators. - *

- * 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) { - 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) { - 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 getName(). - * @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) { - } - } - - 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) { - } - } - - 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 false since we cannot update a zip archive. - * @return false - */ - public boolean canSave() { - return false; - } - - /** - * Called whenever a copy operation has been performed on a tree node. - * This implementation throws an AssertionFailedException - * 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 getStructure - */ - public void save(IStructureComparator structure, Object input) { - Assert.isTrue(false); // Cannot update zip archive - } - - public IStructureComparator locate(Object path, Object source) { - return null; - } - - /** - * Returns false since this IStructureCreator - * cannot rewrite the diff tree in order to fold certain combinations of - * additons and deletions. - *

- * Note: this method is for internal use only. Clients should not call this method. - * @return false - */ - public boolean canRewriteTree() { - return false; - } - - /** - * Empty implementation since this IStructureCreator - * cannot rewrite the diff tree in order to fold certain combinations of - * additons and deletions. - *

- * 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 bd390892d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java +++ /dev/null @@ -1,962 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.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.resource.ImageDescriptor; -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.contentmergeviewer.IMergeViewerContentProvider; -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. - *

- * ContentMergeViewer - *

- * A ContentMergeViewer accesses its - * model by means of a content provider which must implement the - * IMergeViewerContentProvider interface. - *

- *

- * Clients may wish to use the standard concrete subclass TextMergeViewer, - * or define their own subclass. - * - * @see IMergeViewerContentProvider - * @see TextMergeViewer - */ -public abstract class ContentMergeViewer extends ContentViewer - implements IPropertyChangeNotifier, ISavable { - - class SaveAction extends MergeViewerAction { - - private boolean fLeft; - - 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; - - public Resizer(Control c, int dir) { - fDirection= dir; - fControl= c; - fControl.addMouseListener(this); - fLiveResize= !(fControl instanceof Sash); - - 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; - fControl.addMouseMoveListener(this); - } - - public void mouseUp(MouseEvent e) { - fControl.removeMouseMoveListener(this); - if (!fLiveResize) - resize(e); - } - - public void mouseMove(MouseEvent e) { - if (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; - - // 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 - * updateContent. - * - * @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 ToolBarManager. - * It is called when this viewer is installed in its container and if the container - * has a ToolBarManager. - * The ContentMergeViewer 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 true, the left side is copied to the right side; - * if false, 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 null can be returned. - * - * @param left if true, the byte contents of the left area is returned; - * if false, the byte contents of the right area - * @return the content as an array of bytes, or null - */ - 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 null if this viewer does not yet have a configuration. - * - * @return the compare configuration, or null if none - */ - protected CompareConfiguration getCompareConfiguration() { - return fCompareConfiguration; - } - - /** - * The ContentMergeViewer implementation of this - * ContentViewer method - * checks to ensure that the content provider is an IMergeViewerContentProvider. - */ - public void setContentProvider(IContentProvider contentProvider) { - Assert.isTrue(contentProvider instanceof IMergeViewerContentProvider); - super.setContentProvider(contentProvider); - } - - /* package */ IMergeViewerContentProvider getMergeContentProvider() { - return (IMergeViewerContentProvider) getContentProvider(); - } - - /** - * The ContentMergeViewer implementation of this - * Viewer method returns the empty selection. Subclasses may override. - */ - public ISelection getSelection() { - return new ISelection() { - public boolean isEmpty() { - return true; - } - }; - } - - /** - * The ContentMergeViewer implementation of this - * Viewer 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. - *

- * The ContentMergeViewer implementation of this Viewer - * method tries to save the old input by calling doSave(...) and - * then calls internalRefresh(...). - * - * @param input the new input of this viewer, or null if there is no new input - * @param oldInput the old input element, or null 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 Viewer method inputChanged - * to save any unsaved changes of the old input. - *

- * The ContentMergeViewer implementation of this - * method calls saveContent(...). If confirmation has been turned on - * with setConfirmSave(true), a confirmation alert is posted before saving. - *

- * 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 null if there is no new input - * @param oldInput the old input element, or null if there was previously no input - * @return true 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 doSave(...) asks for confirmation before saving - * the old input with saveContent(...). - * @param enable a value of true 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= CompareViewerSwitchingPane.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. - *

- * Calls the hooks createControls and createToolItems - * to let subclasses build the specific content areas and to add items to - * an enclosing toolbar. - *

- * 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); - - ToolBarManager tbm= CompareViewerSwitchingPane.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$ - } - - 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$ - } - - 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) { - - 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. - *

- * This method is called whenever the state of the items needs updating. - *

- * 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. - *

- * This method is called whenever the header must be updated. - *

- * 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 PropertyChangeEvent with the - * property name CompareEditorInput.DIRTY_STATE. - * - * @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 PropertyChangeEvent with the - * property name CompareEditorInput.DIRTY_STATE. - * - * @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 9952100d7..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java +++ /dev/null @@ -1,136 +0,0 @@ -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 e2d2d755c..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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. - *

- * 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. - *

- *

- * Clients may implement this interface. - *

- * - * @see TextMergeViewer - * @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode - */ -public interface IDocumentRange { - - /** - * The position category typically used for an IDocumentRange position - * (value "DocumentRangeCategory"). - * @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 null if this document range spans the whole underlying document. - * - * @return a position that specifies a subrange in the underlying document, or null - */ - 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 ebf8a7eb6..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.contentmergeviewer; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.jface.viewers.IContentProvider; - - -/** - * A content provider that mediates between a ContentMergeViewer's model - * and the viewer itself. - *

- * Clients may implement this interface. - *

- * - * @see ContentMergeViewer - */ -public interface IMergeViewerContentProvider extends IContentProvider { - - //---- ancestor side - - /** - * Returns the label for the ancestor side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the label for the ancestor side of a ContentMergeViewer - */ - String getAncestorLabel(Object input); - - /** - * Returns an optional image for the ancestor side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the image for the ancestor side of a ContentMergeViewer, - * or null if none - */ - Image getAncestorImage(Object input); - - /** - * Returns the contents for the ancestor side of a ContentMergeViewer. - * The interpretation of the returned object depends on the concrete ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the content for the ancestor side of a ContentMergeViewer, - * or null if none - */ - Object getAncestorContent(Object input); - - /** - * Returns whether the ancestor side of the given input element should be shown. - * - * @return true 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 ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the label for the left side of a ContentMergeViewer - */ - String getLeftLabel(Object input); - - /** - * Returns an optional image for the left side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the image for the left side of a ContentMergeViewer, - * or null if none - */ - Image getLeftImage(Object input); - - /** - * Returns the contents for the left side of a ContentMergeViewer. - * The interpretation of the returned object depends on the concrete ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the content for the left side of a ContentMergeViewer, - * or null if none - */ - Object getLeftContent(Object input); - - /** - * Returns whether the left side is editable. - * - * @param input the input object of the ContentMergeViewer - * @return true if the left side of a ContentMergeViewer is editable - */ - boolean isLeftEditable(Object input); - - /** - * Saves new contents for the left side of the ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @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 ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the label for the right side of a ContentMergeViewer - */ - String getRightLabel(Object input); - - /** - * Returns an optional image for the right side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the image for the right side of a ContentMergeViewer, - * or null if none - */ - Image getRightImage(Object input); - - /** - * Returns the contents for the right side of a ContentMergeViewer. - * The interpretation of the returned object depends on the concrete ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the content for the right side of a ContentMergeViewer, - * or null if none - */ - Object getRightContent(Object input); - - /** - * Returns whether the right side is editable. - * - * @param input the input object of the ContentMergeViewer - * @return true if the right side of a ContentMergeViewer is editable - */ - boolean isRightEditable(Object input); - - /** - * Saves new contents for the right side of the ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @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 8eb124e1c..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 IRangeComparator interface - * so that it can be used by the TextMergeViewer. - *

- * TextMergeViewer 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. - *

- * TextMergeViewer'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 - * TextMergeViewer.createTokenComparator factory method). - *

- * - * @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 5e83db18a..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java +++ /dev/null @@ -1,4042 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; -import java.util.ResourceBundle; -import java.io.UnsupportedEncodingException; -import java.text.MessageFormat; - -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.FontData; -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.ImageDescriptor; -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.preference.PreferenceConverter; -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.IWorkbenchActionConstants; - -import org.eclipse.compare.*; -import org.eclipse.compare.internal.CompareUIPlugin; -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 RangeDifferencer to perform a - * textual, line-by-line comparison of two (or three) input documents. - * It is based on the ContentMergeViewer and uses TextViewers - * to implement the ancestor, left, and right content areas. - *

- * 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 TextMergeViewer supports the notion of a current "differing range" - * and provides toolbar buttons to navigate from one range to the next (or previous). - *

- * If there is a current "differing range" and the underlying document is editable - * the TextMergeViewer enables actions in context menu and toolbar to - * copy a range from one side to the other side, thereby performing a merge operation. - *

- * In addition to a line-by-line comparison the TextMergeViewer - * 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. - *

- * The TextMergeViewer'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 ITokenComparator interface and overriding the - * TextMergeViewer.createTokenComparator factory method). - *

- * Access to the TextMergeViewer's model is by means of an - * IMergeViewerContentProvider. Its getXContent methods must return - * either an IDocument, an IDocumentRange, or an IStreamContentAccessor. - * In the IDocumentRange case the TextMergeViewer - * works on a subrange of a document. In the IStreamContentAccessor case - * a document is created internally and initialized from the stream. - *

- * A TextMergeViewer can be used as is. However clients may subclass - * to customize the behavior. For example a MergeTextViewer for Java would override - * the configureTextViewer method to configure the TextViewer for Java source code, - * the createTokenComparator 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= { - IWorkbenchActionConstants.UNDO, - IWorkbenchActionConstants.REDO, - IWorkbenchActionConstants.CUT, - IWorkbenchActionConstants.COPY, - IWorkbenchActionConstants.PASTE, - IWorkbenchActionConstants.DELETE, - IWorkbenchActionConstants.SELECT_ALL, - IWorkbenchActionConstants.SAVE - }; - 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 SYNC_SCROLLING= "SYNC_SCROLLING"; //$NON-NLS-1$ - - 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= 10; - /** Width of birds eye view */ - private static final int BIRDS_EYE_VIEW_INSET= 1; - /** */ - private static final int RESOLVE_SIZE= 5; - - /** line width of change borders */ - private static final int LW= 1; - /** Provide more merge controls in CompareViewerPane toolbar */ - private static final boolean USE_MORE_CONTROLS= true; - /** 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 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 Object fAncestorInput; - private Object fLeftInput; - private Object fRightInput; - - private MergeSourceViewer fAncestor; - private MergeSourceViewer fLeft; - private MergeSourceViewer fRight; - - private int fLeftLineCount; - private int fRightLineCount; - - private boolean fLeftContentsChanged; - private boolean fRightContentsChanged; - - 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= false; - private boolean fUseSingleLine= false; - private boolean fUseResolveUI= false; - - private ActionContributionItem fNextItem; // goto next difference - private ActionContributionItem fPreviousItem; // goto previous difference - private ActionContributionItem fCopyDiffLeftToRightItem; - private ActionContributionItem fCopyDiffRightToLeftItem; - - private boolean fSynchronizedScrolling= true; - private boolean fShowMoreInfo= false; - - private MergeSourceViewer fFocusPart; - - private boolean fSubDoc= true; - private IPositionUpdater fPositionUpdater; - private boolean fIsMotif; - - // SWT widgets - private BufferedCanvas fAncestorCanvas; - private BufferedCanvas fLeftCanvas; - private BufferedCanvas fRightCanvas; - private Canvas fScrollCanvas; - private ScrollBar fVScrollBar; - private Canvas fBirdsEyeCanvas; - private Label fSummaryCanvas; - - // SWT resources to be disposed - private Map fColors; - private Font fFont; - private Cursor fBirdsEyeCursor; - private Image fOKImage; - private Image fNOTOKImage; - - // points for center curves - private double[] fBasicCenterCurve; - - private Menu fCenterMenu; - private Button fCenterButton; - private Diff fButtonDiff; - - /** - * 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) { - //System.out.println("Diff.createPosition: " + start + " " + l); - } - - try { - doc.addPosition(IDocumentRange.RANGE_CATEGORY, p); - } catch (BadPositionCategoryException ex) { - } - return p; - } catch (BadLocationException ee) { - //System.out.println("Diff.createPosition: " + start + " " + end); - } - 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); - - String platform= SWT.getPlatform(); - fIsMotif= "motif".equals(platform); //$NON-NLS-1$ - - if (fIsMotif) - fMarginWidth= 0; - - fPreferenceStore= configuration.getPreferenceStore(); - if (fPreferenceStore != null) { - fPreferenceChangeListener= new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - TextMergeViewer.this.propertyChange(event); - } - }; - fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener); - - Display display= parent.getDisplay(); - updateFont(fPreferenceStore, display); - 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= 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); - } - - private void updateFont(IPreferenceStore ps, Display display) { - - Font oldFont= fFont; - - FontData fontData= null; - if (ps.contains(ComparePreferencePage.TEXT_FONT) - && !ps.isDefault(ComparePreferencePage.TEXT_FONT)) - fontData= PreferenceConverter.getFontData(ps, ComparePreferencePage.TEXT_FONT); - else - fontData= PreferenceConverter.getDefaultFontData(ps, ComparePreferencePage.TEXT_FONT); - if (fontData != null) { - fFont= new Font(display, fontData); - - if (fAncestor != null) - fAncestor.setFont(fFont); - if (fLeft != null) - fLeft.setFont(fFont); - if (fRight != null) - fRight.setFont(fFont); - - if (oldFont != null) - oldFont.dispose(); - } - } - - 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 null the system's default background color is used. - * @param background the background color or null 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 null the system's default foreground color is used. - * @param foreground the foreground color or null 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); - - 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 TextMergeViewer 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 ITokenComparator which is used to show the - * intra line differences. - * The TextMergeViewer 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 - * IStreamContentAccessor and an internal document must be created. This - * document is initialized with the partitioner returned from this method. - *

- * The TextMergeViewer implementation of this method returns - * null. Subclasses may reimplement to create a partitioner for a - * specific content type. - * - * @return a document partitioner, or null - */ - 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) { - - 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) { - if (fPreferenceStore != null) - fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener); - fPreferenceChangeListener= null; - } - - fLeftCanvas= null; - fRightCanvas= null; - fVScrollBar= null; - fBirdsEyeCanvas= null; - fSummaryCanvas= 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 (fFont != null) { - fFont.dispose(); - fFont= null; - } - if (fBirdsEyeCursor != null) { - fBirdsEyeCursor.dispose(); - fBirdsEyeCursor= null; - } - - if (fOKImage != null) { - fOKImage.dispose(); - fOKImage= null; - } - if (fNOTOKImage != null) { - fNOTOKImage.dispose(); - fNOTOKImage= 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) { - - // 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); - - fSummaryCanvas= new Label(composite, SWT.NONE); - /* - new Canvas(composite, SWT.NONE); - fSummaryCanvas.addPaintListener( - new PaintListener() { - public void paintControl(PaintEvent e) { - // TODO Auto-generated method stub - - } - } - ); - */ - 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); - - 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.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 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 x= 0; - 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 - } - - /** - * 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 { - canvas.addMouseMoveListener( - new MouseMoveListener() { - public void mouseMove(MouseEvent e) { - if (showResolveUI()) - handleMouseMoveOverCenter(canvas, e.x, e.y); - } - } - ); - - fCenterButton= new Button(canvas, "carbon".equals(SWT.getPlatform()) ? SWT.FLAT : SWT.PUSH); - 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, false); - } - } - } - ); - } - - return canvas; - } - return super.createCenter(parent); - } - - private void 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; - } - } - } - - /** - * 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); - } - } - ); - - if (fFont != null) - te.setFont(fFont); - - 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 null if there is no new input - * @param oldInput the old input element, or null if there was previously no input - * @return true 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; - - fLeftContentsChanged= false; - fRightContentsChanged= 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 - fLeftInput= left; - setDocument(fLeft, 'L', left); - fLeftLineCount= fLeft.getLineCount(); - - fRightInput= right; - setDocument(fRight, 'R', right); - fRightLineCount= fRight.getLineCount(); - - fAncestorInput= ancestor; - setDocument(fAncestor, 'A', ancestor); - - doDiff(); - - invalidateLines(); - updateVScrollBar(); - refreshBirdsEyeView(); - - if (!emptyInput && !fComposite.isDisposed()) { - // 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()) { - fLeftContentsChanged= true; - setLeftDirty(true); - } else if (doc == fRight.getDocument()) { - setRightDirty(true); - fRightContentsChanged= 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.getContents()); - } catch (CoreException ex) { - } - - 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) { - if (DEBUG) System.out.println("BadPositionCategoryException: " + ex); //$NON-NLS-1$ - } catch (BadLocationException ex) { - 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) { - } - - oldDoc.removeDocumentListener(fDocumentListener); - } - } - - /** - * Returns the contents of the underlying document as an array of bytes. - * - * @param left if true 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; - 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) - //scrollbarWidth= fScrollCanvas.computeTrim(0, 0, 0, 0).width; - scrollbarWidth= fLeft.getTextWidget().computeTrim(0, 0, 0, 0).width; - 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) { - if (fSummaryCanvas != null) - fSummaryCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, BIRDS_EYE_VIEW_WIDTH); - y+= scrollbarHeight; - fBirdsEyeCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, height-(3*scrollbarHeight)); - } - - // 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) { - } - - } - 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) { - } - 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) { - } - } - 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() { - Image c= null; - if (showResolveUI()) { - boolean hasIncoming= false; // we only show red or green if there is at least one incoming or conflicting change - boolean unresolved= false; - if (fChangeDiffs != null) { - Iterator e= fChangeDiffs.iterator(); - while (e.hasNext()) { - Diff d= (Diff) e.next(); - if (d.isIncomingOrConflicting()) { - hasIncoming= true; - if (!d.fResolved) { - unresolved= true; - break; - } - } - } - } - if (hasIncoming) { - if (unresolved) { - if (fNOTOKImage == null) { - ImageDescriptor id= CompareUIPlugin.getImageDescriptor("obj16/unresolved.gif"); //$NON-NLS-1$ - if (id != null) - fNOTOKImage= id.createImage(fSummaryCanvas.getDisplay()); - } - c= fNOTOKImage; - } else { - if (fOKImage == null) { - ImageDescriptor id= CompareUIPlugin.getImageDescriptor("obj16/resolved.gif"); //$NON-NLS-1$ - if (id != null) - fOKImage= id.createImage(fSummaryCanvas.getDisplay()); - } - c= fOKImage; - } - } - } - fSummaryCanvas.setImage(c); - } - - 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) { - } - } - } - 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) { - - 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$ - - 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$ - - - 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$ - } - - 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$ - } - } - - /* 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); - fBasicCenterCurve= null; - invalidateLines(); - - } else if (key.equals(ComparePreferencePage.USE_RESOLVE_UI)) { - fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI); - updateResolveStatus(); - invalidateLines(); - - } else if (key.equals(ComparePreferencePage.TEXT_FONT)) { - if (fPreferenceStore != null) { - updateFont(fPreferenceStore, fComposite.getDisplay()); - 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= ((double) 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 null - * 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 revealAndSelect is true 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, false); - } - break; - case RangeDifference.RIGHT: - if (!leftToRight) { - if (!compoundChangeStarted) { - target.beginCompoundChange(); - compoundChangeStarted= true; - } - copy(diff, leftToRight, false); - } - 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); - fRightContentsChanged= false; - } 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); - fLeftContentsChanged= false; - } - doDiff(); - invalidateLines(); - updateVScrollBar(); - selectFirstDiff(); - refreshBirdsEyeView(); - } - - private void copyDiffLeftToRight() { - copy(fCurrentDiff, true, false, false); - } - - private void copyDiffRightToLeft() { - copy(fCurrentDiff, false, false, false); - } - - /* - * Copy the contents of the given diff from one side to the other. - */ - private void copy(Diff diff, boolean leftToRight, boolean both, boolean gotoNext) { - if (copy(diff, leftToRight, both)) { - 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, boolean both) { - - 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: - s= fromDoc.get(fromStart, fromLen); - if (both) - s+= toDoc.get(toStart, toLen); - break; - } - if (s != null) { - toDoc.replace(toStart, toLen, s); - toPos.setOffset(toStart); - toPos.setLength(s.length()); - } - - } catch (BadLocationException e) { - } - } - - 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; - } -} \ No newline at end of file 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 6e7f9eaae..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties +++ /dev/null @@ -1,91 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== -# @(#)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. Try to 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 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 @@ - - - - - - - Package-level Javadoc - - -Support for compare and merge viewers which show the -content side-by-side. -

-Package Specification

- -The ContentMergeViewer 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 ImageMergeViewer in -package org.eclipse.compare.internal shows how to base a simple -mergeviewer for images on ContentMergeViewer. -

- -A ContentMergeViewer accesses its model by means of a content -provider which must implement the IMergeViewerContentProvider interface. -

- -The TextMergeViewer is the standard concrete subclass of -ContentMergeViewer for comparing and merging text content. -
-A text merge viewer uses the org.eclipse.compare.rangedifferencer.RangeDifferencer -to perform a textual, line-by-line comparison of two (or three) input documents. -For text lines that differ the TextMergeViewer uses an ITokenComparator -to find longest sequences of matching and non-matching tokens. -The TextMergeViewer'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 ITokenComparator interface. -

The TextMergeViewer not only works on whole documents but on -subranges of documents too. In this case the viewer's input must be an -IDocumentRange instead of an IDocument. - - - 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 ffb82dd64..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 7f5f94b83..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.IActionDelegate; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - - -public class AddFromHistoryAction implements IActionDelegate { - - private static final String BUNDLE_NAME= "org.eclipse.compare.internal.AddFromHistoryAction"; //$NON-NLS-1$ - - private ISelection fSelection; - - public AddFromHistoryAction() { - } - - public void selectionChanged(IAction a, ISelection s) { - fSelection= s; - } - - public void run(IAction action) { - - 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(fSelection); - - 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(IContainer.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); - - 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 4c3e7dbcd..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties +++ /dev/null @@ -1,39 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 a0629fe62..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java +++ /dev/null @@ -1,449 +0,0 @@ -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, IStreamContentAccessor, 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 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) { - } - } - 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; - private CompareViewerSwitchingPane fStructuredComparePane; - - - 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]= (IFile) 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 parent) { - - 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 - org.eclipse.compare.Splitter hsplitter= new org.eclipse.compare.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); - - 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 vsplitter; - } - - /** - * Feeds selection from member viewer to edition viewer. - */ - private void handleMemberSelect(Widget w) { - Object 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/BinaryCompareViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java deleted file mode 100644 index 692341d66..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.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) { - - 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) { - } - } - if (right != null) { - try { - right.close(); - } catch (IOException ex) { - } - } - } - 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 5a909ee30..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 BinaryCompareViewer. - * 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 adf51c207..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties +++ /dev/null @@ -1,16 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 af6b59d02..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 { - - /** 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. - * @private - */ - void doubleBufferPaint(GC dest) { - - Point size= getSize(); - - if (size.x <= 0 || size.y <= 0) - 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 d0c6c2f52..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ResourceNode 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) { - 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= Utilities.readBytes(is); - if (bytes != null) - dst.setContent(bytes); - } catch (CoreException ex) { - } - } - 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 93fe3ab91..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ICompareConfiguration. - */ -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 d3aea03f8..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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; - } -} \ No newline at end of file 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 3e0854ec0..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; - -import org.eclipse.ui.IActionDelegate; -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareUI; - - -public class CompareAction implements IActionDelegate { - - private ResourceCompareInput fInput; - - public void run(IAction action) { - if (fInput != null) { - fInput.initializeCompareConfiguration(); - CompareUI.openCompareEditor(fInput); - fInput= null; // don't reuse this input! - } - } - - public void selectionChanged(IAction action, 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)); - - fInput= new ResourceCompareInput(cc); - } - action.setEnabled(fInput.setSelection(selection)); - } -} 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 a1f95a0ae..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - } - - 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 parent) { - - Control c= fCompareEditorInput.createContents(parent); - c.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Shell shell= c.getShell(); - shell.setText(fCompareEditorInput.getTitle()); - shell.setImage(fCompareEditorInput.getTitleImage()); - - return c; - } - - /* (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) { - } catch (OperationCanceledException x) { - } 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 37eec48db..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.widgets.*; - -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.part.EditorPart; - -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 IPropertyChangeListener { - - public final static String CONFIRM_SAVE_PROPERTY= "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY"; //$NON-NLS-1$ - - private IActionBars fActionBars; - - - public CompareEditor() { - } - - /* 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$ - - CompareEditorInput cei= (CompareEditorInput) input; - - setSite(site); - setInput(input); - - setTitleImage(cei.getTitleImage()); - setTitle(cei.getTitle()); - - if (input instanceof IPropertyChangeNotifier) - ((IPropertyChangeNotifier)input).addPropertyChangeListener(this); - } - - 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) - ((CompareEditorInput) input).createContents(parent); - } - - /* - * @see DesktopPart#dispose - */ - public void dispose() { - - IEditorInput input= getEditorInput(); - if (input instanceof IPropertyChangeNotifier) - ((IPropertyChangeNotifier)input).removePropertyChangeListener(this); - - super.dispose(); - } - - /* - * @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) { - } catch (OperationCanceledException x) { - } 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) { - if (isDirty()) - 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 ae6392730..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; - -import org.eclipse.jface.action.*; - -import org.eclipse.ui.*; -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); - fNext= new NavigationAction(bundle, true); - fPrevious= new NavigationAction(bundle, false); - fToolbarNext= new NavigationAction(bundle, true); - fToolbarPrevious= new NavigationAction(bundle, false); - } - - /* - * @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(IWorkbenchActionConstants.NEXT, fNext); - actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, fPrevious); - - CompareConfiguration cc= editor.getCompareConfiguration(); - fIgnoreWhitespace.setCompareConfiguration(cc); - } - } -} 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 5ffe65594..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2002. - * All Rights Reserved. - */ -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 315b0f548..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties +++ /dev/null @@ -1,52 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2002. -# All Rights Reserved. -# ===================================== - -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 74cfa18cd..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.dialogs.MessageDialog; - -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 { - - 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 void 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; - } - // beep - if (fPanes[0] != null) { - Control c= fPanes[0].getContent(); - if (c != null) { - Display display= c.getDisplay(); - if (display != null) - display.beep(); - - String title; - String message; - if (next) { - 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(c.getShell(), title, message); - } - } - } - - 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/ComparePreferencePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java deleted file mode 100644 index db6e783f5..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.*; -import java.io.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.jface.preference.*; -import org.eclipse.jface.util.*; - -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.IHelpContextIds; -import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; -import org.eclipse.ui.texteditor.AbstractTextEditor; - -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, IStreamContentAccessor { - 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(fContent.getBytes()); - } - }; - - 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 TEXT_FONT= PREFIX + "TextFont"; //$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$ - - - private WorkbenchChainedTextFontFieldEditor fFontEditor; - 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.STRING, TEXT_FONT), - new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE), - - 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), - }; - - - 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(USE_SPLINES, false); - store.setDefault(USE_SINGLE_LINE, false); - store.setDefault(USE_RESOLVE_UI, false); - - store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); - - WorkbenchChainedTextFontFieldEditor.startPropagate(store, TEXT_FONT); - } - - 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() { - fFontEditor.store(); - fOverlayStore.propagate(); - return true; - } - - /* - * @see PreferencePage#performDefaults() - */ - protected void performDefaults() { - - fFontEditor.loadDefault(); - - fOverlayStore.loadDefaults(); - initializeFields(); - - super.performDefaults(); - } - - /* - * @see DialogPage#dispose() - */ - public void dispose() { - - fFontEditor.setPreferencePage(null); - fFontEditor.setPreferenceStore(null); - - 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) { - - 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(); - - WorkbenchHelp.setHelp(parent, IHelpContextIds.COMPARE_VIEWERS_PREFERENCE_PAGE); - - 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$ - - 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$ - - 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$ - - fFontEditor= addTextFontEditor(composite, "ComparePreferencePage.textFont.label", TEXT_FONT); //$NON-NLS-1$ - fFontEditor.setPreferenceStore(getPreferenceStore()); - fFontEditor.setPreferencePage(this); - fFontEditor.load(); - - 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(80); - gd.heightHint= convertHeightInCharsToPixels(15); - 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("previewAncestor.txt"), //$NON-NLS-1$ - new FakeInput("previewLeft.txt"), //$NON-NLS-1$ - new FakeInput("previewRight.txt") //$NON-NLS-1$ - ) - ); - - return fPreviewViewer.getControl(); - } - - 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 WorkbenchChainedTextFontFieldEditor addTextFontEditor(Composite parent, String labelKey, String key) { - - String label= Utilities.getString(labelKey); - - Group group= new Group(parent, SWT.NULL); - group.setText(label); - GridLayout layout= new GridLayout(); - layout.numColumns= 3; - layout.marginWidth+= 3; - group.setLayout(layout); - WorkbenchChainedTextFontFieldEditor fe= new WorkbenchChainedTextFontFieldEditor(key, "", group); //$NON-NLS-1$ - - GridData gd= new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan= 2; - group.setLayoutData(gd); - - return fe; - } - - 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 filename) { - String separator= System.getProperty("line.separator"); //$NON-NLS-1$ - StringBuffer buffer= new StringBuffer(512); - BufferedReader reader= null; - try { - reader= new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename))); - String line; - while ((line= reader.readLine()) != null) { - buffer.append(line); - buffer.append(separator); - } - } catch (IOException io) { - CompareUIPlugin.log(io); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - } - } - } - 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 aec4cfb5e..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java +++ /dev/null @@ -1,859 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.MalformedURLException; -import java.lang.reflect.InvocationTargetException; -import java.util.*; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.preference.IPreferenceStore; - -import org.eclipse.core.runtime.*; -import org.eclipse.ui.model.IWorkbenchAdapter; -import org.eclipse.ui.*; -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.ui.plugin.AbstractUIPlugin; - - -/** - * 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. - *

- * 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. - *

- * This class is the plug-in runtime class for the - * "org.eclipse.compare" plug-in. - *

- */ -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; - - /** - * Creates the CompareUIPlugin object and registers all - * structure creators, content merge viewers, and structure merge viewers - * contributed to this plug-in's extension points. - *

- * Note that instances of plug-in runtime classes are automatically created - * by the platform in the course of plug-in activation. - *

- * - * @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) { - } - 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 null if - * no active workkbench page can be determined. - * - * @return the active workkbench page or null 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 null if - * no workbench window is active. - * - * @return the SWT Shell of the active workbench window, or null 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: - * '.' ' ' '.' ... - */ - 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()); - } - - 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 - * @see CompareEditorInput - */ - public void openCompareEditor(CompareEditorInput input) { - - if (compareResultOK(input)) { - IWorkbenchPage activePage= getActivePage(); - if (activePage != null) { - try { - activePage.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 true if compare result is OK to show, false 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. - *

- * 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. - *

- * - * @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 IWorkbenchAdapter.getImageDescriptor, which it - * uses to create an image if it does not already have one. - *

- * 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. - *

- * - * @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) { - } - 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 null 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 null 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 null - */ - 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 type= getType(input); - if (type == null) - return null; - - 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 null 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 null - */ - 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 type= getType(input); - type= normalizeCase(type); - - if (ITypedElement.FOLDER_TYPE.equals(type)) - return 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; - } - - /** - * 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 String getType(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); - } - boolean homogenous= false; - switch (cnt) { - case 1: - homogenous= true; - break; - case 2: - homogenous= types[0].equals(types[1]); - break; - case 3: - homogenous= types[0].equals(types[1]) && types[1].equals(types[2]); - break; - } - if (homogenous) - return types[0]; - return null; - } - - /** - * 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 null if the input isn't an IStreamContentAccessor. - */ - 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) { - } - } - } - return ITypedElement.UNKNOWN_TYPE; - } - return null; - } - - private static IViewerDescriptor getContentViewerDescriptor2(String type) { - return (IViewerDescriptor) fgContentMergeViewerDescriptors.get(normalizeCase(type)); - } - - 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"); - 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 + ">"); - } - } - } - } - } - - 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(); - } -} 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 06f195194..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -public class CompareWithEditionAction extends EditionAction { - - public CompareWithEditionAction() { - super(false, "org.eclipse.compare.internal.CompareWithEditionAction"); //$NON-NLS-1$ - } -} - 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 67a8be8e2..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties +++ /dev/null @@ -1,32 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ==================================== - -# @(#)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 aa3e21137..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 be2b9155b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.jface.text.*; -import org.eclipse.compare.contentmergeviewer.ITokenComparator; -import org.eclipse.compare.rangedifferencer.IRangeComparator; - -/** - * Implements the IRangeComparator interface for lines in a document. - * A DocLineComparator is used as the input for the RangeDifferencer - * engine to perform a line oriented compare on documents. - *

- * A DocLineComparator doesn't know anything about line separators because - * its notion of lines is solely defined in the underlying IDocument. - */ -public class DocLineComparator implements ITokenComparator { - - private IDocument fDocument; - private int fLineOffset; - private int fLineCount; - private int fLength; - private boolean fIgnoreWhiteSpace; - - /** - * Creates a DocLineComparator for the given document range. - * ignoreWhiteSpace controls whether comparing lines (in method - * rangesEqual) should ignore whitespace. - * - * @param document the document from which the lines are taken - * @param region if non-null only lines within this range are taken - * @param ignoreWhiteSpace if true 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) { - } - - if (fLength == 0) - fLineCount= 0; - else { - int endLine= fDocument.getNumberOfLines(); - try { - endLine= fDocument.getLineOfOffset(start + fLength); - } catch (BadLocationException ex) { - } - 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 true if a line given by the first index - * matches a line specified by the other IRangeComparator 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 true 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 true 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) { - } - } - return ""; //$NON-NLS-1$ - } - - private boolean compare(String s1, String s2) { - int i1= 0; - int i2= 0; - int l1= s1.length(); - int l2= s2.length(); - char c1= ' '; - char c2= ' '; - while (i1 < l1 || i2 < l2) { - if (i1 < l1) { - c1= s1.charAt(i1); - if (Character.isWhitespace(c1)) { - i1++; - continue; - } - } - if (i2 < l2) { - c2= s2.charAt(i2); - if (Character.isWhitespace(c2)) { - i2++; - continue; - } - } - if (c1 != c2) - return false; - i1++; - i2++; - } - 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 47338251b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 bfc9df986..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.io.InputStream; -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -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.action.IAction; -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 implements IActionDelegate { - - /** - * Implements the IStreamContentAccessor and ITypedElement protocols - * for a Document. - */ - class DocumentBufferNode implements ITypedElement, IStreamContentAccessor { - - private IDocument fDocument; - private String type; - 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(fDocument.get().getBytes()); - } - } - - private ISelection fSelection; - private String fBundleName; - private boolean fReplaceMode; - protected boolean fPrevious= false; - - EditionAction(boolean replaceMode, String bundleName) { - fReplaceMode= replaceMode; - fBundleName= bundleName; - } - - public final void selectionChanged(IAction action, ISelection selection) { - fSelection= selection; - if (action != null) { - IFile[] files= getFiles(selection, fReplaceMode); - action.setEnabled(files.length == 1); // we don't support multiple selection for now - } - } - - public void run(IAction action) { - IFile[] files= getFiles(fSelection, fReplaceMode); - 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 (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; - 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 { - InputStream is= sa.getContents(); - String text= Utilities.readString(is); - 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; - } - - private IFile[] getFiles(ISelection selection, boolean modifiable) { - ArrayList result= new ArrayList(); - Object[] s= Utilities.toArray(selection); - for (int i= 0; i < s.length; i++) { - Object o= s[i]; - IFile file= null; - if (o instanceof IFile) { - file= (IFile) o; - } else if (o instanceof IAdaptable) { - IAdaptable a= (IAdaptable) o; - Object adapter= a.getAdapter(IResource.class); - if (adapter instanceof IFile) - file= (IFile) adapter; - } - if (file != null) { - if (modifiable) { - if (!file.isReadOnly()) - result.add(file); - } else { - result.add(file); - } - } - } - return (IFile[]) result.toArray(new IFile[result.size()]); - } - - -} - 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 1d0d4ea18..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 CoreException an error dialog - * pops up showing the exception's status information. For a InvocationTargetException - * 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 JavaStatusConstants.INTERNAL_ERROR. - */ - public static void log(Throwable t, String message) { - CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(), - CompareUIPlugin.INTERNAL_ERROR, message, t)); - } - - /** - * Handles the given CoreException. The workbench shell is used as a parent - * for the dialog window. - * - * @param e the CoreException 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 CoreException. - * - * @param e the CoreException 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 InvocationTargetException. The workbench shell is used - * as a parent for the dialog window. - * - * @param e the InvocationTargetException 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 InvocationTargetException. - * - * @param e the InvocationTargetException 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/INavigatable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java deleted file mode 100644 index 93f6850fd..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 d89af1917..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IOpenable.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 International Business Machines Corp. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM 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 579e9cd88..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 6ee209225..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.compare.structuremergeviewer.IStructureCreator; - -/** - * A factory object for creating IStructureCreators from a descriptor. - *

- * It is used when registering IStructureCreator for types - * in CompareUIPlugin.registerStructureCreator. - *

- * - * @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 7ae836e9f..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 Viewers from a descriptor. - *

- * It is used when registering a viewer for a specific type - * in CompareUIPlugin.registerContentViewerDescriptor and - * in CompareUIPlugin.registerStructureViewerDescriptor. - * - * @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 a9f17141c..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; - -import org.eclipse.compare.*; - -/** - * Toggles the ICompareConfiguration.IGNORE_WS property of an - * ICompareConfiguration. - */ -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 1681ddcfa..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * A Canvas showing a single centered SWT Image. - * If the Image is larger than the Canvas, - * Scrollbars 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 2439c6b46..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.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 fAncestorImage; - 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); - 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) { - - fAncestorImage= ancestor; - 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) { - } - } - } - - Image image= null; - Display display= canvas.getDisplay(); - if (stream != null) { - try { - image= new Image(display, stream); - } catch (SWTException ex) { - } - } - - 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) { - } - } - } - } - - 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 01397c7cf..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ImageMergeViewer. - * 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 aeac6a027..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties +++ /dev/null @@ -1,26 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 7048f4f49..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - } -} \ No newline at end of file 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 986326a85..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - 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 28f04492b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 fInitialized= true; - 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) { - } - } - } - - 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) { - } - try { - endLine= doc.getLineOfOffset(start+length); - } catch(BadLocationException ex) { - } - - 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) { - } - } - 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) { - } - - 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) { - } - 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 52269f883..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 711b52cbb..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ContentMergeViewer to work on an ICompareInput - * e.g. a DiffNode. - */ -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 (((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 1c496b311..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.compare.internal; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; - -import org.eclipse.compare.CompareViewerSwitchingPane; - -/** - * 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); - - CompareViewerSwitchingPane.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 002346a8b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -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); - } -} \ No newline at end of file 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 dc9661d6b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - - -public class ReplaceWithEditionAction extends EditionAction { - - public ReplaceWithEditionAction() { - super(true, "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$ - } -} 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 51aac98d8..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties +++ /dev/null @@ -1,34 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 1f5fc651d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 26e5fe34d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java +++ /dev/null @@ -1,136 +0,0 @@ -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.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; - - - public ResizableDialog(Shell parent, ResourceBundle bundle) { - super(parent); - setShellStyle(getShellStyle() | SWT.RESIZE); - - fBundle= bundle; - - fSettings= CompareUIPlugin.getDefault().getDialogSettings(); - } - - 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 614790a0d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.text.MessageFormat; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.widgets.Composite; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - -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; - - - 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; - } - } - - /** - * Creates an compare editor input for the given selection. - */ - ResourceCompareInput(CompareConfiguration config) { - super(config); - } - - public Viewer createDiffViewer(Composite parent) { - Viewer v= super.createDiffViewer(parent); - if (v instanceof DiffTreeViewer) - fDiffViewer= (DiffTreeViewer) v; - return v; - } - - /** - * Returns true if compare can be executed for the given selection. - */ - boolean setSelection(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]; - } - - fAncestor= null; - fLeft= getStructure(fLeftResource); - fRight= getStructure(fRightResource); - - if (incomparable(fLeft, fRight)) - return false; - - if (fThreeWay) { - fAncestorResource= selection[0]; - fAncestor= getStructure(fAncestorResource); - - if (incomparable(fAncestor, fRight)) - 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 the given arguments cannot be compared. - */ - private boolean incomparable(IStructureComparator c1, IStructureComparator c2) { - if (c1 == null || c2 == null) - return true; - return isLeaf(c1) != isLeaf(c2); - } - - /** - * Returns true if the given arguments is a leaf. - */ - private boolean isLeaf(IStructureComparator c) { - if (c instanceof ITypedElement) { - ITypedElement te= (ITypedElement) c; - return !ITypedElement.FOLDER_TYPE.equals(te.getType()); - } - return false; - } - - /** - * Creates a IStructureComparator for the given input. - * Returns null if no IStructureComparator - * can be found for the IResource. - */ - private IStructureComparator getStructure(IResource input) { - - if (input instanceof IContainer) - return new BufferedResourceNode(input); - - if (input instanceof IFile) { - IStructureComparator rn= new BufferedResourceNode(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(); - } - } - - private String buildLabel(IResource r) { - //return r.getName(); - 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 abf8efe3d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; - -import org.eclipse.compare.*; - -/** - * Toggles the ICompareConfiguration.SHOW_PSEUDO_CONFLICTS property of an - * ICompareConfiguration. - */ -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 31adfe1a8..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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= ((ICompareInput) fInput).getLeft(); - fSourceViewer.setDocument(new Document(getString(left))); - } - } - - public Object getInput() { - return fInput; - } - - private String getString(Object input) { - - if (input instanceof IStreamContentAccessor) { - IStreamContentAccessor sca= (IStreamContentAccessor) input; - try { - return Utilities.readString(sca.getContents()); - } catch (CoreException ex) { - } - } - 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 c33ac3c76..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved - */ -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; iTextMergeViewer. - * 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 e1c22cf8d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 TextMergeViewer. - * 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); - } -} \ No newline at end of file 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 986f45361..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - - 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) { - } - - 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 6e8bb17e0..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ITokenComparator interface for words (or tokens) - * in a string. - * A TokenComparator is used as the input for the RangeDifferencer - * 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 TokenComparator 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 TokenComparator 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 true if a token given by the first index - * matches a token specified by the other IRangeComparator 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 true 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 true 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 c892df46d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.io.*; -import java.text.MessageFormat; -import java.util.*; - -import org.eclipse.swt.widgets.*; - -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.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; - -import org.eclipse.ui.*; - -import org.eclipse.compare.CompareConfiguration; - -/** - * Convenience and utility methods. - */ -public class Utilities { - - 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(); - } - - public static boolean isMotif() { - return false; - } - - /** - * Returns the elements of the given selection. - * Returns an empty array if the selection is empty or if - * the given selection is not of type IStructuredSelection. - * - * @param selection the selection - * @return the selected elements - */ - public static Object[] toArray(ISelection selection) { - if (!(selection instanceof IStructuredSelection)) { - return new Object[0]; - } - IStructuredSelection ss= (IStructuredSelection) selection; - return ss.toArray(); - } - - /** - * Convenience method: extract all IResources from given selection. - * Never returns null. - */ - public static IResource[] getResources(ISelection selection) { - - ArrayList tmp= new ArrayList(); - - if (selection instanceof IStructuredSelection) { - - Object[] s= ((IStructuredSelection)selection).toArray(); - - for (int i= 0; i < s.length; i++) { - Object o= s[i]; - if (o instanceof IResource) { - tmp.add(o); - continue; - } - if (o instanceof IAdaptable) { - IAdaptable a= (IAdaptable) o; - Object adapter= a.getAdapter(IResource.class); - if (adapter instanceof IResource) - tmp.add(adapter); - continue; - } - } - } - return (IResource[]) tmp.toArray(new IResource[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) { - } - } - try { - bos.close(); - } catch (IOException x) { - } - } - - return bos.toByteArray(); - } - - /** - * Returns null if an error occurred. - */ - public static String readString(InputStream is) { - 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, ResourcesPlugin.getEncoding())); - - while ((read= reader.read(part)) != -1) - buffer.append(part, 0, read); - - return buffer.toString(); - - } catch (IOException ex) { - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ex) { - } - } - } - return null; - } - - 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) { - } - } - 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) { - } - } - 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) { - } catch (MissingResourceException x) { - } - } - return dfltValue; - } - - /** - * Answers true if the given selection contains resources that don't - * have overlapping paths and false 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; - } - */ -} 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 8a7c7acf0..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 Viewers from an IConfigurationElement. - */ -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) { - } - } - - 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 81208e39c..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java +++ /dev/null @@ -1,7 +0,0 @@ -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 1fbb4fc7a..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.action.IAction; -import org.eclipse.jface.dialogs.Dialog; -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.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - -import org.eclipse.ui.IActionDelegate; -import org.eclipse.ui.IEditorPart; - -import org.eclipse.compare.internal.*; - - -public class CompareWithPatchAction implements IActionDelegate { - - static class PatchWizardDialog extends WizardDialog { - - PatchWizardDialog(Shell parent, IWizard wizard) { - super(parent, wizard); - - setShellStyle(getShellStyle() | SWT.RESIZE); - setMinimumPageSize(700, 500); - } - } - - private ISelection fSelection; - private boolean fSavedFiles; - private boolean fAutobuildState; - - - public void selectionChanged(IAction action, ISelection selection) { - fSelection= selection; - IResource[] resources= PatchWizard.getResource(fSelection); - action.setEnabled(resources != null && resources.length == 1); - } - - public void run(IAction action) { - PatchWizard wizard= new PatchWizard(fSelection); - - 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()); - fSavedFiles= true; - } 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()); - } - } - ); - 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() == Dialog.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 9d1c9f5ec..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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((Hunk[]) 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 77211f319..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 fIsEnabled2= 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 fIsEnabled2; - } - - void setEnabled(boolean b) { - fIsEnabled2= b; - } - - 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: - *

    - *
  • - * '+': add the line - *
  • - * '-': delete the line - *
  • - * ' ': no change, context line - *
- */ - 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 37b7afe57..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java +++ /dev/null @@ -1,621 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.util.*; - -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.viewers.*; -import org.eclipse.jface.wizard.*; - -import org.eclipse.ui.help.*; -import org.eclipse.ui.model.*; - -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; - - private final static int SIZING_SELECTION_WIDGET_WIDTH= 400; - private final static int SIZING_SELECTION_WIDGET_HEIGHT= 150; - - // dialog store id constants - private final static String PAGE_NAME= "PatchWizardPage1"; //$NON-NLS-1$ - private final static String STORE_PATCH_FILE_ID= PAGE_NAME + ".PATCH_FILE"; //$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$ - - // help IDs - private final static String PATCH_HELP_CONTEXT_ID= "PatchWizardHelpId"; //$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(); - - WorkbenchHelp.setHelp(composite, PATCH_HELP_CONTEXT_ID); - } - - /* (non-JavaDoc) - * Method declared in IWizardPage. - */ - public IWizardPage getNextPage() { - if (true) { - - Patcher patcher= ((PatchWizard) getWizard()).getPatcher(); - - // 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); - } - } 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$ - } - } - } - - // 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) { - } - } - - Diff[] diffs= patcher.getDiffs(); - if (diffs == null || diffs.length == 0) { - String source= getUseClipboard() ? "Clipboard" //$NON-NLS-1$ - : "File"; //$NON-NLS-1$ - MessageDialog.openError(null, - PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), //$NON-NLS-1$ - PatchMessages.getString("InputPatchPage.NoDiffsFound_"+source+".message")); //$NON-NLS-1$ //$NON-NLS-2$ - return this; - } - - // guess prefix count - int guess= guessPrefix(diffs); - patcher.setStripPrefixSegments(guess); - } - return super.getNextPage(); - } - - private int guessPrefix(Diff[] diffs) { - /* - ArrayList list= new ArrayList(); - IResource target= fPatchWizard.getTarget(); - if (target instanceof IFile) { - list.add(target.getFullPath()); - } else if (target instanceof IContainer) { - addLeaf(list, (IContainer) target); - } - - // guess prefix count - for (int i= 0; i < diffs.length; i++) { - IPath p= diffs[i].fOldPath; - if (p != null) { - int matches= match(p, list); - if (matches > 0) { - return p.segmentCount() - matches; - } - } - } - */ - return 0; - } - - private int match(IPath path, ArrayList list) { - Iterator iter= list.iterator(); - while (iter.hasNext()) { - IPath filePath= (IPath) iter.next(); - int matches= matchTrailingSegments(path, filePath); - if (matches > 0) - return matches; - } - return 0; - } - - private int matchTrailingSegments(IPath p1, IPath p2) { - int matches= 0; - int i1= p1.segmentCount()-1; - int i2= p2.segmentCount()-1; - for (; i1 >= 0 && i2 >= 0; i1--, i2--) { - String s1= p1.segment(i1); - String s2= p2.segment(i2); - if (!s1.equals(s2)) - break; - matches++; - } - return matches; - } - - private void addLeaf(ArrayList list, IContainer c) { - IResource[] rs= null; - try { - rs= c.members(); - } catch(CoreException ex) { - } - if (rs != null) { - for (int i= 0; i < rs.length; i++) { - IResource r= rs[i]; - if (r instanceof IFile) - list.add(r.getFullPath()); - else if (r instanceof IContainer) - addLeaf(list, (IContainer) r); - } - } - } - - /* (non-JavaDoc) - * Method declared in IWizardPage. - */ - public boolean canFlipToNextPage() { - if (true) { - // 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(); - } else { - return super.canFlipToNextPage(); - } - } - - 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(PatchWizard.getResource(event.getSelection())); - updateWidgetEnablements(); - } - } - ); - //fPatchFileNameField.setFocus(); - } - - /** - * Returns a content provider for IResources that returns - * only children of the given resource type. - */ - private ITreeContentProvider getResourceProvider(final int resourceType) { - return new WorkbenchContentProvider() { - public Object[] getChildren(Object o) { - if (o instanceof IContainer) { - try { - ArrayList results= new ArrayList(); - IResource[] members= ((IContainer)o).members(); - for (int i= 0; i < members.length; i++) - // filter out the desired resource types - if ((members[i].getType() & resourceType) != 0) - results.add(members[i]); - return results.toArray(); - } catch (CoreException e) { - } - } - // just return an empty set of children - return new Object[0]; - } - }; - } - - /** - * 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$ - } - - /** - * Creates a new label with a bold font. - * - * @param parent the parent control - * @param text the label text - * @return the new label control - */ - private static Label buildPlainLabel(Composite parent, String text) { - Label label= new Label(parent, SWT.NONE); - label.setText(text); - GridData data= new GridData(); - data.verticalAlignment= GridData.FILL; - data.horizontalAlignment= GridData.FILL; - label.setLayoutData(data); - return label; - } - - /** - * 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 COMBO_HISTORY_LENGTH. - * - * @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 a592ab176..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 null 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) { - } - } - - /* package */ List readLines() { - try { - List lines= new ArrayList(); - String line; - while ((line= readLine()) != null) - lines.add(line); - return lines; - } catch (IOException ex) { - //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/PatchCompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareInput.java deleted file mode 100644 index 938a98e36..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareInput.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.io.ByteArrayInputStream; -import java.text.MessageFormat; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.core.runtime.*; -import org.eclipse.core.resources.*; - -import org.eclipse.jface.viewers.*; - -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.compare.internal.*; - - -/** - * A PatchCompareInput uses a Patcher to - * patch selected workspace resources. - */ -/* package */ class PatchCompareInput extends CompareEditorInput { - - static class Rejected extends DiffNode implements IStreamContentAccessor { - Diff fDiff; - String fName; - Rejected(IDiffContainer parent, String name, Diff diff) { - super(parent, Differencer.NO_CHANGE); - fName= name; - fDiff= diff; - } - public String getName() { - return fName + " *"; //$NON-NLS-1$ - } - public String getType() { - return "txt"; //$NON-NLS-1$ - } - public Image getImage() { - return CompareUI.getImage("file"); //$NON-NLS-1$ - } - public InputStream getContents() { - return new ByteArrayInputStream(fDiff.fRejected.getBytes()); - } - } - - private DiffNode fRoot; - private IResource fTarget; - private Patcher fPatcher; - - /** - * Creates an compare editor input for the given selection. - */ - /* package */ PatchCompareInput(CompareConfiguration config, Patcher patcher, ISelection selection) { - super(config); - fPatcher= patcher; - IResource[] s= Utilities.getResources(selection); - if (s.length == 1) - fTarget= s[0]; - - if (fPatcher != null) { - String rformat= PatchMessages.getString("PatchCompareInput.RightTitle.format"); //$NON-NLS-1$ - String rightLabel= MessageFormat.format(rformat, new String[] { fPatcher.getName() } ); - config.setRightLabel(rightLabel); - //cc.setRightImage(CompareUIPlugin.getImage(fRightResource)); - } - - if (fTarget != null) { - String leftLabel= fTarget.getName(); - config.setLeftLabel(leftLabel); - config.setLeftImage(CompareUIPlugin.getImage(fTarget)); - } - } - - /** - * Performs a two-way or three-way diff on the current selection. - */ - public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException { - - try { - Diff[] diffs= fPatcher.getDiffs(); - - pm.beginTask(Utilities.getString("ResourceCompare.taskName"), diffs.length); //$NON-NLS-1$ - - fRoot= new DiffNode(0); - IContainer rootFolder= null; - if (fTarget instanceof IContainer) - rootFolder= (IContainer) fTarget; - - for (int i= 0; i < diffs.length; i++) { - Diff diff= diffs[i]; - if (diff.isEnabled()) { - IPath path= fPatcher.getPath(diff); - createPath(fRoot, rootFolder, path, diff, false); - - String rej= diff.fRejected; - if (rej != null) { - IPath pp= path.removeLastSegments(1); - pp= pp.append(path.lastSegment() + ".rej"); //$NON-NLS-1$ - createPath(fRoot, rootFolder, pp, diff, true); - } - } - pm.worked(1); - } - - fTarget.refreshLocal(IResource.DEPTH_INFINITE, pm); - - String leftLabel= fTarget.getName(); - - String rformat= PatchMessages.getString("PatchCompareInput.RightTitle.format"); //$NON-NLS-1$ - String rightLabel= MessageFormat.format(rformat, new String[] { fPatcher.getName() } ); - - String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$ - String title= MessageFormat.format(format, new String[] {leftLabel, rightLabel} ); - setTitle(title); - - return fRoot; - - } catch (CoreException ex) { - throw new InvocationTargetException(ex); - } finally { - pm.done(); - } - } - - public void saveChanges(IProgressMonitor pm) throws CoreException { - if (fRoot instanceof DiffNode) { - try { - commit(pm, (DiffNode) fRoot); - } finally { - setDirty(false); - } - } - } - - /* - * Recursively walks the diff tree and commits all changes. - */ - private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - - ITypedElement left= node.getLeft(); - if (left instanceof 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 void createPath(DiffContainer root, IContainer folder, IPath path, Diff diff, boolean reject) { - if (path.segmentCount() > 1) { - IFolder f= folder.getFolder(path.uptoSegment(1)); - IDiffElement child= root.findChild(path.segment(0)); - if (child == null) { - ResourceNode rn= new ResourceNode(f); - child= new DiffNode(root, Differencer.CHANGE, null, rn, rn); - } - if (child instanceof DiffContainer) - createPath((DiffContainer)child, f, path.removeFirstSegments(1), diff, reject); - } else { - // a leaf - BufferedResourceNode rn= new BufferedResourceNode(folder.getFile(path)); - if (reject) { - new Rejected(root, path.segment(0), diff); - } else { - new DiffNode(root, diff.getType(), null, rn, new PatchedResource(rn, diff, path, fPatcher)); - } - } - } -} - - 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 faae17288..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 648ef156c..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2002. - * All Rights Reserved. - */ -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 a407ec0e9..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties +++ /dev/null @@ -1,79 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2002. -# All Rights Reserved. -# ===================================== - -# -# '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 must be saved before this operation.\nPress OK to confirm or Cancel otherwise - -# -# PatchWizard -# -PatchWizard.title=Resource Patcher -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 what resource to patch with which patch -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=Nothing selected to apply patch to -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.NoDiffsFound_Clipboard.message=Clipboard does not contain valid patch -InputPatchPage.NoDiffsFound_File.message=File does not contain valid patch - -# -# PreviewPatchPage -# -PreviewPatchPage.title= Verify Patch -PreviewPatchPage.message= The tree shows the contents of the patch.\nA checked item indicates that a patch could be applied successfully. Uncheck an item if you want to exclude it. -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) - -# -# 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 f966cc568..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; - -import org.eclipse.swt.graphics.Image; - -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.*; -import org.eclipse.compare.internal.*; -import org.eclipse.compare.structuremergeviewer.Differencer; - - -/* 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 PreviewPatchPage fPreviewPatchPage; - - private Patcher fPatcher; - private IResource fTarget; - - - /** - * Creates a wizard for applying a patch file to the workspace. - */ - /* package */ PatchWizard(ISelection selection) { - - setTargets(getResource(selection)); - - fPatcher= new Patcher(); - - setWindowTitle(PatchMessages.getString("PatchWizard.title")); //$NON-NLS-1$ - - 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); - } - } - - static IResource[] getResource(ISelection selection) { - IResource[] rs= Utilities.getResources(selection); - ArrayList list= null; - for (int i= 0; i < rs.length; i++) { - IResource r= rs[i]; - if (r != null && r.isAccessible()) { - if (list == null) - list= new ArrayList(); - list.add(r); - } - } - if (list != null && list.size() > 0) - return (IResource[]) list.toArray(new IResource[list.size()]); - return null; - } - - Patcher getPatcher() { - return fPatcher; - } - - IResource getTarget() { - return fTarget; - } - - void setTargets(IResource[] targets) { - 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(fPreviewPatchPage= new PreviewPatchPage(this)); - } - - /* (non-Javadoc) - * Method declared on IWizard. - */ - public boolean needsProgressMonitor() { - return true; - } - - /* (non-Javadoc) - * Method declared on IWizard. - */ - public boolean performFinish() { - - if (false) { - CompareConfiguration cc= new CompareConfiguration() { - public Image getImage(int kind) { - if (kind == Differencer.ADDITION) - kind= Differencer.DELETION; - else if (kind == Differencer.DELETION) - kind= Differencer.ADDITION; - return super.getImage(kind); - } - public Image getImage(Image base, int kind) { - if (kind == Differencer.ADDITION) - kind= Differencer.DELETION; - else if (kind == Differencer.DELETION) - kind= Differencer.ADDITION; - return super.getImage(base, kind); - } - }; - cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false)); - - fPatcher.setName(fPatchWizardPage.getPatchName()); - - CompareUI.openCompareEditor(new PatchCompareInput(cc, fPatcher, new StructuredSelection(fTarget))); - } else { - fPatcher.setName(fPatchWizardPage.getPatchName()); - - try { - WorkspaceModifyOperation op= new WorkspaceModifyOperation() { - protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - fPatcher.applyAll(getTarget(), monitor); - } 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 - } - } - - // 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/PatchedResource.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchedResource.java deleted file mode 100644 index 49825501a..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchedResource.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; - -import org.eclipse.compare.*; - - -/* package */ class PatchedResource implements ITypedElement, IStreamContentAccessor { - - private Diff fDiff; - private IStreamContentAccessor fCurrent; - private IPath fPath; - private byte[] fContent; - private Patcher fPatcher; - - /* package */ PatchedResource(IStreamContentAccessor current, Diff diff, IPath path, Patcher patcher) { - fDiff= diff; - fCurrent= current; - fPath= path; - fPatcher= patcher; - } - - public InputStream getContents() throws CoreException { - if (fContent == null) { - InputStream is= null; - - try { - is= fCurrent.getContents(); - } catch (CoreException ex) { - is= new ByteArrayInputStream(new byte[0]); - } - if (is != null) { - - try { - String encoding= ResourcesPlugin.getEncoding(); - BufferedReader br= new BufferedReader(new InputStreamReader(is, encoding)); - String s= fPatcher.patch(fDiff,br, null); - if (s != null) - fContent= s.getBytes(encoding); - } catch (UnsupportedEncodingException e) { - throw new CoreException(new Status(IStatus.ERROR, CompareUI.PLUGIN_ID, Platform.PLUGIN_ERROR, e.getMessage(), e)); - } - - try { - is.close(); - } catch (IOException ex) { - } - } - } - return new ByteArrayInputStream(fContent); - } - - public Image getImage() { - return CompareUI.getImage(getType()); - } - - public String getName() { - return fPath.toOSString(); - } - - public String getType() { - String type= fPath.getFileExtension(); - if (type != null) - return type; - return ITypedElement.UNKNOWN_TYPE; - } -} - 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 a20360ddc..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java +++ /dev/null @@ -1,1003 +0,0 @@ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.text.*; -import java.util.*; - -import org.eclipse.jface.util.Assert; - -import org.eclipse.core.runtime.*; -import org.eclipse.core.resources.*; - -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; - - - Patcher() { - } - - //---- options - - void setName(String name) { - fName= name; - } - - String getName() { - return fName; - } - - /** - * Returns an array of Diffs after a sucessfull call to parse. - * If parse hasn't been called returns null. - */ - 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 true if new value differs from old. - */ - boolean setStripPrefixSegments(int strip) { - if (strip != fStripPrefixSegments) { - fStripPrefixSegments= strip; - return true; - } - return false; - } - - int getStripPrefixSegments() { - return fStripPrefixSegments; - } - - /** - * Returns true if new value differs from old. - */ - boolean setFuzz(int fuzz) { - if (fuzz != fFuzz) { - fFuzz= fuzz; - return true; - } - return false; - } - - /** - * Returns true 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 true 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); - 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((Diff[]) 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) { - } - } - // 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 patch the contents of the given reader with the specified Diff. - * Any hunk that couldn't be applied is returned in the list failedHunks. - */ - /* package */ String patch(Diff diff, BufferedReader reader, List failedHunks) { - - List lines= new LineReader(reader).readLines(); - if (lines == null) - lines= new ArrayList(); - - patch(diff, lines, failedHunks); - - return createString(lines); - } - - /** - * 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)) { - shift+= doPatch(hunk, lines, shift); - } else { - boolean found= false; - int oldShift= shift; - - for (int i= shift-1; i > shift-fFuzz; i--) { - if (tryPatch(hunk, lines, i)) { - shift= i; - found= true; - break; - } - } - - if (! found) { - for (int i= shift+1; i < shift+fFuzz; i++) { - if (tryPatch(hunk, lines, i)) { - 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 contextMatches= 0; - 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))) { - contextMatches++; - pos++; - break; - } - if (contextMatches <= 0) - return false; - pos++; - } - } 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 charcter: " + 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) throws CoreException { - - final int WORK_UNIT= 10; - - IFile file= null; // file to be patched - IContainer container= null; - if (target instanceof IContainer) - container= (IContainer) target; - else if (target instanceof IFile) { - file= (IFile) target; - container= file.getParent(); - } else { - Assert.isTrue(false); - } - - if (pm != null) { - String message= PatchMessages.getString("Patcher.Task.message"); //$NON-NLS-1$ - pm.beginTask(message, fDiffs.length*WORK_UNIT); - } - - for (int 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()); - - if (container != null) - file= 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) { - } - } - } - } - - 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. - */ - private 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, ResourcesPlugin.getEncoding()); - } catch (UnsupportedEncodingException x) { - // use default encoding - streamReader= new InputStreamReader(is); - } - - BufferedReader reader= new BufferedReader(streamReader); - lines= new LineReader(reader).readLines(); - } catch(CoreException ex) { - } finally { - if (is != null) - try { - is.close(); - } catch(IOException ex) { - } - } - } - - 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(ResourcesPlugin.getEncoding()); - } 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) { - } - } - } - - /** - * 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 Character.isWhitespace(...). - */ - 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; - } -} 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 19151ec35..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java +++ /dev/null @@ -1,597 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.util.*; - -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.viewers.Viewer; -import org.eclipse.jface.wizard.WizardPage; -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.structuremergeviewer.*; - - -/** - * Shows the parsed patch file and any mismatches - * between files, hunks and the currently selected - * resources. - */ -/* package */ class PreviewPatchPage extends WizardPage { - - /** - * Used with CompareInput - */ - static class HunkInput implements ITypedElement, IStreamContentAccessor { - 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(fContent.getBytes()); - } - }; - - private PatchWizard fPatchWizard; - - private Tree fTree; - private Combo fStripPrefixSegments; - private CompareViewerSwitchingPane fHunkViewer; - private Button fIgnoreWhitespaceButton; - private Button fReversePatchButton; - private Text fFuzzField; - - private Image fNullImage; - private Image fAddImage; - private Image fDelImage; - private Image fErrorImage; - private Image fErrorAddImage; - private Image fErrorDelImage; - - 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(); - - fNullImage= new DiffImage(null, null, w).createImage(); - fAddImage= new DiffImage(null, addId, w).createImage(); - fDelImage= new DiffImage(null, delId, w).createImage(); - - fErrorImage= new DiffImage(errIm, null, w).createImage(); - fErrorAddImage= new DiffImage(errIm, addId, w).createImage(); - fErrorDelImage= 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 fAddImage; - case Differencer.DELETION: - return fDelImage; - } - return fNullImage; - } - switch (diff.getType()) { - case Differencer.ADDITION: - return fErrorAddImage; - case Differencer.DELETION: - return fErrorDelImage; - } - return fErrorImage; - } - - Image getImage(Hunk hunk) { - if (hunk.fMatches) - return fNullImage; - return fErrorImage; - } - - 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); - - 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); - } - } - } - ); - - // creating tree's content - buildTree(); - - // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer(this, PATCH_HELP_CONTEXT_ID)); - } - - /** - * Create the group for setting various patch options - */ - private void buildPatchOptionsGroup(Composite parent) { - - final Patcher patcher= fPatchWizard.getPatcher(); - - Group group= new Group(parent, SWT.NONE); - group.setText(PatchMessages.getString("PreviewPatchPage.PatchOptions.title")); //$NON-NLS-1$ - GridLayout layout= new GridLayout(); - layout.numColumns= 5; - group.setLayout(layout); - group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); - //fPatchFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // 1st row - new Label(group, SWT.NONE).setText(PatchMessages.getString("PreviewPatchPage.IgnoreSegments.text")); //$NON-NLS-1$ - - fStripPrefixSegments= new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.SIMPLE); - int prefixCnt= patcher.getStripPrefixSegments(); - String prefix= Integer.toString(prefixCnt); - fStripPrefixSegments.add(prefix); - fStripPrefixSegments.setText(prefix); - - addSpacer(group); - - fReversePatchButton= new Button(group, SWT.CHECK); - fReversePatchButton.setText(PatchMessages.getString("PreviewPatchPage.ReversePatch.text")); //$NON-NLS-1$ - - addSpacer(group); - - // 2nd row - Label l= new Label(group, SWT.NONE); - l.setText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.text")); //$NON-NLS-1$ - l.setToolTipText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.tooltip")); //$NON-NLS-1$ - fFuzzField= new Text(group, SWT.BORDER); - fFuzzField.setText("2"); //$NON-NLS-1$ - GridData gd2= new GridData(GridData.HORIZONTAL_ALIGN_CENTER); - gd2.widthHint= 30; - fFuzzField.setLayoutData(gd2); - - 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(); - } - } - ); - } - - 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) { - 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(); - fPatchWizard.getPatcher().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) { - } - } - return stripPrefixSegments; - } - - private int getFuzzFactor() { - int fuzzFactor= 0; - if (fFuzzField != null) { - String s= fFuzzField.getText(); - try { - fuzzFactor= Integer.parseInt(s); - } catch(NumberFormatException ex) { - } - } - 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/internal/previewAncestor.txt b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewAncestor.txt deleted file mode 100644 index 75ada4dda..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewAncestor.txt +++ /dev/null @@ -1,10 +0,0 @@ -a -b -c -d -e -f -g -h -i -j \ No newline at end of file diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt deleted file mode 100644 index 253c5b567..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt +++ /dev/null @@ -1,10 +0,0 @@ -a -x -c -z -e -f -g -h -i -j \ No newline at end of file diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt deleted file mode 100644 index bc1af89f4..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt +++ /dev/null @@ -1,10 +0,0 @@ -a -y -c -z -e -f -g -h -i -j \ No newline at end of file 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 @@ - - - - - - - Package-level Javadoc - - -Provides support for performing structural and textual -compare operations on arbitrary data and displaying the results. -

-Package Specification

- -The class CompareUI 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. -

- -A compare operation must be implemented as a subclass of CompareEditorInput. -A CompareEditorInput 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. -

- -The NavigationAction is used to navigate (step) through the individual -differences of a CompareEditorInput. -

- -An instance of CompareConfiguration 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 CompareEditorInput -on creation. -

- -When implementing a hierarchical compare operation as a subclass of -CompareEditorInput clients have to provide a tree of objects where each -node implements the interface -org.eclipse.compare.structuremergeviewer.IStructureComparator. -This interface is used by the hierarchical differencing engine -(org.eclipse.compare.structuremergeviewer.Differencer) to walk the tree. -
-In addition every leaf of the tree must implement the IStreamContentAccessor -interface in order to give the differencing engine access to its stream content. -

- -The abstract class BufferedContent provides a default implementation -for the IStreamContentAccessor and IContentChangeNotifier interfaces. -Its subclass ResourceNode adds an implementation for the -IStructureComparator and ITypedElement interfaces -based on Eclipse workbench resources (org.eclipse.core.resources.IResource). -It can be used without modification as the input to the differencing engine. -

- -The ZipFileStructureCreator is an implementation of the -org.eclipse.compare.structuremergeviewer.IStructureCreator interface -and makes the contents of a zip archive available as a -hierarchical structure of IStructureComparators which can be easily compared -by the differencing engine (org.eclipse.compare.structuremergeviewer.Differencer). -It is a good example for how to make structured files available to the hierarchical -compare functionality of the Compare plugin. -

- -The EditionSelectionDialog is a simple selection 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 "Replace with Version" or "Replace with Edition" on workbench resources. -

- -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. This functionality -can be used to implement "Replace with Method Edition" for the Java -language. -

- -The EditionSelectionDialog requires that the editions implement -the IStreamContentAccessor and IModificationDate interfaces. -The HistoryItem is a convenience class that implements these interfaces -for IFileState objects. -

- - -The CompareViewerPane is a convenience class which provides -a label and local toolbar for a compare viewer (or any other subclass of a -JFace Viewer). -
-Its abstract subclass CompareViewerSwitchingPane supports dynamic -viewer switching, 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. - - - - 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 21f6c53a8..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -import java.util.ArrayList; -import java.util.List; - -/** - * A custom iterator to iterate over a List of RangeDifferences. - * It is used internally by the RangeDifferencer. - */ -/* package */ class DifferencesIterator { - - List fRange; - int fIndex; - RangeDifference[] fArray; - RangeDifference fDifference; - - /** - * Creates a differences iterator on an array of RangeDifferences. - */ - 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 RangeDifference. - */ - 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 RangeDifferences - */ - 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 a5e21418e..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -/** - * For breaking an object to compare into a sequence of comparable entities. - *

- * It is used by RangeDifferencer to find longest sequences of - * matching and non-matching ranges. - *

- * 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. getRangeCount would return the number of lines in the - * document, and rangesEqual would compare a specified line given - * with one in another IRangeComparator. - *

- *

- * Clients should implement this interface; there is no standard implementation. - *

- */ -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 IRangeComparator and index. - * - * @param thisIndex the index of the comparable entity within this IRangeComparator - * @param other the IRangeComparator to compare this with - * @param otherIndex the index of the comparable entity within the other IRangeComparator - * @return true 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 - * true or false - * @param maxLength another number on which to base the decision whether to return - * true or false - * @param other the other IRangeComparator to compare with - * @return true 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 1a457193d..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -/* package */ class LinkedRangeDifference extends RangeDifference { - - static final int INSERT= 0; - static final int DELETE= 1; - static final int CHANGE= 2; - static final int ERROR= 3; - - 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 3bf64d72e..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -/** - * Description of a change between two or three ranges of comparable entities. - *

- * RangeDifference objects are the elements of a compare result returned from - * the RangeDifferencer find* methods. - * Clients use these objects as they are returned from the differencer. - * This class is not intended to be instantiated or subclassed. - *

- * Note: A range in the RangeDifference 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. - *

- * - * @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 RIGHT) */ - 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 RangeDifference 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 RangeDifference 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 - * NOCHANGE, CHANGE, LEFT, RIGHT, - * ANCESTOR, CONFLICT, ERROR - */ - 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 f2fa311b3..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 RangeDifferencer finds the differences between two or three IRangeComparators. - *

- * To use the differencer, clients provide an IRangeComparator - * that breaks their input data into a sequence of comparable entities. The differencer - * returns the differences among these sequences as an array of RangeDifference objects - * (findDifferences methods). - * Every RangeDifference represents a single kind of difference - * and the corresponding ranges of the underlying comparable entities in the - * left, right, and optionally ancestor sides. - *

- * Alternatively, the findRanges methods not only return objects for - * the differing ranges but for non-differing ranges too. - *

- * The algorithm used is an objectified version of one described in: - * A File Comparison Program, 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 IRangeComparators. - * The differences are returned as an array of RangeDifferences. - * 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 IRangeComparators. - * The differences are returned as an array of RangeDifferences. - * If no differences are detected an empty array is returned. - * - * @param pm if not null 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 IRangeComparators. - * The differences are returned as a list of RangeDifferences. - * If no differences are detected an empty list is returned. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param ancestor the ancestor range comparator or null - * @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 IRangeComparators. - * The differences are returned as a list of RangeDifferences. - * If no differences are detected an empty list is returned. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param pm if not null used to report progress - * @param ancestor the ancestor range comparator or null - * @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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference 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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference elements for non-differing ranges too. - * - * @param pm if not null 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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference elements for non-differing ranges too. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param pm if not null used to report progress - * @param ancestor the ancestor range comparator or null - * @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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference elements for non-differing ranges too. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param pm if not null used to report progress - * @param ancestor the ancestor range comparator or null - * @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= (RangeDifference) 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 RangeDifference3 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 right and 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 @@ - - - - - - - Package-level Javadoc - - -Provides support for finding the differences between -two or three sequences of comparable entities. -

-Package Specification

- -The class RangeDifferencer finds longest sequences of matching and -non-matching comparable entities. Its implementation is based on -an objectified version of the algorithm described in: -A File Comparison Program, by Webb Miller and Eugene W. Myers, -Software Practice and Experience, Vol. 15, Nov. 1985. -

- -Clients must supply the input to the differencer as an implementation -of the IRangeComparator interface. -An IRangeComparator breaks the input data into a sequence -of entities and provides a method for comparing -one entity with the entity in another IRangeComparator. -

- -For example, to compare two text documents and find longest common -sequences of matching and non-matching lines, -the implementation of IRangeComparator -must break the document into lines and provide a method for testing -whether two lines are considered equal. -See org.eclipse.compare.internal.DocLineComparator for how this can be done. -

- -The differencer returns the differences among these sequences as an -array of RangeDifference objects. -Every single RangeDifference 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. - - - 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 2f1b5398b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -import java.util.ArrayList; - -/** - * The standard implementation of a diff container element. - *

- * This class may be instantiated, or further subclassed. - *

- */ -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 null. - * @param name of the container - * @param kind of difference (defined in Differencer). - */ - public DiffContainer(IDiffContainer parent, int kind) { - super(parent, kind); - } - - /** - * Tries to find the child with the given name. - * Returns null 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 2aa6ecae9..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.compare.ITypedElement; - -/** - * An abstract base implementation of the IDiffElement interface. - *

- * Subclasses may add behavior and state, and may override getImage - * and getType to suit. - *

- */ -public abstract class DiffElement implements IDiffElement { - - private int fKind; - private IDiffContainer fParent; - - /** - * Creates a new DiffElement as a child of the given parent. - * If parent is not null the new element is added to the parent. - * - * @param parent the parent of this child; if not null 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 DiffElement implementation of this ITypedInput - * method returns null. Subclasses may re-implement to provide - * an image for this element. - */ - public Image getImage() { - return null; - } - - /** - * The DiffElement implementation of this ITypedElement - * method returns ITypedElement.UNKNOWN_TYPE. 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 3776443cb..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ITypedElement and ICompareInput - * interfaces it can be used directly to display the - * compare result in a DiffTreeViewer and as the input to any other - * compare/merge viewer. - *

- * DiffNodes are typically created as the result of performing - * a compare with the Differencer. - *

- * 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 DiffNode and initializes with the given values. - * - * @param parent under which the new container is added as a child or null - * @param kind of difference (defined in Differencer) - * @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 DiffNode with diff kind Differencer.CHANGE - * 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 DiffNode and initializes with the given values. - * - * @param kind of difference (defined in Differencer) - * @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 DiffNode with the given diff kind. - * - * @param kind of difference (defined in Differencer) - */ - public DiffNode(int kind) { - super(null, kind); - } - - /** - * Creates a new DiffNode and initializes with the given values. - * - * @param parent under which the new container is added as a child or null - * @param kind of difference (defined in Differencer) - */ - public DiffNode(IDiffContainer parent, int kind) { - super(parent, kind); - } - - /** - * Registers a listener for changes of this ICompareInput. - * 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 ICompareInput 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 ICompareInput. - */ - 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 true if this node shouldn't automatically be expanded in - * a DiffTreeViewer. - * - * @return true if node shouldn't automatically be expanded - */ - public boolean dontExpand() { - return fDontExpand; - } - - /** - * Controls whether this node is not automatically expanded when displayed in - * a DiffTreeViewer. - * - * @param dontExpand if true this node is not automatically expanded in DiffTreeViewer - */ - public void setDontExpand(boolean dontExpand) { - fDontExpand= dontExpand; - } - - /** - * Returns the first not-null input of this node. - * Method checks the three inputs in the order: ancestor, right, left. - * - * @return the first not-null input of this node - */ - public ITypedElement getId() { - if (fAncestor != null) - return fAncestor; - if (fRight != null) - return fRight; - return fLeft; - } - - /** - * Returns the (non-null) name of the left or right side if they are identical. - * Otherwise both names are concatenated (separated with a slash ('/')). - *

- * 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((ITypedElement)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 3c3915a09..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java +++ /dev/null @@ -1,707 +0,0 @@ -/* - * Copyright (c) 2000,2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 IDiffContainer and IDiffElement interfaces. - *

- * This class may be instantiated; it is not intended to be subclassed outside - * this package. - *

- * - * @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 ViewerFilter fViewerFilter; - private IPropertyChangeListener fPropertyChangeListener; - - private Action fCopyLeftToRightAction; - private Action fCopyRightToLeftAction; - private Action fNextAction; - private Action fPreviousAction; - 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= CompareViewerSwitchingPane.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 mm) { - fillContextMenu(mm); - if (mm.isEmpty()) { - if (fEmptyMenuAction == null) { - fEmptyMenuAction= - new Action(Utilities.getString(fBundle, "emptyMenuItem")) {}; //$NON-NLS-1$ - fEmptyMenuAction.setEnabled(false); - } - mm.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 inputChanged - * after a new input has been set but before any controls are updated. - * This default implementation calls navigate(true) - * 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 DiffNodes that shouldn't expand - * (i.e. where the dontExpand method returns true). - */ - 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 internalExpandToLevel - * to control whether a given model node should be expanded or not. - * This default implementation checks whether the object is a DiffNode and - * calls dontExpand() 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 false if a node should be expanded, true 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 ToolBarManager. Two actions - * allow for copying one side of a DiffNode to the other side. - * Two other actions are for navigating from one node to the next (previous). - *

- * 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 DiffNode 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$ - } - ISelection selection= getSelection(); - fExpandAllAction.setEnabled(selection != null && !selection.isEmpty()); - 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 DiffNodes in the current selection to the other side. - * Called from the (internal) actions for copying the sides of a DiffNode. - * Clients may override. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 ICompareInput.copy(...). - * Clients may override. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 true 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 true the next node is selected, otherwise the previous node - * @return true 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 f0cf96fa6..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties +++ /dev/null @@ -1,44 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)DiffTreeViewerResources.properties -# -# Resource strings for DiffTreeViewer.java - -title= Structure Compare -defaultLabel= - -##################################################### -# Dummy menu item for empty context menu -##################################################### - -emptyMenuItem= - -##################################################### -# Actions -##################################################### - -action.Smart.label=Smart -action.Smart.tooltip=Try to Guess Similar Elements -action.Smart.image=smartmode_co.gif - -action.ExpandAll.label=Expand All -action.ExpandAll.tooltip=Expand All Nodes - -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 aeecf85ba..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java +++ /dev/null @@ -1,515 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * The engine is used by calling one of the findDifferences methods and passing - * in the objects to compare. - * The engine calls the following methods on the input objects to perform the compare: - *

    - *
  • getChildren: for enumerating the children of an object (if any), - *
  • contentsEqual: for comparing the content of leaf objects, that is, objects without children, - *
  • visit: for every pair of compared object the compare result is passed in. - *
- * 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: - *
    - *
  • getChildren: tries to apply the IStructureComparator - * interface to enumerate the children, - *
  • contentsEqual: tries to apply the IStreamContentAccessor interface - * to perform a byte-wise content comparison, - *
  • visit: creates a DiffNode for any detected difference between the compared objects and - * links it under a parent node effectively creating a tree of differences. - *
- * 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 true 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 updateProgress which is called for every node or - * leaf compare. The method returns the object that was returned from the top-most call to method visit. - * At most two of the ancestor, left, and right parameters are allowed to be null. - * - * @param threeWay if true a three-way comparison is performed, otherwise a two-way compare - * @param pm a progress monitor which is passed to method updateProgress - * @param data a client data that is passed to the top-level call to visit - * @param ancestor the ancestor object of the compare (may be null) - * @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 visit, - * possibly null - */ - 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 visit method on the parent input. - * It can be considered the "parent" reference and is useful when building a tree. - *

- * The Differencer implementation returns a new - * DiffNode which is initialized with the corresponding values. - * Subclasses may override. - * - * @param data object returned from parent call to visit, - * possibly null - * @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 null - */ - protected Object visit(Object data, int result, Object ancestor, Object left, Object right) { - return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right); - } - - /** - * 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. - *

- * The Differencer implementation - * returns true if both inputs implement IStreamContentAccessor - * and their byte contents is identical. Subclasses may override to implement - * a different content compare on the given inputs. - *

- * - * @param input1 first input to contents compare - * @param input2 second input to contents compare - * @return true 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) { - } finally { - if (is1 != null) { - try { - is1.close(); - } catch(IOException ex) { - } - } - if (is2 != null) { - try { - is2.close(); - } catch(IOException ex) { - } - } - } - return false; - } - - /** - * Tries to return an InputStream for the given object. - * Returns null 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) { - } - } - return null; - } - - /** - * Returns the children of the given input or null if there are no children. - *

- * The Differencer implementation checks whether the input - * implements the IStructureComparator interface. If yes it is used - * to return an array containing all children. Otherwise null is returned. - * Subclasses may override to implement a different strategy to enumerate children. - *

- * - * @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. - *

- * The Differencer implementation shows the name of the input object - * as a subtask. Subclasses may override. - *

- * - * @param progressMonitor the progress monitor for reporting progress - * @name input a non-null input object - */ - 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 0b20deb07..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - * DocumentRangeNodes 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 DocumentRangeNode maps to a range - * of characters in the document. - *

- * Since a DocumentRangeNode implements the IStructureComparator - * and IStreamContentAccessor 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. - *

- * Subclasses may add additional state collected while parsing the document. - *

- * @see Differencer - */ -public class DocumentRangeNode - implements IDocumentRange, IStructureComparator, IEditableContent, IStreamContentAccessor { - - private static final boolean POS_UPDATE= true; - - 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 DocumentRangeNode for the given range within the specified - * document. The typeCode 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) { - } catch (BadLocationException ex) { - } - } - } - - /* (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 equals and hashcode. - * - * @return the node's id - */ - public String getId() { - return fID; - } - - /** - * Sets this node's id. - * It is used in equals and hashcode. - * - * @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. - *

- * E.g. when parsing a Java document the "append position" of a DocumentRangeNode - * 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) { - } catch (BadLocationException ex) { - // ignore - } - } else { - fAppendPosition= new Position(pos); - } - } - - /** - * Returns the position that has been set with setAppendPosition. - * If setAppendPosition 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) { - } catch (BadLocationException ex) { - // ignore - } - } else { - fAppendPosition= new Position(fBaseDocument.getLength()); - } - } - return fAppendPosition; - } - - /** - * Implementation based on getID. - */ - 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 getID. - */ - 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) { - // ignore - } - } - } - - /* (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(s.getBytes()); - } - - /* (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 { - InputStream is= ((IStreamContentAccessor)other).getContents(); - byte[] bytes= Utilities.readBytes(is); - srcContents= new String(bytes); - } catch(CoreException ex) { - } - } - } - - if (child != null) { // there is a destination - -// if (child instanceof DocumentRangeNode) { -// DocumentRangeNode drn= (DocumentRangeNode) child; -// -// IDocument doc= drn.getDocument(); -// Position range= drn.getRange(); -// try { -// doc.replace(range.getOffset(), range.getLength(), srcContents); -// } catch (BadLocationException ex) { -// } -// } - } else { - // no destination: we have to add the contents into the parent - add(srcContents, null /*srcParentNode*/, src); - } - return child; - } - - /* (non Javadoc) - * see IEditableContent.setContent - */ - public void setContent(byte[] content) { -// fBaseDocument.set(new String(content)); - } -} - 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 9979935ea..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * Note: at most two sides of an ICompareInput can be null, - * (as it is normal for additions or deletions) but not all three. - *

- * ICompareInput provides methods for registering - * ICompareInputChangeListeners - * that get informed if one (or more) - * of the three sides of an ICompareInput object changes its value. - *

- * For example when accepting an incoming addition - * the (non-null) left side of an ICompareInput - * is copied to the right side by means of method copy. - * This should trigger a call to compareInputChanged of registered - * ICompareInputChangeListeners. - *

- * Clients can implement this interface, or use the convenience implementation - * DiffNode. - *

- * - * @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-null 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-null sides. - * - * @return image representing this input, or null 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 ICompareInput - * is the result of another compare. In this case it is used - * together with getImage to compose a icon - * which reflects the kind of difference between the two or three elements. - * - * @return kind of difference (see Differencer) - */ - int getKind(); - - /** - * Returns the ancestor side of this input. - * Returns null if this input has no ancestor - * or in the two-way compare case. - * - * @return the ancestor of this input, or null - */ - ITypedElement getAncestor(); - - /** - * Returns the left side of this input. - * Returns null if there is no left side (deletion or addition). - * - * @return the left side of this input, or null - */ - ITypedElement getLeft(); - - /** - * Returns the right side of this input. - * Returns null if there is no right side (deletion or addition). - * - * @return the right side of this input, or null - */ - 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 leftToRight. This method is called from - * a merge viewer if a corresponding action ("take left" or "take right") - * has been pressed. - *

- * The implementation should handle the following cases: - *

    - *
  • - * if the source side is null the destination must be deleted, - *
  • - * if the destination is null the destination must be created - * and filled with the contents from the source, - *
  • - * if both sides are non-null the contents of source must be copied to destination. - *
- * In addition the implementation should send out notification to the registered - * ICompareInputChangeListener. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 601bc1466..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -/** - * Listener that gets informed if one (or more) - * of the three sides of an ICompareInput object changes its value. - *

- * For example when accepting an incoming addition - * the (non-null) left side of an ICompareInput - * is copied to the right side (which was null). - * This triggers a call to compareInputChanged of registered - * ICompareInputChangeListener. - *

- * Note however, that listener are not informed if the content of one of the sides changes. - *

- * Clients may implement this interface. It is also implemented by viewers that take - * an ICompareInput as input. - *

- */ -public interface ICompareInputChangeListener { - - /** - * Called whenever the value (not the content) of one or more of the three sides - * of a ICompareInput has changed. - * - * @param source the ICompareInput 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 f4d472fbe..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -/** - * IDiffContainer is a IDiffElement with children. - *

- * IDiffContainer are the inner nodes displayed - * by the DiffTreeViewer. - * IDiffContainer are typically created as the result of performing - * a compare with the Differencer. - *

- * Clients may implement this interface, or use one of the standard implementations, - * DiffContainer or DiffNode. - * - * @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 getChildren method. - * - * @return true 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 null). - * - * @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 d2dbb59a0..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -import org.eclipse.compare.ITypedElement; - -/** - * An IDiffElement is used in the DiffTreeViewer - * to display the kind of change detected as the result of a two-way or three-way compare. - *

- * The base interface ITypedElement provides a name, a type, and an image. - * IDiffElement adds API for maintaining a parent relationship. - *

- * DiffTreeViewer works on a tree of IDiffElements. - * Leaf elements must implement the - * IDiffElement interface, inner nodes the IDiffContainer interface. - *

- * IDiffElements are typically created as the result of performing - * a compare with the Differencer. - *

- * Clients may implement this interface, or use one of the standard implementations, - * DiffElement, DiffContainer, or DiffNode. - * - * @see DiffTreeViewer - * @see DiffElement - * @see DiffContainer - * @see DiffNode - */ -public interface IDiffElement extends ITypedElement { - - /** - * Returns the kind of difference as defined in Differencer. - * - * @return the kind of difference as defined in Differencer - */ - int getKind(); - - /** - * Returns the parent of this element. - * If the object is the root of a hierarchy null is returned. - * - * @return the parent of this element, or null if the element has no parent - */ - IDiffContainer getParent(); - - /** - * Sets the parent of this element. - * - * @param parent the new parent of this element, or null 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 45bc52994..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -/** - * Interface used to compare hierarchical structures. - * It is used by the differencing engine. - *

- * 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 null - * 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, equals would return true - * 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 true if this object is the same as the other argument; false 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 a27175e6b..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 - * IStructureComparators 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. - *

- * Structure creators are used in the following contexts: - *

    - *
  • - * the StructureDiffViewer uses an IStructureCreator to - * build two (or three) tree structures of its input elements (method getStructure). - * These trees are then compared with each other by means of the differencing engine and displayed - * with the DiffTreeViewer, - *
  • - *
  • - * the ReplaceWithEditionDialog uses an IStructureCreator - * to map a path back to a range of characters in the textual representation. - *
  • - *
- * A IStructureCreator 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. - *

- *

- * Clients may implement this interface; there is no standard implementation. - *

- * - * @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 StructureDiffViewer. - * - * @return a descriptive name for this IStructureCreator - */ - String getName(); - - /** - * Creates a tree structure consisting of IStructureComparators - * 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 null is returned. - * - * @param input the object from which to create the tree of IStructureComparator - * @return the root node of the structure or null 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 null is returned. - * This method is similar to getStructure but in - * contrast to getStructure only a single node without any children must be returned. - * This method is used in the ReplaceWithEditionDialog to locate a sub element - * (e.g. a method) within an input object (e.g. a file containing source code). - *

- * One (not optimized) approach to implement this method is calling getStructure(input) - * to build the full tree, and then finding that node within the tree that is specified - * by path. - *

- * The syntax of path 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 path to the selectEdition - * method of ReplaceWithEditionDialog and will receive this value unchanged - * as an argument to locate. - * - * @param path specifies a sub object within the input object - * @param input the object from which to create the IStructureComparator - * @return the single node specified by path or null - * - * @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 ignoreWhitespace is true 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 true 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 getStructure - */ - 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 d7e6af9a4..000000000 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 IStructureCreator - * to retrieve a hierarchical structure from the input object (an ICompareInput) - * and perform a two-way or three-way compare on it. - *

- * This class may be instantiated; it is not intended to be subclassed outside - * this package. - *

- * - * @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 ICompareInputChangeListener fThreeWayInputChangedListener; - 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); - } - }; - fThreeWayInputChangedListener= new ICompareInputChangeListener() { - public void compareInputChanged(ICompareInput input) { - StructureDiffViewer.this.compareInputChanged(input); - } - }; - } - - /** - * Configures the StructureDiffViewer 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 ICompareInput. - * - * @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 null if no - * structure creator has been set with setStructureCreator. - * - * @return the structure creator or null - */ - public IStructureCreator getStructureCreator() { - return fStructureCreator; - } - - /** - * Reimplemented to get the descriptive title for this viewer from the IStructureCreator. - */ - 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 diff. - * - * @return the root of the diff tree produced by method diff - */ - 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 getInput is not identical to getRoot. - */ - 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; - fThreeWayInputChangedListener= 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 diff 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 diff() 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 diff() 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-null 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 null 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 save method on the structure creator after - * nodes have been copied from one side to the other side of an input object. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 @@ - - - - - - - Package-level Javadoc - - -Provides support for finding and displaying the differences -between hierarchically structured data. -

-Package Specification

- -The class Differencer 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. -

- -If the input elements to the differencing engine implement the IStructureComparator -interface the engine recursively applies itself to the children of -the input element. Leaf elements must implement the org.eclipse.compare.IStreamContentAccessor -interface so that the differencer can perform a bytewise comparison on their contents. -

- -One good example for this is org.eclipse.compare.ResourceNode which implements both interfaces -(and more) for Eclipse workspace resources (org.eclipse.core.resources.IResource). -

- -Another example is the DocumentRangeNode 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 -(org.eclipse.compare.contentmergeviewer.IDocumentRange). -
-Typically DocumentRangeNodes 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 JavaNode (in org.eclipse.jdt.internal.ui.compare) -and PropertyNode (in org.eclipse.jdt.internal.ui.compare) are good examples for this. -

- -By default the differencing engine returns the result of the compare operation -as a tree of DiffNode objects. However, this can be changed by overriding -a single method of the engine. -

- -Every DiffNode describes the changes among the two or three inputs. -

- -A tree of DiffNodes can be displayed in a DiffTreeViewer. -The DiffTreeViewer requires that inner nodes of the tree implement -the IDiffContainer interface and leafs the IDiffElement interface. -

- -The typical steps to compare hierarchically structured data and to display -the differences would be to: -

    -
  • -map the input data into a tree of IStructureComparator and IStreamContentAccessors,
  • - -
  • -perform the compare operation by means of the Differencer, and
  • - -
  • -feed the differencing result into the DiffTreeViewer.
  • - -
- -The StructureDiffViewer is a specialized DiffTreeViewer -that automates the three steps from above. It takes a single input object -of type ICompareInput from which it retrieves the two or three -input elements to compare. Then it uses a IStructureCreator to -extract a tree of IStructureComparator and IStreamContentAccessor -from them. These trees are then compared with the differencing engine and -the result is displayed in the tree viewer. -

- - - - - 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/next_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/prev_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/cview16/compare_view.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/next_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/next_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/prev_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/etool16/conflict_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/eview16/compare_view.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/obj16/day_obj.gif and /dev/null differ diff --git a/bundles/org.eclipse.compare/icons/full/obj16/resolved.gif b/bundles/org.eclipse.compare/icons/full/obj16/resolved.gif deleted file mode 100644 index 96d149cb8..000000000 Binary files a/bundles/org.eclipse.compare/icons/full/obj16/resolved.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/obj16/resource_obj.gif and /dev/null differ diff --git a/bundles/org.eclipse.compare/icons/full/obj16/unresolved.gif b/bundles/org.eclipse.compare/icons/full/obj16/unresolved.gif deleted file mode 100644 index 95b2ad5fa..000000000 Binary files a/bundles/org.eclipse.compare/icons/full/obj16/unresolved.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/add_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/chg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/del_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/error_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/indel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif and /dev/null differ diff --git a/bundles/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugin.properties deleted file mode 100644 index 9396d843f..000000000 --- a/bundles/org.eclipse.compare/plugin.properties +++ /dev/null @@ -1,140 +0,0 @@ -######################################### -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -######################################### -# -# 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: Must be CompareEditorInput - -# -# 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 -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.textFont.label= Text &font -# Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=19211 -ComparePreferencePage.showMoreInfo.label= &Show additional compare information in the status line -ComparePreferencePage.preview.label= Preview: -ComparePreferencePage.ancestor.label= Common Ancestor -ComparePreferencePage.left.label= Local -ComparePreferencePage.right.label= Remote -ComparePreferencePage.structureCompare.label= &Open structure compare automatically -ComparePreferencePage.generalTab.label= &General -ComparePreferencePage.textCompareTab.label= &Text Compare -ComparePreferencePage.backgroundColor1.label= Bac&kground Color: -ComparePreferencePage.backgroundColor2.label= S&ystem Default -ComparePreferencePage.backgroundColor3.label= C&ustom -# Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20077 -ComparePreferencePage.ignoreWhitespace.label= Ignore &white space - -# New UI -ComparePreferencePage.useSplines.label= [Experimental] Use splines in center panel -ComparePreferencePage.useSingleLine.label= [Experimental] Connect ranges with single line -ComparePreferencePage.useResolveUI.label= [Experimental] Use new resolve UI - -# -# 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.threeWay.title=Compare ({0}-{1}-{2}) - -# -# DiffTreeViewer & DiffNodes -# -DiffTreeViewer.title= Structure Compare -DiffNode.noName= -DiffNode.nameFormat= {0} / {1} - -# -# Differencing engine -# -Differencer.progressFormat= Comparing {0} - -# -# Patch: rejected patch markers -# -rejectedPatchMarker.name= Rejected Patch diff --git a/bundles/org.eclipse.compare/plugin.xml b/bundles/org.eclipse.compare/plugin.xml deleted file mode 100644 index b68d4731a..000000000 --- a/bundles/org.eclipse.compare/plugin.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 8a49fb9d5..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - 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 bf7d0f58b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - org.eclipse.compare - - - org.eclipse.core.boot - org.eclipse.ui - org.eclipse.core.runtime - org.eclipse.core.resources - org.eclipse.swt - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - 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 @@ - - - -About - - - -

About This Content

- -

20th June, 2002

-

License

-

Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

- -

Contributions

- -

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.

- -

If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

- - - \ 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 46151f0cf..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -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 947cd0bd3..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html +++ /dev/null @@ -1,1193 +0,0 @@ - - - - - - - Eclipse Platform Release Notes - Desktop - - - -

-Eclipse Platform Build Notes
-Compare

-Eclipse Build Input February 6th 2003 - -

-Problem reports fixed

-#30525: "Team" menu item missing accelerator
-#28202: contentmergeviewers do not work with mixed-case extensions
-#19114: Restore Java Element from Local History should also provide check boxes [compare]
-#28436: Overview rule green only after focus change
- -

-

-Eclipse Build Input January 28th 2003 - -

-API Additions

-Added new method CompareUI.findContentViewer(..., Object input, ...) - -

-Problem reports fixed

-Remoced doc folder.
-#24597: Compare UI API issues
-#23883: CompareDialog.commitAction.label string resource name is wrong
-#29791: Rename 'Compare to Patch' to 'Apply Patch'
- -

-

-Eclipse Build Input January 14th 2003 - -

-Problem reports fixed

-Extension point schema files added.
-Resolve status indicator is only shown if there are incoming changes. - -

-

-Eclipse Build Input January 7th 2003 - -

-Problem reports fixed

-#28278: TextMergeViewer leaks Color objects
-#27864: Load of CompareUI fails when not triggered in UI thread
-#28388: Illegal Argument Exceptions in compare viewer
- -

-

-Eclipse Build Input December 17th 2002 - -

-Problem reports fixed

-#28388: Illegal Argument Exceptions in compare viewer
- -

-

-Eclipse Build Input December 16th 2002 - -

-Problem reports fixed

-Fixed a problem with trim in compare viewer on Mac OS X.
-#28278: TextMergeViewer leaks Color objects
- -
-Eclipse Build Input December 13th 2002 - -

-Problem reports fixed

-#28012: Double-click behaving strangely in Synchronize View
- -

-

-Eclipse Build Input December 10th 2002 - -

-What's new in this drop

-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. - -

-Problem reports fixed

-#27993: Incorrect structure comparison
- -

-

-Eclipse Build Input December 3rd 2002 - -

-What's new in this drop

- -

-API Additions

-Made internal class Splitter public API. - -

-Problem reports fixed

-#24597: Compare UI API issues
- -

-

-Eclipse Build Input November 26th 2002 - -

-Problem reports fixed

-#20975: Compare preference page has no F1 help
- -

-

-Eclipse Build Input June 27th 2002 - -

-What's new in this drop

-Updated JavaDoc package.html files - -

-

-Eclipse Build Input June 25th 2002 - -

-What's new in this drop

-Updated JavaDoc - -

-

-Eclipse Build Input June 12th 2002 - -

-What's new in this drop

- -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. - -

-

-Eclipse Build Input June 8th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#18807: Compare with patch fails due to missing LF
-#13730: Entire zipfiles content sent prior when computing synchronization view content
- -

-Problem reports closed

- -

-

-Eclipse Build Input June 7th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#13730: Entire zipfiles content sent prior when computing synchronization view content
-#14952: Diff Browser Opens Too Small / Not Easily Resizable
- - -

-Problem reports closed

- -

-

-Eclipse Build Input June 6th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

-New constant CompareUI.PLUGIN_ID - -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#13949: DBCS: bogus at text compare
-#19013: backgronud color: is it honored?
-#19216: Accessibility in Workbench > Compare > Text Compare
-#19371: Java & Compare editor's Next/Previous toolbar buttons shouldn't be retargetable
- - -

-Problem reports closed

- -

-

-Eclipse Build Input June 1st 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

-Made class NavigationAction public. - -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#8004: Ctrl+E beeps every time
-#14800: Compare View eats tabs
-#18200: Both sets of arrows say "Select Next Change"
-#18206: Casing, wording issue on "Last Resource reached" prompt
-#16285: Add from Local History needs a description label
-#17431: Accessibility issues
-#18148: Using combinations of No and Next file button break wrapping
-#18151: Next File button does not ding when on last file
-#16570: Compare refuses to show further differences if not ignoring whitespaces
-#10790: Patch does not apply if file not found locally
-#12643: Expand all does not disable when there is no selection
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 31st 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#18116: Compare view does not inherit Java editor background color
-#13190: Compare with Patch does not apply Patch, if single file selected
- - -

-Problem reports closed

- -

-

-Eclipse Build Input May 30th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#17699: Java Editor: Local Histroy menu entries are enabled for read-only files
-#16283: Add from Local History items are unsorted
-#16288: Add from Local History: list of available editions flashes
-#17664: Applying a patch with deleted package fails
- - -

-Problem reports closed

- -

-

-Eclipse Build Input May 29th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#14040: Platform interoperability issue w.r.t. Compare With Patch
-#17790: Missing mnemonics in patch selection dialog
-#10917: Patch support does not use mnemonics
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 28th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#17889: Should not assume type of PropertyChangeEvent values
-#17678: Applying a patch does many compiles
-#17536: NPE in compare
-#17121: Casing of message when end of changes needs to be sentence style
-#17648: Can't apply patch w/o ignoring whitespace
-#16936: Compare with patch requires "Ignore Whitespace" to be turned off
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 18th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#14371: TextMergeViewer.sameDoc() is broken
-#14378: CompareEditorInput never resets dirtyness flag (detailed)
-#14680: Compare unreadable in high contrast black
-#14952: Diff Browser Opens Too Small / Not Easily Resizable
-#14742: Ignore whitespace preference
-#14624: No visual cue when compared file wraps
-#13606: Support multiple selection in Add from local history
- -

-Problem reports closed

- -

-

-Eclipse Build Input May 16th 2002 - -

-What's new in this drop

-Bumped plugin version number to 2.0.0
-Adapted to new findEditor methods
- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#8373: Compare With->Patch... missing mnemonic
-#12719: "Show Pseudo-Conflicts" setting is problematic
- -

-Problem reports closed

- -

-

-Eclipse Build Input April 30th 2002 - -

-What's new in this drop

-All strings NLSed. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#14515: java compare uses internal jcore scanner
-#14782: Add from Local History missing mnemonic
- -

-Problem reports closed

- -

-

-Eclipse Build Input April 18th 2002 - -

-What's new in this drop

-All strings NLSed. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#13152: Internal error in "Add from Local History..." on packages
- -

-Problem reports closed

- -

-

-Eclipse Build Input April 9th 2002 - -

-What's new in this drop

-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. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

-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. - -

-Problem reports fixed

-#11578: Patch: Missing resource on dialog
-#11579: Compare with Patch should be disabled on closed projects
-#11907: clicking in bird's eye view spots does nothing if panes not synched
-#11536: Option to turn off structured comparison
-#10682: Need better UI for recovering deletions from local history
-#11446: provide "add from local history" for compilation units
-#8615: Styled Text widget does not respond to system color change
-#9673: editor background color - no effect on other viewers
-#11642: Compare editors not using default background colors
-#10434: Compare browser fails silently and does not give result
- -

-Problem reports closed

- -

-

-Eclipse Build Input March 18th 2002 - -

-What's new in this drop

-First cut of a birdseyeview for the text compare viewer.
-'Compare which Each other' for Java elements. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#3641: DCR: Can't compare from outliner (1GDHJKK)
- -

-Problem reports closed

- -

-

-Eclipse Build Input March 14th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#11305: Can't compare a "C" file
- - -

-Problem reports closed

- -

-

-Eclipse Build Input March 12th 2002 - -

-What's new in this drop

-Structure Compare viewers are enabled by default.
- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#10379: Compare with Local History Dialog: lower pane is missing a bordeer
-#9768: (empty-menu) in compare view
-#9842: Expand All action needed in structure compare view
- - -

-Problem reports closed

- -

-

-Eclipse Build Input March 5th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#9869: Need more support for creating/deleting resources
- - -

-Problem reports closed

- -

-

-Eclipse Build Input February 26th 2002 - -

-What's new in this drop

-Patch: for every rejected file a task marker is added
-Compare preference page shows options in a preview
-New preference option for additional compare status line information - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#9540: Compare with patch: it should not be possible to check items that could not be applied
-#9532: Compare with patch: next disabled although clipboard specified
-#7681: Structured results expands import statements
-#9572: Debugging trace left in status bar
- - -

-Problem reports closed

- -

-

-Eclipse Build Input February 12th 2002 - -

-What's new in this drop

-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. -
-Patch wizard has a 'Reverse' option for applying a "reversed" patch. -This option can be used to 'undo' a patch. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#9153: NPE when closing synchronize view
-#9331: NPE during compare with stream version
-#6346: Problems with Patch
-#6727: Patch: *.rej file must be saved in workspace
-#7358: Internal Error in Compare with Patch with new files
- -

-Problem reports closed

- -

-

-Eclipse Build Input February 5th 2002 - -

-What's new in this drop

-The structure compare pane opens when a resource is selected. -In previous version a double click was required. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#5063: Should not have to double-click to open Structure Compare
-#2602: Compare FW accessibility issues (1GK79UB)
-#2707: Merge viewer should ask for save before releasing (1GI9JXS)
-#2772: DCR: Automatic structure compare (1GJ6EUY)
-#3829: Smart rename button enabled when no smartness is available (1GEUVHN)
-#9089: Local history - Selecting item in structured compare has no effect
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 29th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#6271: Can't tell which file is which in Compare browser
-#2519: next/prev arrows active when only one difference in compare (1GFIQX3)
-#8363: NPE comparing two resources in the navigator.
-#2501: Empty menu in compare browser (1GFBQKE)
-#2854: Compare: Save code path problematic (1GJYGAX)
-#8574: Not structure compare in compare with local history
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 23th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#8089: Replace from local history: parse error
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 22th 2002 - -

-What's new in this drop

-Fixed an inconsistency in the binary compare viewer: -info message didn't match +/-icon in the resource compare pane. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#3859: replace from history does not work for elements with error (1GEYIZ6)
-#6177: Double click action dangerous in 'Restore from Local History'
-#7821: Team 2.0 CVS synchronze bug 'no-name' dirs..
-#2773: Java structure compare should give better indication when no changes (1GJ6ENE)
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 15th 2002 - -

-What's new in this drop

-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. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#1893: Compare Viewer doesn't scroll to last line (1GBB34N)
-#5839: Usability: Initial diff is sometimes not horizontally aligned
-#5325: Compare always scroll the text pane to the extreme limit
-#7048: First element not selected
-#2548: Project compare should open viewing selected file (1GFMRP6)
-#2938: Replace from local history should show busy cursor (1GKU0P3)
-#7594: Menu entry "Replace with Previous" shouldn't have a "..."
-Workaround added for:
-#7320: Next diff scrolls when going into current diff
- -

-Problem reports closed

- -

-

-Eclipse Build Input January 8th 2002 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

-Added methods to CompareUI plugin for adding and removing aliases -for the file extension to StructureCompareViewer mapping -(addStructureViewerAlias, removeStructureViewerAlias). - -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#6828: Support with replace with previous
-#2396: Save in compare editors needs progress bar (1GEYF58)
-#5271: JARs compared as source in release browser
-#5121: Replace with Previous (from local history)
- -

-Problem reports closed

- -

-

-Eclipse Build Input December 11th 2001 - -

-What's new in this drop

-Keyboard shortcuts for 'Goto next Difference' and 'Goto previous Difference' -changed to Control-E and Control-Shift-E.
-Better NLS support.
-Updated file "about.html". - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

- -

-Problem reports closed

- -

-

-Eclipse Build Input December 4th 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#4381: Replace from local histroy - workspace element included
- -

-Problem reports closed

- -

-

-Eclipse Build Input November 27th 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#6298: Replace with Local History: Workbench -> Workspace
-#5238: Compare fails if takes more than 20 seconds
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 210, November 12th, 2001 - -

-What's new in this drop

-First cut for 'rejected hunk' support. - -

-API changes

- -

-API Additions

-new classes CompareViewerPane and CompareViewerSwitchingPane
- -

-Other highlights

-Improved Patch wizard.
- -

-Known deficiencies

- -

-Problem reports fixed

-#5723: Apply Patch dialog has no radio selection
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 207, November 1st, 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-#5334: Internal errors using patch tool
-#5150: Compare with patch cannot read VCM's CVS patch file
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 204, October 12th, 2001 - -

-What's new in this drop

-First cut of patch support. - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

- -

-Problem reports closed

- -

-

-Eclipse SDK Build 202, September 27th, 2001 - -

-What's new in this drop

- -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-1GKKUA5: ITPUI:WINNT - Severe: memory leak in sync view
-1GKKGGS: ITPJUI:WIN2000 - (136) compares zips as source
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 201, September 21st, 2001 - -

-What's new in this drop

-removed direction icon in TextMergeViewer for two-way compare - -

-API changes

- -

-API Additions

- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-1GJURWJ: ITPUI:WIN2000 - Hebrew + Japanese: compare view defaults to binary
-1GK0388: ITPJCORE:WIN2000 - replace with local history: selecting (workspace) deletes source
-1GITG2V: ITPUI:WIN2000 - Comparing html files uses binary compare
-1GJW2TP: ITPJUI:WIN2000 - java compare: why beep every time?
- -

-Problem reports closed

- -

-

-Eclipse SDK Build 200, September 13th, 2001 - -

-What's new in this drop

-If not specified otherwise Compare viewer font is taken from workbench text font
-The shortcut for "Goto Next/Previous Difference" is Ctrl-D/Ctrl-Shift-D -to avoid a clash with Ctrl-P of the Print command. - -

-API changes

- -

-API Additions

-new method EditionSelectionDialog.setHideIdenticalEntries(boolean)
-new method EditionSelectionDialog.setTargetIsRight(boolean)
-new method EditionSelectionDialog.setAddMode(boolean)
-new method CompareEditorInput.saveChanges(...)
-new method TextMergeViewer.createLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace)
- -

-Other highlights

- -

-Known deficiencies

- -

-Problem reports fixed

-1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty
-1GG0ELM: ITPVCM:ALL - Local history displayed some of Today's items as Yesterday
-1GGNKHN: ITPJUI:ALL - No progress during replace with local history
-1GF2JNI: ITPUI:ALL - (minor)Compare failed title should be title case
-1GHBPA1: ITPVCM:WINNT - Compare - next change arrow switches to wrong file
-1GGQQH3: ITPJUI:WINNT - Compare hightlights a non-change instead of the change
-1GI5DN9: ITPUI:WIN2000 - Conflicting token deletions don't show up in text compare viewer
-1GI3KUR: ITPJUI:WIN2000 - Compare: double-click in versions list closes view
-1GFFR4B: ITPUI:WIN98 - local history is misleading
-1GBM0IL: ITPUI:WINNT - CompareEditorInput#save should throw CoreException
-1GI99LE: ITPUI:ALL - Compare viewer does not show last line when horizontal scroll bar is present
-1GBB34N: ITPJUI:WIN2000 - Compare Viewer doesn't scroll to last line
-1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range
-1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files
-1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update
-1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options
-1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()
-1GI3HDZ: ITPJUI:ALL - Compare: conflicts with no ancestor does not show differences
-1GEUX0D: ITPJUI:ALL - not state aware toolbar button in compare
- -

-Problem reports closed

-1GF9Y9C: ITPUI:WIN2000 - DCR: only get ancestor pane contents if pane is visible
- - - 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 fbe1a66c2..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 IStreamContentAccessor. - *

- * Subclasses must implement the createStream method - * to connect the buffered content with a streamable source (e.g., a file). - *

- * As long as the contents of BufferedContent is only retrieved as an input stream - * (by means of getContents) and the BufferedContent is not modified (with - * setContent) no buffering takes place. - * Buffering starts when either method getContent or setContent 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. - *

- * Subclasses must implement this method. - *

- * - * @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 null if - * the contents could not be accessed - */ - public byte[] getContent() { - if (fContent == null) { - try { - InputStream is= createStream(); - fContent= Utilities.readBytes(is); - } catch(CoreException ex) { - } - } - 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 IContentChangeListeners 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 9bb8f76ab..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 CompareConfiguration 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 ICompareConfiguration 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 IGNORE_WHITESPACE property - * and all interested viewers would receive notification. - *

- * Suitable default labels are provided (without images); both the left and right sides - * are editable. - *

- *

- * Clients may use this class as is, or subclass to add new state and behavior. - *

- */ -public class CompareConfiguration { - - /** - * Name of the ignore whitespace property (value "IGNORE_WHITESPACE"). - */ - public static final String IGNORE_WHITESPACE= "IGNORE_WHITESPACE"; //$NON-NLS-1$ - /** - * Name of the show pseudo conflicts property (value "SHOW_PSEUDO_CONFLICTS"). - */ - public static final String SHOW_PSEUDO_CONFLICTS= "SHOW_PSEUDO_CONFLICTS"; //$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 ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE, - * and CompareConfiguration.IGNORE_WHITESPACE. - * - * @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 - * (CompareUIPlugin.getDefault().getPreferenceStore()). - */ - 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 Differencer. - * Newly created images are remembered by this class and - * disposed when the dispose method is called. - * - * @param kind the kind of change as defined in Differencer. - * @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 Differencer. - * 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 dispose 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 Differencer. - * @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() { - } - - /** - * Fires a PropertyChangeEvent 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 PropertyChangeEvent - * 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 null - * if no such property exists. - * - * @param propertyName the name of the property to retrieve - * @return the property with the given name, or null 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 null - * @return the label for the ancestor side or null - */ - 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 null - * @return the image for the ancestor side or null - */ - 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 true left side is editable - */ - public void setLeftEditable(boolean editable) { - fLeftEditable= editable; - } - - /** - * Returns whether the left hand side of a merge viewer is editable. - * - * @return true 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 null - * @return the label for the left hand side or null - */ - 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 null - * @return the image for the left hand side or null - */ - 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 true right side is editable - */ - public void setRightEditable(boolean editable) { - fRightEditable= editable; - } - - /** - * Returns whether the right hand side of a merge viewer is editable. - * - * @return true 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 null - * @return the label for the right hand side or null - */ - 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 null - * @return the image for the right hand side or null - */ - 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 8c408f334..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java +++ /dev/null @@ -1,815 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.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.swt.custom.BusyIndicator; -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 interface 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. - *

- * A CompareEditorInput defines methods for the following sequence steps: - *

    - *
  • running a lengthy compare operation under progress monitor control, - *
  • creating a UI for displaying the model and initializing the some widgets with the compare result, - *
  • tracking the dirty state of the model in case of merge, - *
  • saving the model. - *
- * The Compare plug-in's openCompareEditor method takes an ICompareEditorInput - * 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. - *

- * The prepareInput 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 ICompareEditorInput should hold onto them and return them with - * the getCompareResult method. - * If the value returned from getCompareResult is not null - * a compare editor is opened on the ICompareEditorInput with title and title image initialized by the - * corresponding methods of the ICompareEditorInput. - *

- * Creation of the editor's SWT controls is delegated to the createContents method. - * Here the SWT controls must be created and initialized with the result of the compare operation. - *

- * If merging is allowed, the modification state of the compared constituents must be tracked and the dirty - * state returned from method isSaveNeeded. The value true triggers a subsequent call - * to save where the modified resources can be saved. - *

- * 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. - *

- * Subclasses provide custom setups, e.g. for a Catchup/Release operation - * by passing a subclass of CompareConfiguration and by implementing the prepareInput method. - * If a subclass cannot use the DiffTreeViewer which is installed by default in the - * top left pane, method createDiffViewer 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 "DIRTY_STATE"). - */ - 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 ISelection fSelection2; - 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; - - /** - * Creates a CompareEditorInput 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); - - 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 (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 fTitle; - } - - /* (non Javadoc) - * see IEditorInput.getName - */ - public String getName() { - return fTitle; - } - - /** - * Returns null since this editor cannot be persisted. - * - * @return null because this editor cannot be persisted - */ - public IPersistableElement getPersistable() { - return null; - } - - /** - * Returns false to indicate that this input - * should not appear in the "File Most Recently Used" menu. - * - * @return false - */ - 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 setTitle. - * - * @return the title - */ - public String getTitle() { - 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 null 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 ToolBarManager. - *

- * Subclasses may override to add their own actions. - *

- * - * @param toolBarManager the ToolBarManager 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 prepareInput method must propagate a checked exception, - * it should wrap it inside an InvocationTargetException; runtime exceptions are automatically - * wrapped in an InvocationTargetException by the calling context - * @exception InterruptedException if the operation detects a request to cancel, - * using IProgressMonitor.isCanceled(), it should exit by throwing - * InterruptedException - */ - public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - fInput= prepareInput(monitor); - } - - /** - * Runs the compare operation and returns the compare result. - * If null 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 InterruptedException. - *

- * 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. - *

- * - * @param monitor the progress monitor to use to display progress and receive - * requests for cancelation - * @return the result of the compare operation, or null if there are no differences - * @exception InvocationTargetException if the prepareInput method must propagate a checked exception, - * it should wrap it inside an InvocationTargetException; runtime exceptions are automatically - * wrapped in an InvocationTargetException by the calling context - * @exception InterruptedException if the operation detects a request to cancel, - * using IProgressMonitor.isCanceled(), it should exit by throwing - * InterruptedException - */ - protected abstract Object prepareInput(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException; - - /** - * Returns the compare result computed by the most recent call to the - * run method. Returns null if no - * differences were found. - * - * @return the compare result prepared in method prepareInput - * or null 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. - *

- * 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); - - final Splitter h= new Splitter(fComposite, SWT.HORIZONTAL); - - 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); - - 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; - } - }; - fComposite.setVisible(h, false); - fComposite.setVisible(fContentInputPane, true); - - fComposite.setWeights(new int[] { 30, 70 }); - - fComposite.layout(); - - // 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()); - } - } - ); - - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // setup the wiring for second pane - /* - fStructurePane1.addOpenListener( - new IOpenListener() { - public void open(OpenEvent oe) { - feed2(oe.getSelection()); - } - } - ); - */ - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - fStructurePane1.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - ISelection s= e.getSelection(); - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // if (s == null || s.isEmpty()) - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - feed2(s); - } - } - ); - - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // setup the wiring for third pane - /* - fStructurePane2.addOpenListener( - new IOpenListener() { - public void open(OpenEvent oe) { - feed3(oe.getSelection()); - } - } - ); - */ - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - fStructurePane2.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - ISelection s= e.getSelection(); - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // if (s == null || s.isEmpty()) - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - feed3(s); - } - } - ); - - - // Begin fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - // now deal with activation/deactivation - /* - Listener activationListener= new Listener() { - int fOldOpenStrategy; - - public void handleEvent(Event event) { - if (event.widget instanceof CompareViewerSwitchingPane) { - - switch (event.type) { - case SWT.Activate: - fFocusPane= (CompareViewerSwitchingPane) event.widget; - fOldOpenStrategy= OpenStrategy.getOpenMethod(); - OpenStrategy.setOpenMethod(OpenStrategy.SINGLE_CLICK | OpenStrategy.ARROW_KEYS_OPEN); - break; - case SWT.Deactivate: - OpenStrategy.setOpenMethod(fOldOpenStrategy); - break; - } - } - } - }; - fStructureInputPane.addListener(SWT.Activate, activationListener); - fStructurePane1.addListener(SWT.Activate, activationListener); - fStructurePane2.addListener(SWT.Activate, activationListener); - fContentInputPane.addListener(SWT.Activate, activationListener); - - fStructureInputPane.addListener(SWT.Deactivate, activationListener); - fStructurePane1.addListener(SWT.Deactivate, activationListener); - fStructurePane2.addListener(SWT.Deactivate, activationListener); - fContentInputPane.addListener(SWT.Deactivate, activationListener); - */ - // End fix for http://bugs.eclipse.org/bugs/show_bug.cgi?id=19972 - - - if (fInput instanceof ICompareInput) { - fStructureInputPane.setInput((ICompareInput) 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; - } - - 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 IStructuredSelection with exactly one element. Returns - * null otherwise. - * - * @param selection the selection - * @return the first element of the selection, or null - */ - 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). - *

- * 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. - *

- */ - 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 createContents and returns a DiffTreeViewer. - *

- * Subclasses may override if they need a different viewer. - *

- * - * @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 - * null can be returned to indicate that no viewer could be found. - *

- * This implementation forwards the request to CompareUI.findStructureViewer. - *

- * Subclasses may override to implement a different strategy. - *

- * - * @return a compare viewer which is suitable for the given input object or null - */ - 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 - * null can be returned to indicate that no viewer could be found. - *

- * This implementation forwards the request to CompareUI.findContentViewer. - *

- * Subclasses may override to implement a different strategy. - *

- * - * @return a compare viewer which is suitable for the given input object or null - */ - 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 true if there are unsaved changes. - * The value returned is the value of the DIRTY_STATE property of this input object. - - * Returns true if this input has unsaved changes, - * that is if setDirty(true) has been called. - * Subclasses don't have to override if the functionality provided by setDirty - * is sufficient. - * - * @return true 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 PropertyChangeEvent 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) { - fListenerList.add(listener); - } - - /* (non Javadoc) - * see IPropertyChangeNotifier.removeListener - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - fListenerList.remove(listener); - } - - /** - * Save any unsaved changes. - * Empty implementation. - * Subclasses must override to save any changes. - * - * @param progressMonitor an IProgressMonitor 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 ISavable.save on them. - * - * @param progressMonitor an IProgressMonitor 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 f19a441ac..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.plugin.AbstractUIPlugin; - -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.structuremergeviewer.ICompareInput; - - -/** - * The class CompareUI 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. - *

- * 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 "org.eclipse.compare"). - * @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. - * - * @param input the input on which to open the compare editor - */ - public static void openCompareEditor(CompareEditorInput input) { - CompareUIPlugin plugin= CompareUIPlugin.getDefault(); - if (plugin != null) - plugin.openCompareEditor(input); - } - - /** - * 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. - *

- * 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. - *

- * - * @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 IWorkbenchAdapter.getImageDescriptor, which it - * uses to create an image if it does not already have one. - *

- * 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. - *

- * - * @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 null 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 null - */ - 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 null 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 null - */ - 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 - * null 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 IStreamContentAccessor and - * ITypedElement or ICompareInput. - * @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 null - */ - 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 findStructureViewer - * treat alias as a synonym for type and return the same viewer. - *

- * 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. - *

- * 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 2461e5e22..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 CompareViewerPane is a convenience class which installs a - * CLabel and a Toolbar in a ViewForm. - *

- * Double clicking onto the CompareViewerPane's title bar maximizes - * the CompareViewerPane to the size of an enclosing Splitter - * (if there is one). - * If more Splitters are nested maximizing walks up and - * maximizes to the outermost Splitter. - * - * @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

    - *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • - *
- * @exception SWTException
    - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • - *
- */ - public CompareViewerPane(Composite parent, int style) { - super(parent, 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); - } - - /** - * Sets the receiver's title text. - * The value null clears it. - * - * @param text the text to be displayed in the CompareViewerPane's title or null - * - * @exception SWTException
    - *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • - *
- */ - public void setText(String label) { - CLabel cl= (CLabel) getTopLeft(); - cl.setText(label); - } - - /** - * Return the receiver's title text. - * - * @return the text of the CompareViewerPane's title or null - */ - public void setImage(Image image) { - CLabel cl= (CLabel) getTopLeft(); - cl.setImage(image); - } - - /** - * Returns a ToolBarManager if the given parent is a - * CompareViewerPane or null otherwise. - * - * @param parent a Composite or null - * @return a ToolBarManager if the given parent is a CompareViewerPane otherwise null - */ - public static ToolBarManager getToolBarManager(Composite parent) { - if (parent instanceof CompareViewerPane) { - CompareViewerPane pane= (CompareViewerPane) parent; - return pane.getToolBarManager(); - } - return null; - } - - /** - * Clears tool items in the CompareViewerPane's control bar. - * - * @param parent a Composite or null - */ - 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 b185dfb3e..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 CompareViewerPane that supports dynamic viewer switching. - * - *

- * Clients must implement the viewer switching strategy by implementing - * the getViewer(Viewer, Object) method. - *

- * If a property with the name CompareUI.COMPARE_VIEWER_TITLE is set - * on the top level SWT control of a viewer, it is used as a title in the CompareViewerPane'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 CompareViewerSwitchingPane 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

    - *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • - *
- * @exception SWTException
    - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • - *
- */ - public CompareViewerSwitchingPane(Composite parent, int style) { - this(parent, style, false); - } - - /** - * Creates a CompareViewerSwitchingPane 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
    - *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • - *
- * @exception SWTException
    - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • - *
- */ - 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 setTitelArgument - * or null if no optional title argument has been set. - *

- * Note: this method is for internal use only. Clients should not call this method. - * - * @return the optional title argument or null - */ - public String getTitleArgument() { - return fTitleArgument; - } - - /** - * Returns true if no viewer is installed or if the current viewer - * is a NullViewer. - * - * @return true if no viewer is installed or if the current viewer is a NullViewer - */ - 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 getViewer(Viewer, Object). - * 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 setInput(Object) method. - * If new and old viewer don't differ no new viewer is installed but just - * setInput(Object) is called. - * If the input is null the pane is cleared, - * that is the current viewer is disposed. - * - * @param input the new input object or null - */ - 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 Object 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, null is returned. - * The additional argument oldViewer represents the viewer currently installed - * in the pane (or null 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 null - * @param input the input object for which a viewer must be determined or null - * @return a viewer for the given input, or null 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 8fa8ba34d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java +++ /dev/null @@ -1,1123 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.io.InputStream; -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.*; -import org.eclipse.compare.*; - - -/** - * 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. - *

- * 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. - *

- * Subsections of an input element are determined by first finding an - * IStructureCreator for the input's type. - * Then the method locate is used to extract the subsection. - *

- * Each edition (variant in the list of variants) must implement the IModificationDate interface - * so that the dialog can sort the editions and present them in a tree structure where every - * node corresponds one day. - *

- * The functionality is surfaced in a single function selectEdition. - *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- * - * @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 { - InputStream is= sca.getContents(); - if (is != null) - fContent= Utilities.readString(is); - } catch (CoreException ex) { - } - } - } - 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: - *
-	 *	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
-	 * 
- * - * @param parent if not null the new dialog stays on top of this parent shell - * @param bundle ResourceBundle to configure the dialog - */ - public EditionSelectionDialog(Shell parent, ResourceBundle bundle) { - super(parent, bundle); - - fCompareConfiguration= new CompareConfiguration(); - fCompareConfiguration.setLeftEditable(false); - fCompareConfiguration.setRightEditable(false); - - 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(); - } - - /** - * 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 null - * @param editions the list of editions (element type: ITypedElements) - * @param path If null dialog shows full input; if non null it extracts a subsection - * @return returns the selected edition or null if error occurred. - * The returned ITypedElement is one of the original editions - * if path was null; otherwise - * it is an ITypedElement returned from IStructureCreator.locate(path, item) - * @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 null - * @param editions the list of editions (element type: ITypedElements) - * @param path If null dialog shows full input; if non null it extracts a subsection - * @return returns the selected edition or null if dialog was cancelled. - * The returned ITypedElement is one of the original editions - * if path was null; otherwise - * it is an ITypedElement returned from IStructureCreator.locate(path, item) - */ - 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) - fCompareConfiguration.setRightLabel(targetLabel); - else - fCompareConfiguration.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 selectEdition. - * - * @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 EditionSelectionDialog 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 EditionSelectionDialog 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 selectEdition. If a not null path was specified this method - * returns a subsection of this target (IStructureCreator.locate(path, target)) - * instead of the input target. - *

- * For example if the target is a Java compilation unit and path specifies - * a method, the value returned from getTarget 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 selected editions that have been specified with the most - * recent call to selectEdition. - * - * @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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the name of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param target the target element for which a label must be returned - * @param item if a path has been specified in selectEdition 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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the formatted modification date of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param selectedEdition the selected edition for which a label must be returned - * @param item if a path has been specified in selectEdition 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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the formatted modification date of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param edition the edition for which a label must be returned - * @param item if a path has been specified in edition 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 MessageFormat.format. - * The single format argument for MessageFormat.format ("{0}" in the format string) - * is the formatted modification date of the given input element. - *

- * Subclasses may override to create their own label. - *

- * - * @param selectedEdition the selected edition for which a label must be returned - * @param item if a path has been specified in selectEdition 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) - return fTimeImage; - return null; - } - - /* (non Javadoc) - * Creates SWT control tree. - */ - protected synchronized Control createDialogArea(Composite parent) { - - 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 (fDateImage != null) - fDateImage.dispose(); - if (fTimeImage != null) - fTimeImage.dispose(); - } - } - ); - - 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, fCompareConfiguration); - 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, fCompareConfiguration); - } - }; - vsplitter.setWeights(new int[] { 30, 70 }); - - return vsplitter; - } - - /* (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 null 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= (ITypedElement)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); - 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 { - 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 94d31411e..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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; - -import org.eclipse.compare.*; - -/** - * A combination IFileState and ITypedElement that can be used as - * an input to a compare viewer or other places where an IStreamContentAccessor - * is needed. - *

- *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- */ -public class HistoryItem implements IStreamContentAccessor, ITypedElement, IModificationDate { - - private ITypedElement fBase; - private IFileState fFileState; - - /** - * Creates a HistoryItem object which combines the given IFileState - * and ITypedElement into an object - * which is suitable as input for a compare viewer or ReplaceWithEditionDialog. - * - * @param base the implementation of the ITypedElement interface delegates to this base ITypedElement - * @param fileState the IFileState 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()); - } -} - 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 4e2daf187..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -/** - * An IContentChangeListener is informed about content changes of a - * IContentChangeNotifier. - *

- * Clients may implement this interface. - *

- * - * @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 e47077147..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -/** - * Interface common to all objects that provide a means for registering - * for content change notification. - *

- * Clients may implement this interface. - *

- * - * @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 66d5f9921..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -/** - * Common interface for objects with editable contents. - * Typically it is implemented by objects that also implement - * the IStreamContentAccessor interface. - *

- * Clients may implement this interface. - *

- * Note that implementing IEditableContent does not - * automatically mean that it is editable. An object is only editable if - * it implements IEditableContent and the isEditable method returns true. - * - * @see IStreamContentAccessor - */ -public interface IEditableContent { - - /** - * Returns true if this object can be modified. - * If it returns false the other methods of this API must not be called. - * - * @return true 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 a child, - *
  • - * remove a child, - *
  • - * copy the contents of a child - *
- * - * What to do is encoded in the two arguments as follows: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
add:child == nullother != null
remove:child != nullother == null
copy:child != nullother != null
- */ - ITypedElement replace(ITypedElement child, ITypedElement other); -} 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 0ab0bbd5a..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * Clients may implement this interface. - *

- */ -public interface IModificationDate { - - /** - * Returns the modification time of this object. - *

- * 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 02aa86de8..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * Clients may implement this interface. - *

- * - * @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 07ae9828c..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamContentAccessor.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -import java.io.InputStream; - -import org.eclipse.core.runtime.CoreException; - -/** - * An IStreamContentAccessor object represents a set of bytes which can be - * accessed by means of a stream. - *

- * Clients may implement this interface, or use the standard implementation, - * BufferedContent. - * - * @see BufferedContent - */ -public interface IStreamContentAccessor { - /** - * Returns an open InputStream for this object which can be used to retrieve the object's content. - * The client is responsible for closing the stream when finished. - * Returns null 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/ITypedElement.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java deleted file mode 100644 index 2bf989fd5..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ITypedElement.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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. - *

- * These methods are typically used to present an input object in the compare UI - * (getName and getImage) - * and for finding a viewer for a given input type (getType). - *

- * Clients may implement this interface. - */ -public interface ITypedElement { - - /** - * Type for a folder input (value "FOLDER"). - * 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 "txt"). - */ - public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$ - - /** - * Type for an element whose actual type could not - * be determined (value "???"). - */ - 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 null 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 - * FOLDER_TYPE. - * 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 86d878ff4..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IViewerCreator.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare; - -import org.eclipse.swt.widgets.Composite; - -import org.eclipse.jface.viewers.Viewer; - -/** - * A factory object for Viewer. - *

- * This interface is only required when creating a Viewer from a plugin.xml file. - * Since Viewers have no default constructor they cannot be - * instantiated directly with Class.forName. - */ -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 8e7d9572f..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.compare.internal.CompareNavigator; -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.internal.Utilities; - -/** - * A NavigationAction is used to navigate through the individual - * differences of a CompareEditorInput. - *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- * @since 2.0 - */ -public class NavigationAction extends Action { - - private boolean fNext; - private CompareEditorInput fCompareEditorInput; - - - /** - * Creates a NavigationAction. - * - * @param next if true action goes to the next difference; otherwise to the previous difference. - */ - public NavigationAction(boolean next) { - this(CompareUIPlugin.getResourceBundle(), next); - } - - /** - * Creates a NavigationAction that initializes its attributes - * from the given ResourceBundle. - * - * @param bundle is used to initialize the action - * @param next if true 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(CompareNavigator.class); - if (adapter instanceof CompareNavigator) - ((CompareNavigator)adapter).selectChange(fNext); - } - } - - /** - * Sets the CompareEditorInput on which this action operates. - * - * @param input the CompareEditorInput on which this action operates; if null 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 46b5be006..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.structuremergeviewer.IStructureComparator; - -/** - * A ResourceNode wrappers an IResources so that it can be used - * as input for the differencing engine (interfaces IStructureComparator and ITypedElement) - * and the ReplaceWithEditionDialog (interfaces ITypedElement and IModificationDate). - *

- * Clients may instantiate this class; it is not intended to be subclassed. - *

- * - * @see EditionSelectionDialog - */ -public class ResourceNode extends BufferedContent - implements IStructureComparator, ITypedElement, IEditableContent, IModificationDate { - - private IResource fResource; - private ArrayList fChildren; - - - /** - * Creates a ResourceNode 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 true if the other object is of type ITypedElement - * 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) { - } - } - } - return fChildren.toArray(); - } - - /** - * This hook method is called from getChildren once for every - * member of a container resource. This implementation - * creates a new ResourceNode for the given child resource. - * Clients may override this method to create a different type of - * IStructureComparator or to filter children by returning null. - * - * @param child the child resource for which a IStructureComparator must be returned - * @return a ResourceNode for the given child or null - */ - protected IStructureComparator createChild(IResource child) { - return new ResourceNode(child); - } - - /** - * Returns an open stream if the corresponding resource implements the - * IStorage interface. Otherwise the value null 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) - return new BufferedInputStream(((IStorage)fResource).getContents()); - 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; - } -} - 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 221157198..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2002 IBM Corp. All rights reserved. This file is made - * available under the terms of the Common Public License v1.0 which accompanies - * 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. - *

- * If Splitters are nested directly: - *

    - *
  • changing the visibilty of a child will propagate upward to the topmost - * Splitter
  • - *
  • maximizing a child makes it as large as the topmost enclosing - * Splitter
  • - *
- * - * @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. - *

- * The style value is either one of the style constants defined in - * class SWT which is applicable to instances of this - * class, or must be built by bitwise OR'ing together - * (that is, using the int "|" operator) two or more - * of those SWT style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - *

- * - * @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
    - *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • - *
- * @exception SWTException
    - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • - *
- * - * @see SWT#HORIZONTAL - * @see SWT#VERTICAL - * @see #getStyle - */ - 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(); - } - } - - /* - * 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 up - Composite parent= getParent(); - if (parent instanceof Splitter) - ((Splitter) parent).setMaximizedControl(this); - else - layout(true); - } - - /* - * 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; - } - - /* - * 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 e5d338784..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.Iterator; -import java.util.HashMap; -import java.util.zip.*; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.jface.util.Assert; - -import org.eclipse.core.runtime.CoreException; - -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.compare.internal.Utilities; - - -/** - * This implementation of the IStructureCreator interface - * makes the contents of a zip archive available as a - * hierarchical structure of IStructureComparators. - *

- * 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) { - 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) { - 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 getName(). - * @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) { - } - } - - 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) { - } - } - - 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 false since we cannot update a zip archive. - * @return false - */ - public boolean canSave() { - return false; - } - - /** - * Called whenever a copy operation has been performed on a tree node. - * This implementation throws an AssertionFailedException - * 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 getStructure - */ - public void save(IStructureComparator structure, Object input) { - Assert.isTrue(false); // Cannot update zip archive - } - - public IStructureComparator locate(Object path, Object source) { - return null; - } - - /** - * Returns false since this IStructureCreator - * cannot rewrite the diff tree in order to fold certain combinations of - * additons and deletions. - *

- * Note: this method is for internal use only. Clients should not call this method. - * @return false - */ - public boolean canRewriteTree() { - return false; - } - - /** - * Empty implementation since this IStructureCreator - * cannot rewrite the diff tree in order to fold certain combinations of - * additons and deletions. - *

- * 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 bd390892d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java +++ /dev/null @@ -1,962 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.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.resource.ImageDescriptor; -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.contentmergeviewer.IMergeViewerContentProvider; -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. - *

- * ContentMergeViewer - *

    - *
  • implements the overall layout and defines hooks so that subclasses - * can easily provide an implementation for a specific content type, - *
  • implements the UI for making the areas resizable, - *
  • has an action for controlling whether the ancestor area is visible or not, - *
  • has actions for copying one side of the input to the other side, - *
  • tracks the dirty state of the left and right sides and send out notification - * on state changes. - *
- * A ContentMergeViewer accesses its - * model by means of a content provider which must implement the - * IMergeViewerContentProvider interface. - *

- *

- * Clients may wish to use the standard concrete subclass TextMergeViewer, - * or define their own subclass. - * - * @see IMergeViewerContentProvider - * @see TextMergeViewer - */ -public abstract class ContentMergeViewer extends ContentViewer - implements IPropertyChangeNotifier, ISavable { - - class SaveAction extends MergeViewerAction { - - private boolean fLeft; - - 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; - - public Resizer(Control c, int dir) { - fDirection= dir; - fControl= c; - fControl.addMouseListener(this); - fLiveResize= !(fControl instanceof Sash); - - 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; - fControl.addMouseMoveListener(this); - } - - public void mouseUp(MouseEvent e) { - fControl.removeMouseMoveListener(this); - if (!fLiveResize) - resize(e); - } - - public void mouseMove(MouseEvent e) { - if (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; - - // 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 - * updateContent. - * - * @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 ToolBarManager. - * It is called when this viewer is installed in its container and if the container - * has a ToolBarManager. - * The ContentMergeViewer 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 true, the left side is copied to the right side; - * if false, 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 null can be returned. - * - * @param left if true, the byte contents of the left area is returned; - * if false, the byte contents of the right area - * @return the content as an array of bytes, or null - */ - 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 null if this viewer does not yet have a configuration. - * - * @return the compare configuration, or null if none - */ - protected CompareConfiguration getCompareConfiguration() { - return fCompareConfiguration; - } - - /** - * The ContentMergeViewer implementation of this - * ContentViewer method - * checks to ensure that the content provider is an IMergeViewerContentProvider. - */ - public void setContentProvider(IContentProvider contentProvider) { - Assert.isTrue(contentProvider instanceof IMergeViewerContentProvider); - super.setContentProvider(contentProvider); - } - - /* package */ IMergeViewerContentProvider getMergeContentProvider() { - return (IMergeViewerContentProvider) getContentProvider(); - } - - /** - * The ContentMergeViewer implementation of this - * Viewer method returns the empty selection. Subclasses may override. - */ - public ISelection getSelection() { - return new ISelection() { - public boolean isEmpty() { - return true; - } - }; - } - - /** - * The ContentMergeViewer implementation of this - * Viewer 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. - *

- * The ContentMergeViewer implementation of this Viewer - * method tries to save the old input by calling doSave(...) and - * then calls internalRefresh(...). - * - * @param input the new input of this viewer, or null if there is no new input - * @param oldInput the old input element, or null 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 Viewer method inputChanged - * to save any unsaved changes of the old input. - *

- * The ContentMergeViewer implementation of this - * method calls saveContent(...). If confirmation has been turned on - * with setConfirmSave(true), a confirmation alert is posted before saving. - *

- * 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 null if there is no new input - * @param oldInput the old input element, or null if there was previously no input - * @return true 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 doSave(...) asks for confirmation before saving - * the old input with saveContent(...). - * @param enable a value of true 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= CompareViewerSwitchingPane.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. - *

- * Calls the hooks createControls and createToolItems - * to let subclasses build the specific content areas and to add items to - * an enclosing toolbar. - *

- * 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); - - ToolBarManager tbm= CompareViewerSwitchingPane.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$ - } - - 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$ - } - - 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) { - - 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. - *

- * This method is called whenever the state of the items needs updating. - *

- * 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. - *

- * This method is called whenever the header must be updated. - *

- * 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 PropertyChangeEvent with the - * property name CompareEditorInput.DIRTY_STATE. - * - * @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 PropertyChangeEvent with the - * property name CompareEditorInput.DIRTY_STATE. - * - * @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 9952100d7..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/DelayedProgressMonitor.java +++ /dev/null @@ -1,136 +0,0 @@ -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 e2d2d755c..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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. - *

- * 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. - *

- *

- * Clients may implement this interface. - *

- * - * @see TextMergeViewer - * @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode - */ -public interface IDocumentRange { - - /** - * The position category typically used for an IDocumentRange position - * (value "DocumentRangeCategory"). - * @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 null if this document range spans the whole underlying document. - * - * @return a position that specifies a subrange in the underlying document, or null - */ - 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 ebf8a7eb6..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.contentmergeviewer; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.jface.viewers.IContentProvider; - - -/** - * A content provider that mediates between a ContentMergeViewer's model - * and the viewer itself. - *

- * Clients may implement this interface. - *

- * - * @see ContentMergeViewer - */ -public interface IMergeViewerContentProvider extends IContentProvider { - - //---- ancestor side - - /** - * Returns the label for the ancestor side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the label for the ancestor side of a ContentMergeViewer - */ - String getAncestorLabel(Object input); - - /** - * Returns an optional image for the ancestor side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the image for the ancestor side of a ContentMergeViewer, - * or null if none - */ - Image getAncestorImage(Object input); - - /** - * Returns the contents for the ancestor side of a ContentMergeViewer. - * The interpretation of the returned object depends on the concrete ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the content for the ancestor side of a ContentMergeViewer, - * or null if none - */ - Object getAncestorContent(Object input); - - /** - * Returns whether the ancestor side of the given input element should be shown. - * - * @return true 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 ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the label for the left side of a ContentMergeViewer - */ - String getLeftLabel(Object input); - - /** - * Returns an optional image for the left side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the image for the left side of a ContentMergeViewer, - * or null if none - */ - Image getLeftImage(Object input); - - /** - * Returns the contents for the left side of a ContentMergeViewer. - * The interpretation of the returned object depends on the concrete ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the content for the left side of a ContentMergeViewer, - * or null if none - */ - Object getLeftContent(Object input); - - /** - * Returns whether the left side is editable. - * - * @param input the input object of the ContentMergeViewer - * @return true if the left side of a ContentMergeViewer is editable - */ - boolean isLeftEditable(Object input); - - /** - * Saves new contents for the left side of the ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @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 ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the label for the right side of a ContentMergeViewer - */ - String getRightLabel(Object input); - - /** - * Returns an optional image for the right side of a ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the image for the right side of a ContentMergeViewer, - * or null if none - */ - Image getRightImage(Object input); - - /** - * Returns the contents for the right side of a ContentMergeViewer. - * The interpretation of the returned object depends on the concrete ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @return the content for the right side of a ContentMergeViewer, - * or null if none - */ - Object getRightContent(Object input); - - /** - * Returns whether the right side is editable. - * - * @param input the input object of the ContentMergeViewer - * @return true if the right side of a ContentMergeViewer is editable - */ - boolean isRightEditable(Object input); - - /** - * Saves new contents for the right side of the ContentMergeViewer. - * - * @param input the input object of the ContentMergeViewer - * @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 8eb124e1c..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 IRangeComparator interface - * so that it can be used by the TextMergeViewer. - *

- * TextMergeViewer 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. - *

- * TextMergeViewer'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 - * TextMergeViewer.createTokenComparator factory method). - *

- * - * @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 5e83db18a..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java +++ /dev/null @@ -1,4042 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; -import java.util.ResourceBundle; -import java.io.UnsupportedEncodingException; -import java.text.MessageFormat; - -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.FontData; -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.ImageDescriptor; -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.preference.PreferenceConverter; -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.IWorkbenchActionConstants; - -import org.eclipse.compare.*; -import org.eclipse.compare.internal.CompareUIPlugin; -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 RangeDifferencer to perform a - * textual, line-by-line comparison of two (or three) input documents. - * It is based on the ContentMergeViewer and uses TextViewers - * to implement the ancestor, left, and right content areas. - *

- * 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 TextMergeViewer supports the notion of a current "differing range" - * and provides toolbar buttons to navigate from one range to the next (or previous). - *

- * If there is a current "differing range" and the underlying document is editable - * the TextMergeViewer enables actions in context menu and toolbar to - * copy a range from one side to the other side, thereby performing a merge operation. - *

- * In addition to a line-by-line comparison the TextMergeViewer - * 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. - *

- * The TextMergeViewer'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 ITokenComparator interface and overriding the - * TextMergeViewer.createTokenComparator factory method). - *

- * Access to the TextMergeViewer's model is by means of an - * IMergeViewerContentProvider. Its getXContent methods must return - * either an IDocument, an IDocumentRange, or an IStreamContentAccessor. - * In the IDocumentRange case the TextMergeViewer - * works on a subrange of a document. In the IStreamContentAccessor case - * a document is created internally and initialized from the stream. - *

- * A TextMergeViewer can be used as is. However clients may subclass - * to customize the behavior. For example a MergeTextViewer for Java would override - * the configureTextViewer method to configure the TextViewer for Java source code, - * the createTokenComparator 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= { - IWorkbenchActionConstants.UNDO, - IWorkbenchActionConstants.REDO, - IWorkbenchActionConstants.CUT, - IWorkbenchActionConstants.COPY, - IWorkbenchActionConstants.PASTE, - IWorkbenchActionConstants.DELETE, - IWorkbenchActionConstants.SELECT_ALL, - IWorkbenchActionConstants.SAVE - }; - 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 SYNC_SCROLLING= "SYNC_SCROLLING"; //$NON-NLS-1$ - - 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= 10; - /** Width of birds eye view */ - private static final int BIRDS_EYE_VIEW_INSET= 1; - /** */ - private static final int RESOLVE_SIZE= 5; - - /** line width of change borders */ - private static final int LW= 1; - /** Provide more merge controls in CompareViewerPane toolbar */ - private static final boolean USE_MORE_CONTROLS= true; - /** 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 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 Object fAncestorInput; - private Object fLeftInput; - private Object fRightInput; - - private MergeSourceViewer fAncestor; - private MergeSourceViewer fLeft; - private MergeSourceViewer fRight; - - private int fLeftLineCount; - private int fRightLineCount; - - private boolean fLeftContentsChanged; - private boolean fRightContentsChanged; - - 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= false; - private boolean fUseSingleLine= false; - private boolean fUseResolveUI= false; - - private ActionContributionItem fNextItem; // goto next difference - private ActionContributionItem fPreviousItem; // goto previous difference - private ActionContributionItem fCopyDiffLeftToRightItem; - private ActionContributionItem fCopyDiffRightToLeftItem; - - private boolean fSynchronizedScrolling= true; - private boolean fShowMoreInfo= false; - - private MergeSourceViewer fFocusPart; - - private boolean fSubDoc= true; - private IPositionUpdater fPositionUpdater; - private boolean fIsMotif; - - // SWT widgets - private BufferedCanvas fAncestorCanvas; - private BufferedCanvas fLeftCanvas; - private BufferedCanvas fRightCanvas; - private Canvas fScrollCanvas; - private ScrollBar fVScrollBar; - private Canvas fBirdsEyeCanvas; - private Label fSummaryCanvas; - - // SWT resources to be disposed - private Map fColors; - private Font fFont; - private Cursor fBirdsEyeCursor; - private Image fOKImage; - private Image fNOTOKImage; - - // points for center curves - private double[] fBasicCenterCurve; - - private Menu fCenterMenu; - private Button fCenterButton; - private Diff fButtonDiff; - - /** - * 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) { - //System.out.println("Diff.createPosition: " + start + " " + l); - } - - try { - doc.addPosition(IDocumentRange.RANGE_CATEGORY, p); - } catch (BadPositionCategoryException ex) { - } - return p; - } catch (BadLocationException ee) { - //System.out.println("Diff.createPosition: " + start + " " + end); - } - 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); - - String platform= SWT.getPlatform(); - fIsMotif= "motif".equals(platform); //$NON-NLS-1$ - - if (fIsMotif) - fMarginWidth= 0; - - fPreferenceStore= configuration.getPreferenceStore(); - if (fPreferenceStore != null) { - fPreferenceChangeListener= new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - TextMergeViewer.this.propertyChange(event); - } - }; - fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener); - - Display display= parent.getDisplay(); - updateFont(fPreferenceStore, display); - 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= 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); - } - - private void updateFont(IPreferenceStore ps, Display display) { - - Font oldFont= fFont; - - FontData fontData= null; - if (ps.contains(ComparePreferencePage.TEXT_FONT) - && !ps.isDefault(ComparePreferencePage.TEXT_FONT)) - fontData= PreferenceConverter.getFontData(ps, ComparePreferencePage.TEXT_FONT); - else - fontData= PreferenceConverter.getDefaultFontData(ps, ComparePreferencePage.TEXT_FONT); - if (fontData != null) { - fFont= new Font(display, fontData); - - if (fAncestor != null) - fAncestor.setFont(fFont); - if (fLeft != null) - fLeft.setFont(fFont); - if (fRight != null) - fRight.setFont(fFont); - - if (oldFont != null) - oldFont.dispose(); - } - } - - 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 null the system's default background color is used. - * @param background the background color or null 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 null the system's default foreground color is used. - * @param foreground the foreground color or null 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); - - 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 TextMergeViewer 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 ITokenComparator which is used to show the - * intra line differences. - * The TextMergeViewer 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 - * IStreamContentAccessor and an internal document must be created. This - * document is initialized with the partitioner returned from this method. - *

- * The TextMergeViewer implementation of this method returns - * null. Subclasses may reimplement to create a partitioner for a - * specific content type. - * - * @return a document partitioner, or null - */ - 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) { - - 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) { - if (fPreferenceStore != null) - fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener); - fPreferenceChangeListener= null; - } - - fLeftCanvas= null; - fRightCanvas= null; - fVScrollBar= null; - fBirdsEyeCanvas= null; - fSummaryCanvas= 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 (fFont != null) { - fFont.dispose(); - fFont= null; - } - if (fBirdsEyeCursor != null) { - fBirdsEyeCursor.dispose(); - fBirdsEyeCursor= null; - } - - if (fOKImage != null) { - fOKImage.dispose(); - fOKImage= null; - } - if (fNOTOKImage != null) { - fNOTOKImage.dispose(); - fNOTOKImage= 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) { - - // 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); - - fSummaryCanvas= new Label(composite, SWT.NONE); - /* - new Canvas(composite, SWT.NONE); - fSummaryCanvas.addPaintListener( - new PaintListener() { - public void paintControl(PaintEvent e) { - // TODO Auto-generated method stub - - } - } - ); - */ - 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); - - 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.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 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 x= 0; - 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 - } - - /** - * 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 { - canvas.addMouseMoveListener( - new MouseMoveListener() { - public void mouseMove(MouseEvent e) { - if (showResolveUI()) - handleMouseMoveOverCenter(canvas, e.x, e.y); - } - } - ); - - fCenterButton= new Button(canvas, "carbon".equals(SWT.getPlatform()) ? SWT.FLAT : SWT.PUSH); - 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, false); - } - } - } - ); - } - - return canvas; - } - return super.createCenter(parent); - } - - private void 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; - } - } - } - - /** - * 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); - } - } - ); - - if (fFont != null) - te.setFont(fFont); - - 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 null if there is no new input - * @param oldInput the old input element, or null if there was previously no input - * @return true 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; - - fLeftContentsChanged= false; - fRightContentsChanged= 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 - fLeftInput= left; - setDocument(fLeft, 'L', left); - fLeftLineCount= fLeft.getLineCount(); - - fRightInput= right; - setDocument(fRight, 'R', right); - fRightLineCount= fRight.getLineCount(); - - fAncestorInput= ancestor; - setDocument(fAncestor, 'A', ancestor); - - doDiff(); - - invalidateLines(); - updateVScrollBar(); - refreshBirdsEyeView(); - - if (!emptyInput && !fComposite.isDisposed()) { - // 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()) { - fLeftContentsChanged= true; - setLeftDirty(true); - } else if (doc == fRight.getDocument()) { - setRightDirty(true); - fRightContentsChanged= 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.getContents()); - } catch (CoreException ex) { - } - - 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) { - if (DEBUG) System.out.println("BadPositionCategoryException: " + ex); //$NON-NLS-1$ - } catch (BadLocationException ex) { - 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) { - } - - oldDoc.removeDocumentListener(fDocumentListener); - } - } - - /** - * Returns the contents of the underlying document as an array of bytes. - * - * @param left if true 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; - 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) - //scrollbarWidth= fScrollCanvas.computeTrim(0, 0, 0, 0).width; - scrollbarWidth= fLeft.getTextWidget().computeTrim(0, 0, 0, 0).width; - 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) { - if (fSummaryCanvas != null) - fSummaryCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, BIRDS_EYE_VIEW_WIDTH); - y+= scrollbarHeight; - fBirdsEyeCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, height-(3*scrollbarHeight)); - } - - // 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) { - } - - } - 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) { - } - 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) { - } - } - 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() { - Image c= null; - if (showResolveUI()) { - boolean hasIncoming= false; // we only show red or green if there is at least one incoming or conflicting change - boolean unresolved= false; - if (fChangeDiffs != null) { - Iterator e= fChangeDiffs.iterator(); - while (e.hasNext()) { - Diff d= (Diff) e.next(); - if (d.isIncomingOrConflicting()) { - hasIncoming= true; - if (!d.fResolved) { - unresolved= true; - break; - } - } - } - } - if (hasIncoming) { - if (unresolved) { - if (fNOTOKImage == null) { - ImageDescriptor id= CompareUIPlugin.getImageDescriptor("obj16/unresolved.gif"); //$NON-NLS-1$ - if (id != null) - fNOTOKImage= id.createImage(fSummaryCanvas.getDisplay()); - } - c= fNOTOKImage; - } else { - if (fOKImage == null) { - ImageDescriptor id= CompareUIPlugin.getImageDescriptor("obj16/resolved.gif"); //$NON-NLS-1$ - if (id != null) - fOKImage= id.createImage(fSummaryCanvas.getDisplay()); - } - c= fOKImage; - } - } - } - fSummaryCanvas.setImage(c); - } - - 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) { - } - } - } - 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) { - - 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$ - - 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$ - - - 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$ - } - - 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$ - } - } - - /* 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); - fBasicCenterCurve= null; - invalidateLines(); - - } else if (key.equals(ComparePreferencePage.USE_RESOLVE_UI)) { - fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI); - updateResolveStatus(); - invalidateLines(); - - } else if (key.equals(ComparePreferencePage.TEXT_FONT)) { - if (fPreferenceStore != null) { - updateFont(fPreferenceStore, fComposite.getDisplay()); - 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= ((double) 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 null - * 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 revealAndSelect is true 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, false); - } - break; - case RangeDifference.RIGHT: - if (!leftToRight) { - if (!compoundChangeStarted) { - target.beginCompoundChange(); - compoundChangeStarted= true; - } - copy(diff, leftToRight, false); - } - 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); - fRightContentsChanged= false; - } 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); - fLeftContentsChanged= false; - } - doDiff(); - invalidateLines(); - updateVScrollBar(); - selectFirstDiff(); - refreshBirdsEyeView(); - } - - private void copyDiffLeftToRight() { - copy(fCurrentDiff, true, false, false); - } - - private void copyDiffRightToLeft() { - copy(fCurrentDiff, false, false, false); - } - - /* - * Copy the contents of the given diff from one side to the other. - */ - private void copy(Diff diff, boolean leftToRight, boolean both, boolean gotoNext) { - if (copy(diff, leftToRight, both)) { - 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, boolean both) { - - 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: - s= fromDoc.get(fromStart, fromLen); - if (both) - s+= toDoc.get(toStart, toLen); - break; - } - if (s != null) { - toDoc.replace(toStart, toLen, s); - toPos.setOffset(toStart); - toPos.setLength(s.length()); - } - - } catch (BadLocationException e) { - } - } - - 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; - } -} \ No newline at end of file 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 6e7f9eaae..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewerResources.properties +++ /dev/null @@ -1,91 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== -# @(#)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. Try to 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 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 @@ - - - - - - - Package-level Javadoc - - -Support for compare and merge viewers which show the -content side-by-side. -

-Package Specification

- -The ContentMergeViewer 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 ImageMergeViewer in -package org.eclipse.compare.internal shows how to base a simple -mergeviewer for images on ContentMergeViewer. -

- -A ContentMergeViewer accesses its model by means of a content -provider which must implement the IMergeViewerContentProvider interface. -

- -The TextMergeViewer is the standard concrete subclass of -ContentMergeViewer for comparing and merging text content. -
-A text merge viewer uses the org.eclipse.compare.rangedifferencer.RangeDifferencer -to perform a textual, line-by-line comparison of two (or three) input documents. -For text lines that differ the TextMergeViewer uses an ITokenComparator -to find longest sequences of matching and non-matching tokens. -The TextMergeViewer'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 ITokenComparator interface. -

The TextMergeViewer not only works on whole documents but on -subranges of documents too. In this case the viewer's input must be an -IDocumentRange instead of an IDocument. - - - 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 ffb82dd64..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 7f5f94b83..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.IActionDelegate; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - - -public class AddFromHistoryAction implements IActionDelegate { - - private static final String BUNDLE_NAME= "org.eclipse.compare.internal.AddFromHistoryAction"; //$NON-NLS-1$ - - private ISelection fSelection; - - public AddFromHistoryAction() { - } - - public void selectionChanged(IAction a, ISelection s) { - fSelection= s; - } - - public void run(IAction action) { - - 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(fSelection); - - 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(IContainer.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); - - 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 4c3e7dbcd..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.properties +++ /dev/null @@ -1,39 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 a0629fe62..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java +++ /dev/null @@ -1,449 +0,0 @@ -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, IStreamContentAccessor, 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 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) { - } - } - 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; - private CompareViewerSwitchingPane fStructuredComparePane; - - - 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]= (IFile) 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 parent) { - - 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 - org.eclipse.compare.Splitter hsplitter= new org.eclipse.compare.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); - - 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 vsplitter; - } - - /** - * Feeds selection from member viewer to edition viewer. - */ - private void handleMemberSelect(Widget w) { - Object 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/BinaryCompareViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java deleted file mode 100644 index 692341d66..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.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) { - - 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) { - } - } - if (right != null) { - try { - right.close(); - } catch (IOException ex) { - } - } - } - 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 5a909ee30..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerCreator.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 BinaryCompareViewer. - * 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 adf51c207..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewerResources.properties +++ /dev/null @@ -1,16 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 af6b59d02..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 { - - /** 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. - * @private - */ - void doubleBufferPaint(GC dest) { - - Point size= getSize(); - - if (size.x <= 0 || size.y <= 0) - 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 d0c6c2f52..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ResourceNode 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) { - 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= Utilities.readBytes(is); - if (bytes != null) - dst.setContent(bytes); - } catch (CoreException ex) { - } - } - 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 93fe3ab91..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ICompareConfiguration. - */ -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 d3aea03f8..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ColorEditor.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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; - } -} \ No newline at end of file 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 3e0854ec0..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; - -import org.eclipse.ui.IActionDelegate; -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareUI; - - -public class CompareAction implements IActionDelegate { - - private ResourceCompareInput fInput; - - public void run(IAction action) { - if (fInput != null) { - fInput.initializeCompareConfiguration(); - CompareUI.openCompareEditor(fInput); - fInput= null; // don't reuse this input! - } - } - - public void selectionChanged(IAction action, 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)); - - fInput= new ResourceCompareInput(cc); - } - action.setEnabled(fInput.setSelection(selection)); - } -} 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 a1f95a0ae..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - } - - 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 parent) { - - Control c= fCompareEditorInput.createContents(parent); - c.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Shell shell= c.getShell(); - shell.setText(fCompareEditorInput.getTitle()); - shell.setImage(fCompareEditorInput.getTitleImage()); - - return c; - } - - /* (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) { - } catch (OperationCanceledException x) { - } 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 37eec48db..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.widgets.*; - -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.part.EditorPart; - -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 IPropertyChangeListener { - - public final static String CONFIRM_SAVE_PROPERTY= "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY"; //$NON-NLS-1$ - - private IActionBars fActionBars; - - - public CompareEditor() { - } - - /* 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$ - - CompareEditorInput cei= (CompareEditorInput) input; - - setSite(site); - setInput(input); - - setTitleImage(cei.getTitleImage()); - setTitle(cei.getTitle()); - - if (input instanceof IPropertyChangeNotifier) - ((IPropertyChangeNotifier)input).addPropertyChangeListener(this); - } - - 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) - ((CompareEditorInput) input).createContents(parent); - } - - /* - * @see DesktopPart#dispose - */ - public void dispose() { - - IEditorInput input= getEditorInput(); - if (input instanceof IPropertyChangeNotifier) - ((IPropertyChangeNotifier)input).removePropertyChangeListener(this); - - super.dispose(); - } - - /* - * @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) { - } catch (OperationCanceledException x) { - } 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) { - if (isDirty()) - 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 ae6392730..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; - -import org.eclipse.jface.action.*; - -import org.eclipse.ui.*; -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); - fNext= new NavigationAction(bundle, true); - fPrevious= new NavigationAction(bundle, false); - fToolbarNext= new NavigationAction(bundle, true); - fToolbarPrevious= new NavigationAction(bundle, false); - } - - /* - * @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(IWorkbenchActionConstants.NEXT, fNext); - actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, fPrevious); - - CompareConfiguration cc= editor.getCompareConfiguration(); - fIgnoreWhitespace.setCompareConfiguration(cc); - } - } -} 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 5ffe65594..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2002. - * All Rights Reserved. - */ -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 315b0f548..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties +++ /dev/null @@ -1,52 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2002. -# All Rights Reserved. -# ===================================== - -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 74cfa18cd..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareNavigator.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.dialogs.MessageDialog; - -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 { - - 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 void 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; - } - // beep - if (fPanes[0] != null) { - Control c= fPanes[0].getContent(); - if (c != null) { - Display display= c.getDisplay(); - if (display != null) - display.beep(); - - String title; - String message; - if (next) { - 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(c.getShell(), title, message); - } - } - } - - 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/ComparePreferencePage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java deleted file mode 100644 index db6e783f5..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.*; -import java.io.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.jface.preference.*; -import org.eclipse.jface.util.*; - -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.IHelpContextIds; -import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; -import org.eclipse.ui.texteditor.AbstractTextEditor; - -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, IStreamContentAccessor { - 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(fContent.getBytes()); - } - }; - - 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 TEXT_FONT= PREFIX + "TextFont"; //$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$ - - - private WorkbenchChainedTextFontFieldEditor fFontEditor; - 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.STRING, TEXT_FONT), - new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE), - - 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), - }; - - - 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(USE_SPLINES, false); - store.setDefault(USE_SINGLE_LINE, false); - store.setDefault(USE_RESOLVE_UI, false); - - store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); - - WorkbenchChainedTextFontFieldEditor.startPropagate(store, TEXT_FONT); - } - - 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() { - fFontEditor.store(); - fOverlayStore.propagate(); - return true; - } - - /* - * @see PreferencePage#performDefaults() - */ - protected void performDefaults() { - - fFontEditor.loadDefault(); - - fOverlayStore.loadDefaults(); - initializeFields(); - - super.performDefaults(); - } - - /* - * @see DialogPage#dispose() - */ - public void dispose() { - - fFontEditor.setPreferencePage(null); - fFontEditor.setPreferenceStore(null); - - 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) { - - 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(); - - WorkbenchHelp.setHelp(parent, IHelpContextIds.COMPARE_VIEWERS_PREFERENCE_PAGE); - - 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$ - - 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$ - - 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$ - - fFontEditor= addTextFontEditor(composite, "ComparePreferencePage.textFont.label", TEXT_FONT); //$NON-NLS-1$ - fFontEditor.setPreferenceStore(getPreferenceStore()); - fFontEditor.setPreferencePage(this); - fFontEditor.load(); - - 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(80); - gd.heightHint= convertHeightInCharsToPixels(15); - 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("previewAncestor.txt"), //$NON-NLS-1$ - new FakeInput("previewLeft.txt"), //$NON-NLS-1$ - new FakeInput("previewRight.txt") //$NON-NLS-1$ - ) - ); - - return fPreviewViewer.getControl(); - } - - 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 WorkbenchChainedTextFontFieldEditor addTextFontEditor(Composite parent, String labelKey, String key) { - - String label= Utilities.getString(labelKey); - - Group group= new Group(parent, SWT.NULL); - group.setText(label); - GridLayout layout= new GridLayout(); - layout.numColumns= 3; - layout.marginWidth+= 3; - group.setLayout(layout); - WorkbenchChainedTextFontFieldEditor fe= new WorkbenchChainedTextFontFieldEditor(key, "", group); //$NON-NLS-1$ - - GridData gd= new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan= 2; - group.setLayoutData(gd); - - return fe; - } - - 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 filename) { - String separator= System.getProperty("line.separator"); //$NON-NLS-1$ - StringBuffer buffer= new StringBuffer(512); - BufferedReader reader= null; - try { - reader= new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename))); - String line; - while ((line= reader.readLine()) != null) { - buffer.append(line); - buffer.append(separator); - } - } catch (IOException io) { - CompareUIPlugin.log(io); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - } - } - } - 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 aec4cfb5e..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java +++ /dev/null @@ -1,859 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.MalformedURLException; -import java.lang.reflect.InvocationTargetException; -import java.util.*; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.preference.IPreferenceStore; - -import org.eclipse.core.runtime.*; -import org.eclipse.ui.model.IWorkbenchAdapter; -import org.eclipse.ui.*; -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.ui.plugin.AbstractUIPlugin; - - -/** - * 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. - *

- * 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. - *

- * This class is the plug-in runtime class for the - * "org.eclipse.compare" plug-in. - *

- */ -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; - - /** - * Creates the CompareUIPlugin object and registers all - * structure creators, content merge viewers, and structure merge viewers - * contributed to this plug-in's extension points. - *

- * Note that instances of plug-in runtime classes are automatically created - * by the platform in the course of plug-in activation. - *

- * - * @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) { - } - 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 null if - * no active workkbench page can be determined. - * - * @return the active workkbench page or null 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 null if - * no workbench window is active. - * - * @return the SWT Shell of the active workbench window, or null 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: - * '.' ' ' '.' ... - */ - 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()); - } - - 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 - * @see CompareEditorInput - */ - public void openCompareEditor(CompareEditorInput input) { - - if (compareResultOK(input)) { - IWorkbenchPage activePage= getActivePage(); - if (activePage != null) { - try { - activePage.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 true if compare result is OK to show, false 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. - *

- * 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. - *

- * - * @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 IWorkbenchAdapter.getImageDescriptor, which it - * uses to create an image if it does not already have one. - *

- * 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. - *

- * - * @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) { - } - 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 null 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 null 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 null - */ - 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 type= getType(input); - if (type == null) - return null; - - 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 null 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 null - */ - 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 type= getType(input); - type= normalizeCase(type); - - if (ITypedElement.FOLDER_TYPE.equals(type)) - return 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; - } - - /** - * 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 String getType(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); - } - boolean homogenous= false; - switch (cnt) { - case 1: - homogenous= true; - break; - case 2: - homogenous= types[0].equals(types[1]); - break; - case 3: - homogenous= types[0].equals(types[1]) && types[1].equals(types[2]); - break; - } - if (homogenous) - return types[0]; - return null; - } - - /** - * 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 null if the input isn't an IStreamContentAccessor. - */ - 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) { - } - } - } - return ITypedElement.UNKNOWN_TYPE; - } - return null; - } - - private static IViewerDescriptor getContentViewerDescriptor2(String type) { - return (IViewerDescriptor) fgContentMergeViewerDescriptors.get(normalizeCase(type)); - } - - 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"); - 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 + ">"); - } - } - } - } - } - - 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(); - } -} 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 06f195194..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -public class CompareWithEditionAction extends EditionAction { - - public CompareWithEditionAction() { - super(false, "org.eclipse.compare.internal.CompareWithEditionAction"); //$NON-NLS-1$ - } -} - 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 67a8be8e2..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.properties +++ /dev/null @@ -1,32 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ==================================== - -# @(#)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 aa3e21137..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImage.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 be2b9155b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.jface.text.*; -import org.eclipse.compare.contentmergeviewer.ITokenComparator; -import org.eclipse.compare.rangedifferencer.IRangeComparator; - -/** - * Implements the IRangeComparator interface for lines in a document. - * A DocLineComparator is used as the input for the RangeDifferencer - * engine to perform a line oriented compare on documents. - *

- * A DocLineComparator doesn't know anything about line separators because - * its notion of lines is solely defined in the underlying IDocument. - */ -public class DocLineComparator implements ITokenComparator { - - private IDocument fDocument; - private int fLineOffset; - private int fLineCount; - private int fLength; - private boolean fIgnoreWhiteSpace; - - /** - * Creates a DocLineComparator for the given document range. - * ignoreWhiteSpace controls whether comparing lines (in method - * rangesEqual) should ignore whitespace. - * - * @param document the document from which the lines are taken - * @param region if non-null only lines within this range are taken - * @param ignoreWhiteSpace if true 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) { - } - - if (fLength == 0) - fLineCount= 0; - else { - int endLine= fDocument.getNumberOfLines(); - try { - endLine= fDocument.getLineOfOffset(start + fLength); - } catch (BadLocationException ex) { - } - 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 true if a line given by the first index - * matches a line specified by the other IRangeComparator 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 true 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 true 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) { - } - } - return ""; //$NON-NLS-1$ - } - - private boolean compare(String s1, String s2) { - int i1= 0; - int i2= 0; - int l1= s1.length(); - int l2= s2.length(); - char c1= ' '; - char c2= ' '; - while (i1 < l1 || i2 < l2) { - if (i1 < l1) { - c1= s1.charAt(i1); - if (Character.isWhitespace(c1)) { - i1++; - continue; - } - } - if (i2 < l2) { - c2= s2.charAt(i2); - if (Character.isWhitespace(c2)) { - i2++; - continue; - } - } - if (c1 != c2) - return false; - i1++; - i2++; - } - 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 47338251b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 bfc9df986..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.io.InputStream; -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -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.action.IAction; -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 implements IActionDelegate { - - /** - * Implements the IStreamContentAccessor and ITypedElement protocols - * for a Document. - */ - class DocumentBufferNode implements ITypedElement, IStreamContentAccessor { - - private IDocument fDocument; - private String type; - 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(fDocument.get().getBytes()); - } - } - - private ISelection fSelection; - private String fBundleName; - private boolean fReplaceMode; - protected boolean fPrevious= false; - - EditionAction(boolean replaceMode, String bundleName) { - fReplaceMode= replaceMode; - fBundleName= bundleName; - } - - public final void selectionChanged(IAction action, ISelection selection) { - fSelection= selection; - if (action != null) { - IFile[] files= getFiles(selection, fReplaceMode); - action.setEnabled(files.length == 1); // we don't support multiple selection for now - } - } - - public void run(IAction action) { - IFile[] files= getFiles(fSelection, fReplaceMode); - 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 (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; - 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 { - InputStream is= sa.getContents(); - String text= Utilities.readString(is); - 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; - } - - private IFile[] getFiles(ISelection selection, boolean modifiable) { - ArrayList result= new ArrayList(); - Object[] s= Utilities.toArray(selection); - for (int i= 0; i < s.length; i++) { - Object o= s[i]; - IFile file= null; - if (o instanceof IFile) { - file= (IFile) o; - } else if (o instanceof IAdaptable) { - IAdaptable a= (IAdaptable) o; - Object adapter= a.getAdapter(IResource.class); - if (adapter instanceof IFile) - file= (IFile) adapter; - } - if (file != null) { - if (modifiable) { - if (!file.isReadOnly()) - result.add(file); - } else { - result.add(file); - } - } - } - return (IFile[]) result.toArray(new IFile[result.size()]); - } - - -} - 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 1d0d4ea18..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 CoreException an error dialog - * pops up showing the exception's status information. For a InvocationTargetException - * 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 JavaStatusConstants.INTERNAL_ERROR. - */ - public static void log(Throwable t, String message) { - CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(), - CompareUIPlugin.INTERNAL_ERROR, message, t)); - } - - /** - * Handles the given CoreException. The workbench shell is used as a parent - * for the dialog window. - * - * @param e the CoreException 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 CoreException. - * - * @param e the CoreException 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 InvocationTargetException. The workbench shell is used - * as a parent for the dialog window. - * - * @param e the InvocationTargetException 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 InvocationTargetException. - * - * @param e the InvocationTargetException 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/INavigatable.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java deleted file mode 100644 index 93f6850fd..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/INavigatable.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 d89af1917..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, 2002 International Business Machines Corp. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM 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 579e9cd88..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavable.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 6ee209225..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IStructureCreatorDescriptor.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.compare.structuremergeviewer.IStructureCreator; - -/** - * A factory object for creating IStructureCreators from a descriptor. - *

- * It is used when registering IStructureCreator for types - * in CompareUIPlugin.registerStructureCreator. - *

- * - * @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 7ae836e9f..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IViewerDescriptor.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 Viewers from a descriptor. - *

- * It is used when registering a viewer for a specific type - * in CompareUIPlugin.registerContentViewerDescriptor and - * in CompareUIPlugin.registerStructureViewerDescriptor. - * - * @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 a9f17141c..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/IgnoreWhiteSpaceAction.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; - -import org.eclipse.compare.*; - -/** - * Toggles the ICompareConfiguration.IGNORE_WS property of an - * ICompareConfiguration. - */ -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 1681ddcfa..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageCanvas.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * A Canvas showing a single centered SWT Image. - * If the Image is larger than the Canvas, - * Scrollbars 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 2439c6b46..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.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 fAncestorImage; - 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); - 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) { - - fAncestorImage= ancestor; - 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) { - } - } - } - - Image image= null; - Display display= canvas.getDisplay(); - if (stream != null) { - try { - image= new Image(display, stream); - } catch (SWTException ex) { - } - } - - 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) { - } - } - } - } - - 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 01397c7cf..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerCreator.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ImageMergeViewer. - * 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 aeac6a027..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewerResources.properties +++ /dev/null @@ -1,26 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 7048f4f49..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - } -} \ No newline at end of file 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 986326a85..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ListDialog.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - 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 28f04492b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 fInitialized= true; - 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) { - } - } - } - - 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) { - } - try { - endLine= doc.getLineOfOffset(start+length); - } catch(BadLocationException ex) { - } - - 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) { - } - } - 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) { - } - - 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) { - } - 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 52269f883..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 711b52cbb..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ContentMergeViewer to work on an ICompareInput - * e.g. a DiffNode. - */ -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 (((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 1c496b311..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/NullViewer.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.compare.internal; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; - -import org.eclipse.compare.CompareViewerSwitchingPane; - -/** - * 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); - - CompareViewerSwitchingPane.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 002346a8b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -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); - } -} \ No newline at end of file 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 dc9661d6b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - - -public class ReplaceWithEditionAction extends EditionAction { - - public ReplaceWithEditionAction() { - super(true, "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$ - } -} 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 51aac98d8..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties +++ /dev/null @@ -1,34 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)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 1f5fc651d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 26e5fe34d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java +++ /dev/null @@ -1,136 +0,0 @@ -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.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; - - - public ResizableDialog(Shell parent, ResourceBundle bundle) { - super(parent); - setShellStyle(getShellStyle() | SWT.RESIZE); - - fBundle= bundle; - - fSettings= CompareUIPlugin.getDefault().getDialogSettings(); - } - - 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 614790a0d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.text.MessageFormat; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.widgets.Composite; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - -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; - - - 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; - } - } - - /** - * Creates an compare editor input for the given selection. - */ - ResourceCompareInput(CompareConfiguration config) { - super(config); - } - - public Viewer createDiffViewer(Composite parent) { - Viewer v= super.createDiffViewer(parent); - if (v instanceof DiffTreeViewer) - fDiffViewer= (DiffTreeViewer) v; - return v; - } - - /** - * Returns true if compare can be executed for the given selection. - */ - boolean setSelection(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]; - } - - fAncestor= null; - fLeft= getStructure(fLeftResource); - fRight= getStructure(fRightResource); - - if (incomparable(fLeft, fRight)) - return false; - - if (fThreeWay) { - fAncestorResource= selection[0]; - fAncestor= getStructure(fAncestorResource); - - if (incomparable(fAncestor, fRight)) - 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 the given arguments cannot be compared. - */ - private boolean incomparable(IStructureComparator c1, IStructureComparator c2) { - if (c1 == null || c2 == null) - return true; - return isLeaf(c1) != isLeaf(c2); - } - - /** - * Returns true if the given arguments is a leaf. - */ - private boolean isLeaf(IStructureComparator c) { - if (c instanceof ITypedElement) { - ITypedElement te= (ITypedElement) c; - return !ITypedElement.FOLDER_TYPE.equals(te.getType()); - } - return false; - } - - /** - * Creates a IStructureComparator for the given input. - * Returns null if no IStructureComparator - * can be found for the IResource. - */ - private IStructureComparator getStructure(IResource input) { - - if (input instanceof IContainer) - return new BufferedResourceNode(input); - - if (input instanceof IFile) { - IStructureComparator rn= new BufferedResourceNode(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(); - } - } - - private String buildLabel(IResource r) { - //return r.getName(); - 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 abf8efe3d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowPseudoConflicts.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.util.ResourceBundle; - -import org.eclipse.compare.*; - -/** - * Toggles the ICompareConfiguration.SHOW_PSEUDO_CONFLICTS property of an - * ICompareConfiguration. - */ -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 31adfe1a8..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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= ((ICompareInput) fInput).getLeft(); - fSourceViewer.setDocument(new Document(getString(left))); - } - } - - public Object getInput() { - return fInput; - } - - private String getString(Object input) { - - if (input instanceof IStreamContentAccessor) { - IStreamContentAccessor sca= (IStreamContentAccessor) input; - try { - return Utilities.readString(sca.getContents()); - } catch (CoreException ex) { - } - } - 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 c33ac3c76..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved - */ -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; iTextMergeViewer. - * 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 e1c22cf8d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TextViewerCreator.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 TextMergeViewer. - * 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); - } -} \ No newline at end of file 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 986f45361..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TimeoutContext.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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); - - 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) { - } - - 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 6e8bb17e0..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/TokenComparator.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ITokenComparator interface for words (or tokens) - * in a string. - * A TokenComparator is used as the input for the RangeDifferencer - * 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 TokenComparator 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 TokenComparator 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 true if a token given by the first index - * matches a token specified by the other IRangeComparator 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 true 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 true 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 c892df46d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal; - -import java.io.*; -import java.text.MessageFormat; -import java.util.*; - -import org.eclipse.swt.widgets.*; - -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.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; - -import org.eclipse.ui.*; - -import org.eclipse.compare.CompareConfiguration; - -/** - * Convenience and utility methods. - */ -public class Utilities { - - 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(); - } - - public static boolean isMotif() { - return false; - } - - /** - * Returns the elements of the given selection. - * Returns an empty array if the selection is empty or if - * the given selection is not of type IStructuredSelection. - * - * @param selection the selection - * @return the selected elements - */ - public static Object[] toArray(ISelection selection) { - if (!(selection instanceof IStructuredSelection)) { - return new Object[0]; - } - IStructuredSelection ss= (IStructuredSelection) selection; - return ss.toArray(); - } - - /** - * Convenience method: extract all IResources from given selection. - * Never returns null. - */ - public static IResource[] getResources(ISelection selection) { - - ArrayList tmp= new ArrayList(); - - if (selection instanceof IStructuredSelection) { - - Object[] s= ((IStructuredSelection)selection).toArray(); - - for (int i= 0; i < s.length; i++) { - Object o= s[i]; - if (o instanceof IResource) { - tmp.add(o); - continue; - } - if (o instanceof IAdaptable) { - IAdaptable a= (IAdaptable) o; - Object adapter= a.getAdapter(IResource.class); - if (adapter instanceof IResource) - tmp.add(adapter); - continue; - } - } - } - return (IResource[]) tmp.toArray(new IResource[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) { - } - } - try { - bos.close(); - } catch (IOException x) { - } - } - - return bos.toByteArray(); - } - - /** - * Returns null if an error occurred. - */ - public static String readString(InputStream is) { - 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, ResourcesPlugin.getEncoding())); - - while ((read= reader.read(part)) != -1) - buffer.append(part, 0, read); - - return buffer.toString(); - - } catch (IOException ex) { - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ex) { - } - } - } - return null; - } - - 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) { - } - } - 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) { - } - } - 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) { - } catch (MissingResourceException x) { - } - } - return dfltValue; - } - - /** - * Answers true if the given selection contains resources that don't - * have overlapping paths and false 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; - } - */ -} 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 8a7c7acf0..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 Viewers from an IConfigurationElement. - */ -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) { - } - } - - 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 81208e39c..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerSwitchingCancelled.java +++ /dev/null @@ -1,7 +0,0 @@ -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 a592ab176..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 null 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) { - } - } - - /* package */ List readLines() { - try { - List lines= new ArrayList(); - String line; - while ((line= readLine()) != null) - lines.add(line); - return lines; - } catch (IOException ex) { - //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 1fbb4fc7a..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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.action.IAction; -import org.eclipse.jface.dialogs.Dialog; -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.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - -import org.eclipse.ui.IActionDelegate; -import org.eclipse.ui.IEditorPart; - -import org.eclipse.compare.internal.*; - - -public class CompareWithPatchAction implements IActionDelegate { - - static class PatchWizardDialog extends WizardDialog { - - PatchWizardDialog(Shell parent, IWizard wizard) { - super(parent, wizard); - - setShellStyle(getShellStyle() | SWT.RESIZE); - setMinimumPageSize(700, 500); - } - } - - private ISelection fSelection; - private boolean fSavedFiles; - private boolean fAutobuildState; - - - public void selectionChanged(IAction action, ISelection selection) { - fSelection= selection; - IResource[] resources= PatchWizard.getResource(fSelection); - action.setEnabled(resources != null && resources.length == 1); - } - - public void run(IAction action) { - PatchWizard wizard= new PatchWizard(fSelection); - - 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()); - fSavedFiles= true; - } 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()); - } - } - ); - 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() == Dialog.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 9d1c9f5ec..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Diff.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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((Hunk[]) 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 77211f319..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Hunk.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 fIsEnabled2= 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 fIsEnabled2; - } - - void setEnabled(boolean b) { - fIsEnabled2= b; - } - - 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: - *

    - *
  • - * '+': add the line - *
  • - * '-': delete the line - *
  • - * ' ': no change, context line - *
- */ - 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 37b7afe57..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java +++ /dev/null @@ -1,621 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.util.*; - -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.viewers.*; -import org.eclipse.jface.wizard.*; - -import org.eclipse.ui.help.*; -import org.eclipse.ui.model.*; - -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; - - private final static int SIZING_SELECTION_WIDGET_WIDTH= 400; - private final static int SIZING_SELECTION_WIDGET_HEIGHT= 150; - - // dialog store id constants - private final static String PAGE_NAME= "PatchWizardPage1"; //$NON-NLS-1$ - private final static String STORE_PATCH_FILE_ID= PAGE_NAME + ".PATCH_FILE"; //$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$ - - // help IDs - private final static String PATCH_HELP_CONTEXT_ID= "PatchWizardHelpId"; //$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(); - - WorkbenchHelp.setHelp(composite, PATCH_HELP_CONTEXT_ID); - } - - /* (non-JavaDoc) - * Method declared in IWizardPage. - */ - public IWizardPage getNextPage() { - if (true) { - - Patcher patcher= ((PatchWizard) getWizard()).getPatcher(); - - // 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); - } - } 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$ - } - } - } - - // 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) { - } - } - - Diff[] diffs= patcher.getDiffs(); - if (diffs == null || diffs.length == 0) { - String source= getUseClipboard() ? "Clipboard" //$NON-NLS-1$ - : "File"; //$NON-NLS-1$ - MessageDialog.openError(null, - PatchMessages.getString("InputPatchPage.PatchErrorDialog.title"), //$NON-NLS-1$ - PatchMessages.getString("InputPatchPage.NoDiffsFound_"+source+".message")); //$NON-NLS-1$ //$NON-NLS-2$ - return this; - } - - // guess prefix count - int guess= guessPrefix(diffs); - patcher.setStripPrefixSegments(guess); - } - return super.getNextPage(); - } - - private int guessPrefix(Diff[] diffs) { - /* - ArrayList list= new ArrayList(); - IResource target= fPatchWizard.getTarget(); - if (target instanceof IFile) { - list.add(target.getFullPath()); - } else if (target instanceof IContainer) { - addLeaf(list, (IContainer) target); - } - - // guess prefix count - for (int i= 0; i < diffs.length; i++) { - IPath p= diffs[i].fOldPath; - if (p != null) { - int matches= match(p, list); - if (matches > 0) { - return p.segmentCount() - matches; - } - } - } - */ - return 0; - } - - private int match(IPath path, ArrayList list) { - Iterator iter= list.iterator(); - while (iter.hasNext()) { - IPath filePath= (IPath) iter.next(); - int matches= matchTrailingSegments(path, filePath); - if (matches > 0) - return matches; - } - return 0; - } - - private int matchTrailingSegments(IPath p1, IPath p2) { - int matches= 0; - int i1= p1.segmentCount()-1; - int i2= p2.segmentCount()-1; - for (; i1 >= 0 && i2 >= 0; i1--, i2--) { - String s1= p1.segment(i1); - String s2= p2.segment(i2); - if (!s1.equals(s2)) - break; - matches++; - } - return matches; - } - - private void addLeaf(ArrayList list, IContainer c) { - IResource[] rs= null; - try { - rs= c.members(); - } catch(CoreException ex) { - } - if (rs != null) { - for (int i= 0; i < rs.length; i++) { - IResource r= rs[i]; - if (r instanceof IFile) - list.add(r.getFullPath()); - else if (r instanceof IContainer) - addLeaf(list, (IContainer) r); - } - } - } - - /* (non-JavaDoc) - * Method declared in IWizardPage. - */ - public boolean canFlipToNextPage() { - if (true) { - // 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(); - } else { - return super.canFlipToNextPage(); - } - } - - 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(PatchWizard.getResource(event.getSelection())); - updateWidgetEnablements(); - } - } - ); - //fPatchFileNameField.setFocus(); - } - - /** - * Returns a content provider for IResources that returns - * only children of the given resource type. - */ - private ITreeContentProvider getResourceProvider(final int resourceType) { - return new WorkbenchContentProvider() { - public Object[] getChildren(Object o) { - if (o instanceof IContainer) { - try { - ArrayList results= new ArrayList(); - IResource[] members= ((IContainer)o).members(); - for (int i= 0; i < members.length; i++) - // filter out the desired resource types - if ((members[i].getType() & resourceType) != 0) - results.add(members[i]); - return results.toArray(); - } catch (CoreException e) { - } - } - // just return an empty set of children - return new Object[0]; - } - }; - } - - /** - * 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$ - } - - /** - * Creates a new label with a bold font. - * - * @param parent the parent control - * @param text the label text - * @return the new label control - */ - private static Label buildPlainLabel(Composite parent, String text) { - Label label= new Label(parent, SWT.NONE); - label.setText(text); - GridData data= new GridData(); - data.verticalAlignment= GridData.FILL; - data.horizontalAlignment= GridData.FILL; - label.setLayoutData(data); - return label; - } - - /** - * 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 COMBO_HISTORY_LENGTH. - * - * @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 a592ab176..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 null 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) { - } - } - - /* package */ List readLines() { - try { - List lines= new ArrayList(); - String line; - while ((line= readLine()) != null) - lines.add(line); - return lines; - } catch (IOException ex) { - //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/PatchCompareInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareInput.java deleted file mode 100644 index 938a98e36..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareInput.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.io.ByteArrayInputStream; -import java.text.MessageFormat; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.core.runtime.*; -import org.eclipse.core.resources.*; - -import org.eclipse.jface.viewers.*; - -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.compare.internal.*; - - -/** - * A PatchCompareInput uses a Patcher to - * patch selected workspace resources. - */ -/* package */ class PatchCompareInput extends CompareEditorInput { - - static class Rejected extends DiffNode implements IStreamContentAccessor { - Diff fDiff; - String fName; - Rejected(IDiffContainer parent, String name, Diff diff) { - super(parent, Differencer.NO_CHANGE); - fName= name; - fDiff= diff; - } - public String getName() { - return fName + " *"; //$NON-NLS-1$ - } - public String getType() { - return "txt"; //$NON-NLS-1$ - } - public Image getImage() { - return CompareUI.getImage("file"); //$NON-NLS-1$ - } - public InputStream getContents() { - return new ByteArrayInputStream(fDiff.fRejected.getBytes()); - } - } - - private DiffNode fRoot; - private IResource fTarget; - private Patcher fPatcher; - - /** - * Creates an compare editor input for the given selection. - */ - /* package */ PatchCompareInput(CompareConfiguration config, Patcher patcher, ISelection selection) { - super(config); - fPatcher= patcher; - IResource[] s= Utilities.getResources(selection); - if (s.length == 1) - fTarget= s[0]; - - if (fPatcher != null) { - String rformat= PatchMessages.getString("PatchCompareInput.RightTitle.format"); //$NON-NLS-1$ - String rightLabel= MessageFormat.format(rformat, new String[] { fPatcher.getName() } ); - config.setRightLabel(rightLabel); - //cc.setRightImage(CompareUIPlugin.getImage(fRightResource)); - } - - if (fTarget != null) { - String leftLabel= fTarget.getName(); - config.setLeftLabel(leftLabel); - config.setLeftImage(CompareUIPlugin.getImage(fTarget)); - } - } - - /** - * Performs a two-way or three-way diff on the current selection. - */ - public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException { - - try { - Diff[] diffs= fPatcher.getDiffs(); - - pm.beginTask(Utilities.getString("ResourceCompare.taskName"), diffs.length); //$NON-NLS-1$ - - fRoot= new DiffNode(0); - IContainer rootFolder= null; - if (fTarget instanceof IContainer) - rootFolder= (IContainer) fTarget; - - for (int i= 0; i < diffs.length; i++) { - Diff diff= diffs[i]; - if (diff.isEnabled()) { - IPath path= fPatcher.getPath(diff); - createPath(fRoot, rootFolder, path, diff, false); - - String rej= diff.fRejected; - if (rej != null) { - IPath pp= path.removeLastSegments(1); - pp= pp.append(path.lastSegment() + ".rej"); //$NON-NLS-1$ - createPath(fRoot, rootFolder, pp, diff, true); - } - } - pm.worked(1); - } - - fTarget.refreshLocal(IResource.DEPTH_INFINITE, pm); - - String leftLabel= fTarget.getName(); - - String rformat= PatchMessages.getString("PatchCompareInput.RightTitle.format"); //$NON-NLS-1$ - String rightLabel= MessageFormat.format(rformat, new String[] { fPatcher.getName() } ); - - String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$ - String title= MessageFormat.format(format, new String[] {leftLabel, rightLabel} ); - setTitle(title); - - return fRoot; - - } catch (CoreException ex) { - throw new InvocationTargetException(ex); - } finally { - pm.done(); - } - } - - public void saveChanges(IProgressMonitor pm) throws CoreException { - if (fRoot instanceof DiffNode) { - try { - commit(pm, (DiffNode) fRoot); - } finally { - setDirty(false); - } - } - } - - /* - * Recursively walks the diff tree and commits all changes. - */ - private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - - ITypedElement left= node.getLeft(); - if (left instanceof 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 void createPath(DiffContainer root, IContainer folder, IPath path, Diff diff, boolean reject) { - if (path.segmentCount() > 1) { - IFolder f= folder.getFolder(path.uptoSegment(1)); - IDiffElement child= root.findChild(path.segment(0)); - if (child == null) { - ResourceNode rn= new ResourceNode(f); - child= new DiffNode(root, Differencer.CHANGE, null, rn, rn); - } - if (child instanceof DiffContainer) - createPath((DiffContainer)child, f, path.removeFirstSegments(1), diff, reject); - } else { - // a leaf - BufferedResourceNode rn= new BufferedResourceNode(folder.getFile(path)); - if (reject) { - new Rejected(root, path.segment(0), diff); - } else { - new DiffNode(root, diff.getType(), null, rn, new PatchedResource(rn, diff, path, fPatcher)); - } - } - } -} - - 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 faae17288..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 648ef156c..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2002. - * All Rights Reserved. - */ -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 a407ec0e9..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties +++ /dev/null @@ -1,79 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2002. -# All Rights Reserved. -# ===================================== - -# -# '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 must be saved before this operation.\nPress OK to confirm or Cancel otherwise - -# -# PatchWizard -# -PatchWizard.title=Resource Patcher -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 what resource to patch with which patch -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=Nothing selected to apply patch to -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.NoDiffsFound_Clipboard.message=Clipboard does not contain valid patch -InputPatchPage.NoDiffsFound_File.message=File does not contain valid patch - -# -# PreviewPatchPage -# -PreviewPatchPage.title= Verify Patch -PreviewPatchPage.message= The tree shows the contents of the patch.\nA checked item indicates that a patch could be applied successfully. Uncheck an item if you want to exclude it. -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) - -# -# 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 f966cc568..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; - -import org.eclipse.swt.graphics.Image; - -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.*; -import org.eclipse.compare.internal.*; -import org.eclipse.compare.structuremergeviewer.Differencer; - - -/* 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 PreviewPatchPage fPreviewPatchPage; - - private Patcher fPatcher; - private IResource fTarget; - - - /** - * Creates a wizard for applying a patch file to the workspace. - */ - /* package */ PatchWizard(ISelection selection) { - - setTargets(getResource(selection)); - - fPatcher= new Patcher(); - - setWindowTitle(PatchMessages.getString("PatchWizard.title")); //$NON-NLS-1$ - - 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); - } - } - - static IResource[] getResource(ISelection selection) { - IResource[] rs= Utilities.getResources(selection); - ArrayList list= null; - for (int i= 0; i < rs.length; i++) { - IResource r= rs[i]; - if (r != null && r.isAccessible()) { - if (list == null) - list= new ArrayList(); - list.add(r); - } - } - if (list != null && list.size() > 0) - return (IResource[]) list.toArray(new IResource[list.size()]); - return null; - } - - Patcher getPatcher() { - return fPatcher; - } - - IResource getTarget() { - return fTarget; - } - - void setTargets(IResource[] targets) { - 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(fPreviewPatchPage= new PreviewPatchPage(this)); - } - - /* (non-Javadoc) - * Method declared on IWizard. - */ - public boolean needsProgressMonitor() { - return true; - } - - /* (non-Javadoc) - * Method declared on IWizard. - */ - public boolean performFinish() { - - if (false) { - CompareConfiguration cc= new CompareConfiguration() { - public Image getImage(int kind) { - if (kind == Differencer.ADDITION) - kind= Differencer.DELETION; - else if (kind == Differencer.DELETION) - kind= Differencer.ADDITION; - return super.getImage(kind); - } - public Image getImage(Image base, int kind) { - if (kind == Differencer.ADDITION) - kind= Differencer.DELETION; - else if (kind == Differencer.DELETION) - kind= Differencer.ADDITION; - return super.getImage(base, kind); - } - }; - cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false)); - - fPatcher.setName(fPatchWizardPage.getPatchName()); - - CompareUI.openCompareEditor(new PatchCompareInput(cc, fPatcher, new StructuredSelection(fTarget))); - } else { - fPatcher.setName(fPatchWizardPage.getPatchName()); - - try { - WorkspaceModifyOperation op= new WorkspaceModifyOperation() { - protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - fPatcher.applyAll(getTarget(), monitor); - } 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 - } - } - - // 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/PatchedResource.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchedResource.java deleted file mode 100644 index 49825501a..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchedResource.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; - -import org.eclipse.compare.*; - - -/* package */ class PatchedResource implements ITypedElement, IStreamContentAccessor { - - private Diff fDiff; - private IStreamContentAccessor fCurrent; - private IPath fPath; - private byte[] fContent; - private Patcher fPatcher; - - /* package */ PatchedResource(IStreamContentAccessor current, Diff diff, IPath path, Patcher patcher) { - fDiff= diff; - fCurrent= current; - fPath= path; - fPatcher= patcher; - } - - public InputStream getContents() throws CoreException { - if (fContent == null) { - InputStream is= null; - - try { - is= fCurrent.getContents(); - } catch (CoreException ex) { - is= new ByteArrayInputStream(new byte[0]); - } - if (is != null) { - - try { - String encoding= ResourcesPlugin.getEncoding(); - BufferedReader br= new BufferedReader(new InputStreamReader(is, encoding)); - String s= fPatcher.patch(fDiff,br, null); - if (s != null) - fContent= s.getBytes(encoding); - } catch (UnsupportedEncodingException e) { - throw new CoreException(new Status(IStatus.ERROR, CompareUI.PLUGIN_ID, Platform.PLUGIN_ERROR, e.getMessage(), e)); - } - - try { - is.close(); - } catch (IOException ex) { - } - } - } - return new ByteArrayInputStream(fContent); - } - - public Image getImage() { - return CompareUI.getImage(getType()); - } - - public String getName() { - return fPath.toOSString(); - } - - public String getType() { - String type= fPath.getFileExtension(); - if (type != null) - return type; - return ITypedElement.UNKNOWN_TYPE; - } -} - 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 a20360ddc..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java +++ /dev/null @@ -1,1003 +0,0 @@ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.text.*; -import java.util.*; - -import org.eclipse.jface.util.Assert; - -import org.eclipse.core.runtime.*; -import org.eclipse.core.resources.*; - -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; - - - Patcher() { - } - - //---- options - - void setName(String name) { - fName= name; - } - - String getName() { - return fName; - } - - /** - * Returns an array of Diffs after a sucessfull call to parse. - * If parse hasn't been called returns null. - */ - 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 true if new value differs from old. - */ - boolean setStripPrefixSegments(int strip) { - if (strip != fStripPrefixSegments) { - fStripPrefixSegments= strip; - return true; - } - return false; - } - - int getStripPrefixSegments() { - return fStripPrefixSegments; - } - - /** - * Returns true if new value differs from old. - */ - boolean setFuzz(int fuzz) { - if (fuzz != fFuzz) { - fFuzz= fuzz; - return true; - } - return false; - } - - /** - * Returns true 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 true 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); - 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((Diff[]) 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) { - } - } - // 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 patch the contents of the given reader with the specified Diff. - * Any hunk that couldn't be applied is returned in the list failedHunks. - */ - /* package */ String patch(Diff diff, BufferedReader reader, List failedHunks) { - - List lines= new LineReader(reader).readLines(); - if (lines == null) - lines= new ArrayList(); - - patch(diff, lines, failedHunks); - - return createString(lines); - } - - /** - * 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)) { - shift+= doPatch(hunk, lines, shift); - } else { - boolean found= false; - int oldShift= shift; - - for (int i= shift-1; i > shift-fFuzz; i--) { - if (tryPatch(hunk, lines, i)) { - shift= i; - found= true; - break; - } - } - - if (! found) { - for (int i= shift+1; i < shift+fFuzz; i++) { - if (tryPatch(hunk, lines, i)) { - 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 contextMatches= 0; - 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))) { - contextMatches++; - pos++; - break; - } - if (contextMatches <= 0) - return false; - pos++; - } - } 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 charcter: " + 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) throws CoreException { - - final int WORK_UNIT= 10; - - IFile file= null; // file to be patched - IContainer container= null; - if (target instanceof IContainer) - container= (IContainer) target; - else if (target instanceof IFile) { - file= (IFile) target; - container= file.getParent(); - } else { - Assert.isTrue(false); - } - - if (pm != null) { - String message= PatchMessages.getString("Patcher.Task.message"); //$NON-NLS-1$ - pm.beginTask(message, fDiffs.length*WORK_UNIT); - } - - for (int 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()); - - if (container != null) - file= 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) { - } - } - } - } - - 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. - */ - private 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, ResourcesPlugin.getEncoding()); - } catch (UnsupportedEncodingException x) { - // use default encoding - streamReader= new InputStreamReader(is); - } - - BufferedReader reader= new BufferedReader(streamReader); - lines= new LineReader(reader).readLines(); - } catch(CoreException ex) { - } finally { - if (is != null) - try { - is.close(); - } catch(IOException ex) { - } - } - } - - 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(ResourcesPlugin.getEncoding()); - } 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) { - } - } - } - - /** - * 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 Character.isWhitespace(...). - */ - 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; - } -} 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 19151ec35..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java +++ /dev/null @@ -1,597 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.internal.patch; - -import java.io.*; -import java.util.*; - -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.viewers.Viewer; -import org.eclipse.jface.wizard.WizardPage; -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.structuremergeviewer.*; - - -/** - * Shows the parsed patch file and any mismatches - * between files, hunks and the currently selected - * resources. - */ -/* package */ class PreviewPatchPage extends WizardPage { - - /** - * Used with CompareInput - */ - static class HunkInput implements ITypedElement, IStreamContentAccessor { - 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(fContent.getBytes()); - } - }; - - private PatchWizard fPatchWizard; - - private Tree fTree; - private Combo fStripPrefixSegments; - private CompareViewerSwitchingPane fHunkViewer; - private Button fIgnoreWhitespaceButton; - private Button fReversePatchButton; - private Text fFuzzField; - - private Image fNullImage; - private Image fAddImage; - private Image fDelImage; - private Image fErrorImage; - private Image fErrorAddImage; - private Image fErrorDelImage; - - 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(); - - fNullImage= new DiffImage(null, null, w).createImage(); - fAddImage= new DiffImage(null, addId, w).createImage(); - fDelImage= new DiffImage(null, delId, w).createImage(); - - fErrorImage= new DiffImage(errIm, null, w).createImage(); - fErrorAddImage= new DiffImage(errIm, addId, w).createImage(); - fErrorDelImage= 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 fAddImage; - case Differencer.DELETION: - return fDelImage; - } - return fNullImage; - } - switch (diff.getType()) { - case Differencer.ADDITION: - return fErrorAddImage; - case Differencer.DELETION: - return fErrorDelImage; - } - return fErrorImage; - } - - Image getImage(Hunk hunk) { - if (hunk.fMatches) - return fNullImage; - return fErrorImage; - } - - 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); - - 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); - } - } - } - ); - - // creating tree's content - buildTree(); - - // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer(this, PATCH_HELP_CONTEXT_ID)); - } - - /** - * Create the group for setting various patch options - */ - private void buildPatchOptionsGroup(Composite parent) { - - final Patcher patcher= fPatchWizard.getPatcher(); - - Group group= new Group(parent, SWT.NONE); - group.setText(PatchMessages.getString("PreviewPatchPage.PatchOptions.title")); //$NON-NLS-1$ - GridLayout layout= new GridLayout(); - layout.numColumns= 5; - group.setLayout(layout); - group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); - //fPatchFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // 1st row - new Label(group, SWT.NONE).setText(PatchMessages.getString("PreviewPatchPage.IgnoreSegments.text")); //$NON-NLS-1$ - - fStripPrefixSegments= new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.SIMPLE); - int prefixCnt= patcher.getStripPrefixSegments(); - String prefix= Integer.toString(prefixCnt); - fStripPrefixSegments.add(prefix); - fStripPrefixSegments.setText(prefix); - - addSpacer(group); - - fReversePatchButton= new Button(group, SWT.CHECK); - fReversePatchButton.setText(PatchMessages.getString("PreviewPatchPage.ReversePatch.text")); //$NON-NLS-1$ - - addSpacer(group); - - // 2nd row - Label l= new Label(group, SWT.NONE); - l.setText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.text")); //$NON-NLS-1$ - l.setToolTipText(PatchMessages.getString("PreviewPatchPage.FuzzFactor.tooltip")); //$NON-NLS-1$ - fFuzzField= new Text(group, SWT.BORDER); - fFuzzField.setText("2"); //$NON-NLS-1$ - GridData gd2= new GridData(GridData.HORIZONTAL_ALIGN_CENTER); - gd2.widthHint= 30; - fFuzzField.setLayoutData(gd2); - - 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(); - } - } - ); - } - - 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) { - 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(); - fPatchWizard.getPatcher().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) { - } - } - return stripPrefixSegments; - } - - private int getFuzzFactor() { - int fuzzFactor= 0; - if (fFuzzField != null) { - String s= fFuzzField.getText(); - try { - fuzzFactor= Integer.parseInt(s); - } catch(NumberFormatException ex) { - } - } - 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/internal/previewAncestor.txt b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewAncestor.txt deleted file mode 100644 index 75ada4dda..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewAncestor.txt +++ /dev/null @@ -1,10 +0,0 @@ -a -b -c -d -e -f -g -h -i -j \ No newline at end of file diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt deleted file mode 100644 index 253c5b567..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewLeft.txt +++ /dev/null @@ -1,10 +0,0 @@ -a -x -c -z -e -f -g -h -i -j \ No newline at end of file diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt deleted file mode 100644 index bc1af89f4..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/previewRight.txt +++ /dev/null @@ -1,10 +0,0 @@ -a -y -c -z -e -f -g -h -i -j \ No newline at end of file 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 @@ - - - - - - - Package-level Javadoc - - -Provides support for performing structural and textual -compare operations on arbitrary data and displaying the results. -

-Package Specification

- -The class CompareUI 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. -

- -A compare operation must be implemented as a subclass of CompareEditorInput. -A CompareEditorInput 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. -

- -The NavigationAction is used to navigate (step) through the individual -differences of a CompareEditorInput. -

- -An instance of CompareConfiguration 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 CompareEditorInput -on creation. -

- -When implementing a hierarchical compare operation as a subclass of -CompareEditorInput clients have to provide a tree of objects where each -node implements the interface -org.eclipse.compare.structuremergeviewer.IStructureComparator. -This interface is used by the hierarchical differencing engine -(org.eclipse.compare.structuremergeviewer.Differencer) to walk the tree. -
-In addition every leaf of the tree must implement the IStreamContentAccessor -interface in order to give the differencing engine access to its stream content. -

- -The abstract class BufferedContent provides a default implementation -for the IStreamContentAccessor and IContentChangeNotifier interfaces. -Its subclass ResourceNode adds an implementation for the -IStructureComparator and ITypedElement interfaces -based on Eclipse workbench resources (org.eclipse.core.resources.IResource). -It can be used without modification as the input to the differencing engine. -

- -The ZipFileStructureCreator is an implementation of the -org.eclipse.compare.structuremergeviewer.IStructureCreator interface -and makes the contents of a zip archive available as a -hierarchical structure of IStructureComparators which can be easily compared -by the differencing engine (org.eclipse.compare.structuremergeviewer.Differencer). -It is a good example for how to make structured files available to the hierarchical -compare functionality of the Compare plugin. -

- -The EditionSelectionDialog is a simple selection 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 "Replace with Version" or "Replace with Edition" on workbench resources. -

- -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. This functionality -can be used to implement "Replace with Method Edition" for the Java -language. -

- -The EditionSelectionDialog requires that the editions implement -the IStreamContentAccessor and IModificationDate interfaces. -The HistoryItem is a convenience class that implements these interfaces -for IFileState objects. -

- - -The CompareViewerPane is a convenience class which provides -a label and local toolbar for a compare viewer (or any other subclass of a -JFace Viewer). -
-Its abstract subclass CompareViewerSwitchingPane supports dynamic -viewer switching, 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. - - - - 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 21f6c53a8..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/DifferencesIterator.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -import java.util.ArrayList; -import java.util.List; - -/** - * A custom iterator to iterate over a List of RangeDifferences. - * It is used internally by the RangeDifferencer. - */ -/* package */ class DifferencesIterator { - - List fRange; - int fIndex; - RangeDifference[] fArray; - RangeDifference fDifference; - - /** - * Creates a differences iterator on an array of RangeDifferences. - */ - 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 RangeDifference. - */ - 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 RangeDifferences - */ - 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 a5e21418e..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/IRangeComparator.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -/** - * For breaking an object to compare into a sequence of comparable entities. - *

- * It is used by RangeDifferencer to find longest sequences of - * matching and non-matching ranges. - *

- * 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. getRangeCount would return the number of lines in the - * document, and rangesEqual would compare a specified line given - * with one in another IRangeComparator. - *

- *

- * Clients should implement this interface; there is no standard implementation. - *

- */ -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 IRangeComparator and index. - * - * @param thisIndex the index of the comparable entity within this IRangeComparator - * @param other the IRangeComparator to compare this with - * @param otherIndex the index of the comparable entity within the other IRangeComparator - * @return true 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 - * true or false - * @param maxLength another number on which to base the decision whether to return - * true or false - * @param other the other IRangeComparator to compare with - * @return true 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 1a457193d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/LinkedRangeDifference.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -/* package */ class LinkedRangeDifference extends RangeDifference { - - static final int INSERT= 0; - static final int DELETE= 1; - static final int CHANGE= 2; - static final int ERROR= 3; - - 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 3bf64d72e..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifference.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.rangedifferencer; - -/** - * Description of a change between two or three ranges of comparable entities. - *

- * RangeDifference objects are the elements of a compare result returned from - * the RangeDifferencer find* methods. - * Clients use these objects as they are returned from the differencer. - * This class is not intended to be instantiated or subclassed. - *

- * Note: A range in the RangeDifference 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. - *

- * - * @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 RIGHT) */ - 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 RangeDifference 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 RangeDifference 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 - * NOCHANGE, CHANGE, LEFT, RIGHT, - * ANCESTOR, CONFLICT, ERROR - */ - 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 f2fa311b3..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 RangeDifferencer finds the differences between two or three IRangeComparators. - *

- * To use the differencer, clients provide an IRangeComparator - * that breaks their input data into a sequence of comparable entities. The differencer - * returns the differences among these sequences as an array of RangeDifference objects - * (findDifferences methods). - * Every RangeDifference represents a single kind of difference - * and the corresponding ranges of the underlying comparable entities in the - * left, right, and optionally ancestor sides. - *

- * Alternatively, the findRanges methods not only return objects for - * the differing ranges but for non-differing ranges too. - *

- * The algorithm used is an objectified version of one described in: - * A File Comparison Program, 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 IRangeComparators. - * The differences are returned as an array of RangeDifferences. - * 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 IRangeComparators. - * The differences are returned as an array of RangeDifferences. - * If no differences are detected an empty array is returned. - * - * @param pm if not null 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 IRangeComparators. - * The differences are returned as a list of RangeDifferences. - * If no differences are detected an empty list is returned. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param ancestor the ancestor range comparator or null - * @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 IRangeComparators. - * The differences are returned as a list of RangeDifferences. - * If no differences are detected an empty list is returned. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param pm if not null used to report progress - * @param ancestor the ancestor range comparator or null - * @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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference 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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference elements for non-differing ranges too. - * - * @param pm if not null 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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference elements for non-differing ranges too. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param pm if not null used to report progress - * @param ancestor the ancestor range comparator or null - * @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 IRangeComparators. - * In contrast to findDifferences, the result - * contains RangeDifference elements for non-differing ranges too. - * If the ancestor range comparator is null, a two-way - * comparison is performed. - * - * @param pm if not null used to report progress - * @param ancestor the ancestor range comparator or null - * @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= (RangeDifference) 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 RangeDifference3 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 right and 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 @@ - - - - - - - Package-level Javadoc - - -Provides support for finding the differences between -two or three sequences of comparable entities. -

-Package Specification

- -The class RangeDifferencer finds longest sequences of matching and -non-matching comparable entities. Its implementation is based on -an objectified version of the algorithm described in: -A File Comparison Program, by Webb Miller and Eugene W. Myers, -Software Practice and Experience, Vol. 15, Nov. 1985. -

- -Clients must supply the input to the differencer as an implementation -of the IRangeComparator interface. -An IRangeComparator breaks the input data into a sequence -of entities and provides a method for comparing -one entity with the entity in another IRangeComparator. -

- -For example, to compare two text documents and find longest common -sequences of matching and non-matching lines, -the implementation of IRangeComparator -must break the document into lines and provide a method for testing -whether two lines are considered equal. -See org.eclipse.compare.internal.DocLineComparator for how this can be done. -

- -The differencer returns the differences among these sequences as an -array of RangeDifference objects. -Every single RangeDifference 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. - - - 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 2f1b5398b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -import java.util.ArrayList; - -/** - * The standard implementation of a diff container element. - *

- * This class may be instantiated, or further subclassed. - *

- */ -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 null. - * @param name of the container - * @param kind of difference (defined in Differencer). - */ - public DiffContainer(IDiffContainer parent, int kind) { - super(parent, kind); - } - - /** - * Tries to find the child with the given name. - * Returns null 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 2aa6ecae9..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffElement.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.compare.ITypedElement; - -/** - * An abstract base implementation of the IDiffElement interface. - *

- * Subclasses may add behavior and state, and may override getImage - * and getType to suit. - *

- */ -public abstract class DiffElement implements IDiffElement { - - private int fKind; - private IDiffContainer fParent; - - /** - * Creates a new DiffElement as a child of the given parent. - * If parent is not null the new element is added to the parent. - * - * @param parent the parent of this child; if not null 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 DiffElement implementation of this ITypedInput - * method returns null. Subclasses may re-implement to provide - * an image for this element. - */ - public Image getImage() { - return null; - } - - /** - * The DiffElement implementation of this ITypedElement - * method returns ITypedElement.UNKNOWN_TYPE. 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 3776443cb..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ITypedElement and ICompareInput - * interfaces it can be used directly to display the - * compare result in a DiffTreeViewer and as the input to any other - * compare/merge viewer. - *

- * DiffNodes are typically created as the result of performing - * a compare with the Differencer. - *

- * 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 DiffNode and initializes with the given values. - * - * @param parent under which the new container is added as a child or null - * @param kind of difference (defined in Differencer) - * @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 DiffNode with diff kind Differencer.CHANGE - * 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 DiffNode and initializes with the given values. - * - * @param kind of difference (defined in Differencer) - * @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 DiffNode with the given diff kind. - * - * @param kind of difference (defined in Differencer) - */ - public DiffNode(int kind) { - super(null, kind); - } - - /** - * Creates a new DiffNode and initializes with the given values. - * - * @param parent under which the new container is added as a child or null - * @param kind of difference (defined in Differencer) - */ - public DiffNode(IDiffContainer parent, int kind) { - super(parent, kind); - } - - /** - * Registers a listener for changes of this ICompareInput. - * 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 ICompareInput 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 ICompareInput. - */ - 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 true if this node shouldn't automatically be expanded in - * a DiffTreeViewer. - * - * @return true if node shouldn't automatically be expanded - */ - public boolean dontExpand() { - return fDontExpand; - } - - /** - * Controls whether this node is not automatically expanded when displayed in - * a DiffTreeViewer. - * - * @param dontExpand if true this node is not automatically expanded in DiffTreeViewer - */ - public void setDontExpand(boolean dontExpand) { - fDontExpand= dontExpand; - } - - /** - * Returns the first not-null input of this node. - * Method checks the three inputs in the order: ancestor, right, left. - * - * @return the first not-null input of this node - */ - public ITypedElement getId() { - if (fAncestor != null) - return fAncestor; - if (fRight != null) - return fRight; - return fLeft; - } - - /** - * Returns the (non-null) name of the left or right side if they are identical. - * Otherwise both names are concatenated (separated with a slash ('/')). - *

- * 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((ITypedElement)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 3c3915a09..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java +++ /dev/null @@ -1,707 +0,0 @@ -/* - * Copyright (c) 2000,2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 IDiffContainer and IDiffElement interfaces. - *

- * This class may be instantiated; it is not intended to be subclassed outside - * this package. - *

- * - * @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 ViewerFilter fViewerFilter; - private IPropertyChangeListener fPropertyChangeListener; - - private Action fCopyLeftToRightAction; - private Action fCopyRightToLeftAction; - private Action fNextAction; - private Action fPreviousAction; - 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= CompareViewerSwitchingPane.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 mm) { - fillContextMenu(mm); - if (mm.isEmpty()) { - if (fEmptyMenuAction == null) { - fEmptyMenuAction= - new Action(Utilities.getString(fBundle, "emptyMenuItem")) {}; //$NON-NLS-1$ - fEmptyMenuAction.setEnabled(false); - } - mm.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 inputChanged - * after a new input has been set but before any controls are updated. - * This default implementation calls navigate(true) - * 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 DiffNodes that shouldn't expand - * (i.e. where the dontExpand method returns true). - */ - 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 internalExpandToLevel - * to control whether a given model node should be expanded or not. - * This default implementation checks whether the object is a DiffNode and - * calls dontExpand() 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 false if a node should be expanded, true 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 ToolBarManager. Two actions - * allow for copying one side of a DiffNode to the other side. - * Two other actions are for navigating from one node to the next (previous). - *

- * 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 DiffNode 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$ - } - ISelection selection= getSelection(); - fExpandAllAction.setEnabled(selection != null && !selection.isEmpty()); - 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 DiffNodes in the current selection to the other side. - * Called from the (internal) actions for copying the sides of a DiffNode. - * Clients may override. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 ICompareInput.copy(...). - * Clients may override. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 true 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 true the next node is selected, otherwise the previous node - * @return true 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 f0cf96fa6..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties +++ /dev/null @@ -1,44 +0,0 @@ -# ===================================== -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -# ===================================== - -# @(#)DiffTreeViewerResources.properties -# -# Resource strings for DiffTreeViewer.java - -title= Structure Compare -defaultLabel= - -##################################################### -# Dummy menu item for empty context menu -##################################################### - -emptyMenuItem= - -##################################################### -# Actions -##################################################### - -action.Smart.label=Smart -action.Smart.tooltip=Try to Guess Similar Elements -action.Smart.image=smartmode_co.gif - -action.ExpandAll.label=Expand All -action.ExpandAll.tooltip=Expand All Nodes - -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 aeecf85ba..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java +++ /dev/null @@ -1,515 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * The engine is used by calling one of the findDifferences methods and passing - * in the objects to compare. - * The engine calls the following methods on the input objects to perform the compare: - *

    - *
  • getChildren: for enumerating the children of an object (if any), - *
  • contentsEqual: for comparing the content of leaf objects, that is, objects without children, - *
  • visit: for every pair of compared object the compare result is passed in. - *
- * 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: - *
    - *
  • getChildren: tries to apply the IStructureComparator - * interface to enumerate the children, - *
  • contentsEqual: tries to apply the IStreamContentAccessor interface - * to perform a byte-wise content comparison, - *
  • visit: creates a DiffNode for any detected difference between the compared objects and - * links it under a parent node effectively creating a tree of differences. - *
- * 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 true 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 updateProgress which is called for every node or - * leaf compare. The method returns the object that was returned from the top-most call to method visit. - * At most two of the ancestor, left, and right parameters are allowed to be null. - * - * @param threeWay if true a three-way comparison is performed, otherwise a two-way compare - * @param pm a progress monitor which is passed to method updateProgress - * @param data a client data that is passed to the top-level call to visit - * @param ancestor the ancestor object of the compare (may be null) - * @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 visit, - * possibly null - */ - 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 visit method on the parent input. - * It can be considered the "parent" reference and is useful when building a tree. - *

- * The Differencer implementation returns a new - * DiffNode which is initialized with the corresponding values. - * Subclasses may override. - * - * @param data object returned from parent call to visit, - * possibly null - * @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 null - */ - protected Object visit(Object data, int result, Object ancestor, Object left, Object right) { - return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right); - } - - /** - * 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. - *

- * The Differencer implementation - * returns true if both inputs implement IStreamContentAccessor - * and their byte contents is identical. Subclasses may override to implement - * a different content compare on the given inputs. - *

- * - * @param input1 first input to contents compare - * @param input2 second input to contents compare - * @return true 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) { - } finally { - if (is1 != null) { - try { - is1.close(); - } catch(IOException ex) { - } - } - if (is2 != null) { - try { - is2.close(); - } catch(IOException ex) { - } - } - } - return false; - } - - /** - * Tries to return an InputStream for the given object. - * Returns null 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) { - } - } - return null; - } - - /** - * Returns the children of the given input or null if there are no children. - *

- * The Differencer implementation checks whether the input - * implements the IStructureComparator interface. If yes it is used - * to return an array containing all children. Otherwise null is returned. - * Subclasses may override to implement a different strategy to enumerate children. - *

- * - * @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. - *

- * The Differencer implementation shows the name of the input object - * as a subtask. Subclasses may override. - *

- * - * @param progressMonitor the progress monitor for reporting progress - * @name input a non-null input object - */ - 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 0b20deb07..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - * DocumentRangeNodes 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 DocumentRangeNode maps to a range - * of characters in the document. - *

- * Since a DocumentRangeNode implements the IStructureComparator - * and IStreamContentAccessor 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. - *

- * Subclasses may add additional state collected while parsing the document. - *

- * @see Differencer - */ -public class DocumentRangeNode - implements IDocumentRange, IStructureComparator, IEditableContent, IStreamContentAccessor { - - private static final boolean POS_UPDATE= true; - - 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 DocumentRangeNode for the given range within the specified - * document. The typeCode 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) { - } catch (BadLocationException ex) { - } - } - } - - /* (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 equals and hashcode. - * - * @return the node's id - */ - public String getId() { - return fID; - } - - /** - * Sets this node's id. - * It is used in equals and hashcode. - * - * @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. - *

- * E.g. when parsing a Java document the "append position" of a DocumentRangeNode - * 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) { - } catch (BadLocationException ex) { - // ignore - } - } else { - fAppendPosition= new Position(pos); - } - } - - /** - * Returns the position that has been set with setAppendPosition. - * If setAppendPosition 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) { - } catch (BadLocationException ex) { - // ignore - } - } else { - fAppendPosition= new Position(fBaseDocument.getLength()); - } - } - return fAppendPosition; - } - - /** - * Implementation based on getID. - */ - 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 getID. - */ - 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) { - // ignore - } - } - } - - /* (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(s.getBytes()); - } - - /* (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 { - InputStream is= ((IStreamContentAccessor)other).getContents(); - byte[] bytes= Utilities.readBytes(is); - srcContents= new String(bytes); - } catch(CoreException ex) { - } - } - } - - if (child != null) { // there is a destination - -// if (child instanceof DocumentRangeNode) { -// DocumentRangeNode drn= (DocumentRangeNode) child; -// -// IDocument doc= drn.getDocument(); -// Position range= drn.getRange(); -// try { -// doc.replace(range.getOffset(), range.getLength(), srcContents); -// } catch (BadLocationException ex) { -// } -// } - } else { - // no destination: we have to add the contents into the parent - add(srcContents, null /*srcParentNode*/, src); - } - return child; - } - - /* (non Javadoc) - * see IEditableContent.setContent - */ - public void setContent(byte[] content) { -// fBaseDocument.set(new String(content)); - } -} - 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 9979935ea..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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. - *

- * Note: at most two sides of an ICompareInput can be null, - * (as it is normal for additions or deletions) but not all three. - *

- * ICompareInput provides methods for registering - * ICompareInputChangeListeners - * that get informed if one (or more) - * of the three sides of an ICompareInput object changes its value. - *

- * For example when accepting an incoming addition - * the (non-null) left side of an ICompareInput - * is copied to the right side by means of method copy. - * This should trigger a call to compareInputChanged of registered - * ICompareInputChangeListeners. - *

- * Clients can implement this interface, or use the convenience implementation - * DiffNode. - *

- * - * @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-null 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-null sides. - * - * @return image representing this input, or null 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 ICompareInput - * is the result of another compare. In this case it is used - * together with getImage to compose a icon - * which reflects the kind of difference between the two or three elements. - * - * @return kind of difference (see Differencer) - */ - int getKind(); - - /** - * Returns the ancestor side of this input. - * Returns null if this input has no ancestor - * or in the two-way compare case. - * - * @return the ancestor of this input, or null - */ - ITypedElement getAncestor(); - - /** - * Returns the left side of this input. - * Returns null if there is no left side (deletion or addition). - * - * @return the left side of this input, or null - */ - ITypedElement getLeft(); - - /** - * Returns the right side of this input. - * Returns null if there is no right side (deletion or addition). - * - * @return the right side of this input, or null - */ - 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 leftToRight. This method is called from - * a merge viewer if a corresponding action ("take left" or "take right") - * has been pressed. - *

- * The implementation should handle the following cases: - *

    - *
  • - * if the source side is null the destination must be deleted, - *
  • - * if the destination is null the destination must be created - * and filled with the contents from the source, - *
  • - * if both sides are non-null the contents of source must be copied to destination. - *
- * In addition the implementation should send out notification to the registered - * ICompareInputChangeListener. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 601bc1466..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -/** - * Listener that gets informed if one (or more) - * of the three sides of an ICompareInput object changes its value. - *

- * For example when accepting an incoming addition - * the (non-null) left side of an ICompareInput - * is copied to the right side (which was null). - * This triggers a call to compareInputChanged of registered - * ICompareInputChangeListener. - *

- * Note however, that listener are not informed if the content of one of the sides changes. - *

- * Clients may implement this interface. It is also implemented by viewers that take - * an ICompareInput as input. - *

- */ -public interface ICompareInputChangeListener { - - /** - * Called whenever the value (not the content) of one or more of the three sides - * of a ICompareInput has changed. - * - * @param source the ICompareInput 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 f4d472fbe..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -/** - * IDiffContainer is a IDiffElement with children. - *

- * IDiffContainer are the inner nodes displayed - * by the DiffTreeViewer. - * IDiffContainer are typically created as the result of performing - * a compare with the Differencer. - *

- * Clients may implement this interface, or use one of the standard implementations, - * DiffContainer or DiffNode. - * - * @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 getChildren method. - * - * @return true 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 null). - * - * @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 d2dbb59a0..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -import org.eclipse.compare.ITypedElement; - -/** - * An IDiffElement is used in the DiffTreeViewer - * to display the kind of change detected as the result of a two-way or three-way compare. - *

- * The base interface ITypedElement provides a name, a type, and an image. - * IDiffElement adds API for maintaining a parent relationship. - *

- * DiffTreeViewer works on a tree of IDiffElements. - * Leaf elements must implement the - * IDiffElement interface, inner nodes the IDiffContainer interface. - *

- * IDiffElements are typically created as the result of performing - * a compare with the Differencer. - *

- * Clients may implement this interface, or use one of the standard implementations, - * DiffElement, DiffContainer, or DiffNode. - * - * @see DiffTreeViewer - * @see DiffElement - * @see DiffContainer - * @see DiffNode - */ -public interface IDiffElement extends ITypedElement { - - /** - * Returns the kind of difference as defined in Differencer. - * - * @return the kind of difference as defined in Differencer - */ - int getKind(); - - /** - * Returns the parent of this element. - * If the object is the root of a hierarchy null is returned. - * - * @return the parent of this element, or null if the element has no parent - */ - IDiffContainer getParent(); - - /** - * Sets the parent of this element. - * - * @param parent the new parent of this element, or null 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 45bc52994..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package org.eclipse.compare.structuremergeviewer; - -/** - * Interface used to compare hierarchical structures. - * It is used by the differencing engine. - *

- * 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 null - * 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, equals would return true - * 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 true if this object is the same as the other argument; false 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 a27175e6b..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 - * IStructureComparators 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. - *

- * Structure creators are used in the following contexts: - *

    - *
  • - * the StructureDiffViewer uses an IStructureCreator to - * build two (or three) tree structures of its input elements (method getStructure). - * These trees are then compared with each other by means of the differencing engine and displayed - * with the DiffTreeViewer, - *
  • - *
  • - * the ReplaceWithEditionDialog uses an IStructureCreator - * to map a path back to a range of characters in the textual representation. - *
  • - *
- * A IStructureCreator 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. - *

- *

- * Clients may implement this interface; there is no standard implementation. - *

- * - * @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 StructureDiffViewer. - * - * @return a descriptive name for this IStructureCreator - */ - String getName(); - - /** - * Creates a tree structure consisting of IStructureComparators - * 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 null is returned. - * - * @param input the object from which to create the tree of IStructureComparator - * @return the root node of the structure or null 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 null is returned. - * This method is similar to getStructure but in - * contrast to getStructure only a single node without any children must be returned. - * This method is used in the ReplaceWithEditionDialog to locate a sub element - * (e.g. a method) within an input object (e.g. a file containing source code). - *

- * One (not optimized) approach to implement this method is calling getStructure(input) - * to build the full tree, and then finding that node within the tree that is specified - * by path. - *

- * The syntax of path 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 path to the selectEdition - * method of ReplaceWithEditionDialog and will receive this value unchanged - * as an argument to locate. - * - * @param path specifies a sub object within the input object - * @param input the object from which to create the IStructureComparator - * @return the single node specified by path or null - * - * @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 ignoreWhitespace is true 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 true 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 getStructure - */ - 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 d7e6af9a4..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies 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 IStructureCreator - * to retrieve a hierarchical structure from the input object (an ICompareInput) - * and perform a two-way or three-way compare on it. - *

- * This class may be instantiated; it is not intended to be subclassed outside - * this package. - *

- * - * @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 ICompareInputChangeListener fThreeWayInputChangedListener; - 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); - } - }; - fThreeWayInputChangedListener= new ICompareInputChangeListener() { - public void compareInputChanged(ICompareInput input) { - StructureDiffViewer.this.compareInputChanged(input); - } - }; - } - - /** - * Configures the StructureDiffViewer 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 ICompareInput. - * - * @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 null if no - * structure creator has been set with setStructureCreator. - * - * @return the structure creator or null - */ - public IStructureCreator getStructureCreator() { - return fStructureCreator; - } - - /** - * Reimplemented to get the descriptive title for this viewer from the IStructureCreator. - */ - 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 diff. - * - * @return the root of the diff tree produced by method diff - */ - 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 getInput is not identical to getRoot. - */ - 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; - fThreeWayInputChangedListener= 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 diff 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 diff() 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 diff() 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-null 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 null 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 save method on the structure creator after - * nodes have been copied from one side to the other side of an input object. - * - * @param leftToRight if true the left side is copied to the right side. - * If false 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 @@ - - - - - - - Package-level Javadoc - - -Provides support for finding and displaying the differences -between hierarchically structured data. -

-Package Specification

- -The class Differencer 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. -

- -If the input elements to the differencing engine implement the IStructureComparator -interface the engine recursively applies itself to the children of -the input element. Leaf elements must implement the org.eclipse.compare.IStreamContentAccessor -interface so that the differencer can perform a bytewise comparison on their contents. -

- -One good example for this is org.eclipse.compare.ResourceNode which implements both interfaces -(and more) for Eclipse workspace resources (org.eclipse.core.resources.IResource). -

- -Another example is the DocumentRangeNode 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 -(org.eclipse.compare.contentmergeviewer.IDocumentRange). -
-Typically DocumentRangeNodes 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 JavaNode (in org.eclipse.jdt.internal.ui.compare) -and PropertyNode (in org.eclipse.jdt.internal.ui.compare) are good examples for this. -

- -By default the differencing engine returns the result of the compare operation -as a tree of DiffNode objects. However, this can be changed by overriding -a single method of the engine. -

- -Every DiffNode describes the changes among the two or three inputs. -

- -A tree of DiffNodes can be displayed in a DiffTreeViewer. -The DiffTreeViewer requires that inner nodes of the tree implement -the IDiffContainer interface and leafs the IDiffElement interface. -

- -The typical steps to compare hierarchically structured data and to display -the differences would be to: -

    -
  • -map the input data into a tree of IStructureComparator and IStreamContentAccessors,
  • - -
  • -perform the compare operation by means of the Differencer, and
  • - -
  • -feed the differencing result into the DiffTreeViewer.
  • - -
- -The StructureDiffViewer is a specialized DiffTreeViewer -that automates the three steps from above. It takes a single input object -of type ICompareInput from which it retrieves the two or three -input elements to compare. Then it uses a IStructureCreator to -extract a tree of IStructureComparator and IStreamContentAccessor -from them. These trees are then compared with the differencing engine and -the result is displayed in the tree viewer. -

- - - - - 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/ancestorpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copy_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/copycont_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/next_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/prev_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/smartmode_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/syncpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/clcl16/twowaycompare_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/conflict_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ctool16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/cview16/compare_view.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/ancestorpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copy_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/copycont_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/next_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/prev_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/smartmode_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/syncpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dlcl16/twowaycompare_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/conflict_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/dtool16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/ancestorpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copy_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_l_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/copycont_r_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/next_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/prev_nav.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/smartmode_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/syncpane_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/elcl16/twowaycompare_co.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/conflict_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/etool16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/eview16/compare_view.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/day_obj.gif and /dev/null differ diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resolved.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resolved.gif deleted file mode 100644 index 96d149cb8..000000000 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resolved.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/resource_obj.gif and /dev/null differ diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/unresolved.gif b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/unresolved.gif deleted file mode 100644 index 95b2ad5fa..000000000 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/obj16/unresolved.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/add_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/chg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/confdel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/del_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/error_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/inchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/indel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/outdel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_inchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_indel_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outadd_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outchg_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/icons/full/ovr16/r_outdel_ov.gif and /dev/null 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 9396d843f..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties +++ /dev/null @@ -1,140 +0,0 @@ -######################################### -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -######################################### -# -# 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: Must be CompareEditorInput - -# -# 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 -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.textFont.label= Text &font -# Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=19211 -ComparePreferencePage.showMoreInfo.label= &Show additional compare information in the status line -ComparePreferencePage.preview.label= Preview: -ComparePreferencePage.ancestor.label= Common Ancestor -ComparePreferencePage.left.label= Local -ComparePreferencePage.right.label= Remote -ComparePreferencePage.structureCompare.label= &Open structure compare automatically -ComparePreferencePage.generalTab.label= &General -ComparePreferencePage.textCompareTab.label= &Text Compare -ComparePreferencePage.backgroundColor1.label= Bac&kground Color: -ComparePreferencePage.backgroundColor2.label= S&ystem Default -ComparePreferencePage.backgroundColor3.label= C&ustom -# Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20077 -ComparePreferencePage.ignoreWhitespace.label= Ignore &white space - -# New UI -ComparePreferencePage.useSplines.label= [Experimental] Use splines in center panel -ComparePreferencePage.useSingleLine.label= [Experimental] Connect ranges with single line -ComparePreferencePage.useResolveUI.label= [Experimental] Use new resolve UI - -# -# 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.threeWay.title=Compare ({0}-{1}-{2}) - -# -# DiffTreeViewer & DiffNodes -# -DiffTreeViewer.title= Structure Compare -DiffNode.noName= -DiffNode.nameFormat= {0} / {1} - -# -# Differencing engine -# -Differencer.progressFormat= Comparing {0} - -# -# Patch: rejected patch markers -# -rejectedPatchMarker.name= Rejected Patch 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 b68d4731a..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 faaacedf2..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentMergeViewers.exsd +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - This extension point allows to plug in a compare/merge -viewer for specific content types. The viewer must -extend <samp>org.eclipse.jface.viewers.Viewer</samp>. -However since viewers don't have a default constructor -the extension point must implement a factory object -for viewers: the interface -<samp>org.eclipse.compare.IViewerCreator</samp>. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the viewer - - - - - - - name of a class that implements a factory for the -content merge viewer and implements -<samp>org.eclipse.compare.IViewerCreator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "java, gif" - - - - - - - - - - - - The following is an example of compare/merge viewer -for text files (extension "txt"): -<p> -<pre> -<extension point = "org.eclipse.compare.contentMergeViewers"> - <viewer - id="org.eclipse.compare.contentmergeviewer.TextMergeViewer" - class="org.eclipse.compare.internal.TextMergeViewerCreator" - extensions="txt" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines content viewers for text, binary contents, and images. - - - - - - - - - - - - - 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 b88b3152d..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/contentViewers.exsd +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - This extension point allows to plug in a viewer for -specific content types. These viewers are used in -the EditionSelectionDialog when presenting an edition -of a resource or a subsection thereof. The viewer -must extend <samp>org.eclipse.jface.viewers.Viewer</samp> -and must accept a viewer input of type -<samp>IStreamContentAccessor</samp>. -However since viewers don't have a default -constructor the extension point must implement a -factory object for viewers: the interface -<samp>org.eclipse.compare.IViewerCreator</samp>. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the viewer - - - - - - - name of a class that implements a factory for the -content merge viewer and implements -<samp>org.eclipse.compare.IViewerCreator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "java, gif" - - - - - - - - - - - - The following is an example of a viewer for text -files (extension "txt"): -<p> -<pre> -<extension point = "org.eclipse.compare.contentViewers"> - <viewer - id="org.eclipse.compare.internal.TextViewer" - class="org.eclipse.compare.internal.TextViewerCreator" - extensions="txt" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines content viewers for -text and images. - - - - - - - - - <p> -<a href="hglegal.htm"> - <img SRC="ngibmcpy.gif" - ALT="Copyright IBM Corp. 2000, 2003. All Rights Reserved." - BORDER=0 height=14 width=324></a> -</p> - - - - 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 b52f3abb2..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureCreators.exsd +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - This extension point allows to plug in an object -that produces a tree structure of -<samp>IStructureComparator</samp> for a given content. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the structure creator - - - - - - - name of a class that implements the structure creator -and implements -<samp>org.eclipse.compare.structuremergeviewer.IStructureComparator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "java, properties" - - - - - - - - - - - - The following is an example of a structure creator for -java files (extension "java"): -<p> -<pre> -<extension point = "org.eclipse.compare.structureCreators"> - <structureCreator - id="org.eclipse.compare.JavaStructureCreator" - class="org.eclipse.compare.JavaStructureCreator" - extensions="java" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines a structure -creator for zip archives. - - - - - - - - - <p> -<a href="hglegal.htm"> - <img SRC="ngibmcpy.gif" - ALT="Copyright IBM Corp. 2000, 2003. All Rights Reserved." - BORDER=0 height=14 width=324></a> -</p> - - - - 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 910a5ebfe..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/schema/structureMergeViewers.exsd +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - This extension point allows to plug in a compare/merge -viewer for structured content. The viewer must extend -<samp>org.eclipse.jface.viewers.Viewer</samp>. -However since viewers don't have a default -constructor the extension point must implement a -factory object for viewers: the interface -<samp>org.eclipse.compare.IViewerCreator</samp>. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the viewer - - - - - - - name of a class that implements a factory for the -content merge viewer and implements -<samp>org.eclipse.compare.IViewerCreator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "zip, jar" - - - - - - - - - - - - The following is an example of compare/merge viewer -for zip files (extension "zip"): -<p> -<pre> -<extension point = "org.eclipse.compare.structureMergeViewers"> - <viewer - id="org.eclipse.compare.ZipCompareViewer" - class="org.eclipse.compare.ZipCompareViewerCreator" - extensions="zip" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines a structure compare -viewer for zip archives. - - - - - - - - - <p> -<a href="hglegal.htm"> - <img SRC="ngibmcpy.gif" - ALT="Copyright IBM Corp. 2000, 2003. All Rights Reserved." - BORDER=0 height=14 width=324></a> -</p> - - - - 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 b533d2ebd..000000000 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/scripts/exportplugin.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.compare/schema/contentMergeViewers.exsd b/bundles/org.eclipse.compare/schema/contentMergeViewers.exsd deleted file mode 100644 index faaacedf2..000000000 --- a/bundles/org.eclipse.compare/schema/contentMergeViewers.exsd +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - This extension point allows to plug in a compare/merge -viewer for specific content types. The viewer must -extend <samp>org.eclipse.jface.viewers.Viewer</samp>. -However since viewers don't have a default constructor -the extension point must implement a factory object -for viewers: the interface -<samp>org.eclipse.compare.IViewerCreator</samp>. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the viewer - - - - - - - name of a class that implements a factory for the -content merge viewer and implements -<samp>org.eclipse.compare.IViewerCreator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "java, gif" - - - - - - - - - - - - The following is an example of compare/merge viewer -for text files (extension "txt"): -<p> -<pre> -<extension point = "org.eclipse.compare.contentMergeViewers"> - <viewer - id="org.eclipse.compare.contentmergeviewer.TextMergeViewer" - class="org.eclipse.compare.internal.TextMergeViewerCreator" - extensions="txt" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines content viewers for text, binary contents, and images. - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.compare/schema/contentViewers.exsd b/bundles/org.eclipse.compare/schema/contentViewers.exsd deleted file mode 100644 index b88b3152d..000000000 --- a/bundles/org.eclipse.compare/schema/contentViewers.exsd +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - This extension point allows to plug in a viewer for -specific content types. These viewers are used in -the EditionSelectionDialog when presenting an edition -of a resource or a subsection thereof. The viewer -must extend <samp>org.eclipse.jface.viewers.Viewer</samp> -and must accept a viewer input of type -<samp>IStreamContentAccessor</samp>. -However since viewers don't have a default -constructor the extension point must implement a -factory object for viewers: the interface -<samp>org.eclipse.compare.IViewerCreator</samp>. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the viewer - - - - - - - name of a class that implements a factory for the -content merge viewer and implements -<samp>org.eclipse.compare.IViewerCreator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "java, gif" - - - - - - - - - - - - The following is an example of a viewer for text -files (extension "txt"): -<p> -<pre> -<extension point = "org.eclipse.compare.contentViewers"> - <viewer - id="org.eclipse.compare.internal.TextViewer" - class="org.eclipse.compare.internal.TextViewerCreator" - extensions="txt" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines content viewers for -text and images. - - - - - - - - - <p> -<a href="hglegal.htm"> - <img SRC="ngibmcpy.gif" - ALT="Copyright IBM Corp. 2000, 2003. All Rights Reserved." - BORDER=0 height=14 width=324></a> -</p> - - - - diff --git a/bundles/org.eclipse.compare/schema/structureCreators.exsd b/bundles/org.eclipse.compare/schema/structureCreators.exsd deleted file mode 100644 index b52f3abb2..000000000 --- a/bundles/org.eclipse.compare/schema/structureCreators.exsd +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - This extension point allows to plug in an object -that produces a tree structure of -<samp>IStructureComparator</samp> for a given content. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the structure creator - - - - - - - name of a class that implements the structure creator -and implements -<samp>org.eclipse.compare.structuremergeviewer.IStructureComparator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "java, properties" - - - - - - - - - - - - The following is an example of a structure creator for -java files (extension "java"): -<p> -<pre> -<extension point = "org.eclipse.compare.structureCreators"> - <structureCreator - id="org.eclipse.compare.JavaStructureCreator" - class="org.eclipse.compare.JavaStructureCreator" - extensions="java" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines a structure -creator for zip archives. - - - - - - - - - <p> -<a href="hglegal.htm"> - <img SRC="ngibmcpy.gif" - ALT="Copyright IBM Corp. 2000, 2003. All Rights Reserved." - BORDER=0 height=14 width=324></a> -</p> - - - - diff --git a/bundles/org.eclipse.compare/schema/structureMergeViewers.exsd b/bundles/org.eclipse.compare/schema/structureMergeViewers.exsd deleted file mode 100644 index 910a5ebfe..000000000 --- a/bundles/org.eclipse.compare/schema/structureMergeViewers.exsd +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - This extension point allows to plug in a compare/merge -viewer for structured content. The viewer must extend -<samp>org.eclipse.jface.viewers.Viewer</samp>. -However since viewers don't have a default -constructor the extension point must implement a -factory object for viewers: the interface -<samp>org.eclipse.compare.IViewerCreator</samp>. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a unique identifier that can be used to reference the viewer - - - - - - - name of a class that implements a factory for the -content merge viewer and implements -<samp>org.eclipse.compare.IViewerCreator</samp> - - - - - - - - - - a comma separated list of file extensions e.g . "zip, jar" - - - - - - - - - - - - The following is an example of compare/merge viewer -for zip files (extension "zip"): -<p> -<pre> -<extension point = "org.eclipse.compare.structureMergeViewers"> - <viewer - id="org.eclipse.compare.ZipCompareViewer" - class="org.eclipse.compare.ZipCompareViewerCreator" - extensions="zip" - /> -</extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - The Compare UI plugin defines a structure compare -viewer for zip archives. - - - - - - - - - <p> -<a href="hglegal.htm"> - <img SRC="ngibmcpy.gif" - ALT="Copyright IBM Corp. 2000, 2003. All Rights Reserved." - BORDER=0 height=14 width=324></a> -</p> - - - - diff --git a/bundles/org.eclipse.compare/scripts/exportplugin.xml b/bundles/org.eclipse.compare/scripts/exportplugin.xml deleted file mode 100644 index b533d2ebd..000000000 --- a/bundles/org.eclipse.compare/scripts/exportplugin.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.team.core/.classpath b/bundles/org.eclipse.team.core/.classpath deleted file mode 100644 index 4432f278d..000000000 --- a/bundles/org.eclipse.team.core/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - 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 5acda000b..000000000 --- a/bundles/org.eclipse.team.core/.options +++ /dev/null @@ -1,4 +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 \ 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 39d74e11c..000000000 --- a/bundles/org.eclipse.team.core/.project +++ /dev/null @@ -1,20 +0,0 @@ - - - org.eclipse.team.core - - - org.apache.xerces - org.eclipse.core.resources - org.eclipse.core.runtime - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - 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 @@ - - - -About - - - -

About This Content

- -

20th June, 2002

-

License

-

Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

- -

Contributions

- -

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.

- -

If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

- - - \ 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 f90d8d5b1..000000000 --- a/bundles/org.eclipse.team.core/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# 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 159207d73..000000000 --- a/bundles/org.eclipse.team.core/buildnotes_team.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - - - - - - - - - - Eclipse Platform Release Notes - VCM - - - - - - -

- -

- -

- -

- -

- -

- -

Eclipse Platform Build Notes – Team Support

-

Team build I20020909 – September 9, 2002

- -

Build submission for Integration Build 20020910

- -

What's new in this build

- -

The ability to export/import target sites has been added along -with properties pages for target sites and deployed projects.

- -

Eclipse Platform Build Notes – Team Support

-

Team build I20020517 – May 17 2002

- -

Build submission for Integration Build 20020517

- -

What's new in this build

- -

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.

- -

- -

- -

- -

- -

- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020430 – April 30 2002

- -

Build submission for Integration Build 20020430

- -

What's new in this build

- -

No major changes

- -

- -

- -

- -

- -

- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020423 – April 23 2002

- -

Build submission for Integration Build 20020423

- -

What's new in this build

- -

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.

- -

- -

- -

- -

- -

- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020418 – April 18 2002

- -

Build submission for Integration Build 20020418

- -

What's new in this build

- -

No significant changes to the core Team support in this - build.

- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020409 – April 9 2002

- -

Build submission for Integration Build 20020409

- -

What's new in this build

- -

No significant changes to the core Team support in this - build.

-
- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020402 – April 2 2002

- -

Build submission for Integration Build 20020402

- -

What's new in this build

- -

Team plug-ins are now turned on by default. The - old VCM plug-ins are still included in the build but are turned off.
- 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.
-
-

- -


-

- -
-

Eclipse Platform Build Notes – Team Support

- -

Team build I20020312 – March 12 2002

- -

Build submission for Integration Build 20020312

- -

What's new in this build

- -

- -

Team plug-ins are now turned on by default. The - old VCM plug-ins are still included in the build but are turned off.

- -


- The Decorations extension point has been removed from org.eclipse.team.ui. - Please use the generic workbench decoration facility in the future.
-

- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020305 – March 5 2002

- -

Build submission for Integration Build 20020305

- -

What's new in this drop

- -

No changes to the core team support in this drop.

- -


- All Team plug-ins are turned off by default. If you wish to use Team - support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml 
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml 
  4. -
  5. Rename plugins/org.eclipse.team.core/plugin.xml.off - to plugins/org.eclipse.team.core/plugin.xml 
  6. -
  7. Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off - to plugins/org.eclipse.team.cvs.core/plugin.xml 
  8. -
  9. Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off - to plugins/org.eclipse.team.cvs.ssh/plugin.xml 
  10. - -
- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020226 – February 26, 2002

- -

Build submission for Integration Build 20020226

- -

What's new in this drop

- -

- -

- -

- -

No changes in this drop.

- -


- All Team plug-ins are turned off by default. If you wish to use Team - support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml 
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml 
  4. -
  5. Rename plugins/org.eclipse.team.core/plugin.xml.off - to plugins/org.eclipse.team.core/plugin.xml 
  6. -
  7. Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off - to plugins/org.eclipse.team.cvs.core/plugin.xml 
  8. -
  9. Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off - to plugins/org.eclipse.team.cvs.ssh/plugin.xml 
  10. - -
- -

Eclipse Platform Build Notes – Team Support

- -

Team build I20020214 – February 14, 2002

- -

Build submission for Integration Build 20020214

- -

What's new in this drop

- -

Bug fixes:

- -

Change in semantics to validateEdit (9802)

- -

 

- -

All Team plug-ins are turned off by default. If you -wish to use Team support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml
  4. -
  5. Rename plugins/org.eclipse.team.core/plugin.xml.off - to plugins/org.eclipse.team.core/plugin.xml
  6. -
  7. Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off - to plugins/org.eclipse.team.cvs.core/plugin.xml
  8. -
  9. Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off - to plugins/org.eclipse.team.cvs.ssh/plugin.xml
  10. - -
- -

Eclipse Platform Build Notes – Team Support

- -

Team build V2_0_6 – February 12, 2002

- -

Build submission for Integration Build 20020212

- -

What's new in this drop

- -

48 bugs fixed.

- -

Global ignore facility added to the core team support.

- -

 

- -

All Team plug-ins are turned off by default. If you -wish to use Team support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml
  4. -
  5. Rename plugins/org.eclipse.team.core/plugin.xml.off - to plugins/org.eclipse.team.core/plugin.xml
  6. -
  7. Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off - to plugins/org.eclipse.team.cvs.core/plugin.xml
  8. -
  9. Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off - to plugins/org.eclipse.team.cvs.ssh/plugin.xml
  10. - -
- -

-  

- -

Please report any problems to the VCM team, and use -the VCM component for bug tracking.

- -

Eclipse Platform Build Notes – Team Support

- -

Team build V2_0_5 – February 5, 2002

- -

Build submission for Integration Build 20020205

- -

What's new in this drop

- -

41 bugs fixed.

- -

CVS operations move from the CVS submenu to the Team - submenu.

- -

Proper plugin.xml files will be included with this build.

- -

 

- -

All Team plug-ins are turned off by default. If you -wish to use Team support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml
  4. -
  5. Rename plugins/org.eclipse.team.core/plugin.xml.off - to plugins/org.eclipse.team.core/plugin.xml
  6. -
  7. Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off - to plugins/org.eclipse.team.cvs.core/plugin.xml
  8. -
  9. Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off - to plugins/org.eclipse.team.cvs.ssh/plugin.xml
  10. - -
- -

-  

- -

Please report any problems to the VCM team, and use -the VCM component for bug tracking.

- -

 

- -

Run - this query to determine which bugs have been fixed since January - 29 th. If you wish to narrow the search, edit the query and - change the dates.

- -

Eclipse Platform Build Notes – Team Support

- -

Team build V2_0_4 – January 29, 2002

- -

Build submission for Integration Build 20020129

- -

What's new in this drop

- -

Merge support has been added

- -

Numerous bug fixes

- -

 

- -

All Team plug-ins are turned off by default. If you -wish to use Team support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml
  4. -
  5. Rename plugins/org.eclipse.team.core/plugin.xml.off - to plugins/org.eclipse.team.core/plugin.xml
  6. -
  7. Rename plugins/org.eclipse.team.cvs.core/plugin.xml.off - to plugins/org.eclipse.team.cvs.core/plugin.xml
  8. -
  9. Rename plugins/org.eclipse.team.cvs.ssh/plugin.xml.off - to plugins/org.eclipse.team.cvs.ssh/plugin.xml
  10. - -
- -

-  

- -

Please report any problems to the VCM team, and use -the VCM component for bug tracking.

- -

 

- -

Run - this query to determine which bugs have been fixed since January - 15 th. If you wish to narrow the search, edit the query and - change the dates.

- -

Eclipse Platform Build Notes – Team Support

- -

Team build V2_0_2 – January 15, 2002

- -

Build submission for Integration Build 20020115

- -

What's new in this drop

- -

This is the initial release for the Team support plug-ins. - Team support is intended to be an eventual replacement for the VCM codebase.

- -

 

- -

The plug-ins are turned off by default. If you wish -to use Team support,

- -
    -
  1. Rename plugins/org.eclipse.team.ui/plugin.xml.off - to plugins/org.eclipse.team.ui/plugin.xml
  2. -
  3. Rename plugins/org.eclipse.team.cvs.ui/plugin.xml.off - to plugins/org.eclipse.team.cvs.ui/plugin.xml
  4. - -
- -

 

- -

Please report any problems to the VCM team, and use -the VCM component for bug tracking.

- -

 

- -

Run - this query to determine which bugs have been fixed since January - 7 th. If you wish to narrow the search, edit the query and - change the dates.

- -

 

-
- - - diff --git a/bundles/org.eclipse.team.core/doc/hglegal.htm b/bundles/org.eclipse.team.core/doc/hglegal.htm deleted file mode 100644 index 7c69b7304..000000000 --- a/bundles/org.eclipse.team.core/doc/hglegal.htm +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - Legal Notices - - - -

-Notices

-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.core/doc/ngibmcpy.gif b/bundles/org.eclipse.team.core/doc/ngibmcpy.gif deleted file mode 100644 index 61cef4852..000000000 Binary files a/bundles/org.eclipse.team.core/doc/ngibmcpy.gif and /dev/null differ diff --git a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html deleted file mode 100644 index e159d1d33..000000000 --- a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Team Core Extension Points - - - -
-

Team Core Plug-in

-This document lists all of the extension points that the Team Core plug-in makes available to repository provider developers. -

-


-

General Extension Points

-The following extension points can be used to extend various aspects of the team functionality: - -Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_fileTypes.html b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_fileTypes.html deleted file mode 100644 index b0ba7ed28..000000000 --- a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_fileTypes.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Eclipse Team Core Extension Point: File Types - - - -
-

-File Types

-Identifier: org.eclipse.team.core.fileTypes -

Description: 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. -

Plugins may provide an extension for this extension point. No code -beyond the XML extension declaration is required. -

Configuration Markup: -

   <!ELEMENT fileTypes EMPTY> -
   <!ATTLIST fileTypes -
      extension   -CDATA #REQUIRED -
      type        -CDATA #REQUIRED -
   > - -

    -
  • extension - the file extension being identified by this contribution.
  • -
  • type - one of either "text" or "binary", identifying the contents of files matching the value of extension.
  • -
- -Examples: -

Following is an example of a fileTypes extension: -

   <extension point="org.eclipse.team.core.fileTypes"> -
      <fileTypes -
        extension="txt" -
        type="text"> -
      </fileTypes> -
   </extension> - -

Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_ignore.html b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_ignore.html deleted file mode 100644 index 4d1645394..000000000 --- a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_ignore.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Eclipse Team Core Extension Point: Ignore - - - -

-

-Ignore

-Identifier: org.eclipse.team.core.ignore -

Description: This extension point is used to register -information about whether particular resources should be ignored; that -is, excluded from version configuration management operations. -

Plugins may provide an extension for this extension point. No code -beyond the XML extension declaration is required. -

Configuration Markup: -

   <!ELEMENT ignore EMPTY> -
   <!ATTLIST ignore -
      pattern   -CDATA #REQUIRED -
      selected  -CDATA #REQUIRED -
   > - -

    -
  • pattern - the pattern against which resources will be compared.
  • -
  • selected - one of "true" or "false", determines whether this ignore pattern is enabled.
  • -
- -Examples: -

Following is an example of an ignore extension: -

   <extension point="org.eclipse.team.core.ignore"> -
      <ignore -
        pattern="*.class" -
        selected="true"> -
      </ignore> -
   </extension> - -

Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_projectSets.html b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_projectSets.html deleted file mode 100644 index c27b2f3ec..000000000 --- a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_projectSets.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Eclipse Team Core Extension Point: Project Sets - - - -

-

-Project Sets

-Identifier: org.eclipse.team.core.projectSets -

Description: This extension point is used to register -a handler for creating and reading project sets. Project sets are a 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 members with a simple -way of creating a workspace with a particular lineup of projects from one or -more team providers. -

Providers may provide an extension for this extension point. -

Configuration Markup: -

   <!ELEMENT projectSets EMPTY> -
   <!ATTLIST projectSets -
      id         -CDATA #REQUIRED -
      class      -CDATA #REQUIRED -
   > - -

    -
  • id - the id of the provider for which this handler creates and reads project sets.
  • -
  • class - the fully-qualified name of a class implementing org.eclipse.team.core.IProjectSetSerializer.
  • -
- -Examples: -

Following is an example of a projectSets extension: -

   <extension point="org.eclipse.team.core.projectSets"> -
      <projectSets -
        id="org.eclipse.team.cvs.core.cvsprovider" -
        class="org.eclipse.team.cvs.core.CVSProjectSetSerializer"> -
      </projectSets> -
   </extension> - -

Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_repository.html b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_repository.html deleted file mode 100644 index dc9b520d3..000000000 --- a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core_repository.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Eclipse Team Core Extension Point: Repository - - - -

-

Repository

-Identifier: org.eclipse.team.core.repository -

Description: This extension point is used to register -a repository provider. A repository provider provides sychronization -of the contents of projects in the local workspace to a corresponding -entity in a remote repository of a particular type (e.g. CVS, Clearcase, PVCS, etc.). -

Providers may provide an extension for this extension point. -

Configuration Markup: -

   <!ELEMENT repository EMPTY> -
   <!ATTLIST repository -
      id         -CDATA #REQUIRED -
      class      -CDATA #REQUIRED -
   > - -

    -
  • id - the id of the provider.
  • -
  • class - the fully-qualified name of a class extending org.eclipse.team.core.RepositoryProvider.
  • -
- -Examples: -

Following is an example of a repository extension: -

   <extension point="org.eclipse.team.core.repository"> -
      <repository -
        id="org.eclipse.team.cvs.core.cvsprovider" -
        class="org.eclipse.team.internal.ccvs.core.CVSTeamProvider"> -
      </repository> -
   </extension> - -

Supplied Implementation: The plug-in org.eclipse.team.examples.filesystem contains a -sample implementation of RepositoryProvider for a filesystem based repository provider. - -

Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties deleted file mode 100644 index 539fdfdde..000000000 --- a/bundles/org.eclipse.team.core/plugin.properties +++ /dev/null @@ -1,7 +0,0 @@ -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 Provider Factories \ 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 b0d43c0bd..000000000 --- a/bundles/org.eclipse.team.core/plugin.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.team.core/schema/fileTypes.mxsd b/bundles/org.eclipse.team.core/schema/fileTypes.mxsd deleted file mode 100644 index 479dbca90..000000000 --- a/bundles/org.eclipse.team.core/schema/fileTypes.mxsd +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - 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. -<p> -Providers may provide an extension for this extension point. No code beyond the XML extension declaration is required. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - the file extension being identified by this contribution. - - - - - - - one of either "text" or "binary", identifying the contents of files matching the value of extension. - - - - - - - - - - - - Following is an example of a fileTypes extension: - -<p> -<pre> - <extension point="org.eclipse.team.core.fileTypes"> - <fileTypes extension="txt" type="text"/> - </extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.team.core/schema/ignore.mxsd b/bundles/org.eclipse.team.core/schema/ignore.mxsd deleted file mode 100644 index 9776ed7d6..000000000 --- a/bundles/org.eclipse.team.core/schema/ignore.mxsd +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - the pattern against which resources will be compared. - - - - - - - one of "true" or "false", determines whether this ignore pattern is enabled. - - - - - - - - - - - - Following is an example of an ignore extension: - -<p> -<pre> - <extension point="org.eclipse.team.core.ignore"> - <ignore pattern="*.class" enabled="true"/> - </extension> -</pre> -</p> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.team.core/schema/projectSets.mxsd b/bundles/org.eclipse.team.core/schema/projectSets.mxsd deleted file mode 100644 index 911064a67..000000000 --- a/bundles/org.eclipse.team.core/schema/projectSets.mxsd +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - 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. -<p> -Providers may provide an extension for this extension point. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - the nature id of the provider for which this handler creates and reads project sets. - - - - - - - the fully qualified name of a class implementing <samp>org.eclipse.team.core.IProjectSerializer</samp>. - - - - - - - - - - - - - - - Following is an example of a projectSets extension: - -<p> -<pre> - <extension point="org.eclipse.team.core.projectSets"> - <projectSets - id="org.eclipse.team.cvs.core.cvsnature" - class="org.eclipse.team.cvs.core.CVSProjectSetSerializer"> - </projectSets> - </extension> -</pre> -</p> - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - - - - - 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 62f7fb99d..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultRepositoryProviderType.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eclipse.team.core; - -/* - */ -public final class DefaultRepositoryProviderType extends RepositoryProviderType { - - -} 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 e78cbbabf..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.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 a35e684c3..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IIgnoreInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.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 '\'. - *

- * 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 d1a0596d6..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.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/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java deleted file mode 100644 index 80e401383..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.team.core; - -import java.io.File; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * Provisional - */ - -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 - } - - /** - * Returns true if when importing a project set the projects can be created - * at a specified file system location different than the default. - * - * NOTE: If this method is overriden to return true, then the provider - * must also override addToWorkspace(String[], String, IPath, Object, - * IProgressMonitor); - * - * @return boolean - */ - public boolean supportsProjectSetImportRelocation() { - return false; - } - - /** - * This method will only be called if - * RepositoryProviderType#supportsProjectSetImportRelocation returns true. - * - * 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 root the root file system path under which the projects should be - * created. - * @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 abstract IProject[] addToWorkspace(String[] referenceStrings, String filename, IPath root, Object context, IProgressMonitor monitor) throws TeamException; -} 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 2c7bb4522..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java +++ /dev/null @@ -1,604 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IFileModificationValidator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.resources.IProjectNatureDescriptor; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.team.IMoveDeleteHook; -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.NullProgressMonitor; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; -import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations; - -/** - * A concrete subclass of RepositoryProvider 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. - *

- * To create a repository provider and have it registered with the platform, a client - * must minimally: - *

    - *
  1. extend RepositoryProvider - *
  2. define a repository extension in plugin.xml. - * Here is an example extension point definition: - * - * - *
    <extension point="org.eclipse.team.core.repository"> - *
     <repository - *
      class="org.eclipse.myprovider.MyRepositoryProvider" - *
      id="org.eclipse.myprovider.myProviderID"> - *
     </repository> - *
    </extension> - *
    - *

- *

- * Once a repository provider is registered with Team, then you - * can associate a repository provider with a project by invoking RepositoryProvider.map(). - *

- * @see RepositoryProvider.map(IProject, String) - * - * @since 2.0 - */ -public abstract class RepositoryProvider implements IProjectNature { - - 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; - - /** - * 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 - *
    - *
  • There is no provider by that ID.
  • - *
  • The project is already associated with a repository provider and that provider - * prevented its unmapping.
  • - *
- * @see RepositoryProvider#unmap(IProject) - */ - public static void map(IProject project, String id) throws TeamException { - try { - 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); - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - - /* - * 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; - } - - /** - * 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{ - 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(new Status(IStatus.ERROR, TeamPlugin.ID, 0, - 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); - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - - /* - * 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 setProject. - * 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 RepositoryProvider.map() - * 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 IFileModificationValidator for pre-checking operations - * that modify the contents of files. - * Returns null 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 IMoveDeleteHook 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. - *

- * Returning null signals that the default move and delete behavior is desired. - * - * @see org.eclipse.core.resources.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 null 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 any repository provider. Otherwise call getProvider(project, id) - * to look for a specific repository provider type. - *

- * @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 mapNewProvider(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) { - TeamPlugin.log(e.getStatus()); - } catch(TeamException e) { - TeamPlugin.log(e.getStatus()); - } - return null; - } - - /** - * Returns a provider of type with the given id if associated with the given project - * or null 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 - return mapNewProvider(project, id); - } - - //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) { - // would happen if provider nature id is not registered with the resources plugin - TeamPlugin.log(new Status(IStatus.WARNING, TeamPlugin.ID, 0, Policy.bind("RepositoryProviderTypeRepositoryProvider_not_registered_as_a_nature_id___3", id), e)); //$NON-NLS-1$ - } catch(TeamException e) { - TeamPlugin.log(e.getStatus()); - } - 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 - * getProvider would) if one is not already instantiated. - * @param project the project being tested. - * @return boolean - * - * @see getProvider(IProject) - */ - public static boolean isShared(IProject project) { - try { - if (lookupProviderProp(project) != null) return true; - return project.getPersistentProperty(PROVIDER_PROP_KEY) != null; - } catch (CoreException e) { - TeamPlugin.log(e.getStatus()); - return false; - } - } - - /** - * Provisional non-API method. - * - * This method is here to allow experimentation with 3rd party tools - * calling providers in a repository neutral manner. - * - * Returns an object which implements a set of provider neutral operations for this - * provider. Answers null if the provider does not wish to support these - * operations. - * - * @return the repository operations or null if the provider does not - * support provider neutral operations. - * @see SimpleAccessOperations - */ - public SimpleAccessOperations getSimpleAccess() { - return null; - } - - /* - * @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.getStatus()); - } 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; - } - - /** - * Convert a project that are using natures to mark them as Team projects - * to instead use persistent properties. Optionally remove the nature from the project. - * Do nothing if the project has no Team nature. - * Assume that the same ID is used for both the nature and the persistent property. - * - * @deprecated - */ - public static void convertNatureToProperty(IProject project, boolean removeNature) throws TeamException { - RepositoryProvider provider = RepositoryProvider.getProvider(project); - if(provider == null) - return; - - String providerId = provider.getID(); - - RepositoryProvider.map(project, providerId); - if(removeNature) { - Team.removeNatureFromProject(project, providerId, new NullProgressMonitor()); - } - } - - /** - * 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 canHandleLinkedResources() method. - * - * @param resource see org.eclipse.core.resources.team.TeamHook - * @param updateFlags see org.eclipse.core.resources.team.TeamHook - * @param location see org.eclipse.core.resources.team.TeamHook - * @return IStatus see org.eclipse.core.resources.team.TeamHook - * - * @see RepositoryProvider#canHandleLinkedResources() - */ - 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.team.resources.team.IMoveDeleteHook). This method is - * called after the RepositoryProvider is instantiated but before - * setProject() is invoked so it will not have access to any - * state determined from the setProject() method. - * @return boolean - * - * @see org.eclipe.team.resources.team.IMoveDeleteHook - */ - public boolean canHandleLinkedResources() { - return false; - } -} 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 048368a8e..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java +++ /dev/null @@ -1,108 +0,0 @@ -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; - -/** - * Provisional. - * - * 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. - */ - -public abstract class RepositoryProviderType { - private static Map allProviderTypes = new HashMap(); - - private String id; - - /** - * Constructor for RepositoryProviderType. - */ - public RepositoryProviderType() { - } - - 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) { - 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.getStatus()); - } 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 instance. The id will be the repository - * provider type's id as defined in the provider plugin's plugin.xml. - * - * @return the nature id of this provider - */ - public final String getID() { - return this.id; - } - - /** - * Answers the ProjectSetCapability that implements methods to import and - * create project sets. If the provider doesn't wish to provide this - * feature, return null. - * - * @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 96a1a2b85..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java +++ /dev/null @@ -1,615 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.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.Arrays; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.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.IProgressMonitor; -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.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. - * - * @since 2.0 - */ -public final class Team { - - public static final String PREF_TEAM_IGNORES = "ignore_files"; //$NON-NLS-1$ - public static final String PREF_TEAM_TYPES = "file_types"; //$NON-NLS-1$ - public 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 Hashtable fileTypes, pluginTypes; - - // The ignore list that is read at startup from the persisted file - private static Map globalIgnore, pluginIgnore; - - 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; - } - } - - private static class IgnoreInfo implements IIgnoreInfo { - private String pattern; - private boolean enabled; - - public IgnoreInfo(String pattern, boolean enabled) { - this.pattern = pattern; - this.enabled = enabled; - } - public String getPattern() { - return pattern; - } - public boolean getEnabled() { - return enabled; - } - }; - - /** - * 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; - Hashtable 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(IFile file) { - if (file.isDerived()) return true; - IIgnoreInfo[] ignorePatterns = getAllIgnores(); - StringMatcher matcher; - for (int i = 0; i < ignorePatterns.length; i++) { - IIgnoreInfo info = ignorePatterns[i]; - if (info.getEnabled()) { - matcher = new StringMatcher(info.getPattern(), true, false); - if (matcher.match(file.getName())) return true; - } - } - return false; - } - - /** - * Returns whether the given file should be ignored. - * @deprecated use isIgnoredHint instead - */ - public static boolean isIgnored(IFile file) { - IIgnoreInfo[] ignorePatterns = getAllIgnores(); - StringMatcher matcher; - for (int i = 0; i < ignorePatterns.length; i++) { - IIgnoreInfo info = ignorePatterns[i]; - if (info.getEnabled()) { - matcher = new StringMatcher(info.getPattern(), true, false); - if (matcher.match(file.getName())) return true; - } - } - return false; - } - - /** - * Return all known file types. - * - * @return all known file types - */ - public static IFileTypeInfo[] getAllTypes() { - List result = new ArrayList(); - Hashtable table = getFileTypeTable(); - Enumeration e = table.keys(); - while (e.hasMoreElements()) { - String string = (String)e.nextElement(); - int type = ((Integer)table.get(string)).intValue(); - result.add(new FileTypeInfo(string, type)); - } - return (IFileTypeInfo[])result.toArray(new IFileTypeInfo[result.size()]); - } - - /** - * Returns the list of global ignores. - */ - public synchronized static IIgnoreInfo[] getAllIgnores() { - if (globalIgnore == null) { - globalIgnore = new HashMap(); - try { - readIgnoreState(); - } catch (TeamException e) { - TeamPlugin.log(IStatus.ERROR, Policy.bind("Team.Error_loading_ignore_state_from_disk_1"), e); //$NON-NLS-1$ - } - initializePluginIgnores(); - } - IIgnoreInfo[] result = new IIgnoreInfo[globalIgnore.size()]; - Iterator e = globalIgnore.keySet().iterator(); - int i = 0; - while (e.hasNext() ) { - final String pattern = (String)e.next(); - final boolean enabled = ((Boolean)globalIgnore.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 Hashtable getFileTypeTable() { - if (fileTypes == null) loadTextState(); - return fileTypes; - } - - /** - * 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) { - fileTypes = new Hashtable(11); - for (int i = 0; i < extensions.length; i++) { - fileTypes.put(extensions[i], new Integer(types[i])); - } - // Now set into preferences - StringBuffer buf = new StringBuffer(); - Iterator e = fileTypes.keySet().iterator(); - while (e.hasNext()) { - String extension = (String)e.next(); - boolean isCustom = (!pluginTypes.containsKey(extension)) || - !((Integer)pluginTypes.get(extension)).equals((Integer)pluginTypes.get(extension)); - if (isCustom) { - buf.append(extension); - buf.append(PREF_TEAM_SEPARATOR); - Integer type = (Integer)fileTypes.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 Hashtable(11); - 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((Boolean)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()); - } - - /** - * Utility method for removing a project nature from a project. - * - * @param proj the project to remove the nature from - * @param natureId the nature id to remove - * @param monitor a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * - * @deprecated - */ - public static void removeNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException { - try { - IProjectDescription description = proj.getDescription(); - String[] prevNatures= description.getNatureIds(); - List newNatures = new ArrayList(Arrays.asList(prevNatures)); - newNatures.remove(natureId); - description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()])); - proj.setDescription(description, monitor); - } catch(CoreException e) { - throw wrapException(Policy.bind("manager.errorRemovingNature", proj.getName(), natureId), e); //$NON-NLS-1$ - } - } - - /** - * Utility method for adding a nature to a project. - * - * @param proj the project to add the nature - * @param natureId the id of the nature to assign to the project - * @param monitor a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * - * @exception TeamException if a problem occured setting the nature - * - * @deprecated - */ - public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException { - try { - IProjectDescription description = proj.getDescription(); - String[] prevNatures= description.getNatureIds(); - String[] newNatures= new String[prevNatures.length + 1]; - System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); - newNatures[prevNatures.length]= natureId; - description.setNatureIds(newNatures); - proj.setDescription(description, monitor); - } catch(CoreException e) { - throw wrapException(Policy.bind("manager.errorSettingNature", proj.getName(), natureId), e); //$NON-NLS-1$ - } - } - - /* - * TEXT - * - * Reads the text patterns currently defined by extensions. - */ - private static void initializePluginPatterns() { - pluginTypes = new Hashtable(); - 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 (!fileTypes.containsKey(ext)) { - if (type.equals("text")) { //$NON-NLS-1$ - pluginTypes.put(ext, new Integer(TEXT)); - fileTypes.put(ext, new Integer(TEXT)); - } else if (type.equals("binary")) { //$NON-NLS-1$ - fileTypes.put(ext, new Integer(BINARY)); - pluginTypes.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(); - fileTypes.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() { - fileTypes = new Hashtable(11); - boolean old = loadBackwardCompatibleTextState(); - if (!old) loadTextPreferences(); - initializePluginPatterns(); - 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(); - fileTypes.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() { - pluginIgnore = new Hashtable(); - 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("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 - pluginIgnore.put(pattern, new Boolean(enabled)); - if (!globalIgnore.containsKey(pattern)) { - globalIgnore.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(); - RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject()); - // Only consider projects that have a provider - if (provider == null) continue; - // Only consider project additions that are moves - if (delta.getKind() != IResourceDelta.ADDED) continue; - if ((delta.getFlags() & IResourceDelta.MOVED_FROM) == 0) 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.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.getStatus()); - 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); - } -} 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 379b6cfa9..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core; - -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. - *

- * To determine the exact cause of the failure the caller should look at each status in detail.

- * - * @since 2.0 - */ -public class TeamException extends Exception { - - protected IStatus status = null; - - // 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; - - /** - * Single status constructor for a TeamProviderException. - * @param status - */ - public TeamException(IStatus status) { - super(status.getMessage()); - this.status = status; - } - - /** - * Answer the single status resulting from the attempted API call. - * - * @return IStatus the single status of the result, or null if this is a multi-status - * response. - */ - public IStatus getStatus() { - return status; - } - - /** - * Method TeamException. - * @param message - * @param e - */ - public TeamException(String message, Exception e) { - super(e.getMessage()); - this.status = new Status(IStatus.ERROR, TeamPlugin.ID, 0, message, e); - } - - /** - * @see java.lang.Throwable#Throwable(String) - */ - public TeamException(String message) { - super(message); - this.status = new Status(IStatus.ERROR, TeamPlugin.ID, 0, message, null); - } -} 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 @@ - - - - - - Package-level Javadoc - - -Application programming interfaces for defining and working with repository providers. -

-Package Specification

-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. - - \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/ILocalSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/ILocalSyncElement.java deleted file mode 100644 index 9a7736ee5..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/ILocalSyncElement.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core.sync; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A ILocalSyncElement describes the relative synchronization of a local - * resource using a base resource for comparison. - *

- * Differences between the base and local resources are classified as outgoing changes; - * if there is a difference, the local resource is considered the outgoing resource.

- * - * @see IRemoteSyncElement - * - * @since 2.0 - */ -public interface ILocalSyncElement { - - /*==================================================================== - * 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; - - /*==================================================================== - * Constants defining synchronization granularity: - *====================================================================*/ - - /** - * Constant (value 1) to only consider timestamp comparisons (e.g. isDirty) when - * calculating the synchronization kind. This is the faster sync compare option but it can result in false - * conflicts. - */ - public static final int GRANULARITY_TIMESTAMP = 1; - - /** - * Constant (value 2) indicating to consider file contents when calculating the synchronization kind. This - * synchronization mode will perform a content comparison only after timestamp operations (isDirty) - * indicate a change. This mode allows conflicts types to be correctly identified. - */ - public static final int GRANULARITY_CONTENTS = 2; - - /** - * Constant (value 4) indicating to consider file contents (potentially ignoring whitespace) - * when calculating the synchronization kind. This synchronization mode will perform a content - * comparison only after timestamp operations (isDirty) indicate a change. - * This mode allows conflicts types to be correctly identified. - */ - public static final int GRANULARITY_CONTENTS_IGNORE_WHITESPACE = 4; - - /** - * Answer a string that describes the simple name of the sync node, which is suitable - * for display to a user. The name will be used in UI operations, so it is expected that - * implementations will cache this value. - * - * @return String the simple name that identifies the resource within its parent container. - */ - public String getName(); - - /** - * Answer if the sync node is a container and may have children. - * - * @return boolean true if the remote resource is a container, and - * false if it is not. - */ - public boolean isContainer(); - - /** - * Answers the local sync element of this node. Returns a non-existing local - * resource handle if the local resource does not exist in the workspace. - * - * @return IResource the local resource handle in this node. There should always be a local - * resource available, however the resource may not exist. - */ - public IResource getLocal(); - - /** - * Answers the base sync element of this node. Returns null - * if there is no base (e.g. conflicting add). - * - * @return IRemoteResource the base resource in this node, or null is there - * is none. - */ - public IRemoteResource getBase(); - - /** - * Answers and array of ILocalSyncElement elements that are immediate - * children of this sync element, in no particular order. The returned sync nodes are - * a combination of the nodes represented by the sync element (e.g. local, base, remote). - * - * @param monitor a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * - * @return ILocalSyncElement[] array of immediate children of this sync node. - * - * @throws TeamException - */ - public ILocalSyncElement[] members(IProgressMonitor monitor) throws TeamException; - - /** - * Performs a synchronization calculation on the given element based on the local and base - * resources. Returns an integer describing the synchronization state of this element. - * - * @param granularity the granularity at which the elements of this sync element - * should be compared. On of GRANULARITY_TIMESTAMP, or - * GRANULARITY_CONTENTS. - * @param progress a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * - * @return int an integer describing the synchronization state of this element. - */ - public int getSyncKind(int granularity, IProgressMonitor progress); -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteResource.java deleted file mode 100644 index f920a42ad..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteResource.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core.sync; - -import java.io.InputStream; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Interface for resources that are not local. - * - * @since 2.0 - */ -public interface IRemoteResource extends IAdaptable { - - /** - * Answers a string that describes the name of the remote resource. The name may be - * displayed to the user. - * - * @return name of the remote resource. - */ - public String getName(); - - /** - * Answers and array of IRemoteResource elements that are immediate - * children of this remote resource, in no particular order. - * - * @param progress a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * - * @return array of immediate children of this remote resource. - */ - public IRemoteResource[] members(IProgressMonitor progress) throws TeamException; - - /** - * Returns a stream over the contents of this remote element. - * - * @param progress a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - */ - public InputStream getContents(IProgressMonitor progress) throws TeamException; - - /** - * Answers if the remote element may have children. - * - * @return true if the remote element may have children and - * false otherwise. - */ - public boolean isContainer(); -} - diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteSyncElement.java deleted file mode 100644 index b5821c632..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/IRemoteSyncElement.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core.sync; - - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A IRemoteSyncElement describes the relative synchronization of a local - * and remote resource using a base resource for comparison. - *

- * Differences between the base and remote resources are classified as incoming changes; - * if there is a difference, the remote resource is considered the incoming resource.

- * - * @see ILocalSyncElement - * - * @since 2.0 - */ -public interface IRemoteSyncElement extends ILocalSyncElement { - - /** - * Answer the remote sync element of this node. Returns null - * if there is no remote. - * - * @return the remote resource in this sync element, or null is there - * is none. - */ - public IRemoteResource getRemote(); - - /** - * Answers true if the base tree is not to be considered during sync - * comparisons and false if it should. If the base tree is ignored the - * sync comparison can be based on isOutOfDate and isDirty methods only. - */ - public boolean isThreeWay(); -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/LocalSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/LocalSyncElement.java deleted file mode 100644 index f5651e425..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/LocalSyncElement.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core.sync; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A standard abstract class that provides implementations for ILocalSyncElement - * methods. - * - * @since 2.0 - */ -public abstract class LocalSyncElement implements ILocalSyncElement { - - /** - * Creates a client specific sync element from a local and base - * resources. The base resource may be null and should be - * intialized by the client if available. - * - * @param local the local resource in the workbench. Will never be null. - * @param base the base resource, may me null. - * @param data client specific data. - * - * @return a client specific sync element. - */ - public abstract ILocalSyncElement create(IResource local, IRemoteResource base, Object data); - - /** - * Client data that is passed to every create() call. - * - * @return client specific data that will be passed to create. - */ - protected abstract Object getData(); - - /** - * Client can decide is a specific element should be ignored from this sync element's - * children. - * - * @param resource the resource to be queried. - * - * @return true if this element should be ignored and not considered an - * immediate child of this element, and false otherwise. - */ - protected abstract boolean isIgnored(IResource resource); - - /* - * @see ILocalSyncElement#getSyncKind(int, IProgressMonitor) - */ - public int getSyncKind(int granularity, IProgressMonitor progress) { - - // XXX not sure how local sync will be used? - int sync = IN_SYNC; - return sync; - } - - /* - * @see ILocalSyncElement#getName() - */ - public String getName() { - return getLocal().getName(); - } - - /* - * @see ILocalSyncElement#isContainer() - */ - public boolean isContainer() { - return getLocal().getType() != IResource.FILE; - } - - /* - * @see ILocalSyncElement#members(IProgressMonitor) - */ - public ILocalSyncElement[] members(IProgressMonitor monitor) throws TeamException { - try { - if(getLocal().getType() != IResource.FILE) { - IResource[] members = ((IContainer)getLocal()).members(); - List syncElements = new ArrayList(5); - for (int i = 0; i < members.length; i++) { - IResource iResource = members[i]; - // the base is initialy set to null, however the concrete subclass should - // initialize the base if one is available. - if(!isIgnored(iResource)) { - syncElements.add(create(iResource, null, getData())); - } - } - return (ILocalSyncElement[]) syncElements.toArray(new ILocalSyncElement[syncElements.size()]); - } else { - return new ILocalSyncElement[0]; - } - } catch(CoreException e) { - throw new TeamException(e.getStatus()); - } - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java deleted file mode 100644 index 39f5629f4..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java +++ /dev/null @@ -1,440 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.core.sync; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.core.Policy; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A standard abstract class that provides implementations for interesting - * IRemoteSyncElement methods. The members method - * provided will create a unified tree based on the local, base, and remote - * children. The getSyncKind method will calculate the relative - * sync kind of the remote node. - * - * @since 2.0 - */ -public abstract class RemoteSyncElement extends LocalSyncElement implements IRemoteSyncElement { - - /** - * Creates a client specific sync element from a local, base, and - * remote resources. The base and remote resource may be - * null. - * - * @param local the local resource in the workbench. Will never be null. - * @param base the base resource, may me null. - * @param remote the remote resource, may be null. - * @param data client specific data. - * - * @return a client specific sync element. - */ - public abstract IRemoteSyncElement create(boolean isThreeWay, IResource local, IRemoteResource base, IRemoteResource remote, Object data); - - /* - * @see ILocalSyncElement#members() - */ - public ILocalSyncElement[] members(IProgressMonitor progress) throws TeamException { - // create union of the local, base, and remote trees - IRemoteResource remote = getRemote(); - IRemoteResource base = getBase(); - IResource local = getLocal(); - - IRemoteResource[] remoteChildren = - remote != null ? remote.members(progress) : new IRemoteResource[0]; - - IRemoteResource[] baseChildren = - base != null ? base.members(progress) : new IRemoteResource[0]; - - IResource[] localChildren; - try { - if( local.getType() != IResource.FILE && local.exists() ) { - localChildren = ((IContainer)local).members(); - } else { - localChildren = new IResource[0]; - } - } catch(CoreException e) { - throw new TeamException(e.getStatus()); - } - - if (remoteChildren.length > 0 || localChildren.length > 0) { - List syncChildren = new ArrayList(10); - Set allSet = new HashSet(20); - Map localSet = null; - Map remoteSet = null; - Map baseSet = 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++) { - IRemoteResource remoteChild = remoteChildren[i]; - String name = remoteChild.getName(); - remoteSet.put(name, remoteChild); - allSet.add(name); - } - } - - if (baseChildren.length > 0) { - baseSet = new HashMap(10); - for (int i = 0; i < baseChildren.length; i++) { - IRemoteResource baseChild = baseChildren[i]; - String name = baseChild.getName(); - baseSet.put(name, baseChild); - 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; - - IRemoteResource remoteChild = - remoteSet != null ? (IRemoteResource) remoteSet.get(keyChildName) : null; - - IRemoteResource baseChild = - baseSet != null ? (IRemoteResource) baseSet.get(keyChildName) : null; - - - if (localChild == null) { - // there has to be a remote resource available if we got this far - Assert.isTrue(remoteChild != null || baseChild != null); - boolean isContainer = remoteChild != null ? remoteChild.isContainer() : baseChild.isContainer(); - - localChild = getResourceChild(local /* parent */, keyChildName, isContainer); - } - - if(!localChild.exists() || !isIgnored(localChild)) { - syncChildren.add(create(isThreeWay(), localChild, baseChild, remoteChild, getData())); - } - } - return (IRemoteSyncElement[]) syncChildren.toArray(new IRemoteSyncElement[syncChildren.size()]); - } - else { - return new IRemoteSyncElement[0]; - } - } - - /* - * @see ILocalSyncElement#getSyncKind(int, IProgressMonitor) - */ - public int getSyncKind(int granularity, IProgressMonitor progress) { - int description = IN_SYNC; - - IResource local = getLocal(); - IRemoteResource remote = getRemote(); - IRemoteResource base = getBase(); - - boolean localExists = getLocal().exists(); - - if (isThreeWay()) { - if (base == null) { - if (remote == null) { - if (!localExists) { - Assert.isTrue(false); - } else { - description = OUTGOING | ADDITION; - } - } else { - if (!localExists) { - description = INCOMING | ADDITION; - } else { - description = CONFLICTING | ADDITION; - try { - progress.beginTask(null, 60); - if (isGranularityContents(granularity) && - compare(granularity, true, local, remote, Policy.subMonitorFor(progress, 30))) { - description |= PSEUDO_CONFLICT; - } - } finally { - progress.done(); - } - } - } - } else { - if (!localExists) { - if (remote == null) { - description = CONFLICTING | DELETION | PSEUDO_CONFLICT; - } else { - if (compare(granularity, false, base, remote, progress)) - description = OUTGOING | DELETION; - else - description = CONFLICTING | CHANGE; - } - } else { - if (remote == null) { - if (compare(granularity, false, local, base, progress)) - description = INCOMING | DELETION; - else - description = CONFLICTING | CHANGE; - } else { - progress.beginTask(null, 90); - boolean ay = compare(granularity, false, local, base, Policy.subMonitorFor(progress, 30)); - boolean am = compare(granularity, false, base, remote, Policy.subMonitorFor(progress, 30)); - if (ay && am) { - ; - } else if (ay && !am) { - description = INCOMING | CHANGE; - } else if (!ay && am) { - description = OUTGOING | CHANGE; - } else { - description = CONFLICTING | CHANGE; - if (isGranularityContents(granularity) && - compare(granularity, true, local, remote, Policy.subMonitorFor(progress, 30))) { - description |= PSEUDO_CONFLICT; - } - } - progress.done(); - } - } - } - } 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 (! compare(granularity, false, local, remote, Policy.subMonitorFor(progress, 30))) - description= CHANGE; - } - } - } - return description; - } - - /** - * Helper methods for comparisons that returns true if the resource contents are the same. - * - * If timestampDiff is true then the timestamps don't differ and there's no point checking the - * contents. - */ - protected boolean compare(int granularity, boolean force, IResource e1, IRemoteResource e2, IProgressMonitor monitor) { - boolean timestampEquals; - if (force) { - timestampEquals = false; - } else { - timestampEquals = timestampEquals(e1, e2); - } - if (!timestampEquals && isGranularityContents(granularity)) { - try { - monitor.beginTask(null, 100); - return contentsEqual( - getContents(e1, Policy.subMonitorFor(monitor, 50)), - getContents(e2, Policy.subMonitorFor(monitor, 50)), - granularity == GRANULARITY_CONTENTS_IGNORE_WHITESPACE); - } finally { - monitor.done(); - } - } else { - return timestampEquals; - } - } - - protected boolean compare(int granularity, boolean force, IRemoteResource e1, IRemoteResource e2, IProgressMonitor monitor) { - boolean timestampEquals; - if (force) { - timestampEquals = false; - } else { - timestampEquals = timestampEquals(e1, e2); - } - if (!timestampEquals && isGranularityContents(granularity)) { - try { - monitor.beginTask(null, 100); - return contentsEqual( - getContents(e1, Policy.subMonitorFor(monitor, 50)), - getContents(e2, Policy.subMonitorFor(monitor, 50)), - granularity == GRANULARITY_CONTENTS_IGNORE_WHITESPACE); - } finally { - monitor.done(); - } - } else { - return timestampEquals; - } - } - - protected abstract boolean timestampEquals(IResource e1, IRemoteResource e2); - protected abstract boolean timestampEquals(IRemoteResource e1, IRemoteResource e2); - - protected boolean isGranularityContents(int granularity) { - return granularity != GRANULARITY_TIMESTAMP; - } - - private InputStream getContents(IResource resource, IProgressMonitor monitor) { - try { - if (resource instanceof IStorage) - return new BufferedInputStream(((IStorage) resource).getContents()); - return null; - } catch (CoreException e) { - return null; - } - } - - private InputStream getContents(IRemoteResource remote, IProgressMonitor monitor) { - try { - if (!remote.isContainer()) - return new BufferedInputStream(remote.getContents(monitor)); - return null; - } catch (TeamException exception) { - // The remote node has gone away . - return null; - } - } - - /** - * Returns true if both input streams byte contents is identical. - * - * @param input1 first input to contents compare - * @param input2 second input to contents compare - * @return true if content is equal - */ - private boolean contentsEqual(InputStream is1, InputStream is2, boolean ignoreWhitespace) { - if (is1 == is2) - return true; - - 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(); - while (ignoreWhitespace && isWhitespace(c1)) c1 = is1.read(); - int c2 = is2.read(); - while (ignoreWhitespace && isWhitespace(c2)) c2 = is2.read(); - if (c1 == -1 && c2 == -1) - return true; - if (c1 != c2) - break; - - } - } catch (IOException ex) { - } finally { - if (is1 != null) { - try { - is1.close(); - } catch (IOException ex) { - } - } - if (is2 != null) { - try { - is2.close(); - } catch (IOException ex) { - } - } - } - return false; - } - - /* - * Skip all whitspace. - */ - private boolean isWhitespace(int c) { - if (c == -1) return false; - return Character.isWhitespace((char)c); - } - - /* - * Returns a handle to a non-existing resource. - */ - 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)); - } - } - - /* - * @see Object#toString() - */ - public String toString() { - return getName() + kindToString(getSyncKind(GRANULARITY_TIMESTAMP, null)); - } - - static public 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$ - } -} \ No newline at end of file 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 e15eb2f0b..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Assert.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.team.internal.core; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - - -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 true, an IllegalArgumentException - * is thrown. - * - * @param expression the outcode of the check - * @return true 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 true, an IllegalArgumentException - * 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 true 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 null. 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 null - */ -public static void isNotNull(Object object) { - if (object == null) - throw new AssertionFailedException("null argument"); //$NON-NLS-1$ -} -/** Asserts that the given object is not null. 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 null - */ -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 true. If this - * is not the case, some kind of unchecked exception is thrown. - * - * @param expression the outcode of the check - * @return true 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 true. 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 true 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/DefaultFileModificationValidator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java deleted file mode 100644 index bce3077f4..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core; - -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.core.runtime.Status; -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(Status.ERROR, TeamPlugin.ID, Status.ERROR, 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 b35fa8136..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.eclipse.team.internal.core; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -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/FileModificationValidatorManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java deleted file mode 100644 index fc2a78d61..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.team.internal.core; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -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/InfiniteSubProgressMonitor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java deleted file mode 100644 index e09373605..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.eclipse.team.internal.core; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -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. - * However, the number of ticks that can actually be worked is n*ticks/2 where - * 2^n = ticks. What this means is that if you provide a ticks 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 ef1e1eea6..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.eclipse.team.internal.core; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -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 91507fa05..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.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. - *

- * This implementation supports cancelation. The default implementations of the - * other methods do nothing. - *

- * @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 7d63beedb..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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; - - static { - //init debug options - if (TeamPlugin.getPlugin().isDebugging()) { - DEBUG_STREAMS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/streams"));//$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); - } -} \ 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 0f0c8ad5a..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java +++ /dev/null @@ -1,389 +0,0 @@ -package org.eclipse.team.internal.core; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -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 startend(exclusive). - * @param text, the String object to search in - * @param start, the starting index of the search range, inclusive - * @param end, the ending index of the search range, exclusive - * @return an StringMatcher.Position 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 - * text, determine if the given substring matches with aPattern - * @return true if the specified portion of the text matches the pattern - * @param String text, a String object that contains the substring to match - * @param int start marks the starting position (inclusive) of the substring - * @param int end marks the ending index (exclusive) of the substring - */ - public boolean match(String text, int start, int end) { - if (null == fPattern || null == text) - throw new IllegalArgumentException(); - - if (start >= end) - return false; - - if (fIgnoreWildCards) - return fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength); - int segCount = fSegments.length; - if (segCount == 0)//pattern contains only '*'(s) or empty pattern - 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; - } - } - - /* 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 text with the pattern - * @return true if matched eitherwise false - * @param text, 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 text, a string which contains no wildcard - * @param start, the starting index in the text for search, inclusive - * @param end, 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 text, a simple regular expression that may only contain '?'(s) - * @param start, the starting index in the text for search, inclusive - * @param end, the stopping point of search, exclusive - * @param p, a simple regular expression that may contains '?' - * @param caseIgnored, 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 text, a String to match - * @param start, int that indicates the starting index of match, inclusive - * @param end int that indicates the ending index of match, exclusive - * @param p, String, String, a simple regular expression that may contain '?' - * @param ignoreCase, boolean indicating wether code>p 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 text, the string to match - * @param start, the starting index in the text for search, inclusive - * @param end, the stopping point of search, exclusive - * @param code>p, a string that has no wildcard - * @param ignoreCase, boolean indicating wether code>p 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 fbf1ac367..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 fbf342a8e..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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; -import org.eclipse.team.internal.core.target.TargetManager; - -/** - * TeamPlugin is the plug-in runtime class for the Team - * resource management plugin. - *

- * - * @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 id of the targets extension point - public static final String TARGETS_EXTENSION = "targets"; //$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(); - TargetManager.startup(); - } - - /** - * @see Plugin#shutdown() - */ - public void shutdown() { - Team.shutdown(); - } - - /** - * Returns the Team plug-in. - * - * @return the single instance of this plug-in runtime class - */ - public static TeamPlugin getPlugin() { - return plugin; - } - - /** - * Returns the plug-in's log - */ - public static void log(int severity, String message, Throwable e) { - plugin.getLog().log(new Status(severity, ID, 0, message, e)); - } - - /** - * Returns the plug-in's log - */ - public static void log(IStatus status) { - plugin.getLog().log(status); - } - - /* - * 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)); - } - -} \ No newline at end of file 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 3da7fbbe9..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/messages.properties +++ /dev/null @@ -1,90 +0,0 @@ -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 occured trying to map project ''{0}'' to provider ''{1}''. Please restart Eclipse. -RepositoryProvider.invalidClass=Class ''{1}'' resistered 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 occured writing the state file ''{0}''. -Team.readError=An error occured 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 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 396739e7d..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/simpleAccess/SimpleAccessOperations.java +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 SimpleAccessOperations 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 semantics of the SimpleAccessOperations 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. - *

- * 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.

- *

- * The method is applied to all resources satisfying the depth parameter, described above.

- *

- * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.

- * - * @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 IResource - * static constants. - * @param progress a progress monitor to indicate the duration of the operation, or - * null 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 resources - * array. Possible status codes include: - *
    - *
  • NO_REMOTE_RESOURCE
  • - *
  • IO_FAILED
  • - *
  • NOT_AUTHORIZED
  • - *
  • UNABLE
  • - *
- */ - 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. - *

- * 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.

- *

- * 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.

- *

- * Where checkout is applied to a resource that is already checked-out the method has no - * effect.

- * - * @param resources the array of local resources to be checked-out. - * @param depth the depth to traverse the given resources, taken from IResource - * constants. - * @param progress a progress monitor to indicate the duration of the operation, or - * null 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 resources - * array. Possible status codes include: - *
    - *
  • NOT_CHECKED_IN
  • - *
  • NO_REMOTE_RESOURCE
  • - *
  • IO_FAILED
  • - *
  • NOT_AUTHORIZED
  • - *
  • UNABLE
  • - *
- * @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. - *

- * 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 correspond to the new remote resource.

- *

- * 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.

- *

- * Note that some providers may require 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).

- * - * @param resources an array of local resources to be checked-in. - * @param the depth to traverse the given resources, taken from IResource - * constants. - * @param progress a progress monitor to indicate the duration of the operation, or - * null 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 resources - * array. Possible status codes include: - *
    - *
  • NOT_CHECKED_OUT
  • - *
  • IO_FAILED
  • - *
  • NOT_AUTHORIZED
  • - *
  • UNABLE
  • - *
- * @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. - *

- * 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.

- *

- * Note also that uncheckout() does not affect the content of the local resource. The - * caller is required to perform a get() 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 uncheckout() with an - * IResource that does not exist locally.

- * - * @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 IResource - * constants. - * @param progress a progress monitor to indicate the duration of the operation, or - * null 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 - * resources array. Possible status codes include: - *
    - *
  • NOT_CHECKED_OUT
  • - *
  • IO_FAILED
  • - *
  • NOT_AUTHORIZED
  • - *
  • UNABLE
  • - *
- * @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. - *

- * 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.

- *

- * Note that the IResource'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.

- *

- * The resource may be checked-in or checked-out prior to deletion. The local resource is not - * deleted by this method.

- *

- * Resource deletions are inherently deep.

- * - * @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 - * null 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 - * resources array. Possible status codes include: - *
    - *
  • NO_REMOTE_RESOURCE
  • - *
  • IO_FAILED
  • - *
  • NOT_AUTHORIZED
  • - *
  • UNABLE
  • - *
- */ - public void delete(IResource[] resources, IProgressMonitor progress) throws TeamException; - - /* - * Informs the provider that a local resource's name or path has changed. - *

- * Some providers, such as versioning providers, may require this information to track the resource - * across name changes.

- *

- * Note that this method is always called after the local resource has been moved.

- * - * @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 - * null 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: - *
    - *
  • NO_REMOTE_RESOURCE
  • - *
  • IO_FAILED
  • - *
  • NOT_AUTHORIZED
  • - *
  • UNABLE
  • - *
- */ - 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 true. - *

- * It is undefined whether this method tests for a resource being checked out to this workspace - * or any workspace.

- * - * @param resource the local resource to test. - * @return true if the resource is checked-out and false if it is not. - * @see checkout(IResource[], int, IProgressMonitor) - */ - public boolean isCheckedOut(IResource resource); - - /* - * Answers whether the resource has a corresponding remote resource. - *

- * Before a resource is checked-in, the resource will occur locally but not remotely, and calls to this - * method will return false. 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 true.

- * - * @param resource the local resource to test. - * @return true if the local resource has a corresponding remote resource, - * and false 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 true if the resource has a different modification - * timestamp, and false otherwise. - */ - public boolean isDirty(IResource resource); -} \ No newline at end of file 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 0719a99c1..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 60e4ba561..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 0bdcbb38e..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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.core.runtime.Status; -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; - - /** - * 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; - } - - /** - * 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(new Status(IStatus.ERROR, TeamPlugin.ID, 0, e.getMessage(), e)); - } finally { - for (;;) { - try { - in.close(); - return; - } catch (InterruptedIOException e) { - if (monitor.isCanceled()) 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 (monitor.isCanceled()) 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 (monitor.isCanceled()) 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 (monitor.isCanceled()) 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; - } - } -} 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 9d0dd4755..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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; - - /** - * 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; - } - - /** - * 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 (monitor.isCanceled()) 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 (monitor.isCanceled()) 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 (monitor.isCanceled()) 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 (monitor.isCanceled()) 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$ - } - } - } - } -} \ No newline at end of file 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 65c0f09e7..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 2781e8425..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 b82a6134e..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.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 99a91fdf1..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.streams; - -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(out); - 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 (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; - } - synchronized (this) { - head = (head + len) % iobuffer.length; - length -= len; - notify(); - } - } - if (bytesUntilFlush >= 0) { - bytesUntilFlush -= len; - if (bytesUntilFlush <= 0) { - // flush the buffer now - try { - out.flush(); - } catch (InterruptedIOException e) { - } - bytesUntilFlush = -1; // might have been 0 - } - } - } - } -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java deleted file mode 100644 index 01a058769..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/AuthenticatedSite.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.TeamPlugin; - -/** - * This is a layer that contains anything which a Target Site implementation that uses authentication would need to have. - */ -public abstract class AuthenticatedSite extends Site { - - protected String username; - protected String password; - - /** - * @see org.eclipse.team.internal.core.target.Site#dispose() - */ - public void dispose() throws TeamException { - try { - Platform.flushAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (CoreException e) { - throw new TeamException(e.getStatus()); - } - } - - /** - * Gets the username. - * @return Returns a String - */ - public String getUsername() { - return username; - } - - /** - * Gets the password. - * @return Returns a String - */ - public String getPassword() { - return password; - } - - public void setUsername(String name) throws TeamException { - Map authInfo=Platform.getAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - if (authInfo==null) authInfo=new HashMap(2); - authInfo.put("name", name); //$NON-NLS-1$ - try { - Platform.flushAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - Platform.addAuthorizationInfo(getURL(), "", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$ - this.username=name; - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - - public void setPassword(String password) throws TeamException { - Map authInfo=Platform.getAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - if (authInfo==null) authInfo=new HashMap(2); - authInfo.put("password", password); //$NON-NLS-1$ - try { - Platform.flushAuthorizationInfo(getURL(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - Platform.addAuthorizationInfo(getURL(), "", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$ - this.password=password; - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java deleted file mode 100644 index be6b5cc7f..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/BaseIdentifierNotInitializedException.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -public class BaseIdentifierNotInitializedException extends Exception { - /** - * Default constructor for a TeamProviderException. - */ - public BaseIdentifierNotInitializedException() { - super(); - } - - /** - * Constructor for a TeamProviderException that takes - * a string description of the cause of the exception. - * - * @param message a message describing the cause of the exception. - */ - public BaseIdentifierNotInitializedException(String message) { - super(message); - } -} - diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java deleted file mode 100644 index 0f4b48362..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/IRemoteTargetResource.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.net.URL; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; - -/** - * Interface for target resources that are not local. This is a handle to a - * clients-side 'proxy' for the server resource. There are no guarantees that - * the handle is not stale or invalid. - *

- * Use exists() to verify is the associated server resource - * exists.

- *

- * Methods that take progress monitors are expected to be long running and - * may contact the server. Progress and cancellation will be provided. Clients - * can assume that methods that don't take progress monitors are responsive - * and won't contact the server. - *

- * - * @see IRemoteResource - */ -public interface IRemoteTargetResource extends IRemoteResource { - /** - * Returns the URL of this remote resource. - */ - public URL getURL(); - - /** - * Returns the size of the resource. - */ - public int getSize(IProgressMonitor monitor) throws TeamException; - - /** - * Returns the last modified time - */ - public String getLastModified(IProgressMonitor monitor) throws TeamException; - - /** - * Return a boolean value indicating whether or not this resource exists on the - * remote server. - */ - public boolean exists(IProgressMonitor monitor) throws TeamException; - - /** - * Creates the directory named by this URL, including any necessary but non-existant - * parent directories. - */ - public void mkdirs(IProgressMonitor monitor) throws TeamException; - - /** - * Returns a handle to the remote file identified by the given path in this - * folder. - *

- * This is a remote resource handle operation; neither the resource nor - * the result need exist on the server.

- *

- * The supplied path may be absolute or relative; in either case, it is - * interpreted as relative to this resource and is appended - * to this container's full path to form the full path of the resultant resource. - * A trailing separator is ignored. - *

- * - * @param name the path of the remote member file - * @return the (handle of the) remote file - * @see #getFolder - */ - public IRemoteTargetResource getFile(String name); - - /** - * Returns a handle to the remote folder identified by the given path in this - * folder. - *

- * This is a remote resource handle operation; neither the resource nor - * the result need exist on the server.

- *

- * The supplied path may be absolute or relative; in either case, it is - * interpreted as relative to this resource and is appended - * to this container's full path to form the full path of the resultant resource. - * A trailing separator is ignored. - *

- * - * @param path the path of the remote member file - * @return the (handle of the) remote file - * @see #getFolder - */ - public IRemoteTargetResource getFolder(String name); - - /** - * Return the site where this remote resource exists - */ - public Site getSite(); - - /** - * Return true if this can be reached (in some fashion). - * This method is not guaranteed to catch all connection failure cases but is used - * to at least test the waters. - * @param monitor - * @return boolean - */ - boolean canBeReached(IProgressMonitor monitor) throws TeamException; - - /** - * Delete the remote resource. - */ - public void delete(IProgressMonitor monitor) throws TeamException; - -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java deleted file mode 100644 index 307ed846c..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.io.ObjectInputStream; -import java.util.Properties; - -/** - * The ISiteFactory interface must be implemented by any plug-in - * that is providing target management. It provides mechanisms for creating - * concrete Site instances for it's target type. - * - * @see Site - */ -public interface ISiteFactory { - /** - * Responsible for reading from the stream and restoring the classes fields - * then returning a new Site instance. The Site - * instances are written using the Site#writeObject method. - * - * @param is the input stream that contains the output of Site#writeObject - * @return a new target site - */ - public Site newSite(ObjectInputStream is); - - /** - * Returns a new target site for the given target specific properties. This - * is mainly used for testing purposes. - * - * @param properties the target specific location encoded in properties - * @return a new target site - */ - public Site newSite(Properties properties); -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java deleted file mode 100644 index 6ffa76038..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ISiteListener.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -public interface ISiteListener { - public void siteAdded(Site site); - public void siteRemoved(Site site); -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java deleted file mode 100644 index 74e36867d..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITargetRunnable.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; - -public interface ITargetRunnable { - public void run(IProgressMonitor monitor) throws TeamException; -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java deleted file mode 100644 index 16799dab3..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ITeamStatusConstants.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.team.core.Team; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; - -public interface ITeamStatusConstants { - - public static final IStatus OK_STATUS = Team.OK_STATUS; - - public static final IStatus NOT_CHECKED_OUT_STATUS = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - TeamException.NOT_CHECKED_OUT, - Policy.bind("teamStatus.notCheckedOut"), //$NON-NLS-1$ - null); - - public static final IStatus NOT_CHECKED_IN_STATUS = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - TeamException.NOT_CHECKED_IN, - Policy.bind("teamStatus.notCheckedIn"), //$NON-NLS-1$ - null); - - public static final IStatus NO_REMOTE_RESOURCE_STATUS = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - TeamException.NO_REMOTE_RESOURCE, - Policy.bind("teamStatus.noRemoteResource"), //$NON-NLS-1$ - null); - - public static final IStatus IO_FAILED_STATUS = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - TeamException.IO_FAILED, - Policy.bind("teamStatus.ioFailed"), //$NON-NLS-1$ - null); - - public static final IStatus CONFLICT_STATUS = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - TeamException.CONFLICT, - Policy.bind("teamStatus.conflict"), //$NON-NLS-1$ - null); - - public static final IStatus REQUIRED_CONFIGURATION_MISSING = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - -100, - Policy.bind("provider.configuration.missing"), //$NON-NLS-1$ - null); - - public static final IStatus INVALID_CONFIGURATION = - new Status( - IStatus.ERROR, - TeamPlugin.ID, - -101, - Policy.bind("provider.configuration.invalid"), //$NON-NLS-1$ - null); -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java deleted file mode 100644 index f9a91f638..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -public class LocationMapping { - - private final long SERIAL_ID = 1; - - private String type; - private URL url; - private IPath path; - - public LocationMapping(Site site, IPath path) { - this.type = site.getType(); - this.url = site.getURL(); - this.path = path; - } - - public LocationMapping(String type, URL url, IPath path) { - this.type = type; - this.url = url; - this.path = path; - } - - public LocationMapping(byte[] bytes) throws IOException { - ByteArrayInputStream bis = new ByteArrayInputStream(bytes); - DataInputStream is = new DataInputStream(bis); - long id = is.readLong(); - this.type = is.readUTF(); - this.url = new URL(is.readUTF()); - this.path = new Path(is.readUTF()); - } - - - /** - * Gets the type. - * @return Returns a String - */ - public String getType() { - return type; - } - - /** - * Gets the locationId. - * @return Returns a String - */ - public URL getURL() { - return url; - } - - /** - * @see Object#equals(Object) - */ - public boolean equals(Object other) { - if(this == other) return true; - if(! (other instanceof LocationMapping)) return false; - LocationMapping location = (LocationMapping)other; - return getType().equals(location.getType()) && - getURL().equals(location.getURL()) && - getPath().equals(location.getPath()); - } - /** - * Gets the path. - * @return Returns a IPath - */ - public IPath getPath() { - return path; - } - - - public byte[] encode() throws IOException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream os = new DataOutputStream(bos); - os.writeLong(SERIAL_ID); - os.writeUTF(getType()); - os.writeUTF(getURL().toExternalForm()); - os.writeUTF(getPath().toString()); - return bos.toByteArray(); - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java deleted file mode 100644 index 99f52a4fc..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/RemoteTargetSyncElement.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.core.sync.RemoteSyncElement; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; - -/** - * Is a synchronization element that can calculate three-way sync - * states based on timestamps. This is useful for synchronizing between - * repositories without revision history and thus the base contents is - * not available (e.g. non-versioning DAV, FTP...) - * - * @see IRemoteSyncElement - */ -public class RemoteTargetSyncElement extends RemoteSyncElement { - - private IRemoteTargetResource remote; - private IResource local; - private TargetProvider provider; - - public RemoteTargetSyncElement(TargetProvider provider, IResource local, IRemoteTargetResource remote) { - this.local = local; - this.remote = remote; - this.provider = provider; - } - - /** - * @see RemoteSyncElement#create(boolean, IResource, IRemoteResource, IRemoteResource, Object) - */ - public IRemoteSyncElement create(boolean isThreeWay, IResource local, IRemoteResource base, IRemoteResource remote, Object data) { - return new RemoteTargetSyncElement(provider, local, (IRemoteTargetResource)remote); - } - - /** - * @see RemoteSyncElement#timestampEquals(IResource, IRemoteResource) - */ - protected boolean timestampEquals(IResource e1, IRemoteResource e2) { - return false; - } - - /** - * @see RemoteSyncElement#timestampEquals(IRemoteResource, IRemoteResource) - */ - protected boolean timestampEquals(IRemoteResource e1, IRemoteResource e2) { - return false; - } - - /** - * @see LocalSyncElement#create(IResource, IRemoteResource, Object) - */ - public ILocalSyncElement create(IResource local, IRemoteResource base, Object data) { - return new RemoteTargetSyncElement(provider, local, (IRemoteTargetResource)base); - } - - /** - * @see LocalSyncElement#getData() - */ - protected Object getData() { - return null; - } - - /** - * @see LocalSyncElement#isIgnored(IResource) - */ - protected boolean isIgnored(IResource resource) { - return false; - } - - /** - * @see IRemoteSyncElement#getRemote() - */ - public IRemoteResource getRemote() { - return remote; - } - - /** - * @see IRemoteSyncElement#isThreeWay() - */ - public boolean isThreeWay() { - return true; - } - - /** - * @see ILocalSyncElement#getLocal() - */ - public IResource getLocal() { - return local; - } - - /** - * @see ILocalSyncElement#getBase() - */ - public IRemoteResource getBase() { - return null; - } - - /** - * @see ILocalSyncElement#getSyncKind(int, IProgressMonitor) - */ - public int getSyncKind(int granularity, IProgressMonitor progress) { - progress.beginTask(null, 100); - int description = IN_SYNC; - IResource local = getLocal(); - boolean localExists = local.exists(); - boolean hasBase = provider.hasBase(local); - boolean isOutgoing; - boolean isIncoming; - if (hasBase) { - isOutgoing = provider.isDirty(local); - isIncoming = isOutOfDate(Policy.subMonitorFor(progress, 10)); - } else { - // if there's no base, use existance to determine direction - isOutgoing = localExists; - isIncoming = remote != null; - } - - if (remote == null) { - if (!localExists) { - // this should never happen - // Assert.isTrue(false); - } else { - // no remote but a local - if (!isOutgoing && isIncoming) { - description = INCOMING | DELETION; - } else if (isOutgoing && isIncoming) { - description = CONFLICTING | CHANGE; - } else if (!isOutgoing && !isIncoming) { - description = OUTGOING | ADDITION; - } else if (isOutgoing && !isIncoming) { - description = OUTGOING | ADDITION; - } - } - } else { - if (!localExists) { - // a remote but no local - if (!isOutgoing /* and both out of date and not out of date */) { - description = INCOMING | ADDITION; - } else if (isOutgoing && !isIncoming) { - description = OUTGOING | DELETION; - } else if (isOutgoing && isIncoming) { - description = CONFLICTING | CHANGE; - } - } else { - // have a local and a remote - if (!isOutgoing && !isIncoming) { - // ignore, there is no change; - } else if (!isOutgoing && isIncoming) { - description = INCOMING | CHANGE; - } else if (isOutgoing && !isIncoming) { - description = OUTGOING | CHANGE; - } else { - description = CONFLICTING | CHANGE; - } - // if contents are the same, then mark as pseudo change - if (description != IN_SYNC && compare(granularity, false, local, remote, Policy.subMonitorFor(progress, 90))) - description |= PSEUDO_CONFLICT; - } - } - return description; - } - /** - * Returns the provider. - * @return TargetProvider - */ - protected TargetProvider getProvider() { - return provider; - } - - /** - * Return true if the resource associated with the receiver is out-of-date - */ - protected boolean isOutOfDate(IProgressMonitor monitor) { - IResource local = getLocal(); - if (provider.hasBase(local)) { - try{ - return provider.isOutOfDate(local, monitor); - } catch(TeamException e) { - TeamPlugin.log(e.getStatus()); - return true; - } - } - return false; - } - -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java deleted file mode 100644 index ba91c3f2c..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java +++ /dev/null @@ -1,826 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.core.NullSubProgressMonitor; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; - -/** - * This abstract class implements the state of a local and corresponding remote resource, - * and behavior of those resources. - *

- * Common state for all 'managed' resources includes: - *

    - *
  • the local resource and corresponding remote resource objects
  • - *
  • the timestamp of the local resource as it was last in synch with the provider
  • - *
  • an identifier for the remote resource as it was last in synch with the provider
  • - */ -public abstract class ResourceState { - - /* - * Serialization format identifier. - * see toBytes() and fromBytes() - */ - private static final int BYTES_FORMAT = 0; - - /* - * These constants are used to indicate uninitialized values for the local - * base timestamp and remote base identifier. - */ - protected static final long EMPTY_LOCALBASETS = -1L; - protected static final String EMPTY_REMOTEBASEID = "Undefined:"; //$NON-NLS-1$ - - /* - * The base state of the resource. The 'base' is the state of the resource - * state that was fetched from (or put in) the provider. - */ - protected long localBaseTimestamp = EMPTY_LOCALBASETS; - protected String remoteBaseIdentifier = EMPTY_REMOTEBASEID; - - protected boolean checkedOut = true; - - /* - * This is the local resource that the receiver represents. It is initialized by - * the constructor. (The remote resource is maintained by specific subclasses - * as it is type-dependent.) - */ - protected IResource localResource; - - protected QualifiedName stateKey = new QualifiedName("org.eclipse.team.target", "state_info"); //$NON-NLS-1$ //$NON-NLS-2$ - - protected URL rootUrl; - - /** - * Constructor for a resource state given a local resource. - * Remember which local resource this state represents. - * - * @param localResource the local part of a synchronized pair of resources. - */ - public ResourceState(IResource localResource, URL rootUrl) { - super(); - this.rootUrl = rootUrl; - SynchronizedTargetProvider.getSynchronizer().add(stateKey); - this.localResource = localResource; - } - - /** - * Get the timestamp that represents the base state of the local resource, that is - * the state that the local resource had when it was initially fetched from the repository. - * - * @return the timestamp of the local state of the resource (as reported by - * java.io.File.getLastModified()) at the point the resource was downloaded to the - * workspace. - * @throws BaseIdentifierNotInitializedException if the resource has not yet been - * downloaded. - */ - public long getLocalBaseTimestamp() - throws BaseIdentifierNotInitializedException { - if (localBaseTimestamp == EMPTY_LOCALBASETS) - throw new BaseIdentifierNotInitializedException(); - return localBaseTimestamp; - } - - - /** - * Get the identifier that represents the base state of the remote resource, that is - * the state of the remote resource when it was fetched as the base state of the - * local resource. - *

    - * In general, repositories have arbitrary ways to distinguish resource states. - * The result should only be used for equality comparison, there should be no - * ordering or other information implied from the value returned. For example, - * the value may be a version identifier, timestamp, ETag, etc. To ensure - * schemes do not inadvertantly test equal it is recommended that the identifier - * be a URI where the scheme denotes the value type, - * e.g., date-rfc1123:Fri, 16 Nov 2001 06:25:24 GMT

    - * - * @return an opaque identifier to the base state of the resource in the provider. - * @throws BaseIdentifierNotInitializedException if the resource has not yet been - * downloaded. - */ - public String getRemoteBaseIdentifier() - throws BaseIdentifierNotInitializedException { - if (remoteBaseIdentifier.equals(EMPTY_REMOTEBASEID)) - throw new BaseIdentifierNotInitializedException(); - return remoteBaseIdentifier; - } - - - /** - * Get the identifier that represents the released state of the resource, - * that is the state that it currently has in the repository. - *

    - * In general, repositories have arbitrary ways to distinguish resource states. - * The result should only be used for equality comparison, there should be no - * ordering or other information implied from the value returned. For example, - * the value may be a version identifier, timestamp, ETag, etc. To ensure - * schemes do not inadvertantly test equal it is recommended that the identifier - * be a URI where the scheme denotes the value type, - * e.g., date-rfc1123:Fri, 16 Nov 2001 06:25:24 GMT

    - * - * @param progress a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * @return an opaque identifier to the current released state of the resource in - * the provider. - * @throws TeamException if there is a problem getting the released state - * identifier from the provider. Valid exception status codes include: - *
      - *
    • IO_FAILED
    • - *
    • NO_REMOTE_RESOURCE
    • - *

    - */ - public abstract String getReleasedIdentifier(IProgressMonitor monitor) throws TeamException; - - /** - * Check out the receiver. Return a status if the receiver is in the wrong state for the operation to be performed. - * - * @throws TeamException if there is a error communicating with the resource from the server. - */ - public void checkout(IProgressMonitor progress) throws TeamException { - progress.beginTask(null, 100); - try { - // Not going to allow branching. - if (isOutOfDate(Policy.subMonitorFor(progress, 50))) - throw new TeamException(ITeamStatusConstants.CONFLICT_STATUS); - - // Sanity check. - if (!hasRemote(Policy.subMonitorFor(progress, 50))) - throw new TeamException(ITeamStatusConstants.NO_REMOTE_RESOURCE_STATUS); - - // Legally, the resource must be checked in before it can be checked out. - if (isCheckedOut()) - throw new TeamException(ITeamStatusConstants.NOT_CHECKED_IN_STATUS); - - // Do the provider specific action for check-out. - basicCheckout(progress); - } finally { - progress.done(); - } - } - - /** - * A basic checkout is provider specific. - * Unless overridden, work in an optimistic mode. - */ - protected void basicCheckout(IProgressMonitor progress) throws TeamException { - checkedOut = true; - } - - - /** - * Check in the receiver. - * - * @throws TeamException if there is a error communicating with the resource from the server. - */ - public void checkin(IProgressMonitor progress) throws TeamException { - progress = Policy.monitorFor(progress); - progress.beginTask(null, 100); - try { - // The resource must be checked out before it can be checked in. - if (!isCheckedOut()) - throw new TeamException(ITeamStatusConstants.NOT_CHECKED_OUT_STATUS); - - if (!hasLocal()) { - if (hasRemote(Policy.subMonitorFor(progress, 10))) { - delete(Policy.subMonitorFor(progress, 80)); - } - } else { - // Ensure the necessary remote direcotories exist - mkRemoteDirs(Policy.subMonitorFor(progress, 10)); - // Copy from the local resource to the repository. - if (getLocal().getType() == IResource.FILE) { - upload(Policy.subMonitorFor(progress, 80)); - } - } - //if we got to here the upload succeeded (didn't throw) - checkedOut = false; - } finally { - progress.done(); - } - } - - /** - * Uncheckout the receiver. - */ - public void uncheckout(IProgressMonitor progress) throws TeamException { - // Has to be checked-out before it can be reversed. - if (!isCheckedOut()) - throw new TeamException(ITeamStatusConstants.NOT_CHECKED_OUT_STATUS); - - // Nothing interesting to do since the API spec. requires that we do not reverse - // any local changes. - checkedOut = false; - } - - /** - * Answer whether the receiver is checked out or not. - *

    - * Note that this is a quick operation that will be called from the UI, so providers are required - * to cache information that is expensive to compute. Where the cache may get stale users - * have the opportunity to force a refresh using ITeamProvider.refreshState(). - * - * @return true if the receiver is checked in, and false - * if it is not. - * @see ITeamProvider#isCheckedOut(IResource) - * @see ITeamProvider#refreshState(IResource[], int, IProgressMonitor) - */ - public boolean isCheckedOut() { - return checkedOut; - } - - /** - * Answer if the local resource currently has a different timestamp to the - * base timestamp for this resource. - * - * @return true if the resource has a different modification - * timestamp, and false otherwise. - * @see ITeamProvider#isDirty(IResource) - */ - public boolean isDirty() { - if (!hasPhantom()) return false; - if (!hasLocal()) return true; - if (localBaseTimestamp == EMPTY_LOCALBASETS) - return localResource.getType() == IResource.FILE; - return localBaseTimestamp != localResource.getModificationStamp(); - } - - /** - * Answers true if the base identifier of the given resource is different to the - * current released state of the resource. - */ - public boolean isOutOfDate(IProgressMonitor monitor) throws TeamException { - if (!hasPhantom()) return false; - if (remoteBaseIdentifier.equals(EMPTY_REMOTEBASEID)) return false; - String releasedIdentifier = getReleasedIdentifier(monitor); - return !remoteBaseIdentifier.equals(releasedIdentifier); - } - - /** - * Download the remote resource represented by the receiver state to the location - * represented by the local resource (i.e., resource.getLocation().toFile()). - * This copies from the provider to the workspace, and sets the local - * base timestamp and remote base identifier. - * The provider may (and should wherever possible) optimize the case where it - * knows the local resource is identical to the remote resource. - */ - public abstract void download(IProgressMonitor progress) throws TeamException; - - /** - * Upload the resource represented by the local resource to the remote - * resource represented by the receiver. This copies from the workspace to - * the provider and sets the local base timestamp and remote base - * identifier. - */ - public abstract void upload(IProgressMonitor progress) throws TeamException; - - /** - * Delete the remote resource. - */ - public abstract void delete(IProgressMonitor progress) throws TeamException; - - /** - * Answer if the remote resource exists. - */ - public abstract boolean hasRemote(IProgressMonitor monitor) throws TeamException; - - /** - * Answer the type of the remote resource (if it exists). - * The type should correspond to the IResource enumerated types. - */ - public abstract int getRemoteType(); - - /** - * Answer the array of resource states for each member of the receiver. - * If the receiver has no members (or is incapable of having members) - * answer an empty array. - */ - public abstract ResourceState[] getRemoteChildren(IProgressMonitor monitor) throws TeamException; - - /** - * Create the necessary remote directories corresponding to the local resource. - * That is, if the resource is a folder, create it and its parents if they don't - * already exist. If the resource is a file, create its parents if they don't - * already exist. - */ - protected abstract void mkRemoteDirs(IProgressMonitor monitor) throws TeamException; - - /** - */ - public IResource getLocal() { - return localResource; - } - - /** - * Get the file underlying the local resource. - */ - protected File getLocalFile() { - return localResource.getLocation().toFile(); - } - - /** - * Answer if the local resource exists. - */ - protected boolean hasLocal() { - return localResource.exists(); - } - - /** - * Answer if the local resource has a phantom, which indicates that the respource had both a local - * and remote version at one time. - */ - protected boolean hasPhantom() { - try { - return SynchronizedTargetProvider.getSynchronizer().getSyncInfo(stateKey, localResource) != null; - } catch (CoreException e) { - TeamPlugin.log(e.getStatus()); - return false; - } - } - - /** - * Initializes the resource state instance from the given serialized state. - * The format of the serialized state is that produced by toBytes(). - * - * @param bytes the serialized resource state. - */ - public final void loadState() throws TeamException { - try { - byte[] storedState = - SynchronizedTargetProvider.getSynchronizer().getSyncInfo(stateKey, localResource); - if (storedState != null) - fromBytes(storedState); - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - - /** - * Initializes the resource state instance from the given serialized state. - * The format of the serialized state is that produced by toBytes(). - * - * @param bytes the serialized resource state. - */ - protected void fromBytes(byte[] bytes) throws TeamException{ - try { - DataInputStream dataStream = - new DataInputStream(new ByteArrayInputStream(bytes)); - if (BYTES_FORMAT != dataStream.readByte()) - return; - - // Restore common resource state values. - remoteBaseIdentifier = dataStream.readUTF(); - localBaseTimestamp = dataStream.readLong(); - - } catch (IOException e) { - throw TeamPlugin.wrapException(e); - } - }; - - public final void storeState() throws TeamException { - try { - SynchronizedTargetProvider.getSynchronizer().setSyncInfo( - stateKey, - localResource, - toBytes()); - // Ensure that the parent has base info recorded (otherwise deleting the parent will cause the lose of sync info) - if (localResource.getType() == IResource.PROJECT) return; - IContainer parent = localResource.getParent(); - if (parent != null && parent.getType() != IResource.PROJECT && - SynchronizedTargetProvider.getSynchronizer().getSyncInfo(stateKey, parent) == null) { - getParent().storeState(); - } else { - ResourcesPlugin.getWorkspace().save(false, null); - } - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - - /** - * Answer the resource state as a sequence of bytes, in a format that can be used to - * reconstruct an equivalent resource state using the fromBytes(byte[]) - * method. - *

    - * Subclasses should implement storeState(DataOutputStream) to - * store provider specific state information.

    - * - * @return the resource state as a byte array. - * @see #storeState(DataOutputStream) - * @see fromBytes(byte[]) - */ - protected byte[] toBytes() throws TeamException { - try { - // Create a stream to store the byte representation of the receiver's state. - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(32); - // Guess ~32 bytes - DataOutputStream dataStream = new DataOutputStream(byteStream); - dataStream.writeByte(BYTES_FORMAT); - - // Store data common to all resource states. - dataStream.writeUTF(remoteBaseIdentifier); - dataStream.writeLong(localBaseTimestamp); - - dataStream.close(); - return byteStream.toByteArray(); - } catch (IOException e) { - throw TeamPlugin.wrapException(e); - } - } - - final public void removeState() throws TeamException { - try { - if (localResource.exists() || localResource.isPhantom()) { - SynchronizedTargetProvider.getSynchronizer().flushSyncInfo( - stateKey, - localResource, - IResource.DEPTH_INFINITE); - } - } catch (CoreException e) { - throw TeamPlugin.wrapException(e); - } - } - - /** - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class adapter) { - return Platform.getAdapterManager().getAdapter(this, adapter); - } - - /** - * Method getRoot. - * @return URL of this resource's parent - */ - public URL getRoot() { - return rootUrl; - } - - private ResourceState getParent() throws TeamException { - return getResourceStateFor(localResource.getParent()); - } - - private ResourceState getResourceStateFor(IResource resource) throws TeamException { - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - return ((SynchronizedTargetProvider)provider).getState(resource); - } - - /** - * Get the resource corresponding to the receiver to the specified depth. - */ - protected final void get(int depth, IProgressMonitor progress) throws TeamException { - - progress = Policy.monitorFor(progress); - - // the no progress monitor is used to control the progress given to - // other methods and ensures that the progress monitor is not overloaded - // with subtask messages and work. The null monitor does propagate - // cancellation. - IProgressMonitor noProgress = new NullSubProgressMonitor(progress); - try { - progress.beginTask(null, 100); - Policy.checkCanceled(progress); - - // If remote does not exist then simply ensure no local resource exists. - if (!hasRemote(noProgress)) { - if (hasLocal()) - deleteLocal(noProgress); - return; - } - - // Ensure that the required local folders exist - if (!hasLocal()) { - mkLocalDirs(noProgress); - } - - // If the remote resource is a file, download the remote contents - if (getRemoteType() == IResource.FILE) { - download(Policy.subMonitorFor(progress, 100)); - return; - } - - // The remote resource is a container. - - // If the local resource is a file, we must remove it first. - if (getLocal().getType() == IResource.FILE) { - if (hasLocal()) { - deleteLocal(noProgress); // May not exist. - } - // change the local resource to a folder and create it - localResource = localResource.getParent().getFolder(new Path(localResource.getName())); - mkLocalDirs(noProgress); - } - - // Finally, resolve the collection membership based upon the depth parameter. - switch (depth) { - case IResource.DEPTH_ZERO : - // If we are not considering members of the collection then we are done. - return; - case IResource.DEPTH_ONE : - // If we are considering only the immediate members of the collection - getFolderShallow(Policy.subMonitorFor(progress, 100)); - return; - case IResource.DEPTH_INFINITE : - // We are going in deep. - getFolderDeep(Policy.subMonitorFor(progress, 100)); - return; - default : - // We have covered all the legal cases. - Assert.isLegal(false); - return; // Never reached. - } // end switch - } finally { - progress.done(); - } - } - - /** - * Get the folder resource represented by the receiver deeply. - */ - protected final void getFolderDeep(IProgressMonitor progress) throws TeamException { - progress = Policy.monitorFor(progress); - try { - progress.beginTask(null, 10); - // Could throw if problem getting the folder at this level. - ResourceState[] childFolders = getFolderShallow(Policy.subMonitorFor(progress, 7)); - - // If there are no further children then we are done. - if (childFolders.length == 0) - return; - - IProgressMonitor subProgress = Policy.subMonitorFor(progress, 3); - // Collect the responses in the multistatus. - try { - subProgress.beginTask(null, childFolders.length); - for (int i = 0; i < childFolders.length; i++) { - childFolders[i].get(IResource.DEPTH_INFINITE, Policy.subMonitorFor(subProgress, 1)); - } - } finally { - subProgress.done(); - } - - return; - } finally { - progress.done(); - } - } - - /** - * Synchronize from the remote provider to the workspace. - * Assume that the 'remote' folder is correct, and change the local - * folder to look like the remote folder. - * - * returns an array of children of the remote resource that are themselves - * collections. - */ - protected final ResourceState[] getFolderShallow(IProgressMonitor progress) throws TeamException { - progress = Policy.monitorFor(progress); - IProgressMonitor noProgress = new NullProgressMonitor(); - try { - // We are assuming that the resource is a container. - Assert.isLegal(getLocal() instanceof IContainer); - IContainer localContainer = (IContainer)getLocal(); - - // Get list of all _remote_ children. - ResourceState[] remoteChildren = getRemoteChildren(noProgress); - - // This will be the list of remote children that are themselves containers. - Set remoteChildFolders = new HashSet(); - - // Make a list of _local_ children that have not yet been processed, - IResource[] localChildren = getLocalChildren(); - Set surplusLocalChildren = new HashSet(localChildren.length); - surplusLocalChildren.addAll(Arrays.asList(localChildren)); - - progress.beginTask(null, remoteChildren.length * 100); - // For each remote child that is a file, make the local file content equivalent. - for (int i = 0; i < remoteChildren.length; i++) { - Policy.checkCanceled(progress); - ResourceState remoteChildState = remoteChildren[i]; - // If the remote child is a container add it to the list, and ensure that the local child - // is a folder if it exists. - if (remoteChildState.getRemoteType() == IResource.FILE) { - // The remote resource is a file. Copy the content of the remote file - // to the local file, overwriting any existing content that may exist, and - // creating the file if it doesn't. - remoteChildState.download(Policy.subMonitorFor(progress, 100)); - // Remember that we have processed this child. - surplusLocalChildren.remove(remoteChildState.getLocal()); - } else { - // The remote resource is a container. - remoteChildFolders.add(remoteChildState); - // If the local child is not a container then it must be deleted. - IResource localChild = remoteChildState.getLocal(); - if (localChild.exists() && (!(localChild instanceof IContainer))) - remoteChildState.deleteLocal(noProgress); - } // end if - } // end for - - // Remove each local child that does not have a corresponding remote resource. - TargetProvider provider = TargetManager.getProvider(localContainer.getProject()); - Iterator childrenItr = surplusLocalChildren.iterator(); - while (childrenItr.hasNext()) { - IResource unseenChild = (IResource) childrenItr.next(); - ((SynchronizedTargetProvider)provider).newState(unseenChild).deleteLocal(noProgress); - } // end-while - - // Answer the array of children seen on the remote collection that are - // themselves collections (to support depth operations). - return (ResourceState[]) remoteChildFolders.toArray( - new ResourceState[remoteChildFolders.size()]); - } finally { - progress.done(); - } - } - - /** - * Delete the local resource represented by the resource state. Do not complain if the resource does not exist. - */ - protected final void deleteLocal(IProgressMonitor progress) throws TeamException { - try { - getLocal().delete(IResource.KEEP_HISTORY, progress); - removeState(); - } catch (CoreException exception) { - throw TeamPlugin.wrapException(exception); - } - } - - /** - * Make the local directories matching the description of the local resource state. - */ - protected final void mkLocalDirs(IProgressMonitor progress) throws TeamException { - try { - IResource resource = getLocal(); - if (resource.getType() == IResource.FILE) { - resource = resource.getParent(); - } - if (resource.getType() == IResource.FOLDER && ! resource.exists()) { - if (!resource.getParent().exists()) { - ResourceState parent=getResourceStateFor(resource.getParent()); - parent.mkLocalDirs(progress); - } - ((IFolder)resource).create(false /* force */, true /* make local */, progress); - // Mark the folders as having a base - storeState(); - } - } catch (CoreException exception) { - // The creation failed. - throw TeamPlugin.wrapException(exception); - } - } - - /** - * Get an array of local children of the given container, or an empty array if the - * container does not exist or has no children. - */ - protected final IResource[] getLocalChildren() throws TeamException { - // We are assuming that the resource is a container. - Assert.isLegal(getLocal() instanceof IContainer); - IContainer container = (IContainer)getLocal(); - if (container.exists()) - try { - return container.members(); - } catch (CoreException exception) { - throw TeamPlugin.wrapException(exception); - } - return new IResource[0]; - } - - /** - * Put the resource from the workspace to the remote provider. - * Assume that the 'local' resource is correct, and change the remote - * resource to look like the local resource. This includes removing any - * child resources that exist remotely but do not exist locally. - */ - protected final void put(IProgressMonitor progress) throws TeamException { - - progress = Policy.monitorFor(progress); - - // the no progress monitor is used to control the progress given to - // other methods and ensures that the progress monitor is not overloaded - // with subtask messages and work. The null monitor does propagate - // cancellation. - IProgressMonitor noProgress = new NullSubProgressMonitor(progress); - try { - // Check cancellation - progress.beginTask(null, 100); - Policy.checkCanceled(progress); - - // This operation is inefficient -// // Ensure that the remote type matches the local type -// boolean hasRemote = hasRemote(noProgress); -// if ((getRemoteType() != localResource.getType() && localResource.getType() != IResource.PROJECT)) { -// if (hasRemote) delete(noProgress); -// hasRemote = false; -// } - - // Upload the resource (this is a shallow operation for folders) - checkin(Policy.subMonitorFor(progress, 75)); - - // If we're putting a file, we're done - if (localResource.getType() == IResource.FILE) return; - - // If the local doesn't exist then we just deleted the remote so we're done - if (!hasLocal()) return; - - // Make a list of _remote_ children that have not yet been processed, - Map surplusRemoteChildren = new HashMap(); - boolean hasRemote = hasRemote(noProgress); // XXX is this needed? - if (hasRemote) { - ResourceState[] remoteChildren = remoteChildren = getRemoteChildren(progress); - for (int i = 0; i < remoteChildren.length; i++) { - ResourceState resourceState = remoteChildren[i]; - surplusRemoteChildren.put(resourceState.getLocal(), resourceState); - } - } - - // For each local child that is a file, make the remote file content equivalent. - IResource[] localChildren = getLocalChildren(); - IProgressMonitor subMonitor = Policy.subMonitorFor(progress, 25); - try { - subMonitor.beginTask(null, localChildren.length * 100); - for (int i = 0; i < localChildren.length; i++) { - IResource localChild = localChildren[i]; - // Get the resource state corresponding to the local resource - ResourceState state = (ResourceState)surplusRemoteChildren.get(localChild); - if (state == null) { - // There is no remote corresponding to the local - state = getResourceStateFor(localChild); - } else { - // There is a remote. Remember that we have processed this child. - surplusRemoteChildren.remove(localChild); - } - // Put the child (this is a deep operation for folders) - state.put(Policy.subMonitorFor(subMonitor, 100)); - } - } finally { - subMonitor.done(); - } - - // Remove each remote child that does not have a corresponding local resource. - Iterator childrenItr = surplusRemoteChildren.values().iterator(); - while (childrenItr.hasNext()) { - ResourceState unseenChild = (ResourceState) childrenItr.next(); - unseenChild.delete(noProgress); - } - } finally { - progress.done(); - - } - } - - /** - * Method to be used only by subclasses to set the remoteBaseIdentifier after - * an upload or download. - * - * @param remoteBaseIdentifier The remoteBaseIdentifier to set - */ - protected void setRemoteBaseIdentifier(String remoteBaseIdentifier) { - this.remoteBaseIdentifier = remoteBaseIdentifier; - } - - /** - * Method to be used only by subclasses to set the localBaseTimestamp after - * an upload or download. - * - * @param localBaseTimestamp The localBaseTimestamp to set - */ - public void setLocalBaseTimestamp(long localBaseTimestamp) { - this.localBaseTimestamp = localBaseTimestamp; - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java deleted file mode 100644 index b330e3424..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/Site.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.io.ObjectOutputStream; -import java.net.URL; -import java.util.Properties; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.TeamException; - -/** - * A Site is a place where resources can be deployed and - * retrieved via a target provider. - * - * @see ISiteFactory - */ -public abstract class Site { - - //The location of the site's resources: - private URL rootUrl; - - /** - * Answers a TargetProvider instance for the given path at - * this site. - */ - public abstract TargetProvider newProvider(IPath intrasitePath) - throws TeamException; - - /** - * Answers the type identifier for this site. For example: - *
    -	 * org.eclipse.team.target.webdav
    -	 * 
    - * - * @return string identifier for this site - */ - public abstract String getType(); - - /** - * Answers a string that can be displayed to the user that represents - * this site. For example: - *
    -	 * http://usename@www.mysite.com/dav (WebDav)
    - 	 * 
    - */ - public String getDisplayName() { - return getURL().toExternalForm(); - } - - /** - * Writes the state of this site such that the corresponding concrete - * ISiteFactory class can restore the site. - * - * @param os the object stream into which to write it's state - */ - public abstract void writeObject(ObjectOutputStream os); - - /** - * Returns a handle to the remote resource that represents this site - * on the server. - * - * @return a remote handle to this site that may or may not exist - */ - public IRemoteTargetResource getRemoteResource() throws TeamException { - return newProvider(Path.EMPTY).getRemoteResource(); - } - - /** - * Compares two Sites. The result is true if and only if - * the argument is not null and is a Site object that - * represents the same Site as this object. Two Site objects are equal - * if they have the same types and URLs. - * - * @param other the Site to compare with - * - * @return true if the Sites are the same; false - * otherwise - * - * @see Object#equals(Object) - */ - public boolean equals(Object other) { - if (this == other) return true; - if (!(other instanceof Site)) return false; - Site location = (Site)other; - if (!getType().equals(location.getType())) return false; - URL url = getURL(); - if (url == null) return super.equals(other); - return url.equals(location.getURL()); - } - - public int hashCode() { - URL url = getURL(); - if (url == null) return super.hashCode(); - return url.hashCode(); - } - - /** - * Debugging helper - * - * @see Object#toString() - */ - public String toString() { - return getDisplayName(); - } - - /** - * Should be called whenever a site is being deleted from the workspace. - * This method removes the encrypted login info stored for the site. - * @throws TeamException - */ - public abstract void dispose() throws TeamException; - - /** - * Answers the location of this site as a URL. For example: - *
    -	 * http://www.mysite.com:14356/dav
    -	 * 
    - * - * @return URL location of this site - */ - public URL getURL() { - return rootUrl; - } - - /** - * Sets the rootUrl. - * @param rootUrl The rootUrl to set - */ - protected void setURL(URL rootUrl) { - this.rootUrl = rootUrl; - } - - public abstract Properties getConfiguration(); - -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java deleted file mode 100644 index 5aa0a2f7d..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/SynchronizedTargetProvider.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ISynchronizer; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; - -public abstract class SynchronizedTargetProvider extends TargetProvider { - - private static final int CONFIG_FORMAT_VERSION = 2; - - // The location where the target reads/writes against - protected Site site; - // The path relative to the site where the target reads/writes against - protected IPath intrasitePath; - // The URL which combines the site and relative path - protected URL targetURL; - - /* - * Answers the synchronizer. - */ - final protected static ISynchronizer getSynchronizer() { - return ResourcesPlugin.getWorkspace().getSynchronizer(); - } - - public SynchronizedTargetProvider(Site site, IPath intrasitePath) throws TeamException { - this.intrasitePath = intrasitePath; - this.site = site; - // Create the combined URL here so we know it's good - String root = getSite().getURL().toExternalForm(); - try { - targetURL = UrlUtil.concat(root, intrasitePath); - } catch (MalformedURLException e) { - throw new TeamException(Policy.bind(Policy.bind("SynchronizedTargetProvider.invalidURLCombination"), root, intrasitePath.toString()), e); //$NON-NLS-1$ - } - } - - /* - * Answers a new state based on an existing local resource. - */ - abstract public ResourceState newState(IResource resource); - - /* - * Answers a new state based on an existing local resource and - * an associated existing remote resource. - */ - abstract public ResourceState newState(IResource resource, IRemoteTargetResource remote); - - /** - * @see TargetProvider#getSite() - */ - public Site getSite() { - return site; - } - - /** - * @see TargetProvider#getURL() - */ - public URL getURL() { - return targetURL; - } - - /* - * Get the state descriptor for a given resource. - */ - public ResourceState getState(IResource resource) throws TeamException { - // Create a new resource state with default values. - ResourceState state = newState(resource); - state.loadState(); - return state; - } - - /* - * Get the state descriptor for a given resource. - */ - public ResourceState getState(IResource resource, IRemoteTargetResource remote) throws TeamException { - // Create a new resource state with default values. - ResourceState state = newState(resource, remote); - state.loadState(); - return state; - } - - /** - * Get the resource from the provider to the workspace, and remember the fetched - * state as the base state of the resource. - * - * @see TargetProvider.get(IResource[], int, IProgressMonitor) - */ - public void get(final IResource[] resources, IProgressMonitor progress) throws TeamException { - run(new ITargetRunnable() { - public void run(IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(null, resources.length * 100); - for (int i = 0; i < resources.length; i++) { - getState(resources[i]).get(IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100)); - } - } finally { - monitor.done(); - } - } - }, Policy.monitorFor(progress)); - } - - /** - * Get the resource from the provider to the workspace, and remember the fetched - * state as the base state of the resource. - * - * @see TargetProvider.get(IResource, IRemoteTargetResource, IProgressMonitor) - */ - public void get(final IResource resource, final IRemoteTargetResource remote, IProgressMonitor progress) throws TeamException { - run(new ITargetRunnable() { - public void run(IProgressMonitor monitor) throws TeamException { - getState(resource, remote).get(IResource.DEPTH_INFINITE, monitor); - } - }, Policy.monitorFor(progress)); - } - - - /** - * Put the resources to the remote. - * - * @see TargetProvider.put(IResource[], IProgressMonitor) - */ - public void put(final IResource[] resources, IProgressMonitor progress) throws TeamException { - run(new ITargetRunnable() { - public void run(IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(null, resources.length * 100); - for (int i = 0; i < resources.length; i++) { - getState(resources[i]).put(Policy.subMonitorFor(monitor, 100)); - } - } finally { - monitor.done(); - } - } - }, Policy.monitorFor(progress)); - } - - /** - * Answer if the local resource currently has a different timestamp to the - * base timestamp for this resource. - * - * @param resource the resource to test. - * @return true if the resource has a different modification - * timestamp, and false otherwise. - * - * @see TargetProvider#isDirty(IResource) - */ - public boolean isDirty(IResource resource) { - try { - return getState(resource).isDirty(); - } catch (TeamException e) { - TeamPlugin.log(e.getStatus()); - return true; - } - } - - /** - * Answers true if the base identifier of the given resource is different to the - * current released state of the resource. - * - * @param resource the resource state to test. - * @return true if the resource base identifier is different to the - * current released state of the resource, and false otherwise. - * - * @see TargetProvider#isOutOfDate(IResource, IProgressMonitor) - */ - public boolean isOutOfDate(IResource resource, IProgressMonitor monitor) throws TeamException { - ResourceState state = getState(resource); - return state.isOutOfDate(monitor); - } - - /** - * @see TargetProvider#deregister(IProject) - */ - public void deregister(IProject project) { - try { - newState(project).removeState(); - } catch (TeamException e) { - TeamPlugin.log(e.getStatus()); - } - } - - /** - * @see TargetProvider#getRemoteSyncElement(IResource) - */ - public IRemoteSyncElement getRemoteSyncElement(IResource resource) { - return new RemoteTargetSyncElement(this, resource, getRemoteResourceFor(resource)); - } - - - /** - * @see TargetProvider#hasBase(IResource) - */ - public boolean hasBase(IResource resource) { - // the project always has a base - if (resource.getType() == IResource.PROJECT) return true; - try { - return getState(resource).hasPhantom(); - } catch (TeamException e) { - TeamPlugin.log(e.getStatus()); - return true; - } - } - - -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java deleted file mode 100644 index defb8fcf9..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetManager.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ISynchronizer; -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.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.TeamPlugin; - -public class TargetManager { - private static final String TARGET_SITES_FILE = ".targetSites"; //$NON-NLS-1$ - - private static final QualifiedName TARGET_MAPPINGS = - new QualifiedName("org.eclipse.team.core.target", "mappings"); //$NON-NLS-1$ //$NON-NLS-2$ - - private static Map factories = new Hashtable(); - private static List sites = new ArrayList(); - private static List listeners = new ArrayList(); - - //Key for persistent property to denote the project as having target management - private static final QualifiedName PROP_KEY = - new QualifiedName("org.eclipse.team", "target"); //$NON-NLS-1$ //$NON-NLS-2$ - - //Key to signify the kind of target. We only have one at the moment - private static final String BASIC_TARGET_KEY = "basic"; //$NON-NLS-1$ - - public static void startup() { - ResourcesPlugin.getWorkspace().getSynchronizer().add(TARGET_MAPPINGS); - readLocations(); - } - - public static Site[] getSites() { - return (Site[]) sites.toArray( - new Site[sites.size()]); - } - - public static void addSite(Site site) { - sites.add(site); - save(); - for (Iterator it = listeners.iterator(); it.hasNext();) { - ISiteListener element = (ISiteListener) it.next(); - element.siteAdded(site); - } - } - - public static void removeSite(Site site) { - sites.remove(site); - save(); - for (Iterator it = listeners.iterator(); it.hasNext();) { - ISiteListener element = (ISiteListener) it.next(); - element.siteRemoved(site); - } - } - - /** - * @see TargetProvider#map(IProject) - */ - public static void map(IProject project, Site site, IPath path) throws TeamException { - try { - ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer(); - byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project); - if (mappingBytes != null) { - throw new TeamException(Policy.bind("TargetManager.Problems_mapping_project._Project_is_already_mapped._4")); //$NON-NLS-1$ - } - LocationMapping mapping = new LocationMapping(site, path); - s.setSyncInfo( - TARGET_MAPPINGS, - project, - mapping.encode()); - project.setPersistentProperty(PROP_KEY, BASIC_TARGET_KEY); - } catch (CoreException e) { - throw new TeamException(Policy.bind("TargetManager.Problems_mapping_project", project.getName()), e); //$NON-NLS-1$ - } catch (IOException e) { - throw new TeamException(Policy.bind("TargetManager.Problems_mapping_project", project.getName()), e); //$NON-NLS-1$ - } - } - - /** - * @see TargetProvider#unmap(IProject) - */ - public static void unmap(IProject project) throws TeamException { - try { - ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer(); - byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project); - if (mappingBytes == null) { - throw new TeamException(Policy.bind("TargetManager.unableToUnmap", project.getName())); //$NON-NLS-1$ - } else { - TargetProvider provider = getProvider(project); - provider.deregister(project); - s.flushSyncInfo(TARGET_MAPPINGS, project, IResource.DEPTH_ZERO); - } - project.setPersistentProperty(PROP_KEY, null); // null arg removes - } catch (CoreException e) { - throw new TeamException(Policy.bind("TargetManager.problemsUnmapping", project.getName()), e); //$NON-NLS-1$ - } - } - - public static TargetProvider getProvider(IProject project) throws TeamException { - try { - ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer(); - byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project); - if (mappingBytes == null) { - return null; - } else { - LocationMapping mapping = new LocationMapping(mappingBytes); - Site site = - getSite(mapping.getType(), mapping.getURL()); - if (site != null) { - return site.newProvider(mapping.getPath()); - } - } - return null; - } catch (CoreException e) { - throw new TeamException(Policy.bind("TargetManager.problemsGettingProvider", project.getName()), e); //$NON-NLS-1$ - } catch (IOException e) { - throw new TeamException(Policy.bind("TargetManager.problemsGettingProvider", project.getName()), e); //$NON-NLS-1$ - } - } - - public static Site getSite(String type, URL url) { - return getSite(type, url.toExternalForm()); - } - - public static Site getSite(String type, String urlID) { - for (Iterator it = sites.iterator(); it.hasNext();) { - Site element = (Site) it.next(); - if (element.getType().equals(type) - && element.getURL().toExternalForm().equals(urlID)) { - return element; - } - } - return null; - } - - public static void addSiteListener(ISiteListener listener) { - listeners.add(listener); - } - - public static void removeSiteListener(ISiteListener listener) { - listeners.remove(listener); - } - - private static void readLocations() { - // read saved locations list from disk, only if the file exists - IPath pluginStateLocation = - TeamPlugin.getPlugin().getStateLocation().append( - TARGET_SITES_FILE); - File f = pluginStateLocation.toFile(); - if (f.exists()) { - try { - DataInputStream dis = - new DataInputStream(new FileInputStream(f)); - readLocations(dis); - } catch (IOException e) { - TeamPlugin.log(new Status(Status.ERROR, TeamPlugin.ID, 0, Policy.bind("Config.error"), e)); //$NON-NLS-1$ - } - } - } - - private static void writeLocations() { - // save repositories to disk - IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation(); - File tempFile = pluginStateLocation.append(TARGET_SITES_FILE + ".tmp").toFile(); //$NON-NLS-1$ - File stateFile = - pluginStateLocation.append(TARGET_SITES_FILE).toFile(); - try { - DataOutputStream dos = - new DataOutputStream(new FileOutputStream(tempFile)); - writeLocations(dos); - dos.close(); - if (stateFile.exists()) - stateFile.delete(); - boolean renamed = tempFile.renameTo(stateFile); - if (!renamed) { - //todo: log the error - } - } catch (IOException e) { - TeamPlugin.log(new Status(Status.ERROR, TeamPlugin.ID, 0, Policy.bind("Config.error"), e)); //$NON-NLS-1$ - } - } - - private static void save() { - writeLocations(); - } - - private static void readLocations(DataInputStream dis) throws IOException { - int repoCount = dis.readInt(); - for (int i = 0; i < repoCount; i++) { - String id = dis.readUTF(); - ISiteFactory factory = - (ISiteFactory) getSiteFactory(id); - if (factory == null) { - //todo: log error - return; - } - Site site = factory.newSite(new ObjectInputStream(dis)); - sites.add(site); - } - } - - private static void writeLocations(DataOutputStream dos) - throws IOException { - dos.writeInt(sites.size()); - Iterator iter = sites.iterator(); - while (iter.hasNext()) { - Site site = (Site) iter.next(); - dos.writeUTF(site.getType()); - site.writeObject(new ObjectOutputStream(dos)); - } - dos.flush(); - dos.close(); - } - - public static ISiteFactory getSiteFactory(String id) { - TeamPlugin plugin = TeamPlugin.getPlugin(); - if (plugin != null) { - IExtensionPoint extension = - plugin.getDescriptor().getExtensionPoint( - TeamPlugin.TARGETS_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 (ISiteFactory) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ - } catch (CoreException e) { - TeamPlugin.log(e.getStatus()); - return null; - } - } - } - } - } - } - return null; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java deleted file mode 100644 index 84b1a623b..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteSyncElement; - -public abstract class TargetProvider { - /** - * Answers the site which this target is associated with - * @return a printable string - */ - public abstract Site getSite(); - - /** - * Answers the full path where the provider stores/retrieves to/from. - * @return a printable string - */ - public abstract URL getURL(); - - /** - * 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. - * Where, the remote resource does not exist and the local does, this method will delete - * the local resource. - *

    - * If the remote resource is a container (e.g. folder or project) this operation is equivalent - * to getting each 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.

    - *

    - * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.

    - * - * @param resources an array of local resources to update from the corresponding remote - * resources. - * @param progress a progress monitor to indicate the duration of the operation, or - * null 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 resources - * array. - */ - public abstract void get(IResource[] resources, IProgressMonitor progress) throws TeamException; - - /** - * Updates the local resource to have the same content as the given remote - * resource. Where the local resource does not exist, this method will create it. - *

    - * 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.

    - *

    - * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.

    - * - * @param resources an array of local resources to update from the corresponding remote - * resources. - * @param progress a progress monitor to indicate the duration of the operation, or - * null 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 resources - * array. - */ - public abstract void get(IResource resource, IRemoteTargetResource remote, IProgressMonitor progress) throws TeamException; - - /** - * Transfers the content of the local resource to the corresponding remote resource. - *

    - * 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 correspond to the new remote resource. - * If the local resource doesn't exist and a remote does, the remote resource will be deleted. - *

    - *

    - * If the local resource is a container (e.g. folder or project) this operation is equivalent - * to putting each member of the local resource, thereby updating the - * content of existing remote members, creating remote members to receive new local resources, - * and deleting remote members that no longer have a corresponding local resource.

    - *

    - * @param resources an array of local resources to be put. - * @param progress a progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. - * @throws TeamException if there is a problem put'ing one or more of the resources. - * The exception will contain multiple status', one for each resource in the resources - * array. - */ - public abstract void put(IResource[] resources, IProgressMonitor progress) throws TeamException; - - /** - * Returns a remote resource handle at the path of the given local resource. - * - * @param resource local resource path to be used to construct the remote handle's path - * @return a handle to a remote resource that may or may not exist - */ - public abstract IRemoteTargetResource getRemoteResourceFor(IResource resource); - - /** - * Returns a remote resource handle at the path of this target provider's URL. - * @return a handle to a remote resource that may or may not exist - */ - public abstract IRemoteTargetResource getRemoteResource(); - - /** - * Replies true if its believed possible to get the given resource. - * This intended to be a relatively quick operation, presumably based on local state of the provider - * or it may be used to indicate that the provider only supports data transfer in one direction. - * It is not intended to indicate the existance of a remote resource. Hence, this method may return true - * even if there is no remote resource. - */ - public boolean canGet(IResource resource) { - return true; - } - - /** - * Replies true if its believed possible to put the given resource. - * This intended to be a relatively quick operation, presumably based on local state of the provider - * or it may be used to indicate that the provider only supports data transfer in one direction. - */ - public boolean canPut(IResource resource) { - return true; - } - - /** - * Answers true if the base identifier of the given resource is different to the - * current released state of the resource. Answer false if there is no correspondence - * between the local and remote resources (i.e. hasBase(resource) returns false). - * - * @param resource the resource to test - * @param monitor a progress monitor - * - * @throws TeamException if there is a problem getting this information from the server. - */ - public abstract boolean isOutOfDate(IResource resource, IProgressMonitor monitor) throws TeamException; - - /** - * Answer true if the local resource currently has a different timestamp to the - * base timestamp for this resource. Answer true for local resources that no longer exist - * (i.e. the local resource did exist and corresponded to a remote resource) and false if the - * local resource does not exist and was never mapped to a remote resource. - * - * @param resource the resource to test - */ - public abstract boolean isDirty(IResource resource); - - /** - * Answer true if the given resource at one time had a remote counterpart and still does - * to the knowledge of the provider. - * - * @param resource the resource to test - */ - public abstract boolean hasBase(IResource resource); - - public abstract void deregister(IProject project); - - /** - * This method provides a mechanism for allowing a target provider to optimize connections - * over a set of operations. The default behavior of the method is to run the provided runnable - * and to supply it with the provided progress monitor. Specific target providers may override this - * method in order to ensure that the number of connections made to a remote server is minimized. - * Calls to this method are nestable and it is up to the target provider to ensure that this is - * supported. - */ - public void run(final ITargetRunnable runnable, IProgressMonitor monitor) throws TeamException { - try { - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - try { - runnable.run(monitor); - } catch (TeamException e) { - throw new CoreException(e.getStatus()); - } - } - }, monitor); - } catch (CoreException e) { - throw new TeamException(e.getStatus()); - } - } - - /** - * Return an IRemoteSyncElement for the given resource. This element is used to - * compare the state of the local and remote resources. - */ - public abstract IRemoteSyncElement getRemoteSyncElement(IResource resource); - - /** - * @see java.lang.Object#equals(Object) - */ - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj.getClass().equals(this.getClass())) { - return this.getURL().toExternalForm().equals(((TargetProvider)obj).getURL().toExternalForm()); - } - return super.equals(obj); - } - - - /** - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getURL().toExternalForm().hashCode(); - } - -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java deleted file mode 100644 index cec172b8e..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/UrlUtil.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.core.target; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -public class UrlUtil { - - public static IPath getTrailingPath(URL fullURL, URL startingURL) { - IPath fullPath = new Path(fullURL.getPath()); - IPath startingPath = new Path(startingURL.getPath()); - int matchingCount = fullPath.matchingFirstSegments(startingPath); - return fullPath.removeFirstSegments(matchingCount); - } - - public static URL concat(String root, IPath end) throws MalformedURLException { - return new URL(concatString(root, end)); - } - - public static String concatString(String root, IPath end) { - if(end.isEmpty()) - return root; - if(root.length() == 0) - return end.toString(); - boolean rootHasTrailing = root.charAt(root.length() - 1) == Path.SEPARATOR; //has trailing '/' - boolean endHasLeading = end.isAbsolute(); // has leading '/' - - if(rootHasTrailing && endHasLeading) //http://mysite/ + /myFolder - return root + end.toString().substring(1); // we have two seperators, drop one - - if(!rootHasTrailing && !endHasLeading) //http://mysite + myFolder - return root + Path.SEPARATOR + end.toString(); - - return root + end.toString(); //have one separator between the two, just concat end - } - - /* - * Return a string that is like url but guaranteed to end with a '/' - */ - public static String makeAbsolute(String url) { - boolean hasTrailing = url.charAt(url.length() - 1) == Path.SEPARATOR; //has trailing '/' - if(hasTrailing) - return url; - return url + Path.SEPARATOR; - } - - /* - * @see toTruncatedPath(URL, int) - */ - public static String toTruncatedPath(URL url, int split) { - return toTruncatedPath(url.getPath(), split); - } - - /* - * If the number of segments in the url path is greater than split then - * the returned path is truncated to split number of segments and '...' - * is shown as the first segment of the path. - */ - public static String toTruncatedPath(String url, int split) { - IPath path = new Path(url); - path = path.setDevice(null); // clear the device id, in this case the http: - int segments = path.segmentCount(); - if(segments>split) { - IPath last = path.removeFirstSegments(segments - split); - return "..." + IPath.SEPARATOR + last.toString(); //$NON-NLS-1$ - } - return path.toString(); - } -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties deleted file mode 100644 index eb507c645..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/messages.properties +++ /dev/null @@ -1,11 +0,0 @@ - -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. -provider.configuration.missing=Required configuration value missing. -provider.configuration.invalid=Configuration value is invalid. -filetransfer.monitor={0} ({1}K of {2}K bytes) -multiStatus.errorsOccurred=Errors occurred \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ssh/.classpath b/bundles/org.eclipse.team.cvs.ssh/.classpath deleted file mode 100644 index 25a2d596a..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - 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 499b102f3..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 21c5b67aa..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/.project +++ /dev/null @@ -1,21 +0,0 @@ - - - org.eclipse.team.cvs.ssh - - - org.eclipse.core.boot - org.eclipse.core.runtime - org.eclipse.team.core - org.eclipse.team.cvs.core - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - 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 @@ - - - -About - - - -

    About This Content

    - -

    20th June, 2002

    -

    License

    -

    Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

    - -

    Third Party Content

    - -

    The Content includes items that have been sourced from third parties as follows:

    - -

    The Java (TM) Ssh Applet

    -

    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:

    - -
    - Copyright (c) 1998 Cedric Gourio
    - (http://www.cl.cam.ac.uk/~fapp2/software/java-ssh/)
    - (javassh@france-mail.com) - -

    This program is FREE FOR COMMERCIAL AND NON-COMMERCIAL USE.
    - You can freely modify the code.

    - -

    You should however include this copyright notice in any redistribution
    - and please keep in touch with the author for any feedback.

    -
    - -

    The Blowfish Encryption Algorithm

    -

    The plug-in is based on an algorithm developed by Bruce Schneier. The algorithm was originally published in -a paper that is located at http://www.counterpane.com/bfsverlag.html. -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.

    - -

    Contributions

    - -

    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.

    - -

    If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

    - -

    Cryptography

    - -

    Export Control

    -

    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.

    - -

    Encryption Items

    - -

    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.

    - -

    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.

    - -

    The following Java classes contain encryption items (the plug-in may contain both binary and source code):

    - -
      -
    • org.eclipse.team.internal.ccvs.ssh.Blowfish
    • -
    • org.eclipse.team.internal.ccvs.ssh.Cipher
    • -
    • org.eclipse.team.internal.ccvs.ssh.Client
    • -
    • org.eclipse.team.internal.ccvs.ssh.ClientPacket
    • -
    • org.eclipse.team.internal.ccvs.ssh.Misc
    • -
    - -Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. - - - \ 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 62bf10bf9..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# 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 47ea87785..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/plugin.properties +++ /dev/null @@ -1,2 +0,0 @@ -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 7de275b30..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/plugin.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - 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 6af1ae215..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java +++ /dev/null @@ -1,1214 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 14c6270d2..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Cipher.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 4985e742b..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Client.java +++ /dev/null @@ -1,721 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - * - ******************************************************************************/ -package org.eclipse.team.internal.ccvs.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 OutputStream 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(InputStream socketIn, OutputStream socketOut, String username, String password) { - this.socketIn = socketIn; - this.socketOut = socketOut; - this.username = username; - this.password = password; -} -public Client(InputStream socketIn, OutputStream socketOut, String username, String password, String command) { - this(socketIn, socketOut, username, password); - this.command = command; -} -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 { - - // Create the socket (the socket should always be null here) - if (socket == null) { - try { - socket = Util.createSocket(host, port, monitor); - } 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); - } - socketIn = new BufferedInputStream(new PollingInputStream(socket.getInputStream(), - timeout > 0 ? timeout : 1, monitor)); - 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. - 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(); - - // 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; - send(SSH_MSG_DISCONNECT, null); - 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"));//$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")); //$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 839a6ef30..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 2931b3b80..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/KnownHosts.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - * - ******************************************************************************/ - -package org.eclipse.team.internal.ccvs.ssh; - -import java.io.*; -import java.math.BigInteger; -import java.util.Vector; - -import org.eclipse.core.boot.BootLoader; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -/** - * 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 known_hosts, or - * known_hosts 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.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) { - 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", hostname); //$NON-NLS-1$ - IStatus status = new Status(IStatus.INFO, SSHPlugin.ID, IStatus.OK, message, null); - SSHPlugin.getPlugin().getLog().log(status); - } catch (IOException ex) { - } - } - - /* - * 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 { - new File(defaultFilename()).createNewFile(); - } catch (IOException ee) { - // FIXME - Write to the log here - } - - } - 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 d4eef0263..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Misc.java +++ /dev/null @@ -1,465 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 ae83339ac..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 3b458214f..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Policy.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -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$ - } - } - -} \ No newline at end of file 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 32d2c181d..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHMethod.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 10f9ee0de..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java +++ /dev/null @@ -1 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; public class SSHPlugin extends Plugin { public static String ID = "org.eclipse.team.cvs.ssh"; //$NON-NLS-1$ private static SSHPlugin instance; /** * 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; } } \ No newline at end of file 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 44f209f55..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHServerConnection.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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; - - protected SSHServerConnection(ICVSRepositoryLocation location, String password) { - this.location = location; - this.password = password; - } - - public void close() throws IOException { - client.disconnect(); - } - /** - * Returns the InputStream used to read data from the - * server. - */ - public InputStream getInputStream() { - return inputStream; - } - /** - * Returns the OutputStream 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 7fcc895b2..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ServerPacket.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -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 2ee8ca46c..000000000 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/messages.properties +++ /dev/null @@ -1,30 +0,0 @@ -########################### -# (c) Copyright IBM Corp. 2000, 2001. -# All Rights Reserved. -########################### - -# 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=Added host key for {0} to known_hosts. -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} - diff --git a/bundles/org.eclipse.team.ui/.classpath b/bundles/org.eclipse.team.ui/.classpath deleted file mode 100644 index b9991d9b2..000000000 --- a/bundles/org.eclipse.team.ui/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - 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 8971323ad..000000000 --- a/bundles/org.eclipse.team.ui/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - org.eclipse.team.ui - - - org.apache.xerces - org.eclipse.compare - org.eclipse.core.resources - org.eclipse.core.runtime - org.eclipse.swt - org.eclipse.team.core - org.eclipse.ui - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - 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 @@ - - - -About - - - -

    About This Content

    - -

    20th June, 2002

    -

    License

    -

    Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

    - -

    Contributions

    - -

    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.

    - -

    If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

    - - - \ 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 6d0877d4b..000000000 --- a/bundles/org.eclipse.team.ui/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# 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/doc/hglegal.htm b/bundles/org.eclipse.team.ui/doc/hglegal.htm deleted file mode 100644 index 7c69b7304..000000000 --- a/bundles/org.eclipse.team.ui/doc/hglegal.htm +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - Legal Notices - - - -

    -Notices

    -(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.ui/doc/ngibmcpy.gif b/bundles/org.eclipse.team.ui/doc/ngibmcpy.gif deleted file mode 100644 index 61cef4852..000000000 Binary files a/bundles/org.eclipse.team.ui/doc/ngibmcpy.gif and /dev/null differ diff --git a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html deleted file mode 100644 index 8f8cb1da6..000000000 --- a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Team UI Extension Points - - - -
    -

    Team UI Plug-in

    -This document lists all of the extension points that the Team UI plug-in makes available to provider developers. -

    -


    -

    -General Extension Points

    -The following extension point can be used to register a configuration mechanism for associating a project -with a repository provider: - -Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - diff --git a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html deleted file mode 100644 index 11cc569b6..000000000 --- a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Eclipse Team UI Extension Point: Configuration Wizards - - - -
    -

    -Configuration Wizards

    -Identifier: org.eclipse.team.ui.configurationWizards -

    Description: This extension point is used to register -a method for configuration of a project. Configuration involves the association -of a project with a repository provider, including all information necessary to -initialize that repository provider, including such things as username, password, and -any relevant information necessary to locate the provider. -

    Providers may provide an extension for this extension point, and an -implementation of org.eclipse.team.ui.IConfigurationWizard which -gathers the necessary information and configures the project. -

    Configuration Markup: -

       <!ELEMENT wizard EMPTY> -
       <!ATTLIST wizard -
          name           -CDATA #REQUIRED -
          icon           -CDATA #REQUIRED -
          class          -CDATA #REQUIRED -
          id             -CDATA #REQUIRED -
       > - -

      -
    • name - the name of the configuration type, as it should appear in the configuration wizard. One examples is "CVS".
    • -
    • icon - the icon to present in the configuration wizard next to the name.
    • -
    • class - a fully qualified name of the Java class implementing org.eclipse.team.ui.IConfigurationWizard.
    • -
    • id - a unique identifier for this extension.
    • -
    - -Examples: -

    Following is an example of a configuration wizard extension: -

       <extension point="org.eclipse.team.ui.configurationWizard"> -
          <wizard -
            name="CVS" -
            icon="icons/full/wizards/newconnect_wiz.gif" -
            class="org.eclipse.team.internal.ccvs.ui.wizards.SharingWizard" -
            id="org.eclipse.team.ccvs.ui.SharingWizard"> -
          </wizard> -
       </extension> - -

    API Information: The value of the class attribute -must represent a class that implements org.eclipse.team.ui.IConfigurationWizard. -This interface supports configuration of a wizard given a workbench and a project. - -

    Supplied Implementation: The plug-in org.eclipse.team.examples.filesystem contains a -sample implementation of IConfigurationWizard for a filesystem based repository provider. - -

    Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif and /dev/null differ diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/site_element.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/site_element.gif deleted file mode 100644 index 36f82e3ab..000000000 Binary files a/bundles/org.eclipse.team.ui/icons/full/dlcl16/site_element.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif and /dev/null differ diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/site_element.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/site_element.gif deleted file mode 100644 index 42f9b81d7..000000000 Binary files a/bundles/org.eclipse.team.ui/icons/full/elcl16/site_element.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif and /dev/null 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 Binary files a/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif and /dev/null differ diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties deleted file mode 100644 index 7d77f353c..000000000 --- a/bundles/org.eclipse.team.ui/plugin.properties +++ /dev/null @@ -1,40 +0,0 @@ -providerName=Eclipse.org -pluginName=Team Support UI - -configurationWizards=Configuration Wizards -targetWizards=Target Site Addition Wizards - -TeamPreferencePage.name=Team -TextPreferencePage.name=File Content -IgnorePreferencePage.name=Ignored Resources -loginDetails=Login Details -targetSite=Target Site - -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 - -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 -TargetSiteImportWizard.name=Target Site -TargetSiteImportWizard.description=A wizard that imports a Target site -TargetSiteExportWizard.name=Target Site -TargetSiteExportWizard.description=A wizard that exports a Target site - -Deployment.group=Depl&oy -Deployment.getAction=&Target -Deployment.uploadAction=Upl&oad -Deployment.synchronize=Synchroni&ze with Target... - -SiteExplorerGetAs.label=Download &As... -SiteExplorerGetAs.tooltip=Download the selected remote folder with a user specified project type and name. -SiteExplorerGetAsProject.label=&Download As Project -SiteExplorerGetAsProject.tooltip=Download the selected remote folder and create a project with the same name. -SiteExplorerDiscardSite.label=D&iscard Site -SiteExplorerDiscardSite.tooltip=Discard the site \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml deleted file mode 100644 index 3bffdf21d..000000000 --- a/bundles/org.eclipse.team.ui/plugin.xml +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %ProjectSetImportWizard.description - - - - - - - - - - - %ProjectSetExportWizard.description - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.team.ui/schema/configurationWizards.mxsd b/bundles/org.eclipse.team.ui/schema/configurationWizards.mxsd deleted file mode 100644 index 15177dbfc..000000000 --- a/bundles/org.eclipse.team.ui/schema/configurationWizards.mxsd +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - 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. -<p> -Providers may provide an extension for this extension point, and an implementation of <samp>org.eclipse.team.ui.IConfigurationWizard</samp> -which gathers the necessary information and configures the projects. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The name of the configuration type as it should appear in the configuration wizard. Examples are "CVS", "WebDAV". - - - - - - - the icon to present in the configuration wizard next to the name. - - - - - - - - - - a fully qualified name of the Java class implementing <samp>org.eclipse.team.ui.IConfigurationWizard</samp>. - - - - - - - - - - a unique identifier for this extension. - - - - - - - - - - - - Following is an example of a configuration wizard extension: - -<p> -<pre> - <extension point="org.eclipse.team.ui.configurationWizard"> - <wizard - name="WebDAV" - icon="webdav.gif" - class="com.xyz.DAVDecorator" - id="com.xyz.dav"> - </wizard> - </extension> -</pre> -</p> - - - - - - - - - The value of the <samp>class</samp> attribute must represent a class that implements <samp>org.eclipse.team.ui.IConfigurationWizard</samp>. -This interface supports configuration of a wizard given a workbench and a project. - - - - - - - - - The plug-in org.eclipse.team.provider.examples.ui contains sample implementations of IConfigurationWizard for the WebDAV and filesystem provider types. - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java deleted file mode 100644 index dcaa3339a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.internal.model.WorkbenchAdapter; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * ConfigurationWizardElement represents an item in the configuration wizard table, - * declared by an extension to the configurationWizards extension point. - */ -public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable { - private String id; - private String name; - private ImageDescriptor imageDescriptor; - private String description; - private IConfigurationElement configurationElement; - - /** - * Creates a new instance of this class - * - * @param name the name of the element - */ - public ConfigurationWizardElement(String name) { - this.name = name; - } - /** - * Create an the instance of the object described by the configuration - * element. That is, create the instance of the class the isv supplied in - * the extension point. - * - * @throws CoreException if an error occurs creating the extension - */ - public Object createExecutableExtension() throws CoreException { - return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS); - } - /* - * Method declared on IAdaptable. - */ - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) { - return this; - } - return Platform.getAdapterManager().getAdapter(this, adapter); - } - /** - * Returns the configuration element - * - * @return the configuration element - */ - public IConfigurationElement getConfigurationElement() { - return configurationElement; - } - /** - * Returns the description parameter of this element - * - * @return the description of this elemnet - */ - public String getDescription() { - return description; - } - /** - * Returns the image for the given element - * - * @param element the element to get the image for - * @return the image for the given element - */ - public ImageDescriptor getImageDescriptor(Object element) { - return imageDescriptor; - } - /** - * Returns the label for the given element - * - * @param element the element to get the label for - * @return the label for the given element - */ - public String getLabel(Object element) { - return name; - } - /** - * Returns the id as specified in the extension. - * - * @return java.lang.String - */ - public String getID() { - return id; - } - /** - * Returns the image for this element. - * - * @return the image for this element - */ - public ImageDescriptor getImageDescriptor() { - return imageDescriptor; - } - /** - * Set the configuration element - * - * @param newConfigurationElement the new configuration element - */ - public void setConfigurationElement(IConfigurationElement newConfigurationElement) { - configurationElement = newConfigurationElement; - } - /** - * Set the description parameter of this element - * - * @param value the new desrciption - */ - public void setDescription(String value) { - description = value; - } - /** - * Sets the id parameter of this element - * - * @param value the new ID - */ - public void setID(String value) { - id = value; - } - /** - * Sets the image for this element. - * - * @param value the new image - */ - public void setImageDescriptor(ImageDescriptor value) { - imageDescriptor = value; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java deleted file mode 100644 index f0a5f015d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardNode; -import org.eclipse.swt.graphics.Point; - -/** - * 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/ConfigureProjectWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java deleted file mode 100644 index 5cf177f3f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java +++ /dev/null @@ -1,220 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.internal.model.AdaptableList; - -/** - * The wizard for associating projects with team providers - */ -public class ConfigureProjectWizard extends Wizard implements IConfigurationWizard { - protected IWorkbench workbench; - protected IProject project; - protected IConfigurationWizard wizard; - - protected ConfigureProjectWizardMainPage mainPage; - private String pluginId = UIConstants.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 UIConstants.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.getStatus()); - return; - } - } - mainPage = new ConfigureProjectWizardMainPage("configurePage1", getWizardLabel(), TeamImages.getImageDescriptor(UIConstants.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() { - if (wizard != null) { - return wizard.performFinish(); - } -// Code added for 13722 which causes CVS share project wizard to be finished twice -// IConfigurationWizard wizard = mainPage.getSelectedWizard(); -// if (wizard != null) { -// if (wizard.canFinish()) { -// return wizard.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(TeamImages.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/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java deleted file mode 100644 index a250cdece..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.model.AdaptableList; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * The main page of the configure project wizard. It contains a table - * which lists possible team providers with which to configure the project. - * The user may select one and press "Next", which will display a provider- - * specific wizard page. - */ -public class ConfigureProjectWizardMainPage extends WizardPage { - private Table table; - private TableViewer viewer; - private AdaptableList wizards; - private IWorkbench workbench; - private IProject project; - private String description; - - private IConfigurationWizard selectedWizard; - - /** - * Create a new ConfigureProjectWizardMainPage - * - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page title - * @param wizards the wizards to populate the table with - */ - public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards) { - this(pageName,title,titleImage,wizards,Policy.bind("ConfigureProjectWizardMainPage.selectRepository")); //$NON-NLS-1$ - } - - /** - * Create a new ConfigureProjectWizardMainPage - * - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page title - * @param wizards the wizards to populate the table with - * @param description The string to use as a description label - */ - public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards, String description) { - super(pageName, title, titleImage); - this.wizards = wizards; - this.description = description; - } - - public IConfigurationWizard getSelectedWizard() { - return selectedWizard; - } - /* - * @see WizardPage#canFlipToNextPage - */ - public boolean canFlipToNextPage() { - return selectedWizard != null && selectedWizard.getPageCount() > 0; - } - /* - * @see WizardPage#createControl - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - setControl(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARE_PROJECT_PAGE); - - Label label = new Label(composite, SWT.LEFT); - label.setText(description); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - - table = new Table(composite, SWT.SINGLE | SWT.BORDER); - data = new GridData(GridData.FILL_BOTH); - data.heightHint = table.getItemHeight() * 7; - table.setLayoutData(data); - viewer = new TableViewer(table); - viewer.setContentProvider(new WorkbenchContentProvider()); - viewer.setLabelProvider(new WorkbenchLabelProvider()); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - // Initialize the wizard so we can tell whether to enable the Next button - ISelection selection = event.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - selectedWizard = null; - setPageComplete(false); - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() != 1) { - selectedWizard = null; - setPageComplete(false); - return; - } - ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement(); - try { - selectedWizard = (IConfigurationWizard)selectedElement.createExecutableExtension(); - selectedWizard.init(workbench, project); - } catch (CoreException e) { - return; - } - selectedWizard.addPages(); - - // Ask the container to update button enablement - setPageComplete(true); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - getWizard().getContainer().showPage(getNextPage()); - } - }); - viewer.setInput(wizards); - } - /** - * The WizardSelectionPage implementation of - * this IWizardPage 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/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java deleted file mode 100644 index 5434a16cb..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * A simple superclass for detail button dialogs. - */ -abstract public class DetailsDialog extends Dialog { - /** - * The Details button. - */ - private Button detailsButton; - - /** - * The Ok button. - */ - private Button okButton; - - /** - * The title of the dialog. - */ - private String title; - - /** - * The error message - */ - private Label errorMessageLabel; - - /** - * The SWT list control that displays the error details. - */ - private Composite detailsComposite; - - /** - * Indicates whether the error details viewer is currently created. - */ - private boolean detailsCreated = false; - - /** - * The key for the image to be displayed (one of the image constants on Dialog) - */ - private String imageKey = null; - - /** - * Creates a details pane dialog. - * Note that the dialog will have no visual representation (no widgets) - * until it is told to open. - * - * @param parentShell the shell under which to create this dialog - * @param dialogTitle the title to use for this dialog - * @param message the message to show in this dialog - * @param status the error to show to the user - * @param displayMask the mask to use to filter the displaying of child items, - * as per IStatus.matches - * @see org.eclipse.core.runtime.IStatus#matches - */ - public DetailsDialog(Shell parentShell, String dialogTitle) { - super(parentShell); - this.title = dialogTitle; - setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); - } - - /* (non-Javadoc) - * Method declared on Dialog. - * Handles the pressing of the Ok or Details button in this dialog. - * If the Ok button was pressed then close this dialog. If the Details - * button was pressed then toggle the displaying of the error details area. - * Note that the Details button will only be visible if the error being - * displayed specifies child details. - */ - protected void buttonPressed(int id) { - if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed? - toggleDetailsArea(); - } else { - super.buttonPressed(id); - } - } - - /* (non-Javadoc) - * Method declared in Window. - */ - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(title); - } - - /* (non-Javadoc) - * Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) { - // create OK and Details buttons - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - if (includeCancelButton()) { - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false); - updateEnablements(); - } - - /* (non-Javadoc) - * Method declared on Dialog. - * Creates and returns the contents of the upper part - * of the dialog (above the button bar). - */ - final protected Control createDialogArea(Composite parent) { - // create composite - Composite composite = (Composite)super.createDialogArea(parent); - - // create image - Image image = JFaceResources.getImageRegistry().get(getImageKey()); - if (image != null) { - // create a composite to split the dialog area in two - Composite top = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - layout.numColumns = 2; - top.setLayout(layout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - top.setFont(parent.getFont()); - - // add the image to the left of the composite - Label label = new Label(top, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData(new GridData( - GridData.HORIZONTAL_ALIGN_CENTER | - GridData.VERTICAL_ALIGN_CENTER)); - - // add a composite to the right to contain the custom components - Composite right = new Composite(top, SWT.NONE); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - right.setLayout(layout); - right.setLayoutData(new GridData(GridData.FILL_BOTH)); - right.setFont(parent.getFont()); - createMainDialogArea(right); - } else { - createMainDialogArea(composite); - } - - errorMessageLabel = new Label(composite, SWT.NONE); - errorMessageLabel.setLayoutData(new GridData( - GridData.GRAB_HORIZONTAL | - GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageLabel.setFont(parent.getFont()); - errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); - - return composite; - } - - /** - * Creates the dialog's top composite - * - * @param parent the parent composite - */ - abstract protected void createMainDialogArea(Composite parent); - - /** - * Create this dialog's drop-down list component. - * - * @param parent the parent composite - * @return the drop-down list component - */ - abstract protected Composite createDropDownDialogArea(Composite parent); - - /** - * Toggles the unfolding of the details area. This is triggered by - * the user pressing the details button. - */ - private void toggleDetailsArea() { - Point windowSize = getShell().getSize(); - Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - if (detailsCreated) { - detailsComposite.dispose(); - detailsCreated = false; - detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); - } else { - detailsComposite = createDropDownDialogArea((Composite)getContents()); - detailsCreated = true; - detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); - } - - Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); - } - - final protected void setErrorMessage(String error) { - if(errorMessageLabel != null) { - if(error == null || error.length() == 0) { - errorMessageLabel.setText(""); //$NON-NLS-1$ - } else { - errorMessageLabel.setText(error); - } - errorMessageLabel.update(); - } - } - - final protected void setPageComplete(boolean complete) { - if(okButton != null ) { - okButton.setEnabled(complete); - } - } - - abstract protected void updateEnablements(); - - protected boolean includeCancelButton() { - return true; - } - /** - * 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; - } - - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java deleted file mode 100644 index c978b7012..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * Display a message with a details that can contain a list of projects - */ -public class DetailsDialogWithProjects extends DetailsDialog { - - private String message; - private String detailsTitle; - private IProject[] projects; - - private Button actionButton; - private org.eclipse.swt.widgets.List detailsList; - - private boolean includeCancelButton; - - /** - * Constructor for DetailsDialogWithProjects. - * @param parentShell - * @param dialogTitle - */ - public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton, String imageKey) { - super(parentShell, dialogTitle); - setImageKey(imageKey); - this.message = dialogMessage; - this.detailsTitle = detailsTitle; - this.projects = projects; - this.includeCancelButton = includeCancelButton; - } - - /** - * @see DetailsDialog#createMainDialogArea(Composite) - */ - protected void createMainDialogArea(Composite composite) { - Label label = new Label(composite, SWT.WRAP); - label.setText(message); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(composite.getFont()); - updateEnablements(); - } - - /** - * @see DetailsDialog#createDropDownDialogArea(Composite) - */ - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - if (detailsTitle != null) { - detailsList.add(detailsTitle); - } - - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - detailsList.add(projects[i].getName()); //$NON-NLS-1$ - } - return composite; - } - - /** - * @see DetailsDialog#updateEnablements() - */ - protected void updateEnablements() { - setPageComplete(true); - } - - /** - * @see DetailsDialog#includeCancelButton() - */ - protected boolean includeCancelButton() { - return includeCancelButton; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java deleted file mode 100644 index 34df73f27..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class ExportProjectSetMainPage extends TeamWizardPage { - Text fileText; - String file = ""; //$NON-NLS-1$ - Button browseButton; - List selectedProjects = new ArrayList(); - - CheckboxTableViewer tableViewer; - Table table; - - class ProjectContentProvider extends WorkbenchContentProvider { - public Object[] getElements(Object element) { - if (element instanceof IProject[]) return (IProject[]) element; - return null; - } - }; - - public ExportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.EXPORT_PROJECT_SET_PAGE); - - createLabel(composite, Policy.bind("ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2")); //$NON-NLS-1$ - - table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - tableViewer = new CheckboxTableViewer(table); - table.setLayout(new TableLayout()); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 300; - table.setLayoutData(data); - tableViewer.setContentProvider(new ProjectContentProvider()); - tableViewer.setLabelProvider(new WorkbenchLabelProvider()); - tableViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - IProject project = (IProject)event.getElement(); - if (event.getChecked()) { - selectedProjects.add(project); - } else { - selectedProjects.remove(project); - } - updateEnablement(); - } - }); - createLabel(composite, Policy.bind("ExportProjectSetMainPage.Project_Set_File_Name__3")); //$NON-NLS-1$ - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ExportProjectSetMainPage.&File_name__1")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ExportProjectSetMainPage.Browse_4")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell(), SWT.SAVE); - d.setFilterExtensions(new String[] {"*.psf"}); //$NON-NLS-1$ - d.setFilterNames(new String[] {Policy.bind("ExportProjectSetMainPage.Project_Set_Files_3")}); //$NON-NLS-1$ - d.setFileName(Policy.bind("ExportProjectSetMainPage.default")); //$NON-NLS-1$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - initializeProjects(); - setControl(composite); - updateEnablement(); - } - - private void initializeProjects() { - List projectList = new ArrayList(); - IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < workspaceProjects.length; i++) { - if (RepositoryProvider.getProvider(workspaceProjects[i]) != null) { - projectList.add(workspaceProjects[i]); - } - } - tableViewer.setInput((IProject[]) projectList.toArray(new IProject[projectList.size()])); - // Check any necessary projects - if (selectedProjects != null) { - tableViewer.setCheckedElements((IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()])); - } - } - private void updateEnablement() { - boolean complete; - if (selectedProjects.size() == 0) { - setMessage(null); - complete = false; - } else if (file.length() == 0) { - setMessage(null); - complete = false; - } else { - File f = new File(file); - if (f.isDirectory()) { - setMessage(Policy.bind("ExportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - - public String getFileName() { - return file; - } - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - - public IProject[] getSelectedProjects() { - return (IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]); - } - public void setSelectedProjects(IProject[] selectedProjects) { - this.selectedProjects.addAll(Arrays.asList(selectedProjects)); - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java deleted file mode 100644 index 1483703ad..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.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/IPromptCondition.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java deleted file mode 100644 index 19a4a12e8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import org.eclipse.core.resources.IResource; - -/** - * Input to a confirm prompt - * - * @see PromptingDialog - */ -public interface IPromptCondition { - /** - * Answers true 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/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java deleted file mode 100644 index 753ae44b5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java +++ /dev/null @@ -1,3 +0,0 @@ -package org.eclipse.team.internal.ui; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ 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.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) { noDefaultAndApplyButton(); 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(); 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; } private void fillTable() { IIgnoreInfo[] ignore = Team.getAllIgnores(); 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/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java deleted file mode 100644 index 65df4f04a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.io.File; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.help.WorkbenchHelp; - -public class ImportProjectSetMainPage extends TeamWizardPage { - Text fileText; - String file = ""; //$NON-NLS-1$ - Button browseButton; - Button createWorkingSetButton; - Text workingSetNameField; - - private boolean createWorkingSet = false; - private String workingSetName = ""; //$NON-NLS-1$ - - // constants - private static final int SIZING_TEXT_FIELD_WIDTH = 80; - - public ImportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.IMPORT_PROJECT_SET_PAGE); - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ImportProjectSetMainPage.Project_Set_File_Name__2")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ImportProjectSetMainPage.Browse_3")); //$NON-NLS-1$ - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell()); - d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterNames(new String[] {Policy.bind("ImportProjectSetMainPage.Project_Set_Files_2"), Policy.bind("ImportProjectSetMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - createWorkinSetCreationArea(inner, 3); - setControl(composite); - updateEnablement(); - } - - /** - * Method createWorkinSetCreationArea. - * @param inner - */ - private void createWorkinSetCreationArea(Composite composite, int numColumns) { - - createWorkingSetButton = new Button(composite, SWT.CHECK | SWT.RIGHT); - createWorkingSetButton.setText(Policy.bind("ImportProjectSetMainPage.createWorkingSetLabel")); //$NON-NLS-1$ - createWorkingSetButton.setSelection(createWorkingSet); - GridData data = new GridData(); - data.horizontalSpan = numColumns; - createWorkingSetButton.setLayoutData(data); - - final Label label = new Label(composite, SWT.NONE); - label.setText(Policy.bind("ImportProjectSetMainPage.workingSetLabel")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalSpan = 1; - label.setLayoutData(data); - label.setEnabled(createWorkingSet); - - workingSetNameField = new Text(composite, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - data.horizontalSpan = 1; - workingSetNameField.setLayoutData(data); - workingSetNameField.setEnabled(createWorkingSet); - - createWorkingSetButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - createWorkingSet = createWorkingSetButton.getSelection(); - label.setEnabled(createWorkingSet); - workingSetNameField.setEnabled(createWorkingSet); - updateEnablement(); - } - }); - workingSetNameField.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateEnablement(); - } - }); - } - - private boolean validateWorkingSetName() { - if (createWorkingSet) { - workingSetName = workingSetNameField.getText(); - if (workingSetName.length() == 0) { - setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameEmpty"), ERROR); //$NON-NLS-1$ - return false; - } else { - // todo: verify name doesn't already exist - IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName); - if (existingSet != null) { - setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameExists"), WARNING); //$NON-NLS-1$ - return true; - } - } - } - setMessage(null); - return true; - } - - private void updateEnablement() { - boolean complete; - setMessage(null); - if (file.length() == 0) { - complete = false; - } else { - // See if the file exists - File f = new File(file); - if (!f.exists()) { - setMessage(Policy.bind("ImportProjectSetMainPage.The_specified_file_does_not_exist_4"), ERROR); //$NON-NLS-1$ - complete = false; - } else if (f.isDirectory()) { - setMessage(Policy.bind("ImportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = validateWorkingSetName(); - } - } - setPageComplete(complete); - } - - public String getFileName() { - return file; - } - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - /** - * @return String - */ - public String getWorkingSetName() { - if (!createWorkingSet) return null; - return workingSetName; - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java deleted file mode 100644 index a87b42af7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class NatureToPropertyAction extends TeamAction { - - /** - * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return true; - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(IAction) - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - final Shell shell = getShell(); - IProject[] projects = getSelectedProjects(); - List statii = new ArrayList(); - for (int i = 0; i < projects.length; i++) { - IFile file = projects[i].getFile(".project"); //$NON-NLS-1$ - IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, shell); - if (status.getCode() == IStatus.OK) { - RepositoryProvider.convertNatureToProperty(projects[i], true); - } else { - statii.add(status); - RepositoryProvider.convertNatureToProperty(projects[i], false); - } - } - if (!statii.isEmpty()) { - final IStatus[] statusArray = (IStatus[])statii.toArray(new IStatus[statii.size()]); - shell.getDisplay().syncExec(new Runnable() { - public void run() { - if (statusArray.length == 1) { - ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), statusArray[0]); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), new MultiStatus(TeamUIPlugin.ID, 0, statusArray, Policy.bind("NatureToPropertyAction.multiMessage"), null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - }); - for (int i = 0; i < statusArray.length; i++) { - TeamUIPlugin.log(statusArray[i]); - } - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("NatureToPropertyAction.label"), PROGRESS_DIALOG); //$NON-NLS-1$ - } -} - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java deleted file mode 100644 index 58af97721..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -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.SubProgressMonitor; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; - -/** - * 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 }); - } - - /** - * 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); - } -} \ No newline at end of file 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 308680152..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -public class ProjectSetContentHandler extends DefaultHandler { - boolean inPsf = false; - boolean inProvider = false; - boolean inProject = false; - Map map; - String id; - List references; - boolean isVersionOne = false; - - /** - * @see ContentHandler#startElement(String, String, String, Attributes) - */ - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - if (localName.equals("psf")) { //$NON-NLS-1$ - map = new HashMap(); - inPsf = true; - String version = atts.getValue("version"); //$NON-NLS-1$ - isVersionOne = version.equals("1.0"); //$NON-NLS-1$ - return; - } - if (isVersionOne) return; - if (localName.equals("provider")) { //$NON-NLS-1$ - if (!inPsf) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4")); //$NON-NLS-1$ - inProvider = true; - id = atts.getValue("id"); //$NON-NLS-1$ - references = new ArrayList(); - return; - } - if (localName.equals("project")) { //$NON-NLS-1$ - if (!inProvider) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7")); //$NON-NLS-1$ - inProject = true; - String reference = atts.getValue("reference"); //$NON-NLS-1$ - references.add(reference); - return; - } - } - - /** - * @see ContentHandler#endElement(String, String, String) - */ - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - if (localName.equals("psf")) { //$NON-NLS-1$ - inPsf = false; - return; - } - if (isVersionOne) return; - if (localName.equals("provider")) { //$NON-NLS-1$ - map.put(id, references); - references = null; - inProvider = false; - return; - } - if (localName.equals("project")) { //$NON-NLS-1$ - inProject = false; - return; - } - } - - public Map getReferences() { - return map; - } - - public boolean isVersionOne() { - return isVersionOne; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java deleted file mode 100644 index a24d180ec..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -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.ui.TeamImages; -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"), TeamImages.getImageDescriptor(UIConstants.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(""); //$NON-NLS-1$ - writer.newLine(); - writer.write(""); //$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"); //$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"); //$NON-NLS-1$ - writer.newLine(); - } - } - writer.write("\t"); //$NON-NLS-1$ - writer.newLine(); - } - writer.write(""); //$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/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java deleted file mode 100644 index ceb4fbd00..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.xerces.parsers.SAXParser; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.IProjectSetSerializer; -import org.eclipse.team.core.Team; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.ui.TeamImages; -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"), TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_IMPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$ - mainPage.setFileName(lastFile); - addPage(mainPage); - } - public boolean performFinish() { - - // check if the desired working set exists - final String workingSetName = mainPage.getWorkingSetName(); - if (workingSetName != null) { - IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName); - if (existingSet != null && - !MessageDialog.openConfirm(getShell(), Policy.bind("ProjectSetImportWizard.workingSetExistsTitle"), Policy.bind("ProjectSetImportWizard.workingSetExistsMessage", workingSetName))) //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - - final boolean[] result = new boolean[] {false}; - try { - getContainer().run(true, true, new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InvocationTargetException { - InputStreamReader reader = null; - try { - String filename = mainPage.getFileName(); - lastFile = filename; - reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$ - - SAXParser parser = new SAXParser(); - ProjectSetContentHandler handler = new ProjectSetContentHandler(); - parser.setContentHandler(handler); - InputSource source = new InputSource(reader); - parser.parse(source); - - Map map = handler.getReferences(); - List newProjects = new ArrayList(); - if (map.size() == 0 && handler.isVersionOne) { - IProjectSetSerializer serializer = Team.getProjectSetSerializer("versionOneSerializer"); //$NON-NLS-1$ - if (serializer != null) { - IProject[] projects = serializer.addToWorkspace(new String[0], filename, getShell(), monitor); - if (projects != null) - newProjects.addAll(Arrays.asList(projects)); - } - } else { - Iterator it = map.keySet().iterator(); - while (it.hasNext()) { - String id = (String)it.next(); - List references = (List)map.get(id); - IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); - if (serializer != null) { - IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), filename, getShell(), monitor); - if (projects != null) - newProjects.addAll(Arrays.asList(projects)); - } - } - } - if (workingSetName != null) - createWorkingSet(workingSetName, (IProject[]) newProjects.toArray(new IProject[newProjects.size()])); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (SAXException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException)target; - } - if (target instanceof Error) { - throw (Error)target; - } - } - return result[0]; - } - - private void createWorkingSet(String workingSetName, IProject[] projects) { - IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager(); - IWorkingSet oldSet = manager.getWorkingSet(workingSetName); - if (oldSet == null) { - IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects); - manager.addWorkingSet(newSet); - }else { - oldSet.setElements(projects); - } - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java deleted file mode 100644 index 87d1630f6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * A confirmation dialog helper that will either show a 'yes/no/yes to all/cancel' - * dialog to confirm an action performed on several resources or if only one - * resource is specified 'ok/cancel' will be shown. - */ -public class PromptingDialog { - private IResource[] resources; - private Shell shell; - private String[] buttons; - private boolean confirmOverwrite = true; - private IPromptCondition condition; - private String title; - private boolean hasMultipleResources; - - /** - * Prompt for the given resources using the specific condition. The prompt dialog will - * have the title specified. - */ - public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) { - this.condition = condition; - this.resources = resources; - this.title = title; - this.shell = shell; - this.hasMultipleResources = resources.length > 1; - if (hasMultipleResources) { - 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 - 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/TeamPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java deleted file mode 100644 index 3420f79d5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -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.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(UIConstants.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(UIConstants.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(UIConstants.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/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java deleted file mode 100644 index 03afd868a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -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.preference.IPreferenceStore; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * TeamUIPlugin is the plugin for generic, non-provider specific, - * team UI functionality in the workbench. - */ -public class TeamUIPlugin extends AbstractUIPlugin { - - private static TeamUIPlugin instance; - public static final String ID = "org.eclipse.team.ui"; //$NON-NLS-1$ - - private static List propertyChangeListeners = new ArrayList(5); - - /** - * Creates a new TeamUIPlugin. - * - * @param descriptor the plugin descriptor - */ - public TeamUIPlugin(IPluginDescriptor descriptor) { - super(descriptor); - 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() { - return instance; - } - /** - * Initializes the preferences for this plugin if necessary. - */ - protected void initializePreferences() { - IPreferenceStore store = getPreferenceStore(); - store.setDefault(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING, 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); - } - - 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); - } - - /** - * @see Plugin#startup() - */ - public void startup() throws CoreException { - Policy.localize("org.eclipse.team.internal.ui.messages"); //$NON-NLS-1$ - initializePreferences(); - } - - /* - * 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); - } - } - - /** - * 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); - } - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java deleted file mode 100644 index 7eb5198f5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui; - -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/internal/ui/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java deleted file mode 100644 index 6ca4aaae0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java +++ /dev/null @@ -1 +0,0 @@ -package org.eclipse.team.internal.ui; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ComboBoxCellEditor; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.TableEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.team.core.IFileTypeInfo; import org.eclipse.team.core.Team; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.help.WorkbenchHelp; /** * This preference page displays all patterns which determine whether a resource * is to be treated as a text file or not. The page allows the user to add or * remove entries from this table, and change their values from Text to Binary. */ public class TextPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { // Some string constants for display purposes private static final String TEXT = Policy.bind("TextPreferencePage.text"); //$NON-NLS-1$ private static final String BINARY = Policy.bind("TextPreferencePage.binary"); //$NON-NLS-1$ // The name of the parameter in the file registry private static final String TYPE = "type"; //$NON-NLS-1$ // The input for the table viewer private List input; // Widgets private TableViewer viewer; private Button removeButton; private Button changeButton; /** * TableEntry is a pair of strings representing an entry in the table */ class TableEntry { String ext; String value; public TableEntry(String ext, String value) { this.ext = ext; this.value = value; } public String getExtension() { return ext; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } /** * TableLabelProvider provides labels for TableEntrys. */ class TableLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object element, int columnIndex) { TableEntry entry = (TableEntry)element; switch (columnIndex) { case 0: return entry.getExtension(); case 1: return entry.getValue(); default: return null; } } public Image getColumnImage(Object element, int columnIndex) { return null; } }; /* * Method declared on IWorkbenchPreferencePage */ public void init(IWorkbench workbench) { } /* * @see PreferencePage#createControl */ protected Control createContents(Composite ancestor) { noDefaultAndApplyButton(); 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); 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(); Dialog.applyDialogFont(parent); 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 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() { this.input = new ArrayList(); IFileTypeInfo[] infos = Team.getAllTypes(); 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); } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java deleted file mode 100644 index f525538a8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -/** - * Central location for constants used by the Team user interface. - */ -public interface UIConstants { - // plugin id - public final String PLUGIN_ID = "org.eclipse.team.ui"; //$NON-NLS-1$ - - // extension points - public final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$ - public final String PT_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$ - public final String PT_DECORATORS = "decorators"; //$NON-NLS-1$ - - // image paths - public final String ICON_PATH = "icons/full/"; //$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$ - - // preferences - public final String PREF_ALWAYS_IN_INCOMING_OUTGOING = "pref_always_in_incoming_outgoing"; //$NON-NLS-1$ - - //objects - public final String IMG_SITE_ELEMENT = "clcl16/site_element.gif"; //$NON-NLS-1$ - -} 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 0e0e4b9e7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.eclipse.team.internal.ui.actions; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.ConfigureProjectWizard; -import org.eclipse.team.internal.ui.Policy; - -/** - * Action for configuring a project. Configuring involves associating - * the project with a Team provider and performing any provider-specific - * configuration that is necessary. - */ -public class ConfigureProjectAction extends TeamAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IProject project = getSelectedProjects()[0]; - ConfigureProjectWizard wizard = new ConfigureProjectWizard(); - wizard.init(null, project); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.open(); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("ConfigureProjectAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (!selectedProjects[0].isAccessible()) return false; - if (RepositoryProvider.getProvider(selectedProjects[0]) == null) return true; - return false; - } -} \ No newline at end of file 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 89ac22e4b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.eclipse.team.internal.ui.actions; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -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; - } -} \ 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 bf99c9e1e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java +++ /dev/null @@ -1,388 +0,0 @@ -package org.eclipse.team.internal.ui.actions; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -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.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.TeamPlugin; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * The abstract superclass of all Team actions. This class contains some convenience - * methods for getting selected objects and mapping selected objects to their - * providers. - * - * Team providers may subclass this class when creating their actions. - * Team providers may also instantiate or subclass any of the - * subclasses of TeamAction provided in this package. - */ -public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate { - // The current selection - protected IStructuredSelection selection; - - // The shell, required for the progress dialog - protected Shell shell; - - // Constants for determining the type of progress. Subclasses may - // pass one of these values to the run method. - public final static int PROGRESS_DIALOG = 1; - public final static int PROGRESS_BUSYCURSOR = 2; - - private IWorkbenchPart targetPart; - - /** - * Returns the selected projects. - * - * @return the selected projects - */ - protected IProject[] getSelectedProjects() { - ArrayList projects = null; - if (!selection.isEmpty()) { - projects = new ArrayList(); - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - if (next instanceof IProject) { - projects.add(next); - continue; - } - if (next instanceof IAdaptable) { - IAdaptable a = (IAdaptable) next; - Object adapter = a.getAdapter(IResource.class); - if (adapter instanceof IProject) { - projects.add(adapter); - continue; - } - } - } - } - if (projects != null && !projects.isEmpty()) { - IProject[] result = new IProject[projects.size()]; - projects.toArray(result); - return result; - } - return new IProject[0]; - } - /** - * Returns the selected resources. - * - * @return the selected resources - */ - protected IResource[] getSelectedResources() { - ArrayList resources = null; - if (!selection.isEmpty()) { - resources = new ArrayList(); - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - if (next instanceof IResource) { - resources.add(next); - continue; - } - if (next instanceof IAdaptable) { - IAdaptable a = (IAdaptable) next; - Object adapter = a.getAdapter(IResource.class); - if (adapter instanceof IResource) { - resources.add(adapter); - continue; - } - } - } - } - if (resources != null && !resources.isEmpty()) { - IResource[] result = new IResource[resources.size()]; - resources.toArray(result); - return result; - } - return new IResource[0]; - } - - /** - * Convenience method for getting the current shell. - * - * @return the shell - */ - protected Shell getShell() { - if (shell != null) { - return shell; - } else { - return TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(); - } - } - /** - * Convenience method for running an operation with progress and - * error feedback. - * - * @param runnable the runnable which executes the operation - * @param problemMessage the message to display in the case of errors - * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG - */ - final protected void run(final IRunnableWithProgress runnable, final String problemMessage, int progressKind) { - final Exception[] exceptions = new Exception[] {null}; - switch (progressKind) { - case PROGRESS_BUSYCURSOR : - BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { - public void run() { - try { - runnable.run(new NullProgressMonitor()); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } catch (InterruptedException e) { - exceptions[0] = null; - } - } - }); - break; - default : - case PROGRESS_DIALOG : - try { - new ProgressMonitorDialog(getShell()).run(true, true, runnable); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } catch (InterruptedException e) { - exceptions[0] = null; - } - break; - } - if (exceptions[0] != null) { - handle(exceptions[0], null, problemMessage); - } - } - - /* - * Method declared on IActionDelegate. - */ - public void selectionChanged(IAction action, ISelection selection) { - if (selection instanceof IStructuredSelection) { - this.selection = (IStructuredSelection) selection; - if (action != null) { - setActionEnablement(action); - } - } - } - - /** - * Method invoked from selectionChanged(IAction, ISelection) - * to set the enablement status of the action. The instance variable - * selection will contain the latest selection so the methods - * getSelectedResources() and getSelectedProjects() - * 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.getStatus()); - } - } - } - - /* - * Method declared on IObjectActionDelegate. - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - this.shell = targetPart.getSite().getShell(); - this.targetPart = targetPart; - } - /** - * Shows the given errors to the user. - * - * @param status the status containing the error - * @param title the title of the error dialog - * @param message the message for the error dialog - * @param shell the shell to open the error dialog in - */ - protected void handle(Exception exception, String title, String message) { - IStatus status = null; - boolean log = false; - boolean dialog = false; - if (exception instanceof TeamException) { - status = ((TeamException)exception).getStatus(); - log = false; - dialog = true; - } else if (exception instanceof InvocationTargetException) { - Throwable 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) { - ErrorDialog.openError(getShell(), title, message, toShow); - } - if (log) { - TeamUIPlugin.log(toShow); - } - } - } - /** - * Concrete action enablement code. - * Subclasses must implement. - * - * @return whether the action is enabled - * @throws TeamException if an error occurs during enablement detection - */ - abstract protected boolean isEnabled() throws TeamException; - - /** - * Convenience method that maps the selected resources to their providers. - * The returned Hashtable has keys which are ITeamProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their selected resources - */ - protected Hashtable getProviderMapping() { - return getProviderMapping(getSelectedResources()); - } - /** - * Convenience method that maps the given resources to their providers. - * The returned Hashtable has keys which are ITeamProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getProviderMapping(IResource[] resources) { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } - - /** - * Convenience method that maps the selected resources to their target providers. - * The returned Hashtable has keys which are TargetProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their selected resources - */ - protected Hashtable getTargetProviderMapping() throws TeamException { - return getTargetProviderMapping(getSelectedResources()); - } - /** - * Convenience method that maps the given resources to their target providers. - * The returned Hashtable has keys which are TargetProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - TargetProvider provider = TargetManager.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } - - /** - * @return IWorkbenchPart - */ - protected IWorkbenchPart getTargetPart() { - return targetPart; - } - - /** - * Return the path that was active when the menu item was selected. - * @return IWorkbenchPage - */ - protected IWorkbenchPage getTargetPage() { - if (getTargetPart() == null) return TeamUIPlugin.getActivePage(); - return getTargetPart().getSite().getPage(); - } - - /** - * Show the view with the given ID in the perspective from which the action - * was executed. Returns null if the view is not registered. - * - * @param viewId - * @return IViewPart - */ - protected IViewPart showView(String viewId) { - try { - return getTargetPage().showView(viewId); - } catch (PartInitException pe) { - return null; - } - } -} \ 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 a1e2333cb..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties +++ /dev/null @@ -1,278 +0,0 @@ -############################################### -# Message catalog for org.eclipse.team.ui -############################################### - -AuthenticatedTargetSitePropertiesPage.Server=Server hostname: -AuthenticatedTargetSitePropertiesPage.User=&User: -AuthenticatedTargetSitePropertiesPage.Password=&Password: -AuthenticatedTargetSitePropertiesPage.Error=Error Occurred - -ProjectTargetMappingPropertiesPage.Error=A Bad Thing (tm) happened. -ProjectTargetMappingPropertiesPage.URL=Target site URL: -ProjectTargetMappingPropertiesPage.FolderName=Deployment path: -ProjectTargetMappingPropertiesPage.ChangeBtn=&Change these settings... - -CatchupReleaseViewer.open=&Open in Compare Editor -CatchupReleaseViewer.expand=&Expand All -CatchupReleaseViewer.ignoreWhiteSpace=&Ignore White Space -CatchupReleaseViewer.refreshAction=&Refresh With Remote -CatchupReleaseViewer.showIncomingAction=Show Incoming -CatchupReleaseViewer.showInNavigator=&Show in Navigator -CatchupReleaseViewer.showOnlyConflictsAction=Show Only Conflicts -CatchupReleaseViewer.showOutgoingAction=Show Outgoing -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 - -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 occured - -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 - -TeamAction.internal=Internal error occured. -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 - -ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2=&Select the projects to include in the Team Project Set: -ExportProjectSetMainPage.Project_Set_File_Name__3=Select the export destination: -ExportProjectSetMainPage.Browse_4=B&rowse... -ExportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder - -ImportProjectSetMainPage.Project_Set_File_Name__2=F&ile name: -ImportProjectSetMainPage.Browse_3=B&rowse... -ImportProjectSetMainPage.The_specified_file_does_not_exist_4=The specified file does not exist -ImportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder -ImportProjectSetMainPage.workingSetNameEmpty=The working set name must not be empty -ImportProjectSetMainPage.workingSetNameExists=The specified working set already exists -ImportProjectSetMainPage.createWorkingSetLabel=&Create a working set containing the imported projects -ImportProjectSetMainPage.workingSetLabel=&Working Set Name: - -ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4=Element provider must be contained in element psf -ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7=Element project must be contained in element provider - -ProjectSetExportWizard.Project_Set_1=Team Project Set -ProjectSetExportWizard.Export_a_Project_Set_3=Export a Team Project Set -ProjectSetExportWizard.Question_4=Question -ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5=Target directory does not exist. Would you like to create it? -ProjectSetExportWizard.Export_Problems_6=Export Problems -ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7=An error occurred creating the target directory -ProjectSetExportWizard.Question_8=Question -ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9=Target already exists. Would you like to overwrite it? -ProjectSetImportWizard.Project_Set_1=Team Project Set -ProjectSetImportWizard.Import_a_Project_Set_3=Import a Team Project Set -ProjectSetImportWizard.workingSetExistsTitle=Working Set Exists -ProjectSetImportWizard.workingSetExistsMessage=Working set ''{0}'' already exists. Overwrite? - -ExportProjectSetMainPage.Project_Set_Files_3=Team Project Set Files (*.psf) -ExportProjectSetMainPage.default=projectSet.psf -ImportProjectSetMainPage.allFiles=All Files (*.*) -ImportProjectSetMainPage.Project_Set_Files_2=Team Project Set Files (*.psf) -ExportProjectSetMainPage.&File_name__1=&File name: -TeamPreferencePage.General_settings_for_Team_support_1=General settings for Team support -TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2=&Use Incoming/Outgoing mode when synchronizing - -TargetSiteExportWizard.Target_Site=Target Site -TargetSiteExportWizard.Export_a_Target_Site=Export a target site -TargetSiteExportWizard.Creation_Question=Should I? -TargetSiteExportWizard.Create_dir=Would you like to create the directory, since it does not currently exist? -TargetSiteExportWizard.Export_Problems=Bad things happened! -TargetSiteExportWizard.Directory_creation_error=I was unable to create a new directory. Make sure you have write permissions in the appropriate area of the filesystem. -TargetSiteExportWizard.Overwrite_Question=Do you really want to? -TargetSiteExportWizard.Overwrite_file=Would you like to overwrite the file you have selected? - -ExportTargetSiteMainPage.Select_Sites=Select the sites to export -ExportTargetSiteMainPage.folder_specified=You cannot export to a directory! -ExportTargetSiteMainPage.Target_Site_Filename=Target site Filename -ExportTargetSiteMainPage.File_name=File name -ExportTargetSiteMainPage.Browse=Browse -ExportTargetSiteMainPage.Target_Site_Files=Target site files -ExportTargetSiteMainPage.default=targetSite.tsf - -ImportTargetSiteMainPage.nonexistent_file=No such file exists on your filesystem! -ImportTargetSiteMainPage.folder_specified=That is a directory, not a file! -ImportTargetSiteMainPage.File_name=File name -ImportTargetSiteMainPage.Browse=Browse -ImportTargetSiteMainPage.Target_Site_Files=Target site files - -NatureToPropertyAction.label=Convert Nature -NatureToPropertyAction.message=Could not remove the nature from one or more of the selected projects. -NatureToPropertyAction.multiMessage=Could not write .project file - -TargetSiteImportWizard.Target_Site=Target Site -TargetSiteImportWizard.Import_Target_Site=Import a Target site - -############################################### -# Target Management Messages -############################################### - -TargetSiteCreationWizard.windowTitleProject=Target a Site -TargetSiteCreationWizard.windowTitleNoProject=New Site -TargetSiteCreationWizard.label=Create a site connection -TargetSiteCreationWizard.description=Select the type of site you want to target. - -TargetSiteCreationWizard.mappingPageTitle=Specify the location on the site -TargetSiteCreationWizard.siteSelectionPage=Select or create a site - -SiteSelectionPage.description=Select an existing site or create a new site where you want to upload your resources to. -SiteSelectionPage.label=Select an existing site or create a new one: -SiteSelectionPage.useExisting=&Use Existing Site -SiteSelectionPage.createNew=&Create a new Site -SiteSelectionPage.disconnectTarget=&Disconnect from Site - -GetAsProject.thisResourceExists=The resource ''{0}'' already exists in the workspace. Overwrite? -GetAsProject.thisExternalFileExists=The folder ''{0}'' exists in the local file system. Overwrite? -GetAsProject.confirmOverwrite=Confirm Overwrite -GetAsProject.taskName1=Downloading ''{0}'' -GetAsProject.taskNameN=Downloading {0} folders -GetAsProject.errorCreatingProject=Error creating project: {0} -GetAsProject.errorGettingResources=Error getting resources - -GetAs.checkoutFailed=Problems encountered receiving the remote folder -GetAs.enterProjectTitle=Downloading ''{0}'' As... -GetAs.taskname=Downloading ''{0}'' as ''{1}'' - -Error=Error - -CreateNewFolderAction.errorCreatingFolder=Error creating the remote folder. -CreateNewFolderAction.title=New Remote Folder -CreateNewFolderAction.message=Enter the name for the new remote folder: -CreateNewFolderAction.newFolderName=New Folder - -GetAction.title=Download -GetAction.working=Downloading from ''{0}''... - -PutAction.title=Upload -PutAction.working=Uploading to ''{0}''... - -SiteExplorerView.addSiteAction=Target &Site -SiteExplorerView.addSiteActionTooltip=Add a Site -SiteExplorerView.newFolderAction=Fo&lder... -SiteExplorerView.newMenu=&New -SiteExplorerView.Name_1=Name -SiteExplorerView.Size_2=Size -SiteExplorerView.Modified_3=Modified -SiteExplorerView.URL_4=URL -SiteExplorerView.mappedProjects={0} is mapped to {1} -SiteExplorerView.projectsAlreadyMapped=The selected sites are being used by projects in your workspace. You must disconnect the projects from the Sites before discarding them. -SiteExplorerView.unmapProjectsAndDisconnect=Disconnect projects from these sites then discard the sites -SiteExplorerView.unmapDialogTitle=Warning - -CreateNewFolderAction.creatingFolder=Creating Folder -CreateNewFolderAction.suggestedNameProgress=Retrieving existing folder names... -CreateNewFolderAction.suggestedNameConcat={0}_{1} - -SiteExplorerView.promptForDeletingSites=Are you sure you want to discard {0} site(s)? -SiteExplorerView.promptForDeletingSitesTitle=Confirm Discarding Sites - -SiteExplorerViewLabelProvider.fileSize={0} KB - -MappingSelectionPage.description=Specify the location on the site where you want to target your resources. -MappingSelectionPage.label=Select the site or a folder: -MappingSelectionPage.newFolderLabel=&Create Folder... -MappingSelectionPage.mappingTitle=Select the location on the site - -ConfigureTargetWizardQuestion_2=Question -ConfigureTargetWizardError_6=Error -ConfigureTargetWizardError_mapping_the_project_with_this_site_7=Error mapping the project with this site -ConfigureTargetWizardURL_doesn__t_exist_on_the_server_8=URL doesn\'t exist on the server -ConfigureTargetWizardValidating_connection_to_Site..._9=Validating connection to Site... -ConfigureTargetWizardConnection_Error_10=Connection Error -ConfigureTargetWizard.alreadyMapped=''{0}'' is already targetted to ''{1}''. Are you sure you want to change this? -ConfigureTargetWizard.errorOccurred=An error occured connecting to ''{0}''.\n\nCode: {1}\nMessage: {2}\n\nDo you still want to keep this target? -ConfigureTargetWizard.errorUnmappingProject=An error occured trying to disconnect this project. - -GetAction.Exception_getting_provider_2=Exception getting provider -GetAction.confirmFileOverwrite=You have local changes which you are about to overwrite. Do you wish to continue? -GetAction.confirmFileOverwriteTitle=Confirm Overwrite - -TargetSyncAction.errorEncountered=An error occured performing the action - -GetSyncAction.Getting..._1=Downloading... -PutAction.Exception_getting_provider_2=Exception getting provider -PutSyncAction.Putting..._1=Uploading... - -TargetCatchupReleaseViewer.Get_1=&Download -TargetCatchupReleaseViewer.Put_2=&Upload - -SiteSelectionPage.siteLabelCurrentWithMapping={0} (currently as {1}) -SiteSelectionPage.siteLabelCurrent={0} (current) - -UploadAction.Exception_getting_provider=Exception getting provider -UploadAction.working=Uploading to ''{0}''... -UploadAction.noDirtyTitle=No Dirty Resources Found -UploadAction.noDirtyMessage=There were no dirty resources found to upload. -UploadAction.confirmDeletionTitle=Confirm Deletion -UploadAction.confirmFileDeletionMessage=File ''{0}'' has been deleted locally. Do you want to delete it remotely? -UploadAction.problemMessage=Problems occurred uploading. - - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java deleted file mode 100644 index 3703ba0a8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java +++ /dev/null @@ -1,723 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; - -import org.eclipse.compare.BufferedContent; -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.IEditableContent; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.NavigationAction; -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.structuremergeviewer.DiffContainer; -import org.eclipse.compare.structuremergeviewer.DiffElement; -import org.eclipse.compare.structuremergeviewer.DiffTreeViewer; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.views.navigator.ResourceNavigator; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * This viewer adds a custom filter and some merge actions. - * Note this is a layer breaker and needs to be refactored. Viewers should - * not contain references to workbench actions. Actions should be contributed - * by the view. - */ -public abstract class CatchupReleaseViewer extends DiffTreeViewer { - - class ShowInNavigatorAction extends Action implements ISelectionChangedListener { - IViewSite viewSite; - public ShowInNavigatorAction(IViewSite viewSite, String title) { - super(title, null); - this.viewSite = viewSite; - } - public void run() { - showSelectionInNavigator(viewSite); - } - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); - if (selection.size() == 0) { - setEnabled(false); - return; - } - for (Iterator iter = selection.iterator(); iter.hasNext();) { - ITeamNode node = (ITeamNode)iter.next(); - if(!node.getResource().isAccessible()) { - setEnabled(false); - return; - } - } - setEnabled(true); - } - }; - - /** - * This filter hides all empty categories tree nodes. - */ - class CategoryFilter extends ViewerFilter { - static final int SHOW_INCOMING = 1; - static final int SHOW_OUTGOING = 2; - static final int SHOW_CONFLICTS = 4; - static final int SHOW_PSEUDO_CONFLICTS = 8; - - private int showMask = 0; - - CategoryFilter(int showMask) { - // Mask for all categories to show - this.showMask = showMask; - } - int getMask() { - return showMask; - } - void setMask(int mask) { - this.showMask = mask; - } - public boolean select(Viewer viewer, Object parentElement, Object element) { - // If this element has visible children, always show it. - // This is not great -- O(n^2) filtering - if (hasFilteredChildren(element)) { - return true; - } - if (element instanceof ITeamNode) { - // Filter out pseudo conflicts if requested - int kind = ((ITeamNode)element).getKind(); - if ((showMask & SHOW_PSEUDO_CONFLICTS) == 0 && (kind & IRemoteSyncElement.PSEUDO_CONFLICT) != 0) { - return false; - } - int change = ((ITeamNode)element).getKind() & IRemoteSyncElement.CHANGE_MASK; - int direction = ((ITeamNode)element).getChangeDirection(); - switch (direction) { - case ITeamNode.INCOMING: - return (showMask & SHOW_INCOMING) != 0; - case ITeamNode.OUTGOING: - return (showMask & SHOW_OUTGOING) != 0; - case Differencer.CONFLICTING: - return (showMask & SHOW_CONFLICTS) != 0; - default: - return change != 0; - } - } - // No children are visible, and this folder has no changes, so don't show it. - return false; - } - public boolean isFilterProperty(Object element, String property) { - return property.equals(PROP_KIND); - } - } - - class FilterAction extends Action { - /** - * Must subclass constructor to make it accessible to container class - */ - FilterAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - updateFilters(); - } - } - class SyncSorter extends ViewerSorter { - public int compare(Viewer viewer, Object e1, Object e2) { - boolean oneIsFile = e1 instanceof TeamFile; - boolean twoIsFile = e2 instanceof TeamFile; - if (oneIsFile != twoIsFile) { - return oneIsFile ? 1 : -1; - } - return super.compare(viewer, e1, e2); - } - } - - class RemoveFromTreeAction extends Action { - public RemoveFromTreeAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - ISelection s = getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return; - } - // mark all selected nodes as in sync - for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) { - Object element = it.next(); - setAllChildrenInSync((IDiffElement)element); - } - refresh(); - } - public void update() { - // Update action enablement - setEnabled(!getSelection().isEmpty()); - } - } - class ExpandAllAction extends Action { - public ExpandAllAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - expandSelection(); - } - public void update() { - setEnabled(!getSelection().isEmpty()); - } - } - class OpenAction extends Action { - public OpenAction(String title, ImageDescriptor image) { - super(title, image); - } - public void run() { - openSelection(); - } - public void update() { - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() == 1) { - Object element = ss.getFirstElement(); - setEnabled(element instanceof TeamFile); - return; - } - } - setEnabled(false); - } - } - - // The current sync mode - private int syncMode = SyncView.SYNC_NONE; - - // Actions - private FilterAction showIncoming; - private FilterAction showOutgoing; - private FilterAction showOnlyConflicts; - private Action refresh; - private OpenAction open; - private ExpandAllAction expandAll; - private RemoveFromTreeAction removeFromTree; - private ShowInNavigatorAction showInNavigator; - private Action ignoreWhiteSpace; - private Action toggleGranularity; - - private NavigationAction showPrevious; - private NavigationAction showNext; - - // Property constant for diff mode kind - static final String PROP_KIND = "team.ui.PropKind"; //$NON-NLS-1$ - - private Action copyAllRightToLeft; - - private boolean compareFileContents = false; - - /** - * Creates a new catchup/release viewer. - */ - protected CatchupReleaseViewer(Composite parent, SyncCompareInput model) { - super(parent, model.getCompareConfiguration()); - setSorter(new SyncSorter()); - initializeActions(model); - } - - /** - * Contributes actions to the provided toolbar - */ - void contributeToActionBars(IActionBars actionBars) { - IToolBarManager toolBar = actionBars.getToolBarManager(); - - toolBar.add(new Separator()); - toolBar.add(showOnlyConflicts); - - toolBar.add(new Separator()); - toolBar.add(showNext); - toolBar.add(showPrevious); - - // Drop down menu - IMenuManager menu = actionBars.getMenuManager(); - if (syncMode == SyncView.SYNC_BOTH) { - menu.add(showIncoming); - menu.add(showOutgoing); - } - menu.add(toggleGranularity); - menu.add(ignoreWhiteSpace); - menu.add(refresh); - } - - /** - * Contributes actions to the popup menu. - */ - protected void fillContextMenu(IMenuManager manager) { - open.update(); - manager.add(open); - manager.add(new Separator()); - expandAll.update(); - manager.add(expandAll); - removeFromTree.update(); - manager.add(removeFromTree); - if (showInNavigator != null) { - manager.add(showInNavigator); - } - if (syncMode == SyncView.SYNC_COMPARE) { - manager.add(copyAllRightToLeft); - } - } - - protected void openSelection() { - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - Iterator elements = ((IStructuredSelection)selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - openSelection(next); - } - } - } - - /** - * Method openSelection. - * @param next - */ - private void openSelection(Object next) { - if (next instanceof TeamFile) { - handleOpen(null); - } - } - - /** - * Expands to infinity all items in the selection. - */ - protected void expandSelection() { - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - Iterator elements = ((IStructuredSelection)selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - expandToLevel(next, ALL_LEVELS); - } - } - } - - protected int getSyncMode() { - return syncMode; - } - - /** - * Returns true if the given element has filtered children, and false otherwise. - */ - protected boolean hasFilteredChildren(Object element) { - return getFilteredChildren(element).length > 0; - } - - /** - * Creates the actions for this viewer. - */ - private void initializeActions(final SyncCompareInput diffModel) { - // Mask actions - ImageDescriptor image = TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_ENABLED); - showIncoming = new FilterAction(Policy.bind("CatchupReleaseViewer.showIncomingAction"), image); //$NON-NLS-1$ - showIncoming.setToolTipText(Policy.bind("CatchupReleaseViewer.showIncomingAction")); //$NON-NLS-1$ - showIncoming.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_DISABLED)); - showIncoming.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING)); - - image = TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_ENABLED); - showOutgoing = new FilterAction(Policy.bind("CatchupReleaseViewer.showOutgoingAction"), image); //$NON-NLS-1$ - showOutgoing.setToolTipText(Policy.bind("CatchupReleaseViewer.showOutgoingAction")); //$NON-NLS-1$ - showOutgoing.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_DISABLED)); - showOutgoing.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING)); - - //show only conflicts is not a HideAction because it doesnt flip bits, it sets an exact mask - image = TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_ENABLED); - showOnlyConflicts = new FilterAction(Policy.bind("CatchupReleaseViewer.showOnlyConflictsAction"), image); //$NON-NLS-1$ - showOnlyConflicts.setToolTipText(Policy.bind("CatchupReleaseViewer.showOnlyConflictsAction")); //$NON-NLS-1$ - showOnlyConflicts.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_DISABLED)); - showOnlyConflicts.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING)); - - //refresh action - image = TeamImages.getImageDescriptor(UIConstants.IMG_REFRESH_ENABLED); - refresh = new Action(Policy.bind("CatchupReleaseViewer.refreshAction"), image) { //$NON-NLS-1$ - public void run() { - diffModel.refresh(); - } - }; - refresh.setToolTipText(Policy.bind("CatchupReleaseViewer.refreshAction")); //$NON-NLS-1$ - refresh.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_REFRESH_DISABLED)); - refresh.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_REFRESH)); - - // Open Action - open = new OpenAction(Policy.bind("CatchupReleaseViewer.open"), null); //$NON-NLS-1$ - WorkbenchHelp.setHelp(open, IHelpContextIds.OPEN_ACTION); - - // Expand action - expandAll = new ExpandAllAction(Policy.bind("CatchupReleaseViewer.expand"), null); //$NON-NLS-1$ - WorkbenchHelp.setHelp(expandAll, IHelpContextIds.EXPANDALL_ACTION); - - // Toggle granularity - image = TeamImages.getImageDescriptor(UIConstants.IMG_CONTENTS_ENABLED); - toggleGranularity = new Action(Policy.bind("CatchupReleaseViewer.Compare_File_Contents_1"), image) { //$NON-NLS-1$ - public void run() { - compareFileContents = isChecked(); - diffModel.setSyncGranularity(compareFileContents ? ILocalSyncElement.GRANULARITY_CONTENTS : ILocalSyncElement.GRANULARITY_TIMESTAMP); - updateFilters(); - } - }; - compareFileContents = diffModel.getSyncGranularity() != IRemoteSyncElement.GRANULARITY_TIMESTAMP; - toggleGranularity.setChecked(compareFileContents); - toggleGranularity.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_CONTENTS_DISABLED)); - toggleGranularity.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_CONTENTS)); - - removeFromTree = new RemoveFromTreeAction(Policy.bind("CatchupReleaseViewer.removeFromView"), null); //$NON-NLS-1$ - WorkbenchHelp.setHelp(removeFromTree, IHelpContextIds.REMOVE_ACTION); - - copyAllRightToLeft = new Action(Policy.bind("CatchupReleaseViewer.copyAllRightToLeft"), null) { //$NON-NLS-1$ - public void run() { - ISelection s = getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return; - } - for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) { - final Object element = it.next(); - if(element instanceof DiffElement) { - try { - new ProgressMonitorDialog(getTree().getShell()).run(false, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - try { - monitor.beginTask(Policy.bind("CatchupReleaseViewer.Copying_right_contents_into_workspace_2"), 100); //$NON-NLS-1$ - copyAllRightToLeft((DiffElement)element, Policy.subMonitorFor(monitor, 100)); - } finally { - monitor.done(); - } - } - }, monitor); - } catch(CoreException e) { - throw new InvocationTargetException(e); - } - } - }); - } catch(InvocationTargetException e) { - ErrorDialog.openError(TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("CatchupReleaseViewer.errorCopyAllRightToLeft"), null, null); //$NON-NLS-1$ - } catch(InterruptedException e) { - } - } - } - refresh(); - } - public boolean isEnabled() { - ISelection s = getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return false; - } - return ((IStructuredSelection)s).size() == 1; - } - }; - - // Show in navigator - if (diffModel.getViewSite() != null) { - showInNavigator = new ShowInNavigatorAction(diffModel.getViewSite(), Policy.bind("CatchupReleaseViewer.showInNavigator")); //$NON-NLS-1$ - WorkbenchHelp.setHelp(showInNavigator, IHelpContextIds.NAVIGATOR_SHOW_ACTION); - addSelectionChangedListener(showInNavigator); - } - - // Ignore white space - image = TeamImages.getImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_ENABLED); - ignoreWhiteSpace = new Action(Policy.bind("CatchupReleaseViewer.ignoreWhiteSpace"), image) { //$NON-NLS-1$ - public void run() { - diffModel.setIgnoreWhitespace(isChecked()); - } - }; - ignoreWhiteSpace.setId("team.ignoreWhiteSpace"); //$NON-NLS-1$ - boolean ignore = CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(CompareConfiguration.IGNORE_WHITESPACE); - ignoreWhiteSpace.setChecked(ignore); - ignoreWhiteSpace.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_DISABLED)); - ignoreWhiteSpace.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE)); - - // Show next and previous change - showNext = new NavigationAction(true); - showPrevious = new NavigationAction(false); - showNext.setCompareEditorInput(diffModel); - showPrevious.setCompareEditorInput(diffModel); - - // Add a double-click listener for expanding/contracting - getTree().addListener(SWT.MouseDoubleClick, new Listener() { - public void handleEvent(Event e) { - mouseDoubleClicked(e); - } - }); - - // Add an F5 listener for refresh - getTree().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.F5) { - diffModel.refresh(); - } - } - }); - - // Set an initial filter -- show all changes - showIncoming.setChecked(true); - showOutgoing.setChecked(true); - showOnlyConflicts.setChecked(false); - setFilters(CategoryFilter.SHOW_INCOMING| CategoryFilter.SHOW_CONFLICTS | CategoryFilter.SHOW_OUTGOING); - } - - /** - * Method setAllChildrenInSync. - * @param iDiffElement - */ - private void setAllChildrenInSync(IDiffElement element) { - if(element instanceof DiffContainer) { - DiffContainer container = (DiffContainer)element; - IDiffElement[] children = container.getChildren(); - for (int i = 0; i < children.length; i++) { - setAllChildrenInSync(children[i]); - } - } - ((DiffElement)element).setKind(IRemoteSyncElement.IN_SYNC); - } - - protected void copyAllRightToLeft(IDiffElement element, IProgressMonitor monitor) throws CoreException { - if(element instanceof DiffContainer) { - DiffContainer container = (DiffContainer)element; - IDiffElement[] children = container.getChildren(); - for (int i = 0; i < children.length; i++) { - copyAllRightToLeft(children[i], monitor); - } - } else if(element instanceof TeamFile) { - TeamFile file = (TeamFile)element; - try { - monitor = Policy.monitorFor(monitor); - monitor.beginTask(null, 1); - file.setProgressMonitor(Policy.subMonitorFor(monitor, 1)); - if(file.getKind() != IRemoteSyncElement.IN_SYNC) { - if(file.getRight() == null || file.getLeft() == null) { - file.copy(false /* right to left */); - } - ITypedElement te = file.getLeft(); - ITypedElement rte = file.getRight(); - if(te instanceof IEditableContent) { - IEditableContent editable = (IEditableContent)te; - if(editable.isEditable()) { - if(rte instanceof BufferedContent) { - editable.setContent(((BufferedContent)rte).getContent()); - } - } - } - } - file.setProgressMonitor(null); - } finally { - monitor.done(); - } - } - } - - /* - * Method declared on ContentViewer. - */ - protected void inputChanged(Object input, Object oldInput) { - super.inputChanged(input, oldInput); - // Update the refresh action - if (refresh != null) { - Tree tree = getTree(); - if (tree != null) { - refresh.setEnabled(input != null); - } - } - } - - /** - * Shows the selected resource(s) in the resource navigator. - */ - private void showSelectionInNavigator(IViewSite viewSite) { - ISelection selection = getSelection(); - if (!(selection instanceof IStructuredSelection)) { - return; - } - // Create a selection of IResource objects - Object[] selected = ((IStructuredSelection)selection).toArray(); - IResource[] resources = new IResource[selected.length]; - for (int i = 0; i < selected.length; i++) { - resources[i] = ((ITeamNode)selected[i]).getResource(); - } - ISelection resourceSelection = new StructuredSelection(resources); - - // Show the resource selection in the navigator - try { - IViewPart part = viewSite.getPage().showView(IPageLayout.ID_RES_NAV); - if (part instanceof ResourceNavigator) { - ((ResourceNavigator)part).selectReveal(resourceSelection); - } - } catch (PartInitException e) { - TeamUIPlugin.log(e.getStatus()); - } - } - - /** - * The mouse has been double-clicked in the tree, perform appropriate - * behaviour. - */ - private void mouseDoubleClicked(Event e) { - // Only act on single selection - ISelection selection = getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection structured = (IStructuredSelection)selection; - if (structured.size() == 1) { - Object first = structured.getFirstElement(); - if (first instanceof IDiffContainer) { - // Try to expand/contract - setExpandedState(first, !getExpandedState(first)); - } - } - } - } - - /** - * @see org.eclipse.jface.viewers.StructuredViewer#handleOpen(SelectionEvent) - */ - protected void handleOpen(SelectionEvent event) { - ISelection selection = getSelection(); - if (!selection.isEmpty() && selection instanceof IStructuredSelection) { - IStructuredSelection structured = (IStructuredSelection)selection; - Object selected = structured.getFirstElement(); - if (selected instanceof TeamFile) { - updateLabels(((TeamFile)selected).getMergeResource()); - } - } - super.handleOpen(event); - } - - /** - * Subclasses may override to provide different labels for the compare configuration. - */ - protected void updateLabels(MergeResource resource) { - resource.setLabels(getCompareConfiguration()); - } - - /** - * Set the filter mask to be the exact mask specified. - */ - private void setFilters(int maskToHide) { - ViewerFilter[] filters = getFilters(); - if (filters != null) { - for (int i = 0; i < filters.length; i++) { - if (filters[i] instanceof CategoryFilter) { - CategoryFilter filter = (CategoryFilter)filters[i]; - // Set the exact match to be applied on the filter - filter.setMask(maskToHide); - refresh(); - return; - } - } - } - // No category filter found -- add one - addFilter(new CategoryFilter(maskToHide)); - } - - /** - * The sync mode has changed. Update the filters. - */ - public void syncModeChanged(int mode) { - this.syncMode = mode; - updateFilters(); - } - - /** - * Sets the viewer filtering based on the current state - * of the filter actions. - */ - void updateFilters() { - //do nothing if viewer is disposed - Control control = getControl(); - if (control == null || control.isDisposed()) - return; - - //always show conflicts - int filters = CategoryFilter.SHOW_CONFLICTS; - - //determine what other filters to apply based on current action states - switch (syncMode) { - case SyncView.SYNC_INCOMING: - case SyncView.SYNC_MERGE: - if (!showOnlyConflicts.isChecked()) { - filters |= CategoryFilter.SHOW_INCOMING; - } - break; - case SyncView.SYNC_OUTGOING: - if (!showOnlyConflicts.isChecked()) { - filters |= CategoryFilter.SHOW_OUTGOING; - } - break; - case SyncView.SYNC_BOTH: - boolean conflictsOnly = showOnlyConflicts.isChecked(); - //if showing only conflicts, don't allow these actions to happen - showIncoming.setEnabled(!conflictsOnly); - showOutgoing.setEnabled(!conflictsOnly); - if (!conflictsOnly) { - if (showIncoming.isChecked()) { - filters |= CategoryFilter.SHOW_INCOMING; - } - if (showOutgoing.isChecked()) { - filters |= CategoryFilter.SHOW_OUTGOING; - } - } - break; - } - - //determine whether to show pseudo conflicts - if (!compareFileContents) { - filters |= CategoryFilter.SHOW_PSEUDO_CONFLICTS; - } - setFilters(filters); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java deleted file mode 100644 index 3a6fa098f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A node in a sync tree that represents a changed folder - * (incoming/outgoing creation or deletion). - */ -public class ChangedTeamContainer extends UnchangedTeamContainer { - private MergeResource mergeResource; - - /** - * ChangedTeamContainer constructor - */ - public ChangedTeamContainer(IDiffContainer parent, MergeResource resource, int description) { - super(parent, resource.getResource(), description); - this.mergeResource = resource; - } - - /* - * Method declared on ITeamNode. - */ - public int getChangeDirection() { - return getKind() & Differencer.DIRECTION_MASK; - } - - public int getChangeType() { - return getKind() & Differencer.CHANGE_TYPE_MASK; - } - - public String getName() { - return mergeResource.getName(); - } - - /** - * Returns the team resource managed by this object. - */ - public MergeResource getMergeResource() { - return mergeResource; - } - - /* - * Method declared on IDiffContainer - */ - public void removeToRoot(IDiffElement child) { - // Don't want to remove empty changed containers - remove(child); - } - - /** - * For debugging purposes only. - */ - public String toString() { - return "ChangedTeamContainer(" + getResource().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void makeInSync() { - setKind(Differencer.NO_CHANGE); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java deleted file mode 100644 index 0d438994b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Interface for a sync node that responds to team commands. - */ -public interface ITeamNode extends IDiffElement { - // Possible values for the change direction - static final int INCOMING = Differencer.RIGHT; - static final int OUTGOING = Differencer.LEFT; - static final int CONFLICTING = Differencer.CONFLICTING; - static final int NO_CHANGE = Differencer.NO_CHANGE; - - /** - * Returns the change direction for this resource. One of: - * INCOMING, OUTGOING, CONFLICTING, NO_CHANGE. - */ - public int getChangeDirection(); - - /** - * Returns the type of change for this resource. One of: - * CHANGE, DELETION, ADDITION - */ - public int getChangeType(); - - /** - * Returns the core resource represented by this node. - */ - public IResource getResource(); -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java deleted file mode 100644 index 47dda8a70..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.InputStream; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.ITypedElement; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.Policy; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Encapsulates information about a resource that requires - * contact with the Team API. - */ -public class MergeResource { - private IRemoteSyncElement syncTree; - - /** - * Creates a new merge resource based on the given sync information. - */ - public MergeResource(IRemoteSyncElement syncTree) { - this.syncTree = syncTree; - } - - /** - * Returns an InputStream for the base revision of this incoming resource. - */ - public InputStream getBaseRevision() throws CoreException { - IRemoteResource remote = syncTree.getBase(); - if (remote != null && !remote.isContainer()) { - try { - return remote.getContents(new NullProgressMonitor()); - } catch (TeamException exception) { - // The remote resource has gone. - return null; - } - } - return null; - } - - public String getExtension() { - if (syncTree.isContainer()) { - return ITypedElement.FOLDER_TYPE; - } - String name = getName(); - if (name != null) { - int index = name.lastIndexOf('.'); - if (index == -1) - return ""; //$NON-NLS-1$ - if (index == (name.length() - 1)) - return ""; //$NON-NLS-1$ - return name.substring(index + 1); - } - return ITypedElement.FOLDER_TYPE; - } - - /** - * Returns an InputStream for the latest repository version of this incoming resource. - */ - public InputStream getLatestRevision() throws CoreException { - IRemoteResource remote = syncTree.getRemote(); - try { - return remote.getContents(new NullProgressMonitor()); - } catch (TeamException e) { - throw new CoreException(e.getStatus()); - } - } - - /** - * Returns an InputStream for the local resource. - */ - public InputStream getLocalStream() throws CoreException { - IResource left = syncTree.getLocal(); - if (left == null) return null; - if (left.exists() && left.getType() == IResource.FILE) { - return ((IFile)left).getContents(true); - } - return null; - } - - public String getName() { - return syncTree.getName(); - } - - /* - * @see IMergeResource#getResource. - */ - public IResource getResource() { - return syncTree.getLocal(); - } - - public IRemoteSyncElement getSyncElement() { - return syncTree; - } - - /** - * Returns true if this merge resource has a base resource, - * and false otherwise. - */ - public boolean hasBaseRevision() { - return syncTree.getBase() != null; - } - - /** - * Returns true if this merge resource has a latest revision, - * and false otherwise. - */ - public boolean hasLatestRevision() { - return syncTree.getRemote() != null; - } - - /** - * Is this a leaf node, i.e. a file? - */ - public boolean isLeaf() { - return !syncTree.isContainer(); - } - - /** - * Updates the given compare configuration with appropriate left, right - * and ancestor labels for this resource. - */ - public void setLabels(CompareConfiguration config) { - String name = getName(); - config.setLeftLabel(Policy.bind("MergeResource.workspaceFile", name)); //$NON-NLS-1$ - - - IRemoteResource remote = syncTree.getRemote(); - if (remote != null) { - config.setRightLabel(Policy.bind("MergeResource.repositoryFile", name)); //$NON-NLS-1$ - // config.setRightLabel(TeamUIPlugin.getResourceString("MergeResource.repositoryFile", new Object[] {name, remote.getVersionName()} )); - } else { - config.setRightLabel(Policy.bind("MergeResource.noRepositoryFile")); //$NON-NLS-1$ - } - - IRemoteResource base = syncTree.getBase(); - if (base != null) { - config.setAncestorLabel(Policy.bind("MergeResource.commonFile", name)); //$NON-NLS-1$ - // config.setAncestorLabel(TeamUIPlugin.getResourceString("MergeResource.commonFile", new Object[] {name, common.getVersionName()} )); - } else { - config.setAncestorLabel(Policy.bind("MergeResource.noCommonFile")); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java deleted file mode 100644 index 7f2191300..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java +++ /dev/null @@ -1,470 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.internal.CompareUIPlugin; -import org.eclipse.compare.structuremergeviewer.DiffContainer; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.ICompareInput; -import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IViewSite; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * Performs a catchup or release operation on an array of resources. - */ -public abstract class SyncCompareInput extends CompareEditorInput { - private IRemoteSyncElement[] trees; - private CatchupReleaseViewer catchupReleaseViewer; - private DiffNode diffRoot; - private Shell shell; - private IViewSite viewSite; - private int granularity; - - private ICompareInputChangeListener listener = new ICompareInputChangeListener() { - public void compareInputChanged(ICompareInput source) { - SyncCompareInput.this.compareInputChanged(source); - } - }; - - /** - * Subclasses may override but must call super. - */ - protected void compareInputChanged(ICompareInput source) { - catchupReleaseViewer.update(source, new String[] {CatchupReleaseViewer.PROP_KIND}); - updateStatusLine(); - } - - /** - * Creates a new catchup or release operation. - */ - public SyncCompareInput(int granularity) { - super(new CompareConfiguration()); - privateSetSyncGranularity(granularity); - } - - /** - * Creates a new catchup or release operation. - */ - public SyncCompareInput() { - this(ILocalSyncElement.GRANULARITY_TIMESTAMP); - } - - protected abstract IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException; - - /* - * @see CompareEditorInput#createContents - */ - public Control createContents(Composite parent) { - Control result = super.createContents(parent); - initialSelectionAndExpansionState(); - return result; - } - - /** - * Subclasses must create and return a new CatchupReleaseViewer, and set the viewer - * using setViewer(). - */ - public abstract Viewer createDiffViewer(Composite parent); - - /** - * Returns the root node of the diff tree. - */ - public DiffNode getDiffRoot() { - return diffRoot; - } - - /** - * Returns the first diff element that is still unresolved in the - * subtree rooted at the given root element. - * Returns null if everything is resolved. - */ - private IDiffElement getFirstChange(IDiffElement root) { - if (root instanceof ITeamNode) { - ITeamNode node = (ITeamNode)root; - if (node instanceof TeamFile) { - return node; - } - } - if (root instanceof IDiffContainer) { - IDiffElement[] children = ((IDiffContainer)root).getChildren(); - IDiffElement result = null; - for (int i = 0; i < children.length; i++) { - result = getFirstChange(children[i]); - if (result != null) { - return result; - } - } - } - return null; - } - - protected Shell getShell() { - return shell; - } - - /** - * Returns the name of this operation. - * It is dipslayed in the CompareEditor's title bar. - */ - public String getTitle() { - return Policy.bind("SyncCompareInput.synchronize"); //$NON-NLS-1$ - } - - /** - * Returns the compare viewer; - */ - public CatchupReleaseViewer getViewer() { - return catchupReleaseViewer; - } - - /** - * Returns the view site, or null if this is a merge. - */ - public IViewSite getViewSite() { - return viewSite; - } - - /** - * Returns true if the model has incoming or conflicting changes. - */ - boolean hasIncomingChanges() { - if (diffRoot == null) { - return false; - } - SyncSet set = new SyncSet(new StructuredSelection(diffRoot.getChildren())); - return set.hasIncomingChanges() || set.hasConflicts(); - } - - /** - * Set an appropriate initial selection and expansion state. - */ - private void initialSelectionAndExpansionState() { - // Select the next change - IDiffElement next = getFirstChange(diffRoot); - if (next != null) { - catchupReleaseViewer.setSelection(new StructuredSelection(next), true); - } else { - catchupReleaseViewer.collapseAll(); - catchupReleaseViewer.setSelection(new StructuredSelection()); - } - } - - /** - * Performs a compare on the given selection. - * This method is called before the CompareEditor has been opened. - * If the result of the diff is empty (or an error has occured) - * no CompareEditor is opened but an Alert is shown. - */ - public Object prepareInput(final IProgressMonitor pm) throws InterruptedException, InvocationTargetException { - if (pm.isCanceled()) { - throw new InterruptedException(); - } - - try { - pm.beginTask(Policy.bind("SyncCompareInput.taskTitle"), 100); //$NON-NLS-1$ - - // Estimate 70% of the time is creating the sync elements - this.trees = createSyncElements(Policy.subMonitorFor(pm, 70)); - setMessage(null); - if (trees.length == 0) { - return null; - } - final InterruptedException[] exceptions = new InterruptedException[1]; - - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - // collect changes and build the diff tree - diffRoot = new DiffNode(0); - try { - doServerDelta(monitor); - } catch (InterruptedException e) { - exceptions[0] = e; - } - } - }; - if (pm.isCanceled()) { - throw new InterruptedException(); - } - // Estimate 30% of the time is doing the server delta - ResourcesPlugin.getWorkspace().run(runnable, Policy.subMonitorFor(pm, 30)); - if (exceptions[0] != null) throw exceptions[0]; - if (pm.isCanceled()) { - throw new InterruptedException(); - } - - if (!diffRoot.hasChildren()) { - diffRoot = null; - } - - updateStatusLine(); - - return diffRoot; - } catch (CoreException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - - void doServerDelta(IProgressMonitor pm) throws InterruptedException { - pm.beginTask(null, trees.length * 1000); - pm.setTaskName(Policy.bind("SyncCompareInput.taskTitle")); //$NON-NLS-1$ - for (int i = 0; i < trees.length; i++) { - IRemoteSyncElement tree = trees[i]; - IProgressMonitor monitor = Policy.subMonitorFor(pm, 1000); - monitor.beginTask(null, 1000); - IDiffElement localRoot = collectResourceChanges(null, tree, monitor); - monitor.done(); - makeParents(localRoot); - } - } - - /* - * This method expects to be past a monitor that has already had it's beginTask invoked - * and has enough ticks to allow 1 unit of work per resource in the tree and an additional - * unit for each folder. - */ - protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) { - int type = tree.getSyncKind(getSyncGranularity(), Policy.subMonitorFor(pm, 1)); - MergeResource mergeResource = new MergeResource(tree); - - if (tree.isContainer()) { - IDiffContainer element = new ChangedTeamContainer(parent, mergeResource, type); - try { - ILocalSyncElement[] children = tree.members(Policy.subMonitorFor(pm, 1)); - for (int i = 0; i < children.length; i++) { - collectResourceChanges(element, (IRemoteSyncElement)children[i], pm); - } - } catch (TeamException e) { - TeamUIPlugin.log(e.getStatus()); - } - return element; - } else { - TeamFile file = new TeamFile(parent, mergeResource, type, shell); - file.addCompareInputChangeListener(listener); - return file; - } - } - - public int getSyncGranularity() { - return granularity; - } - - public void setSyncGranularity(int granularity) { - privateSetSyncGranularity(granularity); - refresh(); - } - - private void privateSetSyncGranularity(int granularity) { - this.granularity = granularity; - if (granularity != IRemoteSyncElement.GRANULARITY_TIMESTAMP) { - if (isIgnoreWhitespace()) { - this.granularity = IRemoteSyncElement.GRANULARITY_CONTENTS_IGNORE_WHITESPACE; - } else { - this.granularity = IRemoteSyncElement.GRANULARITY_CONTENTS; - } - } - } - - public void setIgnoreWhitespace(boolean ignore) { - // Set the ignore whitespace - Boolean value = ignore ? Boolean.TRUE : Boolean.FALSE; - getCompareConfiguration().setProperty(CompareConfiguration.IGNORE_WHITESPACE, value); - // Set the granularity (which queries the ignore whitespace setting) - privateSetSyncGranularity(getSyncGranularity()); - // Refresh if the granularity is file contents - if (granularity != IRemoteSyncElement.GRANULARITY_TIMESTAMP) { - refresh(); - } - } - - public boolean isIgnoreWhitespace() { - Object o = getCompareConfiguration().getProperty(CompareConfiguration.IGNORE_WHITESPACE); - if (o instanceof Boolean) { - return ((Boolean)o).booleanValue(); - } - return CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(CompareConfiguration.IGNORE_WHITESPACE); - } - - /** - * Builds a DiffFolder tree under the given root for the given resource. - */ - private DiffContainer buildPath(DiffContainer root, IContainer resource) { - DiffContainer parent = root; - if (resource.getType() == IResource.ROOT) { - return root; - } - if (resource.getType() != IResource.PROJECT) { - parent = buildPath(root, resource.getParent()); - } - - DiffContainer c = (DiffContainer)parent.findChild(resource.getName()); - if (c == null) { - c = new UnchangedTeamContainer(parent, resource); - } - return c; - } - - void makeParents(IDiffElement element) { - IContainer parent = ((ITeamNode)element).getResource().getParent(); - DiffContainer container = buildPath(diffRoot, parent); - container.add(element); - } - - /** - * Performs a refresh, with progress and cancelation. - */ - public void refresh() { - final Object[] input = new Object[1]; - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - input[0] = prepareInput(monitor); - } - }; - try { - run(op, Policy.bind("SyncCompareInput.refresh")); //$NON-NLS-1$ - } catch (InterruptedException e) { - return; - } - - catchupReleaseViewer.setInput(input[0]); - if (input[0] == null) { - MessageDialog.openInformation(shell, Policy.bind("nothingToSynchronize"), Policy.bind("SyncCompareInput.nothingText")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); - try { - dialog.run(true, true, op); - } catch (InvocationTargetException e) { - Throwable throwable = e.getTargetException(); - IStatus error = null; - if (throwable instanceof TeamException) { - error = ((TeamException)throwable).getStatus(); - } else if (throwable instanceof CoreException) { - error = ((CoreException)throwable).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$ - } - ErrorDialog.openError(shell, problemMessage, null, error); - TeamUIPlugin.log(error); - // Throw an interrupted exception so we drop out of the sync - throw new InterruptedException(); - } - } - - public void setViewSite(IViewSite viewSite) { - this.viewSite = viewSite; - this.shell = viewSite.getShell(); - } - - public void setViewer(CatchupReleaseViewer viewer) { - this.catchupReleaseViewer = viewer; - } - - /** - * Updates the status line. - */ - public void updateStatusLine() { - if (viewSite != null && !shell.isDisposed()) { - Runnable update = new Runnable() { - public void run() { - if (!shell.isDisposed()) { - IStatusLineManager statusLine = viewSite.getActionBars().getStatusLineManager(); - if (diffRoot == null) { - statusLine.setMessage(null); - statusLine.setErrorMessage(null); - return; - } - SyncSet set = getSyncSet(new StructuredSelection(diffRoot.getChildren())); - if (set.hasConflicts()) { - statusLine.setMessage(null); - statusLine.setErrorMessage(set.getStatusLineMessage()); - } else { - statusLine.setErrorMessage(null); - statusLine.setMessage(set.getStatusLineMessage()); - } - viewSite.getActionBars().updateActionBars(); - } - } - }; - // Post or run the update - if (shell.getDisplay() != Display.getCurrent()) { - shell.getDisplay().asyncExec(update); - } else { - update.run(); - } - } - } - - protected SyncSet getSyncSet(IStructuredSelection selection) { - return new SyncSet(selection); - } - public boolean saveIfNecessary() { - if (! isSaveNeeded()) return true; - - final boolean[] result = new boolean[] { false }; - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - try { - result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("SyncView.saveTitle"),//$NON-NLS-1$ - Policy.bind("SyncView.saveMessage"));//$NON-NLS-1$ - if (result[0]) { - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - saveChanges(monitor); - } - }, new NullProgressMonitor()); - } - } catch (CoreException e) { - IStatus status = e.getStatus(); - ErrorDialog.openError(getShell(), status.getMessage(), Policy.bind("SyncView.errorSaving"), status);//$NON-NLS-1$ - result[0] = false; - } - } - }); - return result[0]; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java deleted file mode 100644 index 36e161abd..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java +++ /dev/null @@ -1,282 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ui.Policy; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * This class contains a set of resources that are slated to be - * synchronized. It performs various operations on the - * set in preparation for catchup/release. - */ -public class SyncSet { - private HashSet set; - - /** - * Creates a new sync set on the nodes in the given selection. - */ - public SyncSet(IStructuredSelection nodeSelection) { - this.set = new HashSet(nodeSelection.size() + 1); - collectNodes(nodeSelection); - } - - /** - * Collects all nodes to which this action will apply. This means - * all nodes in the selection, plus all their children. - */ - private void collectNodes(IStructuredSelection selection) { - Object[] nodes = selection.toArray(); - for (int i = 0; i < nodes.length; i++) { - recursivelyAdd((ITeamNode)nodes[i]); - } - } - - /** - * Adds all parent creations for the given node to the sync set. - */ - private void collectParentCreations(ITeamNode node) { - IDiffElement parent = node.getParent(); - if (parent != null && parent instanceof ITeamNode) { - if (parent.getKind() != IRemoteSyncElement.IN_SYNC) { - set.add(parent); - collectParentCreations((ITeamNode)parent); - } - } - } - - /** - * Returns all nodes in the set that have changes - */ - public ITeamNode[] getChangedNodes() { - ArrayList nodeList = new ArrayList(set.size()); - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - int dir = node.getChangeDirection(); - // We assume changed nodes of the wrong type have been culled - // during set creation. - if (dir != Differencer.NO_CHANGE) { - nodeList.add(node); - } - } - ITeamNode[] nodes = new ITeamNode[nodeList.size()]; - nodeList.toArray(nodes); - return nodes; - } - - /** - * Returns the resources from all the nodes in this set. - */ - public IResource[] getResources() { - ITeamNode[] changed = getChangedNodes(); - IResource[] resources = new IResource[changed.length]; - for (int i = 0; i < changed.length; i++) { - resources[i] = changed[i].getResource(); - } - return resources; - } - - /** - * Returns a message for the status line describing this sync set. - */ - public String getStatusLineMessage() { - int incoming = 0; - int outgoing = 0; - int conflicts = 0; - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode next = (ITeamNode)it.next(); - switch (next.getChangeDirection()) { - case IRemoteSyncElement.INCOMING: - incoming++; - break; - case IRemoteSyncElement.OUTGOING: - outgoing++; - break; - case IRemoteSyncElement.CONFLICTING: - conflicts++; - break; - } - } - StringBuffer result = new StringBuffer(); - - if (conflicts == 0) { - result.append(Policy.bind("SyncSet.noConflicts")); //$NON-NLS-1$ - } else { - result.append(Policy.bind("SyncSet.conflicts", new Object[] {Integer.toString(conflicts)} )); //$NON-NLS-1$ - } - if (incoming == 0) { - result.append(Policy.bind("SyncSet.noIncomings")); //$NON-NLS-1$ - } else { - result.append(Policy.bind("SyncSet.incomings", new Object[] {Integer.toString(incoming)} )); //$NON-NLS-1$ - } - if (outgoing == 0) { - result.append(Policy.bind("SyncSet.noOutgoings")); //$NON-NLS-1$ - } else { - result.append(Policy.bind("SyncSet.outgoings", new Object[] {Integer.toString(outgoing)} )); //$NON-NLS-1$ - } - return result.toString(); - } - - /** - * Returns true if there are any conflicting nodes in the set, and - * false otherwise. - */ - public boolean hasConflicts() { - for (Iterator it = set.iterator(); it.hasNext();) { - if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.CONFLICTING) { - return true; - } - } - return false; - } - - /** - * Returns true if this sync set has incoming changes. - * Note that conflicts are not considered to be incoming changes. - */ - public boolean hasIncomingChanges() { - for (Iterator it = set.iterator(); it.hasNext();) { - if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.INCOMING) { - return true; - } - } - return false; - } - - /** - * Returns true if this sync set has outgoing changes. - * Note that conflicts are not considered to be outgoing changes. - */ - public boolean hasOutgoingChanges() { - for (Iterator it = set.iterator(); it.hasNext();) { - if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.OUTGOING) { - return true; - } - } - return false; - } - - /** - * Returns true if this sync set has auto-mergeable conflicts. - */ - public boolean hasAutoMergeableConflicts() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if ((node.getKind() & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) { - return true; - } - } - return false; - } - - /** - * Adds the given node, plus all its children, to the given set. - */ - private void recursivelyAdd(ITeamNode node) { - // Add the node and recurse - if (set.add(node)) { - if (node instanceof IDiffContainer) { - IDiffElement[] children = ((IDiffContainer)node).getChildren(); - for (int i = 0; i < children.length; i++) { - if (children[i] instanceof ITeamNode) { - recursivelyAdd((ITeamNode)children[i]); - } - } - } - // Add any created parents (can't release or load a - // resource creation without including new parents) - collectParentCreations(node); - } - } - - /** - * Removes all conflicting nodes from this set. - */ - public void removeConflictingNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if (node.getChangeDirection() == IRemoteSyncElement.CONFLICTING) { - it.remove(); - } - } - } - /** - * Removes all outgoing nodes from this set. - */ - public void removeOutgoingNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if (node.getChangeDirection() == IRemoteSyncElement.OUTGOING) { - it.remove(); - } - } - } - /** - * Removes all incoming nodes from this set. - */ - public void removeIncomingNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if (node.getChangeDirection() == IRemoteSyncElement.INCOMING) { - it.remove(); - } - } - } - /** - * Removes all nodes from this set that are not auto-mergeable conflicts - */ - public void removeNonMergeableNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - if ((node.getKind() & IRemoteSyncElement.MANUAL_CONFLICT) != 0) { - it.remove(); - } else if (node.getChangeDirection() != ITeamNode.CONFLICTING) { - it.remove(); - } - } - } - - /** - * Removes all nodes that aren't applicable for the direction. - */ - public void removeNonApplicableNodes(int direction) { - for (Iterator it = set.iterator(); it.hasNext();) { - ITeamNode node = (ITeamNode)it.next(); - int nodeDirection = node.getKind() & IRemoteSyncElement.DIRECTION_MASK; - if (nodeDirection != IRemoteSyncElement.CONFLICTING) { - if (nodeDirection != direction) { - it.remove(); - } - } - } - } - - /** - * Remove the given node from the sync set - */ - public void remove(ITeamNode node) { - set.remove(node); - } - - protected HashSet getSyncSet() { - return set; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java deleted file mode 100644 index 51d02916e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java +++ /dev/null @@ -1,454 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.NavigationAction; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.part.IShowInSource; -import org.eclipse.ui.part.ShowInContext; -import org.eclipse.ui.part.ViewPart; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * This class provides a view for performing synchronizations - * between the local workspace and a repository. - */ -public class SyncView extends ViewPart { - public static final String VIEW_ID = "org.eclipse.team.ui.sync.SyncView"; //$NON-NLS-1$ - private SyncCompareInput input; - private Composite top; - - // The possible sync modes - public static final int SYNC_NONE = 0; - public static final int SYNC_INCOMING = 1; - public static final int SYNC_OUTGOING = 2; - public static final int SYNC_BOTH = 3; - public static final int SYNC_MERGE = 4; - public static final int SYNC_COMPARE = 5; - - // Titles cached for efficiency - private final String CATCHUP_TITLE = Policy.bind("SyncView.incomingModeTitle"); //$NON-NLS-1$ - private final String RELEASE_TITLE = Policy.bind("SyncView.outgoingModeTitle"); //$NON-NLS-1$ - private final String FREE_TITLE = Policy.bind("SyncView.freeModeTitle"); //$NON-NLS-1$ - - private int currentSyncMode = SYNC_NONE; - - /** - * Action for toggling the sync mode. - */ - class SyncModeAction extends Action { - // The sync mode that this action enables - private int syncMode; - public SyncModeAction(String title, ImageDescriptor image, int mode) { - super(title, image); - this.syncMode = mode; - } - public void run() { - SyncView.this.setSyncMode(syncMode); - } - } - - private SyncModeAction incomingMode; - private SyncModeAction outgoingMode; - private SyncModeAction freeMode; - private NavigationAction next; - private NavigationAction previous; - - private class PartListener implements IPartListener { - public void partActivated(IWorkbenchPart part) { - } - public void partBroughtToTop(IWorkbenchPart part) { - } - public void partClosed(IWorkbenchPart part) { - } - public void partDeactivated(IWorkbenchPart part) { - if (part == SyncView.this && input != null) { - input.saveIfNecessary(); - } - } - public void partOpened(IWorkbenchPart part) { - } - } - - private IPartListener partListener; - - /** - * Creates a new view. - */ - public SyncView() { - super(); - } - - /* - * @see IWorkbenchPart#createPartControl - */ - public void createPartControl(Composite parent) { - top = new Composite(parent, SWT.NONE); - - //XXX Set the control data to be this part, so the compare - //frames that will eventually live in this widget hierarchy - //have some way to access the action bars for hooking global - //actions. See corresponding XXX comment in CompareEditor#findActionBars - top.setData(this); - - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - top.setLayout(layout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - showDefaultContents(); - - initializeSyncModes(); - // add part listener - partListener = new PartListener(); - getViewSite().getWorkbenchWindow().getPartService().addPartListener(partListener); - WorkbenchHelp.setHelp(top, IHelpContextIds.SYNC_VIEW); - } - - public void dispose() { - // remove part listener - if (partListener != null) { - getViewSite().getWorkbenchWindow().getPartService().removePartListener(partListener); - partListener = null; - } - super.dispose(); - } - - /** - * Makes the sync view visible in the active page. If there isn't a sync - * view registered null is returned. Otherwise the opened view - * part is returned. - */ - public static SyncView findViewInActivePage(IWorkbenchPage activePage) { - try { - if (activePage == null) { - activePage = TeamUIPlugin.getActivePage(); - if (activePage == null) return null; - } - IViewPart part = activePage.findView(VIEW_ID); - if (part == null) - part = activePage.showView(VIEW_ID); - return (SyncView)part; - } catch (PartInitException pe) { - return null; - } - } - - /** - * Sets up the sync modes and the actions for switching between them. - */ - private void initializeSyncModes() { - // Create the actions - incomingMode = new SyncModeAction( - Policy.bind("SyncView.incomingModeAction"), //$NON-NLS-1$ - TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_ENABLED), - SYNC_INCOMING); - incomingMode.setToolTipText(Policy.bind("SyncView.incomingModeToolTip")); //$NON-NLS-1$ - incomingMode.setChecked(false); - incomingMode.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_DISABLED)); - incomingMode.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP)); - - outgoingMode = new SyncModeAction( - Policy.bind("SyncView.outgoingModeAction"), //$NON-NLS-1$ - TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_ENABLED), - SYNC_OUTGOING); - outgoingMode.setToolTipText(Policy.bind("SyncView.outgoingModeToolTip")); //$NON-NLS-1$ - outgoingMode.setChecked(false); - outgoingMode.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_DISABLED)); - outgoingMode.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE)); - - freeMode = new SyncModeAction( - Policy.bind("SyncView.freeModeAction"), //$NON-NLS-1$ - TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_ENABLED), - SYNC_BOTH); - freeMode.setToolTipText(Policy.bind("SyncView.freeModeToolTip")); //$NON-NLS-1$ - freeMode.setChecked(false); - freeMode.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_DISABLED)); - freeMode.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE)); - - // Set up global actions for next and previous - next = new NavigationAction(true); - previous = new NavigationAction(false); - IActionBars actionBars = getViewSite().getActionBars(); - if (actionBars != null) { - actionBars.setGlobalActionHandler(IWorkbenchActionConstants.NEXT, next); - actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, previous); - actionBars.updateActionBars(); - } - } - - private boolean isEmpty(DiffNode node) { - if (node == null) return true; - if (node.getKind() != 0) return false; - IDiffElement[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; - } - return true; - } - private boolean isEmpty(IDiffElement element) { - if (element.getKind() != 0) return false; - if (element instanceof DiffNode) { - IDiffElement[] children = ((DiffNode)element).getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; - } - } - return true; - } - - /** - * Runs an operation and handles progress and exceptions. Returns true - * if the operation was successful, and false if there were errors or - * the user canceled. - */ - private boolean run(IRunnableWithProgress op) { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(getSite().getShell()); - try { - dialog.run(true, true, op); - return true; - } catch (InvocationTargetException e) { - Throwable throwable = e.getTargetException(); - IStatus error = null; - if (throwable instanceof TeamException) { - error = ((TeamException)throwable).getStatus(); - } else if (throwable instanceof CoreException) { - error = ((CoreException)throwable).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal"), throwable); //$NON-NLS-1$ - } - ErrorDialog.openError(getSite().getShell(), Policy.bind("SyncView.unableSynchronize"), null, error); //$NON-NLS-1$ - TeamUIPlugin.log(error); - } catch (InterruptedException e) { - } - return false; - } - - /** - * Asks the part to take focus within the workbench. - */ - public void setFocus() { - if (top != null && !top.isDisposed()) { - top.setFocus(); - } - } - - /** - * Activates the given sync mode. - */ - void setSyncMode(int mode) { - // Implement radio button behaviour - switch (mode) { - case SYNC_INCOMING: - incomingMode.setChecked(true); - outgoingMode.setChecked(false); - freeMode.setChecked(false); - setTitle(CATCHUP_TITLE); - break; - case SYNC_OUTGOING: - outgoingMode.setChecked(true); - incomingMode.setChecked(false); - freeMode.setChecked(false); - setTitle(RELEASE_TITLE); - break; - case SYNC_BOTH: - freeMode.setChecked(true); - outgoingMode.setChecked(false); - incomingMode.setChecked(false); - setTitle(FREE_TITLE); - break; - } - // Only update actions if there is valid input - if (input != null && input.getDiffRoot() != null && mode != currentSyncMode) { - currentSyncMode = mode; - input.getViewer().syncModeChanged(mode); - updateActions(); - } - } - - /** - * Shows default contents for the view if there is nothing to synchronize. - */ - private void showDefaultContents() { - Label label = new Label(top, SWT.WRAP); - label.setLayoutData(new GridData(GridData.FILL_BOTH)); - label.setText(Policy.bind("SyncView.text")); //$NON-NLS-1$ - } - - /** - * Shows synchronization information for the given resources in the sync view. - * @deprecated - */ - public void showSync(SyncCompareInput input) { - showSync(input, null); - } - - /** - * Shows synchronization information for the given resources in the sync - * view. - * @param input the diff tree to be displayed - * @param page the page on which to open the sync view - */ - public void showSync(SyncCompareInput input, IWorkbenchPage page) { - next.setCompareEditorInput(input); - previous.setCompareEditorInput(input); - IActionBars actionBars = getViewSite().getActionBars(); - actionBars.updateActionBars(); - - input.setViewSite(getViewSite()); - this.input = input; - currentSyncMode = SYNC_NONE; - - // Remove old viewer - Control[] oldChildren = top.getChildren(); - if (oldChildren != null) { - for (int i = 0; i < oldChildren.length; i++) { - oldChildren[i].dispose(); - } - } - // Remove actions from toolbar - IActionBars bars = getViewSite().getActionBars(); - bars.getToolBarManager().removeAll(); - bars.getToolBarManager().update(false); - bars.getMenuManager().removeAll(); - bars.getMenuManager().update(); - bars.updateActionBars(); - - // Display the default contents while running the diff - showDefaultContents(); - top.layout(); - - // Run the diff and stop if cancel or error occurred. - if (!run(input)) return; - - // Check for problem message - if (input.getMessage() != null) { - MessageDialog.openInformation(getSite().getShell(), Policy.bind("SyncView.unableSynchronize"), input.getMessage()); //$NON-NLS-1$ - return; - } - - // Check for empty comparison - if (isEmpty(input.getDiffRoot())) { - MessageDialog.openInformation(getSite().getShell(), Policy.bind("nothingToSynchronize"), Policy.bind("SyncView.same")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - // Remove the default contents - oldChildren = top.getChildren(); - if (oldChildren != null) { - for (int i = 0; i < oldChildren.length; i++) { - oldChildren[i].dispose(); - } - } - - // Show the result - Control control = input.createContents(top); - control.setLayoutData(new GridData(GridData.FILL_BOTH)); - /*TreeViewer viewer = input.getViewer(); - if (viewer != null) { - Control viewerControl = viewer.getControl(); - if (viewerControl != null && !viewerControl.isDisposed()) { - WorkbenchHelp.setHelp(viewerControl, new ViewContextComputer(this, ITeamHelpContextIds.SYNC_VIEW)); - } - }*/ - - top.layout(); - - // Set the sync mode depending on user preference - if (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING)) { - freeMode.run(); - } else { - if (input.hasIncomingChanges()) { - incomingMode.run(); - } else { - outgoingMode.run(); - } - } - // Reveal if fast view - try { - if (page == null) page = TeamUIPlugin.getActivePage(); - if (page != null) page.showView(VIEW_ID); - } catch (PartInitException e) { - TeamUIPlugin.log(e.getStatus()); - } - } - - /** - * Updates the actions for this view's action bar. - */ - private void updateActions() { - IActionBars bars = getViewSite().getActionBars(); - IToolBarManager toolBar = bars.getToolBarManager(); - IMenuManager menu = bars.getMenuManager(); - toolBar.removeAll(); - menu.removeAll(); - - toolBar.add(incomingMode); - toolBar.add(outgoingMode); - toolBar.add(freeMode); - input.getViewer().contributeToActionBars(bars); - - toolBar.update(false); - menu.update(false); - bars.updateActionBars(); - } - - /** - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class key) { - if (key == IShowInSource.class) { - return new IShowInSource() { - public ShowInContext getShowInContext() { - if (input == null || input.getViewer() == null) return null; - return new ShowInContext(null, input.getViewer().getSelection()); - } - }; - } - return super.getAdapter(key); - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java deleted file mode 100644 index 7d1be48ad..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java +++ /dev/null @@ -1,378 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.structuremergeviewer.DiffElement; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.ICompareInput; -import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.util.ListenerList; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.TeamPlugin; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A sync node for a version-controlled file, where the left - * side is the local file, the right side is the remote file, - * and the ancestor is the common file. - */ -public class TeamFile extends DiffElement implements ICompareInput, ITeamNode, IAdaptable { - - private MergeResource mergeResource; - - private Shell shell; - private ListenerList listeners; - - private TypedBufferedContent localByteContents; - private TypedBufferedContent commonByteContents; - private TypedBufferedContent remoteByteContents; - - boolean hasBeenSaved = false; - - private IProgressMonitor monitor; - - /** - * Creates a new file node. - */ - public TeamFile(IDiffContainer parent, MergeResource res, int changeType, Shell shell) { - super(parent, changeType); - Assert.isNotNull(res); - this.mergeResource = res; - this.shell = shell; - - commonByteContents = new TypedBufferedContent(this, false) { - public InputStream createStream() throws CoreException { - return mergeResource.getBaseRevision(); - } - }; - remoteByteContents = new TypedBufferedContent(this, false) { - protected InputStream createStream() throws CoreException { - return mergeResource.getLatestRevision(); - } - }; - - if(getResource().exists()) { - localByteContents = getLocalTypedContent(); - } else { - localByteContents = null; - } - } - - public void addCompareInputChangeListener(ICompareInputChangeListener l) { - if (listeners == null) { - listeners = new ListenerList(); - } - listeners.add(l); - } - - /* - * @see ICompareInput#copy(boolean) - */ - public void copy(boolean leftToRight) { - if (leftToRight) return; - ITypedElement right = getRight(); - ITypedElement left = getLeft(); - try { - if (left == null) { - // Addition - saveChanges(new ByteArrayInputStream(new byte[0])); - localByteContents = getLocalTypedContent(); - } else { - // deletion - saveChanges(null); - localByteContents = null; - } - } catch(CoreException e) { - TeamPlugin.log(e.getStatus()); - } - } - - public boolean equals(Object other) { - if (other != null && other.getClass() == getClass()) { - TeamFile file = (TeamFile) other; - return mergeResource.equals(file.mergeResource); - } - return super.equals(other); - } - - /* - * @see ICompareInput#getAncestor - */ - public ITypedElement getAncestor() { - if (mergeResource.hasBaseRevision()) { - return commonByteContents; - } - return null; - } - - /* - * Method declared on ITeamNode. - */ - public int getChangeDirection() { - return getKind() & Differencer.DIRECTION_MASK; - } - - /* - * @see ITeamNode#getChangeType() - */ - public int getChangeType() { - return getKind() & Differencer.CHANGE_TYPE_MASK; - } - - /* - * @see ITypedInput#getType - */ - public Image getImage() { - return CompareUI.getImage(getType()); - } - - /* - * @see ICompareInput#getLeft - */ - public ITypedElement getLeft() { - return localByteContents; - } - - /* - * @see ITypedInput#getName - */ - public String getName() { - if(hasBeenSaved) { - return Policy.bind("TeamFile.modified", mergeResource.getName()); //$NON-NLS-1$ - } else { - return mergeResource.getName(); - } - } - - /* - * @see ICompareInput#getRight - */ - public ITypedElement getRight() { - if (mergeResource.hasLatestRevision()) { - return remoteByteContents; - } else { - return null; - } - } - - /* - * @see ITypedInput#getType - */ - public String getType() { - return mergeResource.getExtension(); - } - - /* - * @see ICompareInput#removeCompareInputChangeListener(ICompareInputChangeListener) - */ - public void removeCompareInputChangeListener(ICompareInputChangeListener listener) { - if (listeners != null) { - listeners.remove(listener); - } - } - - /* - * @see Object - */ - public int hashCode() { - return mergeResource.hashCode(); - } - - /** - * Returns the team resource managed by this object. - * Guaranteed to be non-null. - */ - public MergeResource getMergeResource() { - return mergeResource; - } - - /** - * Returns the core resource managed by this object. - * Guaranteed to be non-null. - */ - public IResource getResource() { - return mergeResource.getResource(); - } - - /** - * For debugging purposes only. - */ - public String toString() { - return "TeamFile(" + mergeResource.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected TypedBufferedContent getLocalTypedContent() { - // don't allow editing of outgoing deletion content. To revert from the deletion the - // user should use the appropriate sync view action. - boolean outgoingDeletion = getChangeDirection() == IRemoteSyncElement.OUTGOING && getChangeType() == IRemoteSyncElement.DELETION; - final String name = getName(); - return new TypedBufferedContent(this, !outgoingDeletion) { - protected InputStream createStream() throws CoreException { - return mergeResource.getLocalStream(); - } - public void setContent(byte[] contents) { - try { - if(contents==null) { - saveChanges(new ByteArrayInputStream(new byte[0])); - } else { - saveChanges(new ByteArrayInputStream(contents)); - } - } catch(CoreException e) { - ErrorDialog.openError(TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("TeamFile.saveChanges", name), null, e.getStatus()); //$NON-NLS-1$ - } - fireContentChanged(); - } - public ITypedElement replace(ITypedElement child, ITypedElement other) { - return null; - } - }; - } - - /** - * The local resource has beed modified (i.e. merged). - */ - public void merged() { - // calculate the new sync state based on the type of change that was merged. This - // logic cannot be in the IRemoteSyncElement because there is no way to update the - // base before calling getSyncKind() again. - if(getChangeDirection()==INCOMING) { - switch(getChangeType()) { - case Differencer.ADDITION: - case Differencer.CHANGE: - setKind(OUTGOING | Differencer.CHANGE); - break; - case Differencer.DELETION: - setKind(CONFLICTING | Differencer.CHANGE); - } - } else { - setKind(OUTGOING | (getKind() & Differencer.CHANGE_TYPE_MASK)); - } - hasBeenSaved = false; - } - - public void setProgressMonitor(IProgressMonitor monitor) { - this.monitor = monitor; - } - - private void saveChanges(final InputStream is) throws CoreException { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IFile file = (IFile) getResource(); - if (is != null) { - if (!file.exists()) { - createParents(getParent(), getResource().getParent()); - file.create(is, false, monitor); - } else { - file.setContents(is, false, true, monitor); - } - } else { - file.delete(false, true, monitor); - deleteParents(getParent(), getResource().getParent()); - } - hasBeenSaved = true; - - // update the UI with the sync state change. - fireThreeWayInputChange(); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - }); - } - - private void createParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException { - if(!parentFolder.exists() && parentFolder.getType() != IResource.PROJECT) { - createParents(parentNode.getParent(), parentFolder.getParent()); - ((IFolder)parentFolder).create(false /* force */, true, null); - if(parentNode instanceof ChangedTeamContainer) { - ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC); - } - } - } - - private void deleteParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException { - if(parentFolder.members().length == 0 && parentFolder.getType() != IResource.PROJECT) { - IContainer parent = parentFolder.getParent(); - parentFolder.delete(false, null); - if(parentNode instanceof ChangedTeamContainer) { - ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC); - } - deleteParents(parentNode.getParent(), parent); - } - } - - private void run(IRunnableWithProgress runnable) throws CoreException { - try { - if(monitor == null) { - new ProgressMonitorDialog(shell).run(false, false, runnable); - } else { - runnable.run(monitor); - } - } catch (InvocationTargetException e) { - if (e.getTargetException() instanceof CoreException) { - throw (CoreException)e.getTargetException(); - } else { - throw new CoreException(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, Policy.bind("simpleInternal"), e.getTargetException())); //$NON-NLS-1$ - } - } catch (InterruptedException e) { - // Ignore - } - } - - private void fireThreeWayInputChange() { - if (listeners != null) { - Object[] listenerArray = listeners.getListeners(); - // Iterate backwards so that the model gets updated last - // it might want to remove the node completely, which might - // upset other listeners. - for (int i = listenerArray.length; --i >= 0;) - ((ICompareInputChangeListener) listenerArray[i]).compareInputChanged(this); - } - } - - public boolean hasBeenSaved() { - return hasBeenSaved; - } - - /** - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - if (adapter == IResource.class) - return mergeResource.getResource(); - return null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java deleted file mode 100644 index 6c739f918..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.compare.BufferedContent; -import org.eclipse.compare.IEditableContent; -import org.eclipse.compare.ITypedElement; -import org.eclipse.swt.graphics.Image; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A content buffer for resources on a server. - */ -abstract class TypedBufferedContent extends BufferedContent implements ITypedElement, IEditableContent { - private ITeamNode node; - private boolean editable; - - /** - * Creates a new content buffer for the given team node. - */ - TypedBufferedContent(ITeamNode node, boolean editable) { - this.node = node; - this.editable = editable; - } - - public Image getImage() { - return node.getImage(); - } - - public String getName() { - return node.getName(); - } - - public String getType() { - return node.getType(); - } - - /** - * Returns true if this object can be modified. - * If it returns false the other methods must not be called. - * - * @return true if this object can be modified. - */ - public boolean isEditable() { - return editable; - } - - /** - * This is not the definitive API! - * This method is called on a parent to - * - add a child, - * - remove a child, - * - copy the contents of a child - * - * What to do is encoded in the two arguments as follows: - * add: child == null other != null - * remove: child != null other == null - * copy: child != null other != null - */ - public ITypedElement replace(ITypedElement child, ITypedElement other) { - return null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java deleted file mode 100644 index 05dfee3ad..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.team.internal.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.ResourceNode; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.swt.graphics.Image; - -/** - * Note: This class/interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is being made available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * A node in a diff tree that represents a folder with no changes - * to itself, it is only a placeholder for changes in its children. - */ -public class UnchangedTeamContainer extends DiffNode implements ITeamNode { - private IResource resource; - - public UnchangedTeamContainer(IDiffContainer parent, IResource resource) { - this(parent, resource, Differencer.NO_CHANGE); - } - - public UnchangedTeamContainer(IDiffContainer parent, IResource resource, int description) { - super(parent, description); - setLeft(new ResourceNode(resource)); - this.resource = resource; - } - - /* - * Method declared on ITeamNode - */ - public int getChangeDirection() { - return ITeamNode.NO_CHANGE; - } - - /* - * @see ITeamNode#getChangeType() - */ - public int getChangeType() { - return ITeamNode.NO_CHANGE; - } - - public Image getImage() { - return CompareUI.getImage(getType()); - } - - public String getName() { - return resource.getName(); - } - - /** - * Returns the resource underlying this diff node. - */ - public IResource getResource() { - return resource; - } - - public String getType() { - return ITypedElement.FOLDER_TYPE; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java deleted file mode 100644 index 088319419..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.AuthenticatedSite; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.dialogs.PropertyPage; - -public class AuthenticatedTargetSitePropertiesPage extends PropertyPage { - public static final int WIDTH_HINT = 250; - - private Site site; - private Text nameText, passwordText; - - /** - * Initializes the page - */ - private void initialize() { - IAdaptable element = getElement(); - if (element instanceof SiteElement) { - site = ((SiteElement)element).getSite(); - } else { - SiteElement adapter = (SiteElement)element.getAdapter(SiteElement.class); - if (adapter != null) { - site = adapter.getSite(); - } - } - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - initialize(); - Composite container = new Composite(parent, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - - Label serverLabel = new Label(container, SWT.NONE); - serverLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.Server")); //$NON-NLS-1$ - serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - Label serverText = new Label(container, SWT.NONE); - serverText.setText(site.getURL().getHost()); - GridData data = new GridData(); - data.widthHint = WIDTH_HINT; - serverText.setLayoutData(data); - - Label nameLabel = new Label(container, SWT.NONE); - nameLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.User")); //$NON-NLS-1$ - nameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - nameText = new Text(container, SWT.SINGLE | SWT.BORDER); - data = new GridData(); - data.widthHint = WIDTH_HINT; - nameText.setLayoutData(data); - String name=((AuthenticatedSite)site).getUsername(); - if (name!=null) nameText.setText(name); - - Label passwordLabel = new Label(container, SWT.NONE); - passwordLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.Password")); //$NON-NLS-1$ - passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - passwordText = new Text(container, SWT.SINGLE | SWT.BORDER); - passwordText.setEchoChar('*'); - passwordText.setText(""); //$NON-NLS-1$ - data = new GridData(); - data.widthHint = WIDTH_HINT; - passwordText.setLayoutData(data); - - return container; - } - - /** - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - String name = nameText.getText(); - String password = passwordText.getText(); - try { - if (name!=null && name.length()>0) ((AuthenticatedSite)site).setUsername(name); - if (password!=null && password.length()>0) ((AuthenticatedSite)site).setPassword(password); - return true; - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("AuthenticatedTargetSitePropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$ - return false; - } - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java deleted file mode 100644 index 2672b4a8e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java +++ /dev/null @@ -1,400 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.IWizardContainer; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.ConfigurationWizardElement; -import org.eclipse.team.internal.ui.ConfigureProjectWizardMainPage; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.internal.model.AdaptableList; - -public class ConfigureTargetWizard extends Wizard implements IConfigurationWizard { - protected IWorkbench workbench; - protected IProject project; - protected IConfigurationWizard wizard; - - protected ConfigureProjectWizardMainPage mainPage; - protected static MappingSelectionPage mappingPage; - - private String pluginId = UIConstants.PLUGIN_ID; - - protected final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$ - protected final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ - protected final static String ATT_NAME = "name"; //$NON-NLS-1$ - protected final static String ATT_CLASS = "class"; //$NON-NLS-1$ - protected final static String ATT_ICON = "icon"; //$NON-NLS-1$ - protected final static String ATT_ID = "id"; //$NON-NLS-1$ - - public ConfigureTargetWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(getWizardWindowTitle()); //$NON-NLS-1$ - } - - public static final String MAPPING_PAGE_NAME = "mapping-page"; //$NON-NLS-1$ - - protected SiteSelectionPage siteSelectionPage = null; - /** - * @see ConfigureProjectWizard#getExtensionPoint() - */ - protected String getExtensionPoint() { - return UIConstants.PT_TARGETCONFIG; - } - - /** - * @see ConfigureProjectWizard#getWizardDescription() - */ - protected String getWizardDescription() { - return Policy.bind("TargetSiteCreationWizard.description"); //$NON-NLS-1$ - } - - /** - * @see ConfigureProjectWizard#getWizardLabel() - */ - protected String getWizardLabel() { - return Policy.bind("TargetSiteCreationWizard.label"); //$NON-NLS-1$ - } - - /** - * @see ConfigureProjectWizard#getWizardWindowTitle() - */ - protected String getWizardWindowTitle() { - if(project != null) { - return Policy.bind("TargetSiteCreationWizard.windowTitleProject"); //$NON-NLS-1$ - } else { - return Policy.bind("TargetSiteCreationWizard.windowTitleNoProject"); //$NON-NLS-1$ - } - } - - /* - * @see Wizard#addPages - */ - public void addPages() { - Site[] sites = TargetManager.getSites(); - AdaptableList wizards = getAvailableWizards(); - - if(sites.length > 0 && project != null) { - TargetProvider provider = null; - try { - provider = TargetManager.getProvider(project); - } catch (TeamException e) { - TeamUIPlugin.log(e.getStatus()); - } - siteSelectionPage = new SiteSelectionPage("site-selection-page", Policy.bind("TargetSiteCreationWizard.siteSelectionPage"), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE), provider); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(siteSelectionPage); - } - - if(project != null) { - mappingPage = new MappingSelectionPage(ConfigureTargetWizard.MAPPING_PAGE_NAME, Policy.bind("MappingSelectionPage.mappingTitle"), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE)); //$NON-NLS-1$ - mappingPage.setWizard(this); - } - - try { - if(wizards.size() == 1) { - ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0]; - this.wizard = (IConfigurationWizard)element.createExecutableExtension(); - wizard.init(workbench, project); - wizard.addPages(); - if (wizard.getPageCount() > 0) { - wizard.setContainer(getContainer()); - IWizardPage[] pages = wizard.getPages(); - for (int i = 0; i < pages.length; i++) { - addPage(pages[i]); - } - } - } else { - mainPage = new ConfigureProjectWizardMainPage("target-selection-page", getWizardLabel(), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE), wizards, Policy.bind("ConfigureProjectWizardMainPage.selectTarget")); //$NON-NLS-1$ //$NON-NLS-2$ - mainPage.setDescription(getWizardDescription()); - mainPage.setProject(project); - mainPage.setWorkbench(workbench); - addPage(mainPage); - } - } catch (CoreException e) { - TeamUIPlugin.log(e.getStatus()); - return; - } - } - - public IWizardPage getNextPage(IWizardPage page) { - if(page == siteSelectionPage) { - if(siteSelectionPage.isDisconnect()) { - return null; - } - if(siteSelectionPage.getSite() != null) { - mappingPage.setSite(siteSelectionPage.getSite()); - mappingPage.setPreviousPage(page); - return mappingPage; - } else if(mainPage != null) { - return mainPage; - } else if(wizard != null) { - return wizard.getStartingPage(); - } - } - if(wizard != null) { - return wizard.getNextPage(page); - } - return super.getNextPage(page); - } - - public static MappingSelectionPage getMappingPage() { - return mappingPage; - } - - public boolean canFinish() { - // If we are on the first page, never allow finish unless the selected wizard has no pages. - IWizardPage currentPage = getContainer().getCurrentPage(); - if (currentPage == mainPage) { - if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) { - return true; - } - return false; - } else if(currentPage == siteSelectionPage) { - if(siteSelectionPage.getSite() != null || siteSelectionPage.isDisconnect()) { - return true; - } else { - return false; - } - } - - MappingSelectionPage mappingPage = getMappingPage(); - if(mappingPage != null && currentPage == mappingPage) { - return mappingPage.isPageComplete(); - } - if(wizard != null) { - return wizard.canFinish(); - } - return super.canFinish(); - } - - /* - * @see Wizard#performFinish - */ - public boolean performFinish() { - // handles finish on site selection page and on mapping page - IWizardPage currentPage = getContainer().getCurrentPage(); - if(currentPage == siteSelectionPage || currentPage == getMappingPage()) { - Site site; - if(currentPage == siteSelectionPage) { - // if the user selected the disconnect option then disconnect - // this project from the target - if(siteSelectionPage.isDisconnect()) { - try { - TargetManager.unmap(project); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("Error"), Policy.bind("ConfigureTargetWizard.errorUnmappingProject"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - return true; - } - site = siteSelectionPage.getSite(); - } else { - site = getMappingPage().getSite(); - } - // a site has been selected on either the site selection page or the - // mapping page. Use this site information to map the project to the - // target. - IPath path = Path.EMPTY; - if(getMappingPage() != null) { - path = getMappingPage().getMapping(); - } - if(! setMapping(getContainer(), project, site, path)) - return false; //mapping failed so fail finish - } - - // allow target wizard to finish - if (wizard != null) { - return wizard.performFinish(); - } - return true; - } - - public static boolean setMapping(IWizardContainer container, IProject project, Site site, IPath path) { - if(validateSite(site, container)) { - if(TargetManager.getSite(site.getType(), site.getURL()) == null) { - TargetManager.addSite(site); - } - try { - TargetProvider provider = TargetManager.getProvider(project); - if(provider != null) { - if(!provider.getSite().equals(site) && !MessageDialog.openQuestion(container.getShell(), - Policy.bind("ConfigureTargetWizardQuestion_2"), //$NON-NLS-1$ - Policy.bind("ConfigureTargetWizard.alreadyMapped", project.getName(), provider.getURL().toExternalForm()))) { //$NON-NLS-1$ - return false; - } - TargetManager.unmap(project); - } - TargetManager.map(project, site, path); - return true; - } catch (TeamException e) { - ErrorDialog.openError(container.getShell(), Policy.bind("ConfigureTargetWizardError_6"), Policy.bind("ConfigureTargetWizardError_mapping_the_project_with_this_site_7"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - } else { - return false; - } - } - - public static boolean validateSite(final Site site, final IWizardContainer container) { - final boolean[] valid = new boolean[] {true}; - final String[] message = new String[] {Policy.bind("ConfigureTargetWizardURL_doesn__t_exist_on_the_server_8")}; //$NON-NLS-1$ - final int[] code = new int[] {-1}; - try { - container.run(true, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(Policy.bind("ConfigureTargetWizardValidating_connection_to_Site..._9"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - IRemoteTargetResource remote = site.getRemoteResource(); - valid[0] = remote.canBeReached(monitor); - } catch(TeamException e) { - message[0] = e.getStatus().getMessage(); - code[0] = e.getStatus().getCode(); - valid[0] = false; - } finally { - monitor.done(); - } - } - }); - } catch (InvocationTargetException e) { - valid[0] = false; - message[0] = e.getTargetException().getMessage(); - } catch (InterruptedException e) { - return false; - } - if(! valid[0]) { - if(! MessageDialog.openQuestion(container.getShell(), - Policy.bind("ConfigureTargetWizardConnection_Error_10"), //$NON-NLS-1$ - Policy.bind("ConfigureTargetWizard.errorOccurred", new Object[] {site.getURL().toExternalForm(), new Integer(code[0]), message[0]}))) { //$NON-NLS-1$ - return false; - } - } - return true; - } - - /** - * Returns the configuration wizards that are available for invocation. - * - * @return the available wizards - */ - protected AdaptableList getAvailableWizards() { - AdaptableList result = new AdaptableList(); - IPluginRegistry registry = Platform.getPluginRegistry(); - IExtensionPoint point = registry.getExtensionPoint(pluginId, getExtensionPoint()); - if (point != null) { - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - for (int j = 0; j < elements.length; j++) { - IConfigurationElement element = elements[j]; - if (element.getName().equals(TAG_WIZARD)) { - ConfigurationWizardElement wizard = createWizardElement(element); - if (wizard != null) { - result.add(wizard); - } - } - } - } - } - - return result; - } - /** - * Returns a new ConfigurationWizardElement configured according to the parameters - * contained in the passed Registry. - * - * May answer null if there was not enough information in the Extension to create - * an adequate wizard - * - * @param element the element for which to create a wizard element - * @return the wizard element for the given element - */ - protected ConfigurationWizardElement createWizardElement(IConfigurationElement element) { - // WizardElements must have a name attribute - String nameString = element.getAttribute(ATT_NAME); - if (nameString == null) { - // Missing attribute - return null; - } - ConfigurationWizardElement result = new ConfigurationWizardElement(nameString); - if (initializeWizard(result, element)) { - // initialization was successful - return result; - } - return null; - } - /** - * Initialize the passed element's properties based on the contents of - * the passed registry. Answer a boolean indicating whether the element - * was able to be adequately initialized. - * - * @param element the element to initialize the properties for - * @param extension the registry to get properties from - * @return whether initialization was successful - */ - protected boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config) { - element.setID(config.getAttribute(ATT_ID)); - String description = ""; //$NON-NLS-1$ - IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION); - if (children.length >= 1) { - description = children[0].getValue(); - } - - element.setDescription(description); - - // apply CLASS and ICON properties - element.setConfigurationElement(config); - String iconName = config.getAttribute(ATT_ICON); - if (iconName != null) { - IExtension extension = config.getDeclaringExtension(); - element.setImageDescriptor(TeamImages.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; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java deleted file mode 100644 index 7ddc69d46..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * Action to create a new remote folder. - */ -public class CreateNewFolderAction extends TargetAction { - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedRemoteFolders().length == 1; - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - try { - TeamUIPlugin.runWithProgressDialog(getShell(), true /* cancelable */, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - createDir(getShell(), getSelectedRemoteFolders()[0], new String()); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - }); - } catch (InvocationTargetException e) { - handle(e, Policy.bind("Error"), Policy.bind("CreateNewFolderAction.errorCreatingFolder")); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (InterruptedException e) { - } - } - - /** - * Throws a TeamException if one occured. - * Returns null if the operation was cancelled or an exception occured - */ - public static IRemoteTargetResource createDir(final Shell shell, final IRemoteTargetResource parent, final String defaultName) throws TeamException { - final IRemoteTargetResource[] newFolder = new IRemoteTargetResource[] {null}; - try { - TeamUIPlugin.runWithProgressDialog(shell, true, new IRunnableWithProgress() { - public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(Policy.bind("CreateNewFolderAction.creatingFolder"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - final String[] folderName = new String[] {null}; - final String suggestedName = getSuggestedFolderName(parent, Policy.subMonitorFor(monitor, 0), defaultName); - shell.getDisplay().syncExec(new Runnable() { - public void run() { - InputDialog dialog = new InputDialog(shell, - Policy.bind("CreateNewFolderAction.title"), //$NON-NLS-1$ - Policy.bind("CreateNewFolderAction.message"), //$NON-NLS-1$ - suggestedName, - null); - Policy.checkCanceled(monitor); - if(dialog.open() == InputDialog.OK) { - folderName[0] = dialog.getValue(); - } - } - }); - if(folderName[0] != null) { - newFolder[0] = parent.getFolder(folderName[0]); - newFolder[0].mkdirs(Policy.subMonitorFor(monitor, 0)); - } - } catch(TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }); - } catch(InvocationTargetException e) { - if (e.getTargetException() instanceof TeamException) { - throw (TeamException)e.getTargetException(); - } - TeamUIPlugin.handle(e); - } catch(InterruptedException e) { - } - return newFolder[0]; - } - - protected static String getSuggestedFolderName(IRemoteTargetResource parent, IProgressMonitor monitor, String defaultName) throws TeamException { - IRemoteResource[] members; - monitor.subTask(Policy.bind("CreateNewFolderAction.suggestedNameProgress")); //$NON-NLS-1$ - members = parent.members(monitor); - ArrayList names = new ArrayList(); - - String suggestedFolderName = defaultName; - - boolean nameUsed = false; - - for (int i = 0; i < members.length; i++) { - String existingName = members[i].getName(); - names.add(existingName); // cache them for next round since faster - if(existingName.equals(suggestedFolderName)) { - nameUsed = true; - } - } - - if(!nameUsed) - return suggestedFolderName; - - //Otherwise, keep proposing new names by incrementing a postfix name index until we find one not used - int postfix = 1; - - String baseName = suggestedFolderName; - - do { - nameUsed = false; - for (int i = 0; i < members.length && !nameUsed; i++) { - suggestedFolderName = Policy.bind("CreateNewFolderAction.suggestedNameConcat", baseName, String.valueOf(postfix)); //$NON-NLS-1$ - String existingName = (String) names.get(i); - - if(existingName.equals(suggestedFolderName)) { - postfix = postfix + 1; - nameUsed = true; - } - } - } while(nameUsed); - return suggestedFolderName; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java deleted file mode 100644 index ddf1ff3ee..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.DetailsDialog; -import org.eclipse.team.internal.ui.Policy; - -/** - * Discards a remembered Site from Target Management. Before a Site can be - * discarded all resources using this site must be deconfigured. This action will - * prompt the user if a Site cannot be discarded because of existing connections. - */ -public class DiscardSiteAction extends TargetAction { - - private class AlreadyMappedDialog extends DetailsDialog { - private IProject[] projects; - private org.eclipse.swt.widgets.List detailsList; - private Button unmap; - - public AlreadyMappedDialog(Shell shell, IProject[] projects) { - super(shell, Policy.bind("SiteExplorerView.unmapDialogTitle")); //$NON-NLS-1$ - setImageKey(DLG_IMG_WARNING); - this.projects = projects; - } - - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - TargetProvider target; - try { - target = TargetManager.getProvider(project); - } catch (TeamException e) { - continue; - } - detailsList.add(Policy.bind("SiteExplorerView.mappedProjects", project.getName(), target.getURL().toExternalForm())); //$NON-NLS-1$ - } - return composite; - } - - protected void createMainDialogArea(Composite composite) { - Label label = new Label(composite, SWT.WRAP); - label.setText(Policy.bind("SiteExplorerView.projectsAlreadyMapped")); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(composite.getFont()); - - unmap = new Button(composite, SWT.CHECK); - unmap.setText(Policy.bind("SiteExplorerView.unmapProjectsAndDisconnect")); //$NON-NLS-1$ - unmap.setSelection(false); - unmap.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - updateEnablements(); - } - }); - setPageComplete(false); - updateEnablements(); - } - - protected void updateEnablements() { - setPageComplete(unmap.getSelection()); - } - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedSites().length > 0; - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - deletedSelected(); - } - - private void deletedSelected() { - try { - Site[] sites = getSelectedSites(); - if(sites.length > 0) { - - // sites are already mapped, ask if they want to unmap projects first - IProject[] mappedProjects = projectsMappedToSite(sites); - if( mappedProjects.length > 0 ) { - AlreadyMappedDialog dialog = new AlreadyMappedDialog(getShell(), mappedProjects); - if(dialog.open() == AlreadyMappedDialog.OK) { - for (int i = 0; i < mappedProjects.length; i++) { - TargetManager.unmap(mappedProjects[i]); - } - } else { - // nothing to do - return; - } - } else { - MessageDialog d = new MessageDialog(getShell(), - Policy.bind("SiteExplorerView.promptForDeletingSitesTitle"), //$NON-NLS-1$ - null, - Policy.bind("SiteExplorerView.promptForDeletingSites", new Integer(sites.length).toString()), //$NON-NLS-1$ - MessageDialog.QUESTION, - new String[] { - IDialogConstants.YES_LABEL, - IDialogConstants.CANCEL_LABEL }, 0); - if( d.open() != MessageDialog.OK ) { - return; - } - } - // sites aren't mapped, just ask then delete them form the view - // and from the target manager. - for (int i = 0; i < sites.length; i++) { - TargetManager.removeSite(sites[i]); - sites[i].dispose(); - } - } - } catch (TeamException e) { - ErrorDialog.openError(getShell(), - Policy.bind("Error"), //$NON-NLS-1$ - Policy.bind("CreateNewFolderAction.errorDeletingSites"), //$NON-NLS-1$ - e.getStatus()); - } - } - - private IProject[] projectsMappedToSite(Site[] sites) throws TeamException { - List mappedProjects = new ArrayList(); - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - TargetProvider target = TargetManager.getProvider(project); - for (int j = 0; j < sites.length; j++) { - if(target != null && target.getSite().equals(sites[j])) { - mappedProjects.add(project); - } - } - } - return (IProject[]) mappedProjects.toArray(new IProject[mappedProjects.size()]); - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java deleted file mode 100644 index da742ca59..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamWizardPage; - -/** - * This page allows the user to save the settings used by Target sites to a file. - */ -public class ExportTargetSiteMainPage extends TeamWizardPage { - private List selectedSites = new ArrayList(); - private Text fileText; - private String fileName = ""; //$NON-NLS-1$ - private Table table; - private Button browseButton; - - /** - * Constructor for ExportTargetSiteMainPage. - * @param pageName The name of the page. - */ - public ExportTargetSiteMainPage(String pageName) { - super(pageName); - } - - /** - * Constructor for ExportTargetSiteMainPage. - * @param pageName The name of the page - * @param title The title of the page - * @param titleImage The image for the page - */ - public ExportTargetSiteMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - createLabel(composite, Policy.bind("ExportTargetSiteMainPage.Select_Sites")); //$NON-NLS-1$ - - //TODO: add F1 help. - - table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - table.setLayout(new TableLayout()); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 300; - table.setLayoutData(data); - table.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - if (event.detail == SWT.CHECK) { - TableItem item = (TableItem) event.item; - if (item.getChecked()) { - selectedSites.add(item.getData()); - } else { - selectedSites.remove(item.getData()); - } - updateEnablement(); - } - } - }); - createLabel(composite, Policy.bind("ExportTargetSiteMainPage.Target_Site_Filename")); //$NON-NLS-1$ - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ExportTargetSiteMainPage.File_name")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (fileName != null) - fileText.setText(fileName); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - fileName = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ExportTargetSiteMainPage.Browse")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell(), SWT.SAVE); - d.setFilterExtensions(new String[] { "*.tsf" }); //$NON-NLS-1$ - d.setFilterNames(new String[] { Policy.bind("ExportTargetSiteMainPage.Target_Site_Files")}); //$NON-NLS-1$ - d.setFileName(Policy.bind("ExportTargetSiteMainPage.default")); //$NON-NLS-1$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - fileName = f; - } - } - }); - - initializeSites(); - setControl(composite); - updateEnablement(); - } - - public void setSelectedSites(Site[] selectedSites) { - this.selectedSites.addAll(Arrays.asList(selectedSites)); - } - - public void setFileName(String file) { - if (file != null) { - this.fileName = file; - } - } - - private void initializeSites() { - List siteList = new ArrayList(); - Site[] workspaceSites = TargetManager.getSites(); - for (int i = 0; i < workspaceSites.length; i++) { - TableItem item = new TableItem(table, SWT.NONE); - item.setData(workspaceSites[i]); - item.setText(workspaceSites[i].getDisplayName()); - } - } - - /** - * Returns the fileName. - * @return String - */ - public String getFileName() { - return fileName; - } - - public Site[] getSelectedSites() { - return (Site[]) selectedSites.toArray(new Site[selectedSites.size()]); - } - - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - private void updateEnablement() { - boolean complete; - if (selectedSites.size() == 0) { - setMessage(null); - complete = false; - } else if (fileName.length() == 0) { - setMessage(null); - complete = false; - } else { - File f = new File(fileName); - if (f.isDirectory()) { - setMessage(Policy.bind("ExportTargetSiteMainPage.folder_specified"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java deleted file mode 100644 index a5193d0c6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.DetailsDialog; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for getting the contents of the selected resources - */ -public class GetAction extends TargetAction { - - private class OutgoingChangesDialog extends DetailsDialog { - private IResource[] outgoingChanges; - private org.eclipse.swt.widgets.List detailsList; - - public OutgoingChangesDialog(Shell shell, IResource[] outgoingChanges) { - super(shell, Policy.bind("GetAction.confirmFileOverwriteTitle")); //$NON-NLS-1$ - setImageKey(DLG_IMG_QUESTION); - this.outgoingChanges = outgoingChanges; - } - - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - for (int i = 0; i < outgoingChanges.length; i++) { - detailsList.add(outgoingChanges[i].getFullPath().toString()); //$NON-NLS-1$ - } - return composite; - } - - protected void createMainDialogArea(Composite parent) { - Label label = new Label(parent, SWT.WRAP); - label.setText(Policy.bind("GetAction.confirmFileOverwrite")); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(parent.getFont()); - setPageComplete(true); - } - - protected void updateEnablements() { - } - } - - public void run(IAction action) { - if(promptForOutgoingChanges()) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - monitor.beginTask(null, keySet.size() * 1000); - - // perform the get on each provider - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - provider.get(providerResources, Policy.subInfiniteMonitorFor(monitor, 1000)); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("GetAction.title"), PROGRESS_DIALOG); //$NON-NLS-1$ - } - } - - private boolean promptForOutgoingChanges() { - try { - // find any outgoing changes that will be overwritten and prompt - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - - Iterator iterator = keySet.iterator(); - List outgoingChanges = new ArrayList(); - while (iterator.hasNext()) { - TargetProvider provider = (TargetProvider)iterator.next(); - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - outgoingChanges.addAll(Arrays.asList(findResourcesWithOutgoingChanges(providerResources))); - } - if(! outgoingChanges.isEmpty()) { - final OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), - (IResource[]) outgoingChanges.toArray(new IResource[outgoingChanges.size()])); - final boolean okToContinue[] = {true}; - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - if(dialog.open() != OutgoingChangesDialog.OK) { - okToContinue[0] = false; - } - } - }); - return okToContinue[0]; - } - return true; - } catch(CoreException e) { - TeamUIPlugin.handle(e); - } catch(TeamException e) { - TeamUIPlugin.handle(e); - } - return false; - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) - return false; - if(! provider.canPut(resource)) - return false; //if one can't don't allow for any - } - return true; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java deleted file mode 100644 index 70f476954..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.PromptingDialog; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.NewProjectAction; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.ProjectLocationSelectionDialog; - -/** - * Action to transfer a remote folder and it's contents into the workspace. If - * the remote folder doesn't have a .project then the project creation wizard - * is shown to configure a new project, otherwise the a prompt is shown to choose - * the project name and location. - * - * @see GetAsProjectAction - */ -public class GetAsAction extends GetAsProjectAction { - public void run(IAction action) { - - final IRemoteTargetResource[] folders = getSelectedRemoteFolders(); - if (folders.length != 1) return; - final IRemoteTargetResource remoteFolder = folders[0]; - final String remoteName = remoteFolder.getName(); - - // Fetch the members of the folder to see if they contain a .project file. - final boolean[] hasProjectMetaFile = new boolean[] { false }; - final boolean[] errorOccured = new boolean[] { false }; - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - hasProjectMetaFile[0] = hasProjectMetaFile(remoteFolder, monitor); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("GetAs.checkoutFailed"), PROGRESS_DIALOG); //$NON-NLS-1$ - if (errorOccured[0]) return; - - // Prompt outside a workspace runnable so that the project creation delta can be heard - IProject newProject = null; - if ( ! hasProjectMetaFile[0]) { - newProject = getNewProject(remoteFolder.getName()); - if (newProject == null) return; - } - - final IProject createdProject = newProject; - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - IProject project; - if (hasProjectMetaFile[0]) { - // Prompt for name - final Shell shell = getShell(); - final int[] result = new int[] { Dialog.OK }; - project = ResourcesPlugin.getWorkspace().getRoot().getProject(remoteName); - final ProjectLocationSelectionDialog dialog = new ProjectLocationSelectionDialog(shell, project); - dialog.setTitle(Policy.bind("GetAs.enterProjectTitle", remoteName)); //$NON-NLS-1$ - - shell.getDisplay().syncExec(new Runnable() { - public void run() { - result[0] = dialog.open(); - } - }); - if (result[0] != Dialog.OK) return; - - Object[] destinationPaths = dialog.getResult(); - if (destinationPaths == null) return; - String newName = (String) destinationPaths[0]; - IPath newLocation = new Path((String) destinationPaths[1]); - - // prompt if the project exists locally - project = ResourcesPlugin.getWorkspace().getRoot().getProject(newName); - PromptingDialog prompt = new PromptingDialog(getShell(), new IResource[] { project }, - getOverwriteLocalAndFileSystemPrompt(), Policy.bind("GetAsProject.confirmOverwrite"));//$NON-NLS-1$ - if (prompt.promptForMultiple().length == 0) return; - - monitor.beginTask(null, 100); - monitor.setTaskName(Policy.bind("GetAs.taskname", remoteFolder.getName(), newName)); //$NON-NLS-1$ - - // create the project - try { - if (newLocation.equals(Platform.getLocation())) { - // create in default location - project.create(Policy.subMonitorFor(monitor, 3)); - } else { - // create in some other location - IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()); - desc.setLocation(newLocation); - project.create(desc, Policy.subMonitorFor(monitor, 3)); - } - project.open(Policy.subMonitorFor(monitor, 2)); - } catch (CoreException e) { - throw new TeamException(e.getStatus()); - } - } else { - project = createdProject; - monitor.beginTask(null, 95); - monitor.setTaskName(Policy.bind("GetAs.taskname", remoteFolder.getName(), createdProject.getName())); //$NON-NLS-1$ - } - - get(project, remoteFolder, Policy.subInfiniteMonitorFor(monitor, 95)); - - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("GetAs.checkoutFailed"), PROGRESS_DIALOG); //$NON-NLS-1$ - } - - /* - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedRemoteFolders().length == 1; - } - - /** - * Get a new project. - * - * The suggestedName is not currently used but is a desired capability. - */ - private IProject getNewProject(String suggestedName) { - NewProjectListener listener = new NewProjectListener(); - ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE); - (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run(); - ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener); - return listener.getNewProject(); - } - - protected boolean hasProjectMetaFile(IRemoteTargetResource remote, IProgressMonitor monitor) throws TeamException { - IRemoteResource[] children = remote.members(monitor); - for (int i = 0; i < children.length; i++) { - if(children[i].getName().equals(".project")) { //$NON-NLS-1$ - return true; - } - } - return false; - } - - class NewProjectListener implements IResourceChangeListener { - private IProject newProject = null; - /** - * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent) - */ - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta root = event.getDelta(); - IResourceDelta[] projectDeltas = root.getAffectedChildren(); - for (int i = 0; i < projectDeltas.length; i++) { - IResourceDelta delta = projectDeltas[i]; - IResource resource = delta.getResource(); - if (delta.getKind() == IResourceDelta.ADDED) { - newProject = (IProject)resource; - } - } - } - /** - * Gets the newProject. - * @return Returns a IProject - */ - public IProject getNewProject() { - return newProject; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java deleted file mode 100644 index 11ddbf920..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.io.File; -import java.util.HashSet; -import java.util.Set; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.PromptingDialog; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * Action to transfer a remote folder and it's contents into the workspace. The - * resulting project is named with the remote folder name and the kind of project - * is determined by the remote .project file. If the remote folder doesn't not - * contain a .project, then the project default simple type is used. - * - * @see GetAsAction - */ -public class GetAsProjectAction extends TargetAction { - - public void run(IAction action) { - - final IRemoteTargetResource[] remoteFolders = getSelectedRemoteFolders(); - - Set targetProjects = new HashSet(); - for (int i = 0; i < remoteFolders.length; i++) { - String projectName = remoteFolders[i].getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - targetProjects.add(project); - } - final IResource[] projects = (IResource[]) targetProjects.toArray(new IResource[targetProjects.size()]); - PromptingDialog prompt = new PromptingDialog(getShell(), projects, - getOverwriteLocalAndFileSystemPrompt(), - Policy.bind("GetAsProject.confirmOverwrite"));//$NON-NLS-1$ - - try { - if (prompt.promptForMultiple().length != projects.length) return; - } catch (InterruptedException e) { - return; - } - - try { - TeamUIPlugin.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.beginTask(getTaskName(remoteFolders), remoteFolders.length * 100); - monitor.setTaskName(getTaskName(remoteFolders)); - for (int i = 0; i < remoteFolders.length; i++) { - IProject project = (IProject)projects[i]; - IRemoteTargetResource remote = remoteFolders[i]; - IProgressMonitor subMonitor = Policy.subInfiniteMonitorFor(monitor, 100); - get(project, remote, subMonitor); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }); - } catch (InvocationTargetException e) { - handle(e, Policy.bind("Error"), Policy.bind("GetAsProject.errorGettingResources")); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (InterruptedException e) { - return; - } - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - return getSelectedRemoteFolders().length > 0; - } - - protected void get(IProject project, IRemoteTargetResource remote, IProgressMonitor monitor) throws TeamException { - try { - monitor.beginTask(null, 100); - try { - if(!project.exists()) { - project.create(Policy.subMonitorFor(monitor, 5)); - } - if(!project.isOpen()) { - project.open(Policy.subMonitorFor(monitor, 5)); - } - } catch (CoreException e) { - ErrorDialog.openError(getShell(), Policy.bind("Error"), Policy.bind("GetAsProject.errorCreatingProject"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - Site site = remote.getSite(); - TargetProvider provider = TargetManager.getProvider(project); - if(provider != null) { - TargetManager.unmap(project); - } - TargetManager.map(project, site, UrlUtil.getTrailingPath(remote.getURL(), site.getURL())); - provider = TargetManager.getProvider(project); - provider.get(project, remote, Policy.subMonitorFor(monitor, 90)); - } finally { - monitor.done(); - } - } - - protected static String getTaskName(IRemoteTargetResource[] remoteFolders) { - if (remoteFolders.length == 1) { - IRemoteTargetResource folder = remoteFolders[0]; - return Policy.bind("GetAsProject.taskName1", folder.getURL().toExternalForm()); //$NON-NLS-1$ - } - else { - return Policy.bind("GetAsProject.taskNameN", new Integer(remoteFolders.length).toString()); //$NON-NLS-1$ - } - } - - protected IPromptCondition getOverwriteLocalAndFileSystemPrompt() { - return new IPromptCondition() { - // prompt if resource in workspace exists or exists in local file system - public boolean needsPrompt(IResource resource) { - File localLocation = getFileLocation(resource); - if(resource.exists() || localLocation.exists()) { - return true; - } - return false; - } - public String promptMessage(IResource resource) { - File localLocation = getFileLocation(resource); - if(resource.exists()) { - return Policy.bind("GetAsProject.thisResourceExists", resource.getName());//$NON-NLS-1$ - } else { - return Policy.bind("GetAsProject.thisExternalFileExists", resource.getName());//$NON-NLS-1$ - }//$NON-NLS-1$ - } - private File getFileLocation(IResource resource) { - return new File(resource.getParent().getLocation().toFile(), resource.getName()); - } - }; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java deleted file mode 100644 index 3badc596c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.ITeamNode; -import org.eclipse.team.internal.ui.sync.SyncSet; -import org.eclipse.ui.help.WorkbenchHelp; - -public class GetSyncAction extends TargetSyncAction { - - public GetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) { - super(model, sp, label, shell); - WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_GET_ACTION); - } - - /** - * @see TargetSyncAction#isEnabled(ITeamNode) - */ - protected boolean isEnabled(ITeamNode node) { - // Get action is enabled for any changed nodes. - SyncSet set = new SyncSet(new StructuredSelection(node)); - return set.hasIncomingChanges() || set.hasConflicts(); - } - - /** - * @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int) - */ - protected void removeNonApplicableNodes(SyncSet set, int syncMode) { - set.removeOutgoingNodes(); - } - - /** - * @see TargetSyncAction#run(SyncSet, IProgressMonitor) - */ - protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) { - try { - ITeamNode[] changed = syncSet.getChangedNodes(); - if (changed.length == 0) { - return syncSet; - } - List fileResources = new ArrayList(); - List folderDeletions = new ArrayList(); - List folderAdditions = new ArrayList(); - //Find the incoming file changes the potential incoming folder deletions: - for (int i = 0; i < changed.length; i++) { - if (changed[i].getChangeDirection()==ITeamNode.INCOMING || changed[i].getChangeDirection()==ITeamNode.CONFLICTING) { - if (changed[i].getResource().getType()==IResource.FILE) fileResources.add(changed[i].getResource()); - else if (changed[i].getChangeType()==Differencer.DELETION - && /*don't delete nonexistant folders*/changed[i].getResource().exists()) - folderDeletions.add(changed[i].getResource()); - else { - //If the new remote folders have no children then we'd better explicitly create them locally: - IResource resource=changed[i].getResource(); - if (getRemoteResourceFor(resource).members(monitor).length==0) - folderAdditions.add(changed[i].getResource()); - } - } - } - get((IResource[])fileResources.toArray(new IResource[fileResources.size()]), monitor); - get((IResource[])folderAdditions.toArray(new IResource[folderDeletions.size()]), monitor); - if (folderDeletions.size()>0) { - //Prune the list of potential incoming folder deletions, retaining only those that don't have local content: - boolean delete; - Iterator iter=folderDeletions.iterator(); - for (IContainer container=(IContainer)iter.next(); iter.hasNext(); container=(IContainer)iter.next()) { - delete=true; - IResource[] children=container.members(); - for (int j = 0; j < children.length; j++) { - if (!folderDeletions.contains(children[j])) { - delete=false; - break; - } - } - if (!delete) iter.remove(); - } - get((IResource[])folderDeletions.toArray(new IResource[folderDeletions.size()]), monitor); - } - } catch (final TeamException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } catch (final CoreException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } - return syncSet; - } - - /** - * Put the given resources to their associated providers. - * - * @param resources the resources to commit - * @param monitor the progress monitor - */ - public void get(IResource[] resources, IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - Hashtable table = getTargetProviderMapping(resources); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000); - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - provider.get(providerResources, subMonitor); - } - } finally { - monitor.done(); - } - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java deleted file mode 100644 index 8cdb4ab54..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -import java.io.File; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamWizardPage; - -public class ImportTargetSiteMainPage extends TeamWizardPage { - private Text fileText; - private String file = ""; //$NON-NLS-1$ - private Button browseButton; - - /** - * @see org.eclipse.jface.wizard.WizardPage#WizardPage(String, String, ImageDescriptor) - */ - public ImportTargetSiteMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - private void updateEnablement() { - boolean complete; - - if (file.length() == 0) { - setMessage(null); - complete = false; - } else { - // See if the file exists - File f = new File(file); - if (!f.exists()) { - setMessage(Policy.bind("ImportTargetSiteMainPage.nonexistent_file"), ERROR); //$NON-NLS-1$ - complete = false; - } else if (f.isDirectory()) { - setMessage(Policy.bind("ImportTargetSiteMainPage.folder_specified"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - - /** - * single-use mutator - * @param file The name to use for the file. - */ - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - - /** - * Method getFileName. - * @return String - */ - public String getFileName() { - return file; - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) - */ - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - //TODO: add F1 help. - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ImportTargetSiteMainPage.File_name")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ImportTargetSiteMainPage.Browse")); //$NON-NLS-1$ - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell()); - d.setFilterExtensions(new String[] {"*.tsf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterNames(new String[] {Policy.bind("ImportTargetSiteMainPage.Target_Site_Files"), Policy.bind("ImportTargetSiteMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - setControl(composite); - updateEnablement(); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java deleted file mode 100644 index c9ba1d7d6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class MappingSelectionPage extends TargetWizardPage { - private IPath path = Path.EMPTY; - private Site site; - private TreeViewer viewer; - private Text textPath; - - public MappingSelectionPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - setDescription(Policy.bind("MappingSelectionPage.description")); //$NON-NLS-1$ - } - - public void setSite(Site site) { - this.site = site; - } - - public Site getSite() { - return site; - } - - public void createControl(Composite p) { - Composite composite = createComposite(p, 1); - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.TARGET_MAPPING_SELECTION_PAGE); - - createLabel(composite, Policy.bind("MappingSelectionPage.label")); //$NON-NLS-1$ - - viewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE); - - GridData data = new GridData (GridData.FILL_BOTH); - viewer.getTree().setLayoutData(data); - viewer.setContentProvider(new SiteLazyContentProvider()); - viewer.setLabelProvider(new WorkbenchLabelProvider()); - viewer.setSorter(new SiteViewSorter()); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateTextPath(); - } - }); - - // include only folders in view - viewer.addFilter(new ViewerFilter() { - public boolean select(Viewer viewer, Object parentElement, Object element) { - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getRemoteResource().isContainer(); - } - return false; - } - }); - - Button newFolderButton = new Button(composite, SWT.PUSH); - newFolderButton.setText(Policy.bind("MappingSelectionPage.newFolderLabel")); //$NON-NLS-1$ - newFolderButton.addListener(SWT.Selection, new Listener() { - public void handleEvent (Event event) { - Shell shell = getShell(); - try { - // assume that only one folder is selected in the folder tree - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - Object currentSelection = selection.getFirstElement(); - final IRemoteTargetResource selectedFolder = getSelectedRemoteFolder(selection); - String defaultName = ((ConfigureTargetWizard) getWizard()).project.getName(); - - IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(getShell(), selectedFolder, defaultName); - if (newFolder == null) - return; - - RemoteResourceElement newFolderUIElement = new RemoteResourceElement(newFolder); - - ((RemoteResourceElement)currentSelection).setCachedChildren(null); - viewer.refresh(currentSelection); - viewer.setExpandedState(currentSelection, true); - viewer.setSelection(new StructuredSelection(newFolderUIElement)); - } catch (TeamException e) { - TeamUIPlugin.handle(e); - return; - } - } - }); - setViewerInput(); - setControl(composite); - setPageComplete(true); - } - - private IRemoteTargetResource getSelectedRemoteFolder(IStructuredSelection selection) { - if (!selection.isEmpty()) { - final List filesSelection = new ArrayList(); - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if(o instanceof RemoteResourceElement) { - return ((RemoteResourceElement)o).getRemoteResource(); - } else if(o instanceof SiteElement) { - try { - return ((SiteElement)o).getSite().getRemoteResource(); - } catch (TeamException e) { - return null; - } - } - } - } - return null; - } - - /** - * Method updateTextPath. - */ - private void updateTextPath() { - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - if (!selection.isEmpty()) { - final List filesSelection = new ArrayList(); - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if(o instanceof RemoteResourceElement) { - RemoteResourceElement element = (RemoteResourceElement) o; - URL remoteResourceURL; - remoteResourceURL = element.getRemoteResource().getURL(); - this.path = UrlUtil.getTrailingPath( - remoteResourceURL, - this.site.getURL()); - return; - } - } - } - } - - public IPath getMapping() { - return this.path; - } - - /** - * Attempt to set the viewer input. - * Do nothing if we don't have enough info yet to set it. - */ - private void setViewerInput() { - if(this.site == null || viewer == null) - return; - viewer.setInput(new SiteRootsElement(new Site[] {site}, getContainer())); - } - - /** - * @see IDialogPage#setVisible(boolean) - */ - public void setVisible(boolean visible) { - if(visible) { - setViewerInput(); - viewer.setSelection(new StructuredSelection(new SiteElement(site))); - } - super.setVisible(visible); - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java deleted file mode 100644 index 663cec2ba..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.dialogs.PropertyPage; - -public class ProjectTargetMappingPropertiesPage extends PropertyPage { - public static final int WIDTH_HINT = 250; - - private IProject proj; - private Site site = null; - private IPath mapping; - private TargetProvider origProvider=null; - - private Label serverText,folderText; - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - initialize(); - Composite container = new Composite(parent, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - - Label serverLabel = new Label(container, SWT.NONE); - serverLabel.setText(Policy.bind("ProjectTargetMappingPropertiesPage.URL")); //$NON-NLS-1$ - serverText = new Label(container, SWT.NONE); - serverText.setText(site.getURL().toString()); - GridData data = new GridData(); - data.widthHint = WIDTH_HINT; - serverText.setLayoutData(data); - - Label folderLabel = new Label(container, SWT.NONE); - folderLabel.setText(Policy.bind("ProjectTargetMappingPropertiesPage.FolderName")); //$NON-NLS-1$ - folderText = new Label(container, SWT.NONE); - folderText.setText(mapping.toString()); - data = new GridData(); - data.widthHint = WIDTH_HINT; - folderText.setLayoutData(data); - - Button change = new Button(container, SWT.PUSH); - change.setText(Policy.bind("ProjectTargetMappingPropertiesPage.ChangeBtn")); //$NON-NLS-1$ - change.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - ConfigureTargetWizard wizard = new ConfigureTargetWizard(); - wizard.init(null, proj); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.open(); - refreshInfo(); - } - }); - - return container; - } - - private void initialize() { - IAdaptable element = getElement(); - if (element instanceof IProject) { - proj = ((IProject) element).getProject(); - } else { - IProject adapter = (IProject) element.getAdapter(IProject.class); - if (adapter != null) { - proj = adapter.getProject(); - } - } - try { - TargetProvider provider = TargetManager.getProvider(proj); - if (origProvider==null) origProvider=provider; - site = provider.getSite(); - mapping = UrlUtil.getTrailingPath(provider.getURL(), site.getURL()); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("ProjectTargetMappingPropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$ - } - } - - private void refreshInfo() { - initialize(); - serverText.setText(site.getURL().toString()); - folderText.setText(mapping.toString()); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - super.performDefaults(); - IPath oldMapping = UrlUtil.getTrailingPath(origProvider.getURL(), origProvider.getSite().getURL()); - try { - TargetManager.unmap(proj); - TargetManager.map(proj, origProvider.getSite(), oldMapping); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("ProjectTargetMappingPropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$ - } - refreshInfo(); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java deleted file mode 100644 index 42fb231e8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for checking in the selected resources - */ -public class PutAction extends TargetAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000); - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("PutAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - - provider.put(providerResources, subMonitor); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("PutAction.title"), PROGRESS_DIALOG); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) - return false; - if(! provider.canGet(resource)) - return false; //if one can't don't allow for any - } - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java deleted file mode 100644 index 52100ef2b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.ITeamNode; -import org.eclipse.team.internal.ui.sync.SyncSet; -import org.eclipse.team.internal.ui.sync.SyncView; -import org.eclipse.ui.help.WorkbenchHelp; - -public class PutSyncAction extends TargetSyncAction { - - public PutSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) { - super(model, sp, label, shell); - WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_PUT_ACTION); - } - - /** - * @see TargetSyncAction#isEnabled(ITeamNode) - */ - protected boolean isEnabled(ITeamNode node) { - // Put action is enabled for any changed nodes. - return new SyncSet(new StructuredSelection(node)).getChangedNodes().length > 0; - } - - /** - * @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int) - */ - protected void removeNonApplicableNodes(SyncSet set, int syncMode) { - if (syncMode == SyncView.SYNC_OUTGOING) { - set.removeIncomingNodes(); - } - } - - /** - * @see TargetSyncAction#run(SyncSet, IProgressMonitor) - */ - protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) { - try { - ITeamNode[] changed = syncSet.getChangedNodes(); - if (changed.length == 0) { - return syncSet; - } - List fileResources = new ArrayList(); - List folderDeletions = new ArrayList(); - List folderAdditions = new ArrayList(); - //Find the outgoing file changes the potential outgoing folder deletions: - for (int i = 0; i < changed.length; i++) { - if (changed[i].getChangeDirection()==ITeamNode.OUTGOING || changed[i].getChangeDirection()==ITeamNode.CONFLICTING) { - if (changed[i].getResource().getType()==IResource.FILE) fileResources.add(changed[i].getResource()); - else if (changed[i].getChangeType()==Differencer.DELETION) - folderDeletions.add(changed[i].getResource()); - else if (((IContainer)(changed[i].getResource())).members().length==0) - ////If the new local folders have no children then we'd better explicitly create them remotely: - folderAdditions.add(changed[i].getResource()); - } - } - put((IResource[])fileResources.toArray(new IResource[fileResources.size()]), monitor); - if (folderAdditions.size()>0) - put((IResource[])folderAdditions.toArray(new IResource[folderDeletions.size()]), monitor); - if (folderDeletions.size()>0) { - //Prune the list of potential outgoing folder deletions, retaining only those that don't have remote content: - boolean delete; - Iterator iter=folderDeletions.iterator(); - for (IContainer i=(IContainer)iter.next(); iter.hasNext(); i=(IContainer)iter.next()) { - delete=true; - IRemoteResource[] children=getRemoteResourceFor(i).members(monitor); - for (int j = 0; j < children.length; j++) { - if (!folderDeletions.contains(children[j])) { - delete=false; - break; - } - } - if (!delete) iter.remove(); - } - put((IResource[])folderDeletions.toArray(new IResource[folderDeletions.size()]), monitor); - } - } catch (final TeamException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } catch (final CoreException e) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - }); - return null; - } - return syncSet; - } - - /** - * Put the given resources to their associated providers. - * - * @param resources the resources to commit - * @param monitor the progress monitor - */ - public void put(IResource[] resources, IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - Hashtable table = getTargetProviderMapping(resources); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000); - TargetProvider provider = (TargetProvider)iterator.next(); - monitor.setTaskName(Policy.bind("PutAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - List list = (List)table.get(provider); - IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]); - provider.put(providerResources, subMonitor); - } - } finally { - monitor.done(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java deleted file mode 100644 index 4e043f44d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * Used to show IRemoteTargetResource instances in the UI. In addition these elements - * support caching of values returned from IRemoteTargetResource methods, as such these - * instances aren't as much proxies as the underlying remote handles. - *

    - * Implementation in progress: support for configuring these elements with a custom - * progress monitor that can be the target of long running operations. This will - * allow showing progress in wizards and in the SiteExplorerView when navigating - * remote servers.

    - */ -public class RemoteResourceElement implements IWorkbenchAdapter, IAdaptable { - - // remote resource this element represents - private IRemoteTargetResource remote; - - // cache for the remote values - private IRemoteResource[] children = null; - private int size = 0; - private String lastModified = null; - - // context in which to perform long-running operations - private IRunnableContext runContext; - - public RemoteResourceElement(IRemoteTargetResource remote) { - this.remote = remote; - } - - public RemoteResourceElement(IRemoteTargetResource remote, IRunnableContext runContext) { - this(remote); - this.runContext = runContext; - } - - public IRemoteTargetResource getRemoteResource() { - return remote; - } - - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) return this; - return null; - } - - public Object[] getChildren(Object o) { - final Object[][] result = new Object[1][]; - try { - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - // progress for fetching remote children is always unknown - // let's not bother even trying to guess. - monitor.beginTask(null, IProgressMonitor.UNKNOWN); - if(children == null) { - setCachedChildren(remote.members(Policy.subMonitorFor(monitor, 50))); - } - List remoteElements = new ArrayList(); - for (int i = 0; i < children.length; i++) { - IRemoteTargetResource child = (IRemoteTargetResource)children[i]; - RemoteResourceElement element = new RemoteResourceElement(child, runContext); - - // cache size and last modified - element.setLastModified(child.getLastModified(Policy.subMonitorFor(monitor, 25))); - element.setSize(child.getSize(Policy.subMonitorFor(monitor, 25))); - remoteElements.add(element); - } - result[0] = (RemoteResourceElement[])remoteElements.toArray(new RemoteResourceElement[remoteElements.size()]); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - - if(runContext == null) { - TeamUIPlugin.runWithProgress(null, true /*cancelable*/, runnable); - } else { - runContext.run(true, true, runnable); - } - } catch (InterruptedException e) { - return new Object[0]; - } catch (InvocationTargetException e) { - TeamUIPlugin.handle(e.getTargetException()); - return new Object[0]; - } - return result[0]; - } - - public ImageDescriptor getImageDescriptor(Object object) { - if(remote.isContainer()) { - return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); - } else { - return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(remote.getName()); - } - } - - public String getLabel(Object o) { - // would be nice to display more than just the name (e.g. timestamp, size...) - return remote.getName(); - } - - public Object getParent(Object o) { - return null; - } - - public int hashCode() { - return getRemoteResource().hashCode(); - } - - public boolean equals(Object obj) { - if(this == obj) - return true; - if(!(obj instanceof RemoteResourceElement)) - return false; - return ((RemoteResourceElement)obj).getRemoteResource().equals(getRemoteResource()); - } - - public void clearChildren() { - children = null; - } - - public IRemoteResource[] getCachedChildren() { - return children; - } - - public void setCachedChildren(IRemoteResource[] children) { - this.children = children; - } - - protected void setRemoteResource(IRemoteTargetResource remote) { - this.remote = remote; - } - - public String getLastModified() { - return lastModified; - } - - public int getSize() { - return size; - } - - public void setLastModified(String lastModified) { - this.lastModified = lastModified; - } - - public void setSize(int size) { - this.size = size; - } - - public String getName() { - return remote.getName(); - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java deleted file mode 100644 index fa4d97908..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.TeamImages; - -/** - * Used to show Site instances in the UI. Sites are really just remote - * resources but are shown with a different icon and label. - * - * @see RemoteResourceElement - */ -public class SiteElement extends RemoteResourceElement { - private Site site; - - public SiteElement(Site site) { - super(null); - this.site = site; - } - - public SiteElement(Site site, IRunnableContext runContext) { - super(null, runContext); - this.site = site; - } - - public Site getSite() { - return site; - } - - public int hashCode() { - return site.hashCode(); - } - - public ImageDescriptor getImageDescriptor(Object object) { - return TeamImages.getImageDescriptor(UIConstants.IMG_SITE_ELEMENT); - } - - public String getLabel(Object o) { - return getSite().getDisplayName(); - } - - public Object getParent(Object o) { - return null; - } - - public boolean equals(Object obj) { - if(this == obj) - return true; - if(!(obj instanceof SiteElement)) - return false; - Site otherSite = ((SiteElement)obj).getSite(); - return getSite().equals(otherSite); - } - /** - * @see IWorkbenchAdapter#getChildren(Object) - */ - public Object[] getChildren(Object o) { - try { - setRemoteResource(site.getRemoteResource()); - } catch (TeamException e) { - TeamUIPlugin.handle(e); - return new Object[0]; - } - return super.getChildren(this); - } - /** - * @see RemoteResourceElement#getRemoteResource() - */ - public IRemoteTargetResource getRemoteResource() { - try { - return site.getRemoteResource(); - } catch (TeamException e) { - TeamUIPlugin.handle(e); - return null; - } - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java deleted file mode 100644 index d3bcd2ac0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java +++ /dev/null @@ -1,562 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.*; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.ISiteListener; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.dialogs.PropertyDialogAction; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.WorkbenchImages; -import org.eclipse.ui.model.WorkbenchLabelProvider; -import org.eclipse.ui.part.ViewPart; - -/** - * Is a view that allows browsing remote target sites. It is modeled after - * a file explorer: a tree of folders is show with a table of the folder's - * contents. - *

    - * Progress is shown in the main workbench window's status line progress - * monitor.

    - * - * @see Site - * @see IRemoteTargetResource - */ -public class SiteExplorerView extends ViewPart implements ISiteListener { - - public static final String VIEW_ID = "org.eclipse.team.ui.target.SiteExplorerView"; //$NON-NLS-1$ - - // The tree viewer showing the folders and sites - private TreeViewer folderTree; - - // The table view that shows the resources in the currently selected folder - // from the folders tree. - private TableViewer folderContentsTable; - - // The root - private SiteRootsElement root; - - // Embedded progress monitor part used to display progress when contacting the server - // Note: this feature is not enabled yet and is still under construction - private IProgressMonitor progressMonitorPart; - - // The view's actions - private Action addSiteAction; - private Action newFolderAction; - private PropertyDialogAction propertiesAction; - - /** - * Sorter for the folderContents table - */ - class FolderListingSorter extends ViewerSorter { - private boolean reversed = false; - private int columnNumber; - - public static final int NAME = 0; - public static final int SIZE = 1; - public static final int MODIFIED = 2; - - // column headings: "Name" "Size" "Modified" - private int[][] SORT_ORDERS_BY_COLUMN = { - {NAME}, /* name */ - {SIZE, NAME}, /* size */ - {MODIFIED, NAME, SIZE}, /* modified */ - }; - - public FolderListingSorter(int columnNumber) { - this.columnNumber = columnNumber; - } - - public int compare(Viewer viewer, Object o1, Object o2) { - RemoteResourceElement e1 = (RemoteResourceElement)o1; - RemoteResourceElement e2 = (RemoteResourceElement)o2; - int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber]; - int result = 0; - for (int i = 0; i < columnSortOrder.length; ++i) { - result = compareColumnValue(columnSortOrder[i], e1, e2); - if (result != 0) - break; - } - if (reversed) - result = -result; - return result; - } - - int compareColumnValue(int columnNumber, RemoteResourceElement e1, RemoteResourceElement e2) { - IRemoteTargetResource r1 = e1.getRemoteResource(); - IRemoteTargetResource r2 = e2.getRemoteResource(); - switch (columnNumber) { - case NAME: - if (r1.isContainer() && r2.isContainer()) - return compareNames(r1, r2); - else if (r1.isContainer()) - return -1; - else if (r2.isContainer()) - return 1; - return compareNames(r1, r2); - case SIZE: - return new Integer(e1.getSize()).compareTo(new Integer(e2.getSize())); - case MODIFIED: - return getCollator().compare(e1.getLastModified(), e2.getLastModified()); - default: - return 0; - } - } - - protected int compareNames(IRemoteTargetResource resource1, IRemoteTargetResource resource2) { - return resource1.getName().compareTo(resource2.getName()); - } - - /** - * Returns the number of the column by which this is sorting. - */ - public int getColumnNumber() { - return columnNumber; - } - - /** - * Returns true for descending, or false - * for ascending sorting order. - */ - public boolean isReversed() { - return reversed; - } - - /** - * Sets the sorting order. - */ - public void setReversed(boolean newReversed) { - reversed = newReversed; - } - } - - /** - * @see IWorkbenchPart#createPartControl(Composite) - */ - public void createPartControl(Composite top) { - Composite p = new Composite(top, SWT.NULL); - GridData data = new GridData (GridData.FILL_BOTH); - p.setLayoutData(data); - GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 3; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - p.setLayout (gridLayout); - - SashForm sash = new SashForm(p, SWT.HORIZONTAL); - data = new GridData(GridData.FILL_BOTH); - data.horizontalSpan = 3; - sash.setLayoutData(data); - - folderTree = new TreeViewer(sash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - folderTree.setContentProvider(new SiteLazyContentProvider()); - folderTree.setLabelProvider(new WorkbenchLabelProvider()); - - folderTree.setSorter(new SiteViewSorter()); - folderTree.getControl().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent event) { - if (event.keyCode == SWT.F5) { - RemoteResourceElement[] selectedFolders = getSelectedRemoteFolder((IStructuredSelection)folderTree.getSelection()); - if(selectedFolders.length == 1) { - selectedFolders[0].setCachedChildren(null); - folderTree.refresh(selectedFolders[0]); - updateFileTable(selectedFolders[0]); - } - } - } - }); - - folderTree.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - final RemoteResourceElement[] remoteFolders = getSelectedRemoteFolder(selection); - if(remoteFolders.length == 1) { - updateFileTable(remoteFolders[0]); - } - } - }); - - folderTree.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent e) { - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - if(selection.size() == 1) { - expandInTreeCurrentSelection(selection, true /*toggle expanded*/); - } - } - }); - - folderTree.setSorter(new ViewerSorter() { - public int compare(Viewer viewer, Object e1, Object e2) { - String name1 = ""; //$NON-NLS-1$ - String name2 = ""; //$NON-NLS-1$ - if(e1 instanceof RemoteResourceElement) { - name1 = ((RemoteResourceElement)e1).getRemoteResource().getName(); - } else if(e1 instanceof SiteElement) { - name1 = ((SiteElement)e1).getSite().getURL().toExternalForm(); - } - if(e2 instanceof RemoteResourceElement) { - name2 = ((RemoteResourceElement)e2).getRemoteResource().getName(); - } else if(e2 instanceof SiteElement) { - name2 = ((SiteElement)e2).getSite().getURL().toExternalForm(); - } - - return getCollator().compare(name1, name2); - } - }); - - // show only folders in tree - folderTree.addFilter(new ViewerFilter() { - public boolean select(Viewer viewer, Object parentElement, Object element) { - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getRemoteResource().isContainer(); - } - return false; - } - }); - - Table table = new Table(sash, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - - TableColumn tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.Name_1")); //$NON-NLS-1$ - tableColumn.addSelectionListener(getColumnListener()); - layout.addColumnData(new ColumnWeightData(30, true)); - - tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.Size_2")); //$NON-NLS-1$ - tableColumn.setAlignment(SWT.RIGHT); - tableColumn.addSelectionListener(getColumnListener()); - layout.addColumnData(new ColumnWeightData(10, true)); - - tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.Modified_3")); //$NON-NLS-1$ - tableColumn.addSelectionListener(getColumnListener()); - layout.addColumnData(new ColumnWeightData(30, true)); - - tableColumn = new TableColumn(table, SWT.NULL); - tableColumn.setText(Policy.bind("SiteExplorerView.URL_4")); //$NON-NLS-1$ - layout.addColumnData(new ColumnWeightData(30, true)); - - folderContentsTable = new TableViewer(table); - folderContentsTable.setContentProvider(new SiteLazyContentProvider()); - folderContentsTable.setLabelProvider(new SiteExplorerViewLabelProvider()); - - folderContentsTable.getControl().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent event) { - if (event.keyCode == SWT.F5) { - RemoteResourceElement folder = (RemoteResourceElement)folderContentsTable.getInput(); - if(folder != null) { - folder.setCachedChildren(null); - folderContentsTable.refresh(); - } - } - } - }); - - folderContentsTable.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent e) { - IStructuredSelection selection = (IStructuredSelection)folderContentsTable.getSelection(); - if(selection.size() == 1) { - final RemoteResourceElement[] remoteFolders = getSelectedRemoteFolder(selection); - if(remoteFolders.length == 1) { - IStructuredSelection treeSelection = (IStructuredSelection)folderTree.getSelection(); - expandInTreeCurrentSelection(treeSelection, false /*don't toggle*/); - folderTree.setSelection(new StructuredSelection(remoteFolders[0])); - } - } - } - }); - FolderListingSorter sorter = new FolderListingSorter(FolderListingSorter.NAME); - sorter.setReversed(false); - folderContentsTable.setSorter(sorter); - - sash.setWeights(new int[] {33, 67}); - - TargetManager.addSiteListener(this); - - root = new SiteRootsElement(getViewSite().getWorkbenchWindow()); - initalizeActions(); - folderTree.setInput(root); - - // F1 Help - WorkbenchHelp.setHelp(folderTree.getControl(), IHelpContextIds.SITE_EXPLORER_VIEW); - } - - private Shell getShell() { - return folderTree.getTree().getShell(); - } - - private RemoteResourceElement[] getSelectedRemoteFolder(IStructuredSelection selection) { - if (!selection.isEmpty()) { - final List folders = new ArrayList(); - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if(o instanceof RemoteResourceElement) { - folders.add(o); - } - } - return (RemoteResourceElement[]) folders.toArray(new RemoteResourceElement[folders.size()]); - } - return new RemoteResourceElement[0]; - } - - private void expandInTreeCurrentSelection(IStructuredSelection selection, boolean toggle) { - if (!selection.isEmpty()) { - Iterator it = selection.iterator(); - while(it.hasNext()) { - Object element = it.next(); - if(toggle) { - folderTree.setExpandedState(element, !folderTree.getExpandedState(element)); - } else { - folderTree.setExpandedState(element, true); - } - } - } - } - - /** - * Method updateFileTable. - */ - private void updateFileTable(RemoteResourceElement remoteFolder) { - if(remoteFolder != null && !remoteFolder.equals(folderContentsTable.getInput())) { - folderContentsTable.setInput(remoteFolder); - } - } - - private void initalizeActions() { - final Shell shell = folderContentsTable.getTable().getShell(); - // Create actions - - // Refresh (toolbar) - addSiteAction = new Action(Policy.bind("SiteExplorerView.addSiteAction"), TeamImages.getImageDescriptor(UIConstants.IMG_SITE_ELEMENT)) { //$NON-NLS-1$ - public void run() { - ConfigureTargetWizard wizard = new ConfigureTargetWizard(); - wizard.init(null, null); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.open(); - } - }; - addSiteAction.setToolTipText(Policy.bind("SiteExplorerView.addSiteActionTooltip")); //$NON-NLS-1$ - WorkbenchHelp.setHelp(addSiteAction, IHelpContextIds.ADD_SITE_ACTION); - - newFolderAction = new Action(Policy.bind("SiteExplorerView.newFolderAction"), WorkbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_OBJ_FOLDER)) { //$NON-NLS-1$ - public void run() { - final Shell shell = folderTree.getTree().getShell(); - try { - // assume that only one folder is selected in the folder tree, this - // is enforced by isEnable() method for this action - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - Object currentSelection = selection.getFirstElement(); - - RemoteResourceElement selectedFolder; - if(!selection.isEmpty()) { - selectedFolder = getSelectedRemoteFolder(selection)[0]; - } else { - selectedFolder = (RemoteResourceElement)folderContentsTable.getInput(); - } - - IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(shell, selectedFolder.getRemoteResource(), Policy.bind("CreateNewFolderAction.newFolderName")); //$NON-NLS-1$ - if (newFolder == null) - return; - - // force a refresh - selectedFolder.setCachedChildren(null); - - // select the newly added folder - RemoteResourceElement newFolderUIElement = new RemoteResourceElement(newFolder); - folderTree.refresh(currentSelection); - expandInTreeCurrentSelection(new StructuredSelection(currentSelection), false); - folderTree.setSelection(new StructuredSelection(newFolderUIElement)); - } catch (TeamException e) { - TeamUIPlugin.handle(e); - return; - } - } - public boolean isEnabled() { - return folderContentsTable.getInput() != null || - getSelectedRemoteFolder((IStructuredSelection)folderTree.getSelection()).length == 1; - } - }; - WorkbenchHelp.setHelp(newFolderAction, IHelpContextIds.NEW_FOLDER_ACTION); - - IActionBars bars = getViewSite().getActionBars(); - IToolBarManager tbm = bars.getToolBarManager(); - tbm.add(addSiteAction); - tbm.update(false); - - // Properties - propertiesAction = new PropertyDialogAction(shell, folderTree); - getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, propertiesAction); - IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection(); - if (selection.size() == 1 && selection.getFirstElement() instanceof SiteElement) { - propertiesAction.setEnabled(true); - } else { - propertiesAction.setEnabled(false); - } - folderTree.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection ss = (IStructuredSelection)event.getSelection(); - boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof SiteElement; - propertiesAction.setEnabled(enabled); - } - }); - - MenuManager treeMgr = new MenuManager(); - MenuManager tableMgr = new MenuManager(); - Tree tree = folderTree.getTree(); - Table table = folderContentsTable.getTable(); - Menu treeMenu = treeMgr.createContextMenu(tree); - Menu tableMenu = tableMgr.createContextMenu(table); - IMenuListener menuListener = new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - // Misc additions - MenuManager sub = new MenuManager(Policy.bind("SiteExplorerView.newMenu"), IWorkbenchActionConstants.GROUP_ADD); //$NON-NLS-1$ - sub.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - manager.add(sub); - manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - sub.add(addSiteAction); - sub.add(newFolderAction); - manager.add(propertiesAction); - } - }; - treeMgr.addMenuListener(menuListener); - treeMgr.setRemoveAllWhenShown(true); - tableMgr.addMenuListener(menuListener); - tableMgr.setRemoveAllWhenShown(true); - tree.setMenu(treeMenu); - table.setMenu(tableMenu); - getSite().registerContextMenu(tableMgr, folderContentsTable); - getSite().registerContextMenu(treeMgr, folderTree); - } - - /** - * Add the new site to the viewer and make it the current selection. - * - * @see ISiteListener#siteAdded(Site) - */ - public void siteAdded(Site site) { - SiteElement element = new SiteElement(site, getViewSite().getWorkbenchWindow()); - folderTree.add(root, element); - folderTree.setSelection(new StructuredSelection(element)); - } - - /** - * Remote the site from the viewer and select the next site in the - * tree. - * - * @see ISiteListener#siteRemoved(Site) - */ - public void siteRemoved(Site site) { - folderTree.remove(new SiteElement(site)); - selectNextObjectInTreeViewer(); - } - - private void selectNextObjectInTreeViewer() { - Object[] items = folderTree.getVisibleExpandedElements(); - if(items.length > 0) { - folderTree.setSelection(new StructuredSelection(items[0])); - } else { - folderContentsTable.setInput(null); - } - } - - /** - * Adds the listener that sets the sorter. - */ - private SelectionListener getColumnListener() { - /** - * This class handles selections of the column headers. - * Selection of the column header will cause resorting - * of the shown tasks using that column's sorter. - * Repeated selection of the header will toggle - * sorting order (ascending versus descending). - */ - return new SelectionAdapter() { - /** - * Handles the case of user selecting the - * header area. - *

    If the column has not been selected previously, - * it will set the sorter of that column to be - * the current tasklist sorter. Repeated - * presses on the same column header will - * toggle sorting order (ascending/descending). - */ - public void widgetSelected(SelectionEvent e) { - // column selected - need to sort - // only allow sorting on name for now - int column = folderContentsTable.getTable().indexOf((TableColumn) e.widget); - if(column == FolderListingSorter.NAME) { - FolderListingSorter oldSorter = (FolderListingSorter)folderContentsTable.getSorter(); - if (oldSorter != null && column == oldSorter.getColumnNumber()) { - oldSorter.setReversed(!oldSorter.isReversed()); - folderContentsTable.refresh(); - } else { - folderContentsTable.setSorter(new FolderListingSorter(column)); - } - } - } - }; - } - - /** - * @see IWorkbenchPart#setFocus() - */ - public void setFocus() { - } - /** - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - super.dispose(); - TargetManager.removeSiteListener(this); - } - -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java deleted file mode 100644 index 7bace962a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class SiteExplorerViewLabelProvider extends WorkbenchLabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex == 0) { - return super.getImage(element); - } - return null; - } - public String getColumnText(Object element, int columnIndex) { - switch (columnIndex) { - case 0 : - return super.getText(element); - case 1 : - if(element instanceof RemoteResourceElement) { - RemoteResourceElement remote = ((RemoteResourceElement)element); - if(remote.getRemoteResource().isContainer()) { - return ""; //$NON-NLS-1$ - } - int size = remote.getSize(); - int sizeKb = size / 1000; - if(sizeKb == 0 && size % 1000 > 0) { - sizeKb = 1; - } - return Policy.bind("SiteExplorerViewLabelProvider.fileSize", new Integer(sizeKb).toString()); //$NON-NLS-1$ - } - case 2 : - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getLastModified(); - } - case 3 : - if(element instanceof RemoteResourceElement) { - return ((RemoteResourceElement)element).getRemoteResource().getURL().toExternalForm(); - } - } - return ""; //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java deleted file mode 100644 index 9a4bae17c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.ui.model.WorkbenchContentProvider; - -public class SiteLazyContentProvider extends WorkbenchContentProvider { - - public boolean hasChildren(Object element) { - if (element == null) { - return false; - } - // the + box will always appear, but then disappear - // if not needed after you first click on it. - return true; // just always return true to avoid going to server - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java deleted file mode 100644 index 336b25b8f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * Used to show all Sites defined in the workbench. - */ -public class SiteRootsElement implements IWorkbenchAdapter, IAdaptable { - private Site[] sites = null; - - // progress monitoring support - private IRunnableContext runContext; - - public SiteRootsElement(Site[] sites, IRunnableContext runContext) { - this.sites = sites; - this.runContext = runContext; - } - - public SiteRootsElement(IRunnableContext runContext) { - this(null, runContext); - } - - public ImageDescriptor getImageDescriptor(Object object) { - return null; - } - - public Object[] getChildren(Object o) { - Site[] childSites; - if(sites == null) { - childSites = TargetManager.getSites(); - } else { - childSites = sites; - } - SiteElement[] siteElements = new SiteElement[childSites.length]; - for (int i = 0; i < childSites.length; i++) { - siteElements[i] = new SiteElement(childSites[i], runContext); - } - return siteElements; - } - - public String getLabel(Object o) { - return null; - } - - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) return this; - return null; - } - - public Object getParent(Object o) { - return null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java deleted file mode 100644 index ea2e935a2..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * Wizard page that allows selecting an existing target provider site - * or to create a new site. - */ -public class SiteSelectionPage extends TargetWizardPage { - private TableViewer table; - private Button useExistingRepo; - private Button useNewRepo; - private Button disconnectTarget; - private Site site; - private TargetProvider currentProvider; - - private boolean disconnect = false; - - public SiteSelectionPage(String pageName, String title, ImageDescriptor titleImage, TargetProvider currentProvider) { - super(pageName, title, titleImage); - setDescription(Policy.bind("SiteSelectionPage.description")); //$NON-NLS-1$ - this.currentProvider = currentProvider; - } - - protected TableViewer createTable(Composite parent) { - Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - TableLayout layout = new TableLayout(); - layout.addColumnData(new ColumnWeightData(100, true)); - table.setLayout(layout); - TableColumn col = new TableColumn(table, SWT.NONE); - col.setResizable(true); - - return new TableViewer(table); - } - - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 2); - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.TARGET_NEW_SITE_PAGE); - - Label description = new Label(composite, SWT.WRAP); - GridData data = new GridData(); - data.horizontalSpan = 2; - data.widthHint = 350; - description.setLayoutData(data); - description.setText(Policy.bind("SiteSelectionPage.label")); //$NON-NLS-1$ - - useExistingRepo = createRadioButton(composite, Policy.bind("SiteSelectionPage.useExisting"), 2); //$NON-NLS-1$ - table = createTable(composite); - table.setContentProvider(new WorkbenchContentProvider()); - table.setLabelProvider(new WorkbenchLabelProvider() { - protected String decorateText(String input, Object element) { - if(currentProvider != null && element.equals(new SiteElement(currentProvider.getSite()))) { - IPath mapping = UrlUtil.getTrailingPath(currentProvider.getURL(), currentProvider.getSite().getURL()); - if(mapping.isEmpty()) { - return Policy.bind("SiteSelectionPage.siteLabelCurrent", super.decorateText(input, element)); //$NON-NLS-1$ - } else { - return Policy.bind("SiteSelectionPage.siteLabelCurrentWithMapping", super.decorateText(input, element), mapping.toString()); //$NON-NLS-1$ - } - } - return super.decorateText(input, element); - } - }); - - table.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement(); - if(siteElement != null) { - site = siteElement.getSite(); - setPageComplete(true); - } else { - setPageComplete(false); - } - } - }); - useNewRepo = createRadioButton(composite, Policy.bind("SiteSelectionPage.createNew"), 2); //$NON-NLS-1$ - - useExistingRepo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - if (!useExistingRepo.getSelection()) { - table.getTable().setEnabled(false); - site = null; - } else { - table.getTable().setEnabled(true); - SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement(); - if(siteElement != null) { - site = siteElement.getSite(); - } - } - } - }); - - useNewRepo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - SiteSelectionPage.this.setPageComplete(! useNewRepo.getSelection()); - } - }); - - - if(currentProvider != null ) { - disconnectTarget = createRadioButton(composite, Policy.bind("SiteSelectionPage.disconnectTarget"), 2); //$NON-NLS-1$ - disconnectTarget.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - disconnect = disconnectTarget.getSelection(); - SiteSelectionPage.this.setPageComplete(true); - } - }); - } - - setControl(composite); - initializeValues(); - } - - /** - * Initializes states of the controls. - */ - private void initializeValues() { - Site[] sites = TargetManager.getSites(); - table.setInput(new SiteRootsElement(null /* no progress monitoring required */)); - if (sites.length == 0) { - useNewRepo.setSelection(true); - } else { - useExistingRepo.setSelection(true); - if(currentProvider != null) { - table.setSelection(new StructuredSelection(new SiteElement(currentProvider.getSite()))); - } else { - table.setSelection(new StructuredSelection(new SiteElement(sites[0]))); - } - } - } - - public Site getSite() { - return site; - } - - public boolean isDisconnect() { - return disconnect; - } - - /** - * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage() - */ - public boolean canFlipToNextPage() { - if(isDisconnect()) { - return false; - } else { - return true; - } - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java deleted file mode 100644 index 8ec6ec615..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.net.URL; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.team.internal.core.target.Site; - -public class SiteViewSorter extends ViewerSorter { - - public int category(Object element) { - if (element instanceof Site) { - return ((Site)element).getType().hashCode(); - } - return 0; - } - - public int compare(Viewer viewer, Object o1, Object o2) { - int cat1 = category(o1); - int cat2 = category(o2); - if (cat1 != cat2) return cat1 - cat2; - - if (o1 instanceof Site && o2 instanceof Site) { - URL site1 = ((Site)o1).getURL(); - URL site2 = ((Site)o2).getURL(); - return site1.toExternalForm().compareTo(site2.toExternalForm()); - } - return super.compare(viewer, o1, o2); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java deleted file mode 100644 index 09c296fc5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.team.internal.ui.sync.SyncCompareInput; -import org.eclipse.team.internal.ui.sync.SyncView; - -/** - * Action for catchup/release in popup menus. - */ -public class SyncAction extends TeamAction { - - public void run(IAction action) { - IResource[] resources = getSelectedResources(); - SyncView view = SyncView.findViewInActivePage(getTargetPage()); - if (view != null) { - view.showSync(getCompareInput(resources), getTargetPage()); - } - } - - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (!resource.isAccessible()) return false; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) return false; - } - return true; - } - - protected SyncCompareInput getCompareInput(IResource[] resources) { - return new TargetSyncCompareInput(resources, IRemoteSyncElement.GRANULARITY_TIMESTAMP); - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java deleted file mode 100644 index f86983952..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.actions.TeamAction; - -public abstract class TargetAction extends TeamAction { - /** - * Get selected remote target folders - */ - protected IRemoteTargetResource[] getSelectedRemoteFolders() { - ArrayList resources = null; - if (!selection.isEmpty()) { - resources = new ArrayList(); - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - IRemoteTargetResource remote = null; - if (next instanceof RemoteResourceElement) { - remote = ((RemoteResourceElement)next).getRemoteResource(); - } else if(next instanceof SiteElement) { - try { - remote = ((SiteElement)next).getSite().getRemoteResource(); - } catch (TeamException e) { - TeamUIPlugin.handle(e); - return new IRemoteTargetResource[0]; - } - } - if(remote != null && remote.isContainer()) { - resources.add(remote); - continue; - } - } - } - if (resources != null && !resources.isEmpty()) { - return (IRemoteTargetResource[])resources.toArray(new IRemoteTargetResource[resources.size()]); - } - return new IRemoteTargetResource[0]; - } - - /** - * Get selected remote target folders - */ - protected Site[] getSelectedSites() { - ArrayList sites = new ArrayList();; - if (!selection.isEmpty()) { - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - IRemoteTargetResource remote = null; - if (next instanceof SiteElement) { - sites.add(((SiteElement)next).getSite()); - } - } - } - return (Site[])sites.toArray(new Site[sites.size()]); - } - - protected IResource[] findResourcesWithOutgoingChanges(IResource[] resources) throws TeamException, CoreException { - // Collect the dirty resource - final List dirtyResources = new ArrayList(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - final TargetProvider provider = TargetManager.getProvider(resource.getProject()); - resource.accept(new IResourceVisitor() { - public boolean visit(IResource resource) throws CoreException { - if (resource.getType() == IResource.FILE) { - if (provider.isDirty(resource) || ! provider.hasBase(resource)) { - dirtyResources.add(resource); - } - } else { - // Check for outgoing folder deletions? - } - return true; - } - }, IResource.DEPTH_INFINITE, true /* include phantoms */); - } - return (IResource[]) dirtyResources.toArray(new IResource[dirtyResources.size()]); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java deleted file mode 100644 index e6781d58b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer; -import org.eclipse.team.internal.ui.sync.SyncView; -import org.eclipse.ui.help.WorkbenchHelp; -public class TargetCatchupReleaseViewer extends CatchupReleaseViewer { - private GetSyncAction getAction; - private PutSyncAction putAction; - - public TargetCatchupReleaseViewer(Composite parent, TargetSyncCompareInput input) { - super(parent, input); - initializeActions(input); - // set F1 help - WorkbenchHelp.setHelp(this.getControl(), IHelpContextIds.TARGET_CATCHUP_RELEASE_VIEWER); - } - - /** - * Creates the actions for this viewer. - */ - private void initializeActions(final TargetSyncCompareInput diffModel) { - Shell shell = getControl().getShell(); - getAction = new GetSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Get_1"), shell); //$NON-NLS-1$ - putAction = new PutSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Put_2"), shell); //$NON-NLS-1$ - } - protected void fillContextMenu(IMenuManager manager) { - super.fillContextMenu(manager); - manager.add(new Separator()); - switch (getSyncMode()) { - case SyncView.SYNC_INCOMING: - getAction.update(SyncView.SYNC_INCOMING); - manager.add(getAction); - break; - case SyncView.SYNC_OUTGOING: - putAction.update(SyncView.SYNC_INCOMING); - manager.add(putAction); - break; - case SyncView.SYNC_BOTH: - getAction.update(SyncView.SYNC_INCOMING); - manager.add(getAction); - putAction.update(SyncView.SYNC_INCOMING); - manager.add(putAction); - break; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java deleted file mode 100644 index 65b4adba7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.actions.TeamAction; - -public class TargetProjectAction extends TeamAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IProject project = getSelectedProjects()[0]; - ConfigureTargetWizard wizard = new ConfigureTargetWizard(); - wizard.init(null, project); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.open(); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("ConfigureTargetAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (!selectedProjects[0].isAccessible()) return false; -/* try { - if (TargetManager.getProvider(selectedProjects[0]) == null) return true; - } catch (TeamException e) { - TeamPlugin.log(IStatus.ERROR, "Exception getting provider", e); - return false; - } - return false; -*/ - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java deleted file mode 100644 index 480861891..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -public class TargetSiteContentHandler extends DefaultHandler implements ContentHandler { - private StringBuffer buffer; - private List propList; - private String target; - - /** - * Constructor for TargetSiteContentHandler. - */ - public TargetSiteContentHandler() { - super(); - propList=new LinkedList(); - } - - /** - * @see org.xml.sax.ContentHandler#characters(char[], int, int) - */ - public void characters(char[] ch, int start, int length) throws SAXException { - if (buffer!=null) - buffer.append(ch, start, length); - } - - /** - * @see org.xml.sax.ContentHandler#endElement(String, String, String) - */ - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - if (qName.equals("site")) { //$NON-NLS-1$ - Properties props=new Properties(); - byte[] bytes=buffer.toString().getBytes(); - InputStream iStream=new ByteArrayInputStream(bytes); - try { - props.load(iStream); - props.setProperty("target", target); //$NON-NLS-1$ - propList.add(props); - } catch (IOException e) { - //TODO: log an error. - } - } - } - - /** - * Retrieve the property list that has been built up. - * @return Properties[] - */ - Properties[] getProperties() { - return (Properties[]) propList.toArray(new Properties[propList.size()]); - } - - /** - * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) - */ - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - if (qName.equals("site")) { //$NON-NLS-1$ - buffer = new StringBuffer(); - target=atts.getValue("target"); //$NON-NLS-1$ - } - } - - /** - * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) - */ - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - ; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java deleted file mode 100644 index c2189d464..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.lang.reflect.InvocationTargetException; -import java.util.Properties; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.ProjectSetImportWizard; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; - -/** - * This wizard allows the user to save the settings used by Target sites to a file. - */ -public class TargetSiteExportWizard extends Wizard implements IExportWizard { - private ExportTargetSiteMainPage mainPage; - private IStructuredSelection selection; - /** - * Constructor for TargetSiteExportWizard. - */ - public TargetSiteExportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("TargetSiteExportWizard.Target_Site")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - final boolean[] result = new boolean[] { false }; - try { - getContainer().run(false, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - String filename = mainPage.getFileName(); - Path path = new Path(filename); - if (path.getFileExtension() == null) { - filename = filename + ".tsf"; //$NON-NLS-1$ - } - ProjectSetImportWizard.lastFile = filename; - File file = new File(filename); - File parentFile = file.getParentFile(); - if (parentFile != null && !parentFile.exists()) { - boolean r = MessageDialog.openQuestion( - getShell(), - Policy.bind("TargetSiteExportWizard.Creation_Question"), //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Create_dir")); //$NON-NLS-1$ - if (!r) { - result[0] = false; - return; - } - r = parentFile.mkdirs(); - if (!r) { - MessageDialog.openError(getShell(), - Policy.bind("TargetSiteExportWizard.Export_Problems"), //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Directory_creation_error") //$NON-NLS-1$ - ); - result[0] = false; - return; - } - } - if (file.exists() && file.isFile()) { - boolean r = MessageDialog.openQuestion( - getShell(), - Policy.bind("TargetSiteExportWizard.Overwrite_Question"), //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Overwrite_file") //$NON-NLS-1$ - ); - if (!r) { - result[0] = false; - return; - } - } - BufferedWriter writer = null; - try { - OutputStream jout = new FileOutputStream(file); - - writer = new BufferedWriter(new OutputStreamWriter(jout, "UTF-8")); //$NON-NLS-1$ - writer.write(""); //$NON-NLS-1$ - writer.newLine(); - writer.write(""); //$NON-NLS-1$ - writer.newLine(); - writer.flush(); - - Site[] sites = mainPage.getSelectedSites(); - Properties props; - monitor.beginTask(null, 5 * sites.length); - String target; - - //The 1st one needs to have a unique comment since it only requires an opening tag: - props = sites[0].getConfiguration(); - monitor.worked(2); - target=sites[0].getType(); - monitor.worked(1); - props.store(jout, ""); //$NON-NLS-1$ //$NON-NLS-2$ - monitor.worked(2); - - // For each additional site, write the config to disk: - for (int i = 1; i < sites.length; i++) { - props = sites[i].getConfiguration(); - monitor.worked(2); - target=sites[i].getType(); - monitor.worked(1); - props.store(jout, " "); //$NON-NLS-1$ //$NON-NLS-2$ - monitor.worked(2); - } - jout.flush();//This line may not actually be needed but it's not doing any harm either. - - writer.write(""); //$NON-NLS-1$ - writer.newLine(); - writer.write(""); //$NON-NLS-1$ - writer.newLine(); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException) target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException) target; - } - if (target instanceof Error) { - throw (Error) target; - } - } - return result[0]; - } - - /** - * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } - - /** - * @see org.eclipse.jface.wizard.IWizard#addPages() - */ - public void addPages() { - mainPage = new ExportTargetSiteMainPage("targetSiteMainPage", //$NON-NLS-1$ - Policy.bind("TargetSiteExportWizard.Export_a_Target_Site"), //$NON-NLS-1$ - TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_EXPORT_BANNER) //TODO: We need our own banner... - ); - Site[] sites = (Site[]) selection.toList().toArray(new Site[0]); - mainPage.setSelectedSites(sites); - mainPage.setFileName(ProjectSetImportWizard.lastFile); - addPage(mainPage); - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java deleted file mode 100644 index 6ddf81820..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.core.target.ISiteFactory; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.UIConstants; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public class TargetSiteImportWizard extends Wizard implements IImportWizard { - public static String lastFile; - - private ImportTargetSiteMainPage mainPage; - - /** - * Retrieves the Site object that the TargetProvider is contained in. - * @return Site - */ - Site getSite(Properties properties) { - try { - URL url = new URL(properties.getProperty("location")); //$NON-NLS-1$ - return TargetManager.getSite(properties.getProperty("target"), url); //$NON-NLS-1$ - } catch (MalformedURLException e) { - return null; - } - } - - public TargetSiteImportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("TargetSiteImportWizard.Target_Site")); //$NON-NLS-1$ - } - - public void addPages() { - mainPage = new ImportTargetSiteMainPage( - "targetSiteMainPage", //$NON-NLS-1$ - Policy.bind("TargetSiteImportWizard.Import_Target_Site"), //$NON-NLS-1$ - TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_IMPORT_BANNER) - ); - mainPage.setFileName(lastFile); - addPage(mainPage); - } - - /** - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - try { - getContainer().run(true, true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - InputStreamReader reader = null; - try { - String filename = mainPage.getFileName(); - lastFile = filename; - reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$ - - SAXParserFactory factory = SAXParserFactory.newInstance(); - SAXParser parser; - parser = factory.newSAXParser(); - TargetSiteContentHandler handler = new TargetSiteContentHandler(); - InputSource source = new InputSource(reader); - parser.parse(source, handler); - - Properties[] propList = handler.getProperties(); - for (int i = 0; i < propList.length; i++) { - String target = propList[i].getProperty("target"); //$NON-NLS-1$ - ISiteFactory siteFactory = TargetManager.getSiteFactory(target); - Assert.isNotNull(siteFactory); - - final Site newsite = siteFactory.newSite(propList[i]); - Site[] existingSites = TargetManager.getSites(); - boolean dupe = false; - for (int j = 0; j < existingSites.length; j++) { - if (existingSites[j].equals(newsite)) - dupe = true; - } - if (!dupe) { - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - TargetManager.addSite(newsite); - } - }); - } - } - - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (ParserConfigurationException e) { - throw new InvocationTargetException(e); - } catch (SAXException e) { - throw new InvocationTargetException(e); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException) target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException) target; - } - if (target instanceof Error) { - throw (Error) target; - } - } - return true; - } - - /** - * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) {} - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java deleted file mode 100644 index 4961771ac..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Set; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.team.internal.ui.sync.ChangedTeamContainer; -import org.eclipse.team.internal.ui.sync.ITeamNode; -import org.eclipse.team.internal.ui.sync.SyncSet; -import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer; - -public abstract class TargetSyncAction extends Action { - private TargetSyncCompareInput diffModel; - private ISelectionProvider selectionProvider; - - protected int syncMode; - private Shell shell; - - protected static IRemoteResource getRemoteResourceFor(IResource local) throws TeamException { - return TargetManager.getProvider(local.getProject()).getRemoteResourceFor(local); - } - - /** - * Creates a TargetSyncAction which works on selection and doesn't commit changes. - */ - public TargetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) { - super(label); - this.diffModel = model; - this.selectionProvider = sp; - this.shell = shell; - } - - protected Shell getShell() { - return shell; - } - - protected TargetSyncCompareInput getDiffModel() { - return diffModel; - } - - /** - * Returns true if at least one node can perform the specified action. - */ - private boolean isEnabled(Object[] nodes) { - for (int i = 0; i < nodes.length; i++) { - if (nodes[i] instanceof ITeamNode) { - ITeamNode node = (ITeamNode)nodes[i]; - if (isEnabled(node)) { - return true; - } - } else { - if (nodes[i] instanceof IDiffContainer) - if (isEnabled(((IDiffContainer)nodes[i]).getChildren())) - return true; - } - } - return false; - } - - protected abstract boolean isEnabled(ITeamNode node); - - /** - * Perform the sychronization operation. - */ - public void run() { - ISelection s = selectionProvider.getSelection(); - if (!(s instanceof IStructuredSelection) || s.isEmpty()) { - return; - } - final SyncSet set = new SyncSet((IStructuredSelection)s); - removeNonApplicableNodes(set, syncMode); - final SyncSet[] result = new SyncSet[1]; - WorkspaceModifyOperation op = new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - result[0] = TargetSyncAction.this.run(set, monitor); - } - }; - try { - run(op, Policy.bind("TargetSyncAction.errorEncountered")); //$NON-NLS-1$ - } catch (InterruptedException e) { - } - if (result[0] != null) { - // all returned nodes that have a changed sync kind are assumed - // to have been operated on and will be removed from the diff tree. - removeNodes(result[0].getChangedNodes()); - - // any node that claims that it's IN_SYNC will be automatically - // filtered from the diff tree - see DiffElement.setKind(). - diffModel.updateView(); - } - } - - protected abstract void removeNonApplicableNodes(SyncSet set, int syncMode); - - /** - * The given nodes have been synchronized. Remove them from - * the sync set. - * - * For folders that are outgoing deletions, we may need to leave the - * folder as is or adjust the sync kind depending on the sync kind of - * the folder's children. - * - * @see CVSSyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor) - */ - private void removeNodes(final ITeamNode[] nodes) { - // Update the model - Set outgoingFolderDeletions = new HashSet(); - for (int i = 0; i < nodes.length; i++) { - if (nodes[i].getClass() == UnchangedTeamContainer.class) { - // Unchanged containers get removed automatically when all - // children are removed - continue; - } - if (nodes[i].getClass() == ChangedTeamContainer.class) { - // If this node still has children, convert to an - // unchanged container, then it will disappear when - // all children have been removed. - ChangedTeamContainer container = (ChangedTeamContainer)nodes[i]; - IDiffElement[] children = container.getChildren(); - if (children.length > 0) { - IDiffContainer parent = container.getParent(); - UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource()); - for (int j = 0; j < children.length; j++) { - unchanged.add(children[j]); - } - parent.removeToRoot(container); - continue; - } - // No children, it will get removed below. - } - nodes[i].getParent().removeToRoot(nodes[i]); - } - } - - /** - * Updates the action with the latest selection, setting enablement - * as necessary. - */ - public void update(int syncMode) { - this.syncMode = syncMode; - IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection(); - setEnabled(isEnabled(selection.toArray())); - } - - /** - * Subclasses must implement this method, which performs action-specific code. - * - * It may return the sync set which was passed in, or null. - */ - protected abstract SyncSet run(SyncSet syncSet, IProgressMonitor monitor); - - /** - * Helper method to run a runnable in a progress monitor dialog, and display any errors. - */ - protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); - try { - dialog.run(true, true, op); - } catch (InvocationTargetException e) { - Throwable throwable = e.getTargetException(); - IStatus error = null; - if (throwable instanceof CoreException) { - error = ((CoreException)throwable).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$ - } - ErrorDialog.openError(shell, problemMessage, error.getMessage(), error); - TeamUIPlugin.log(error); - } - } - - /** - * Helper method. Check if a save is necessary. If it is, prompt the user to save. - * Return true if all necessary saves have been performed, false otherwise. - */ - protected boolean saveIfNecessary() { - return getDiffModel().saveIfNecessary(); - } - - /** - * Convenience method that maps the given resources to their target providers. - * The returned Hashtable has keys which are TargetProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - TargetProvider provider = TargetManager.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java deleted file mode 100644 index a9137cd51..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.core.target.ITargetRunnable; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer; -import org.eclipse.team.internal.ui.sync.SyncCompareInput; - -public class TargetSyncCompareInput extends SyncCompareInput { - - private IResource[] resources; - - protected TargetSyncCompareInput(IResource[] resources, int granularity) { - super(granularity); - this.resources = resources; - } - - /** - * @see SyncCompareInput#createSyncElements(IProgressMonitor) - */ - protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException { - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(null, resources.length); - IRemoteSyncElement[] elements = new IRemoteSyncElement[resources.length]; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - elements[i] = provider.getRemoteSyncElement(resource); - monitor.worked(1); - } - return elements; - } finally { - monitor.done(); - } - } - - /** - * @see CompareEditorInput#createDiffViewer(Composite) - */ - public Viewer createDiffViewer(Composite parent) { - CatchupReleaseViewer viewer = new TargetCatchupReleaseViewer(parent, this); - setViewer(viewer); - return viewer; - } - - protected void updateView() { - // Update the view - if (getDiffRoot().hasChildren()) { - getViewer().refresh(); - } else { - getViewer().setInput(null); - } - - // Update the status line - updateStatusLine(); - } - - /** - * @see SyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor) - */ - protected IDiffElement collectResourceChanges( - final IDiffContainer parent, - final IRemoteSyncElement tree, - IProgressMonitor pm) { - - final IDiffElement[] result = new IDiffElement[] {null}; - try { - TargetProvider provider = TargetManager.getProvider(tree.getLocal().getProject()); - provider.run(new ITargetRunnable() { - public void run(IProgressMonitor monitor) throws TeamException { - result[0] = TargetSyncCompareInput.super.collectResourceChanges(parent, tree, monitor); - } - }, pm); - } catch (TeamException e) { - TeamUIPlugin.log(e.getStatus()); - } - return result[0]; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java deleted file mode 100644 index 55583c140..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.eclipse.team.internal.ui.target; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/* - * Common superclass for wizard pages. Provides convenience methods - * for widget creation. - */ -public abstract class TargetWizardPage extends WizardPage { - - private static final int COMBO_HISTORY_LENGTH = 5; - - /* - * WizardPage constructor comment. - * @param pageName the name of the page - */ - public TargetWizardPage(String pageName) { - super(pageName); - } - - /* - * WizardPage constructor comment. - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page - */ - public TargetWizardPage(String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - protected Button createRadioButton(Composite parent, String label, int span) { - Button button = new Button(parent, SWT.RADIO); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = span; - button.setLayoutData(data); - return button; - } - - /* - * Creates a new checkbox instance and sets the default layout data. - * - * @param group the composite in which to create the checkbox - * @param label the string to set into the checkbox - * @return the new checkbox - */ - protected Button createCheckBox(Composite group, String label) { - Button button = new Button(group, SWT.CHECK | SWT.LEFT); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = 2; - button.setLayoutData(data); - return button; - } - - /* - * Utility method that creates a combo box - * - * @param parent the parent for the new label - * @return the new widget - */ - protected Combo createCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.READ_ONLY); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - combo.setLayoutData(data); - return combo; - } - - /* - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - - /* - * Utility method that creates a label instance - * and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @return the new label - */ - protected Label createLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - return label; - } - - /* - * Create a text field specific for this application - * - * @param parent the parent of the new text field - * @return the new text field - */ - protected Text createTextField(Composite parent) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.verticalAlignment = GridData.CENTER; - data.grabExcessVerticalSpace = false; - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - text.setLayoutData(data); - return text; - } - - /* - * Adds an entry to a history, while taking care of duplicate history items - * and excessively long histories. The assumption is made that all histories - * should be of length ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH. - * - * @param history the current history - * @param newEntry the entry to add to the history - * @return the history with the new entry appended - */ - protected String[] addToHistory(String[] history, String newEntry) { - ArrayList l = new ArrayList(Arrays.asList(history)); - addToHistory(l, newEntry); - String[] r = new String[l.size()]; - l.toArray(r); - return r; - } - - /* - * Adds an entry to a history, while taking care of duplicate history items - * and excessively long histories. The assumption is made that all histories - * should be of length ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH. - * - * @param history the current history - * @param newEntry the entry to add to the history - */ - protected void addToHistory(List history, String newEntry) { - history.remove(newEntry); - history.add(0,newEntry); - - // since only one new item was added, we can be over the limit - // by at most one item - if (history.size() > COMBO_HISTORY_LENGTH) - history.remove(COMBO_HISTORY_LENGTH); - } - - /* - * Utility method to create an editable combo box - * - * @param parent the parent of the combo box - * @return the created combo - */ - protected Combo createEditableCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.NULL); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - combo.setLayoutData(data); - return combo; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java deleted file mode 100644 index b9e12043b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.internal.ui.target; - -import java.lang.reflect.InvocationTargetException; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.ui.IPromptCondition; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.PromptingDialog; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class UploadAction extends TargetAction { - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() throws TeamException { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - TargetProvider provider = TargetManager.getProvider(resource.getProject()); - if(provider == null) - return false; - if(! provider.canPut(resource)) - return false; //if one can't don't allow for any - // Don't want to go though the resources deeply to see if there are dirty children - } - return true; - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Hashtable table = getTargetProviderMapping(); - Set keySet = table.keySet(); - monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ - Iterator iterator = keySet.iterator(); - boolean hasOutgoing = false; - while (iterator.hasNext()) { - IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1024); - final TargetProvider provider = (TargetProvider)iterator.next(); - subMonitor.setTaskName(Policy.bind("UploadAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$ - - IResource[] providerResources = (IResource[])((List)table.get(provider)).toArray(new IResource[0]); - IResource[] outgoingChanges = findResourcesWithOutgoingChanges(providerResources); - if (outgoingChanges.length > 0) { - // Prompt for any outgoing deletions - PromptingDialog prompt = new PromptingDialog( - getShell(), - outgoingChanges, - new IPromptCondition() { - public boolean needsPrompt(IResource resource) { - return ! resource.exists(); - } - public String promptMessage(IResource resource) { - return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString()); //$NON-NLS-1$ - } - }, - Policy.bind("UploadAction.confirmDeletionTitle"));//$NON-NLS-1$ - - // Put the resources that were selected - hasOutgoing = true; - provider.put(prompt.promptForMultiple(), subMonitor); - } - } - if (!hasOutgoing) { - getShell().getDisplay().syncExec( - new Runnable() { - public void run() { - MessageDialog.openInformation(getShell(), - Policy.bind("UploadAction.noDirtyTitle"), //$NON-NLS-1$ - Policy.bind("UploadAction.noDirtyMessage")); //$NON-NLS-1$ - } - }); - }; - } catch (CoreException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("UploadAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java deleted file mode 100644 index fcd51bfbc..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.team.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -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. - *

    - * This method is called after the no argument constructor and - * before other methods are called. - *

    - * - * @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 b7be0b734..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.eclipse.team.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - - -/** - * 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$ -} - 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 b8d4c50e1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.ui; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Hashtable; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.UIConstants; - -/** - * TeamImages provides convenience methods for accessing shared images - * provided by the org.eclipse.team.ui plug-in. - */ -public class TeamImages { - private static Hashtable imageDescriptors = new Hashtable(20); - - static { - initializeImages(); - } - /** - * Creates an image and places it in the image registry. - * - * @param id the identifier for the image - * @param baseURL the base URL for the image - */ - protected static void createImageDescriptor(String id, URL baseURL) { - URL url = null; - try { - url = new URL(baseURL, UIConstants.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) { - return (ImageDescriptor)imageDescriptors.get(id); - } - /** - * Convenience method to get an image descriptor for an extension - * - * @param extension the extension declaring the image - * @param subdirectoryAndFilename the path to the image - * @return the image - */ - public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) { - IPluginDescriptor pluginDescriptor = extension.getDeclaringPluginDescriptor(); - URL path = pluginDescriptor.getInstallURL(); - URL fullPathString = null; - try { - fullPathString = new URL(path,subdirectoryAndFilename); - return ImageDescriptor.createFromURL(fullPathString); - } catch (MalformedURLException e) { - } - return null; - } - /** - * Initializes the table of images used in this plugin. - */ - private static void initializeImages() { - URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL(); - - // View decoration overlays - createImageDescriptor(ISharedImages.IMG_DIRTY_OVR, baseURL); - createImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR, baseURL); - createImageDescriptor(ISharedImages.IMG_CHECKEDOUT_OVR, baseURL); - - // Target Management Icons - createImageDescriptor(UIConstants.IMG_SITE_ELEMENT, baseURL); - - // Sync View Icons - createImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING, baseURL); - createImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING, baseURL); - createImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING, baseURL); - createImageDescriptor(UIConstants.IMG_REFRESH, baseURL); - createImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE, baseURL); - createImageDescriptor(UIConstants.IMG_CONTENTS, baseURL); - - createImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_REFRESH_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_CONTENTS_DISABLED, baseURL); - - createImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_REFRESH_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_CONTENTS_ENABLED, baseURL); - - createImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP, baseURL); - createImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE, baseURL); - createImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE, baseURL); - - createImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_DISABLED, baseURL); - createImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_DISABLED, baseURL); - - createImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_ENABLED, baseURL); - createImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_ENABLED, baseURL); - - createImageDescriptor(UIConstants.IMG_WIZBAN_SHARE, baseURL); - - // Wizard banners - createImageDescriptor(UIConstants.IMG_PROJECTSET_IMPORT_BANNER, baseURL); - createImageDescriptor(UIConstants.IMG_PROJECTSET_EXPORT_BANNER, baseURL); - - } -} 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 35327e662..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.ui; - -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * TeamUI contains public API for generic UI-based Team functionality - */ -public class TeamUI { - // property change types - public static String GLOBAL_IGNORES_CHANGED = "global_ignores_changed"; //$NON-NLS-1$ - - /** - * Register for changes made to Team properties. - * - * @param listener the listener to add - */ - public static void addPropertyChangeListener(IPropertyChangeListener listener) { - TeamUIPlugin.addPropertyChangeListener(listener); - } - - /** - * Deregister as a Team property changes. - * - * @param listener the listener to remove - */ - public static void removePropertyChangeListener(IPropertyChangeListener listener) { - TeamUIPlugin.removePropertyChangeListener(listener); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html deleted file mode 100644 index 110a89283..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - Package-level Javadoc - - -Application programming interface for associating a repository provider with a project. -

    -Package Specification

    -This package specifies the API for providing a configuration wizard that will -associate and configure a particular repository provider with a project in the -local workspace. - - \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/.classpath b/examples/org.eclipse.team.examples.filesystem/.classpath deleted file mode 100644 index 2bc1164a3..000000000 --- a/examples/org.eclipse.team.examples.filesystem/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/examples/org.eclipse.team.examples.filesystem/.cvsignore b/examples/org.eclipse.team.examples.filesystem/.cvsignore deleted file mode 100644 index ba077a403..000000000 --- a/examples/org.eclipse.team.examples.filesystem/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/examples/org.eclipse.team.examples.filesystem/.project b/examples/org.eclipse.team.examples.filesystem/.project deleted file mode 100644 index aa7f1d122..000000000 --- a/examples/org.eclipse.team.examples.filesystem/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - org.eclipse.team.examples.filesystem - - - org.apache.xerces - org.eclipse.core.boot - org.eclipse.core.resources - org.eclipse.core.runtime - org.eclipse.team.core - org.eclipse.team.ui - org.eclipse.ui - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/examples/org.eclipse.team.examples.filesystem/about.html b/examples/org.eclipse.team.examples.filesystem/about.html deleted file mode 100644 index 9db411aab..000000000 --- a/examples/org.eclipse.team.examples.filesystem/about.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -About - - - -

    About This Content

    - -

    20th June, 2002

    -

    License

    -

    Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

    - -

    Contributions

    - -

    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.

    - -

    If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

    - - - \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/build.properties b/examples/org.eclipse.team.examples.filesystem/build.properties deleted file mode 100644 index c4c2f124e..000000000 --- a/examples/org.eclipse.team.examples.filesystem/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Eclipse build contribution -source.teamfilesystem.jar=src/ -src.includes=about.html -bin.includes=about.html,icons/,doc-html/,plugin.xml,plugin.properties,*.jar \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/doc-html/hglegal.htm b/examples/org.eclipse.team.examples.filesystem/doc-html/hglegal.htm deleted file mode 100644 index cf2ced352..000000000 --- a/examples/org.eclipse.team.examples.filesystem/doc-html/hglegal.htm +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - Legal Notices - - - -

    -Notices

    -(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved. - - diff --git a/examples/org.eclipse.team.examples.filesystem/doc-html/ngibmcpy.gif b/examples/org.eclipse.team.examples.filesystem/doc-html/ngibmcpy.gif deleted file mode 100644 index 61cef4852..000000000 Binary files a/examples/org.eclipse.team.examples.filesystem/doc-html/ngibmcpy.gif and /dev/null differ diff --git a/examples/org.eclipse.team.examples.filesystem/doc-html/team_filesystem_ex.html b/examples/org.eclipse.team.examples.filesystem/doc-html/team_filesystem_ex.html deleted file mode 100644 index 9604d0d6c..000000000 --- a/examples/org.eclipse.team.examples.filesystem/doc-html/team_filesystem_ex.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Team - File System Repository Provider Example - - - -

    Team - File System Repository Provider Example

    - -

    Introduction

    - -

    -The File System Repository Provider shows how to define your own repository provider. -It shows how to override the RepositoryProvider class and register this new class as -a repository provider using the Team extension point. It also illustrates how to create -and register a configuration wizard for connecting a local project to a remote location -and how to provide some custom Team and Replace with menu items for simple Get and Put operations. In -addition it also shows how to use the validate save/validate edit mechanism to support -pessimistic providers. - - -

    Running the example

    - -To start using this example create a project and select Team > Share Project... from the -project's popup menu. In the wizrd that opens, select File System Example and click Next. -Now enter the location in the local file system where you would like to connect the project -to. The Get and Put operations in the Team menu will now transfer to and from the selected -location. - - -

    Copyright IBM Corp. 2000, 2002.  All Rights Reserved. - - - diff --git a/examples/org.eclipse.team.examples.filesystem/icons/full/wizards/fsicon_wiz.gif b/examples/org.eclipse.team.examples.filesystem/icons/full/wizards/fsicon_wiz.gif deleted file mode 100644 index af038fa69..000000000 Binary files a/examples/org.eclipse.team.examples.filesystem/icons/full/wizards/fsicon_wiz.gif and /dev/null differ diff --git a/examples/org.eclipse.team.examples.filesystem/icons/full/wizban/newconnect_wizban.gif b/examples/org.eclipse.team.examples.filesystem/icons/full/wizban/newconnect_wizban.gif deleted file mode 100644 index 3038a23c0..000000000 Binary files a/examples/org.eclipse.team.examples.filesystem/icons/full/wizban/newconnect_wizban.gif and /dev/null differ diff --git a/examples/org.eclipse.team.examples.filesystem/plugin.properties b/examples/org.eclipse.team.examples.filesystem/plugin.properties deleted file mode 100644 index 6685bac52..000000000 --- a/examples/org.eclipse.team.examples.filesystem/plugin.properties +++ /dev/null @@ -1,18 +0,0 @@ -pluginName = Eclipse Team File System Example -providerName=Eclipse.org - -Put.name=Put -Put.tooltip=Copy resources to the shared file system location -Get.name=Get -Get.tooltip=Copy resources from the shared file system location to the workbench -Unmanage.name=Unmanage -Unmanage.tooltip=Mark resources as not-shared - -Replace.name=File System Contents -Replace.tooltip=Overwrites the local copy of this resource with the one in the repository - - -fspropertypage.name=FileSystem Provider -fspropertypage.tooltip=An example repository provider that uses the filesystem to provide storage. -fswizard.name=File System Example (Non-Versioning) -fswizard.description=Associate a project with a file system location. This location can be used to shared resources with others. diff --git a/examples/org.eclipse.team.examples.filesystem/plugin.xml b/examples/org.eclipse.team.examples.filesystem/plugin.xml deleted file mode 100644 index df8b947b7..000000000 --- a/examples/org.eclipse.team.examples.filesystem/plugin.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %fswizard.description - - - - - - - - - - - - - - diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java deleted file mode 100644 index 14efdbae1..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFileModificationValidator; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations; - -/** - * This class models a sentry that verifies whether resources are available for editing or overwriting. - * This has been made a separate clas for illustration purposes. It may have been more apporpriate - * to have FileSystemProvider implement IFileModificationValidator itself since the interface - * only has two methods and their implementation is straight forward. - */ -public final class FileModificationValidator implements IFileModificationValidator { - //Used to avoid creating multiple copies of the OK status: - private static final IStatus OK_STATUS = new Status(Status.OK, FileSystemPlugin.ID, Status.OK, Policy.bind("ok"), null); - - private RepositoryProvider provider; - private SimpleAccessOperations operations; - - /** - * Constructor for FileModificationValidator. - */ - public FileModificationValidator(RepositoryProvider provider) { - this.provider = provider; - operations = provider.getSimpleAccess(); - } - - /** - * This method will convert any exceptions thrown by the SimpleAccessOperations.chechout() to a Status. - * @param resources the resources that are to be checked out - * @return IStatus a status indicator that reports whether the operation went smoothly or not. - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#chechout(IResource[] resources, int depth, IProgressMonitor progress) - */ - private IStatus checkout(IResource[] resources) { - try { - operations.checkout(resources, IResource.DEPTH_INFINITE, null); - } catch (TeamException e) { - return new Status(Status.ERROR, FileSystemPlugin.ID, Status.ERROR, e.getLocalizedMessage(), e); - } - return OK_STATUS; - } - - /** - * This method will be called by the workbench/editor before it tries to edit one or more files. - * The idea is to prevent anyone from accidentally working on a file that they won't be able to check in changes to. - * @see org.eclipse.core.resources.IFileModificationValidator#validateEdit(IFile[], Object) - */ - public IStatus validateEdit(IFile[] files, Object context) { - Collection toBeCheckedOut = new ArrayList(); - - //Make a list of all the files that need to be checked out: - for (int i = 0; i < files.length; i++) { - if (!operations.isCheckedOut(files[i])) { - toBeCheckedOut.add(files[i]); - } - } - - return checkout((IResource[]) toBeCheckedOut.toArray(new IResource[toBeCheckedOut.size()])); - } - - /** - * This method will be called by the workbench before it tries to save a file. - * It should not attempt to save any files that don't recieve an OK status here. - * @see org.eclipse.core.resources.IFileModificationValidator#validateSave(IFile) - */ - public IStatus validateSave(IFile file) { - return checkout(new IResource[] { file }); - } - -} diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java deleted file mode 100644 index f59deeaf7..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.team.core.TeamException; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * This is the plugin class for the file system examples. It provides the following: - * - *

      - *
    1. public fields for the plugin and provider IDs as defined in the plugin.xml - *
    2. initialization on startup of Policy class that provides internationalization of strings - *
    3. helper methods for outputing IStatus objects to the log - *
    4. helper methods for converting CoreExceptions and IOExceptions to TeamExceptions - *
    - */ -public class FileSystemPlugin extends AbstractUIPlugin { - - /** - * This is the ID of the plugin as defined in the plugin.xml - */ - public static final String ID = "org.eclipse.team.examples.filesystem"; - - /** - * This is the provider ID of the plugin as defined in the plugin.xml - */ - public static final String PROVIDER_ID = ID + ".FileSystemProvider"; - - // This static field will hold the singleton instance of the plugin class - private static FileSystemPlugin plugin; - - /** - * Override the standard plugin constructor. - * - * @param descriptor the plugin descriptor - */ - public FileSystemPlugin(IPluginDescriptor descriptor) { - super(descriptor); - // record this instance as the singleton - plugin = this; - } - - /** - * This method will get invoked when the plugin is started. - * Note that this is not necessarily at workbench startup. - * - * @see org.eclipse.core.runtime.Plugin#startup() - */ - public void startup() throws CoreException { - // localize the string bindings used by the plugins (in order to provide NLS support) - Policy.localize("org.eclipse.team.examples.filesystem.messages"); - } - - /** - * Return the singlton instance of the plugin class to allow other - * classes in the plugin access to plugin instance methods such as - * those for logging errors, etc. - */ - public static FileSystemPlugin getPlugin() { - return plugin; - } - - /** - * Helper method to convert a CoreException into a TeamException. - * We do this to maintain the core status and code. This type of - * mapping may not be appropriate in more complicated exception - * handling situations. - * - * @param e the CoreException - */ - public static TeamException wrapException(CoreException e) { - return new TeamException(e.getStatus()); - } - - /** - * Helper method to convert an IOException into a TeamException. - * This type of mapping may not be appropriate in more complicated - * exception handling situations. - * - * @param e the CoreException - */ - public static TeamException wrapException(IOException e) { - return new TeamException(new Status(IStatus.ERROR, FileSystemPlugin.ID, - TeamException.IO_FAILED, e.getMessage(), e)); - } - - /** - * Helper method to log an exception status. - * - * @param status the status to be logged - */ - public static void log(IStatus status) { - plugin.getLog().log(status); - } -} - diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java deleted file mode 100644 index b15430d38..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -import java.io.File; - -import org.eclipse.core.resources.IFileModificationValidator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations; - -/** - * This example illustrates how to create a concrete implementation of a RepositoryProvider - * that uses the file system to act as the repository. See the plugin.xml file for the xml required - * to register this provider with the Team extension point org.eclipse.team.core.repository. - * The plugin.xml file also contains examples of how to filter menu items using a repsitory provider's - * ID. - * - *

    - * This example provider illustrates the following: - *

      - *
    1. simple working implementation of RepositoyProvider - *
    2. storage of a persistant property with the project (which provides the target location for the provider) - *
    3. access to an instance of SimpleAccessOperations for performing simple file operations - *
    - * - *

    - * Additional functionality that will be illustrated in the future include: - *

      - *
    1. Validate Save/Validat Edit - *
    2. Move/Delete Hook - *
    3. Project Sets - *
    4. Use of the workspace synchronizer (ISynchronizer) - *
    5. Use of decorators - *
    6. combining streams and progress monitors to get responsive UI - *
    - * - */ -public class FileSystemProvider extends RepositoryProvider { - - // The location of the folder on file system where the repository is stored. - private IPath root; - - // The QualifiedName that is used to persist the location accross workspace as a persistant property on a resource - private static QualifiedName FILESYSTEM_REPO_LOC = new QualifiedName(FileSystemPlugin.ID, "disk_location"); - - /** - * Create a new FileSystemProvider. - */ - public FileSystemProvider() { - super(); - } - - /** - * This method is invoked when the provider is mapped to a project. - * Although we have access to the project at this point (using - * getProject(), we don't know the root location so - * there is nothing we can do yet. - * - * @see org.eclipse.team.core.RepositoryProvider#configureProject() - */ - public void configureProject() throws CoreException { - } - - /** - * This method is invoked when the provider is unmapped from its - * project. - * - * @see org.eclipse.core.resources.IProjectNature#deconfigure() - */ - public void deconfigure() throws CoreException { - // Clear the persistant property containing the location - getProject().setPersistentProperty(FILESYSTEM_REPO_LOC, null); - } - - /** - * Return the provider ID as specified in the plugin.xml - * - * @see RepositoryProvider#getID() - */ - public String getID() { - return FileSystemPlugin.PROVIDER_ID; - } - - /** - * Set the file system location for the provider. This mist be invoked after - * the provider is mapped and configured but before the provider is used to - * perform any operations. - * - * @param location the path representing the location where the project contents will be stored. - * @throws TeamException - */ - public void setTargetLocation(String location) throws TeamException { - - // set the instance variable to the provided path - root = new Path(location); - - // ensure that the location is a folder (if it exists) - File file = new File(location); - if (file.exists() && !file.isDirectory()) { - throw new TeamException(Policy.bind("FileSystemProvider.mustBeFolder", location)); - } - - // record the location as a persistant property so it will be remembered across platform invokations - try { - getProject().setPersistentProperty(FILESYSTEM_REPO_LOC, location); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - - /** - * Returns the folder in the file system to which the provider is connected. - * Return null if there is no location or there was a problem - * determining it. - * - * @return IPath The path to the root of the repository. - */ - public IPath getRoot() { - if (root == null) { - try { - String location = getProject().getPersistentProperty(FILESYSTEM_REPO_LOC); - if (location == null) { - return null; - } - root = new Path(location); - } catch (CoreException e) { - // log the problem and carry on - FileSystemPlugin.log(e.getStatus()); - return null; - } - } - return root; - } - - /** - * Return an instance of SimpleAccessOperations that provides the - * operations for transfering data to and from the provider's location. - * Note: The interface SimpleAccessOperations is not part of the official - * Team API. We use it here for convenience. - * - * @see org.eclipse.team.core.RepositoryProvider#getSimpleAccess() - */ - public SimpleAccessOperations getSimpleAccess() { - return new FileSystemSimpleAccessOperations(this); - } - /** - * @see org.eclipse.team.core.RepositoryProvider#getFileModificationValidator() - */ - public IFileModificationValidator getFileModificationValidator() { - return new FileModificationValidator(this); - } - -} diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemRemoteResource.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemRemoteResource.java deleted file mode 100644 index cd8bb518b..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemRemoteResource.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; - -/** - * Class represents a handle to a java.io.File that conforms to - * the org.eclipse.team.core.IRemoteResource interface. - */ -public class FileSystemRemoteResource implements IRemoteResource { - - // the file object in which the data is stored on the disk - private File ioFile; - - /** - * The constructor. - * @param path the full path of the resource on disk - */ - public FileSystemRemoteResource(IPath path) { - this(new File(path.toOSString())); - } - - /** - * Create a remote resource handle from the given java.io.file - * - * @param ioFile the file - */ - FileSystemRemoteResource(File ioFile) { - this.ioFile = ioFile; - } - - /** - * Adapters are used to ensure that the right menus will appear in differnet views. - * - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class adapter) { - return Platform.getAdapterManager().getAdapter(this, adapter); - } - - /** - * Returns an input stream containing the contents of the remote resource. - * The remote resource must be a file. - * - * @see org.eclipse.team.core.sync.IRemoteResource#getContents(IProgressMonitor) - */ - public InputStream getContents(IProgressMonitor progress) throws TeamException { - if (isContainer()) - throw new TeamException("This resource is a container so it cannot have data."); - try { - return new FileInputStream(ioFile); - } catch (FileNotFoundException e) { - throw FileSystemPlugin.wrapException(e); - } - } - - /** - * Return the modification timestamp of the remote resource. - * - * @return long The date and time (in milliseconds) when the file was last changed on disk. - */ - public long getLastModified() { - return ioFile.lastModified(); - } - - /** - * @see org.eclipse.team.core.sync.IRemoteResource#getName() - */ - public String getName() { - return ioFile.getName(); - } - - /** - * @see org.eclipse.team.core.sync.IRemoteResource#isContainer() - */ - public boolean isContainer() { - return ioFile.isDirectory(); - } - - /** - * Fetch the members of the remote resource. The remote resource must be a - * container. - * - * @see org.eclipse.team.core.sync.IRemoteResource#members(IProgressMonitor) - */ - public IRemoteResource[] members(IProgressMonitor progress) throws TeamException { - // Make sure we have a container - if (!isContainer()) - throw new TeamException(Policy.bind("RemoteResource.mustBeFolder", ioFile.getName())); - - // convert the File children to remote resource children - File[] members = ioFile.listFiles(); - IRemoteResource[] result = new IRemoteResource[members.length]; - for (int i = 0; i < members.length; i++) { - result[i] = new FileSystemRemoteResource(members[i]); - } - return result; - } - - /** - * copies a single specified file to a specified location on the filesystem. - * @param dest The location on the filesystem to which the file is to be copied - * @param src The source file - */ - static void copyFile(IPath dest, File src) { - File target = new File(dest.append(src.getName()).toOSString()); - try { - InputStream in = ((IFile) src).getContents(); - java.io.FileOutputStream out = new java.io.FileOutputStream(target); - StreamUtil.pipe(in, out, target.length(), null, target.getName()); - } catch (FileNotFoundException e) {} catch (IOException e) {} catch (CoreException e) {} - } - /** - * Recursively copies an entire directory structure to a specified location on the filesystem - * @param dest The location on the filssystem to which the directory structure is to be written - * @param src The directory structure that is to be duplicated - */ - static void copyFolder(IPath dest, File src) { - String children[] = src.list(); - File current; - for (int i = 0; i < children.length; i++) { - current = new File(children[i]); - if (current.isFile()) - copyFile(dest.append(src.getName()), current); - else if (current.isDirectory()) - copyFolder(dest.append(src.getName()), current); - } - } - - /** - * Creates a copy of the remote resource in the location specified - * @param location The destination for the copy of the remote resource - */ - public void copyOver(IPath location) { - copyFolder(location, ioFile); - } - -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java deleted file mode 100644 index 9a8aff1d6..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java +++ /dev/null @@ -1,310 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -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.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations; - -/** - * SimpleAccessOperations is not part of the Team API. We use it here because it provides - * a reasonable set of operation commonly implemented by repository providers. - * Note: This class is not to be interpreted as an example of how a repository - * provider is to do its work. It is only here because we needed to have some operations - * to perform. In the future, we may update this class to illustrate the use of the workspace - * synchronizer (ISynchronizer). - */ -public class FileSystemSimpleAccessOperations implements SimpleAccessOperations { - - // A reference to the provider - private FileSystemProvider provider; - - /** - * Constructor - * @param provider - */ - FileSystemSimpleAccessOperations(FileSystemProvider provider) { - this.provider = provider; - } - - /** - * Given a local resource, finds the remote counterpart. - * @param resource The local resource to lookup - * @return FileSystemRemoteResource The remote counterpart to the given local resource - */ - public FileSystemRemoteResource getRemoteResourceFor(IResource resource) { - return new FileSystemRemoteResource(provider.getRoot().append(resource.getProjectRelativePath())); - } - - /** - * @see SimpleAccessOperations#get(IResource[], int, IProgressMonitor) - */ - public void get(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException { - // ensure the progress monitor is not null - progress = Policy.monitorFor(progress); - progress.beginTask(Policy.bind("GetAction.working"), resources.length); - for (int i = 0; i < resources.length; i++) { - Policy.checkCanceled(progress); - IPath rootdir = provider.getRoot(); - FileSystemRemoteResource remote = getRemoteResourceFor(resources[i]); - if (resources[i].getType() == IResource.FILE) { - //Copy the resource over to the other side: - IFile localFile = (IFile) resources[i]; //since we know the local resource is a file. - if (localFile.getModificationStamp() != remote.getLastModified()) { - //Only do this if the timestamps are different - try { - //Copy from the local file to the remote file: - InputStream source = null; - try { - // Get the remote file content. - source = remote.getContents(progress); - // Set the local file content to be the same as the remote file. - if (localFile.exists()) - localFile.setContents(source, false, false, progress); - else - localFile.create(source, false, progress); - } finally { - if (source != null) - source.close(); - } - } catch (IOException e) { - throw FileSystemPlugin.wrapException(e); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - } else if (depth > 0) { //Assume that resources are either files or containers. - //If the resource is a container, copy its children over. - IRemoteResource[] estranged = remote.members(progress); - IResource[] children = new IResource[estranged.length]; - - if (resources[i].getType() == IResource.PROJECT) { - for (int j = 0; j < estranged.length; j++) { - if (estranged[j].isContainer()) - children[j] = provider.getProject().getFolder(estranged[j].getName()); - else - children[j] = provider.getProject().getFile(estranged[j].getName()); - } - } else if (resources[i].getType() == IResource.FOLDER) { - //Make sure that the folder exists before trying to put anything into it: - IFolder localFolder = (IFolder) resources[i]; - if (!localFolder.exists()) { - try { - localFolder.create(false, true, progress); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - - //Create placeholder local resources to place data into: - for (int j = 0; j < estranged.length; j++) { - if (estranged[j].isContainer()) - children[j] = provider.getProject().getFolder(resources[i].getProjectRelativePath().append(estranged[j].getName())); - else - children[j] = provider.getProject().getFile(resources[i].getProjectRelativePath().append(estranged[j].getName())); - } - } - - //Recurse into children: - if (children.length > 0) - get(children, depth - 1, null); - } - progress.worked(1); - } - progress.done(); - } - - /** - * Simply make sure that the local resource is not read only. - * - * @see SimpleAccessOperations#checkout(IResource[], int, IProgressMonitor) - */ - public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException { - progress = Policy.monitorFor(progress); - progress.beginTask("Checking resources out...", resources.length); - IPath rootdir = provider.getRoot(); - for (int i = 0; i < resources.length; i++) { - Policy.checkCanceled(progress); - - //Do the actual file locking: - FileSystemRemoteResource remote = getRemoteResourceFor(resources[i]); - File diskFile = new File(rootdir.append(resources[i].getProjectRelativePath()).toOSString()); - if (resources[i].getType() == IResource.FILE) { - //TODO: lock the file on the 'server'. - resources[i].setReadOnly(false); - } else if (depth > 0) { - diskFile.mkdirs(); - //Recursively checkout children too: - try { - IResource[] children; - if (resources[i].getType() == IResource.PROJECT) - children = provider.getProject().members(); - else - children = provider.getProject().getFolder(resources[i].getName()).members(); - if (children.length > 0) - checkout(children, depth - 1, null); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - progress.worked(1); - } - progress.done(); - } - - /** - * Checkin the resources to the given depth. Mark all checked in resources as read only. - * - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#checkin(IResource[], int, IProgressMonitor) - */ - public void checkin(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException { - // ensure the progress monitor is not null - progress = Policy.monitorFor(progress); - progress.beginTask(Policy.bind("PutAction.working"), resources.length); - for (int i = 0; i < resources.length; i++) { - Policy.checkCanceled(progress); - IPath rootdir = provider.getRoot(); - // Verify that the resources are checked out: - if (!isCheckedOut(resources[i])) - return; - - File diskFile = new File(rootdir.append(resources[i].getProjectRelativePath()).toOSString()); - if (resources[i].getType() == IResource.FILE) { - //Copy the resource over to the other side: - IFile localFile = (IFile) resources[i]; //since we know the local resource is a file. - if (localFile.getModificationStamp() != diskFile.lastModified()) { - //Only do this if the timestamps are different - try { - diskFile.getParentFile().mkdirs(); - //Copy from the local file to the remote file: - InputStream in = null; - FileOutputStream out = null; - try { - in = localFile.getContents(); - out = new FileOutputStream(diskFile); - //Copy the contents of the local file to the remote file: - StreamUtil.pipe(in, out, diskFile.length(), progress, diskFile.getName()); - } finally { - if (in != null) - in.close(); - if (out != null) - out.close(); - } - } catch (IOException e) { - throw FileSystemPlugin.wrapException(e); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - } else if (depth > 0) { //Assume that resources are either files or containers. - diskFile.mkdirs(); - //Recursively copy children, if any, over as well: - try { - IResource[] children; - if (resources[i].getType() == IResource.PROJECT) - children = provider.getProject().members(); - else - children = provider.getProject().getFolder(resources[i].getName()).members(); - if (children.length > 0) - checkin(children, depth - 1, null); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - progress.worked(1); - } - uncheckout(resources, depth, progress); - progress.done(); - } - - /** - * Mark all checked in resources as read only. - * - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#uncheckout(IResource[], int, IProgressMonitor) - */ - public void uncheckout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException { - progress = Policy.monitorFor(progress); - progress.beginTask("Re-locking resources...", resources.length); - IPath rootdir = provider.getRoot(); - for (int i = 0; i < resources.length; i++) { - Policy.checkCanceled(progress); - - //Do the actual file unlocking: - FileSystemRemoteResource remote = getRemoteResourceFor(resources[i]); - File diskFile = new File(rootdir.append(resources[i].getProjectRelativePath()).toOSString()); - if (resources[i].getType() == IResource.FILE) { - //TODO: unlock the file on the 'server'. - resources[i].setReadOnly(true); - } else if (depth > 0) { - diskFile.mkdirs(); - //Recursively uncheckout children too: - try { - IResource[] children; - if (resources[i].getType() == IResource.PROJECT) - children = provider.getProject().members(); - else - children = provider.getProject().getFolder(resources[i].getName()).members(); - if (children.length > 0) - uncheckout(children, depth - 1, null); - } catch (CoreException e) { - throw FileSystemPlugin.wrapException(e); - } - } - progress.worked(1); - } - progress.done(); - } - - /** - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#delete(IResource[], IProgressMonitor) - */ - public void delete(IResource[] resources, IProgressMonitor progress) throws TeamException {} - - /** - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#moved(IPath, IResource, IProgressMonitor) - */ - public void moved(IPath source, IResource target, IProgressMonitor progress) throws TeamException {} - - /** - * A resource is checked out if it is not read only. - * - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#isCheckedOut(IResource) - */ - public boolean isCheckedOut(IResource resource) { - return !resource.isReadOnly(); - } - - /** - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#hasRemote(IResource) - */ - public boolean hasRemote(IResource resource) { - return false; - } - - /** - * @see org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations#isDirty(IResource) - */ - public boolean isDirty(IResource resource) { - return false; - } - -} diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/Policy.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/Policy.java deleted file mode 100644 index 5e3151f0e..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/Policy.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -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; - -/** - * This class is a clone of the Polciy classes many Eclipse plugin suse to - * provide NLSing of strings and aid in proper progress monitoring. - */ -public class Policy { - - protected static ResourceBundle bundle = null; - - /** - * Creates a NLS catalog for the given locale. - */ - public static void localize(String bundleName) { - bundle = ResourceBundle.getBundle(bundleName); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string. - */ - public static String bind(String id, String binding) { - return bind(id, new String[] { binding }); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - */ - public static String bind(String id, String binding1, String binding2) { - return bind(id, new String[] { binding1, binding2 }); - } - - /** - * Gets a string from the resource bundle. We don't want to crash because of a missing String. - * Returns the key if not found. - */ - public static String bind(String key) { - try { - return bundle.getString(key); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; - } - } - - /** - * 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 + "!"; - } - } - - /** - * 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; - } -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/StreamUtil.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/StreamUtil.java deleted file mode 100644 index cdca08cbc..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/StreamUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.core.runtime.IProgressMonitor; - -public class StreamUtil { - - protected final static byte[] COPY_BUFFER = new byte[4096]; - - public static void pipe( - InputStream in, - OutputStream out, - long sizeEstimate, - IProgressMonitor progress, - String title) - throws IOException { - - // Only show progress for files larger than 25Kb. - Long kilobytesEstimate = new Long(sizeEstimate / 1024); - boolean showProgress = (progress != null) && (sizeEstimate > 25000); - long bytesCopied = 0; - - synchronized (COPY_BUFFER) { - // Read the initial chunk. - int read = in.read(COPY_BUFFER, 0, COPY_BUFFER.length); - - while (read != -1) { - out.write(COPY_BUFFER, 0, read); - - // Report progress - if (showProgress) { - bytesCopied = bytesCopied + read; - progress.subTask( - Policy.bind( - "filetransfer.monitor", - new Object[] { title, new Long(bytesCopied / 1024), kilobytesEstimate })); - } - - // Read the next chunk. - read = in.read(COPY_BUFFER, 0, COPY_BUFFER.length); - } // end while - } // end synchronized - } - -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/messages.properties b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/messages.properties deleted file mode 100644 index 2b40e5e27..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/messages.properties +++ /dev/null @@ -1,28 +0,0 @@ -fileSystem.propertyLocation=Location: - -FileSystemMainPage.location=Location: -FileSystemMainPage.browseDir=&Browse... -FileSystemMainPage.notValidLocation=Location must be an existing directory - -fsMainPage.name=Select a file system location -fsMainPage.description=This location will be used to share resources with a team - -ConfigurationWizard.errorTitle=Error configuring the provider. -ConfigurationWizard.error=File System provider could not be created - -ConfigurationWizard.name=File System Repository -ConfigurationWizard.description=File System Repository Properties - -DisconnectAction.errorTitle=Error Disconnecting - -PutAction.working=Putting resources... -PutAction.problemMessage=A problem occured putting the resources. - -GetAction.working=Getting resources... -GetAction.problemMessage=A problem occured getting the resources. - -ReplaceAction.working=Replacing resources... -ReplaceAction.problemMessage=A problem occured replacing the resources. - -FileSystemProvider.mustBeFolder=Target location ''{0}'' is a file and must be a folder. -RemoteResource.mustBeFolder=Resource ''{0}'' is a file so it cannot have entries \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java deleted file mode 100644 index ea15116e5..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.examples.filesystem.FileSystemPlugin; -import org.eclipse.team.examples.filesystem.FileSystemProvider; -import org.eclipse.team.examples.filesystem.Policy; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.ui.IWorkbench; - -/** - * The file system configuration wizard used when associating a project - * the the file system provider. It is registered as a Team configuration wizard - * in the plugin.xml and is invoked when a user chooses to create a File System - * Repository Provider. One invoked, this wizard makes use of the FileSystemMainPage - * in order to obtain a target locaton on disk. - */ -public class ConfigurationWizard extends Wizard implements IConfigurationWizard { - - IProject project; - - FileSystemMainPage mainPage; - - public ConfigurationWizard() { - // retrieve the remembered dialog settings - IDialogSettings workbenchSettings = FileSystemPlugin.getPlugin().getDialogSettings(); - IDialogSettings section = workbenchSettings.getSection("ProviderExamplesWizard"); //$NON-NLS-1$ - if (section == null) { - section = workbenchSettings.addNewSection("ProviderExamplesWizard"); //$NON-NLS-1$ - } - setDialogSettings(section); - } - - /** - * Remember the project so we can map it on finish - * - * @see org.eclipse.team.ui.IConfigurationWizard#init(IWorkbench, IProject) - */ - public void init(IWorkbench workbench, IProject project) { - this.project = project; - } - - public void addPages() { - mainPage = new FileSystemMainPage( - "FileSystemMainPage", //$NON-NLS-1$ - Policy.bind("ConfigurationWizard.name"), - Policy.bind("ConfigurationWizard.description"), - null); - addPage(mainPage); - } - - /* - * Using the information entered in the main page set the provider for - * the given project. - */ - public boolean performFinish() { - mainPage.finish(null); - try { - // Map the provider and set the location - RepositoryProvider.map(project, FileSystemPlugin.PROVIDER_ID); - FileSystemProvider provider = (FileSystemProvider) RepositoryProvider.getProvider(project); - provider.setTargetLocation(mainPage.getLocation()); - } catch (TeamException e) { - ErrorDialog.openError( - getShell(), - Policy.bind("ConfigurationWizard.errorMapping"), - Policy.bind("ConfigurationWizard.error"), - e.getStatus()); - return false; - } - return true; - } - -} diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java deleted file mode 100644 index d8a61f629..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.examples.filesystem.Policy; -import org.eclipse.team.internal.ui.actions.TeamAction; - -/** - * Action for getting the contents of the selected resources - */ -public class DisconnectAction extends TeamAction { - - /** - * @see org.eclipse.ui.IActionDelegate#run(IAction) - */ - public void run(IAction action) { - IProject projects[] = getSelectedProjects(); - try { - for (int i = 0; i < projects.length; i++) { - RepositoryProvider.unmap(projects[i]); - } - } catch (TeamException e) { - ErrorDialog.openError(getShell(), Policy.bind("DisconnectAction.errorTitle"), null, e.getStatus()); - } - } - - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - return true; - } -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java deleted file mode 100644 index 6bf40986e..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.examples.filesystem.FileSystemPlugin; -import org.eclipse.team.internal.ui.actions.TeamAction; - -/** - * An abstract class that acts as a super class for FileSystemProvider actions. - * It provides some general methods applicable to multipe actions. - */ -public abstract class FileSystemAction extends TeamAction { - - /** - * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IResource[] resources = getSelectedResources(); - if (resources.length == 0) - return false; - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - // we only want to work on resources mapped to a file system provider - RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), FileSystemPlugin.PROVIDER_ID); - if (provider == null) - return false; - } - return true; - } - - /** - * Split the resources into sets associated with their project/provider - */ - protected Map getRepositoryProviderMapping() throws TeamException { - HashMap result = new HashMap(); - IResource[] resources = getSelectedResources(); - 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; - } - -} diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java deleted file mode 100644 index 063053d20..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IDialogSettings; -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.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.examples.filesystem.Policy; - -/** - * This class provides the main page of the file system repository configuration wizard. - * It allows the user to select a location on disk. Once the page is finished, the - * location can be accessed using the getLocation() method. - */ -public class FileSystemMainPage extends WizardPage { - - private static final int COMBO_HISTORY_LENGTH = 5; - - String location; - Combo locationCombo; - - /* - * WizardPage constructor comment. - * @param pageName the name of the page - * @param title the title of the page - * @param description the description of the page - * @param titleImage the image for the page - */ - - public FileSystemMainPage(String pageName, String title, String description, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - setDescription(description); - setTitle(title); - } - - /* - * Creates a new checkbox instance and sets the default layout data. - * - * @param group the composite in which to create the checkbox - * @param label the string to set into the checkbox - * @return the new checkbox - */ - protected Button createCheckBox(Composite group, String label) { - Button button = new Button(group, SWT.CHECK | SWT.LEFT); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = 2; - button.setLayoutData(data); - return button; - } - - /* - * Utility method that creates a combo box - * - * @param parent the parent for the new label - * @return the new widget - */ - protected Combo createCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.READ_ONLY); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - combo.setLayoutData(data); - return combo; - } - - /* - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - - /* - * Utility method that creates a label instance - * and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @return the new label - */ - protected Label createLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - return label; - } - - /* - * Create a text field specific for this application - * - * @param parent the parent of the new text field - * @return the new text field - */ - protected Text createTextField(Composite parent) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.verticalAlignment = GridData.CENTER; - data.grabExcessVerticalSpace = false; - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - text.setLayoutData(data); - return text; - } - - /* - * Adds an entry to a history, while taking care of duplicate history items - * and excessively long histories. The assumption is made that all histories - * should be of length ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH. - * - * @param history the current history - * @param newEntry the entry to add to the history - * @return the history with the new entry appended - */ - protected String[] addToHistory(String[] history, String newEntry) { - ArrayList l = new ArrayList(Arrays.asList(history)); - addToHistory(l, newEntry); - String[] r = new String[l.size()]; - l.toArray(r); - return r; - } - - /* - * Adds an entry to a history, while taking care of duplicate history items - * and excessively long histories. The assumption is made that all histories - * should be of length ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH. - * - * @param history the current history - * @param newEntry the entry to add to the history - */ - protected void addToHistory(List history, String newEntry) { - history.remove(newEntry); - history.add(0,newEntry); - - // since only one new item was added, we can be over the limit - // by at most one item - if (history.size() > COMBO_HISTORY_LENGTH) - history.remove(COMBO_HISTORY_LENGTH); - } - - /* - * Utility method to create an editable combo box - * - * @param parent the parent of the combo box - * @return the created combo - */ - protected Combo createEditableCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.NULL); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - combo.setLayoutData(data); - return combo; - } - - // Dialog store id constants - private static final String STORE_LOCATION = - "ExamplesFSWizardMainPage.STORE_LOCATION";//$NON-NLS-1$ - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - composite.setLayout(layout); - setControl(composite); - - Label label = new Label(composite, SWT.NULL); - label.setText(Policy.bind("FileSystemMainPage.location")); - label.setLayoutData(new GridData()); - - locationCombo = createEditableCombo(composite); - locationCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - locationCombo.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event e) { - location = ((Combo)e.widget).getText(); - FileSystemMainPage.this.validateFields(); - } - }); - - locationCombo.setFocus(); - - new Label(composite, SWT.NULL); - Button browse = new Button(composite, SWT.NULL); - browse.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - browse.setText(Policy.bind("FileSystemMainPage.browseDir")); - browse.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - DirectoryDialog d = new DirectoryDialog(getShell()); - String directory = d.open(); - if(directory!=null) { - locationCombo.setText(directory); - } - } - }); - - initializeValues(); - validateFields(); - } - - public String getLocation() { - return location; - } - - public boolean finish(IProgressMonitor monitor) { - saveWidgetValues(); - return true; - } - /** - * Initializes states of the controls. - */ - private void initializeValues() { - IDialogSettings settings = getDialogSettings(); - if (settings != null) { - String[] locations = settings.getArray(STORE_LOCATION); - if (locations != null) { - for (int i = 0; i < locations.length; i++) { - locationCombo.add(locations[i]); - } - locationCombo.select(0); - } - } - } - /** - * Saves the widget values - */ - private void saveWidgetValues() { - // Update history - IDialogSettings settings = getDialogSettings(); - if (settings != null) { - String[] locations = settings.getArray(STORE_LOCATION); - if (locations == null) locations = new String[0]; - locations = addToHistory(locations, locationCombo.getText()); - settings.put(STORE_LOCATION, locations); - } - } - - /* - * Validates the contents of the editable fields and set page completion - * and error messages appropriately. - */ - private void validateFields() { - String location = locationCombo.getText(); - if (location.length() == 0) { - setErrorMessage(null); - setPageComplete(false); - return; - } else { - File file = new File(location); - if(!file.exists() || !file.isDirectory()) { - setErrorMessage(Policy.bind("FileSystemMainPage.notValidLocation")); - setPageComplete(false); - return; - } - } - setErrorMessage(null); - setPageComplete(true); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemPropertiesPage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemPropertiesPage.java deleted file mode 100644 index 5bf90f4f7..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemPropertiesPage.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.ui.dialogs.PropertyPage; -/* - * A property page which displays the file system specific properties - * for the selected resource. - */ -public class FileSystemPropertiesPage extends PropertyPage { - // The resource to show properties for - protected IResource resource; - - /* - * Creates a key-value property pair in the given parent. - * - * @param parent the parent for the labels - * @param left the string for the left label - * @param right the string for the right label - */ - protected void createPair(Composite parent, String left, String right) { - Label label = new Label(parent, SWT.NONE); - label.setText(left); - - label = new Label(parent, SWT.NONE); - label.setText(right); - label.setToolTipText(right); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - /* - * Returns the element selected when the properties was run - * @return the selected element - */ - protected IResource getSelectedElement() { - // get the resource that is the source of this property page - IResource resource = null; - IAdaptable element = getElement(); - if (element instanceof IResource) { - resource = (IResource)element; - } else { - Object adapter = element.getAdapter(IResource.class); - if (adapter instanceof IResource) { - resource = (IResource)adapter; - } - } - return resource; - } - - /* - * @see PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginHeight = layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - IResource resource = getSelectedElement(); - RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject()); - return composite; - } -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/GetAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/GetAction.java deleted file mode 100644 index a68dc8453..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/GetAction.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.examples.filesystem.FileSystemProvider; -import org.eclipse.team.examples.filesystem.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for getting the contents of the selected resources - */ -public class GetAction extends FileSystemAction { - - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Map table = getRepositoryProviderMapping(); - monitor.beginTask(null, table.size() * 1000); - monitor.setTaskName(Policy.bind("GetAction.working")); //$NON-NLS-1$ - for (Iterator iter = table.keySet().iterator(); iter.hasNext();) { - IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000); - FileSystemProvider provider = (FileSystemProvider) iter.next(); - List list = (List) table.get(provider); - IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]); - provider.getSimpleAccess().get(providerResources, IResource.DEPTH_INFINITE, subMonitor); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("GetAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$ - } -} \ No newline at end of file diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java deleted file mode 100644 index 35d564a48..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.examples.filesystem.FileSystemProvider; -import org.eclipse.team.examples.filesystem.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for checking in the selected resources - */ -public class PutAction extends FileSystemAction { - - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Map table = getRepositoryProviderMapping(); - monitor.beginTask(null, table.size() * 1000); - monitor.setTaskName(Policy.bind("PutAction.working")); //$NON-NLS-1$ - for (Iterator iter = table.keySet().iterator(); iter.hasNext();) { - IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000); - FileSystemProvider provider = (FileSystemProvider) iter.next(); - List list = (List) table.get(provider); - IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]); - provider.getSimpleAccess().checkin(providerResources, IResource.DEPTH_INFINITE, subMonitor); - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("PutAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$ - } -} diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java deleted file mode 100644 index b89d2d16e..000000000 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -package org.eclipse.team.examples.filesystem.ui; - -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.examples.filesystem.FileSystemProvider; -import org.eclipse.team.examples.filesystem.FileSystemRemoteResource; -import org.eclipse.team.examples.filesystem.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for replacing the contents of the selected resources with whatever is in the repository - */ -public class ReplaceAction extends FileSystemAction { - - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - Map table = getRepositoryProviderMapping(); - monitor.beginTask(null, table.size() * 1000); - monitor.setTaskName(Policy.bind("ReplaceAction.working")); //$NON-NLS-1$ - for (Iterator iter = table.keySet().iterator(); iter.hasNext();) { - IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000); - FileSystemProvider provider = (FileSystemProvider) iter.next(); - List list = (List) table.get(provider); - IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]); - //Grab the remote counterparts of 'providerResources': - FileSystemRemoteResource[] remote = new FileSystemRemoteResource[list.size()]; - for (int i = 0; i < remote.length; i++) { - remote[i] = new FileSystemRemoteResource(provider.getRoot().append(providerResources[i].getProjectRelativePath())); - } - //copy the entire tree structure: - IPath dropSpot = null; - for (int i = 0; i < providerResources.length; i++) { - if (providerResources[i].getType() == IResource.FILE) { - IFile localFile = (IFile) providerResources[i]; - dropSpot = localFile.getLocation().removeLastSegments(1); - } else if (providerResources[i].getType() == IResource.FOLDER||providerResources[i].getType() == IResource.PROJECT) { - IContainer localDir = (IContainer) providerResources[i]; - dropSpot = localDir.getLocation().removeLastSegments(1); - } - if (remote[i].isContainer()) - remote[i].copyOver(dropSpot); - else - provider.getSimpleAccess().get(new IResource[] { providerResources[i] }, IResource.DEPTH_ONE, subMonitor); - } - } - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }, Policy.bind("ReplaceAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$ - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/.classpath b/tests/org.eclipse.team.tests.core/.classpath deleted file mode 100644 index f652b1282..000000000 --- a/tests/org.eclipse.team.tests.core/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.core/.cvsignore b/tests/org.eclipse.team.tests.core/.cvsignore deleted file mode 100644 index ba077a403..000000000 --- a/tests/org.eclipse.team.tests.core/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/tests/org.eclipse.team.tests.core/.project b/tests/org.eclipse.team.tests.core/.project deleted file mode 100644 index c7d33535d..000000000 --- a/tests/org.eclipse.team.tests.core/.project +++ /dev/null @@ -1,38 +0,0 @@ - - - org.eclipse.team.tests.core - - - org.apache.xerces - org.eclipse.compare - org.eclipse.core.boot - org.eclipse.core.resources - org.eclipse.core.runtime - org.eclipse.core.tests.harness - org.eclipse.team.core - org.eclipse.team.ui - org.eclipse.ui - org.junit - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/tests/org.eclipse.team.tests.core/about.html b/tests/org.eclipse.team.tests.core/about.html deleted file mode 100644 index 9db411aab..000000000 --- a/tests/org.eclipse.team.tests.core/about.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -About - - - -

    About This Content

    - -

    20th June, 2002

    -

    License

    -

    Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

    - -

    Contributions

    - -

    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.

    - -

    If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

    - - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/build-tests.xml b/tests/org.eclipse.team.tests.core/build-tests.xml deleted file mode 100644 index 9a16b11eb..000000000 --- a/tests/org.eclipse.team.tests.core/build-tests.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/build.properties b/tests/org.eclipse.team.tests.core/build.properties deleted file mode 100644 index f297abfd1..000000000 --- a/tests/org.eclipse.team.tests.core/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -source.teamtests.jar=src/ -bin.includes=about.html,plugin.xml,*.jar,test.xml, ftp.properties, webdav.properties \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/ftp.properties b/tests/org.eclipse.team.tests.core/ftp.properties deleted file mode 100644 index 5139600c3..000000000 --- a/tests/org.eclipse.team.tests.core/ftp.properties +++ /dev/null @@ -1,7 +0,0 @@ -target=org.eclipse.team.ftp -test_dir=target -location=ftp://@host@/path -username=@user@ -password=@password@ -connectionTimeout=6000 -passive=true \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/plugin.xml b/tests/org.eclipse.team.tests.core/plugin.xml deleted file mode 100644 index 71cf6c98a..000000000 --- a/tests/org.eclipse.team.tests.core/plugin.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTargetTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTargetTests.java deleted file mode 100644 index f93f74a9f..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTargetTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.core.tests.harness.EclipseWorkspaceTest; - -public class AllTargetTests extends EclipseWorkspaceTest { - - /** - * Constructor for AllTargetTests. - */ - public AllTargetTests() { - super(); - } - - /** - * Constructor for AllTargetTests. - * @param name - */ - public AllTargetTests(String name) { - super(name); - } - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(TargetProviderTests.suite()); - suite.addTest(RemoteResourceTests.suite()); - suite.addTest(SyncElementTest.suite()); - return new TargetTestSetup(suite); - } -} diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java deleted file mode 100644 index befe86577..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.core.tests.harness.EclipseWorkspaceTest; - -public class AllTeamTests extends EclipseWorkspaceTest { - - /** - * Constructor for CVSClientTest. - */ - public AllTeamTests() { - super(); - } - - /** - * Constructor for CVSClientTest. - * @param name - */ - public AllTeamTests(String name) { - super(name); - } - - /* - * ORDER IS IMPORTANT: Run compatibility and resource tests before any other!!! - */ - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(RepositoryProviderTests.suite()); - suite.addTest(StreamTests.suite()); - return suite; - } -} - diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RemoteResourceTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RemoteResourceTests.java deleted file mode 100644 index 6b137f4d4..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RemoteResourceTests.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.io.IOException; -import java.io.InputStream; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.TargetProvider; - -/** - * A set of test cases for org.eclipse.team.core.sync.IRemoteResource - */ -public class RemoteResourceTests extends TeamTest { - public RemoteResourceTests() { - super(); - } - public RemoteResourceTests(String name) { - super(name); - } - public static Test suite() { - TestSuite suite = new TestSuite(RemoteResourceTests.class); - return new TargetTestSetup(suite); - } - - protected IProject createAndPut(String projectPrefix, String[] resourceNames) throws CoreException, TeamException { - IProject project = getUniqueTestProject(projectPrefix); - IResource[] resources = buildResources(project, resourceNames, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - return project; - } - - public void testGetName() throws CoreException, TeamException { - IProject project = createAndPut("getname", new String[] { "file1.txt", "folder1/", "folder1/b.txt" }); - TargetProvider target = getProvider(project); - IRemoteResource remote = target.getRemoteResource(); - assertEquals(project.getName(), remote.getName()); - } - public void testIsContainerSuccess() throws CoreException, TeamException { - IProject project = getUniqueTestProject("iscontainer"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - IRemoteResource remote = target.getRemoteResource(); - assertTrue(remote.isContainer()); - } - public void testIsContainerFail() throws CoreException, TeamException { - IProject project = createAndPut("iscontainer", new String[] { "file1.txt", "folder1/", "folder1/b.txt" }); - TargetProvider target = getProvider(project); - IRemoteResource remote = target.getRemoteResourceFor(project.getFile("file1.txt")); - assertTrue(!remote.isContainer()); - } - public void testGetContents() throws CoreException, TeamException { - IProject project = createAndPut("getname", new String[] { "file1.txt", "folder1/", "folder1/b.txt" }); - TargetProvider target = getProvider(project); - IRemoteResource remote = target.getRemoteResourceFor(project.getFile("file1.txt")); - InputStream jin = remote.getContents(DEFAULT_MONITOR); - try { - while (jin.available() > 0) { - jin.read(); - } - } catch (IOException e) { - System.out.flush(); - e.printStackTrace(System.err); - fail("Couldn't read from the input stream."); - } - } - public void testMembers() throws CoreException, TeamException { - IProject project = createAndPut("getname", new String[] { "file1.txt", "folder1/", "folder1/b.txt" }); - TargetProvider target = getProvider(project); - IRemoteResource remote = target.getRemoteResource(); - IRemoteResource[] altResources = remote.members(DEFAULT_MONITOR); - for (int i = 0; i < altResources.length; i++) { - assertEquals(altResources[i], project.findMember(altResources[i].getName())); - } - } - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - properties=TargetTestSetup.properties; - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java deleted file mode 100644 index 72355c9d2..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import org.eclipse.core.resources.IFileModificationValidator; -import org.eclipse.core.resources.team.IMoveDeleteHook; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.team.core.RepositoryProvider; - -public class RepositoryProviderBic extends RepositoryProvider { - - final public static String NATURE_ID = "org.eclipse.team.tests.core.bic-provider"; - - private IMoveDeleteHook mdh; - private IFileModificationValidator mv; - - /* - * @see RepositoryProvider#configureProject() - */ - public void configureProject() throws CoreException { - } - - /* - * @see RepositoryProvider#getID() - */ - public String getID() { - return NATURE_ID; - } - /* - * @see IProjectNature#deconfigure() - */ - public void deconfigure() throws CoreException { - } - - /* - * @see RepositoryProvider#getFileModificationValidator() - */ - public IFileModificationValidator getFileModificationValidator() { - return mv; - } - - /* - * @see RepositoryProvider#getMoveDeleteHook() - */ - public IMoveDeleteHook getMoveDeleteHook() { - return mdh; - } - - public void setModificationValidator(IFileModificationValidator mv) { - this.mv = mv; - } - - public void setMoveDeleteHook(IMoveDeleteHook mdh) { - this.mdh = mdh; - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java deleted file mode 100644 index fca87fb4c..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import org.eclipse.core.resources.IFileModificationValidator; -import org.eclipse.core.resources.team.IMoveDeleteHook; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.team.core.RepositoryProvider; - -public class RepositoryProviderNaish extends RepositoryProvider { - - final public static String NATURE_ID = "org.eclipse.team.tests.core.naish-provider"; - private IMoveDeleteHook mdh; - private IFileModificationValidator mv; - /* - * @see RepositoryProvider#configureProject() - */ - public void configureProject() throws CoreException { - } - - /* - * @see RepositoryProvider#getID() - */ - public String getID() { - return NATURE_ID; - } - /* - * @see IProjectNature#deconfigure() - */ - public void deconfigure() throws CoreException { - } - - public void setModificationValidator(IFileModificationValidator mv) { - this.mv = mv; - } - - public void setMoveDeleteHook(IMoveDeleteHook mdh) { - this.mdh = mdh; - } - /* - * @see RepositoryProvider#getFileModificationValidator() - */ - public IFileModificationValidator getFileModificationValidator() { - return mv; - } - - /* - * @see RepositoryProvider#getMoveDeleteHook() - */ - public IMoveDeleteHook getMoveDeleteHook() { - return mdh; - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java deleted file mode 100644 index 9ff6d2d80..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.team.core.RepositoryProvider; - -public class RepositoryProviderOtherSport extends RepositoryProvider { - - final public static String NATURE_ID = "org.eclipse.team.tests.core.other"; - - /* - * @see RepositoryProvider#configureProject() - */ - public void configureProject() throws CoreException { - } - - /* - * @see RepositoryProvider#getID() - */ - public String getID() { - return NATURE_ID; - } - /* - * @see IProjectNature#deconfigure() - */ - public void deconfigure() throws CoreException { - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java deleted file mode 100644 index d26e5cc34..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFileModificationValidator; -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.IResourceStatus; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.team.IMoveDeleteHook; -import org.eclipse.core.resources.team.IResourceTree; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; - -public class RepositoryProviderTests extends TeamTest { - public RepositoryProviderTests() { - super(); - } - - public RepositoryProviderTests(String name) { - super(name); - } - - public static Test suite() { - TestSuite suite = new TestSuite(RepositoryProviderTests.class); - return new TestSetup(suite); - //return new testSetup(new RepositoryProviderTests("test")); - } - - public void testProvidersRegistered() throws CoreException, TeamException { - List repoProviderIds = new ArrayList(Arrays.asList(RepositoryProvider.getAllProviderTypeIds())); - assertEquals(true, repoProviderIds.contains(RepositoryProviderBic.NATURE_ID)); - assertEquals(true, repoProviderIds.contains(RepositoryProviderNaish.NATURE_ID)); - assertEquals(false, repoProviderIds.contains(RepositoryProviderOtherSport.NATURE_ID)); - } - - public void testGetProviderGeneric() throws CoreException, TeamException { - IProject project = getUniqueTestProject("testGetProviderGeneric1"); - IProject project2 = getUniqueTestProject("testGetProviderGeneric2"); - - // test that adding a non registered provider doesn't work - boolean good = false; - try { - RepositoryProvider.map(project, RepositoryProviderOtherSport.NATURE_ID); - } catch (TeamException e) { - good = true; - } - assertTrue(good); - - // adding a valid team provider should be fine - RepositoryProvider.map(project, RepositoryProviderNaish.NATURE_ID); - RepositoryProvider.map(project2, RepositoryProviderNaish.NATURE_ID); - RepositoryProvider provider1 = RepositoryProvider.getProvider(project); - RepositoryProvider provider2 = RepositoryProvider.getProvider(project2); - assertTrue(provider1 != null && provider1.getID().equals(RepositoryProviderNaish.NATURE_ID)); - assertTrue(provider2 != null && provider2.getID().equals(RepositoryProviderNaish.NATURE_ID)); - assertTrue(provider1.getProject().equals(project) && provider2.getProject().equals(project2)); - - // remapping a provider is allowed - RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); - provider1 = RepositoryProvider.getProvider(project); - assertTrue(provider1 != null && provider1.getID().equals(RepositoryProviderBic.NATURE_ID)); - - // closed or non-existant projects cannot be associated with a provider - IProject closedProject = getUniqueTestProject("testGetProviderGenericClosed"); - IProject nonExistantProject = ResourcesPlugin.getWorkspace().getRoot().getProject("nonExistant"); - closedProject.close(null); - assertTrue(RepositoryProvider.getProvider(closedProject) == null); - assertTrue(RepositoryProvider.getProvider(nonExistantProject) == null); - - // removing the nature removes the provider association - RepositoryProvider.unmap(project); - RepositoryProvider.unmap(project2); - assertTrue(RepositoryProvider.getProvider(project)==null); - assertTrue(RepositoryProvider.getProvider(project2)==null); - } - - public void testGetProviderById() throws CoreException, TeamException { - IProject project1 = getUniqueTestProject("testGetProviderById_1"); - IProject project2 = getUniqueTestProject("testGetProviderById_2"); - - // adding a valid team provider should be fine - RepositoryProvider.map(project1, RepositoryProviderBic.NATURE_ID); - RepositoryProvider.map(project2, RepositoryProviderNaish.NATURE_ID); - assertTrue(RepositoryProvider.getProvider(project1, RepositoryProviderBic.NATURE_ID)!=null); - assertTrue(RepositoryProvider.getProvider(project2, RepositoryProviderNaish.NATURE_ID)!=null); - - // closed or non-existant projects cannot be associated with a provider - IProject closedProject = getUniqueTestProject("testGetProviderGenericClosed"); - IProject nonExistantProject = ResourcesPlugin.getWorkspace().getRoot().getProject("nonExistant"); - closedProject.close(null); - assertTrue(RepositoryProvider.getProvider(closedProject, "id") == null); - assertTrue(RepositoryProvider.getProvider(nonExistantProject, "id") == null); - - // removing the nature removes the provider association - RepositoryProvider.unmap(project1); - RepositoryProvider.unmap(project2); - assertTrue(RepositoryProvider.getProvider(project1, RepositoryProviderBic.NATURE_ID)==null); - assertTrue(RepositoryProvider.getProvider(project2, RepositoryProviderNaish.NATURE_ID)==null); - } - - public void testFileModificationValidator() throws CoreException, TeamException { - IProject project = getUniqueTestProject("testFileModificationValidator"); - - // adding a valid team provider should be fine - RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); - RepositoryProviderBic bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(project, RepositoryProviderBic.NATURE_ID); - assertTrue(bicProvider!=null); - - // test that validator gets called by team core dispatching - final boolean[] called = new boolean[] {false}; - bicProvider.setModificationValidator(new IFileModificationValidator() { - // can't test validate edit here because it is only called from editors - public IStatus validateEdit(IFile[] files, Object context) { - return null; - } - public IStatus validateSave(IFile file) { - called[0] = true; - return getTeamTestStatus(IStatus.OK); - } - }); - IFile file = project.getFile("test.txt"); - file.create(new ByteArrayInputStream("test".getBytes()), true, null); - file.setContents(new ByteArrayInputStream("test2".getBytes()), true, false, null); - assertTrue(called[0] == true); - - // test that validator can veto a setContents - called[0] = false; - bicProvider.setModificationValidator(new IFileModificationValidator() { - // can't test validate edit here because it is only called from editors - public IStatus validateEdit(IFile[] files, Object context) { - return null; - } - public IStatus validateSave(IFile file) { - called[0] = true; - return getTeamTestStatus(IStatus.ERROR); - } - }); - try { - file.setContents(new ByteArrayInputStream("test3".getBytes()), true, false, null); - fail("validate hook should veto this setContents"); - } catch(CoreException e) { - assertTrue(called[0] == true); - } - - // test that default validator allows the modification - bicProvider.setModificationValidator(null); - file.setContents(new ByteArrayInputStream("test4".getBytes()), true, false, null); - } - - public void testMoveDeleteHook() throws CoreException, TeamException { - final IProject project = getUniqueTestProject("testMoveDeleteHook"); - - // adding a valid team provider should be fine - RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); - RepositoryProviderBic bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(project, RepositoryProviderBic.NATURE_ID); - assertTrue(bicProvider!=null); - - // only testing that dispatching works, resources plugin is testing the rest of the API - final boolean[] called = new boolean[] {false, false, false, false, false, false}; - IMoveDeleteHook hook = new IMoveDeleteHook() { - public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor) { - called[0] = true; - return false; - } - public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) { - called[1] = true; - return false; - } - public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { - called[2] = true; - return false; - } - public boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) { - called[3] = true; - return false; - } - public boolean moveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) { - called[4] = true; - return false; - } - public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) { - called[5] = true; - return false; - } - }; - bicProvider.setMoveDeleteHook(hook); - - IResource[] resources = buildResources(project, new String[] {"deleteFile.txt", "moveFile.txt", "deletedFolder/", "moveFolder/"}); - ensureExistsInWorkspace(resources, true); - resources[0].delete(false, null); - resources[1].move(resources[1].getFullPath().removeLastSegments(1).append("movedFile_NEW"), false, null); - resources[2].delete(false, null); - resources[3].move(resources[3].getFullPath().removeLastSegments(1).append("movedFolder"), false, null); - // moving using the description allows the moved project to have natures ids or origination - IProjectDescription desc = project.getDescription(); - desc.setName("movedProject"); - project.move(desc, false, null); - IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject("movedProject"); - bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(newProject); - bicProvider.setMoveDeleteHook(hook); - newProject.delete(true, null); - for (int i = 0; i < called.length; i++) { - assertTrue(called[i]); - } - } - - public void testMoveDeleteHookBetweenProjects() throws CoreException, TeamException { - final IProject projectA = getUniqueTestProject("testMoveDeleteHookBetweenProjects_A"); - final IProject projectB = getUniqueTestProject("testMoveDeleteHookBetweenProjects_B"); - final IProject projectC = getUniqueTestProject("testMoveDeleteHookBetweenProjects_C"); - - // adding a valid team provider should be fine - RepositoryProvider.map(projectA, RepositoryProviderBic.NATURE_ID); - final RepositoryProviderBic bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(projectA, RepositoryProviderBic.NATURE_ID); - RepositoryProvider.map(projectB, RepositoryProviderNaish.NATURE_ID); - final RepositoryProviderNaish naishProvider = (RepositoryProviderNaish)RepositoryProvider.getProvider(projectB, RepositoryProviderNaish.NATURE_ID); - assertTrue(bicProvider!=null && naishProvider!=null); - - // only testing that dispatching works, resources plugin is testing the rest of the API - final boolean[] calledProjectA = new boolean[] {false, false}; - bicProvider.setMoveDeleteHook(new IMoveDeleteHook() { - public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor) { - return false; - } - public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) { - return false; - } - public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { - return false; - } - public boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) { - assertTrue(bicProvider.getProject().equals(source.getProject())); - calledProjectA[0] = true; - return false; - } - public boolean moveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) { - assertTrue(bicProvider.getProject().equals(source.getProject())); - calledProjectA[1] = true; - return false; - } - public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) { - return false; - } - }); - - final boolean[] calledProjectB = new boolean[] {false, false}; - naishProvider.setMoveDeleteHook(new IMoveDeleteHook() { - public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor) { - return false; - } - public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) { - return false; - } - public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { - return false; - } - public boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) { - assertTrue(bicProvider.getProject().equals(destination.getProject())); - calledProjectB[0] = true; - return false; - } - public boolean moveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) { - assertTrue(bicProvider.getProject().equals(destination.getProject())); - calledProjectB[1] = true; - return false; - } - public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) { - return false; - } - }); - - // test that moving files/folders between two projects with providers calls the destination - IResource[] resources = buildResources(projectA, new String[] {"moveFile.txt", "moveFolder/"}); - ensureExistsInWorkspace(resources, true); - resources[0].move(projectB.getFullPath().append("moveFile_new.txt"), false, null); - resources[1].move(projectB.getFullPath().append("movedFolder"), false, null); - for (int i = 0; i < calledProjectA.length; i++) { - assertTrue(calledProjectA[i] && calledProjectB[i]==false); - } - - // test that moving files/folders from a project with a provider to a project without a provider calls the - // hooks for the source - calledProjectA[0] = false; calledProjectA[1] = false; - calledProjectB[0] = false; calledProjectB[1] = false; - resources = buildResources(projectA, new String[] {"anotherMovedFiled.txt", "anotherMovedFolder/"}); - ensureExistsInWorkspace(resources, true); - resources[0].move(projectC.getFullPath().append("moveFileOther_new.txt"), false, null); - resources[1].move(projectC.getFullPath().append("movedFolderOther"), false, null); - for (int i = 0; i < calledProjectA.length; i++) { - assertTrue(calledProjectA[i] && calledProjectB[i]==false); - } - } - - public void testMapSuccess() throws CoreException, TeamException { - IProject project = getUniqueTestProject("testLinkSuccess"); - buildResources(project, new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }, true); - IFolder folder = project.getFolder("link"); - folder.createLink(getRandomLocation(), IResource.ALLOW_MISSING_LOCAL, null); - RepositoryProviderWithLinking.setCanHandleLinking(true); - RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); - } - - public void testLinkSuccess() throws CoreException, TeamException { - IProject project = getUniqueTestProject("testLinkSuccess"); - buildResources(project, new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }, true); - RepositoryProviderWithLinking.setCanHandleLinking(true); - RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); - IFolder folder = project.getFolder("link"); - folder.createLink(getRandomLocation(), IResource.ALLOW_MISSING_LOCAL, null); - } - - public void testMapFailure() throws CoreException, TeamException { - IProject project = getUniqueTestProject("testLinkSuccess"); - buildResources(project, new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }, true); - IFolder folder = project.getFolder("link"); - folder.createLink(getRandomLocation(), IResource.ALLOW_MISSING_LOCAL, null); - try { - RepositoryProviderWithLinking.setCanHandleLinking(false); - RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); - } catch (TeamException e) { - if (e.getStatus().getCode() != IResourceStatus.LINKING_NOT_ALLOWED) { - throw e; - } - return; - } - fail("Link should be disallowed"); - } - - public void testLinkFailure() throws CoreException, TeamException { - IProject project = getUniqueTestProject("testLinkSuccess"); - buildResources(project, new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }, true); - RepositoryProviderWithLinking.setCanHandleLinking(false); - RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); - IFolder folder = project.getFolder("link"); - try { - folder.createLink(getRandomLocation(), IResource.ALLOW_MISSING_LOCAL, null); - } catch (CoreException e) { - if (e.getStatus().getCode() != IResourceStatus.LINKING_NOT_ALLOWED) { - throw e; - } - return; - } - fail("Link should be disallowed"); - } - - public void testIsShared() throws CoreException, TeamException { - IProject project1 = getUniqueTestProject("testGetProviderById_1"); - RepositoryProvider.map(project1, RepositoryProviderBic.NATURE_ID); - assertTrue(RepositoryProvider.isShared(project1)); - RepositoryProvider.unmap(project1); - assertTrue(!RepositoryProvider.isShared(project1)); - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTypeBic.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTypeBic.java deleted file mode 100644 index 5a0d469a6..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTypeBic.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.eclipse.team.tests.core; - -import java.io.File; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.ProjectSetCapability; -import org.eclipse.team.core.RepositoryProviderType; -import org.eclipse.team.core.TeamException; - -public class RepositoryProviderTypeBic extends RepositoryProviderType { - File createdFile; - /** - * @see org.eclipse.team.core.RepositoryProviderType#getProjectSetCapability() - */ - public ProjectSetCapability getProjectSetCapability() { - return new ProjectSetCapability() { - public IProject[] addToWorkspace( - String[] referenceStrings, - String filename, - IPath root, - Object context, - IProgressMonitor monitor) - throws TeamException { - return null; - } - - public void projectSetCreated( - File file, - IProgressMonitor monitor) { - - createdFile = file; - } - }; - } - - /** - * @return File - */ - public File getCreatedFile() { - return createdFile; - } - - /** - * Sets the createdFile. - * @param createdFile The createdFile to set - */ - public void setCreatedFile(File createdFile) { - this.createdFile = createdFile; - } - -} diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java deleted file mode 100644 index 3d1d7082d..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.team.core.RepositoryProvider; - -/** - * This class is used to text resource linking - */ -public class RepositoryProviderWithLinking extends RepositoryProvider { - - final public static String TYPE_ID = "org.eclipse.team.tests.core.linking"; - - private static boolean canHandleLinking = false; - - /** - * @see org.eclipse.team.core.RepositoryProvider#configureProject() - */ - public void configureProject() throws CoreException { - } - /** - * @see org.eclipse.team.core.RepositoryProvider#getID() - */ - public String getID() { - return TYPE_ID; - } - /** - * @see org.eclipse.core.resources.IProjectNature#deconfigure() - */ - public void deconfigure() throws CoreException { - } - - /** - * Sets the canHandleLinking. - * @param canHandleLinking The canHandleLinking to set - */ - public static void setCanHandleLinking(boolean canHandleLinking) { - RepositoryProviderWithLinking.canHandleLinking = canHandleLinking; - } - - /** - * @see org.eclipse.team.core.RepositoryProvider#canHandleLinkedResources() - */ - public boolean canHandleLinkedResources() { - return canHandleLinking; - } - -} diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java deleted file mode 100644 index b423aebe3..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.team.internal.core.streams.CRLFtoLFInputStream; -import org.eclipse.team.internal.core.streams.LFtoCRLFInputStream; - -public class StreamTests extends TestCase { - private static final byte[] EMPTY_SEQ = new byte[] { }; - private static final byte[] LF_SEQ = new byte[] { '\n' }; - private static final byte[] CRLF_SEQ = new byte[] { '\r', '\n' }; - - public StreamTests(String name) { - super(name); - } - - public static Test suite() { - return new TestSuite(StreamTests.class); - } - - public void testCRLFtoLFInputStream() throws IOException { - testCRLFtoLFTranslation("", ""); - testCRLFtoLFTranslation("a", "a"); - testCRLFtoLFTranslation("abc", "abc"); - testCRLFtoLFTranslation("\n", "\n"); - testCRLFtoLFTranslation("\r", "\r"); - testCRLFtoLFTranslation("\r\n", "\n"); - testCRLFtoLFTranslation("x\r\r\n\rx", "x\r\n\rx"); - testCRLFtoLFTranslation("The \r\n quick brown \n fox \r\n\n\r\r\n jumped \n\n over \r\n the \n lazy dog.\r\n", - "The \n quick brown \n fox \n\n\r\n jumped \n\n over \n the \n lazy dog.\n"); - } - - private void testCRLFtoLFTranslation(String pre, String post) throws IOException { - ByteArrayInputStream bin = new ByteArrayInputStream(pre.getBytes()); - InputStream in = new CRLFtoLFInputStream(bin); - InputStream inExpected = new ByteArrayInputStream(post.getBytes()); - assertStreamEquals(inExpected, in); - } - - public void testLFtoCRLFInputStream() throws IOException { - testLFtoCRLFTranslation("", ""); - testLFtoCRLFTranslation("a", "a"); - testLFtoCRLFTranslation("abc", "abc"); - testLFtoCRLFTranslation("\n", "\r\n"); - testLFtoCRLFTranslation("\r", "\r"); - testLFtoCRLFTranslation("\r\n", "\r\r\n"); - testLFtoCRLFTranslation("x\r\r\n\rx", "x\r\r\r\n\rx"); - testLFtoCRLFTranslation("The \r\n quick brown \n fox \r\n\n\r\r\n jumped \n\n over \r\n the \n lazy dog.\r\n", - "The \r\r\n quick brown \r\n fox \r\r\n\r\n\r\r\r\n jumped \r\n\r\n over \r\r\n the \r\n lazy dog.\r\r\n"); - } - - private void testLFtoCRLFTranslation(String pre, String post) throws IOException { - ByteArrayInputStream bin = new ByteArrayInputStream(pre.getBytes()); - InputStream in = new LFtoCRLFInputStream(bin); - InputStream inExpected = new ByteArrayInputStream(post.getBytes()); - assertStreamEquals(inExpected, in); - } - - private void assertStreamEquals(InputStream in1, InputStream in2) throws IOException { - try { - for (;;) { - int byte1 = in1.read(); - int byte2 = in2.read(); - assertEquals("Streams not equal", byte1, byte2); - if (byte1 == -1) break; - } - } finally { - in1.close(); - in2.close(); - } - } -} diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java deleted file mode 100644 index 0cadc19b8..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java +++ /dev/null @@ -1,707 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -import junit.framework.AssertionFailedError; -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.core.sync.RemoteSyncElement; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; - -public class SyncElementTest extends TeamTest { - /* - * Constructor for SyncElementTest. - */ - public SyncElementTest() { - super(); - } - - /* - * Constructor for SyncElementTest. - * @param name - */ - public SyncElementTest(String name) { - super(name); - } - - public static Test suite() { - TestSuite suite = new TestSuite(SyncElementTest.class); - return new TargetTestSetup(suite); - //return new CVSTestSetup(new SyncElementTest("testAdditionConflicts")); - } - /* - * Get the child in the sync tree - */ - protected ILocalSyncElement getChild(ILocalSyncElement tree, IPath path) throws TeamException { - if (path.segmentCount() == 0) - return tree; - ILocalSyncElement[] children = tree.members(DEFAULT_MONITOR); - for (int i = 0; i < children.length; i++) { - if (children[i].getName().equals(path.segment(0))) - return getChild(children[i], path.removeFirstSegments(1)); - } - assertTrue("Child " + path.toString() + " does not exist", false); - return null; - } - - /* - * Assert that the specified resources in the tree have the specified sync kind - * Ignore conflict types if they are not specified in the assert statement - */ - public void assertSyncEquals(String message, ILocalSyncElement tree, String[] resources, int[] syncKinds, int granularity) - throws TeamException { - assertTrue(resources.length == syncKinds.length); - for (int i = 0; i < resources.length; i++) { - int conflictTypeMask = 0x0F; // ignore manual and auto merge sync types for now. - ILocalSyncElement child = getChild(tree, new Path(resources[i])); - int kind = child.getSyncKind(granularity, DEFAULT_MONITOR) & conflictTypeMask; - int kindOther = syncKinds[i] & conflictTypeMask; - assertTrue( - message - + ": improper sync state for " - + resources[i] - + " expected " - + RemoteSyncElement.kindToString(kindOther) - + " but was " - + RemoteSyncElement.kindToString(kind), - kind == kindOther); - } - } - - public void assertSyncEquals(String message, ILocalSyncElement tree, String[] resources, int[] syncKinds) throws TeamException { - assertSyncEquals(message, tree, resources, syncKinds, ILocalSyncElement.GRANULARITY_TIMESTAMP); - } - - /* - * Assert that the named resources have no local resource or sync info - */ - public void assertDeleted(String message, IRemoteSyncElement tree, String[] resources) throws CoreException, TeamException { - for (int i = 0; i < resources.length; i++) { - try { - getChild(tree, new Path(resources[i])); - } catch (AssertionFailedError e) { - break; - } - assertTrue(message + ": resource " + resources[i] + " still exists in some form", false); - } - } - - IRemoteSyncElement getRemoteSyncTree(IProject project, IProgressMonitor monitor) throws TeamException { - return getProvider(project).getRemoteSyncElement(project); - } - protected IProject checkoutCopy(IProject project, String postfix) throws CoreException,TeamException { - TargetProvider provider = getProvider(project); - IProject result = getUniqueTestProject(project.getName()+postfix); - TargetManager.map(result, provider.getSite(), UrlUtil.getTrailingPath(provider.getURL(), provider.getSite().getURL())); - TargetProvider target = TargetManager.getProvider(result); - target.get(new IResource[] { result }, null); - return result; - } - protected void getResourcesFromTarget(IProject project, String[] resourceNames)throws TeamException,CoreException { - TargetProvider provider=getProvider(project); - IResource[] resources=getResources(project,resourceNames); - provider.get(resources,null); - } - protected void putResourcesOntoTarget(IProject project, String[] resourceNames)throws TeamException,CoreException { - TargetProvider provider=getProvider(project); - IResource[] resources=getResources(project,resourceNames); - provider.put(resources,null); - } - /** - * Add the resources to an existing container and optionally upload them to the remote server - */ - public IResource[] addResources(IProject container, String[] hierarchy, boolean checkin) throws CoreException, TeamException { - IResource[] newResources = buildResources(container, hierarchy, false); - if (checkin) getProvider(container).put(newResources, DEFAULT_MONITOR); - return newResources; - } - /** - * Delete the resources from an existing container and optionally add the changes to the remote server - */ - public IResource[] deleteResources(IProject container, String[] hierarchy, boolean checkin) throws CoreException, TeamException { - IResource[] resources = getResources(container, hierarchy); - for (int i = 0; i < resources.length; i++) { - resources[0].delete(true, null); - } - if (checkin) getProvider(container).put(resources, DEFAULT_MONITOR); - return resources; - } - /* - * Perform a simple test that checks for the different types of incoming changes - */ - public void testIncomingChanges() throws TeamException, CoreException, IOException { - // Create a test project - IProject project = createAndPut("testIncomingChanges", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }); - - // Checkout and modify a copy - IProject copy = checkoutCopy(project, "-copy"); - IFile file = copy.getFile("folder1/a.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(new ByteArrayInputStream("This will be different".getBytes()), false, false, null); - addResources(copy, new String[] { "folder2/folder3/add.txt" }, false); - deleteResources(copy, new String[] { "folder1/b.txt" }, false); - sleep(1500); // Wait so that timestamp of modified file differs from original - putResourcesOntoTarget(copy,new String[] { "folder1/a.txt","folder2/folder3/add.txt","folder1/b.txt" }); - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testIncomingChanges", - tree, - new String[] { - "file1.txt", - "folder1/", - "folder1/a.txt", - "folder1/b.txt", - "folder2/", - "folder2/folder3/", - "folder2/folder3/add.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.INCOMING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.INCOMING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION, - IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION, - IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION }); - - // Verify that we are in sync (except for "folder1/b.txt", which was deleted) - getResourcesFromTarget(project, - new String[] { - "file1.txt", - "folder1/", - "folder1/a.txt", - "folder1/b.txt", - "folder2/", - "folder2/folder3/", - "folder2/folder3/add.txt" }); - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testIncomingChanges", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC }); - - // Ensure "folder1/b.txt" was deleted - assertDeleted("testIncomingChanges", tree, new String[] { "folder1/b.txt" }); - - // Verify that the copy equals the original - assertEquals(project, copy); - } - - /* - * Perform a simple test that checks for the different types of outgoing changes - */ - public void testOutgoingChanges() throws TeamException, CoreException { - // Create a test project (which commits it as well) - IProject project = createAndPut("testIncomingChanges", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }); - - // Make some modifications - IFile file = project.getFile("folder1/a.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(getRandomContents(), false, false, null); - addResources(project, new String[] { "folder2/folder3/add.txt" }, false); - deleteResources(project, new String[] { "folder1/b.txt" }, false); - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testOutgoingChanges", - tree, - new String[] { - "file1.txt", - "folder1/", - "folder1/a.txt", - "folder1/b.txt", - "folder2/", - "folder2/folder3/", - "folder2/folder3/add.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION }); - - // Commit the changes - putResourcesOntoTarget(project, new String[] { "folder1/a.txt", "folder1/b.txt", "folder2/folder3/add.txt" }); - - // Ensure we're in sync - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testOutgoingChanges", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC }); - - // Ensure deleted resource "folder1/b.txt" no longer exists - assertDeleted("testOutgoingChanges", tree, new String[] { "folder1/b.txt" }); - } - - /* - * Test simple file conflicts - */ - public void testFileConflict() throws TeamException, CoreException, IOException { - // Create a test project (which commits it as well) - IProject project = createAndPut("testFileConflict", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }); - - // Checkout a copy and make some modifications - IProject copy = checkoutCopy(project, "-copy"); - IFile file = copy.getFile("file1.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - appendText(file, "prefix\n", true); - file = copy.getFile("folder1/a.txt"); - file.setContents(new ByteArrayInputStream("Use a custom string to avoid intermitant errors!".getBytes()), false, false, null); - getProvider(copy).put(new IResource[] { copy }, DEFAULT_MONITOR); - - // Make the same modifications to the original (We need to test both M and C!!!) - file = project.getFile("file1.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - appendText(file, "\npostfix", false); // This will test merges (M) - file = project.getFile("folder1/a.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(getRandomContents(), false, false, null); // This will test conflicts (C) - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testFileConflict", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt" }, - new int[] { - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE }); - - // Catch up to the file1.txt conflict using UPDATE with ignoreLocalChanges - getResourcesFromTarget(project, new String[] { "file1.txt" }); - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testFileConflict", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE }); - - // Release the folder1/a.txt conflict uploading - getProvider(project).put(new IResource[] { project.getFile("folder1/a.txt")}, DEFAULT_MONITOR); - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testFileConflict", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt" }, - new int[] { IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC }); - } - - /* - * Test conflicts involving additions - */ - public void testAdditionConflicts() throws TeamException, CoreException { - // CASE 1: The user adds (using CVS add) a remotely added file - // (a) catchup is simply get? - // (b) release must do a merge - // CASE 2: The user adds (but not using cvs add) a remotely added file - // (a) catchup is simply get? - // (b) release must do a merge - // CASE 3: The user adds a remotely added then deleted file - // catchup is not applicable - // release is normal - - // Create a test project (which commits it as well) and add an uncommited resource - IProject project = createAndPut("testAdditionConflicts", new String[] { "file.txt" }); - addResources(project, new String[] { "add1a.txt", "add1b.txt" }, false); - addResources(project, new String[] { "add3.txt" }, false); - buildResources(project, new String[] { "add2a.txt", "add2b.txt" }, false); //useless code!??? - - // Checkout a copy, add the same resource and commit - IProject copy = checkoutCopy(project, "-copy"); - addResources(copy, new String[] { "add1a.txt", "add1b.txt", "add2a.txt", "add2b.txt", "add3.txt" }, true); - deleteResources(copy, new String[] { "add3.txt" }, true); - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testAdditionConflicts", - tree, - new String[] { "file.txt", "add1a.txt", "add1b.txt", "add2a.txt", "add2b.txt", "add3.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION }); - - getProvider(project).put( - new IResource[] { project.getFile("add1b.txt"), project.getFile("add2b.txt"), project.getFile("add3.txt")}, - DEFAULT_MONITOR); - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testAdditionConflicts", - tree, - new String[] { "file.txt", "add1b.txt", "add2b.txt", "add3.txt" }, - new int[] { IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC }); - - IFile file = project.getFile("add1a.txt"); - file.delete(false, DEFAULT_MONITOR); - file = project.getFile("add2a.txt"); - file.delete(false, DEFAULT_MONITOR); - getResourcesFromTarget(project, new String[] { "add1a.txt","add2a.txt" });//This replaces the chunk commented out below: - /*getProvider(project).update( - new IResource[] { project.getFile("add1a.txt"), project.getFile("add2a.txt")}, - new Command.LocalOption[] { Command.DO_NOT_RECURSE }, - null, - true, //createBackups - DEFAULT_MONITOR - );*/ - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testAdditionConflicts", - tree, - new String[] { "add1a.txt", "add2a.txt" }, - new int[] { IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC }); - } - - /* - * Test conflicts involving deletions - */ - public void testDeletionConflicts() throws TeamException, CoreException { - - // CASE 1: The user deletes a remotely modified file - // (a) catchup must do an update - // (b) release must do a merge - // CASE 2: The user deletes (and removes) a remotely modified file - // (a) catchup must do an unmanage and update - // (b) release must do a merge - // CASE 3: The user modified a remotely deleted file - // (a) catchup must do an unmanage and local delete - // (b) release must do a merge - // CASE 4: The user deletes a remotely deleted file - // (a) catchup can update (or unmanage?) - // (b) release must unmanage - // CASE 5: The user deletes (and removes) a remotely deleted file - // (a) catchup can update (or unmanage?) - // (b) release must unmanage - - // Perform the test case for case A first - - // Create a test project (which commits it as well) and delete the resource without committing - IProject project = - createAndPut( - "testDeletionConflictsA", - new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt" }); - IFile file = project.getFile("delete1.txt"); - file.delete(false, DEFAULT_MONITOR); - deleteResources(project, new String[] { "delete2.txt" }, false); - file = project.getFile("delete3.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(new ByteArrayInputStream("unique text for delete3.txt".getBytes()), false, false, null); - file = project.getFile("delete4.txt"); - file.delete(false, DEFAULT_MONITOR); - deleteResources(project, new String[] { "delete5.txt" }, false); - - // Checkout a copy and commit the deletion - IProject copy = checkoutCopy(project, "-copy"); - file = copy.getFile("delete1.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(new ByteArrayInputStream("unique text for delete1.txt".getBytes()), false, false, null); - file = copy.getFile("delete2.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(new ByteArrayInputStream("unique text for delete2.txt".getBytes()), false, false, null); - deleteResources(copy, new String[] { "delete3.txt", "delete4.txt", "delete5.txt" }, false); - getProvider(copy).put(new IResource[] { copy }, DEFAULT_MONITOR); - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testDeletionConflictsA", - tree, - new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt" }, - new int[] { - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE | IRemoteSyncElement.PSEUDO_CONFLICT, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE | IRemoteSyncElement.PSEUDO_CONFLICT }); - - // Catch up to remote changes. - - project.getFile("delete3.txt").delete(false, DEFAULT_MONITOR); - - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testDeletionConflictsA", - tree, - new String[] { "delete1.txt", "delete2.txt" }, - new int[] { - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE | IRemoteSyncElement.PSEUDO_CONFLICT, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE | IRemoteSyncElement.PSEUDO_CONFLICT }); - assertDeleted("testDeletionConflictsA", tree, new String[] { "delete3.txt", "delete4.txt", "delete5.txt" }); - - // Now redo the test case for case B - - // Create a test project (which commits it as well) and delete the resource without committing - project = - createAndPut( - "testDeletionConflictsB", - new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt" }); - file = project.getFile("delete1.txt"); - file.delete(false, DEFAULT_MONITOR); - deleteResources(project, new String[] { "delete2.txt" }, false); - file = project.getFile("delete3.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(getRandomContents(), false, false, null); - file = project.getFile("delete4.txt"); - file.delete(false, DEFAULT_MONITOR); - deleteResources(project, new String[] { "delete5.txt" }, false); - - // Checkout a copy and commit the deletion - copy = checkoutCopy(project, "-copy"); - file = copy.getFile("delete1.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(getRandomContents(), false, false, null); - file = copy.getFile("delete2.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - file.setContents(getRandomContents(), false, false, null); - deleteResources(copy, new String[] { "delete3.txt", "delete4.txt", "delete5.txt" }, false); - getProvider(copy).put(new IResource[] { copy }, DEFAULT_MONITOR); - - // Get the sync tree for the project - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testDeletionConflictsB", - tree, - new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt" }, - new int[] { - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC }); - - // Release the resources - - putResourcesOntoTarget(project, new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt" }); - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals("testDeletionConflictsB", tree, new String[] { "delete3.txt" }, new int[] { IRemoteSyncElement.IN_SYNC }); - assertDeleted("testDeletionConflictsB", tree, new String[] { "delete1.txt", "delete2.txt", "delete4.txt", "delete5.txt" }); - } - - /* - * Test that a deleted file can still be deleted through the team provider - */ - public void testOutgoingDeletion() throws TeamException, CoreException { - - // Create a test project (which commits it as well) - IProject project = createAndPut("testOutgoingDeletion", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }); - - // Delete a file - IFile file = project.getFile("folder1/b.txt"); - file.delete(true, DEFAULT_MONITOR); // WARNING: As of 2002/03/05, this is equivalent to a cvs remove - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testOutgoingDeletion", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION }); - - // Commit the deletion - getProvider(file.getProject()).put(new IResource[] { file }, DEFAULT_MONITOR); - - // Get the sync tree again for the project and ensure others aren't effected - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testOutgoingDeletion", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt" }, - new int[] { IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC }); - - // Assert that deletion no longer appears in remote tree - assertDeleted("testOutgoingDeletion", tree, new String[] { "folder1/b.txt" }); - } - - /* - * Test catching up to an incoming addition - */ - public void testIncomingAddition() throws TeamException, CoreException { - // Create a test project - IProject project = createAndPut("testIncomingAddition", new String[] { "file1.txt", "folder1/", "folder1/a.txt" }); - - // Checkout and modify a copy - IProject copy = checkoutCopy(project, "-copy"); - addResources(copy, new String[] { "folder1/add.txt" }, true); - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testIncomingAddition", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/add.txt" }, - new int[] { - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION }); - - // Get the resource from the tree - ILocalSyncElement element = getChild(tree, new Path("folder1/add.txt")); - - // Catch up to the addition by updating - getResourcesFromTarget(project, new String[] { "folder1/add.txt" }); - - // Get the sync tree again for the project and ensure the added resource is in sync - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testIncomingAddition", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/add.txt" }, - new int[] { IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC }); - } - - /* - * Test changes using a granularity of contents - */ - public void testGranularityContents() throws TeamException, CoreException, IOException { - // Create a test project (which commits it as well) - IProject project = - createAndPut("testGranularityContents", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }); - - // Checkout a copy and make some modifications - IProject copy = checkoutCopy(project, "-copy"); - IFile file = copy.getFile("file1.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - appendText(file, "a", true); - file = copy.getFile("folder1/a.txt"); - file.setContents(getRandomContents(), false, false, null); - putResourcesOntoTarget(copy, new String[] { "file1.txt","folder1/a.txt" }); - - // Make the same modifications to the original - file = project.getFile("file1.txt"); - sleep(1500); // Wait so that timestamp of modified file differs from original - appendText(file, "a", false); - file = project.getFile("folder1/a.txt"); - file.setContents(new ByteArrayInputStream("unique text".getBytes()), false, false, null); - - // Get the sync tree for the project - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testGranularityContents", - tree, - new String[] { "file1.txt", "folder1/", "folder1/a.txt" }, - new int[] { - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE | IRemoteSyncElement.PSEUDO_CONFLICT, - IRemoteSyncElement.IN_SYNC, - IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE }, - IRemoteSyncElement.GRANULARITY_CONTENTS); - } - - public void testRenameProject() throws TeamException, CoreException, IOException { - String[] resourceNames = new String[] { "changed.txt", "folder1/", "folder1/a.txt" }; - int[] inSync = new int[] { IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC, IRemoteSyncElement.IN_SYNC }; - IProject project = createAndPut("testRenameProject", new String[] { "changed.txt", "folder1/", "folder1/a.txt" }); - - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals("sync should be in sync", tree, resourceNames, inSync); - IProjectDescription desc = project.getDescription(); - String newName = project.getName() + "_renamed"; - desc.setName(newName); - project.move(desc, false, null); - project = ResourcesPlugin.getWorkspace().getRoot().getProject(newName); - assertTrue(project.exists()); - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals("sync should be in sync", tree, resourceNames, inSync); - } - - public void testFolderDeletion() throws TeamException, CoreException { - - IProject project = - createAndPut( - "testFolderDeletion", - new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt", "folder1/folder2/file.txt" }); - - // Delete a folder and ensure that the file is managed but doesn't exist - project.getFolder("folder1").delete(false, false, null); - - // The folders and files should show up as outgoing deletions - IRemoteSyncElement tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testFolderDeletion sync check", - tree, - new String[] { "folder1", "folder1/a.txt", "folder1/folder2", "folder1/folder2/file.txt" }, - new int[] { - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION }); - - // commit folder1/a.txt - putResourcesOntoTarget(project, new String[] { "folder1/a.txt" }); - - // Resync and verify that above file is gone and others remain the same - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertSyncEquals( - "testFolderDeletion sync check", - tree, - new String[] { "folder1", "folder1/folder2", "folder1/folder2/file.txt" }, - new int[] { - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION, - IRemoteSyncElement.OUTGOING | IRemoteSyncElement.DELETION }); - assertDeleted("testFolderDeletion", tree, new String[] { "folder1/a.txt" }); - - // Commit folder1/folder2/file.txt - putResourcesOntoTarget(project, new String[] { "folder1/", "folder1/folder2/", "folder1/folder2/file.txt" }); - - // Resync and verify that all are deleted - tree = getRemoteSyncTree(project, DEFAULT_MONITOR); - assertDeleted("testFolderDeletion", tree, new String[] { "folder1", "folder1/folder2", "folder1/folder2/file.txt" }); - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java deleted file mode 100644 index ff03f12f1..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.net.MalformedURLException; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; -import org.eclipse.team.internal.core.target.UrlUtil; - -/** - * A set of test cases for org.eclipse.team.core.target.TargetProvider - */ -public class TargetProviderTests extends TeamTest { - - - public TargetProviderTests() { - super(); - } - public TargetProviderTests(String name) { - super(name); - } - public static Test suite() { - TestSuite suite = new TestSuite(TargetProviderTests.class); - return new TargetTestSetup(suite); - //return new TargetTestSetup(new TargetProviderTests("testPutAndGet")); - } - /** - * Tests the link between the target & the site for consistency. - * @throws CoreException - * @throws TeamException - */ - public void testProjectMapping() throws CoreException, TeamException { - IProject project = getUniqueTestProject("projectmapping"); - TargetProvider target = createProvider(project); - assertTrue(getSite().equals(target.getSite())); - TargetManager.unmap(project); - assertNull(TargetManager.getProvider(project)); - } - /** - * Tests the getURL() method on TargetProvider. - * @throws CoreException - * @throws TeamException - */ - public void testUrlRetrieval() throws CoreException, TeamException, MalformedURLException { - IProject project = getNamedTestProject("urlretrieval"); - TargetManager.map(project, getSite(), new Path(properties.getProperty("test_dir"))); - TargetProvider target = TargetManager.getProvider(project); - String goodurl = UrlUtil.concat(properties.getProperty("location"), new Path(properties.getProperty("test_dir"))).toString(); - assertEquals(goodurl, target.getURL().toString()); - } - /** - * Verifies that the get() and put() methods on the TargetProvider works as expected. - * @throws CoreException - * @throws TeamException - */ - public void testPutAndGet() throws CoreException, TeamException { - // test put - IProject project = getUniqueTestProject("get"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, DEFAULT_MONITOR); - assertLocalEqualsRemote(project); - // test get on a new project - project.delete(true, true, DEFAULT_MONITOR); - project.create(DEFAULT_MONITOR); - project.open(DEFAULT_MONITOR); - target = createProvider(project); - target.get(new IResource[] { project }, DEFAULT_MONITOR); - assertLocalEqualsRemote(project); - } - /** - * Verifies that canGet() and canPut() returns accurate values. - * @throws CoreException - * @throws TeamException - */ - public void testCanGetAndCanPut() throws CoreException, TeamException { - IProject project = getUniqueTestProject("canget"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - for (int i = 0; i < resources.length; i++) { - assertTrue(target.canPut(resources[i])); - } - target.put(resources, DEFAULT_MONITOR); - project.delete(true, true, DEFAULT_MONITOR); - project.create(DEFAULT_MONITOR); - project.open(DEFAULT_MONITOR); - target = createProvider(project); - for (int i = 0; i < resources.length; i++) { - assertTrue(target.canGet(resources[i])); - } - target.get(new IResource[] { project }, null); - } - /** - * Tests bahavior of isOutOfDate() for correctness - * @throws CoreException - * @throws TeamException - */ - public void testIsOutOfDate() throws CoreException, TeamException { - IProject project = getUniqueTestProject("outdated"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - sleep(1501); - IProject dupeProject = getUniqueTestProject("outdated"); - IResource[] freshResources = buildResources(dupeProject, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetManager.map(dupeProject, getSite(), new Path(properties.getProperty("test_dir")).append(project.getName())); - TargetProvider dupeTarget = TargetManager.getProvider(dupeProject); - dupeTarget.put(freshResources, null); - for (int i = 0; i < resources.length; i++) { - if (resources[i].getType() == IResource.FILE) - assertTrue(target.isOutOfDate(resources[i], DEFAULT_PROGRESS_MONITOR)); - } - } - /** - * Tests bahavior of isDirty() for correctness - * @throws CoreException - * @throws TeamException - */ - public void testIsDirty() throws CoreException, TeamException { - IProject project = getUniqueTestProject("dirty"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - sleep(1501); - resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - for (int i = 0; i < resources.length; i++) { - if (resources[i].getType()==IResource.FILE) assertTrue(resources[i].getName(),target.isDirty(resources[i])); - } - } - public void testOverwrite() throws CoreException, TeamException { - IProject project = getUniqueTestProject("overwrite"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - //Create resources with the same names but different content & upload them in the same spot: - resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - target.put(resources, null); - - IProject dupeProject = getUniqueTestProject("overwrite"); - TargetManager.map(dupeProject, getSite(), new Path(properties.getProperty("test_dir")).append(project.getName())); - IResource[] freshResources = buildEmptyResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider dupeTarget = TargetManager.getProvider(dupeProject); - dupeTarget.get(new IResource[] { dupeProject }, null); - for (int i = 0; i < resources.length; i++) { - assertEquals(resources[i],freshResources[i]); - } - } - public void testIsDirtyWhenDeleted() throws CoreException, TeamException { - IProject project = getUniqueTestProject("dirty"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - for (int i = 0; i < resources.length; i++) { - resources[i].delete(true, null); - } - sleep(1501); - resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - for (int i = 0; i < resources.length; i++) { - if (resources[i].getType()==IResource.FILE) assertTrue(resources[i].getName(),target.isDirty(resources[i])); - } - } - public void testIsOutOfDateWhenDeleted() throws CoreException, TeamException { - IProject project = getUniqueTestProject("outdated"); - IResource[] resources = buildResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - for (int i = 0; i < resources.length; i++) { - resources[i].delete(true, null); - } - sleep(1501); - IProject dupeProject = getUniqueTestProject("outdated"); - IResource[] freshResources = buildResources(dupeProject, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetManager.map(dupeProject, getSite(), new Path(properties.getProperty("test_dir")).append(project.getName())); - TargetProvider dupeTarget = TargetManager.getProvider(dupeProject); - dupeTarget.put(freshResources, null); - for (int i = 0; i < resources.length; i++) { - if (resources[i].getType() == IResource.FILE) - assertTrue(target.isOutOfDate(resources[i], DEFAULT_PROGRESS_MONITOR)); - } - } - public void testPutWithPhantoms() throws CoreException, TeamException { - IProject project = getUniqueTestProject("put"); - IResource[] resources = buildEmptyResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false); - TargetProvider target = createProvider(project); - target.put(resources, null); - for (int i = 0; i < resources.length; i++) { - resources[i].delete(true, null); - } - try { - target.put(resources, null); - for (int i = 0; i < resources.length; i++) { - assertTrue(!target.getRemoteResourceFor(resources[i]).exists(null)); - } - } catch (TeamException e) {} catch (RuntimeException e) { - fail("Putting files that don't exist locally should delete them remotely"); - } - } - public void testGetWithPhantoms() throws CoreException, TeamException { - IProject project = getUniqueTestProject("get"); - String[] testFileNames=new String[] { "file1.txt", "folder1/", "folder1/b.txt" }; - IResource[] resources = buildResources(project, testFileNames, false); - TargetProvider target = createProvider(project); - try { - target.get(new IResource[] { project }, null); - IResource[] phantoms=getResources(project,testFileNames); - for (int i = 0; i < phantoms.length; i++) { - assertTrue(!project.getFile(testFileNames[i]).exists()); - } - } catch (TeamException e) { - fail("Getting files that don't exist remotely should delete them locally"); - } - } - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - properties=TargetTestSetup.properties; - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetTestSetup.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetTestSetup.java deleted file mode 100644 index e23583a92..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetTestSetup.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import junit.extensions.TestSetup; -import junit.framework.Test; - -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.ISiteFactory; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; - -/** - * A set of test cases for org.eclipse.team.core.sync.IRemoteResource - */ -public class TargetTestSetup extends TestSetup { - - public static Properties properties; - static { - loadProperties(); - } - - public static void loadProperties() { - properties = new Properties(); - String propertiesFile = System.getProperty("eclipse.target.properties"); - if (propertiesFile == null) - return; - File file = new File(propertiesFile); - if (file.isDirectory()) - file = new File(file, "target.properties"); - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - try { - for (String line;(line = reader.readLine()) != null;) { - int sep = line.indexOf("="); - String property = line.substring(0, sep).trim(); - String value = line.substring(sep + 1).trim(); - properties.setProperty(property, value); - } - } finally { - reader.close(); - } - } catch (Exception e) { - System.err.println("Could not read repository properties file: " + file.getAbsolutePath()); - } - } - - public TargetTestSetup(Test test) { - super(test); - } - /** - * Retrieves the Site object that the TargetProvider is contained in. - * @return Site - */ - Site getSite() { - try { - URL url = new URL(properties.getProperty("location")); - return TargetManager.getSite(properties.getProperty("target"), url); - } catch (MalformedURLException e) { - return null; - } - } - /** - * This method runs before starting the entire test suite. - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - Site location; - ISiteFactory factory = TargetManager.getSiteFactory(properties.getProperty("target")); - assertNotNull(factory); - Site[] locations = TargetManager.getSites(); - - if (locations.length == 0) { - Site l = factory.newSite(properties); - TargetManager.addSite(l); - } - location = getSite(); - - //clean up the directory: - IRemoteTargetResource remote=location.getRemoteResource().getFolder(properties.getProperty("test_dir")); - IRemoteResource[] children=remote.members(null); - for (int i = 0; i < children.length; i++) { - ((IRemoteTargetResource)children[i]).delete(null); - } - - TargetProvider target = location.newProvider(new Path(properties.getProperty("test_dir"))); - assertNotNull(target); - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java deleted file mode 100644 index d478350f7..000000000 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java +++ /dev/null @@ -1,302 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.core; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.tests.harness.EclipseWorkspaceTest; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.internal.core.target.IRemoteTargetResource; -import org.eclipse.team.internal.core.target.Site; -import org.eclipse.team.internal.core.target.TargetManager; -import org.eclipse.team.internal.core.target.TargetProvider; - -public class TeamTest extends EclipseWorkspaceTest { - protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor(); - protected static final IProgressMonitor DEFAULT_PROGRESS_MONITOR = new NullProgressMonitor(); - - Properties properties; - - public TeamTest() { - super(); - } - public TeamTest(String name) { - super(name); - } - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - properties = TargetTestSetup.properties; - } - protected IProject getNamedTestProject(String name) throws CoreException { - IProject target = getWorkspace().getRoot().getProject(name); - if (!target.exists()) { - target.create(null); - target.open(null); - } - assertExistsInFileSystem(target); - return target; - } - - protected IProject getUniqueTestProject(String prefix) throws CoreException { - // manage and share with the default stream create by this class - return getNamedTestProject(prefix + "-" + Long.toString(System.currentTimeMillis())); - } - - protected IStatus getTeamTestStatus(int severity) { - return new Status(severity, "org.eclipse.team.tests.core", 0, "team status", null); - } - /** - * Retrieves the Site object that the TargetProvider is contained in. - * @return Site - */ - Site getSite() { - try { - URL url = new URL(properties.getProperty("location")); - return TargetManager.getSite(properties.getProperty("target"), url); - } catch (MalformedURLException e) { - return null; - } - } - /** - * Creates filesystem 'resources' with the given names and fills them with random text. - * @param container An object that can hold the newly created resources. - * @param hierarchy A list of files & folder names to use as resources - * @param includeContainer A flag that controls whether the container is included in the list of resources. - * @return IResource[] An array of resources filled with variable amounts of random text - * @throws CoreException - */ - public IResource[] buildResources(IContainer container, String[] hierarchy, boolean includeContainer) throws CoreException { - List resources = new ArrayList(hierarchy.length + 1); - if (includeContainer) - resources.add(container); - resources.addAll(Arrays.asList(buildResources(container, hierarchy))); - IResource[] result = (IResource[]) resources.toArray(new IResource[resources.size()]); - ensureExistsInWorkspace(result, true); - for (int i = 0; i < result.length; i++) { - if (result[i].getType() == IResource.FILE) // 3786 bytes is the average size of Eclipse Java files! - ((IFile) result[i]).setContents(getRandomContents(100), true, false, null); - } - return result; - } - public IResource[] buildEmptyResources(IContainer container, String[] hierarchy, boolean includeContainer) throws CoreException { - List resources = new ArrayList(hierarchy.length + 1); - resources.addAll(Arrays.asList(buildResources(container, hierarchy))); - if (includeContainer) - resources.add(container); - IResource[] result = (IResource[]) resources.toArray(new IResource[resources.size()]); - ensureExistsInWorkspace(result, true); - return result; - } - /** - * Creates an InputStream filled with random text in excess of a specified minimum. - * @param sizeAtLeast The minimum number of chars to fill the input stream with. - * @return InputStream The input stream containing random text. - */ - protected static InputStream getRandomContents(int sizeAtLeast) { - StringBuffer randomStuff = new StringBuffer(sizeAtLeast + 100); - while (randomStuff.length() < sizeAtLeast) { - randomStuff.append(getRandomSnippet()); - } - return new ByteArrayInputStream(randomStuff.toString().getBytes()); - } - /** - * Produces a random chunk of text from a finite collection of pre-written phrases. - * @return String Some random words. - */ - public static String getRandomSnippet() { - switch ((int) Math.round(Math.random() * 10)) { - case 0 : - return "este e' o meu conteudo (portuguese)"; - case 1 : - return "Dann brauchen wir aber auch einen deutschen Satz!"; - case 2 : - return "I'll be back"; - case 3 : - return "don't worry, be happy"; - case 4 : - return "there is no imagination for more sentences"; - case 5 : - return "customize yours"; - case 6 : - return "foo"; - case 7 : - return "bar"; - case 8 : - return "foobar"; - case 9 : - return "case 9"; - default : - return "these are my contents"; - } - } - public TargetProvider createProvider(IProject project) throws TeamException { - // Ensure the remote folder exists - IRemoteTargetResource remote = getSite().getRemoteResource().getFolder( - new Path(properties.getProperty("test_dir")).append(project.getName()).toString()); - if (! remote.exists(null)) { - remote.mkdirs(null); - } - TargetManager.map(project, getSite(), new Path(properties.getProperty("test_dir")).append(project.getName())); - TargetProvider target = getProvider(project); - return target; - } - - public TargetProvider getProvider(IProject project) throws TeamException { - return TargetManager.getProvider(project); - } - - public void sleep(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException e) { - System.err.println("Testing was rudely interrupted."); - } - } - void assertLocalEqualsRemote(IProject project) throws CoreException, TeamException { - IProject newProject = getNamedTestProject("equals"); - TargetProvider target = TargetManager.getProvider(project); - IResource[] localResources = project.members(); - for (int i = 0; i < localResources.length; i++) { - assertEquals(target.getRemoteResourceFor(localResources[i]), localResources[i]); - } - } - // Assert that the two containers have equal contents - protected void assertEquals(IRemoteResource container1, IResource container2) throws CoreException, TeamException { - if (container2.getType() == IResource.FILE) { - // Ignore .project file - if (container2.getName().equals(".project")) - return; - assertTrue(compareContent(container1.getContents(DEFAULT_MONITOR), ((IFile) container2).getContents())); - } else { - IRemoteResource[] remoteResources = container1.members(DEFAULT_MONITOR); - IResource[] localResources = ((IFolder) container2).members(); - for (int i = 0; i < localResources.length; i++) { - assertEquals(remoteResources[i], localResources[i]); - } - } - } - protected IProject createAndPut(String projectPrefix, String[] resourceNames) throws CoreException, TeamException { - IProject project = getUniqueTestProject(projectPrefix); - IResource[] resources = buildResources(project, resourceNames, false); - TargetProvider target = createProvider(project); - target.put(resources, DEFAULT_MONITOR); - return project; - } - - public void appendText(IResource resource, String text, boolean prepend) throws CoreException, IOException { - IFile file = (IFile) resource; - InputStream in = file.getContents(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - try { - if (prepend) { - bos.write(text.getBytes()); - } - int i; - while ((i = in.read()) != -1) { - bos.write(i); - } - if (!prepend) { - bos.write(text.getBytes()); - } - } finally { - in.close(); - } - file.setContents(new ByteArrayInputStream(bos.toByteArray()), false, false, DEFAULT_MONITOR); - } - /* - * Get the resources for the given resource names - */ - public IResource[] getResources(IContainer container, String[] hierarchy) throws CoreException { - IResource[] resources = new IResource[hierarchy.length]; - for (int i=0;i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.core/webdav.properties b/tests/org.eclipse.team.tests.core/webdav.properties deleted file mode 100644 index 85f827828..000000000 --- a/tests/org.eclipse.team.tests.core/webdav.properties +++ /dev/null @@ -1,7 +0,0 @@ -target=org.eclipse.team.webdav -test_dir=target -location=http://@host@/path -httpClient.username=@user@ -httpClient.password=@password@ -httpClient.proxyURL= -httpClient.connectionTimeout=6000 \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/.classpath b/tests/org.eclipse.team.tests.cvs.core/.classpath deleted file mode 100644 index a9168f8b0..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/.classpath +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/.cvsignore b/tests/org.eclipse.team.tests.cvs.core/.cvsignore deleted file mode 100644 index c5e82d745..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/.project b/tests/org.eclipse.team.tests.cvs.core/.project deleted file mode 100644 index 1cb4de35f..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/.project +++ /dev/null @@ -1,32 +0,0 @@ - - - org.eclipse.team.tests.cvs.core - - - org.apache.xerces - org.eclipse.compare - org.eclipse.core.boot - org.eclipse.core.resources - org.eclipse.core.runtime - org.eclipse.core.tests.harness - org.eclipse.swt - org.eclipse.team.core - org.eclipse.team.cvs.core - org.eclipse.team.cvs.ui - org.eclipse.team.tests.core - org.eclipse.team.ui - org.eclipse.ui - org.eclipse.update.core - org.junit - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/tests/org.eclipse.team.tests.cvs.core/about.html b/tests/org.eclipse.team.tests.cvs.core/about.html deleted file mode 100644 index 9db411aab..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/about.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -About - - - -

    About This Content

    - -

    20th June, 2002

    -

    License

    -

    Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.

    - -

    Contributions

    - -

    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.

    - -

    If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") 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.

    - - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/cvsui_benchmark.bat b/tests/org.eclipse.team.tests.cvs.core/benchmark/cvsui_benchmark.bat deleted file mode 100644 index 2e3f73e65..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/cvsui_benchmark.bat +++ /dev/null @@ -1,42 +0,0 @@ -@echo off -rem Team UI benchmark script -rem Expects the following plugins to be installed: -rem org.eclipse.core.tests.harness -rem org.eclipse.team.core -rem org.eclipse.team.cvs.core -rem org.eclipse.team.cvs.ui -rem org.eclipse.team.tests.cvs -rem org.eclipse.team.tests.cvs.core -rem org.eclipse.team.ui -rem org.junit - -set ROOT=D:\PerformanceTesting - -set ECLIPSE=%ROOT%\eclipse -set REPOSITORY_PROPERTIES=%ROOT%\repository.properties - -rem set TEST=cvsui.benchmark.all -rem set REPEAT=25 -rem set IGNOREFIRST=-ignorefirst - -set TEST=cvsui.benchmark.command -set REPEAT=25 -set IGNOREFIRST=-ignorefirst - -set LOG=%ROOT%\%TEST%.xml -set WORKSPACE=%ECLIPSE%\workspace -set JRE=%ROOT%\jre -set JAVA=%JRE%\bin\java.exe -set HARNESS=org.eclipse.team.tests.cvs.core.harness - -set VMARGS=-Declipse.cvs.properties=%REPOSITORY_PROPERTIES% -set PROGARGS=-dev bin -noupdate -application %HARNESS% -test %TEST% -log %LOG% -purge -repeat %REPEAT% %IGNOREFIRST% - -pushd %ECLIPSE% -echo Purging the workspace: %WORKSPACE% -del /S /F /Q %WORKSPACE% >NUL: -@echo on -@echo Running Team UI benchmark test -%JAVA% -cp startup.jar %VMARGS% org.eclipse.core.launcher.Main %PROGARGS% -@echo off -popd \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/readme.txt b/tests/org.eclipse.team.tests.cvs.core/benchmark/readme.txt deleted file mode 100644 index 6f64e0e00..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/readme.txt +++ /dev/null @@ -1,180 +0,0 @@ -README Benchmark Tests -====================== - -This plugin provides automated benchmark tests and related support -programs to locate regressions or improvements between different versions -of the CVS Team Provider. - -For now, all of the tests are targeted towards typical UI workflows. -This need not be the case. Should it be necessary, benchmark tests can -easily be written for lower level core components as well. - - - -Deploying the Tests -=================== - -1. If you have a pre-built plugin available, then you do not need to rebuild - the org.eclipse.team.* plugins. Otherwise you must build these as usual, - but you do not need to create a JAR file. Having all of the compiled - classes in the 'bin' directory of each plugin is sufficient. - -2. Checkout the matching version of the org.eclipse.team.tests.cvs.core source - for your org.eclipse.team.* plugins. Ensure all dependencies have been - satisfied. Compile as usual. - -3. Checkout and compile org.eclipse.core.tests.harness. - -4. On the target machine, install a matching version of Eclipse in a dedicated - test directory. Also install a suitable JRE for the platform into that - directory (should always choose the same one). - - If you are using Windows, then copy the "teamui_benchmark.bat" script to the - directory. For other platforms, you will need to cook up your own script. - You will probably want to change the definition of the "ROOT" variable and - other options before running the tests. - - Copy the template "repository.properties" file to the test directory. Fill it in. - - Replace the existing org.eclipse.team.* plugins in the eclipse/plugins - directory with the new ones. Also install org.eclipse.core.tests.harness - there. In the typical case, this just means copying or exporting the projects - directly from the workspace where you compiled them to the new location. - - The test directory structure should look like this: - + mytestdirectory/ - - teamui_benchmark.bat - - repository.properties - + jre/ - ... a suitable java runtime ... - + eclipse/ - - install/ - - readme/ - - splash/ - - buildmanifest.properties - - startup.jar - + plugins/ - - org.eclipse.core.tests.harness/ - - org.eclipse.team.core/ - - org.eclipse.team.ui/ - - org.eclipse.team.cvs.core/ - - org.eclipse.team.cvs.ui/ - - org.eclipse.team.tests.core/ - - org.eclipse.team.tests.cvs.core/ - - org.junit/ - ... and all of the other required Eclipse plugins ... - -5. From a command shell, run the script. Grab a coffee. - - - -Running or Debugging the Tests from within Eclipse -================================================== - -1. Checkout and compile the necessary projects (see above). - -2. Using the PDE launcher, run the "org.eclipse.team.tests.cvs.core.harness" - application with the following arguments: - - VM Arguments: - -Declipse.cvs.properties= - - Program arguments: - -test : id of suite to run (must be plugged into extension point) - [see plugin.xml file for the list of available tests] - -log : specify a file for logging - -nolog : do not write a log file - -repeat : number of iterations to run - -ignorefirst : ignore (do not record) results from first iteration - -purge : purge all projects from the workspace before each iteration - : passed verbatim to the org.eclipse.ui.workbench application - - - -Inspecting the Output -===================== - -1. Checkout and compile the org.eclipse.team.tests.cvs.core project. - -2. Note that the log formatting tools require org.apache.xerces to be on the - classpath when they are run. They do not require any other Eclipse - components, however. - -3. Run any of the following Java programs: - - org.eclipse.team.tests.ccvs.ui.logformatter.PrintSummaryMain - ------------------------------------------------------------ - - Synopsis: - Prints a summary of the output of all runs contained in a particular - XML log file. It is not possible to average runs in multiple log files - at once without merging the files together on disk. [Strip the closing - tag of the first file, and the opening tag of the second file, then - append the second file to the first] - - Program arguments: - : the path of the log file to print - -out : specify an output file, otherwise sends to stdout - -csv : writes the data in comma separated values format - -raw : prints a raw dump without collating or averaging results - - - org.eclipse.team.tests.ccvs.ui.logformatter.PrintDiffMain - --------------------------------------------------------- - - Synopsis: - Prints the difference between the average of all runs contained - in one XML log file (the newer one) and the average of all runs - contained in another XML log file (the older one). This makes it - possible to locate regressions or improvements between versions. - - Program arguments: - : the path of the "newer" log file - : the path of the "older" log file - -out : specify an output file, otherwise sends to stdout - -csv : writes the data in comma separated values format - -t : specify the minimum non-negligible absolute % change - -i : ignore negligible changes in results [filter them out] - - - org.eclipse.team.tests.ccvs.ui.logformatter.LogFormatterUIMain - --------------------------------------------------------- - - Synopsis: - Provides a GUI frontend to the log formatting tools. To run this, - you must ensure that the SWT DLL is on the java library path. - - - -What is Being Logged -==================== - -At the present date the following information is logged for each test run: - - current time - - current SDK build number - - for JUnit test cases: - - test name - - fully qualified class name - - for groups of benchmark tasks: - - name - - for benchmark tasks: - - name - - elapsed time - - for exceptions and errors: - - type of error (warning, error, failure) - - error message - - stack trace, if applicable - - printout of IStatus contents, if applicable - - - -NOTES -===== - -Exceptions and errors are not reported through the log formatting tools yet -since it is difficult to determine automatically which benchmark tasks are -affected (directly or indirectly) by the error. For this reason, you should -MANUALLY INSPECT the generated XML log files and search for elements with -the name "abort". Since running the test cases is time consuming, it -may be better to trim out any affected cases from the log rather than to run -the whole suite over once again. diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_02_26.integration.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_02_26.integration.all.xml deleted file mode 100644 index f5e8da229..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_02_26.integration.all.xml +++ /dev/null @@ -1,6027 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_03_19.integration.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_03_19.integration.all.xml deleted file mode 100644 index d783a1f6d..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_03_19.integration.all.xml +++ /dev/null @@ -1,4577 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_24.milestone5.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_24.milestone5.all.xml deleted file mode 100644 index 04fd66137..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_24.milestone5.all.xml +++ /dev/null @@ -1,12053 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_25.integration.commandline.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_25.integration.commandline.xml deleted file mode 100644 index 30732a995..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_04_25.integration.commandline.xml +++ /dev/null @@ -1,1731 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_10.release2_0.commandline.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_10.release2_0.commandline.xml deleted file mode 100644 index ae9310bab..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_10.release2_0.commandline.xml +++ /dev/null @@ -1,1731 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_11.release2_0.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_11.release2_0.all.xml deleted file mode 100644 index b53f09fb8..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.0/2002_07_11.release2_0.all.xml +++ /dev/null @@ -1,12051 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20021127.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20021127.all.xml deleted file mode 100644 index f34ca5123..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20021127.all.xml +++ /dev/null @@ -1,12069 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20030129.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20030129.all.xml deleted file mode 100644 index d289b4e28..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/team2.1/I20030129.all.xml +++ /dev/null @@ -1,12195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/teamui_benchmark.bat b/tests/org.eclipse.team.tests.cvs.core/benchmark/teamui_benchmark.bat deleted file mode 100644 index a2c69b959..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/teamui_benchmark.bat +++ /dev/null @@ -1,38 +0,0 @@ -@echo off -rem Team UI benchmark script -rem Expects the following plugins to be installed: -rem org.eclipse.core.tests.harness -rem org.eclipse.team.core -rem org.eclipse.team.cvs.core -rem org.eclipse.team.cvs.ui -rem org.eclipse.team.tests.core -rem org.eclipse.team.tests.cvs.core -rem org.eclipse.team.ui -rem org.junit - -set ROOT=D:\PerformanceTesting - -set ECLIPSE=%ROOT%\eclipse -set REPOSITORY_PROPERTIES=%ROOT%\repository.properties -set TEST=cvsui.benchmark.all -set LOG=%ROOT%\%TEST%.xml -set REPEAT=6 -set IGNOREFIRST=-ignorefirst - -set PLUGINS=%ECLIPSE%\plugins -set WORKSPACE=%ECLIPSE%\workspace -set JRE=%ROOT%\jre -set JAVA=%JRE%\bin\java.exe -set HARNESS=org.eclipse.team.tests.cvs.core.harness - -set VMARGS=-Declipse.cvs.properties=%REPOSITORY_PROPERTIES% -set PROGARGS=-dev bin -application %HARNESS% -test %TEST% -log %LOG% -purge -repeat %REPEAT% %IGNOREFIRST% - -pushd %ECLIPSE% -echo Purging the workspace: %WORKSPACE% -del /S /F /Q %WORKSPACE% >NUL: -@echo on -@echo Running Team UI benchmark test -%JAVA% -cp startup.jar %VMARGS% org.eclipse.core.launcher.UIMain %PROGARGS% -@echo off -popd diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/vcm1.0/2002_02_26.integration.all.xml b/tests/org.eclipse.team.tests.cvs.core/benchmark/vcm1.0/2002_02_26.integration.all.xml deleted file mode 100644 index 922e0ef30..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/vcm1.0/2002_02_26.integration.all.xml +++ /dev/null @@ -1,10960 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/benchmark/vcmui_benchmark.bat b/tests/org.eclipse.team.tests.cvs.core/benchmark/vcmui_benchmark.bat deleted file mode 100644 index c92dab1f8..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/benchmark/vcmui_benchmark.bat +++ /dev/null @@ -1,43 +0,0 @@ -@echo off -rem VCM UI benchmark script -rem Expects the following plugins to be installed: -rem org.eclipse.core.tests.harness -rem org.eclipse.team.core -rem org.eclipse.team.cvs.core -rem org.eclipse.team.cvs.ui -rem org.eclipse.team.tests.cvs.core -rem org.eclipse.team.ui -rem org.eclipse.vcm.core -rem org.eclipse.vcm.core.cvs -rem org.eclipse.vcm.tests.core -rem org.eclipse.vcm.tests.ui -rem org.eclipse.vcm.ui -rem org.eclipse.vcm.ui.cvs -rem org.junit - -set ROOT=D:\PerformanceTesting - -set ECLIPSE=%ROOT%\eclipse -set REPOSITORY_PROPERTIES=%ROOT%\repository.properties -set TEST=vcmui.benchmark.all -set LOG=%ROOT%\%TEST%.xml -set REPEAT=21 -set IGNOREFIRST= - -set PLUGINS=%ECLIPSE%\plugins -set WORKSPACE=%ECLIPSE%\workspace -set JRE=%ROOT%\jre -set JAVA=%JRE%\bin\java.exe -set HARNESS=org.eclipse.team.tests.cvs.core.harness - -set VMARGS=-Declipse.tests.vcm.properties=%REPOSITORY_PROPERTIES% -set PROGARGS=-dev bin -application %HARNESS% -test %TEST% -log %LOG% -purge -repeat %REPEAT% %IGNOREFIRST% - -pushd %ECLIPSE% -echo Purging the workspace: %WORKSPACE% -del /S /F /Q %WORKSPACE% >NUL: -@echo on -@echo Running VCM UI benchmark test -%JAVA% -cp startup.jar %VMARGS% org.eclipse.core.launcher.UIMain %PROGARGS% -@echo off -popd diff --git a/tests/org.eclipse.team.tests.cvs.core/build-tests.xml b/tests/org.eclipse.team.tests.cvs.core/build-tests.xml deleted file mode 100644 index ef6cbe55f..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/build-tests.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/build.properties b/tests/org.eclipse.team.tests.cvs.core/build.properties deleted file mode 100644 index eb53c7650..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -source.cvstests.jar=src/ -bin.includes=about.html,plugin.xml,*.jar,test.xml,repository.properties \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/plugin.xml b/tests/org.eclipse.team.tests.cvs.core/plugin.xml deleted file mode 100644 index 1a9b5eadf..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/plugin.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.team.tests.cvs.core/readme.html b/tests/org.eclipse.team.tests.cvs.core/readme.html deleted file mode 100644 index 09ea3e644..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/readme.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - Building and Running the Team/CVS Tests using Ant - - - - - - - -

    Building and Running the Team/CVS Tests using Ant

    - -

    Building the Team/CVS tests

    - -To build the TEam/CVS test plugins, perform the following steps: - -
      - -
    1. Import the following plugins using the Import External Plugins and Fragments wizard: -
        -
      1. org.eclipse.team.* plugins and all required plugins
      2. -
      3. org.junit and any required plugins
      4. -
      -
    2. - -
    3. Check out the following plug-ins from dev.eclipse.org: -
        -
      1. org.eclipse.core.tests.harness
      2. -
      3. org.eclipse.team.tests.core
      4. -
      5. org.eclipse.team.tests.cvs.core
      6. -
      -
    4. - -
    5. In org.eclipse.team.tests.cvs.core, select the file build-tests.xml and choose - Run Ant... from the popup menu. A zip archieve of the CVS test plugins is created - in the org.eclipse.team.tests.cvs.core project. -
    6. - -
    - -

    Setting up the Eclipse install to be used to run the tests

    - -To run the tests built above, perform the following steps: - -
      - -
    1. Install eclipse to you test directory.
    2. - -
    3. Install the eclipse test harness plug-ins and fragments over the above install
    4. - -
    5. Extract the team test plugin archive created above into the test Eclipse install.
    6. - -
    7. The CVS tests require a repository to test with. Modify the repository.properties file in plug-in org.eclipse.team.tests.cvs.core - to contain the information required to connect to your repository. - Important fields in the repository properties file are: -
        -
      • repository - the location string that identifies your test repository. - This string should be of the format ":method:user:password@host:/repo/path" -
      • -
      • initrepo - true if you want to initialize the repository before beginning. - It is not essential to initialize the repository, as the tests will create unique test - project names. -
      • rsh - the rsh (or ssh) client used to initialize the repository -
        Note: Your repository must allow rsh connections from your userid and machine in order for - the tests to run when initrepo is set to true. If ssh is used, it must be configured to connect - when provided with the parameters "host -l username" (i.e. setup to use keys). -
      • -
      -

      There is a sample repository.properties file provided in org.eclipse.team.tests.cvs.core. - The additional properties are for more in-depth tests.

      -

      Note: If you want to keep a repositories.properties file in a separate directory, - this directory can be provided to the test script run below as the "team-home" parameter.

      -
    8. - -
    9. Run the test.xml Ant script using the following command line from the eclipse directory: -
        -
      • For Team:
        - java -cp startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ant.core.antRunner -file plugins/org.eclipse.team.tests.core/test.xml run -dev bin -noupdate -
      • -
      • For CVS:
        - java -cp startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ant.core.antRunner -file plugins/org.eclipse.team.tests.cvs.core/test.xml run -dev bin -noupdate -
      • -
      -
    10. - - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/repository.properties b/tests/org.eclipse.team.tests.cvs.core/repository.properties deleted file mode 100644 index 15f636660..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/repository.properties +++ /dev/null @@ -1,11 +0,0 @@ -repository=:pserver:@user@:@password@@@host@:@root@ -repository1=:pserver:@user@:@password@@@host@:@root1@ -repository2=:pserver:@user@:@password@@@host@:@root2@ -command=C:\cvs\bin\cvs -debug=false -standalone=false -initrepo=false -temp=C:\temp -rsh=rsh -localRepo=false -waitFactor=5 \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip deleted file mode 100644 index 8a0f9cf83..000000000 Binary files a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip and /dev/null differ diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip deleted file mode 100644 index ea3729efb..000000000 Binary files a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip and /dev/null differ diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkTiny.zip b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkTiny.zip deleted file mode 100644 index a127ff3d7..000000000 Binary files a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkTiny.zip and /dev/null differ diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules deleted file mode 100644 index 3ab59a67f..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules +++ /dev/null @@ -1,65 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. - -# Block access to CVS hogs -#world -a denied___checkout_of_world_takes_too_long -#. -a denied___checkout_of_world_takes_too_long - -# self referencing modules -project1 project1 - -# checkout docs in flattened structure -docs -d docs common/docs -macros common/macros - -# include docs with project -project2 project2 &docs -# only project2 -project2-only project2 - -# a use of alias -project3-src project3/src -project3-src_file -a project3-src/file.c project3-src/file.h -project3-sub project3/sub &project3-src_file - -# embeddings -project4 project4 ¯os -project5-project4 -d extensions/project4 project4 -project5 project5 &project5-project4 ¯os - -# using -d to build a project from other projects -project6-dirA -d dirA project6/A -project6-dirB -d dirB project6/B -project6 &project6-dirA &project6-dirB - -# using aliases to provide packaging -project7-common -a project7/common -project7-pc -a project7-common project7/pc -project7-linux -a project7-common project7/linux - -# simple use of module alias -project8-alias -a project8 common \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html deleted file mode 100644 index 8c7fe2111..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/macros/macro1 b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/macros/macro1 deleted file mode 100644 index c88e4d621..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/macros/macro1 +++ /dev/null @@ -1 +0,0 @@ -This is a macro \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project1/f1/file-in-p1.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project1/f1/file-in-p1.txt deleted file mode 100644 index 5ba54a8be..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project1/f1/file-in-p1.txt +++ /dev/null @@ -1 +0,0 @@ -This is a file in project1 \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project2/file-p2.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project2/file-p2.txt deleted file mode 100644 index 547cc5e4f..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project2/file-p2.txt +++ /dev/null @@ -1 +0,0 @@ -This is a file in project 2 \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c deleted file mode 100644 index a3f314b05..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c +++ /dev/null @@ -1 +0,0 @@ -This is a c file \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h deleted file mode 100644 index d45f90e27..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h +++ /dev/null @@ -1 +0,0 @@ -This is an h file \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/sub/file-sub.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/sub/file-sub.txt deleted file mode 100644 index d45364ec8..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/sub/file-sub.txt +++ /dev/null @@ -1 +0,0 @@ -This is a file in project3/sub \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/common/common.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/common/common.txt deleted file mode 100644 index 127506764..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/common/common.txt +++ /dev/null @@ -1 +0,0 @@ -This is a common file \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/linux/linux.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/linux/linux.txt deleted file mode 100644 index c7078a38d..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/linux/linux.txt +++ /dev/null @@ -1 +0,0 @@ -This is a linux file \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/pc/pc.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/pc/pc.txt deleted file mode 100644 index 4bf706a8b..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project7/pc/pc.txt +++ /dev/null @@ -1 +0,0 @@ -This is a pc file \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt deleted file mode 100644 index e9257ebb5..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt +++ /dev/null @@ -1 +0,0 @@ -This is a file in project8 \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/self-host.xml b/tests/org.eclipse.team.tests.cvs.core/self-host.xml deleted file mode 100644 index 7e5147a03..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/self-host.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java deleted file mode 100644 index 34bc77809..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTeamAndCVSTests.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.team.tests.ccvs.core; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.team.tests.core.AllTeamTests; - -public class AllTeamAndCVSTests extends EclipseTest { - - /** - * Constructor for CVSClientTest. - */ - public AllTeamAndCVSTests() { - super(); - } - - /** - * Constructor for CVSClientTest. - * @param name - */ - public AllTeamAndCVSTests(String name) { - super(name); - } - - /* - * ORDER IS IMPORTANT: Run compatibility and resource tests before any other!!! - */ - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new TestSetup(AllTeamTests.suite())); - suite.addTest(new CVSTestSetup(AllTests.suite())); - return suite; - } -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java deleted file mode 100644 index 7f0ddf5b2..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.team.tests.ccvs.core; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTests extends EclipseTest { - - /** - * Constructor for CVSClientTest. - */ - public AllTests() { - super(); - } - - /** - * Constructor for CVSClientTest. - * @param name - */ - public AllTests(String name) { - super(name); - } - - /* - * ORDER IS IMPORTANT: Run compatibility and resource tests before any other!!! - */ - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(org.eclipse.team.tests.ccvs.core.compatible.AllTestsCompatibility.suite()); - suite.addTest(org.eclipse.team.tests.ccvs.core.cvsresources.AllTestsCVSResources.suite()); - suite.addTest(org.eclipse.team.tests.ccvs.core.provider.AllTestsProvider.suite()); - return new CVSTestSetup(suite); - } -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSClientException.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSClientException.java deleted file mode 100644 index b8bd8746e..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSClientException.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.team.tests.ccvs.core; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import org.eclipse.team.internal.ccvs.core.CVSException; - -public class CVSClientException extends CVSException { - - public CVSClientException(String message) { - super(message); - } - -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java deleted file mode 100644 index 5937276d6..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.eclipse.team.tests.ccvs.core; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintStream; - -import junit.extensions.TestSetup; -import junit.framework.Test; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; -import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; -import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; - -public class CVSTestSetup extends TestSetup { - public static final String REPOSITORY_LOCATION; - public static final boolean INITIALIZE_REPO; - public static final boolean DEBUG; - public static final boolean LOCAL_REPO; - public static final String RSH; - public static final int WAIT_FACTOR; - public static final int COMPRESSION_LEVEL; - - public static CVSRepositoryLocation repository; - - // Static initializer for constants - static { - loadProperties(); - REPOSITORY_LOCATION = System.getProperty("eclipse.cvs.repository"); - INITIALIZE_REPO = Boolean.valueOf(System.getProperty("eclipse.cvs.initrepo", "false")).booleanValue(); - DEBUG = Boolean.valueOf(System.getProperty("eclipse.cvs.debug", "false")).booleanValue(); - RSH = System.getProperty("eclipse.cvs.rsh", "rsh"); - LOCAL_REPO = Boolean.valueOf(System.getProperty("eclipse.cvs.localRepo", "false")).booleanValue(); - WAIT_FACTOR = Integer.parseInt(System.getProperty("eclipse.cvs.waitFactor", "1")); - COMPRESSION_LEVEL = Integer.parseInt(System.getProperty("eclipse.cvs.compressionLevel", "0")); - } - - public static void loadProperties() { - String propertiesFile = System.getProperty("eclipse.cvs.properties"); - if (propertiesFile == null) return; - File file = new File(propertiesFile); - if (file.isDirectory()) file = new File(file, "repository.properties"); - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - try { - for (String line; (line = reader.readLine()) != null; ) { - int sep = line.indexOf("="); - String property = line.substring(0, sep).trim(); - String value = line.substring(sep + 1).trim(); - System.setProperty("eclipse.cvs." + property, value); - } - } finally { - reader.close(); - } - } catch (Exception e) { - System.err.println("Could not read repository properties file: " + file.getAbsolutePath()); - } - } - - /** - * Constructor for CVSTestSetup. - */ - public CVSTestSetup(Test test) { - super(test); - } - - public static void executeRemoteCommand(ICVSRepositoryLocation repository, String commandLine) { - if (! LOCAL_REPO) { - commandLine = RSH + " " + repository.getHost() + " -l " + repository.getUsername() + " " + commandLine; - } - int returnCode = executeCommand(commandLine, null, null); - if (returnCode != -1 && returnCode != 0) { - System.err.println("Remote command returned " + returnCode + ": " + commandLine); - } - } - - /** - * Executes a command. - * Returns the command's return code, or -1 on failure. - * - * @param commandLine the local command line to run - * @param environment the new environment variables, or null to inherit from parent process - * @param workingDirectory the new workingDirectory, or null to inherit from parent process - */ - public static int executeCommand(String commandLine, String[] environment, File workingDirectory) { - PrintStream debugStream = CVSTestSetup.DEBUG ? System.out : null; - try { - if (debugStream != null) { - // while debugging, dump CVS command line client results to stdout - // prefix distinguishes between message source stream - debugStream.println(); - printPrefixedLine(debugStream, "CMD> ", commandLine); - if (workingDirectory != null) printPrefixedLine(debugStream, "DIR> ", workingDirectory.toString()); - } - Process cvsProcess = Runtime.getRuntime().exec(commandLine, environment, workingDirectory); - // stream output must be dumped to avoid blocking the process or causing a deadlock - startBackgroundPipeThread(cvsProcess.getErrorStream(), debugStream, "ERR> "); - startBackgroundPipeThread(cvsProcess.getInputStream(), debugStream, "MSG> "); - - int returnCode = cvsProcess.waitFor(); - if (debugStream != null) debugStream.println("RESULT> " + returnCode); - return returnCode; - } catch (IOException e) { - printPrefixedLine(System.err, "Unable to execute command: ", commandLine); - e.printStackTrace(System.err); - } catch (InterruptedException e) { - printPrefixedLine(System.err, "Unable to execute command: ", commandLine); - e.printStackTrace(System.err); - } - return -1; - } - - private static void startBackgroundPipeThread(final InputStream is, final PrintStream os, - final String prefix) { - new Thread() { - public void run() { - BufferedReader reader = null; - try { - try { - reader = new BufferedReader(new InputStreamReader(is)); - for (;;) { - String line = reader.readLine(); - if (line == null) break; - if (os != null) printPrefixedLine(os, prefix, line); - } - } finally { - if (reader != null) reader.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - }.start(); - } - - private static void printPrefixedLine(PrintStream os, String prefix, String line) { - os.print(prefix); - os.println(line.substring(0, Math.min(line.length(), 256))); // trim long lines - } - - /* - * Use rsh to delete any contents of the repository and initialize it again - */ - private static void initializeRepository(CVSRepositoryLocation repository) { - String repoRoot = repository.getRootDirectory(); - executeRemoteCommand(repository, "rm -rf " + repoRoot); - executeRemoteCommand(repository, "cvs -d " + repoRoot + " init"); - } - - public void setUp() throws CVSException { - if (repository == null) - repository = setupRepository(REPOSITORY_LOCATION); - CVSProviderPlugin.getPlugin().setCompressionLevel(COMPRESSION_LEVEL); - } - - protected CVSRepositoryLocation setupRepository(String location) throws CVSException { - - // Give some info about which repository the tests are running with - System.out.println("Connecting to: " + location); - - // Validate that we can connect, also creates and caches the repository location. This - // is important for the UI tests. - CVSRepositoryLocation repository = (CVSRepositoryLocation)CVSProviderPlugin.getPlugin().getRepository(location); - //CVSRepositoryLocation repository = CVSRepositoryLocation.fromString(location); - try { - repository.validateConnection(new NullProgressMonitor()); - } catch (CVSException e) { - System.out.println("Unable to connect to remote repository: " + repository.getLocation()); - throw e; - } - - // Initialize the repo if requested (requires rsh access) - if( INITIALIZE_REPO ) { - initializeRepository(repository); - } - - return repository; - } - - public void tearDown() throws CVSException { - // Nothing to do here - } - -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java deleted file mode 100644 index e144f515b..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.ccvs.core; - -import java.io.File; - -import junit.framework.Assert; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; - -public class CommandLineCVSClient implements ICVSClient { - public static final ICVSClient INSTANCE = new CommandLineCVSClient(); - private static final String cvsExecutable = - System.getProperty("eclipse.cvs.command"); - - public void executeCommand(ICVSRepositoryLocation repositoryLocation, - IContainer localRoot, String command, String[] globalOptions, - String[] localOptions, String[] arguments) throws CVSException { - execute(repositoryLocation.getLocation(), localRoot.getLocation().toFile(), command, - globalOptions, localOptions, arguments); - try { - localRoot.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (CoreException e) { - throw new CVSClientException("CoreException during refreshLocal: " + e.getMessage()); - } - } - - public static void execute( - String repositoryLocation, File localRoot, String command, - String[] globalOptions, String[] localOptions, - String[] arguments) throws CVSException { - // test arguments - Assert.assertNotNull(repositoryLocation); - Assert.assertNotNull(localRoot); - Assert.assertNotNull(command); - Assert.assertNotNull(globalOptions); - Assert.assertNotNull(localOptions); - Assert.assertNotNull(arguments); - Assert.assertTrue(localRoot.exists()); - - // build command line - StringBuffer commandLineBuf = new StringBuffer(cvsExecutable); - commandLineBuf.append(" -d \""); - commandLineBuf.append(repositoryLocation); - commandLineBuf.append('"'); - appendStrings(commandLineBuf, globalOptions); - commandLineBuf.append(' '); - commandLineBuf.append(command); - appendStrings(commandLineBuf, localOptions); - appendStrings(commandLineBuf, arguments); - - // execute command - JUnitTestCase.waitMsec(1500); - int returnCode = CVSTestSetup.executeCommand(commandLineBuf.toString(), null, localRoot); - if (returnCode != 0) { - throw new CVSClientException("Command line client returned non-zero code: " + returnCode); - } - } - - private static void appendStrings(StringBuffer commandLine, String[] strings) { - for (int i = 0; i < strings.length; i++) { - String string = strings[i]; - if (string != null && string.length() != 0) { - commandLine.append(" \""); - commandLine.append(string); - commandLine.append('"'); - } - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java deleted file mode 100644 index 6484ba1bf..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.ccvs.core; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import junit.framework.Assert; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSStatus; -import org.eclipse.team.internal.ccvs.core.ICVSFolder; -import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; -import org.eclipse.team.internal.ccvs.core.client.Command; -import org.eclipse.team.internal.ccvs.core.client.Session; -import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption; -import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; - -public class EclipseCVSClient implements ICVSClient { - public static final ICVSClient INSTANCE = new EclipseCVSClient(); - private static final HashMap commandPool = new HashMap(); - static { - commandPool.put("update", Command.UPDATE); - commandPool.put("co", Command.CHECKOUT); - commandPool.put("ci", Command.COMMIT); - commandPool.put("import", Command.IMPORT); - commandPool.put("add", Command.ADD); - commandPool.put("remove", Command.REMOVE); - commandPool.put("status", Command.STATUS); - commandPool.put("log", Command.LOG); - commandPool.put("tag", Command.TAG); - commandPool.put("rtag", Command.RTAG); - commandPool.put("admin", Command.ADMIN); - commandPool.put("diff", Command.DIFF); - } - - public void executeCommand(ICVSRepositoryLocation repositoryLocation, - IContainer localRoot, String command, String[] globalOptions, - String[] localOptions, String[] arguments) throws CVSException { - execute(repositoryLocation, CVSWorkspaceRoot.getCVSFolderFor(localRoot), command, - globalOptions, localOptions, arguments); - } - - public static void execute( - ICVSRepositoryLocation cvsRepositoryLocation, ICVSFolder cvsLocalRoot, - String command, String[] globalOptions, String[] localOptions, - String[] arguments) throws CVSException { - // test arguments - Assert.assertNotNull(cvsRepositoryLocation); - Assert.assertNotNull(cvsLocalRoot); - Assert.assertNotNull(command); - Assert.assertNotNull(globalOptions); - Assert.assertNotNull(localOptions); - Assert.assertNotNull(arguments); - Assert.assertTrue(cvsLocalRoot.exists()); - - // get command instance - Command cvsCommand = (Command) commandPool.get(command); - - // get global options - List globals = new ArrayList(); - for (int i = 0; i < globalOptions.length; i++) { - globals.add(new CustomGlobalOption(globalOptions[i])); - } - GlobalOption[] cvsGlobalOptions = (GlobalOption[]) globals.toArray(new GlobalOption[globals.size()]); - - // get local options - List locals = new ArrayList(); - for (int i = 0; i < localOptions.length; i++) { - String option = localOptions[i]; - String argument = null; - if ((i < localOptions.length - 1) && (localOptions[i + 1].charAt(0) != '-')) { - argument = localOptions[++i]; - } - locals.add(new CustomLocalOption(option, argument)); - } - LocalOption[] cvsLocalOptions = (LocalOption[]) locals.toArray(new LocalOption[locals.size()]); - - // execute command - IProgressMonitor monitor = new NullProgressMonitor(); - Session session = new Session(cvsRepositoryLocation, cvsLocalRoot); - try { - session.open(monitor); - IStatus status = cvsCommand.execute(session, - cvsGlobalOptions, cvsLocalOptions, arguments, null, monitor); - if (status.getCode() == CVSStatus.SERVER_ERROR) { - throw new CVSClientException("Eclipse client returned non-ok status: " + status); - } - } finally { - session.close(); - monitor.done(); - } - } - - private static class CustomGlobalOption extends GlobalOption { - public CustomGlobalOption(String option) { - super(option); - } - } - - private static class CustomLocalOption extends LocalOption { - public CustomLocalOption(String option, String arg) { - super(option, arg); - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java deleted file mode 100644 index e5a4b243c..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java +++ /dev/null @@ -1,635 +0,0 @@ -package org.eclipse.team.tests.ccvs.core; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.tests.harness.EclipseWorkspaceTest; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSStatus; -import org.eclipse.team.internal.ccvs.core.CVSTag; -import org.eclipse.team.internal.ccvs.core.CVSTeamProvider; -import org.eclipse.team.internal.ccvs.core.ICVSFile; -import org.eclipse.team.internal.ccvs.core.ICVSFolder; -import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile; -import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource; -import org.eclipse.team.internal.ccvs.core.ICVSResource; -import org.eclipse.team.internal.ccvs.core.client.Command; -import org.eclipse.team.internal.ccvs.core.client.Import; -import org.eclipse.team.internal.ccvs.core.client.Session; -import org.eclipse.team.internal.ccvs.core.client.Update; -import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; -import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; -import org.eclipse.team.internal.ccvs.core.connection.CVSServerException; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.eclipse.team.internal.ccvs.core.resources.RemoteFile; -import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder; -import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; -import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; - -public class EclipseTest extends EclipseWorkspaceTest { - - protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor(); - protected static final int RANDOM_CONTENT_SIZE = 3876; - - /** - * Constructor for CVSBlackBoxTest. - */ - public EclipseTest() { - super(); - } - public EclipseTest(String name) { - super(name); - } - - /* - * Get the resources for the given resource names - */ - public IResource[] getResources(IContainer container, String[] hierarchy) throws CoreException { - IResource[] resources = new IResource[hierarchy.length]; - for (int i=0;i obArr2.length) { - assertEquals("Arrays of different length",obArr1[obArr2.length],null); - return; - } - - if (obArr1.length < obArr2.length) { - assertEquals("Arrays of different length",obArr2[obArr1.length],null); - return; - } - - } - - /** - * Write text lines to file from an array of strings. - */ - protected static void writeToFile(IFile file, String[] contents) - throws IOException, CoreException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - PrintStream os = new PrintStream(bos); - try { - for (int i = 0; i < contents.length; i++) { - os.println(contents[i]); - } - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - if (file.exists()) { - file.setContents(bis, false /*force*/, true /*keepHistory*/, null); - } else { - mkdirs(file.getParent()); - file.create(bis, false /*force*/, null); - } - } finally { - os.close(); - } - } - - /** - * Read text lines from file into an array of strings. - */ - protected static String[] readFromFile(IFile file) - throws IOException, CoreException { - if (! file.exists()) return null; - BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents())); - List fileContentStore = new ArrayList(); - try { - String line; - while ((line = reader.readLine()) != null) { - fileContentStore.add(line); - } - } finally { - reader.close(); - } - return (String[]) fileContentStore.toArray(new String[fileContentStore.size()]); - } - - /** - * Append text files to file from an array of strings, create new file if it - * does not exist yet. - */ - protected static void appendToFile(IFile file, String[] contents) - throws IOException, CoreException { - String[] oldContents = readFromFile(file); - String[] newContents; - if (oldContents == null) { - newContents = contents; - } else { - newContents = new String[oldContents.length + contents.length]; - System.arraycopy(oldContents, 0, newContents, 0, oldContents.length); - System.arraycopy(contents, 0, newContents, oldContents.length, contents.length); - } - writeToFile(file, newContents); - } - - /** - * Pre-Append text files to file from an array of strings, create new file if it - * does not exist yet. - */ - protected static void prefixToFile(IFile file, String[] contents) - throws IOException, CoreException { - String[] oldContents = readFromFile(file); - String[] newContents; - if (oldContents == null) { - newContents = contents; - } else { - newContents = new String[oldContents.length + contents.length]; - System.arraycopy(contents, 0, newContents, 0, contents.length); - System.arraycopy(oldContents, 0, newContents, contents.length, oldContents.length); - } - writeToFile(file, newContents); - } - - /** - * genertates Random content meand to be written in a File - */ - protected static String createRandomContent() { - - StringBuffer content = new StringBuffer(); - int contentSize; - - content.append("Random file generated for test" + PLATFORM_NEWLINE); - - contentSize = (int) Math.round(RANDOM_CONTENT_SIZE * 2 * Math.random()); - for (int i=0; i0.99) { - content.append(PLATFORM_NEWLINE); - } - - if (Math.random()>0.99) { - content.append("\n"); - } - - if (NEWLINE_TEST) { - if (Math.random()>0.99) { - content.append("\n\r"); - } - if (Math.random()>0.99) { - content.append('\r'); - } - if (Math.random()>0.99) { - content.append("\r\n"); - } - if (Math.random()>0.99) { - content.append("\n"); - } - if (Math.random()>0.99) { - content.append("\n\n"); - } - if (Math.random()>0.99) { - content.append("\r\r"); - } - } - - content.append((char)('\u0021' + Math.round(60 * Math.random()))); - } - - return content.toString(); - } - - /** - * Creates a folder (and its parents if needed). - */ - protected static void mkdirs(IContainer container) throws CoreException { - if (container.getType() == IResource.PROJECT) { - IProject project = (IProject) container; - if (! project.exists()) { - project.create(null); - } - project.open(null); - } else if (container.getType() == IResource.FOLDER) { - IFolder folder = (IFolder) container; - if (! folder.exists()) { - mkdirs(folder.getParent()); - folder.create(false /*force*/, true /*local*/, null); - } - } - } - - /** - * Creates the file with random content, and all the folders on the - * way to there. - */ - private static void createRandomFile(IFile file) - throws IOException, CoreException { - mkdirs(file.getParent()); - writeToFile(file, new String[] { createRandomContent() }); - } - - /** - * Build the given fileStructure, all files are going to have - * sample content, all folders on the way are created. - */ - protected static void createRandomFile(IContainer parent, String[] fileNameArray) - throws IOException, CoreException { - for (int i = 0; i < fileNameArray.length; i++) { - IFile file = parent.getFile(new Path(fileNameArray[i])); - createRandomFile(file); - } - } - - /** - * wait milliseconds to continou the execution - */ - public static void waitMsec(int msec) { - try { - int wait = CVSTestSetup.WAIT_FACTOR * msec; - long start = System.currentTimeMillis(); - Thread.sleep(wait); - long end = System.currentTimeMillis(); - // Allow a 100 ms error in waiting - assertTrue("Error in thread class. Did not wait long enough", (end - start) > (wait - 100)); - } catch(InterruptedException e) { - fail("wait-problem"); - } - } - - /** - * Call this method from the main-method of your test-case. - * It initialises some required parameter and runs the testcase. - */ - protected static void run(Class test) { - // XXX is this property used anywhere? - System.setProperty("eclipse.cvs.standalone", "true"); - TestRunner.run(test); - } -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/AllTestsCompatibility.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/AllTestsCompatibility.java deleted file mode 100644 index 267f9141b..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/AllTestsCompatibility.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.eclipse.team.tests.ccvs.core.compatible; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTestsCompatibility extends TestSuite { - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(BasicTest.suite()); - suite.addTest(ConflictTest.suite()); - suite.addTest(ModuleTest.suite()); - return new CompatibleTestSetup(suite); - } - - public AllTestsCompatibility(String name) { - super(name); - } - - public AllTestsCompatibility() { - super(); - } -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java deleted file mode 100644 index f8b4b82e6..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java +++ /dev/null @@ -1,490 +0,0 @@ -package org.eclipse.team.tests.ccvs.core.compatible; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import java.util.Date; -import java.util.GregorianCalendar; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.team.tests.ccvs.core.JUnitTestCase; - -public class BasicTest extends JUnitTestCase { - SameResultEnv env1; - SameResultEnv env2; - - public BasicTest(String arg) { - super(arg); - env1 = new SameResultEnv(arg + "-checkout1"); - env2 = new SameResultEnv(arg + "-checkout2"); - } - - public BasicTest() { - this("BasicTest"); - } - - public static void main(String[] args) { - run(BasicTest.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite(BasicTest.class); - return new CompatibleTestSetup(suite); - //return new CompatibleTestSetup(new BasicTest("testReadOnly")); - } - public void setUp() throws Exception { - env1.setUp(); - env2.setUp(); - - // Set the project to the content we need ... - env1.magicSetUpRepo("proj2",new String[]{"a.txt","f1/b.txt","f1/c.txt"}); - env2.deleteFile("proj2"); - } - - public void tearDown() throws Exception { - env1.tearDown(); - env2.tearDown(); - } - - public void testAdd() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.writeToFile("proj2/d.txt",new String[]{"The file to be added","next"}); - env1.mkdirs("proj2/f2/f3"); - env1.mkdirs("proj2/f4/f5"); - env1.writeToFile("proj2/f4/f5/e.txt", new String[]{"Another file to be added","next"}); - - env1.execute("add",EMPTY_ARGS,new String[]{"d.txt"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f2","f2/f3"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f4"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f4/f5"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f4/f5/e.txt"},"proj2"); - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"}); - - // Check the stuff out somewhere else to acctually check, that - // the file has been accepted - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - } - - public void testAddUpdate() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - - env1.writeToFile("proj2/d.txt",new String[]{"The file to be added","next"}); - env1.mkdirs("proj2/f2/f3"); - env1.mkdirs("proj2/f4/f5"); - env1.writeToFile("proj2/f4/f5/e.txt", new String[]{"Another file to be added","next"}); - - env1.execute("add",EMPTY_ARGS,new String[]{"d.txt"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f2","f2/f3"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f4"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f4/f5"},"proj2"); - env1.execute("add",EMPTY_ARGS,new String[]{"f4/f5/e.txt"},"proj2"); - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"}); - - env2.execute("update",EMPTY_ARGS,new String[]{"proj2"}); - - } - - public void testRemove() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.deleteFile("proj2/a.txt"); - env1.deleteFile("proj2/f1/c.txt"); - - env1.execute("remove",EMPTY_ARGS,new String[]{"a.txt"},"proj2"); - env1.execute("remove",EMPTY_ARGS,new String[]{"f1/c.txt"},"proj2"); - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"}); - - // Check the stuff out somewhere else to acctually check, that - // the file has been accepted - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - } - - public void testRemoveRecusive() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - - env1.deleteFile("proj2/a.txt"); - env1.deleteFile("proj2/f1/c.txt"); - - env1.execute("remove",EMPTY_ARGS,new String[0],"proj2"); - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"}); - - // Check the stuff out somewhere else to acctually check, that - // the file has been accepted - env2.execute("update",EMPTY_ARGS,new String[]{"proj2"}); - } - - public void testRoundRewrite() throws Exception { - - // Download content in two locations - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - - // change the file "proj1/folder1/c.txt" in env1 check it in - // on the server - env1.appendToFile("proj2/f1/c.txt", new String[] { "AppendIt" }); - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - - // assure that the file is different in env1 and env2 - // try { - // assertEqualsArrays(env1.readFromFile("proj2/f1/c.txt"), - // env2.readFromFile("proj2/f1/c.txt")); - // throw new IllegalArgumentException("This is a failed Assertion"); - // } catch (AssertionFailedError e) {} - - // update env2 and make sure the changes are there - env2.execute("update",EMPTY_ARGS,new String[]{"proj2"},""); - // assertEqualsArrays(env1.readFromFile("proj2/f1/c.txt"), - // env2.readFromFile("proj2/f1/c.txt")); - } - - public void testUpdateMinusN() throws Exception { - String[] fileContent1; - - fileContent1 = new String[]{"RandomNumber", Math.random() + ""}; - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - - env1.writeToFile("proj1/folder1/c.txt",fileContent1); - - env1.execute("ci",new String[]{"-n"},new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - env2.execute("update",EMPTY_ARGS,new String[]{"proj2"}); - } - - public void testStatus() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("status",EMPTY_ARGS,new String[]{"proj2"}); - - env1.deleteFile("proj2/a.txt"); - env1.deleteFile("proj2/f1/c.txt"); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt" }); - - env1.execute("status",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("status",EMPTY_ARGS,new String[0],"proj2"); - - env1.createRandomFile("proj2/d.txt"); - - env1.execute("status",EMPTY_ARGS,new String[0],"proj2"); - env1.execute("status",EMPTY_ARGS,new String[]{"f1/b.txt"},"proj2"); - // env1.execute("status",localOptions,new String[]{"d.txt"},"proj2"); - } - - public void testLog() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("log",EMPTY_ARGS,new String[]{"proj2"}); - - env1.deleteFile("proj2/a.txt"); - env1.deleteFile("proj2/f1/c.txt"); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt" }); - - env1.execute("log",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("log",EMPTY_ARGS,new String[0],"proj2"); - - env1.createRandomFile("proj2/d.txt"); - - env1.execute("log",EMPTY_ARGS,new String[0],"proj2"); - env1.execute("log",EMPTY_ARGS,new String[]{"f1/b.txt"},"proj2"); - - } - - public void testBranchTag() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("tag",new String[]{"-b"},new String[]{"tag1","proj2"}); - - env1.deleteFile("proj2/a.txt"); - env1.deleteFile("proj2/f1/c.txt"); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt" }); - - env1.execute("tag",new String[]{"-b"},new String[]{"tag2","proj2"}); - - env1.createRandomFile("proj2/d.txt"); - - env1.deleteFile("proj2"); - - // Try an commit and an add in the two different streams - env1.execute("co",new String[]{"-r","tag1"},new String[]{"proj2"}); - env1.appendToFile("proj2/f1/b.txt", new String[] { "AppendItTwo" }); - env1.createRandomFile("proj2/d.txt"); - env1.execute("add",new String[0],new String[]{"d.txt"},"proj2"); - env1.execute("ci",new String[]{"-m","branch"},new String[]{"proj2"}); - env1.deleteFile("proj2"); - env1.execute("co",new String[]{"-r","tag1"},new String[]{"proj2"}); - - env2.execute("co",new String[]{"-r","tag2"},new String[]{"proj2"}); - env2.appendToFile("proj2/f1/b.txt", new String[] { "AppendItThree" }); - env2.createRandomFile("proj2/d.txt"); - env2.execute("add",new String[0],new String[]{"d.txt"},"proj2"); - env2.execute("ci",new String[]{"-m","branch"},new String[]{"proj2"}); - env2.deleteFile("proj2"); - env2.execute("co",new String[]{"-r","tag2"},new String[]{"proj2"}); - } - - public void testBranchingWithLocalChanges() throws Exception { - // Try to branch of a workspace with local changes - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - JUnitTestCase.waitMsec(1500); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt" }); - env1.execute("tag",new String[]{"-b"},new String[]{"branch-with-changes","proj2"}); - env1.execute("update",new String[]{"-r", "branch-with-changes"},new String[]{"proj2"}); - } - - public void testTag() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("tag",EMPTY_ARGS,new String[]{"tag1","proj2"}); - - env1.deleteFile("proj2/a.txt"); - env1.deleteFile("proj2/f1/c.txt"); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt" }); - - env1.execute("tag",EMPTY_ARGS,new String[]{"tag2","proj2"}); - env1.execute("tag",EMPTY_ARGS,new String[]{"tag2"},"proj2"); - - env1.createRandomFile("proj2/d.txt"); - - env1.execute("tag",EMPTY_ARGS,new String[]{"tag3"},"proj2"); - env1.execute("tag",EMPTY_ARGS,new String[]{"tag3","f1/b.txt"},"proj2"); - - env1.deleteFile("proj2"); - env1.execute("co",new String[]{"-r","tag1"},new String[]{"proj2"}); - env1.deleteFile("proj2"); - env1.execute("co",new String[]{"-r","tag2"},new String[]{"proj2"}); - env1.deleteFile("proj2"); - env1.execute("co",new String[]{"-r","tag3"},new String[]{"proj2"}); - - // env1.execute("tag",localOptions,new String[]{"d.txt"},"proj2"); - - env1.execute("update", new String[]{"-r","tag1"}, new String[]{"proj2"}); - env1.execute("update", new String[]{"-r","tag2"}, new String[]{"proj2"}); - env1.execute("update", new String[]{"-r","tag3"}, new String[]{"proj2"}); - env1.execute("update", new String[]{"-A"}, new String[]{"proj2"}); - } - - public void testRTag() throws Exception { - - // Checkout and tag the project - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("tag",EMPTY_ARGS,new String[]{"tag1","proj2"}); - env1.deleteFile("proj2"); - - // Use rtag to tag the above tag as both a version and a branch - env1.execute("rtag",new String[]{"-r", "tag1"},new String[]{"rtag1","proj2"}); - env1.execute("rtag",new String[]{"-b", "-r", "tag1"},new String[]{"btag1","proj2"}); - - // Checkout the version and branch - env1.deleteFile("proj2"); - env1.execute("co",new String[]{"-r","rtag1"},new String[]{"proj2"}); - env1.deleteFile("proj2"); - env1.execute("co",new String[]{"-r","btag1"},new String[]{"proj2"}); - } - - public void testPrune() throws Exception { - - // Download content in two locations - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - - // change the file "proj1/folder1/c.txt" in env1 check it in - // on the server - env1.deleteFile("proj2/f1/b.txt"); - env1.deleteFile("proj2/f1/c.txt"); - env1.execute("remove",EMPTY_ARGS,new String[0],"proj2"); - - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - env1.execute("update",new String[]{"-P"},new String[]{"proj2"},""); - - // update env2 and make sure the changes are there - env2.execute("update",new String[]{"-P"},new String[]{"proj2"},""); - - } - - public void testPrune2() throws Exception { - - // Download content in two locations - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - - // change the file "proj1/folder1/c.txt" in env1 check it in - // on the server - env1.deleteFile("proj2/f1/b.txt"); - env1.deleteFile("proj2/f1/c.txt"); - env1.execute("remove",EMPTY_ARGS,new String[0],"proj2"); - - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - env1.execute("update",new String[]{"-P"},new String[]{},"proj2"); - - // update env2 and make sure the changes are there - env2.execute("update",new String[]{"-P"},new String[]{},"proj2"); - - } - - public void testAdmin() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - - env1.execute("admin",new String[]{"-kb"},new String[]{"proj2/f1/b.txt"},""); - env1.execute("update",EMPTY_ARGS,new String[]{"proj2"},""); - - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - } - - public void testDiff() throws Exception { - - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("diff",EMPTY_ARGS,new String[]{"proj2"}); - - env1.setIgnoreExceptions(true); - - env1.appendToFile("proj2/f1/c.txt",new String[] {"AppendIt2" }); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt" }); - - env1.execute("diff",EMPTY_ARGS,new String[]{"proj2"}); - env1.execute("diff",EMPTY_ARGS,new String[0],"proj2"); - - env1.createRandomFile("proj2/d.txt"); - - env1.execute("diff",EMPTY_ARGS,new String[0],"proj2"); - env1.execute("diff",EMPTY_ARGS,new String[]{"f1/b.txt"},"proj2"); - // env1.execute("diff",localOptions,new String[]{"d.txt"},"proj2"); - - env1.setIgnoreExceptions(false); - } - - public void testReadOnly() throws Exception { - - // Checkout a read-only copy - env1.execute("co",new String[]{"-r"},EMPTY_ARGS,new String[]{"proj2"},""); - // Checkout and modify a writable copy - env2.execute("co",new String[]{},EMPTY_ARGS,new String[]{"proj2"},""); - env2.appendToFile("proj2/f1/c.txt",new String[] {"AppendIt2" }); - // Update the read only copy - env1.execute("update",new String[] {"-r"},EMPTY_ARGS,new String[]{"proj2"},""); - - // Update the read-only copy to writable - env1.execute("update",new String[] {},EMPTY_ARGS,new String[]{"proj2"},""); - } - - public void testQuestionables() throws Exception { - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - env1.writeToFile("proj2/f2/d.txt", new String[]{"content"}); - env1.writeToFile("proj2/f3/f4/d.txt", new String[]{"content"}); - env1.writeToFile("proj2/f5/f6/f7/d.txt", new String[]{"content"}); - env1.execute("add",new String[0],new String[]{"f3"},"proj2"); - env1.execute("add",new String[0],new String[]{"f3/f4"},"proj2"); - env1.execute("update",new String[0],new String[]{"."},"proj2"); - } - - public void testImportWrappers() throws Exception { - // Make the project empty - env1.magicSetUpRepo("proj3",new String[]{"NoImportant.txt"}); - env2.deleteFile("proj3"); - - // Create resouces and import them with the - // special wrapper - env1.createRandomFile(new String[]{"a.txt","a.class","a.xxx"},"proj3"); - env1.execute("import", - new String[]{"-W","*.txt -k 'kv'","-W","*.class -k 'b'","-I","*.xxx","-m","msg"}, - new String[]{"proj3","aTag","bTag"}, - "proj3"); - - // download the server-version - env2.execute("co",EMPTY_ARGS,new String[]{"proj3"},""); - } - - public void testImportIgnores() throws Exception { - // Make the project empty - env1.magicSetUpRepo("proj3",new String[]{"NoImportant.txt"}); - env2.deleteFile("proj3"); - - // Create resouces and import them with the - // special wrapper - env1.createRandomFile(new String[]{"a.txt","a.class","a.xxx"},"proj3"); - env1.execute("import", - new String[]{"-I","*.xxx","-m","msg"}, - new String[]{"proj3","aTag","bTag"}, - "proj3"); - - // download the server-version - env2.execute("co",EMPTY_ARGS,new String[]{"proj3"},""); - } - - private String toGMTString(Date d) { - return d.toGMTString(); - } - - public void testDate() throws Exception { - - // IMPOTANT: - // Do not make tests with relative dates, because the times coming back form the server will - // sometimes differ from the reference-client to the eclipse-client due to the time-delay in calling - - Date beforeChange; - Date firstChange; - Date secondChange; - - env1.execute("co",new String[0],new String[]{"proj2"}); - - // Change the file "a.txt" and record the times you are doing that at - waitMsec(1100); // here we wait for the import to finish - beforeChange = GregorianCalendar.getInstance().getTime(); - - waitMsec(1100); - - env1.appendToFile("proj2/a.txt",new String[] { "AppendIt" }); - env1.execute("ci",new String[]{"-m","msg"},new String[]{"proj2"}); - firstChange = GregorianCalendar.getInstance().getTime(); - - waitMsec(1100); - - env1.appendToFile("proj2/a.txt",new String[] { "AppendIt2" }); - env1.appendToFile("proj2/f1/b.txt",new String[] { "AppendIt2" }); - env1.execute("ci",new String[]{"-m","msg"},new String[]{"proj2"}); - secondChange = GregorianCalendar.getInstance().getTime(); - - waitMsec(1100); - - env1.deleteFile("proj2"); - - // Now check the project at different times out - env1.execute("co",new String[]{"-D",toGMTString(beforeChange)},new String[]{"proj2"}); - env1.deleteFile("proj2"); - - env1.execute("co",new String[]{"-D",toGMTString(firstChange)},new String[]{"proj2"}); - env1.deleteFile("proj2"); - - env1.execute("co",new String[]{"-D",toGMTString(secondChange)},new String[]{"proj2"}); - env1.deleteFile("proj2"); - - // Now do some updates to look if update -D works - env1.execute("co",new String[0],new String[]{"proj2"}); - env1.execute("update",new String[]{"-D",toGMTString(beforeChange)},new String[]{"proj2"}); - env1.execute("update",new String[]{"-D",toGMTString(firstChange)},new String[]{"proj2"}); - env1.execute("update",new String[]{"-D",toGMTString(secondChange)},new String[]{"proj2"}); - - // We look if the parameter -a is working - env1.execute("update",new String[]{"-D",toGMTString(beforeChange),"-A"},new String[]{"proj2"}); - env1.execute("update",new String[]{"-D",toGMTString(secondChange)},new String[]{"proj2"}); - env1.deleteFile("proj2"); - - // We get try to merge changes from different dates - env1.execute("co",new String[0],new String[]{"proj2"}); - env1.appendToFile("proj2/a.txt", new String[] { "This is the world ..." }); - env1.execute("update",new String[]{"-D",toGMTString(beforeChange)},new String[]{"proj2"}); - env1.appendToFile("proj2/a.txt", new String[] {"... which constantly changes" }); - env1.execute("update",new String[]{"-A"},new String[]{"proj2"}); - // Change something to be able to commit - env1.appendToFile("proj2/a.txt", new String[] { "... and the changes are approved" }); - env1.execute("ci",new String[]{"-m","msg"},new String[]{"proj2"}); - - } -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/CompatibleTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/CompatibleTestSetup.java deleted file mode 100644 index 788454176..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/CompatibleTestSetup.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.eclipse.team.tests.ccvs.core.compatible; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import junit.framework.Test; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; -import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; -import org.eclipse.team.tests.ccvs.core.CVSTestSetup; - -/** - * @version 1.0 - * @author ${user} - */ -public class CompatibleTestSetup extends CVSTestSetup { - public static final String ECLIPSE_REPOSITORY_LOCATION; - public static final String REFERENCE_REPOSITORY_LOCATION; - public static CVSRepositoryLocation referenceClientRepository; - public static CVSRepositoryLocation eclipseClientRepository; - - static { - REFERENCE_REPOSITORY_LOCATION = System.getProperty("eclipse.cvs.repository1"); - ECLIPSE_REPOSITORY_LOCATION = System.getProperty("eclipse.cvs.repository2"); - } - - /** - * Constructor for CompatibleTestSetup. - */ - public CompatibleTestSetup(Test test) { - super(test); - } - - /** - * For compatibility testing, we need to set up two repositories - */ - public void setUp() throws CVSException { - CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(false); - CVSProviderPlugin.getPlugin().setFetchAbsentDirectories(false); - - // setup the repositories - if (referenceClientRepository == null) - referenceClientRepository = setupRepository(REFERENCE_REPOSITORY_LOCATION); - if (eclipseClientRepository == null) - eclipseClientRepository = setupRepository(ECLIPSE_REPOSITORY_LOCATION); - } - - public void tearDown() throws CVSException { - CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(true); - CVSProviderPlugin.getPlugin().setFetchAbsentDirectories(true); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ConflictTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ConflictTest.java deleted file mode 100644 index 0d012b129..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ConflictTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.team.tests.ccvs.core.compatible; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.team.tests.ccvs.core.JUnitTestCase; - -public class ConflictTest extends JUnitTestCase { - SameResultEnv env1; - SameResultEnv env2; - - public ConflictTest() { - this(null); - } - - public ConflictTest(String arg) { - super(arg); - env1 = new SameResultEnv(arg + "checkout1"); - env2 = new SameResultEnv(arg + "checkout2"); - } - - public void setUp() throws Exception { - env1.setUp(); - env2.setUp(); - - // Set the project to the content we need ... - env1.magicSetUpRepo("proj2",new String[]{"a.txt","f1/b.txt","f1/c.txt"}); - env2.deleteFile("proj2"); - } - - public void tearDown() throws Exception { - env1.tearDown(); - env2.tearDown(); - } - - public static Test suite() { - TestSuite suite = new TestSuite(ConflictTest.class); - //return new CompatibleTestSetup(new ConflictTest("testSimpleConflict")); - return new CompatibleTestSetup(suite); - } - - public void testSimpleConflict() throws Exception { - // Download content in two locations - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - - // change the file in both directories in a different way - env1.appendToFile("proj2/f1/c.txt", new String[] { "AppendIt This" }); - env2.appendToFile("proj2/f1/c.txt", new String[] { "AppendIt That" }); - - // commit changes of the first - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - - // load the changes into the changed file - // and submit the merge - env2.execute("update",EMPTY_ARGS,new String[]{"proj2"},""); - - // commit must fail because we have a merged conflict which has not been - // edited. - env2.setIgnoreExceptions(true); - env2.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - env2.setIgnoreExceptions(false); - - // Make a change to the file in order to let the cvs-client know - // that we solved the confilict - env2.appendToFile("proj2/f1/c.txt", new String[] { "That's allright" }); - env2.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - } - - public void testMergedUpdate() throws Exception { - // Download content in two locations - env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},""); - - // change the file in both directories in a different way so that - // can be merged without conflicts - env1.prefixToFile("proj2/f1/c.txt", new String[] { "AppendIt at top" }); - env2.appendToFile("proj2/f1/c.txt", new String[] { "AppendIt at bottom" }); - - // commit changes of the first - env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - - // changes should be merged - env2.execute("update",EMPTY_ARGS,new String[]{"proj2"},""); - env2.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},""); - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ModuleTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ModuleTest.java deleted file mode 100644 index fd9080cc8..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/ModuleTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.eclipse.team.tests.ccvs.core.compatible; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.team.tests.ccvs.core.JUnitTestCase; - -public class ModuleTest extends JUnitTestCase { - SameResultEnv env1; - SameResultEnv env2; - - public ModuleTest(String arg) { - super(arg); - env1 = new SameResultEnv(arg + "checkout1"); - env2 = new SameResultEnv(arg + "checkout2"); - } - - public static void main(String[] args) { - run(ModuleTest.class); - } - - public void setUp() throws Exception { - env1.setUp(); - env2.setUp(); - - // Set the project to the content we need ... - env1.magicDeleteRemote("CVSROOT/modules"); - env1.magicDeleteRemote("CVSROOT/modules,v"); - env1.magicSetUpRepo("proj2",new String[]{"a.txt","f1/b.txt","f1/c.txt","f2/d.txt","f2/f3/e.txt"}); - env2.deleteFile("proj2"); - } - - public void tearDown() throws Exception { - env1.tearDown(); - env2.tearDown(); - } - - public static Test suite() { - TestSuite suite = new TestSuite(ModuleTest.class); - return new CompatibleTestSetup(suite); - } - - private void setUpModuleFile(String[] change) throws Exception { - - // Write the modules-file - env1.execute("co",EMPTY_ARGS,new String[]{"CVSROOT"}); - env1.writeToFile("CVSROOT/modules",change); - - // Send it up to the server - env1.execute("add",new String[]{"-m","m"},new String[]{"modules"},"CVSROOT"); - env1.execute("ci",new String[]{"-m","m"},new String[]{"CVSROOT"}); - env1.deleteFile("CVSROOT"); - } - - public void testSimpleModule() throws Exception { - setUpModuleFile(new String[]{"mod1 proj2"}); - env1.execute("co",EMPTY_ARGS,new String[]{"mod1"}); - env1.appendToFile("mod1/a.txt", new String[] { "Append" }); - env1.execute("ci",new String[]{"-m","m"},new String[]{"mod1"}); - env1.execute("update",EMPTY_ARGS,new String[]{"mod1"}); - } - - public void testCompositeModule() throws Exception { - setUpModuleFile(new String[]{ "mod1-f1 proj2/f1", - "mod1-f2 proj2/f2", - "mod1f &mod1-f1 &mod1-f2"}); - - env1.execute("co",EMPTY_ARGS,new String[]{"mod1f"}); - env1.appendToFile("mod1f/mod1-f1/b.txt", new String[] { "Append" }); - env1.execute("ci",new String[]{"-m","m"},new String[]{"mod1f"}); - env1.execute("update",EMPTY_ARGS,new String[]{"mod1f"}); - } - - public void testCompositeAliasModule() throws Exception { - setUpModuleFile(new String[]{"mod1-f1 proj2/f1", - "mod1t proj2/f1 b.txt", - "mod1-f2 &proj2/f2 &mod1t", - "mod1f -a mod1-f1 mod1-f2"}); - - env1.execute("co",EMPTY_ARGS,new String[]{"mod1f"}); - env1.appendToFile("mod1-f1/b.txt", new String[] { "Append" }); - env1.execute("ci",new String[]{"-m","m"},new String[]{"mod1-f1","mod1-f2"}); - env1.execute("update",EMPTY_ARGS,new String[]{"mod1-f1","mod1-f2"}); - } -} - diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java deleted file mode 100644 index db3f1ac27..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java +++ /dev/null @@ -1,484 +0,0 @@ -package org.eclipse.team.tests.ccvs.core.compatible; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ -import java.io.IOException; -import java.io.InputStream; -import java.util.Date; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.ICVSFile; -import org.eclipse.team.internal.ccvs.core.ICVSFolder; -import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; -import org.eclipse.team.internal.ccvs.core.ICVSResource; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; -import org.eclipse.team.tests.ccvs.core.CommandLineCVSClient; -import org.eclipse.team.tests.ccvs.core.EclipseCVSClient; -import org.eclipse.team.tests.ccvs.core.ICVSClient; -import org.eclipse.team.tests.ccvs.core.JUnitTestCase; - - -/** - * This is a TestCase that does provide the possibility - * to run tests on both the reference reference-client and the - * client provided by us, and to check on equal results - * in files and messages to the consol. - * - * No own tests should be placed here, instead you should - * instanciate this testcase in order to make your test from - * another suite. - * The class is final, because you need to be able to open - * two (or more) different enviorments to test certain things. - */ -public final class SameResultEnv extends JUnitTestCase { - private IProject referenceProject; - private ICVSFolder referenceRoot; - private IProject eclipseProject; - private ICVSFolder eclipseRoot; - - private boolean ignoreExceptions; - - public SameResultEnv(String arg) { - super(arg); - } - - /** - * Always to be called in the setUp of the testCase that wants to - * use the same-result Enviorment. - */ - public void setUp() throws Exception { - super.setUp(); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - // setup reference client test project - referenceProject = root.getProject(getName() + "-reference"); - referenceProject.delete(true /*deleteContent*/, true /*force*/, null); - mkdirs(referenceProject); - referenceRoot = CVSWorkspaceRoot.getCVSFolderFor(referenceProject); - - // setup eclipse client test project - eclipseProject = root.getProject(getName() + "-eclipse"); - eclipseProject.delete(true /*deleteContent*/, true /*force*/, null); - mkdirs(eclipseProject); - eclipseRoot = CVSWorkspaceRoot.getCVSFolderFor(eclipseProject); - - // By default, exceptions are not ignored. - // Specific test cases can choose to ignore exceptions - ignoreExceptions = false; - } - - /** - * Always to be called in the tearDown of the testCase that wants to - * use the same-result Enviorment. - */ - public void tearDown() throws Exception { - // we deliberately don't clean up test projects to simplify debugging - super.tearDown(); - } - - /** - * Helper method. - * Calls execute(command, EMPTY_ARGS, localOptions, arguments, pathRelativeToRoot) - */ - public void execute(String command, String[] localOptions, String[] arguments, String pathRelativeToRoot) - throws CVSException { - execute(command, EMPTY_ARGS, localOptions, arguments, pathRelativeToRoot); - } - - /** - * Helper method. - * Calls execute(command, EMPTY_ARGS, localOptions, arguments, "") - */ - public void execute(String command, String[] localOptions, String[] arguments) - throws CVSException { - execute(command, EMPTY_ARGS, localOptions, arguments, ""); - } - - /** - * Runs a command twice, once in the reference environments, once - * in the eclipse environment. Compares the resulting resources - * on disk, but not console output. - */ - public void execute(String command, - String[] globalOptions, String[] localOptions, String[] arguments, - String pathRelativeToRoot) throws CVSException { - - // run with reference client - boolean referenceClientException = execute(CommandLineCVSClient.INSTANCE, - CompatibleTestSetup.referenceClientRepository, referenceProject, - command, globalOptions, localOptions, arguments, pathRelativeToRoot); - // run with Eclipse client - boolean eclipseClientException = execute(EclipseCVSClient.INSTANCE, - CompatibleTestSetup.eclipseClientRepository, eclipseProject, - command, globalOptions, localOptions, arguments, pathRelativeToRoot); - - // assert same results - assertEquals(referenceClientException, eclipseClientException); - assertConsistent(); - } - - private boolean execute(ICVSClient client, ICVSRepositoryLocation repositoryLocation, - IContainer localRoot, String command, - String[] globalOptions, String[] localOptions, String[] arguments, - String pathRelativeToRoot) throws CVSException { - try { - IPath path = new Path(pathRelativeToRoot); - if (path.segmentCount() != 0) { - localRoot = localRoot.getFolder(path); - } - client.executeCommand(repositoryLocation, localRoot, command, globalOptions, - localOptions, arguments); - } catch (CVSException e) { - if (ignoreExceptions) return true; - throw e; - } - return false; - } - - /** - * Deletes files on the both of the cvs-servers. - */ - public void magicDeleteRemote(String remoteName) throws CVSException { - super.magicDeleteRemote(CompatibleTestSetup.referenceClientRepository, remoteName); - super.magicDeleteRemote(CompatibleTestSetup.eclipseClientRepository, remoteName); - } - - /** - * Set up both of the repos on the cvs-server(s) with the standard - * file-structure: - * project - * a.txt - * f1 - * b.txt - * c.txt - */ - public void magicSetUpRepo(String projectName) - throws IOException, CoreException, CVSException { - magicSetUpRepo(projectName, new String[]{"a.txt","f1/b.txt","f1/c.txt"}); - } - - /** - * Set up both of the repos on the cvs-server(s) with a filestructre - * resulting for your input in the parameter createResources. - */ - public void magicSetUpRepo(String projectName, String[] createResources) - throws IOException, CoreException, CVSException { - magicDeleteRemote(projectName); - - IProject projectRoot = workspaceRoot.getProject(projectName + "-setup-tmp"); - mkdirs(projectRoot); - createRandomFile(projectRoot, createResources); - - String[] lOptions = new String[]{"-m","msg"}; - String[] args = new String[]{projectName,"a","b"}; - - magicDeleteRemote(CompatibleTestSetup.referenceClientRepository, projectName); - EclipseCVSClient.execute(CompatibleTestSetup.referenceClientRepository, CVSWorkspaceRoot.getCVSFolderFor(projectRoot), - "import", EMPTY_ARGS, lOptions, args); - - magicDeleteRemote(CompatibleTestSetup.eclipseClientRepository, projectName); - EclipseCVSClient.execute(CompatibleTestSetup.eclipseClientRepository, CVSWorkspaceRoot.getCVSFolderFor(projectRoot), - "import", EMPTY_ARGS, lOptions, args); - - projectRoot.delete(false /*force*/, null); - } - - /** - * Create a file with random-content in both, the reference client and - * the eclipse-client. - * - * @param relativeFileName is the relative path as allways in the - class used for access - */ - public void createRandomFile(String relativeFileName) - throws IOException, CoreException { - String[] contents = new String[] { createRandomContent() }; - writeToFile(relativeFileName, contents); - } - - /** - * Call createRandomFile for every element of the array - * - * @see SameResultEnv#createRandomFile(String) - */ - public void createRandomFile(String[] relativeFileNames, - String pathRelativeToRoot) throws CoreException, IOException { - if (pathRelativeToRoot == null) { - pathRelativeToRoot = ""; - } else if (! pathRelativeToRoot.endsWith("/")) { - pathRelativeToRoot += "/"; - } - for (int i = 0; i < relativeFileNames.length; i++) { - createRandomFile(pathRelativeToRoot + relativeFileNames[i]); - } - } - - /** - * Read from the file (check that we have acctually got the same - * content in both versions - */ - public String[] readFromFile(String relativeFileName) - throws IOException, CoreException { - IFile referenceFile = referenceProject.getFile(relativeFileName); - String[] content1 = super.readFromFile(referenceFile); - IFile eclipseFile = eclipseProject.getFile(relativeFileName); - String[] content2 = super.readFromFile(eclipseFile); - assertEqualsArrays(content1,content2); - return content1; - } - - /** - * Delete a file / folder from both directories. - */ - public void deleteFile(String relativeFileName) throws CoreException { - IResource referenceFile, eclipseFile; - if (relativeFileName.length() != 0) { - referenceFile = referenceProject.findMember(relativeFileName); - eclipseFile = eclipseProject.findMember(relativeFileName); - } else { - referenceFile = referenceProject; - eclipseFile = eclipseProject; - } - assertEquals(referenceFile != null, eclipseFile != null); - if (referenceFile == null) return; - assertEquals(referenceFile.exists(), eclipseFile.exists()); - referenceFile.delete(true, null); - eclipseFile.delete(true, null); - } - - /** - * Creates a folder (and its parents if needed) in both environments. - */ - public void mkdirs(String relativeFolderName) throws CoreException { - IFolder referenceFolder = referenceProject.getFolder(relativeFolderName); - IFolder eclipseFolder = eclipseProject.getFolder(relativeFolderName); - assertEquals(referenceFolder.exists(), eclipseFolder.exists()); - mkdirs(referenceFolder); - mkdirs(eclipseFolder); - } - - /** - * Append a String to an file (acctally to both of the files, that are going - * to have the same content) - */ - public void appendToFile(String relativeFileName, String[] contents) - throws IOException, CoreException { - // Wait a second so that the timestamp will change for sure - waitMsec(1500); - - IFile referenceFile = referenceProject.getFile(relativeFileName); - appendToFile(referenceFile, contents); - IFile eclipseFile = eclipseProject.getFile(relativeFileName); - appendToFile(eclipseFile, contents); - } - - /** - * Append a String to an file (acctally to both of the files, that are going - * to have the same content) - */ - public void prefixToFile(String relativeFileName, String[] contents) - throws IOException, CoreException { - // Wait a second so that the timestamp will change for sure - waitMsec(1500); - - IFile referenceFile = referenceProject.getFile(relativeFileName); - prefixToFile(referenceFile, contents); - IFile eclipseFile = eclipseProject.getFile(relativeFileName); - prefixToFile(eclipseFile, contents); - } - - /** - * Write to the file (acctally to both of the files, that are going - * to have the same content) - */ - public void writeToFile(String relativeFileName, String[] contents) - throws IOException, CoreException { - IFile referenceFile = referenceProject.getFile(relativeFileName); - writeToFile(referenceFile, contents); - IFile eclipseFile = eclipseProject.getFile(relativeFileName); - writeToFile(eclipseFile, contents); - } - - /** - * Checks whether the two directories inside the environment - * are equal and therefore the state valid. - */ - public void assertConsistent() throws CVSException { - assertEquals(referenceRoot, eclipseRoot); - } - - /** - * Deep compare of two ManagedResources (most likly folders). - * Passwords are ignored. - * - * @param ignoreTimestamp if true timestamps of - files are ignored for the comparison - */ - public static void assertEquals(ICVSResource mResource1, - ICVSResource mResource2) - throws CVSException { - - assertEquals(mResource1.isFolder(), mResource2.isFolder()); - assertEquals(mResource1.isManaged() , mResource2.isManaged()); - assertEquals(mResource1.exists(), mResource2.exists()); - - if (!mResource1.exists()) { - return; - } - - if (mResource1.isFolder()) { - assertEquals((ICVSFolder)mResource1,(ICVSFolder)mResource2); - } else { - assertEquals((ICVSFile)mResource1,(ICVSFile)mResource2); - } - } - - /** - * Assert that two CVSFile's are equal by comparing the content - * and the metainformation out of the ResourceSync. - */ - private static void assertEquals(ICVSFile mFile1, ICVSFile mFile2) throws CVSException { - - if (mFile1.getName().equals(".project")) return; - - // Check the permissions on disk - assertEquals(mFile1.isReadOnly(), mFile2.isReadOnly()); - - // Compare the content of the files - try { - InputStream in1 = mFile1.getContents(); - InputStream in2 = mFile2.getContents(); - byte[] buffer1 = new byte[(int)mFile1.getSize()]; - byte[] buffer2 = new byte[(int)mFile2.getSize()]; - // This is not the right way to do it, because the Stream - // may read less than the whoole file - in1.read(buffer1); - in2.read(buffer2); - in1.close(); - in2.close(); - assertEquals("Length differs for file " + mFile1.getName(), buffer1.length, buffer2.length); - assertEquals("Contents differs for file " + mFile1.getName(), new String(buffer1),new String(buffer2)); - } catch (IOException e) { - throw new CVSException("Error in TestCase"); - } - - // We can not do the ceck, because the reference client does - // check out dirty files ?!? - // assertEquals(mFile1.isDirty(),mFile2.isDirty()); - - assertEquals(mFile1.getSyncInfo() == null,mFile2.getSyncInfo() == null); - if (mFile1.getSyncInfo() == null) { - return; - } - - ResourceSyncInfo info1 = mFile1.getSyncInfo(); - ResourceSyncInfo info2 = mFile2.getSyncInfo(); - - assertEquals(info1.getKeywordMode(), info2.getKeywordMode()); - assertEquals(info1.getTag(), info2.getTag()); - assertEquals(info1.getName(), info2.getName()); - assertEquals(info1.getRevision(), info2.getRevision()); - - assertEquals(info1.isDeleted(), info2.isDeleted()); - assertEquals(info1.isAdded(), info2.isAdded()); - assertEquals(info1.isMerged(), info2.isMerged()); - assertEquals(info1.isMergedWithConflicts(), info2.isMergedWithConflicts()); - - // Ensure that timestamps are written using same timezone. - // assertTimestampEquals(info1.getTimeStamp(), info2.getTimeStamp()); - - // We are not able to check for the permissions, as the reference-client doesn't save them - } - - private static void assertTimestampEquals(Date timestamp1, Date timestamp2) { - assertEquals(timestamp1!=null, timestamp2!=null); - if(timestamp1!=null) { - long time1 = timestamp1.getTime(); - long time2 = timestamp2.getTime(); - long difference = Math.abs(time1 - time2); - assertTrue("timestamps should be in same timezone:" + timestamp1 + ":" + timestamp2, difference < (10*60*1000)); // 10 minutes - } - } - - /** - * Assert that two CVSFile's are equal. First the - * metainformation out of the FolderSync for this - * folder is compared, then the amount of children is - * checked and finally the recussion is started to - * compare the children of this folder. - */ - private static void assertEquals(ICVSFolder mFolder1, - ICVSFolder mFolder2) - throws CVSException { - - assertEquals(mFolder1.isCVSFolder(),mFolder2.isCVSFolder()); - - if (mFolder1.isCVSFolder()) { - String root1 = removePassword(mFolder1.getFolderSyncInfo().getRoot()); - String root2 = removePassword(mFolder2.getFolderSyncInfo().getRoot()); - root1 = root1.substring(0,root1.lastIndexOf("@")); - root2 = root2.substring(0,root2.lastIndexOf("@")); - assertEquals(root1,root2); - - assertEquals(mFolder1.getFolderSyncInfo().getRepository(),mFolder2.getFolderSyncInfo().getRepository()); - assertEquals(mFolder1.getFolderSyncInfo().getIsStatic(),mFolder2.getFolderSyncInfo().getIsStatic()); - assertEquals(mFolder1.getFolderSyncInfo().getTag(),mFolder2.getFolderSyncInfo().getTag()); - } - - ICVSResource[] resourceList1 = mFolder1.members(ICVSFolder.FILE_MEMBERS | ICVSFolder.FOLDER_MEMBERS); - ICVSResource[] resourceList2 = mFolder2.members(ICVSFolder.FILE_MEMBERS | ICVSFolder.FOLDER_MEMBERS); - assertEquals(resourceList1.length, resourceList2.length); - for (int i=0; i - * Supported arguments: - * -test : id of suite to run (must be plugged into extension point) - * -log : specify a file for logging - * -nolog : do not write a log file - * -repeat : number of iterations to run - * -ignorefirst : ignore (do not record) results from first iteration - * -purge : purge all projects from the workspace before each iteration - * : passed verbatim to the org.eclipse.ui.workbench application - * - */ -public class EclipseUITestHarnessApplication extends EclipseTestHarnessApplication { - protected boolean purgeWorkspace; - protected boolean ignoreFirst; - protected int repeatCount; - protected LoggingTestResult logResult; - - /** - * Application entry point. - */ - public Object run(Object userArgs) throws Exception { - PrintStream logStream = System.err; - String logFilename = null; - purgeWorkspace = false; - ignoreFirst = false; - repeatCount = 1; - if (userArgs instanceof String[]) { - // parse args, no error handling - String[] args = (String[]) userArgs; - List argsList = new ArrayList(args.length); - for (int i = 0; i < args.length; ++i) { - if ("-repeat".equals(args[i])) { - repeatCount = Integer.parseInt(args[++i]); - } else if ("-ignorefirst".equals(args[i])) { - ignoreFirst = true; - } else if ("-nolog".equals(args[i])) { - logStream = null; - } else if ("-log".equals(args[i])) { - logFilename = args[++i]; - } else if ("-purge".equals(args[i])) { - purgeWorkspace = true; - } else { - argsList.add(args[i]); - } - } - userArgs = argsList.toArray(new String[argsList.size()]); - } - // setup logging - if (logFilename != null) { - File file = new File(logFilename); - logStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(logFilename))); - } - logResult = new LoggingTestResult(logStream); - try { - logResult.startLog(System.currentTimeMillis(), getSDKBuildId()); - return launchWorkbench(userArgs); - } finally { - logResult.endLog(); - if (logFilename != null) logStream.close(); - } - } - - /** - * Launches the Workbench UI. - */ - protected Object launchWorkbench(final Object userArgs) throws Exception { - final Exception[] exception = new Exception[1]; - Workbench workbench = new Workbench() { - /*** this code should be kept in sync with Workbench.runEventLoop() ***/ - protected void runEventLoop(Window.IExceptionHandler handler) { - // Dispatch all events. - Display display = Display.getCurrent(); - while (true) { - try { - if (!display.readAndDispatch()) - break; - } catch (Throwable e) { - break; - } - } - - // Run our hook. - try { - workbenchHook(this); - } catch (Exception e) { - exception[0] = e; - } - - // Close the workbench. - close(); - } - }; - Object result = workbench.run(userArgs); - if (exception[0] != null) throw exception[0]; - return result; - } - - /** - * Callback from Workbench if it launched successfully. - */ - protected Object workbenchHook(Workbench workbench) throws Exception { - // run the underlying non-ui test launcher to locate and start the test cases - return super.run(workbench.getCommandLineArgs()); - } - - /** - * Runs the specified test. Called from the non-ui test launcher. - */ - protected void run(Test test) { - for (int i = 0; i < repeatCount; ++i) { - if (purgeWorkspace) purgeWorkspaceProjects(); - LoggingTestRunner runner = new LoggingTestRunner(); - runner.doRun(test, (i == 0 && ignoreFirst) ? null : logResult, false); - } - } - - /** - * Purges the projects in the workspace. - */ - public static void purgeWorkspaceProjects() { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - // purge all known projects from the workspace - IProject[] projects = workspace.getRoot().getProjects(); - for (int i = 0; i < projects.length; ++i) { - IProject project = projects[i]; - try { - project.delete(true, true, null); - } catch (CoreException e) { - System.err.println("Could not purge project: " + project.getName()); - } - } - } - - /** - * Gets the SDK build id. - */ - public static String getSDKBuildId() { - try { - URL url = Platform.getPluginRegistry().getPluginDescriptor("org.eclipse.sdk").getInstallURL(); - url = new URL(url, "platform.ini"); - InputStream is = url.openStream(); - try { - Properties sdkProperties = new Properties(); - sdkProperties.load(is); - String buildId = sdkProperties.getProperty("buildID"); - if (buildId != null) return buildId; - } finally { - is.close(); - } - } catch (Exception e) { - } - return "unknown"; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java deleted file mode 100644 index 7ba27df8d..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EmptyPerspective.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IPerspectiveFactory; - -/** - * This perspective is used for testing api. It defines an initial - * layout with no parts, just an editor area. - * - * Note: originally borrowed from org.eclipse.jdt.junit.eclipse.util - */ -public class EmptyPerspective implements IPerspectiveFactory { - - /** - * The perspective id. - */ - public static final String PERSP_ID = "org.eclipse.team.tests.ccvs.ui.EmptyPerspective"; - - /** - * Constructs a new Default layout engine. - */ - public EmptyPerspective() { - super(); - } - - /** - * Defines the initial layout for a perspective. - * - * Implementors of this method may add additional views to a - * perspective. The perspective already contains an editor folder - * with ID = ILayoutFactory.ID_EDITORS. Add additional views - * to the perspective in reference to the editor folder. - * - * This method is only called when a new perspective is created. If - * an old perspective is restored from a persistence file then - * this method is not called. - * - * @param factory the factory used to add views to the perspective - */ - public void createInitialLayout(IPageLayout layout) { - //layout.addView( MockViewPart.ID, IPageLayout.BOTTOM, 0.5f, layout.getEditorArea() ); - } -} \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java deleted file mode 100644 index ca90addca..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/FakeSelectionProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; - -/** - * Serves up fake selections. - * - * Note: originally borrowed from org.eclipse.jdt.ui.tests.actions - */ -public class FakeSelectionProvider implements ISelectionProvider { - private Object[] fElems; - public FakeSelectionProvider(Object[] elements){ - fElems = elements; - } - - public void addSelectionChangedListener(ISelectionChangedListener listener) { - } - - public ISelection getSelection() { - return new StructuredSelection(fElems); - } - - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - } - - public void setSelection(ISelection selection) { - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java deleted file mode 100644 index bacd0aff1..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ICriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -/** - * Generic object filter mechanism. - */ -public interface ICriteria { - /** - * Returns true if the candidate object satisfies the specified - * criteria value according to a particular algorithm. - */ - public boolean test(Object candidate, Object value); -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java deleted file mode 100644 index 70effb4b9..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestCase.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import junit.framework.Assert; -import junit.framework.TestCase; -import junit.framework.TestResult; -import org.eclipse.core.runtime.IStatus; - -public class LoggingTestCase extends TestCase { - private LoggingTestResult logResult; - private int disableLogStack; - - /** - * Creates a new logging test case. - */ - public LoggingTestCase(String name) { - super(name); - } - - /** - * Runs a test. - * @param result the result object - */ - public void run(TestResult result) { - // run the garbage collector now to improve benchmark precision - for (int i = 0; i < 4; ++i) { - System.runFinalization(); - System.gc(); - } - if (result instanceof LoggingTestResult) { - logResult = (LoggingTestResult) result; - disableLogStack = 0; - } else { - logResult = null; - disableLogStack = 1; - } - super.run(result); - } - - /** - * Marks the beginning of a new task group. - * @param groupName the name for the group - */ - protected void startGroup(String groupName) { - if (disableLogStack == 0) logResult.startGroup(groupName); - } - - /** - * Marks the ends of the active task group. - */ - protected void endGroup() { - if (disableLogStack == 0) logResult.endGroup(); - } - - /** - * Marks the beginning of a new task. - * @param taskName the name for the task - */ - protected void startTask(String taskName) { - if (disableLogStack == 0) logResult.startTask(taskName); - } - - /** - * Marks the ends of the active task. - */ - protected void endTask() { - if (disableLogStack == 0) logResult.endTask(); - } - - /** - * Disables logging until re-enabled. (this call nests) - */ - protected void disableLog() { - disableLogStack += 1; - } - - /** - * Enables logging when all previous calls to disableLog are matched. - */ - protected void enableLog() { - Assert.assertTrue(disableLogStack > 0); - disableLogStack -= 1; - Assert.assertTrue(disableLogStack != 0 || logResult != null); - } - - /** - * Prints a warning message to the log. - * @param message the message, or null - * @param error an exception with a stack trace, or null - * @param status a status code, or null - */ - protected void printWarning(String message, Throwable error, IStatus status) { - if (disableLogStack == 0) logResult.printWarning(message, error, status); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java deleted file mode 100644 index ee4b28cb1..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestResult.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.PrintStream; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Stack; -import java.util.StringTokenizer; - -import junit.framework.Assert; -import junit.framework.AssertionFailedError; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestResult; -import junit.runner.BaseTestRunner; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.team.core.TeamException; - -public class LoggingTestResult extends TestResult { - protected Stack groupStack; - protected PerformanceTimer currentTask; - protected PrintStream logStream; - protected Stack /* of String */ elements; - protected String indent; - - /** - * Creates a logging test result. - * @param logStream the output stream, or null to disable logging - */ - public LoggingTestResult(PrintStream logStream) { - this.logStream = logStream; - this.elements = new Stack(); - this.indent = ""; - groupStack = new Stack(); - currentTask = null; - } - - /** - * Marks the beginning of a series of log entries. - */ - public void startLog(long timestamp, String sdkBuild) { - println(""); - startXMLElement("log", new String[] { "timestamp", "sdkbuild" }, new String[] { - new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss").format(new Date(timestamp)), - sdkBuild }); - } - - /** - * Marks the end of a series of log entries. - */ - public void endLog() { - endXMLElement(); - } - - /** - * Prints a warning message to the log file. - * @param message the message, or null - * @param error an exception with a stack trace, or null - * @param status a status code, or null - */ - public void printWarning(String message, Throwable error, IStatus status) { - printAbort("warning", message, error, status); - } - - /** - * Called by the JUnit framework when an error occurs. - * @param test the test - * @param error the exception that occurred - */ - public void addError(Test test, Throwable error) { - printAbort("error", null, error, null); - super.addError(test, error); - } - - /** - * Called by the JUnit framework when an assertion failure occurs. - * @param test the test - * @param error the exception that occurred - */ - public void addFailure(Test test, AssertionFailedError error) { - printAbort("failure", null, error, null); - super.addFailure(test, error); - } - - /** - * Called by the JUnit framework to mark the beginning of a test case. - * @param test the test - */ - public void startTest(Test test) { - if (test instanceof TestCase) { - TestCase testCase = (TestCase) test; - startXMLElement("case", new String[] { "class", "name" }, - new String[] { testCase.getClass().getName(), testCase.getName() }); - groupStack.clear(); - currentTask = null; - } - super.startTest(test); - } - - /** - * Called by the JUnit framework to mark the end of a test case. - * @param test the test - */ - public void endTest(Test test) { - if (test instanceof TestCase) { - TestCase testCase = (TestCase) test; - if (currentTask != null) endTask(); - while (! groupStack.isEmpty()) endGroup(); - endXMLElement(); - } - super.endTest(test); - } - - /** - * Marks the beginning of a new task group. - * @param groupName the name for the group - */ - public void startGroup(String groupName) { - Assert.assertNull(currentTask); - startXMLElement("group", new String[] { "name" }, new String[] { groupName }); - groupStack.push(groupName); - } - - /** - * Marks the end of the active task group. - */ - public void endGroup() { - Assert.assertNull(currentTask); - Assert.assertTrue(! groupStack.empty()); - endXMLElement(); - groupStack.pop(); - } - - /** - * Marks the beginning of a new task. - * @param taskName the name for the task - */ - public void startTask(String taskName) { - Assert.assertNull(currentTask); - startXMLElement("task", new String[] { "name" }, new String[] { taskName }); - currentTask = new PerformanceTimer(taskName); - currentTask.start(); - } - - /** - * Marks the end of the active task. - */ - public void endTask() { - Assert.assertNotNull(currentTask); - currentTask.stop(); - printXMLElement("result", new String[] { "elapsed" }, - new String[] { Integer.toString(currentTask.getTotalMillis()) }); - endXMLElement(); - currentTask = null; - } - - protected void startXMLElement(String name, String[] attributes, String[] values) { - println(formatXMLElement(name, attributes, values, false)); - elements.push(name); - indent += " "; - } - - protected void printXMLElement(String name, String[] attributes, String[] values) { - println(formatXMLElement(name, attributes, values, true)); - } - - protected String formatXMLElement(String name, String[] attributes, String[] values, boolean quickEnd) { - // XXX need to escape certain characters in attribute values - StringBuffer buffer = new StringBuffer("<"); - buffer.append(name); - if (attributes != null && values != null) { - for (int i = 0; i < attributes.length; ++i) { - buffer.append(' '); - buffer.append(attributes[i]); - buffer.append("=\""); - buffer.append(values[i]); - buffer.append('"'); - } - } - if (quickEnd) buffer.append('/'); - buffer.append('>'); - return buffer.toString(); - } - - protected void endXMLElement() { - indent = indent.substring(2); - String name = (String) elements.pop(); - println(""); - } - - protected void printXMLElementData(String line) { - // XXX need to escape certain characters in element data - println(line); - } - - protected void printAbort(String type, String message, Throwable error, IStatus status) { - if (status == null && error != null) { - if (error instanceof CoreException) { - status = ((CoreException) error).getStatus(); - } else if (error instanceof TeamException) { - status = ((TeamException) error).getStatus(); - } - } - if (message == null && error != null) { - message = error.getMessage(); - if (message == null) { - message = error.getClass().getName(); - } - } - if (message == null && status != null) { - message = status.getMessage(); - } - if (message == null) message = ""; - startXMLElement("abort", new String[] { "type", "message" }, - new String[] { type, message }); - if (status != null) printStatus(status); - if (error != null) printStackTrace(error); - endXMLElement(); - } - - protected void printStatus(IStatus status) { - startXMLElement("status", new String[] { "severity", "code", "plugin", "message" }, - new String[] { - Integer.toString(status.getSeverity()), - Integer.toString(status.getCode()), - status.getPlugin(), status.getMessage() }); - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; ++i) { - printStatus(children[i]); - } - } - endXMLElement(); - } - - protected void printStackTrace(Throwable error) { - // XXX need a better way to serialize the stack trace - String trace = BaseTestRunner.getFilteredTrace(error); - StringTokenizer tok = new StringTokenizer(trace, "\r\n"); - if (! tok.hasMoreTokens()) return; // empty trace? - tok.nextToken(); // skip message line - startXMLElement("trace", null, null); - while (tok.hasMoreTokens()) { - String frame = tok.nextToken(); - printXMLElementData(frame); - } - endXMLElement(); - } - - protected void println(String line) { - if (logStream != null) logStream.println(indent + line); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java deleted file mode 100644 index 2148316f8..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/LoggingTestRunner.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import junit.framework.Test; -import junit.framework.TestResult; -import junit.textui.TestRunner; - -public class LoggingTestRunner extends TestRunner { - protected LoggingTestResult logResult; - - protected TestResult createTestResult() { - TestResult result = logResult; - logResult = null; - if (result == null) result = new LoggingTestResult(null); - return result; - } - - /** - * Runs a logging test suite. - * @param suite the test suite - * @param logResult the result object to use, or null to create a new one - * @param wait if true, pauses between test runs - */ - public void doRun(Test suite, LoggingTestResult logResult, boolean wait) { - this.logResult = logResult; - super.doRun(suite, wait); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java deleted file mode 100644 index 1a12e6508..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PerformanceTimer.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -public class PerformanceTimer { - private long startTime; - private int totalMillis; - private String name; - - /** - * Creates a timer, initially not running. - */ - public PerformanceTimer(String name) { - this.totalMillis = 0; - this.name = name; - } - - /** - * Starts the timer. Timer must not be running. - */ - public void start() { - startTime = System.currentTimeMillis(); - } - - /** - * Stops the timer. Timer must be running. - */ - public void stop() { - totalMillis += System.currentTimeMillis() - startTime; - startTime = 0; - } - - /** - * Returns the total number of milliseconds elapsed over all measured intervals. - */ - public int getTotalMillis() { - return totalMillis; - } - - /** - * Returns the name of this timer. - */ - public String getName() { - return name; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java deleted file mode 100644 index e8e5c71e1..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SequenceGenerator.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.util.Random; - -/** - * Encapsulates algorithms and state for generating deterministic sequences. - * The sequence of numbers generated will always follow the same pattern, - * regardless of the time, place, or platform. - */ -public class SequenceGenerator { - private static long globalSeqNum = System.currentTimeMillis() * 1000; - private final Random random; - private int uniqueInt; - - /** - * Constructs a new sequence generator with a known seed. - */ - public SequenceGenerator() { - random = new Random(3141592653589793238L); // a known constant - uniqueInt = 1000000; - } - - /** - * Returns a globally unique long integer. - */ - public static long nextGloballyUniqueLong() { - return globalSeqNum++; - } - - /** - * Returns a unique 7-digit integer. - */ - public int nextUniqueInt() { - return uniqueInt++; - } - - /** - * Returns a pseudo-random integer between 0 and n-1. - * @see Random#nextInt(int) - */ - public int nextInt(int n) { - return random.nextInt(n); - } - - /** - * Returns a pseudo-random real number following a gaussian distribution. - * @see Random#nextGaussian() - */ - public double nextGaussian() { - return random.nextGaussian(); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java deleted file mode 100644 index a5a85defc..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Util.java +++ /dev/null @@ -1,789 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import junit.framework.Assert; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.team.internal.ccvs.core.CVSStatus; -import org.eclipse.ui.internal.dialogs.InternalErrorDialog; -import org.eclipse.ui.wizards.datatransfer.ImportOperation; -import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; - -/** - * Provides helpers for: - *
        - *
      • Resource manipulation
      • - *
      • Diff trees
      • - *
      • UI automation
      • - *
      • Parallel development simulation
      • - *
      - * - * Note: This class is referenced from the VCM 1.0 performance tests. - */ public class Util { - /*** RESOURCE MANIPULATION SUPPORT ***/ - - /** - * Gets a handle for a project of a given name. - * @param name the project name - * @return the project handle - */ - public static IProject getProject(String name) throws CoreException { - return ResourcesPlugin.getWorkspace().getRoot().getProject(name); - } - - /** - * Creates a new project. - * @param name the project name - * @return the project handle - */ - public static IProject createProject(String name) throws CoreException { - IProject project = getProject(name); - if (!project.exists()) project.create(null); - if (!project.isOpen()) project.open(null); - return project; - } - - /** - * Deletes a project. - * @param project the project - */ - public static void deleteProject(IProject project) throws CoreException { - project.delete(false /*force*/, null); - } - - /** - * Deletes a file and prunes empty containing folders. - * @param file the file to delete - */ - public static void deleteFileAndPrune(IFile file) throws CoreException { - file.delete(false /*force*/, null); - IContainer container = file.getParent(); - while (container != null && container instanceof IFolder && - isFolderEmpty((IFolder) container)) { - deleteFolder((IFolder) container); - container = container.getParent(); - } - } - - /** - * Deletes a folder. - */ - public static void deleteFolder(IFolder folder) throws CoreException { - try { - folder.delete(false /*force*/, null); - } catch (CoreException e) { - IStatus status = e.getStatus(); - // ignore errors caused by attempting to delete folders that CVS needs to have around - if (findStatusByCode(status, CVSStatus.FOLDER_NEEDED_FOR_FILE_DELETIONS) == null) { - throw e; - } - } - } - - /** - * Finds an IStatus instance in a multi-status by status code. - */ - public static IStatus findStatusByCode(IStatus status, int code) { - if (status.getCode() == code) return status; - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - IStatus found = findStatusByCode(children[i], code); - if (found != null) return found; - } - return null; - } - - /** - * Creates a uniquely named project. - * @param prefix a string prepended to the generated name - * @return the new project - */ - public static IProject createUniqueProject(String prefix) throws CoreException { - return createProject(makeUniqueName(null, prefix, null)); - } - - /** - * Creates a uniquely named file in the parent folder or project with random contents. - * @param gen the sequence generator - * @param parent the parent IFolder or IProject for the new file - * @param meanSize the mean size of file to create (in bytes) - * @param variance 69% of files with be within this amount of the mean - * @param probBinary the probability of a new file being binary as a percentage - * @return the new file - */ - public static IFile createUniqueFile(SequenceGenerator gen, IContainer parent, - int meanSize, int variance, int probBinary) throws IOException, CoreException { - int fileSize; - do { - fileSize = (int) Math.abs(gen.nextGaussian() * variance + meanSize); - } while (fileSize > meanSize + variance * 4); // avoid huge files - - ByteArrayOutputStream os = new ByteArrayOutputStream(); - String fileName; - if (gen.nextInt(100) < probBinary) { - fileName = makeUniqueName(gen, "file", "class"); // binary - writeRandomBytes(gen, os, fileSize); - } else { - fileName = makeUniqueName(gen, "file", "txt"); // text - writeRandomText(gen, os, fileSize); - } - IFile file = parent.getFile(new Path(fileName)); - file.create(new ByteArrayInputStream(os.toByteArray()), true, null); - os.close(); - return file; - } - - /** - * Creates a uniquely named folder in the parent folder. - * @param gen the sequence generator - * @param parent the parent IFolder or IProject for the new folder - * @return the new folder - */ - public static IFolder createUniqueFolder(SequenceGenerator gen, IContainer parent) throws CoreException { - IFolder folder = parent.getFolder(new Path(Util.makeUniqueName(gen, "folder", null))); - folder.create(false /*force*/, true /*local*/, null); - return folder; - } - - /** - * Renames a resource. - * The resource handle becomes invalid. - * @param resource the existing resource - * @param newName the new name for the resource - */ - public static void renameResource(IResource resource, String newName) throws CoreException { - switch (resource.getType()) { - case IResource.PROJECT: { - IProject project = (IProject) resource; - IProjectDescription desc = project.getDescription(); - desc.setName(newName); - project.move(desc, false /*force*/, true /*keepHistory*/, null); - } break; - case IResource.FOLDER: { - try { - resource.move(new Path(newName), false /*force*/, null); - } catch (CoreException e) { - IStatus status = e.getStatus(); - // ignore errors caused by attempting to delete folders that CVS needs to have around - if (findStatusByCode(status, CVSStatus.FOLDER_NEEDED_FOR_FILE_DELETIONS) == null) { - throw e; - } - } - } break; - default: - resource.move(new Path(newName), false /*force*/, null); - break; - } - } - - /** - * Modified a resource. - * @param gen the sequence generator - * @param file the file to modify - */ - public static void modifyFile(SequenceGenerator gen, IFile file) - throws IOException, CoreException { - ByteArrayOutputStream os = new ByteArrayOutputStream(); - try { - InputStream is = file.getContents(true); - try { - byte[] buffer = new byte[8192]; - int rsize; - boolean changed = false; - while ((rsize = is.read(buffer)) != -1) { - double gaussian; - do { - gaussian = gen.nextGaussian() * 0.5; // large changes are less likely than small ones - } while (gaussian > 1.0 || gaussian < -1.0); - int changeSize = (int) (gaussian * rsize); - changed = changed || changeSize != 0; - os.write(buffer, 0, changeSize < 0 ? - changeSize : rsize); // shrink file - writeRandomText(gen, os, changeSize); // enlarge file - } - if (! changed) os.write('!'); // make sure we actually did change the file - file.setContents(new ByteArrayInputStream(os.toByteArray()), false /*force*/, true /*keepHistory*/, null); - } finally { - is.close(); - } - } finally { - os.close(); - } - } - - /** - * Creates a unique name. - * Ensures that a deterministic sequence of names is generated for all files - * and folders within a project, though not across sessions. - * - * @param gen the generator, or null if this name is to be globally unique - * @param prefix a string prepended to the generated name - * @param extension the file extension not including the period, null if none - * @return the new name - */ - public static String makeUniqueName(SequenceGenerator gen, String prefix, String extension) - throws CoreException { - StringBuffer name = new StringBuffer(prefix); - name.append('-'); - if (gen == null) { - name.append(SequenceGenerator.nextGloballyUniqueLong()); - } else { - name.append(gen.nextUniqueInt()); - } - if (extension != null) { - name.append('.'); - name.append(extension); - } - return name.toString(); - } - - /** - * Imports a .zip file into a container's root folder. - * @param container the container - * @param file the path of the .zip file - */ - public static void importZip(IContainer container, File file) - throws IOException, ZipException, InterruptedException, InvocationTargetException { - ZipFile zipFile = new ZipFile(file); - ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile); - ImportOperation importOperation = new ImportOperation(container.getFullPath(), - provider.getRoot(), provider, null); - importOperation.setOverwriteResources(true); // don't ask - importOperation.run(new NullProgressMonitor()); - Assert.assertTrue(importOperation.getStatus().isOK()); - } - - /** - * Writes random text to an output stream. - * @param gen the sequence generator - */ - public static void writeRandomText(SequenceGenerator gen, OutputStream os, int count) throws IOException { - while (count-- > 0) { - int c = gen.nextInt(99); - os.write((c >= 95) ? '\n' : c + ' '); - } - } - - /** - * Writes random bytes to an output stream. - * @param gen the sequence generator - */ - public static void writeRandomBytes(SequenceGenerator gen, OutputStream os, int count) throws IOException { - while (count-- > 0) { - os.write(gen.nextInt(256)); - } - } - - /** - * Creates a random folder deeply below the root folder. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @return the new folder - */ - public static IFolder createRandomDeepFolder(SequenceGenerator gen, IContainer root) throws CoreException { - IContainer container = pickRandomDeepContainer(gen, root); - for (;;) { - IFolder folder = createUniqueFolder(gen, container); - container = folder; - // 12.5% chance of creating a nested folder - if (gen.nextInt(8) != 0) return folder; - } - } - - /** - * Creates several random files deeply below the root folder. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @param count the number of files to create - * @param meanSize the mean size of file to create (in bytes) - * @param probBinary the probability of a new file being binary as a percentage - */ - public static void createRandomDeepFiles(SequenceGenerator gen, IContainer root, int count, - int meanSize, int variance, int probBinary) throws IOException, CoreException { - while (count-- > 0) { - createUniqueFile(gen, pickRandomDeepContainer(gen, root), meanSize, variance, probBinary); - } - } - - /** - * Deletes several random files deeply below the root folder. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @param count the number of files to delete - */ - public static void deleteRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) throws CoreException { - while (count-- > 0) { - IFile file = pickRandomDeepFile(gen, root); - if (file == null) break; - deleteFileAndPrune(file); - } - } - - /** - * Modifies several random files deeply below the root folder. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @param count the number of files to modify - */ - public static void modifyRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) - throws IOException, CoreException { - // perhaps we can add a parameter for the "magnitude" of the change - while (count-- > 0) { - IFile file = pickRandomDeepFile(gen, root); - if (file == null) break; - modifyFile(gen, file); - } - } - - /** - * Touches several random files deeply below the root folder. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @param count the number of files to touch - */ - public static void touchRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) throws CoreException { - while (count-- > 0) { - IFile file = pickRandomDeepFile(gen, root); - if (file == null) break; - file.touch(null); - } - } - - /** - * Renames several random files deeply below the root folder. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @param count the number of files to touch - */ - public static void renameRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) throws CoreException { - IProject project = root.getProject(); - while (count-- > 0) { - IFile file = pickRandomDeepFile(gen, root); - if (file == null) break; - renameResource(file, makeUniqueName(gen, "file", file.getFileExtension())); - } - } - - /** - * Picks a random file from the parent folder or project. - * @param gen the sequence generator - * @param parent the parent IFolder or IProject for the operation - * @return the file that was chosen, or null if no suitable files - */ - public static IFile pickRandomFile(SequenceGenerator gen, IContainer parent) throws CoreException { - IResource[] members = filterResources(parent.members()); - for (int size = members.length; size != 0; --size) { - int elem = gen.nextInt(size); - if (members[elem] instanceof IFile) return (IFile) members[elem]; - System.arraycopy(members, elem + 1, members, elem, size - elem - 1); - } - return null; - } - - /** - * Picks a random folder from the parent folder or project. - * @param gen the sequence generator - * @param parent the parent IFolder or IProject for the operation - * @return the folder, or null if no suitable folders - */ - public static IFolder pickRandomFolder(SequenceGenerator gen, IContainer parent) throws CoreException { - IResource[] members = filterResources(parent.members()); - for (int size = members.length; size != 0; --size) { - int elem = gen.nextInt(size); - if (members[elem] instanceof IFolder) return (IFolder) members[elem]; - System.arraycopy(members, elem + 1, members, elem, size - elem - 1); - } - return null; - } - - /** - * Picks a random file deeply from the root folder or project. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @return the file that was chosen, or null if no suitable files - */ - public static IFile pickRandomDeepFile(SequenceGenerator gen, IContainer root) throws CoreException { - IResource[] members = filterResources(root.members()); - for (int size = members.length; size != 0; --size) { - int elem = gen.nextInt(size); - IResource resource = members[elem]; - if (resource instanceof IFile) return (IFile) resource; - if (resource instanceof IFolder) { - IFile file = pickRandomDeepFile(gen, (IFolder) resource); - if (file != null) return file; - } - System.arraycopy(members, elem + 1, members, elem, size - elem - 1); - } - return null; - } - - /** - * Picks a random folder deeply from the root folder or project. - * May pick the project's root container. - * @param gen the sequence generator - * @param root the root IFolder or IProject for the operation - * @return the container that was chosen, never null - */ - public static IContainer pickRandomDeepContainer(SequenceGenerator gen, IContainer root) throws CoreException { - if (gen.nextInt(6) == 0) { - IResource[] members = filterResources(root.members()); - for (int size = members.length; size != 0; --size) { - int elem = gen.nextInt(size); - IResource resource = members[elem]; - if (resource instanceof IFolder) { - return pickRandomDeepContainer(gen, (IFolder) resource); - } - System.arraycopy(members, elem + 1, members, elem, size - elem - 1); - } - } - Assert.assertTrue(isValidContainer(root)); - return root; - } - - /** - * Returns true if the folder does not contain any real files. - */ - public static boolean isFolderEmpty(IFolder folder) throws CoreException { - IResource[] members = folder.members(); - for (int i = 0; i < members.length; ++i) { - if (isValidFile(members[i]) || isValidFolder(members[i])) return false; - } - return true; - } - - /** - * Returns true iff file is a valid IFile (that should not be ignored). - */ - public static boolean isValidFile(IResource file) throws CoreException { - String name = file.getName(); - return file instanceof IFile - && ! file.isPhantom() - && ! name.equals(".classpath") - && ! name.equals(".project") - && ! name.equals(".vcm_meta"); - } - - /** - * Returns true iff folder is a valid IFolder (that should not be ignored). - */ - public static boolean isValidFolder(IResource folder) throws CoreException { - String name = folder.getName(); - return folder instanceof IFolder - && ! folder.isPhantom() - && ! name.equals("CVS") - && ! name.equals("bin"); - } - - /** - * Returns true iff container is a valid IFolder or IProject (that should not be ignored). - */ - public static boolean isValidContainer(IResource container) throws CoreException { - return container instanceof IProject || isValidFolder(container); - } - - /** - * Returns true iff resource is a valid IFile, IFolder or IProject (that should not be ignored). - */ - public static boolean isValidResource(IResource resource) throws CoreException { - return isValidFile(resource) || isValidContainer(resource); - } - - /** - * Filters and sorts an array of resources to ensure deterministic behaviour across - * sessions. The general idea is to guarantee that given a known sequence of - * pseudo-random numbers, we will always pick the same sequence of files and - * folders each time we repeat the test. - */ - public static IResource[] filterResources(IResource[] resources) throws CoreException { - List list = new ArrayList(resources.length); - for (int i = 0; i < resources.length; ++i) { - if (isValidResource(resources[i])) list.add(resources[i]); - } - if (list.size() != resources.length) { - resources = (IResource[]) list.toArray(new IResource[list.size()]); - } - Arrays.sort(resources, new Comparator() { - public int compare(Object a, Object b) { - return ((IResource) a).getName().compareTo(((IResource) b).getName()); - } - }); - return resources; - } - - /*** DIFF SUPPORT ***/ - - public static boolean isEmpty(IDiffContainer node) { - if (node == null) return true; - if (node.getKind() != 0) return false; - IDiffElement[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; - } - return true; - } - public static boolean isEmpty(IDiffElement element) { - if (element == null) return true; - if (element.getKind() != 0) return false; - if (element instanceof IDiffContainer) { - IDiffElement[] children = ((DiffNode)element).getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; - } - } - return true; - } - - /*** UI SUPPORT ***/ - - /** - * Opens the specified wizard, then notifies the waiter. - * The WizardDialog instance is passed as argument to notify() in the waiter. - */ - public static void waitForWizardToOpen(Shell parent, IWizard wizard, final Waiter waiter) { - WizardDialog dialog = new WizardDialog(parent, wizard) { - public int open() { - // create the window's controls - create(); - // hook into the event loop so we get called back when the wizard is up and running - final Display display = getContents().getDisplay(); - final WizardDialog dialog = this; - display.asyncExec(new Runnable() { - public void run() { - while (display.readAndDispatch()); // process any other pending messages first - waiter.notify(dialog); - } - }); - // call open (does not create the window's controls a second time) - return super.open(); - } - }; - dialog.open(); - } - - /** - * Notifies the waiter when a Shell matching the specified criteria opens. - * The Shell instance is passed as argument to notify() in the waiter. - * - * @param display the root display - * @param pollingPeriod the number of milliseconds to wait between polls - * @param value a value used for matching - * @param criteria a strategy for matching the controls with a value, - * or null to match any Shell. - * @param waiter the waiter to be notified - */ - public static void waitForShellToOpen(final Display display, final int pollingPeriod, - final Object value, final ICriteria criteria, final Waiter waiter) { - final Runnable hook = new Runnable() { - public void run() { - if (display.isDisposed()) return; - Shell[] shells = display.getShells(); - for (int i = 0; i < shells.length; ++i) { - Shell shell = shells[i]; - if (criteria != null && ! criteria.test(shell, value)) continue; - if (! waiter.notify(shell)) return; - } - // poll again as soon as possible - if (waiter.keepWaiting()) { - display.timerExec(pollingPeriod, this); - } - } - }; - hook.run(); - } - - - /** - * Installs a watchdog for JFace error dialogs for the current display. - * The Dialog instance is passed as argument to notify() in the waiter. - * Recognized dialogs: - * - ErrorDialog - * - InternalErrorDialog - * - * @param display the root display - * @param pollingPeriod the number of milliseconds to wait between polls - * @param waiter the waiter to be notified - */ - public static void waitForErrorDialog(Display display, int pollingPeriod, final Waiter waiter) { - ICriteria criteria = new ICriteria() { - public boolean test(Object candidate, Object value) { - Shell shell = (Shell) candidate; - if (shell.isDisposed()) return false; - Object data = shell.getData(); - if (data == null) return false; - return data instanceof ErrorDialog || data instanceof InternalErrorDialog; - } - }; - waitForShellToOpen(display, pollingPeriod, null, criteria, new Waiter() { - public boolean keepWaiting() { - return waiter.keepWaiting(); - } - - public boolean notify(Object object) { - return waiter.notify(((Shell) object).getData()); - } - }); - } - - /** - * Finds a Control in a Composite hierarchy matching the specified criteria. - * - * @param root the root of the hierarchy to search - * @param clazz the Class representing the precise type of Control to find - * @param value a value used for matching - * @param criteria a strategy for matching the controls with a value, - * or null to match anything of the right class. - * @return the first matching Control, or null if none found. - */ - public static Control findControl(Composite root, Class clazz, Object value, ICriteria criteria) { - if (clazz.isAssignableFrom(root.getClass())) { - if (criteria == null || criteria.test(root, value)) return root; - } - Control[] children = root.getChildren(); - for (int i = 0; i < children.length; ++i) { - final Control candidate = children[i]; - if (candidate instanceof Composite) { - Control c = findControl((Composite) candidate, clazz, value, criteria); - if (c != null) return c; - } else { - if (clazz.isAssignableFrom(candidate.getClass())) { - if (criteria == null || criteria.test(candidate, value)) return candidate; - } - } - } - return null; - } - - /** - * Finds a Control in a Composite hierarchy with the specified text string. - * Note: clazz must specify a Control subclass that defines getText() - * - * @param root the root of the hierarchy to search - * @param clazz the Class representing the precise type of Control to find - * @param text the text string to find - * @return the first matching Control, or null if none found. - */ - public static Control findControlWithText(Composite root, Class clazz, String text) { - return findControl(root, clazz, text, new ICriteria() { - public boolean test(Object control, Object value) { - // getText is only defined on certain subclasses of Composite - // so we must use reflection to find the method - try { - Method m = control.getClass().getMethod("getText", new Class[0]); - String text = (String) m.invoke(control, new Object[0]); - return value.equals(stripMnemonicEscapes(text)); - } catch (Exception e) { - e.printStackTrace(); - Assert.fail("Could not invoke method getText()"); - } - return false; - } - }); - } - - /** - * Posts a fake event to the queue. - * Fills in the event type and widget fields. - * @param event the Event - */ - public static void postEvent(final Widget widget, final int eventType, final Event event) { - Display display = widget.getDisplay(); - event.type = eventType; - event.widget = widget; - display.asyncExec(new Runnable() { - public void run() { - widget.notifyListeners(eventType, event); - } - }); - } - - /** - * Strips mnemonic escapes from a text label. - */ - public static String stripMnemonicEscapes(String label) { - StringBuffer buf = new StringBuffer(); - int length = label.length(); - for (int i = 0; i < length; ++i) { - char c = label.charAt(i); - if (c == '&') { - i += 1; - if (i < length) c = label.charAt(i); - } - buf.append(c); - } - return buf.toString(); - } - - /** - * Process pending events for the current display, until at least the - * specified number of milliseconds elapses. - */ - public static void processEventsUntil(int hiatus) { - Display display = Display.getCurrent(); - Assert.assertNotNull(display); - final boolean done[] = new boolean[] { hiatus == 0 }; - if (hiatus != 0) display.timerExec(hiatus, new Runnable() { - public void run() { done[0] = true; } - }); - for (;;) { - while (display.readAndDispatch()); - if (done[0]) return; - display.sleep(); - } - } - - /** - * Process pending events for the current display, until resumed by the user. - * Very useful for inspecting intermediate results while debugging. - */ - public static void processEventsUntilResumed(String title) { - Display display = Display.getCurrent(); - Assert.assertNotNull(display); - Shell shell = new Shell(display, SWT.CLOSE); - shell.setText("Close me to resume: " + title); - shell.setBounds(0, 0, 500, 30); - shell.open(); - while (! shell.isDisposed()) { - while (! display.readAndDispatch()) display.sleep(); - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java deleted file mode 100644 index c6cd88e12..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/Waiter.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - - -/** - * Abstract listener used for the generic problem of waiting for - * something to happen and retrieving some related information. - * e.g. Waiting for a window with a given title to open and getting its handle. - */ -public abstract class Waiter { - /** - * Called when the desired event has occurred. - * @param object an object related to the event, type depends on the context - * @return true to keep waiting, otherwise false - */ - public abstract boolean notify(Object object); - - /** - * Called after each unsuccessful poll for the event. - * @return true to keep waiting, otherwise false - */ - public boolean keepWaiting() { - return true; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java deleted file mode 100644 index 6a3fcb522..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/AllTests.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.benchmark; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTests extends TestSuite { - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTestSuite(SyncTests.class); - suite.addTestSuite(WorkflowTests.class); - //suite.addTestSuite(CommandTests.class); - return new BenchmarkTestSetup(suite); - } - - public AllTests(String name) { - super(name); - } - public AllTests() { - super(); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java deleted file mode 100644 index 6b1c46260..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.benchmark; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -import junit.framework.Test; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.team.tests.ccvs.core.CVSTestSetup; - -public class BenchmarkTestSetup extends CVSTestSetup { - public static final File BIG_ZIP_FILE; - public static final File SMALL_ZIP_FILE; - public static final File TINY_ZIP_FILE; - - // Static initializer for constants - static { - try { - BIG_ZIP_FILE = getTestFile("benchmarkBig.zip"); - SMALL_ZIP_FILE = getTestFile("benchmarkSmall.zip"); - TINY_ZIP_FILE = getTestFile("benchmarkTiny.zip"); - } catch (IOException e) { - throw new Error(e.getMessage()); - } - } - - public static File getTestFile(String name) throws IOException { - IPluginRegistry registry = Platform.getPluginRegistry(); - IPluginDescriptor descriptor = registry.getPluginDescriptor("org.eclipse.team.tests.cvs.core"); - URL baseURL = descriptor.getInstallURL(); - URL url = new URL(baseURL, "resources/BenchmarkTest/" + name); - url = Platform.asLocalURL(url); - if (url.getProtocol().equals("file")) { - return new File(url.getFile()).getAbsoluteFile(); - } - throw new IOException("Cannot find test file: " + name); - } - - public BenchmarkTestSetup(Test test) { - super(test); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java deleted file mode 100644 index cf734b26e..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/CommandTests.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.benchmark; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSTag; -import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption; -import org.eclipse.team.tests.ccvs.core.CommandLineCVSClient; -import org.eclipse.team.tests.ccvs.core.EclipseCVSClient; -import org.eclipse.team.tests.ccvs.core.ICVSClient; -import org.eclipse.team.tests.ccvs.ui.CVSUITestCase; -import org.eclipse.team.tests.ccvs.ui.Util; - -public class CommandTests extends CVSUITestCase { - private String baseName; - private IProject referenceProject; - private IProject eclipseProject; - private IProject uiProject; - - public CommandTests(String name) { - super(name); - } - public CommandTests() { - super(""); - } - public static Test suite() { - return new BenchmarkTestSetup(new TestSuite(CommandTests.class)); - } - - public void setUp() throws Exception { - super.setUp(); - baseName = Util.makeUniqueName(null, getName(), null); - referenceProject = Util.createProject(baseName + "-reference"); - eclipseProject = Util.createProject(baseName + "-eclipse"); - uiProject = Util.createProject(baseName); - } - - public void testImportAddCommitCheckout() throws Throwable { - // import a project using each client - new ComparativeTest("import/add/commit big project") { - protected void runCommandTest(final IContainer localRoot, ICVSClient client) throws Exception { - // use the import command to create a new module - IFolder folder = localRoot.getFolder(new Path("empty_folder")); - folder.create(false /*force*/, true /*local*/, null); - execute(client, "import empty module", folder, "import", - new String[] { }, - new String[] { "-m", "initial import" }, - new String[] { localRoot.getName(), "vendor", "start" }); - folder.delete(false /*force*/, null); - - // checkout the project - localRoot.delete(false /*force*/, null); - execute(client, "checkout module", localRoot.getParent(), "co", - new String[] { }, - new String[] { }, - new String[] { localRoot.getName() }); - - // prepare contents - prepareContents(localRoot); - - // determine the set of files and folders to be added - final Map /* from KSubstOption to String */ files = new HashMap(); - final Set /* of String */ folders = new TreeSet(); - final int trim = localRoot.getProjectRelativePath().segmentCount(); - localRoot.accept(new IResourceVisitor() { - public boolean visit(IResource resource) throws CoreException { - if (! resource.equals(localRoot)) { - String name = resource.getProjectRelativePath().removeFirstSegments(trim).toString(); - if (resource.getType() == IResource.FILE) { - KSubstOption ksubst = KSubstOption.fromFile((IFile) resource); - Set set = (Set) files.get(ksubst); - if (set == null) { - set = new HashSet(); - files.put(ksubst, set); - } - set.add(name); - } else { - folders.add(name); - } - } - return true; - } - }, IResource.DEPTH_INFINITE, false); - - // add all folders - if (!folders.isEmpty()) { - executeInParts(client, "add folders", localRoot, "add", - new String[] { }, - new String[] { }, - (String[])folders.toArray(new String[folders.size()])); - } - // add all files - for (Iterator it = files.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); - KSubstOption ksubst = (KSubstOption) entry.getKey(); - Set set = (Set) entry.getValue(); - executeInParts(client, "add files (" + ksubst.getShortDisplayText() + ")", localRoot, "add", - new String[] { }, - new String[] { ksubst.toString() }, - (String[])set.toArray(new String[set.size()])); - } - - // commit everything - execute(client, "commit module", localRoot, "ci", - new String[] { }, - new String[] { "-m", "dummy message" }, - new String[] { }); - } - protected void runUITest(IContainer localRoot) throws Exception { - prepareContents(localRoot); - actionShareProject(uiProject); - syncCommitResources(new IResource[] { uiProject }, null, "initial"); - } - private void prepareContents(IContainer localRoot) throws Exception { - Util.importZip(localRoot, BenchmarkTestSetup.BIG_ZIP_FILE); - } - }.run(); - - // check it out using each client - new ComparativeTest("checkout big project") { - protected void runCommandTest(IContainer localRoot, ICVSClient client) throws Exception { - execute(client, "checkout module", localRoot.getParent(), "co", - new String[] { }, - new String[] { "-P" }, - new String[] { localRoot.getName() }); - } - protected void runUITest(IContainer localRoot) throws Exception { - actionCheckoutProjects(new String[] { localRoot.getName() }, new CVSTag[] { CVSTag.DEFAULT }); - } - protected void setUp(IContainer localRoot) throws Exception { - // delete then recreate the container - IProject project = (IProject) localRoot; - Util.deleteProject(project); - project.create(null); - project.open(null); - // delete the .project file (avoid .project is in the way error) - IFile file = project.getFile(".project"); - file.delete(false /*force*/, null); - } - }.run(); - } - - protected abstract class ComparativeTest { - private String name; - public ComparativeTest(String name) { - this.name = name; - } - public void run() throws Exception { - startGroup(name); - - startGroup("command line client"); - setUp(referenceProject); - runCommandTest(referenceProject, CommandLineCVSClient.INSTANCE); - tearDown(referenceProject); - endGroup(); - - startGroup("eclipse client"); - setUp(eclipseProject); - runCommandTest(eclipseProject, EclipseCVSClient.INSTANCE); - tearDown(eclipseProject); - endGroup(); - - startGroup("user interface"); - setUp(uiProject); - runUITest(uiProject); - tearDown(uiProject); - endGroup(); - - endGroup(); - } - protected abstract void runCommandTest(IContainer localRoot, ICVSClient client) throws Exception ; - protected abstract void runUITest(IContainer localRoot) throws Exception; - protected void setUp(IContainer localRoot) throws Exception { - } - protected void tearDown(IContainer localRoot) throws Exception { - } - protected void execute(ICVSClient client, String taskname, - IContainer localRoot, String command, - String[] globalOptions, String[] localOptions, String[] arguments) throws CVSException { - // The execution time for the client will include overhead associated with - // computing the command to be run and cleaning up Eclipse state once it has - // completed, including notifying resource delta listener. Since all clients - // in the Eclipse environment are subject to this overhead, the theory is that - // it will be a constant factor that we can neglect. - startTask(taskname); - client.executeCommand(testRepository, localRoot, command, globalOptions, localOptions, arguments); - endTask(); - } - protected void executeInParts(ICVSClient client, String taskname, - IContainer localRoot, String command, - String[] globalOptions, String[] localOptions, String[] arguments) throws CVSException { - // There are problems executing commands with too many arguments - // so we have to break them up into chunks. - startTask(taskname); - int i = 0; - do { - int len = Math.min(200, arguments.length - i); - String[] args; - if (i == 0 && len == arguments.length) { - args = arguments; - } else { - args = new String[len]; - System.arraycopy(arguments, i, args, 0, len); - } - client.executeCommand(testRepository, localRoot, command, globalOptions, localOptions, args); - i += len; - } while (arguments.length - i > 0); - endTask(); - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java deleted file mode 100644 index 04d56f804..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.benchmark; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.team.internal.ccvs.core.CVSTag; -import org.eclipse.team.tests.ccvs.ui.CVSUITestCase; -import org.eclipse.team.tests.ccvs.ui.SequenceGenerator; -import org.eclipse.team.tests.ccvs.ui.Util; - -public class SyncTests extends CVSUITestCase { - private static final int FILE_SIZE_MEAN = 16384; - private static final int FILE_SIZE_VARIANCE = 0; - private static final int PROB_BINARY = 0; - - public SyncTests(String name) { - super(name); - } - public SyncTests() { - super(""); - } - - public static Test suite() { - return new BenchmarkTestSetup(new TestSuite(SyncTests.class)); - } - - public void testSync0() throws Exception { - // test sync on project with no changes - IProject project = setupOutProject(); - startGroup("test sync with no changes"); - syncCommitResources(new IResource[] { project }, null, ""); - endGroup(); - } - - public void testSync1() throws Exception { - runTestSync(1); - } - - public void testSync10() throws Exception { - runTestSync(10); - } - - public void testSync100() throws Exception { - runTestSync(100); - } - - protected IProject setupOutProject() throws Exception { - IProject project = createAndImportProject("testSync", BenchmarkTestSetup.SMALL_ZIP_FILE); - disableLog(); - actionShareProject(project); - syncCommitResources(new IResource[] { project }, null, "initial"); - enableLog(); - return project; - } - - /** - * Runs a sequence of operations for the synchronizer tests. - * A parallel project is used to generate incoming changes. - */ - protected void runTestSync(int size) throws Exception { - final SequenceGenerator gen = new SequenceGenerator(); - - // setup out project then move it out of the way - IProject outProject = setupOutProject(); - String moduleName = outProject.getName(); - Util.renameResource(outProject, moduleName + "out"); - outProject = Util.getProject(moduleName + "out"); - - // setup in project - disableLog(); - actionCheckoutProjects(new String[] { moduleName }, new CVSTag[] { new CVSTag() }); - enableLog(); - IProject inProject = Util.getProject(moduleName); - - /*** outgoing and incoming changes ***/ - startGroup("synchronize " + size + " added file(s)"); - Util.createRandomDeepFiles(gen, outProject, size, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); - startGroup("as outgoing changes"); - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - startGroup("as incoming changes"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - endGroup(); - - startGroup("synchronize " + size + " modified file(s)"); - Util.modifyRandomDeepFiles(gen, outProject, size); - startGroup("as outgoing changes"); - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - startGroup("as incoming changes"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - endGroup(); - - startGroup("synchronize " + size + " removed file(s)"); - Util.deleteRandomDeepFiles(gen, outProject, size); - startGroup("as outgoing changes"); - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - startGroup("as incoming changes"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - endGroup(); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java deleted file mode 100644 index 1964f7d40..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/WorkflowTests.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.benchmark; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.io.File; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.team.internal.ccvs.core.CVSTag; -import org.eclipse.team.tests.ccvs.ui.CVSUITestCase; -import org.eclipse.team.tests.ccvs.ui.SequenceGenerator; -import org.eclipse.team.tests.ccvs.ui.Util; - -public class WorkflowTests extends CVSUITestCase { - private int FILE_SIZE_MEAN = 16384; - private int FILE_SIZE_VARIANCE = 12288; - private int PROB_BINARY = 5; - public WorkflowTests(String name) { - super(name); - } - public WorkflowTests() { - super(""); - } - - public static Test suite() { - return new BenchmarkTestSetup(new TestSuite(WorkflowTests.class)); - //return new BenchmarkTestSetup(new WorkflowTests("testTinyWorkflow")); - } - - public void testBigWorkflow() throws Exception { - runWorkflowTests("testBig", BenchmarkTestSetup.BIG_ZIP_FILE); - } - - public void testSmallWorkflow() throws Exception { - runWorkflowTests("testSmall", BenchmarkTestSetup.SMALL_ZIP_FILE); - } - - public void testTinyWorkflow() throws Exception { - runWorkflowTests("testTiny", BenchmarkTestSetup.TINY_ZIP_FILE); - } - - /** - * Runs a series of incoming and outgoing workflow-related tests. - */ - protected void runWorkflowTests(String name, File initialContents) throws Exception { - final SequenceGenerator gen = new SequenceGenerator(); - IProject outProject = createAndImportProject(name, initialContents); - - // test project sharing - startGroup("test project sharing"); - actionShareProject(outProject); - endGroup(); - - // test initial project commit - startGroup("test initial project commit"); - syncCommitResources(new IResource[] { outProject }, null, "initial"); - endGroup(); - - // move the project out of the way - String moduleName = outProject.getName(); - Util.renameResource(outProject, moduleName + "out"); - outProject = Util.getProject(moduleName + "out"); - - // test initial project checkout - startGroup("test initial project checkout"); - actionCheckoutProjects(new String[] { moduleName }, new CVSTag[] { new CVSTag() }); - endGroup(); - IProject inProject = Util.getProject(moduleName); - - // test scenarios - startGroup("test incoming and outgoing change scenarios"); - startGroup("adding a new component - localized additions and some changes"); - Util.modifyRandomDeepFiles(gen, outProject, 5); - Util.touchRandomDeepFiles(gen, outProject, 2); - IFolder componentRoot = Util.createRandomDeepFolder(gen, outProject); - Util.createRandomDeepFiles(gen, componentRoot, 12, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - - startGroup("catching up to a new component - localized additions and some changes"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - - startGroup("fixing a bug - localized changes"); - Util.modifyRandomDeepFiles(gen, componentRoot, 2); - Util.touchRandomDeepFiles(gen, componentRoot, 2); - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - - startGroup("catching up to a bug fix - localized changes"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - - startGroup("moving a package - scattered changes, files moved"); - Util.modifyRandomDeepFiles(gen, outProject, 5); // a few scattered changes - Util.modifyRandomDeepFiles(gen, componentRoot, 12); // changes to "package" stmt - Util.renameResource(componentRoot, Util.makeUniqueName(gen, "folder", null)); - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - - startGroup("catching up to a moved package - scattered changes, files moved"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - - startGroup("big refactoring - scattered changes, files renamed and balanced additions/deletions"); - Util.deleteRandomDeepFiles(gen, outProject, 4); // some stuff deleted - Util.modifyRandomDeepFiles(gen, outProject, 20); // many scattered changes - Util.renameRandomDeepFiles(gen, outProject, 5); // renamed some stuff - Util.createRandomDeepFiles(gen, outProject, 4, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); // some new stuff added - syncCommitResources(new IResource[] { outProject }, null, ""); - endGroup(); - - startGroup("catching up to a big refactoring - scattered changes, files renamed and balanced additions/deletions"); - syncUpdateResources(new IResource[] { inProject }, null); - endGroup(); - endGroup(); - - // test tagging a project - startGroup("tag project"); - actionCVSTag(new IResource[] { outProject }, "v101"); - endGroup(); - - // replace with remote contents - startGroup("test replace with remote contents scenarios"); - startGroup("no local dirty files, no remote changes"); - actionReplaceWithRemote(new IResource[] { inProject }); - endGroup(); - - startGroup("abandoning some local work, no remote changes"); - Util.deleteRandomDeepFiles(gen, inProject, 4); // some stuff locally deleted - Util.modifyRandomDeepFiles(gen, inProject, 6); // a few unimportant changes to forget - Util.createRandomDeepFiles(gen, inProject, 4, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); // some new work to abandon - actionReplaceWithRemote(new IResource[] { inProject }); - endGroup(); - - startGroup("no local dirty files, many remote changes"); - // e.g. returning from a long vacation - Util.deleteRandomDeepFiles(gen, outProject, 10); // some components obsoleted - Util.modifyRandomDeepFiles(gen, outProject, 42); // many changes - Util.renameRandomDeepFiles(gen, outProject, 8); // evidence of some refactoring - Util.createRandomDeepFiles(gen, outProject, 10, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); // a few new components added - disableLog(); - syncCommitResources(new IResource[] { outProject }, null, ""); - enableLog(); - actionReplaceWithRemote(new IResource[] { inProject }); - endGroup(); - endGroup(); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java deleted file mode 100644 index ee9359101..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ArgumentParser.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -public class ArgumentParser { - protected ArgumentParser() { - } - - public boolean parse(String[] args) { - int index = 0; - String option = null; - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg == null) continue; - if (arg.charAt(0) == '-') { - if (option != null && ! handleOption(option, null)) return false; - option = arg; - } else if (option != null) { - if (! handleOption(option, arg)) return false; - option = null; - } else { - if (! handleArgument(index++, arg)) return false; - } - } - if (option != null && ! handleOption(option, null)) return false; - return handleFinished(); - } - - protected boolean handleFinished() { - return true; - } - - protected boolean handleArgument(int index, String arg) { - return false; - } - - protected boolean handleOption(String option, String arg) { - return false; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java deleted file mode 100644 index 3ae0ba97e..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/CaseEntry.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.xml.sax.Attributes; - -public class CaseEntry extends LogEntryContainer { - private String className; - - public CaseEntry(LogEntryContainer parent, Attributes attributes) { - this(parent, attributes.getValue("name"), attributes.getValue("class")); - } - - public CaseEntry(LogEntryContainer parent, String name, String className) { - super(parent, name); - this.className = (className != null) ? className : "unknown"; - } - - public void accept(ILogEntryVisitor visitor) { - visitor.visitCaseEntry(this); - } - - /** - * Returns the class name of the test case. - */ - public String getClassName() { - return className; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java deleted file mode 100644 index 95be9e392..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/DelimitedValuesWriter.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.PrintStream; - -public class DelimitedValuesWriter { - private static final String BEGIN_QUOTE = "\""; - private static final String END_QUOTE = "\""; - private PrintStream ps; - private String delimiter; - private boolean quoted; - private boolean firstField; - - public DelimitedValuesWriter(PrintStream ps, String delimiter, boolean quoted) { - this.ps = ps; - this.delimiter = delimiter; - this.quoted = quoted; - this.firstField = true; - } - - public void printField(String field) { - if (firstField) { - firstField = false; - } else { - ps.print(delimiter); - } - if (quoted) ps.print(BEGIN_QUOTE); - ps.print(field); - if (quoted) ps.print(END_QUOTE); - } - public void printFields(String[] fields) { - for (int i = 0; i < fields.length; i++) { - printField(fields[i]); - } - } - public void printRecord(String[] fields) { - printFields(fields); - endRecord(); - } - public void endRecord() { - ps.println(); - firstField = true; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java deleted file mode 100644 index 20c15f3b5..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/GroupEntry.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.xml.sax.Attributes; - -public class GroupEntry extends LogEntryContainer { - public GroupEntry(LogEntryContainer parent, Attributes attributes) { - this(parent, attributes.getValue("name")); - } - - public GroupEntry(LogEntryContainer parent, String name) { - super(parent, name); - } - - public void accept(ILogEntryVisitor visitor) { - visitor.visitGroupEntry(this); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java deleted file mode 100644 index 884f86206..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/ILogEntryVisitor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -public interface ILogEntryVisitor { - public void visitRootEntry(RootEntry entry); - public void visitCaseEntry(CaseEntry entry); - public void visitGroupEntry(GroupEntry entry); - public void visitTaskEntry(TaskEntry entry); -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java deleted file mode 100644 index e3300a2d8..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntry.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; - -import junit.framework.Assert; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.helpers.XMLReaderFactory; - -public abstract class LogEntry { - LogEntryContainer parent; - String name; - - /** - * Creates a new log entry with the specified parent. - * @param parent the parent container - * @param name the name of the entry - */ - public LogEntry(LogEntryContainer parent, String name) { - this.parent = parent; - this.name = name != null ? name : "unknown"; - if (parent != null) parent.addEntry(this); - } - - /** - * Accepts a visitor. - * @param visitor the visitor - */ - public abstract void accept(ILogEntryVisitor visitor); - - /** - * Returns the name of this entry. - */ - public String getName() { - return name; - } - - /** - * Returns the parent container of this entry, or null if none. - */ - public LogEntryContainer getParent() { - return parent; - } - - /** - * Reads an array of log entries from a file. - * @return the log entries - */ - public static RootEntry readLog(File file) throws IOException, SAXException { - XMLReader reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); - LogContentHandler contentHandler = new LogContentHandler(); - reader.setContentHandler(contentHandler); - reader.parse(new InputSource(new FileInputStream(file))); - return contentHandler.getLogEntries(); - } - - private static class LogContentHandler extends DefaultHandler implements ContentHandler { - private RootEntry root = null; - private LogEntry current = null; - - public RootEntry getLogEntries() { - return root; - } - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - if ("log".equals(localName)) { - Assert.assertNull(current); - current = root = new RootEntry(null, attributes); - } else if ("case".equals(localName)) { - Assert.assertNotNull(current); - Assert.assertTrue(current instanceof RootEntry); - current = new CaseEntry((LogEntryContainer) current, attributes); - } else if ("group".equals(localName)) { - Assert.assertNotNull(current); - Assert.assertTrue(current instanceof CaseEntry || current instanceof GroupEntry); - current = new GroupEntry((LogEntryContainer) current, attributes); - } else if ("task".equals(localName)) { - Assert.assertNotNull(current); - Assert.assertTrue(current instanceof CaseEntry || current instanceof GroupEntry); - current = new TaskEntry((LogEntryContainer) current, attributes); - } else if ("result".equals(localName)) { - Assert.assertNotNull(current); - Assert.assertTrue(current instanceof TaskEntry); - ((TaskEntry) current).addResult(new Result(attributes)); - } else if ("abort".equals(localName)) { - // currently we ignore failure entries - // XXX need a good way to represent failures - } else if ("trace".equals(localName)) { - // currently we ignore stack frames associated with failure entries - } else if ("status".equals(localName)) { - // currently we ignore status associated with failure entries - } else { - throw new SAXException("Unrecognized element: " + localName); - } - } - public void endElement(String uri, String localName, String qName) - throws SAXException { - Assert.assertNotNull(current); - if ("result".equals(localName) || "abort".equals(localName) || - "trace".equals(localName) || "status".equals(localName)) { - // nothing to do - } else { - current = current.getParent(); - } - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java deleted file mode 100644 index 71c6eb471..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogEntryContainer.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public abstract class LogEntryContainer extends LogEntry { - private List /* of LogEntry */ list = new ArrayList(); - - public LogEntryContainer(LogEntryContainer parent, String name) { - super(parent, name); - } - - /** - * Accepts a visitor for each child in the order in which they are listed. - * @param visitor the visitor - */ - public void acceptChildren(ILogEntryVisitor visitor) { - Iterator it = list.iterator(); - while (it.hasNext()) { - LogEntry entry = (LogEntry) it.next(); - entry.accept(visitor); - } - } - - /** - * Returns the list of children in this container. - */ - public LogEntry[] members() { - return (LogEntry[]) list.toArray(new LogEntry[list.size()]); - } - - /** - * Returns the member with the specified name and class. - */ - public LogEntry findMember(String name, Class clazz) { - Iterator it = list.iterator(); - while (it.hasNext()) { - LogEntry entry = (LogEntry) it.next(); - if (name.equals(entry.getName()) && - clazz.isAssignableFrom(entry.getClass())) return entry; - } - return null; - } - - /* - * Adds the specified entry to the end of the list. - */ - void addEntry(LogEntry entry) { - list.add(entry); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java deleted file mode 100644 index 14e6b3a61..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/LogFormatterUIMain.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -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.Shell; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Text; - -/** - * Quick and dirty UI frontend for the log formatters. - */ -public class LogFormatterUIMain { - - public LogFormatterUIMain() { - } - - public static void main(String[] args) { - new LogFormatterUIMain().run(); - } - - public void run() { - Display display = new Display(); - Shell shell = new Shell(display); - - shell.setText("Log Formatter UI"); - createContents(shell); - - shell.setSize(500, 300); - shell.open(); - while (! shell.isDisposed()) { - if (! display.readAndDispatch()) display.sleep(); - } - shell.dispose(); - display.dispose(); - } - - protected void createContents(Composite parent) { - parent.setLayout(new FillLayout()); - TabFolder tabFolder = new TabFolder(parent, SWT.NONE); - createSummaryTabContents(new TabItem(tabFolder, SWT.NONE)); - createDiffTabContents(new TabItem(tabFolder, SWT.NONE)); - } - - protected void createSummaryTabContents(TabItem item) { - Composite top = new Composite(item.getParent(), SWT.NONE); - item.setControl(top); - item.setText("Create Log Summary"); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - top.setLayout(layout); - - final Text logFileText = createFileSelector(top, "Log file path: "); - final Text outputFileText = createFileSelector(top, "Output file path: "); - - final Button csvCheckButton = new Button(top, SWT.CHECK); - csvCheckButton.setText("Produce comma separated values data"); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); - data.horizontalSpan = 3; - csvCheckButton.setLayoutData(data); - - final Button rawCheckButton = new Button(top, SWT.CHECK); - rawCheckButton.setText("Do not merge results from successive iterations"); - data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); - data.horizontalSpan = 3; - rawCheckButton.setLayoutData(data); - - createRunButton(top, new Runnable() { - public void run() { - PrintSummaryMain.main(new String[] { - logFileText.getText(), - "-out", outputFileText.getText(), - csvCheckButton.getSelection() ? "-csv" : null, - rawCheckButton.getSelection() ? "-raw" : null }); - } - }); - } - - protected void createDiffTabContents(TabItem item) { - Composite top = new Composite(item.getParent(), SWT.NONE); - item.setControl(top); - item.setText("Create Log Diff"); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - top.setLayout(layout); - - final Text newerLogFileText = createFileSelector(top, "Newer log file path: "); - final Text olderLogFileText = createFileSelector(top, "Older log file path: "); - final Text outputFileText = createFileSelector(top, "Output file path: "); - - Label label = new Label(top, SWT.NONE); - label.setText("Threshold %"); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER)); - - final Text thresholdText = new Text(top, SWT.BORDER); - thresholdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); - thresholdText.setText("0"); - - new Label(top, SWT.NONE); - - final Button csvCheckButton = new Button(top, SWT.CHECK); - csvCheckButton.setText("Produce comma separated values data"); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); - data.horizontalSpan = 3; - csvCheckButton.setLayoutData(data); - - final Button ignoreCheckButton = new Button(top, SWT.CHECK); - ignoreCheckButton.setText("Ignore negligible changes in results"); - data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); - data.horizontalSpan = 3; - ignoreCheckButton.setLayoutData(data); - - createRunButton(top, new Runnable() { - public void run() { - PrintDiffMain.main(new String[] { - newerLogFileText.getText(), - olderLogFileText.getText(), - "-out", outputFileText.getText(), - "-t", thresholdText.getText(), - csvCheckButton.getSelection() ? "-csv" : null, - ignoreCheckButton.getSelection() ? "-i" : null }); - } - }); - } - - protected Text createFileSelector(Composite parent, String labelText) { - Label label = new Label(parent, SWT.NONE); - label.setText(labelText); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER)); - - final Text text = new Text(parent, SWT.BORDER); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); - - Button browseButton = new Button(parent, SWT.PUSH); - browseButton.setText("Browse..."); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog dialog = new FileDialog(text.getShell(), SWT.OPEN); - dialog.setFileName(text.getText()); - String name = dialog.open(); - if (name != null) { - text.setText(name); - } - } - }); - browseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); - return text; - } - - protected Button createRunButton(Composite parent, final Runnable runnable) { - Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_END | GridData.GRAB_VERTICAL); - data.horizontalSpan = 3; - separator.setLayoutData(data); - - final Button runButton = new Button(parent, SWT.PUSH); - runButton.setText("Run"); - data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL); - data.horizontalSpan = 3; - runButton.setLayoutData(data); - runButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - runButton.getDisplay().asyncExec(runnable); - } - }); - return runButton; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java deleted file mode 100644 index 302df0f99..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/MergeRunsVisitor.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -public class MergeRunsVisitor implements ILogEntryVisitor { - private RootEntry defaultRoot; - private RootEntry root; - private LogEntryContainer parent; - - /** - * Creates a new visitor to merge series of log entries. - * @param root the root of an existing log to merge into, or null - */ - public MergeRunsVisitor(RootEntry root) { - this.defaultRoot = root; - this.parent = null; - } - - /** - * Returns the root of the newly merged log, or null if none. - */ - public RootEntry getMergedRoot() { - return root; - } - - public void visitRootEntry(RootEntry entry) { - root = defaultRoot; - if (root == null) { - root = new RootEntry(null, entry.getName(), entry.getSDKBuildId(), entry.getTimestamp()); - } - parent = root; - entry.acceptChildren(this); - } - - public void visitCaseEntry(CaseEntry entry) { - LogEntryContainer oldParent = parent; - CaseEntry newEntry = (CaseEntry) parent.findMember(entry.getName(), CaseEntry.class); - if (newEntry == null) { - newEntry = new CaseEntry(parent, entry.getName(), entry.getClassName()); - } - parent = newEntry; - entry.acceptChildren(this); - parent = oldParent; - } - - public void visitGroupEntry(GroupEntry entry) { - LogEntryContainer oldParent = parent; - GroupEntry newEntry = (GroupEntry) parent.findMember(entry.getName(), GroupEntry.class); - if (newEntry == null) { - newEntry = new GroupEntry(parent, entry.getName()); - } - parent = newEntry; - entry.acceptChildren(this); - parent = oldParent; - } - - public void visitTaskEntry(TaskEntry entry) { - TaskEntry newEntry = (TaskEntry) parent.findMember(entry.getName(), TaskEntry.class); - if (newEntry == null) { - newEntry = new TaskEntry(parent, entry.getName()); - } - Result[] results = entry.getResults(); - for (int i = 0; i < results.length; i++) { - newEntry.addResult(results[i]); - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java deleted file mode 100644 index 5f1a47f5a..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVDiffVisitor.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -public class PrintCSVDiffVisitor extends PrintDiffVisitor { - private static final String GROUP_DELIMITER = " / "; - private DelimitedValuesWriter writer; - private String caseName; - private String groupName; - - /** - * Creates a diff visitor that generates CSV output. - * - * @param writer the delimited values writer - * @see PrintDiffVisitor - */ - public PrintCSVDiffVisitor(DelimitedValuesWriter writer, RootEntry olderRoot, int threshold, boolean ignoreNegligible) { - super(olderRoot, threshold, ignoreNegligible); - this.writer = writer; - } - - protected void visitRootEntry(RootEntry entry, RootEntry olderEntry) { - entry.acceptChildren(this); - } - - protected void visitCaseEntry(CaseEntry entry, CaseEntry olderEntry) { - caseName = entry.getName(); - groupName = null; - entry.acceptChildren(this); - } - - protected void visitGroupEntry(GroupEntry entry, GroupEntry olderEntry) { - String oldGroupName = groupName; - if (groupName == null) { - groupName = entry.getName(); - } else { - groupName += GROUP_DELIMITER + entry.getName(); - } - entry.acceptChildren(this); - groupName = oldGroupName; - } - - protected void visitTaskEntry(TaskEntry entry, TaskEntry olderEntry) { - writer.printFields(new String[] { - caseName, // case - groupName, // group - entry.getName() // task - }); - printTaskEntry(entry); - printTaskEntry(olderEntry); - if (entry.getTotalRuns() != 0 && olderEntry.getTotalRuns() != 0) { - int olderMean = olderEntry.getAverageMillis(); - int diff = entry.getAverageMillis() - olderMean; - if (isDifferenceUncertain(entry, olderEntry)) { - writer.printField("UNCERTAIN"); - } else if (isDifferenceNegligible(entry, olderEntry)) { - writer.printField("NEGLIGIBLE"); - } else { - writer.printField(diff > 0 ? "SLOWER" : "FASTER"); // change type - } - writer.printField(Integer.toString(Math.abs(diff))); // change - if (olderMean != 0) { - writer.printField(Util.formatPercentageRatio(Math.abs(diff), olderMean)); // % change - } else { - writer.printField(""); - } - } else { - writer.printFields(new String[] { "", "", "" }); - } - writer.endRecord(); - } - - protected void printTaskEntry(TaskEntry entry) { - if (entry.getTotalRuns() != 0) { - int mean = entry.getAverageMillis(); - writer.printFields(new String[] { - Integer.toString(entry.getTotalRuns()), // runs - Integer.toString(mean) // average - }); - if (entry.getTotalRuns() > 1 && mean != 0) { - int confidence = entry.getConfidenceInterval(); - writer.printFields(new String[] { - Integer.toString(confidence), // 95% confidence interval - Util.formatPercentageRatio(confidence, mean) // 95% c.i. as a percentage - }); - } else { - writer.printFields(new String[] { "", "" }); - } - } else { - writer.printFields(new String[] { "0", "", "", "" }); - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java deleted file mode 100644 index 2ebf7cd7c..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintCSVSummaryVisitor.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -public class PrintCSVSummaryVisitor implements ILogEntryVisitor { - private static final String GROUP_DELIMITER = " / "; - private DelimitedValuesWriter writer; - private String caseName; - private String groupName; - - /** - * Creates a visitor to print a log as comma-separated values. - * @param writer the delimited values writer - */ - public PrintCSVSummaryVisitor(DelimitedValuesWriter writer) { - this.writer = writer; - } - - public void visitRootEntry(RootEntry entry) { - entry.acceptChildren(this); - } - - public void visitCaseEntry(CaseEntry entry) { - caseName = entry.getName(); - groupName = null; - entry.acceptChildren(this); - } - - public void visitGroupEntry(GroupEntry entry) { - String oldGroupName = groupName; - if (groupName == null) { - groupName = entry.getName(); - } else { - groupName += GROUP_DELIMITER + entry.getName(); - } - entry.acceptChildren(this); - groupName = oldGroupName; - } - - public void visitTaskEntry(TaskEntry entry) { - writer.printFields(new String[] { - caseName, // case - groupName, // group - entry.getName() // task - }); - if (entry.getTotalRuns() != 0) { - int mean = entry.getAverageMillis(); - writer.printFields(new String[] { - Integer.toString(entry.getTotalRuns()), // runs - Integer.toString(mean) // average - }); - if (entry.getTotalRuns() > 1 && mean != 0) { - int confidence = entry.getConfidenceInterval(); - writer.printFields(new String[] { - Integer.toString(confidence), // 95% confidence interval - Util.formatPercentageRatio(confidence, mean) // 95% c.i. as a percentage - }); - } else { - writer.printFields(new String[] { "", "" }); - } - } else { - writer.printFields(new String[] { "0", "", "", "" }); - } - // append the result fields (ms) - Result[] results = entry.getResults(); - for (int i = 0; i < results.length; i++) { - Result result = results[i]; - if (result.getRuns() == 0) continue; - writer.printField(Integer.toString(result.getMillis() / result.getRuns())); - } - writer.endRecord(); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java deleted file mode 100644 index 7a82f7a81..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffMain.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; - -import org.xml.sax.SAXException; - -public class PrintDiffMain { - public static void main(String[] args) { - Parser parser = new Parser(); - if (! parser.parse(args)) { - System.err.println("Usage: [-out ] [-csv] [-t ] [-i]"); - System.err.println(" -out : specify the output file, default is console"); - System.err.println(" -csv : produce comma separated values data"); - System.err.println(" -t : minimum non-negligible absolute % change"); - System.err.println(" -i : ignore negligible changes in results"); - return; - } - try { - PrintStream ps = System.out; - try { - if (parser.outputFile != null) ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(parser.outputFile))); - printDiff(ps, parser.newerLogFile, parser.olderLogFile, parser.csv, parser.thresh, parser.ignore); - } finally { - if (ps != System.out) ps.close(); - } - } catch (Exception e) { - System.err.println("An error occurred:"); - e.printStackTrace(); - return; - } - } - - private static void printDiff(PrintStream ps, File newerLogFile, File olderLogFile, - boolean csv, int thresh, boolean ignore) throws IOException, SAXException { - // read and merge newer log - RootEntry newerRoot = LogEntry.readLog(newerLogFile); - MergeRunsVisitor mergeVisitor = new MergeRunsVisitor(null); - newerRoot.accept(mergeVisitor); - newerRoot = mergeVisitor.getMergedRoot(); - - // read and merge older log - RootEntry olderRoot = LogEntry.readLog(olderLogFile); - olderRoot.accept(mergeVisitor); - olderRoot = mergeVisitor.getMergedRoot(); - - // format options - StringBuffer options = new StringBuffer(); - if (thresh != 0) { - options.append("-t "); - options.append(Integer.toString(thresh)); - options.append(" "); - } - if (ignore) options.append("-i "); - - // format log file - if (csv) { - DelimitedValuesWriter writer = new DelimitedValuesWriter(ps, ",", true /*quoted*/); - // print header - writer.printRecord(new String[] { "", "Newer", "Older" }); - writer.printRecord(new String[] { "Log File", newerLogFile.toString(), olderLogFile.toString() }); - writer.printRecord(new String[] { "Generated", newerRoot.getTimestamp(), olderRoot.getTimestamp() }); - writer.printRecord(new String[] { "SDK Build", newerRoot.getSDKBuildId(), olderRoot.getSDKBuildId() }); - writer.endRecord(); - writer.printRecord(new String[] { "Options", "'" + options.toString() }); - writer.endRecord(); - writer.printRecord(new String[] { "", "", "", - "Newer", "", "", "", - "Older", "", "", "", - "", "", "" }); - writer.printRecord(new String[] { "Case", "Group", "Task", - "Runs", "Avg. (ms)", "95% C.I. (ms)", "95% C.I. (%)", - "Runs", "Avg. (ms)", "95% C.I. (ms)", "95% C.I. (%)", - "Change", "Diff (ms)", "Diff (%)" }); - // print quoted CSV data - PrintCSVDiffVisitor diffVisitor = new PrintCSVDiffVisitor(writer, olderRoot, thresh, ignore); - newerRoot.accept(diffVisitor); - } else { - // print header - ps.println("=== LOG DIFF ==="); - ps.println("Newer File: " + newerLogFile); - ps.println(" Generated: " + newerRoot.getTimestamp()); - ps.println(" SDK Build: " + newerRoot.getSDKBuildId()); - ps.println("Older File: " + olderLogFile); - ps.println(" Generated: " + olderRoot.getTimestamp()); - ps.println(" SDK Build: " + olderRoot.getSDKBuildId()); - ps.println("Options: " + options.toString()); - ps.println(); - // compute and print the differences - PrintTextDiffVisitor diffVisitor = new PrintTextDiffVisitor(ps, olderRoot, thresh, ignore); - newerRoot.accept(diffVisitor); - } - } - - private static class Parser extends ArgumentParser { - public File newerLogFile = null; - public File olderLogFile = null; - public File outputFile = null; - public boolean csv = false; - public int thresh = 0; - public boolean ignore = false; - - protected boolean handleFinished() { - return newerLogFile != null && olderLogFile != null; - } - protected boolean handleArgument(int index, String arg) { - if (index == 0) { - newerLogFile = new File(arg); - } else if (index == 1) { - olderLogFile = new File(arg); - } else { - return false; - } - return true; - } - protected boolean handleOption(String option, String arg) { - if ("-out".equals(option)) { - if (arg == null) return false; - outputFile = new File(arg); - } else if ("-csv".equals(option)) { - if (arg != null) return false; - csv = true; - } else if ("-t".equals(option)) { - if (arg == null) return false; - try { - thresh = Integer.parseInt(arg, 10); - } catch (NumberFormatException e) { - return false; - } - if (thresh < 0) return false; - } else if ("-i".equals(option)) { - if (arg != null) return false; - ignore = true; - } else { - return false; - } - return true; - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java deleted file mode 100644 index a75150735..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintDiffVisitor.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -public abstract class PrintDiffVisitor implements ILogEntryVisitor { - protected RootEntry olderRoot; - protected int threshold; // threshold for negligible changes - protected boolean ignoreNegligible; // if true, ignores negligible changes - protected LogEntryContainer olderParent; // corresponding parent in older root - - /** - * Creates a visitor to print a summary of the changes between a log - * and an older one. Optionally ignores differences within a certain threshold. - * Does not print older entries for which there are no corresponding newer ones. - * - * @param olderRoot the root of the older log - * @param threshold the minimum non-negligible % change - * @param ignoreNegligible if true, does not display negligible changes - */ - public PrintDiffVisitor(RootEntry olderRoot, int threshold, boolean ignoreNegligible) { - this.olderRoot = olderRoot; - this.olderParent = null; - this.threshold = threshold; - this.ignoreNegligible = ignoreNegligible; - } - - protected abstract void visitRootEntry(RootEntry entry, RootEntry olderEntry); - protected abstract void visitCaseEntry(CaseEntry entry, CaseEntry olderEntry); - protected abstract void visitGroupEntry(GroupEntry entry, GroupEntry olderEntry); - protected abstract void visitTaskEntry(TaskEntry entry, TaskEntry olderEntry); - - public void visitRootEntry(RootEntry entry) { - olderParent = olderRoot; - visitRootEntry(entry, olderRoot); - } - - public void visitCaseEntry(CaseEntry entry) { - LogEntryContainer prevOlderParent = olderParent; - if (olderParent != null) { - olderParent = (LogEntryContainer) olderParent.findMember(entry.getName(), CaseEntry.class); - } - visitCaseEntry(entry, (CaseEntry) olderParent); - olderParent = prevOlderParent; - } - - public void visitGroupEntry(GroupEntry entry) { - LogEntryContainer prevOlderParent = olderParent; - if (olderParent != null) { - olderParent = (LogEntryContainer) olderParent.findMember(entry.getName(), GroupEntry.class); - } - visitGroupEntry(entry, (GroupEntry) olderParent); - olderParent = prevOlderParent; - } - - public void visitTaskEntry(TaskEntry entry) { - TaskEntry olderEntry = null; - if (olderParent != null) { - olderEntry = (TaskEntry) olderParent.findMember(entry.getName(), TaskEntry.class); - } - if (ignoreNegligible && isDifferenceNegligible(entry, olderEntry)) return; - visitTaskEntry(entry, olderEntry); - } - - protected boolean isDifferenceNegligible(TaskEntry newerEntry, TaskEntry olderEntry) { - if (newerEntry.getTotalRuns() == 0 || olderEntry.getTotalRuns() == 0) return false; - int olderMean = olderEntry.getAverageMillis(); - if (olderMean == 0) return false; - int newerMean = newerEntry.getAverageMillis(); - int diff = Math.abs(newerMean - olderMean); - return diff * 100 / olderMean < threshold; - } - - protected boolean isDifferenceUncertain(TaskEntry newerEntry, TaskEntry olderEntry) { - if (newerEntry.getTotalRuns() == 0 || olderEntry.getTotalRuns() == 0) return false; - int olderMean = olderEntry.getAverageMillis(); - int newerMean = newerEntry.getAverageMillis(); - int diff = Math.abs(newerMean - olderMean); - int diffCI = newerEntry.getConfidenceInterval() + olderEntry.getConfidenceInterval(); - return diff < diffCI; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java deleted file mode 100644 index 91e1acfa3..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintSummaryMain.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; - -import org.xml.sax.SAXException; - -public class PrintSummaryMain { - public static void main(String[] args) { - Parser parser = new Parser(); - if (! parser.parse(args)) { - System.err.println("Usage: [-out ] [-csv] [-raw]"); - System.err.println(" -out : specify the output file, default is console"); - System.err.println(" -csv : produce comma separated values data"); - System.err.println(" -raw : do not merge results from successive iterations"); - return; - } - try { - PrintStream ps = System.out; - try { - if (parser.outputFile != null) ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(parser.outputFile))); - printLog(ps, parser.logFile, parser.csv, parser.raw); - } finally { - if (ps != System.out) ps.close(); - } - } catch (Exception e) { - System.err.println("An error occurred:"); - e.printStackTrace(); - return; - } - } - - private static void printLog(PrintStream ps, File logFile, boolean csv, boolean raw) - throws IOException, SAXException { - // read and merge the log - RootEntry root = LogEntry.readLog(logFile); - if (! raw) { - MergeRunsVisitor mergeVisitor = new MergeRunsVisitor(null); - root.accept(mergeVisitor); - root = mergeVisitor.getMergedRoot(); - } - - // format options - StringBuffer options = new StringBuffer(); - if (raw) options.append("-raw "); - - // format log file - if (csv) { - DelimitedValuesWriter writer = new DelimitedValuesWriter(ps, ",", true /*quoted*/); - // print header - writer.printRecord(new String[] { "Log File", logFile.toString() }); - writer.printRecord(new String[] { "Generated", root.getTimestamp() }); - writer.printRecord(new String[] { "SDK Build", root.getSDKBuildId() }); - writer.endRecord(); - writer.printRecord(new String[] { "Options", "'" + options.toString() }); - writer.endRecord(); - writer.printRecord(new String[] { "Case", "Group", "Task", - "Runs", "Avg. (ms)", "95% C.I. (ms)", "95% C.I. (%)", "Results (ms)" }); - // print quoted CSV data - PrintCSVSummaryVisitor visitor = new PrintCSVSummaryVisitor(writer); - root.accept(visitor); - } else { - // print header - ps.println("=== LOG SUMMARY ==="); - ps.println("File: " + logFile); - ps.println(" Generated: " + root.getTimestamp()); - ps.println(" SDK Build: " + root.getSDKBuildId()); - ps.println("Options: " + options.toString()); - ps.println(); - // print the log summary - root.accept(new PrintTextSummaryVisitor(ps)); - } - } - - private static class Parser extends ArgumentParser { - public File logFile = null; - public File outputFile = null; - public boolean csv = false; - public boolean raw = false; - - protected boolean handleFinished() { - return logFile != null; - } - protected boolean handleArgument(int index, String arg) { - if (index == 0) { - logFile = new File(arg); - } else { - return false; - } - return true; - } - protected boolean handleOption(String option, String arg) { - if ("-out".equals(option)) { - if (arg == null) return false; - outputFile = new File(arg); - } else if ("-csv".equals(option)) { - if (arg != null) return false; - csv = true; - } else if ("-raw".equals(option)) { - if (arg != null) return false; - raw = true; - } else { - return false; - } - return true; - } - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java deleted file mode 100644 index e88c65dd0..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextDiffVisitor.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.PrintStream; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -public class PrintTextDiffVisitor extends PrintDiffVisitor { - private PrintStream os; - private List diffText; // list of things to print - private String indent; - - /** - * Creates a diff visitor that generates text output. - * - * @param os the output stream - * @see PrintDiffVisitor - */ - public PrintTextDiffVisitor(PrintStream os, RootEntry olderRoot, int threshold, boolean ignoreNegligible) { - super(olderRoot, threshold, ignoreNegligible); - this.os = os; - this.diffText = null; - this.indent = ""; - } - - protected void visitRootEntry(RootEntry entry, RootEntry olderEntry) { - entry.acceptChildren(this); - } - - protected void visitCaseEntry(CaseEntry entry, CaseEntry olderEntry) { - String oldIndent = indent; - indent += " "; - StringBuffer line = new StringBuffer(indent); - line.append("%%% "); - line.append(entry.getName()); - line.append(", class="); - line.append(entry.getClassName()); - line.append(':'); - os.println(line); - diffText = null; - entry.acceptChildren(this); - if (diffText != null) { - Iterator it = diffText.iterator(); - while (it.hasNext()) os.println((String) it.next()); - } - diffText = null; - os.println(); - indent = oldIndent; - } - - protected void visitGroupEntry(GroupEntry entry, GroupEntry olderEntry) { - String oldIndent = indent; - List oldDiffText = diffText; - indent += " "; - diffText = null; - entry.acceptChildren(this); - indent = oldIndent; - if (diffText != null) { - StringBuffer line = new StringBuffer(indent); - line.append("+ "); - line.append(entry.getName()); - line.append(':'); - diffText.add(0, line.toString()); - if (oldDiffText != null) diffText.addAll(0, oldDiffText); - } else { - diffText = oldDiffText; - } - } - - protected void visitTaskEntry(TaskEntry entry, TaskEntry olderEntry) { - // print task description - if (diffText == null) diffText = new LinkedList(); // using a list for speedy prepending - StringBuffer line = new StringBuffer(indent); - line.append("- "); - line.append(entry.getName()); - line.append(": "); - diffText.add(line.toString()); - - // print new entry performance - printTaskEntry(" newer: ", entry); - - // print older entry performance - if (olderEntry == null) return; - printTaskEntry(" older: ", olderEntry); - - // print difference - if (entry.getTotalRuns() == 0 || olderEntry.getTotalRuns() == 0) return; - int olderMean = olderEntry.getAverageMillis(); - int diff = entry.getAverageMillis() - olderMean; - line = new StringBuffer(indent); - line.append(" diff : "); - - if (isDifferenceUncertain(entry, olderEntry)) { - line.append("UNCERTAIN"); - } else if (isDifferenceNegligible(entry, olderEntry)) { - line.append("NEGLIGIBLE"); - } else { - line.append(diff > 0 ? "SLOWER" : "FASTER"); - line.append(" by "); - line.append(Integer.toString(Math.abs(diff))); - line.append(" ms"); - if (olderEntry.getAverageMillis() != 0) { - line.append(" = "); - line.append(Util.formatPercentageRatio(Math.abs(diff), olderMean)); - } - line.append(" avg."); - } - diffText.add(line.toString()); - } - - protected void printTaskEntry(String prefix, TaskEntry task) { - StringBuffer line = new StringBuffer(indent); - line.append(prefix); - if (task.getTotalRuns() != 0) { - int averageTime = task.getAverageMillis(); - line.append(Integer.toString(averageTime)); - line.append(" ms"); - if (task.getTotalRuns() > 1) { - line.append(" avg. over "); - line.append(Integer.toString(task.getTotalRuns())); - line.append(" runs"); - if (averageTime != 0) { - int confidence = task.getConfidenceInterval(); - line.append(" (95% C.I. +/- "); - line.append(Integer.toString(confidence)); - line.append(" ms = "); - line.append(Util.formatPercentageRatio(confidence, averageTime)); - line.append(")"); - } - } - } else { - line.append("skipped!"); - } - diffText.add(line.toString()); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java deleted file mode 100644 index 140366165..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/PrintTextSummaryVisitor.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.PrintStream; - -public class PrintTextSummaryVisitor implements ILogEntryVisitor { - private PrintStream os; - private String indent; - private int totalAverageTime; - - /** - * Creates a visitor to print a summary of all entries contained in a log. - * @param os the output stream - */ - public PrintTextSummaryVisitor(PrintStream os) { - this.os = os; - this.indent = ""; - this.totalAverageTime = 0; - } - - protected void visitContainer(LogEntryContainer container) { - int oldTotalAverageTime = totalAverageTime; - indent += " "; - container.acceptChildren(this); - int averageTime = totalAverageTime - oldTotalAverageTime; - StringBuffer line = new StringBuffer(indent); - line.append("* total: "); - line.append(Integer.toString(averageTime)); - line.append(" ms"); - os.println(line); - indent = indent.substring(2); - } - - /** - * Prints the root entry information. - */ - public void visitRootEntry(RootEntry entry) { - entry.acceptChildren(this); - } - - /** - * Prints the total average time spent by all subgroups and subtasks. - */ - public void visitCaseEntry(CaseEntry entry) { - StringBuffer line = new StringBuffer(indent); - line.append("%%% "); - line.append(entry.getName()); - line.append(", class="); - line.append(entry.getClassName()); - line.append(':'); - os.println(line); - visitContainer(entry); - os.println(); - } - - /** - * Prints the total average time spent by all subtasks. - */ - public void visitGroupEntry(GroupEntry entry) { - StringBuffer line = new StringBuffer(indent); - line.append("+ "); - line.append(entry.getName()); - line.append(':'); - os.println(line); - visitContainer(entry); - } - - /** - * Prints the average amount of time spent by a task. - */ - public void visitTaskEntry(TaskEntry task) { - StringBuffer line = new StringBuffer(indent); - line.append("- "); - line.append(task.getName()); - line.append(": "); - if (task.getTotalRuns() != 0) { - int averageTime = task.getAverageMillis(); - totalAverageTime += averageTime; - line.append(Integer.toString(averageTime)); - line.append(" ms"); - if (task.getTotalRuns() > 1) { - line.append(" avg. over "); - line.append(Integer.toString(task.getTotalRuns())); - line.append(" runs"); - if (averageTime != 0) { - int confidence = task.getConfidenceInterval(); - line.append(" (95% C.I. +/- "); - line.append(Integer.toString(confidence)); - line.append(" ms = "); - line.append(Util.formatPercentageRatio(confidence, averageTime)); - line.append(")"); - } - } - } else { - line.append("skipped!"); - } - os.println(line); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java deleted file mode 100644 index af36f54e2..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Result.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.xml.sax.Attributes; - -/** - * Holds the result of one iteration of tests. - * Note that a test might be run multiple times per iteration, particularly if it - * is of very short duration to reduce sampling error. This behaviour is not supported - * at this time, but will likely be of value in the future. - */ -public class Result { - private int runs; - private int millis; - - public Result(Attributes attributes) { - this(1, Integer.parseInt(attributes.getValue("elapsed"))); - } - public Result(int runs, int millis) { - this.runs = runs; - this.millis = millis; - } - public int getRuns() { - return runs; - } - public int getMillis() { - return millis; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java deleted file mode 100644 index 914669176..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/RootEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.xml.sax.Attributes; - -public class RootEntry extends LogEntryContainer { - private String sdkBuildId; - private String timestamp; - - public RootEntry(LogEntryContainer parent, Attributes attributes) { - this(parent, attributes.getValue("name"), - attributes.getValue("sdkbuild"), attributes.getValue("timestamp")); - } - - public RootEntry(LogEntryContainer parent, String name, String sdkBuildId, String timestamp) { - super(parent, name); - this.sdkBuildId = (sdkBuildId != null) ? sdkBuildId : "unknown"; - this.timestamp = (timestamp != null) ? timestamp : "unknown"; - } - - public void accept(ILogEntryVisitor visitor) { - visitor.visitRootEntry(this); - } - - /** - * Returns the SDK Build id. - */ - public String getSDKBuildId() { - return sdkBuildId; - } - - /** - * Returns the class name of the test case. - */ - public String getTimestamp() { - return timestamp; - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java deleted file mode 100644 index ac08e64d1..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/TaskEntry.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.xml.sax.Attributes; - -public class TaskEntry extends LogEntry { - private List /* of Result */ results = new ArrayList(); - - public TaskEntry(LogEntryContainer parent, Attributes attributes) { - this(parent, attributes.getValue("name")); - } - - public TaskEntry(LogEntryContainer parent, String name) { - super(parent, name); - } - - public void accept(ILogEntryVisitor visitor) { - visitor.visitTaskEntry(this); - } - - /** - * Returns the average number of milliseconds elapsed, or -1 if unknown. - */ - public int getAverageMillis() { - int totalMillis = 0; - int totalRuns = 0; - for (Iterator it = results.iterator(); it.hasNext();) { - Result result = (Result) it.next(); - totalMillis += result.getMillis(); - totalRuns += result.getRuns(); - } - if (totalRuns == 0) return -1; - return totalMillis / totalRuns; - } - - /** - * Returns the standard deviation of the sample. - * sqrt((n * sum(X^2) - sum(X)^2) / (n * (n-1))) - */ - public double getStandardDeviation() { - double sumOfSquares = 0.0, sum = 0.0; - int totalRuns = 0; - for (Iterator it = results.iterator(); it.hasNext();) { - Result result = (Result) it.next(); - if (result.getRuns() == 0) continue; - totalRuns += result.getRuns(); - sum += result.getMillis(); - double average = (double)result.getMillis() / result.getRuns(); - sumOfSquares += average * average * result.getRuns(); - } - if (totalRuns == 0) return 0; - return Math.sqrt((sumOfSquares * totalRuns - sum * sum) / (totalRuns * (totalRuns - 1))); - } - - /** - * Returns a 95% confidence interval from the mean represented by getAverageMillis() - * Uses the formula: - * 1.960 * stdev() / sqrt(n) - */ - public int getConfidenceInterval() { - return (int) (1.960 * getStandardDeviation() / Math.sqrt(getTotalRuns())); - } - - /** - * Returns the number of times this task was run. - */ - public int getTotalRuns() { - int totalRuns = 0; - for (Iterator it = results.iterator(); it.hasNext();) { - Result result = (Result) it.next(); - totalRuns += result.getRuns(); - } - return totalRuns; - } - - /** - * Returns an array of all Results for this task. - */ - public Result[] getResults() { - return (Result[]) results.toArray(new Result[results.size()]); - } - - /** - * Adds a result. - * @param result the result - */ - public void addResult(Result result) { - results.add(result); - } - - -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java deleted file mode 100644 index 10d38f8ba..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/logformatter/Util.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.eclipse.team.tests.ccvs.ui.logformatter; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.text.DecimalFormat; -import java.text.NumberFormat; - -public class Util { - private static final NumberFormat percentageFormat = new DecimalFormat("####0.00%"); - - public static String formatPercentageRatio(int numerator, int denominator) { - return percentageFormat.format((double)numerator / denominator); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java deleted file mode 100644 index c4dab7308..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/unit/MenuEnablementTest.java +++ /dev/null @@ -1,526 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial implementation - ******************************************************************************/ -package org.eclipse.team.tests.ccvs.ui.unit; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer; -import org.eclipse.team.internal.ccvs.ui.actions.AddAction; -import org.eclipse.team.internal.ccvs.ui.actions.BranchAction; -import org.eclipse.team.internal.ccvs.ui.actions.CommitAction; -import org.eclipse.team.internal.ccvs.ui.actions.CompareWithRemoteAction; -import org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction; -import org.eclipse.team.internal.ccvs.ui.actions.CompareWithTagAction; -import org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction; -import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction; -import org.eclipse.team.internal.ccvs.ui.actions.MergeAction; -import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction; -import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction; -import org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction; -import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction; -import org.eclipse.team.internal.ccvs.ui.actions.SyncAction; -import org.eclipse.team.internal.ccvs.ui.actions.TagAction; -import org.eclipse.team.internal.ccvs.ui.actions.UnmanageAction; -import org.eclipse.team.internal.ccvs.ui.actions.UpdateAction; -import org.eclipse.team.tests.ccvs.core.CVSTestSetup; -import org.eclipse.team.tests.ccvs.core.EclipseTest; -import org.eclipse.ui.IActionDelegate; - -/** - * Test the menu enablement code for the CVS menus - */ -public class MenuEnablementTest extends EclipseTest { - - private static final int MANAGED = 1; - private static final int ADDED = 2; - private static final int UNMANAGED = 4; - private static final int IGNORED = 8; - private static final int SINGLE_ONLY = 16; - private static final int FOLDERS = 32; - private static final int FILES = 64; - private static final int UNMANAGED_PARENT = 128; - - /** - * Constructor for CVSProviderTest - */ - public MenuEnablementTest() { - super(); - } - - /** - * Constructor for CVSProviderTest - */ - public MenuEnablementTest(String name) { - super(name); - } - - public static Test suite() { - TestSuite suite = new TestSuite(MenuEnablementTest.class); - return new CVSTestSetup(suite); - //return new CVSTestSetup(new MenuEnablementTest("testReadOnly")); - } - - /** - * Create a test project for the given action delegate. The structure of - * this test project is used by the get resource methods to return resources - * of the proper type. - * - * @param actionDelegate * @throws CoreException * @throws TeamException */ - private IProject createTestProject(IActionDelegate actionDelegate) throws CoreException, TeamException { - String actionName = getName(actionDelegate); - return createProject(actionName, new String[] { "file.txt", "folder1/", "folder1/a.txt" }); - } - - private List getManagedResources(IProject testProject, boolean includeFolders, boolean multiple) { - List result = new ArrayList(); - if (includeFolders) { - result.add(testProject.getFolder("folder1")); - } else { - result.add(testProject.getFile("folder1/a.txt")); - } - if (multiple) { - result.add(testProject.getFile("file.txt")); - } - return result; - } - - private List getAddedResources(IProject testProject) throws CoreException, TeamException { - List result = new ArrayList(); - IFile file = testProject.getFile("added.txt"); - if (!file.exists()) { - addResources(testProject, new String[] {"added.txt"}, false); - } - result.add(file); - return result; - } - - private List getIgnoredResources(IProject testProject) throws CoreException, TeamException { - List result = new ArrayList(); - IFile file = testProject.getFile("ignored.txt"); - if (!file.exists()) { - file.create(getRandomContents(), false, null); - } - result.add(file); - IFile ignoreFile = testProject.getFile(".cvsignore"); - InputStream contents = new ByteArrayInputStream("ignored.txt".getBytes()); - if (ignoreFile.exists()) { - ignoreFile.setContents(contents, false, false, null); - } else { - ignoreFile.create(contents, false, null); - } - return result; - } - - private List getUnmanagedResources(IProject testProject) throws CoreException, TeamException { - List result = new ArrayList(); - IFile file = testProject.getFile("unmanaged.txt"); - if (!file.exists()) { - file.create(getRandomContents(), false, null); - } - result.add(file); - return result; - } - - /** - * Method getResourceWithUnmanagedParent. - * @param project - * @return Collection - */ - private List getResourceWithUnmanagedParent(IProject project) throws CoreException { - List result = new ArrayList(); - IFolder folder = project.getFolder("newFolder"); - if(!folder.exists()) folder.create(false, true, null); - IFile file = folder.getFile("unmanaged.txt"); - if (!file.exists()) { - file.create(getRandomContents(), false, null); - } - result.add(file); - return result; - } - - private List getOverlappingResources(IProject testProject, boolean includeFiles) { - List result = new ArrayList(); - result.add(testProject); - result.add(testProject.getFolder("folder1")); - if (includeFiles) { - result.add(testProject.getFile("folder1/a.txt")); - } - return result; - } - - private ISelection asSelection(List resources) { - return new StructuredSelection(resources); - } - - private String getName(IActionDelegate actionDelegate) { - return actionDelegate.getClass().getName(); - } - - /** - * Assert that the enablement for the given IActionDelegate and ISelection - * match that provided as expectedEnablement. - * - * @param actionDelegate * @param selection * @param expectedEnablement */ - private void assertEnablement(IActionDelegate actionDelegate, ISelection selection, boolean expectedEnablement) { - IAction action = new Action() {}; - actionDelegate.selectionChanged(action, selection); - assertEquals(getName(actionDelegate) + " enablement wrong!", expectedEnablement, action.isEnabled()); - } - - /** - * Method assertEnablement. - * @param action - * @param project - * @param IGNORED - * @param b - */ - private void assertEnablement(IActionDelegate action, IProject project, int kind, boolean expectedEnablement) throws CoreException, TeamException { - List resources = new ArrayList(); - boolean multiple = (kind & SINGLE_ONLY) == 0; - boolean includeFolders = ((kind & FOLDERS) > 0) || ((kind & FILES) == 0); - if ((kind & MANAGED) > 0) { - resources.addAll(getManagedResources(project, includeFolders, multiple)); - } - if ((kind & UNMANAGED) > 0) { - resources.addAll(getUnmanagedResources(project)); - } - if ((kind & IGNORED) > 0) { - resources.addAll(getIgnoredResources(project)); - } - if ((kind & ADDED) > 0) { - resources.addAll(getAddedResources(project)); - } - if ((kind & UNMANAGED_PARENT) > 0) { - resources.addAll(getResourceWithUnmanagedParent(project)); - } - ensureAllSyncInfoLoaded(project); - assertEnablement(action, asSelection(resources), expectedEnablement); - } - - /** - * Method ensureAllSyncInfoLoaded. - * @param project - */ - private void ensureAllSyncInfoLoaded(IProject project) throws CVSException { - EclipseSynchronizer.getInstance().ensureSyncInfoLoaded(new IResource[] {project}, IResource.DEPTH_INFINITE); - } - - /** - * Assert that the action is disabled for the reasons common to all menu - * actions. - * - * @param action - * @param project - */ - public void assertDisabledForCommonReasons(IActionDelegate action, IProject project) throws CoreException { - assertDisabledForNoSelection(action); - assertDisabledForFolderFileOverlap(action, project); - assertDisabledForClosedProject(action, project); - assertDisabledForNonCVSProject(action); - } - - private void assertDisabledForNoSelection(IActionDelegate actionDelegate) { - assertEnablement(actionDelegate, StructuredSelection.EMPTY, false /* expected enablement */); - } - - private void assertDisabledForFolderFileOverlap(IActionDelegate action, IProject project) { - List resources = getOverlappingResources(project, true /* include files */); - assertEnablement(action, asSelection(resources), false /* enabled */); - } - - private void assertDisabledForClosedProject(IActionDelegate action, IProject project) throws CoreException { - project.close(null); - List resources = new ArrayList(); - resources.add(project); - assertEnablement(action, asSelection(resources), false /* enabled */); - project.open(null); - } - - private void assertDisabledForNonCVSProject(IActionDelegate action) throws CoreException { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Non-CVS"); - if (!project.exists()) - project.create(null); - List resources = new ArrayList(); - resources.add(project); - assertEnablement(action, asSelection(resources), false /* enabled */); - } - - private void assertEnabledForFolderOnlyOverlap(IActionDelegate action, IProject project) { - List resources = getOverlappingResources(project, false /* include files */); - assertEnablement(action, asSelection(resources), true /* enabled */); - } - - public void testAddAction() throws CoreException, TeamException { - IActionDelegate action = new AddAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnablement(action, project, MANAGED, false /* expected enablement */); - assertEnablement(action, project, ADDED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | IGNORED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, true /* expected enablement */); - } - - public void testBranchAction() throws CoreException, TeamException { - IActionDelegate action = new BranchAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - } - - public void testCommitAction() throws CoreException, TeamException { - IActionDelegate action = new CommitAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, true /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, true /* expected enablement */); - } - - public void testCompareWithRemoteAction() throws CoreException, TeamException { - IActionDelegate action = new CompareWithRemoteAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, true /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, IGNORED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, true /* expected enablement */); - } - - public void testCompareWithRevison() throws CoreException, TeamException { - IActionDelegate action = new CompareWithRevisionAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnablement(action, project, MANAGED | FILES | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, MANAGED | FOLDERS | FILES, false /* expected enablement */); - assertEnablement(action, project, MANAGED | FOLDERS | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, MANAGED | FILES, false /* expected enablement */); - assertEnablement(action, project, ADDED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, IGNORED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - } - - public void testCompareWithTagAction() throws CoreException, TeamException { - IActionDelegate action = new CompareWithTagAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - } - - public void testGenerateDiffAction() throws CoreException, TeamException { - IActionDelegate action = new GenerateDiffFileAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnablement(action, project, MANAGED | FILES | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, MANAGED | FOLDERS | FILES, false /* expected enablement */); - assertEnablement(action, project, MANAGED | FOLDERS | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, MANAGED | FILES, false /* expected enablement */); - assertEnablement(action, project, ADDED | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, IGNORED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - } - - /* - * Should be the same as testAdd */ - public void testIgnoreAction() throws CoreException, TeamException { - IActionDelegate action = new IgnoreAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnablement(action, project, MANAGED, false /* expected enablement */); - assertEnablement(action, project, ADDED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, true /* expected enablement */); - } - - public void testMergeAction() throws CoreException, TeamException { - IActionDelegate action = new MergeAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - } - - public void testReplaceWithRemoteAction() throws CoreException, TeamException { - IActionDelegate action = new ReplaceWithRemoteAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, false /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - } - - /* - * Should be the same as testCompareWithTagAction - */ - public void testReplaceWithTagAction() throws CoreException, TeamException { - IActionDelegate action = new ReplaceWithTagAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - } - - public void testKeywordSubstitutionAction() throws CoreException, TeamException { - IActionDelegate action = new SetKeywordSubstitutionAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - } - - public void testShowInHistory() throws CoreException, TeamException { - IActionDelegate action = new ShowResourceInHistoryAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnablement(action, project, MANAGED | FILES | SINGLE_ONLY, true /* expected enablement */); - assertEnablement(action, project, MANAGED | FOLDERS | FILES, false /* expected enablement */); - assertEnablement(action, project, MANAGED | FOLDERS | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, MANAGED | FILES, false /* expected enablement */); - assertEnablement(action, project, ADDED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, IGNORED | SINGLE_ONLY, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - } - - public void testSyncAction() throws CoreException, TeamException { - IActionDelegate action = new SyncAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, true /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, IGNORED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED, true /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - // true is expected for ignored resources whose parent is not ignored - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, true /* expected enablement */); - } - - public void testTagAction() throws CoreException, TeamException { - IActionDelegate action = new TagAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, false /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - } - - public void testUnmanageAction() throws CoreException, TeamException { - IActionDelegate action = new UnmanageAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - List resources = new ArrayList(); - resources.add(project); - ensureAllSyncInfoLoaded(project); - assertEnablement(action, asSelection(resources), true); - } - - public void testUpdateAction() throws CoreException, TeamException { - IActionDelegate action = new UpdateAction(); - IProject project = createTestProject(action); - assertDisabledForCommonReasons(action, project); - assertEnabledForFolderOnlyOverlap(action, project); - assertEnablement(action, project, MANAGED, true /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED, false /* expected enablement */); - assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, false /* expected enablement */); - assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */); - } -} diff --git a/tests/org.eclipse.team.tests.cvs.core/test.xml b/tests/org.eclipse.team.tests.cvs.core/test.xml deleted file mode 100644 index 166f55123..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/test.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3